lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Miller <>
Subject Re: Weird operator precedence with default operator AND
Date Thu, 11 Oct 2007 15:32:11 GMT

Martin Dietze wrote:
> On Wed, October 10, 2007, Mark Miller wrote:
>> Back in the day you might have been able to call Query.toString() as the 
>> Query contract says that toString() should output valid QueryParser syntax. 
>> This does not work for many queries though (most notably Span Queries -- 
>> QueryParser knows nothing about Span queries).
> I see, so my old code which was based on QueryParser was not
> completely flawed :) Are there any other queries besides span
> queries which can occur with qsol and do not produce valid
> QueryParser syntax? 
I'm not sure, I'd have to look into it.
> Also I wonder why a facette query, like `foo:bar' results in a
> SpanQuery `+spanNear([foo, bar], 0, true)' (I may not understand
> the concept here).
Qsol has a different field search syntax: foo(bar).

If you give something like foo:bar or foo-bar, the results will depend 
on your analyzer. If using the standard analyzer, the ':' or '-' is 
thrown out and two tokens are generated: foo and bar. Like the standard 
Lucene QueryParser, if more than one token is generated from a single 
'queryparser token', they are looked for next to each other. The 
difference is that the standard Lucene QueryParser uses PhraseQuery's 
for this. Qsol uses SpanQuery's instead so that results are consistent 
if the clause needs to be in a SpanQuery rather than a BooleanQuery 
(PhraseQuery's cannot be nested in SpanQuery's). This is required 
because Qsol allows the mixing of Span/Non-Span queries.

If you want to get around this, I may be able to help.

- Mark

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

View raw message