samy
samy

Reputation: 14972

Parsing string to a combination of PhraseQuery and PrefixQuery in Lucene.net

I have a dotnetnuke module that integrates the search infrastructure of dotnetnuke with Lucene. The Lucene.search API takes either a query or a string containing what i need to search for.

For reasons i won't detail here, i can't create the query directly so i use the QueryParser abilities to parse the search string. It works great, except that i haven't found how to combine PhraseQuery and PrefixQuery in the search parameters.

I'd like to be able to parse the following string "here be drag" and have it return documents containing "here be dragons" or "here be dragsters"

I tried parsing "here be drag"* and "here be drag*" but not luck. Is there a special syntax to parse this kind of combination?

Upvotes: 0

Views: 479

Answers (1)

Puneet
Puneet

Reputation: 472

Take a look at the Complex Phrase Query Parser. Since you are using Lucene.net, you may have to look for an earlier version of the ComplexPhrase parser. If I recall correctly, this parser was part of the contrib. Since this parser is not too complex in coding, porting it to c# from Java should not be too difficult.

Upvotes: 1

Related Questions