(Lucene 1.9.1)

 

I have a "filename" field in Lucene that holds a value, like this:
pagefile.sys

 

If I run searches through QueryParser, and I do a search for:

 

pagefile.sys

pagefile

pagefile.

 

This all works because it goes through getFieldQuery, which tokenizes
the string and generates a PhraseQuery out of it.

 

But if I search for this:

 

pagefile.*

 

It doesn't work, because it goes through PrefixQuery, and PrefixQuery
looks for terms that start with "pagefile.", but no terms will start
with "pagefile.", because periods are not tokenized.  Similarly,
searching for:

 

pagefile*sys

 

Doesn't work, because it goes through WildcardQuery, and WildcardQuery
is set up to only match terms as well, and no term starts with
"pagefile" and ends with "sys".

 

I've done a lot of googling on this, but I can't find a good answer for
what I should do.  I'm playing around with removing QueryParser entirely
and generating a MultiPhraseQuery, but want to make sure I'm not
reinventing an already invented wheel.

 

--Colin McGuigan

Reply via email to