Popular Posts
Enable SSL connection for Jsoup import org.jsoup.Connection; import org.jsoup.Jsoup; import javax.net.ssl.*; import java.io.IOException; import java.security.KeyManagement... Build an OpenVPN server on android device Preparation An android device, in this case, Sony xperia Z is used Root permission required Linux Deploy for deploy i... LogonUser Function : impersonate a windows user // This sample demonstrates the use of the WindowsIdentity class to impersonate a user. // IMPORTANT NOTES:  // This sample can be run only ...
Blog Archive
Stats
Query index data
1. Start window service Indexing Service
2. Create a new category and start indexing.
class Program
{
    static void Main(string[] args)
    {
        // reference : http://msdn.microsoft.com/en-us/library/ms690516
        string strCatalog = "TestIndexing";
        string strKeyword = "readme";  // search keyword
        string strQuery = string.Format(
            @"SELECT path, FileName, size, write, attrib FROM SCOPE() WHERE FREETEXT('{0}')",
            //@"SELECT * FROM FILEINFO WHERE FREETEXT('{0}')",
            strKeyword
        );
 
        string connstring = "Provider=MSIDXS.1;Integrated Security .='';Data Source=" + strCatalog;
 
        DataSet set = null;
        try
        {
            using (OleDbDataAdapter adapter = new OleDbDataAdapter(strQuery, connstring))
            {
                adapter.Fill(set = new DataSet());
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
            return;
        }
 
        foreach (DataRow row in set.Tables[0].Rows)
        {
            Console.WriteLine("{0} |{1} @{2}", row["FileName"], row["size"], row["write"]);
        }
        Console.Read();
    }
}