Query searchd with SphinxQL.
Namespace: Gronewold.SphinxConnectorAssembly: Gronewold.SphinxConnector (in Gronewold.SphinxConnector.dll) Version: 2.8.0.26312 (2.8.0.26312)
Syntax
| C# |
|---|
[ObsoleteAttribute("SphinxQL queries will longer be supported with Sphinx 2.0.1. Please use the classes from the SphinxQL namespace to access Sphinx via SphinxQL.")] public SphinxSearchResult QueryWithSphinxQL( string query ) |
| Visual Basic |
|---|
<ObsoleteAttribute("SphinxQL queries will longer be supported with Sphinx 2.0.1. Please use the classes from the SphinxQL namespace to access Sphinx via SphinxQL.")> _ Public Function QueryWithSphinxQL ( _ query As String _ ) As SphinxSearchResult |
Parameters
- query
- Type: System..::..String
The query to execute.
Return Value
An instance of the SphinxSearchResult class with the query result.
Remarks
Note that the options given by the SearchOptions property are not
applied to SphinxQL queries. Use OPTIONS optionname=value in the query instead.
Examples
SphinxClient sphinxClient = new SphinxClient(); SphinxSearchResult result = sphinxClient.QueryWithSphinxQL("SELECT * FROM sakila WHERE MATCH('room')"); foreach (SphinxMatch match in result.Matches) { Console.WriteLine("DocumentId {0} Weight {1}", match.DocumentId, match.Weight); }
SphinxClient sphinxClient = new SphinxClient(); SphinxSearchResult result = sphinxClient.QueryWithSphinxQL(@"SELECT * FROM sakila WHERE MATCH('room') OPTION ranker=bm25, max_matches=50"); foreach (SphinxMatch match in result.Matches) { Console.WriteLine("DocumentId {0} Weight {1}", match.DocumentId, match.Weight); }
Exceptions
| Exception | Condition |
|---|---|
| System..::..ArgumentException | query is empty. |
| System..::..ArgumentNullException | query is null. |
| System..::..NotSupportedException | Version is less than 0.9.9. |
| Gronewold.SphinxConnector..::..SphinxClientException | An error occured while executing the query. See exception message and inner exception for details. |