Yossale
Yossale

Reputation: 14361

Getting exact matches in Lucene using the standard analyzer?

Given 2 documents with the content as follows "I love Lucene" "Lucene is nice" I want to be able to query lucene only for those documents with Lucene in the beginning , i.e , everything that will match the regexp "^Lucene .*".

Is there a way to do it , provided that I can't change the index , and it was analyzed using the standard analyzer?

Upvotes: 1

Views: 1459

Answers (1)

bajafresh4life
bajafresh4life

Reputation: 12843

Sure, take a look at SpanFirstQuery. Here is a good tutorial:

http://www.lucidimagination.com/blog/2009/07/18/the-spanquery/

Upvotes: 3

Related Questions