lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark harwood <markharw...@yahoo.co.uk>
Subject Re: Creating Span Queries from Boolean Queries
Date Wed, 22 Aug 2012 08:22:01 GMT
>>> Ideally I'd like to take any ANDed clauses and require them to occur> withing
$SPAN of the other ANDs.

See ComplexPhraseQueryParser?

Like the standard QueryParser it uses quotes to define a phrase but also interprets any special
characters between the quotes e.g. ( ) * ~
The syntax and its interpretation is outlined here: http://goo.gl/6gni1
(I saw someone else was asking for this recently)



----- Original Message -----
From: Dave Seltzer <dseltzer@tveyes.com>
To: java-user@lucene.apache.org
Cc: 
Sent: Wednesday, 22 August 2012, 1:37
Subject: Re: Creating Span Queries from Boolean Queries

Well I was hoping that someone knew of a recursive solution to
rewriting Boolean queries of arbitrary depth.

I suppose If I can rewrite

"london olympics" AND (football OR soccer) NOT nfl

into

"London Olympics" within_5_words_of (football or soccer)
not_within_5_words_of nfl

Then I should be able to use the same logic to operate on a
BooleanQuery occurring within a BooleanClause.

-D

On Tue, Aug 21, 2012 at 7:26 PM, Jack Krupansky <jack@basetechnology.com>wrote:

> Give us an example of what you are really trying to match.
>
> SpanNearQuery takes a list of clauses, which can be SpanTermQuery to match
> a single term or SpanNearQuery to match a nested span. You can specify the
> maximum distance between terms/spans - use nesting if you want to change
> that distance. That gives you a basic BooleanQuery with AND clauses
> converted to spans.
>
> -- Jack Krupansky
>
> -----Original Message----- From: Dave Seltzer
> Sent: Tuesday, August 21, 2012 6:53 PM
> To: java-user@lucene.apache.org
> Subject: Creating Span Queries from Boolean Queries
>
> Hi Everyone,
>
> If there was a straightforward way to take a Boolean Query created by the
> Lucene Query Parser and convert it to a Span Query.
>
> Ideally I'd like to take any ANDed clauses and require them to occur
> withing $SPAN of the other ANDs.
>
> I can't quite wrap my head around how to solve the problem.
>
> Thanks!
>
> -Dave
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.**apache.org<java-user-unsubscribe@lucene.apache.org>
> For additional commands, e-mail: java-user-help@lucene.apache.**org<java-user-help@lucene.apache.org>
>
>


-- 
Dave Seltzer <dseltzer@tveyes.com>
Chief Systems Architect
TVEyes
(203) 254-3600 x222


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message