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?
Sure, take a look at SpanFirstQuery. Here is a good tutorial:
http://www.lucidimagination.com/blog/2009/07/18/the-spanquery/