lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip Puffinburger" <ppuffinbur...@tlcdelivers.com>
Subject Strange(?) behaviour using MultiFieldQueryParser
Date Tue, 21 Jul 2009 18:47:27 GMT
We have code (using Lucene 2.4.1) that will build a query that looks like:

 

fielda:"ruz an"~2 OR fieldb:"ruz an"~2 OR fieldc:"ruz an"~2

 

When passed to a MultiFieldQueryParser and parsed it comes back looking
like:

 

fielda:"ruz an"~2 fieldb:"ruz an"~2 fieldc:ruz

 

It seems that whenever the input phrase has a stop word in it, fieldc
doesn't keep the phrase intact.   If there is no stop word then it works as
expected and just removes the OR's.

 

The code is pretty simple

 

MultiFieldQueryParser parser = new MultiFieldQueryParser(getCrossfields(),
new MyAnalyzer());

parser.setDefaultOperator(QueryParser.Operator.AND);

            

Query crossFieldQuery = parser.parse(searchExpression);

 

getCrossFields returns a String[] of all the fields we want to look at.
MyAnalyzer is a pretty basic analyzer which adds a filter to remove
diacritics.   searchExpression is the whatever is coming into the search
function, in this case the pre-built query.

 

 

 

Is there a reason that the parse method decides to change the last field
instead of keeping the phrase intact?


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message