I am using lucene as Search engine. When we use the standardAnalyser,the stop words are filtered out. That means, when we search for a phrase that has stop words we can’t find results for exact phrase.
Example we search for “This is a game” it looks for “This game”. (I look at it to work this way)
I need to filter out stop words if someone is searching just for ‘a’ or ‘the’etc (stop words), but not in phrase searches.
EDIT: Looks like it works with QueryParser Object.
However I cant get the results for hits per page in single document for phrase searches. I am looking to use SpanQuery for it, any ideas on how to use it?
Thanks,
Sharma
When you filter stopwords, the relative place of the words is not modified. For example “this is a game” results in:
This at pos 0
game at pos 3
This way when you generate a phrase query (using the usual query parser) with the same stopwords it will work as expected.
Some artifacts may appear, however. The phrases
“this is a game”
“this is some game”
will both match equally well for the query “this is a game”.
Regarding the SpanQuery… I don’t quite understand the question.