O'Reilly logo

Instant Lucene.NET by Michael Heydt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Searching using QueryParser (Should know)

This recipe demonstrates how to use the QueryParser class to execute free-form queries against an index. The purpose of the QueryParser class is to primarily take manually entered search queries and parse them into a Lucene.NET query structure that can be executed against the content in a Lucene.NET index. The expression syntax is quite expressive and powerful, allowing many logical operations and inclusion/exclusion constructs, and we will see examples of this as we progress through more recipes.

How to do it...

The example for this recipe starts out similar to the previous example, by indexing the same two novels. Like the TermQuery recipe, an IndexSearcher object is created, and then five searches are ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required