Witam,
Napisałem programik, który przeszukuje lokalne katalogi wykorzystując Windows Search API. Nie mogę sobie jednak poradzić z rozszerzeniem zakresu szukania na inne komputery w sieci. Poniżej zamieszam kod, z którego korzystam, obsługujac to API. Wie ktoś jak moge rozwiązać ten problem?.
Z góry dzięki.
CSearchManager manager = new CSearchManager();
// the SystemIndex catalog is the default catalog that windows uses
CSearchCatalogManager catalogManager = manager.GetCatalog("SystemIndex");
// get the ISearchQueryHelper which will help us to translate AQS --> SQL necessary to query the indexer
CSearchQueryHelper queryHelper = catalogManager.GetQueryHelper();
queryHelper.QueryWhereRestrictions = "AND scope='file:" + strPath + "'";
string sqlQuery = queryHelper.GenerateSQLFromUserQuery(strContent);
// --- Perform the query ---
// create an OleDbConnection object which connects to the indexer provider with the windows application
System.Data.OleDb.OleDbConnection conn = new OleDbConnection(queryHelper.ConnectionString);
try
{
// open it
conn.Open();
// now create an OleDB command object with the query we built above and the connection we just opened.
OleDbCommand command = new OleDbCommand(sqlQuery, conn);
// execute the command, which returns the results as an OleDbDataReader.
OleDbDataReader WDSResults = command.ExecuteReader();
{...}
WDSResults.Close();
}
catch (Exception e)
{
}
finally
{
conn.Close();
}