You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Fabiano Nunes <fa...@nunes.me> on 2010/09/26 19:32:00 UTC
Fuzzy Phrase
Is it possible to search for fuzzy phrase queries like -- "colorless~ green~
ideas~" -- ?
I have had some success with ComplexPhraseQuery, but I can't use it for
querying two fields at same time, ie, -- head:"hello~ world"~3 AND
contents:"colorless~ green~ ideas~" --
Thank you.
Re: Fuzzy Phrase
Posted by Karl Wettin <ka...@gmail.com>.
There is a SpanFuzzyQuery for Lucene 1.9 from 2006 in LUCENE-522.
karl
27 sep 2010 kl. 00.19 skrev Fabiano Nunes:
> Thank you, Schindler.
> When combining queries, I need two strings, one for each field. I want to
> use just one string like -- head:"hello~ world"~3 AND contents:"colorless~
> green~ ideas~".
>
> When I this string query within ComplexPhraseQuery, I get the exception:
> -- ParseException: Cannot parse 'hello~ world': Cannot have clause for
> field "content" nested in phrase for field "head"
>
> But, If I use -- head:hello AND head:world AND contents:"colorless~ green~
> ideas~" -- no errors occurred.
>
>
> On Sun, Sep 26, 2010 at 2:57 PM, Uwe Schindler <uw...@thetaphi.de> wrote:
>
>> Hi,
>>
>> You can combine two different ComplexPhraseQueries for both fields using an
>> BooleanQuery with Occur.MUST.
>>
>> -----
>> Uwe Schindler
>> H.-H.-Meier-Allee 63, D-28213 Bremen
>> http://www.thetaphi.de
>> eMail: uwe@thetaphi.de
>>
>>
>>> -----Original Message-----
>>> From: falha404@gmail.com [mailto:falha404@gmail.com] On Behalf Of
>>> Fabiano Nunes
>>> Sent: Sunday, September 26, 2010 10:32 AM
>>> To: java-user@lucene.apache.org
>>> Subject: Fuzzy Phrase
>>>
>>> Is it possible to search for fuzzy phrase queries like -- "colorless~
>> green~
>>> ideas~" -- ?
>>> I have had some success with ComplexPhraseQuery, but I can't use it for
>>> querying two fields at same time, ie, -- head:"hello~ world"~3 AND
>>> contents:"colorless~ green~ ideas~" --
>>>
>>> Thank you.
>>
>>
>> ---------------------------------------------------------------------
>> 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
Re: Fuzzy Phrase
Posted by Ahmet Arslan <io...@yahoo.com>.
> I want to
> use just one string like -- head:"hello~ world"~3 AND
> contents:"colorless~
> green~ ideas~".
>
> When I this string query within ComplexPhraseQuery, I get
> the exception:
> -- ParseException: Cannot parse 'hello~ world': Cannot
> have clause for
> field "content" nested in phrase for field "head"
>
> But, If I use -- head:hello AND head:world AND
> contents:"colorless~ green~
> ideas~" -- no errors occurred.
Actually there is solution/patch for that problem.
https://issues.apache.org/jira/secure/attachment/12414443/Lucene-1486+non+default+field.patch
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Fuzzy Phrase
Posted by Fabiano Nunes <fa...@nunes.me>.
Thank you, Schindler.
When combining queries, I need two strings, one for each field. I want to
use just one string like -- head:"hello~ world"~3 AND contents:"colorless~
green~ ideas~".
When I this string query within ComplexPhraseQuery, I get the exception:
-- ParseException: Cannot parse 'hello~ world': Cannot have clause for
field "content" nested in phrase for field "head"
But, If I use -- head:hello AND head:world AND contents:"colorless~ green~
ideas~" -- no errors occurred.
On Sun, Sep 26, 2010 at 2:57 PM, Uwe Schindler <uw...@thetaphi.de> wrote:
> Hi,
>
> You can combine two different ComplexPhraseQueries for both fields using an
> BooleanQuery with Occur.MUST.
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
>
> > -----Original Message-----
> > From: falha404@gmail.com [mailto:falha404@gmail.com] On Behalf Of
> > Fabiano Nunes
> > Sent: Sunday, September 26, 2010 10:32 AM
> > To: java-user@lucene.apache.org
> > Subject: Fuzzy Phrase
> >
> > Is it possible to search for fuzzy phrase queries like -- "colorless~
> green~
> > ideas~" -- ?
> > I have had some success with ComplexPhraseQuery, but I can't use it for
> > querying two fields at same time, ie, -- head:"hello~ world"~3 AND
> > contents:"colorless~ green~ ideas~" --
> >
> > Thank you.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
Phrase query with boolean matches
Posted by Christopher Condit <co...@sdsc.edu>.
I'm trying to use the QueryParser in 3.0.2 to make "foo and bar" (with
the quotes) return documents with the exact phrase "foo and bar". When I
run it through the QueryParser (with a StandardAnalyzer) I end up with
"foo ? bar", which doesn't match the documents in the index. I know that
"and" is a stop word, but I'm curious why it's translated into ? instead
of a * during this parsing (or just left along because it's a phrase
query)...
Can I escape boolean keywords somehow?
Here's a runnable example: http://www.pastie.org/1564773
Thanks,
-Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
RE: Fuzzy Phrase
Posted by Uwe Schindler <uw...@thetaphi.de>.
Hi,
You can combine two different ComplexPhraseQueries for both fields using an
BooleanQuery with Occur.MUST.
-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de
> -----Original Message-----
> From: falha404@gmail.com [mailto:falha404@gmail.com] On Behalf Of
> Fabiano Nunes
> Sent: Sunday, September 26, 2010 10:32 AM
> To: java-user@lucene.apache.org
> Subject: Fuzzy Phrase
>
> Is it possible to search for fuzzy phrase queries like -- "colorless~
green~
> ideas~" -- ?
> I have had some success with ComplexPhraseQuery, but I can't use it for
> querying two fields at same time, ie, -- head:"hello~ world"~3 AND
> contents:"colorless~ green~ ideas~" --
>
> Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org