lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Miller <>
Subject Re: Technology Preview of new Lucene QueryParser
Date Sat, 20 Jan 2007 18:07:32 GMT
Chris Hostetter wrote:
> : > so do you convert A ! B ! C into a three clause boolean query, or a two
> : > clause BooleanQuery that contains another two clause BooleanQuery?
> : >
> : It becomes a three clause boolean query...would there be a difference in
> : scoring? I assumed not and it used to make a boolean that contained
> : another boolean...these days it checks to see if its in a chain of the
> : same operator and makes only one boolean.
> there is in fact a difference in score ... a big difference depending
> on how the coordFactor comes into play.  your three-clause approach makes
> sense to me as the "right" approach, but your "in a chain of the same
> operator" comment scares me ... how does "A | B | C ! D ! E" get parsed?
> I would assume it should result in the QueryParser equivilent of
> "A B C -D -E" ... is there any way to produce a the same underlying
> BooleanQuery using your syntax?
This exchange has caused me to reassess my syntax. It seems that 
QueryParser's handling of A B C -D -E is special because QueryParser 
does not have any operator precedence rules (unless the 1 rule is that 
all operators resolve with the same precedence <g>). What would appear 
in my parser to map to A B C -D -E i.e.  A | B | C ! D ! E, actually 
maps to: A B (+C -D -E). If you want precedence applied to your query, 
there is no way around this-- that is what operator precedence creates. 
Unfortunately, that means my parser is not quite as "rich" as 
QueryParser. While I can duplicate the same hits, QueryParser has a 
greater scoring expressiveness (QueryParser can express precedence 
queries, but you must use parenthesis). My current idea (and mostly 
implemented) is to add a set of operators to my syntax that force a 
first level precedence resolve. To express the query A B C -D -E you 
would use A || B || C !! D !! E . Doubling the operator would 
effectively make the operator bind at the level of parenthesis. You 
could then mix like this: A B ! C & A || Z || B !! H & Q.

I think that this change will be a large step forward in supporting the 
entire Lucene Query/Scoring language with my parser.

- Mark

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message