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 "Levin, Ilya" <il...@hp.com> on 2012/07/22 10:29:25 UTC

using phrase query with wildcard

Hi,

I'm trying to create a phrase query with wildcard, from the forums it seems that the solution is not trivial.
I'm trying to create the following queries: "this is a phrase*"  OR  "*This is a phrase" and
Get hits on every possibility where the * resides.
What is the best way to achieve this?

Thanks.


Re: using phrase query with wildcard

Posted by Jack Krupansky <ja...@basetechnology.com>.
SpanNearQuery can be used to allow an arbitrary number of terms between 
sub-phrases of a larger phrase. But, that is between terms, not at the 
beginning or end of a phrase.

See:
http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/spans/SpanNearQuery.html

You can use SpanMultiTermQueryWrapper to include wild and fuzzy terms in 
your span query.

See:
http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/spans/SpanMultiTermQueryWrapper.html

You can also use SpanPositionRangeQuery to assure that a phrase match occurs 
with a desired position range, such as to assure that the match occurs at 
the beginning, near the beginning, or end of a document.

See:
http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/spans/SpanPositionRangeQuery.html

-- Jack Krupansky

-----Original Message----- 
From: Levin, Ilya
Sent: Sunday, July 22, 2012 4:51 AM
To: java-user@lucene.apache.org
Subject: RE: using phrase query with wildcard

It can be both.

-----Original Message-----
From: Doron Yaacoby [mailto:dorony@gingersoftware.com]
Sent: יום א 22 יולי 2012 11:48
To: java-user@lucene.apache.org
Subject: RE: using phrase query with wildcard

Is * a placeholder for a term or a part of a term?

-----Original Message-----
From: Levin, Ilya [mailto:ilya.levin@hp.com]
Sent: 22 July 2012 11:29
To: java-user@lucene.apache.org
Subject: using phrase query with wildcard

Hi,

I'm trying to create a phrase query with wildcard, from the forums it seems 
that the solution is not trivial.
I'm trying to create the following queries: "this is a phrase*"  OR  "*This 
is a phrase" and Get hits on every possibility where the * resides.
What is the best way to achieve this?

Thanks.


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


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


RE: using phrase query with wildcard

Posted by "Levin, Ilya" <il...@hp.com>.
It can be both.

-----Original Message-----
From: Doron Yaacoby [mailto:dorony@gingersoftware.com] 
Sent: יום א 22 יולי 2012 11:48
To: java-user@lucene.apache.org
Subject: RE: using phrase query with wildcard

Is * a placeholder for a term or a part of a term?

-----Original Message-----
From: Levin, Ilya [mailto:ilya.levin@hp.com] 
Sent: 22 July 2012 11:29
To: java-user@lucene.apache.org
Subject: using phrase query with wildcard

Hi,

I'm trying to create a phrase query with wildcard, from the forums it seems that the solution is not trivial.
I'm trying to create the following queries: "this is a phrase*"  OR  "*This is a phrase" and Get hits on every possibility where the * resides.
What is the best way to achieve this?

Thanks.


---------------------------------------------------------------------
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: using phrase query with wildcard

Posted by Doron Yaacoby <do...@gingersoftware.com>.
Is * a placeholder for a term or a part of a term?

-----Original Message-----
From: Levin, Ilya [mailto:ilya.levin@hp.com] 
Sent: 22 July 2012 11:29
To: java-user@lucene.apache.org
Subject: using phrase query with wildcard

Hi,

I'm trying to create a phrase query with wildcard, from the forums it seems that the solution is not trivial.
I'm trying to create the following queries: "this is a phrase*"  OR  "*This is a phrase" and Get hits on every possibility where the * resides.
What is the best way to achieve this?

Thanks.


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


Re: using phrase query with wildcard

Posted by Ahmet Arslan <io...@yahoo.com>.
> I'm trying to create a phrase query with wildcard, from the
> forums it seems that the solution is not trivial.
> I'm trying to create the following queries: "this is a
> phrase*"  OR  "*This is a phrase" and
> Get hits on every possibility where the * resides.
> What is the best way to achieve this?

Some pointers: 

https://issues.apache.org/jira/browse/LUCENE-1486

http://lucene.apache.org/core/3_6_1/api/all/org/apache/lucene/queryParser/complexPhrase/ComplexPhraseQueryParser.html

http://wiki.apache.org/lucene-java/LuceneFAQ#Can_I_combine_wildcard_and_phrase_search.2C_e.g._.22foo_ba.2A.22.3F

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