First steps

  • Remember to using SphinxClassLibrary;
  • Submitting a query (you can call AddQuery multiple times and submit once)
SphinxClient sphinx_client = new SphinxClient(); // ==> SphinxClient("localhost", 9312)
sphinx_client.AddQuery("needle", "some_index_in_sphinx");
List<Result> results = sphinx_client.RunQueries();
foreach (Result result in results)
    Console.WriteLine(result);
  • Building an excerpt
SphinxClient sphinx_client = new SphinxClient();
List<string> docs = new List<string>();
docs.Add("blabla my document goes here bla bla");
List<string> excerpts = sphinx_client.BuildExcerpts(docs, "some_index_in_sphinx", "words", new ExcerptOptions());
Console.WriteLine("[Excerpt]");
foreach (string e in excerpts)
    Console.WriteLine(e);

Last edited Dec 3, 2010 at 6:34 PM by Tralamazza, version 6

Comments

Tralamazza Mar 4, 2011 at 5:55 PM 
@seasunk, try setting the sphinx_client.Encoding ("UTF-8" by default)

Tralamazza Mar 4, 2011 at 5:42 PM 
@seasunk, I've never tested it, but it works for en-US and pt-BR

seasunk Mar 2, 2011 at 7:23 AM 
hi,this client can't support search chinese?

Tralamazza Dec 3, 2010 at 6:33 PM 
Ah yes sorry, by default the constructor points to localhost:9312

kendallpatterson Nov 23, 2010 at 12:15 AM 
In your example you do not provide a connectionstring example