lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Re[2]: Span Query NLE
Date Mon, 24 Jul 2006 17:44:16 GMT
The "surround" query parser in Lucene's contrib area implements a  
language to construct SpanQuery's.  Check out surround.txt in  
Subversion:

	<http://svn.apache.org/repos/asf/lucene/java/trunk/contrib/surround/>

I have written a query parser for a client that allows construction  
of very sophisticated queries including the full spectrum of  
SpanQuery's, but the language is legacy and not something I'd wish  
upon the general public, and the code is proprietary anyway.  It does  
take some time for someone unfamiliar with JavaCC, such as myself  
initially, to implement a custom parser but it can be a huge success  
for a project to have this capability.

	Erik


On Jul 24, 2006, at 11:48 AM, Charlie wrote:

> Thanks for both of you, Karl and Chris.
>
> You both made my intention even more clearer.
>
> So now the question is:
>
>    Is there a powerful QueryParser.jj can process span query syntax?
>
> (prerequisite is: have we ever defined the Span Query Syntax?)
>
> I will be boasting if I am claim to write one now. I had only one
> compiler class and never feel good about it:)
>
> -- 
> Best regards,
>  Charlie
>
>
> ---
> Monday, July 24, 2006, 2:04:35 AM, you wrote:
>
>
> : >> Would anyone give me a hint regarding the natural language  
> expression
> : >> of the following span query?
>
>> : I'm sorry, but all queries are not supported by the QueryParser.  
>> Spans
>> : beeing one of them. See QueryParser.jj to add your syntax.
>
>> I think one of us is missunderstanding the question ... in my mind  
>> the
>> "natural language expression" for this query...
>
>>    spanNear([spanOr([spanNear([field:six, field:hundred], 0, true),
>>                      spanNear([field:seven, field:hundred], 0, true)
>>                     ]),
>>             spanOr([field:seven, field:six])],
>>             100, true)
>
>> ...is...
>
>>   Either "six" followed by "hundred" with no gap between them, or  
>> "seven"
>>   followed by "hundred" with no gap between them; followed by either
>>   "seven" or "six" with a gap of no more no more then 100 tokens in
>>   between them.
>
>> It's a fairly contrived test case from TestSpansAdvanced if i'm not
>> mistaken, constructed purely to test some complex combinations.
>
>> An example that might make a little more sense is something like...
>
>>    spanNear([spanOr([spanNear([field:Erik, field:Hatcher], 0, true),
>>                      spanNear([field:Otis, field:Gospodnetic], 0,  
>> true)
>>                     ]),
>>             spanOr([field:Apache, field:Lucene])],
>>             100, false)
>
>> ...which I would translate as...
>
>>   Either "Erik" followed by "Hatcher" with no gap between them, or  
>> "Otis"
>>   followed by "Gospodnetic" with no gap between them; near either
>>   "Apache" or "Lucene" with a gap of no more no more then 100  
>> tokens in
>>   between them.
>
>
>> -Hoss
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org


---------------------------------------------------------------------
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