| SphinxClientQuery Method |
Namespace: SphinxConnector.NativeApi
public SphinxSearchResult Query( string query, string indexName = "*", string comment = "" )
| Exception | Condition |
|---|---|
| ArgumentNullException | Parameter query or indexName is null. |
| ArgumentException | Parameter query or indexName is empty. |
| InvalidOperationException |
There are queries which have been added via AddQuery(String, String, String), but have
not yet been executed. Use RunQueries to execute these queries. -or- SortMode has been set to a value other than Relevance, but SortBy is empty. -or- SortMode has been set to Relevance, but SortBy is not empty. |
| SphinxClientException | An error occured while executing the query. See exception message and inner exception for details. |
SphinxClient sphinxClient = new SphinxClient(); //Use SphinxClient with the default options. SphinxSearchResult result = sphinxClient.Query("query", "myindex", "comment"); foreach (SphinxMatch match in result.Matches) { Console.WriteLine("DocumentId {0} Weight {1}", match.DocumentId, match.Weight); }
SphinxClient sphinxClient = new SphinxClient(); //Use SphinxClient with the default options. SphinxSearchResult result = sphinxClient.Query("query", "myindex, myOtherIndex");