Skip to content

Instantly share code, notes, and snippets.

@sirkirby
Last active January 3, 2016 09:59
Show Gist options
  • Save sirkirby/8446376 to your computer and use it in GitHub Desktop.
Save sirkirby/8446376 to your computer and use it in GitHub Desktop.
Azure Full Text Search Ex 4
// parse the query
var query = multiParser.Parse(phrase);
// search the index and return the top 10 best records
var results = searcher.Search(query, 10);
// loop over my top 10 hits and display the results to the console
foreach (var hit in results.ScoreDocs)
{
// gets the document from the hit index
var doc = searcher.Doc(hit.Doc);
// write out the best books matching my phrase
Console.WriteLine(string.Format("{0} by {1}", doc.GetField("Title").StringValue,
doc.GetField("Author").StringValue));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment