SubPhraseQuery in Lucene

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

SubPhraseQuery in Lucene

Preetam Rao

Is there a query in Lucene which matches sub phrases ?

For example if the document text is "new york  existing homes 3 bed 2 bath homes 3 miles from city center 2 rooms" and if user enters "Brooklyn homes with 3 bed rooms  and swimming pools", I would like to recognize the fact the the document contained a sub prefix of the user query and give it more score compared to a document which contained all the terms, but in correct order, for example, " new york 2 beds 3 baths".

This kind of query will be useful when we do not interpret or parse the user query. As seen in the example, it will prove useful when numbers are involved since numbers usually make sense with the term immediately following it.

This is something of a middle ground between pure 'boolean OR' query and a 'exact phrase query' as far as directly using the user query is concerned.

I have documented my thoughts in the below document and if there is nothing similar already implemented,
will open a JIRA issue and work on it.

Please let me know your thoughts on alternate solutions and approaches since it will be very useful for my current project.