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 luocanrao <lu...@sohu.com> on 2010/03/22 15:13:05 UTC

another question about phrasequery?(thanks again)

I don't think the current phrasequery can meet my requirement.

Can someone help me implement such a phrasequery?

 

Exact match document add some score

All other match document add 0 score.(no matter how big slop is)

 

For example:

Document 1: little boy is running

Document 2:boy is little

 

I query "little boy"

Document 1 add score 100(Exact match)

Document 2 add score 0( not Exact match)

But the two document can match the query.

user that search "litter boy" should see both the Document,

but the Document 1 is on the top!!

 


答复: another question about phrasequery?

Posted by luocanrao <lu...@sohu.com>.
Hi , Ian Lea
I mean that query for "little boy" will match the both document. 
the Document that only has terms "boy" and "little" will match the query.
the document one add some sore because it exactly match the query(term position totally match).
do I describe clearly?
 
for example
Document 1: little boy is running
Document 2:boy is little
Document 1 add score 100(Exact match),
but Document 2 add score 0( not Exact match)

-----邮件原件-----
发件人: luocan19826164@sohu.com [mailto:luocan19826164@sohu.com] 
发送时间: 2010年3月23日 11:24
收件人: java-user
主题: Re: another question about phrasequery?(thanks again)

sorry, describle again.I mean that query for "little boy" will match the both document.the Document that only has term "boy" and "little" will match the query.the document&nbsp;one add some sore beacuse it exactly match the query(term position totally match).do I describe clearly?
for example:Document 1: little boy is running
Document 2:boy is little
when I query "little boy",Document&nbsp;1 add score 100(Exact match),but Document 2 add score 0( not Exact match)



----- 原文 ----- 发件人: luocan19826164@sohu.com 主 题: Re: another question about phrasequery?(thanks again)时 间: 2010年3月23日 8:59:57
sorry, describle again.&amp;nbsp;Document 1: little boy is runningDocument 2:boy is littleI mean that a&amp;nbsp; query for "little boy" will match the both document.the Document that only has term "boy" and "little" will match the query.the document 1 add some sore beacuse it exactly match the query(term position totally match).do I describe clearly?&amp;nbsp;&amp;nbsp;for example:Document 1: little boy is runningDocument 2:boy is littleI query "little boy"Document 1 add score 100(Exact match)Document 2 add score 0( not Exact match)----- 原文 ----- 发件人: Ian Lea 主 题: Re: another question about phrasequery?(thanks again)时 间: 2010年3月22日 22:35:39I'm not clear what exactly you are asking. With your examples:Document 1: little boy is runningDocument 2:boy is littlea phrase query for "little boy" will match the first and not thesecond. Is that what you want?a phrase query for "litter boy" won't match either, but a generalquery might match on boy depending on how you set your must/shouldqualifiers.So maybe you should have a 2 phase approach: do a phrase query andstop if you get hits or do a general non-phrase query if you don't.Alternatively issue both at the same time but with the phrase queryboosted.--Ian.On Mon, Mar 22, 2010 at 2:13 PM, luocanrao &amp;lt;luocan19826164@sohu.com&amp;gt; wrote:&amp;gt; I don't think the current phrasequery can meet my requirement.&amp;gt;&amp;gt; Can someone help me implement such a phrasequery?&amp;gt;&amp;gt;&amp;gt;&amp;gt; Exact match document add some score&amp;gt;&amp;gt; All other match document add 0 score.(no matter how big slop is)&amp;gt;&amp;gt;&amp;gt;&amp;gt; For example:&amp;gt;&amp;gt; Document 1: little boy is running&amp;gt;&amp;gt; Document 2:boy is little&amp;gt;&amp;gt;&amp;gt;&amp;gt; I query "little boy"&amp;gt;&amp;gt; Document 1 add score 100(Exact match)&amp;gt;&amp;gt; Document 2 add score 0( not Exact match)&amp;gt;&amp;gt; But the two document can match the query.&amp;gt;&amp;gt; user that search "litter boy" should see both the Document,&amp;gt;&amp;gt; but the Document 1 is on the top!!&amp;gt;&amp;gt;&amp;gt;&amp;gt;---------------------------------------------------------------------To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.orgFor 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: another question about phrasequery?(thanks again)

Posted by lu...@sohu.com.
sorry, describle again.I mean that query for "little boy" will match the both document.the Document that only has term "boy" and "little" will match the query.the document&nbsp;one add some sore beacuse it exactly match the query(term position totally match).do I describe clearly?
for example:Document 1: little boy is running
Document 2:boy is little
when I query "little boy",Document&nbsp;1 add score 100(Exact match),but Document 2 add score 0( not Exact match)



----- 原文 ----- 发件人: luocan19826164@sohu.com 主 题: Re: another question about phrasequery?(thanks again)时 间: 2010年3月23日 8:59:57
sorry, describle again.&amp;nbsp;Document 1: little boy is runningDocument 2:boy is littleI mean that a&amp;nbsp; query for "little boy" will match the both document.the Document that only has term "boy" and "little" will match the query.the document 1 add some sore beacuse it exactly match the query(term position totally match).do I describe clearly?&amp;nbsp;&amp;nbsp;for example:Document 1: little boy is runningDocument 2:boy is littleI query "little boy"Document 1 add score 100(Exact match)Document 2 add score 0( not Exact match)----- 原文 ----- 发件人: Ian Lea 主 题: Re: another question about phrasequery?(thanks again)时 间: 2010年3月22日 22:35:39I'm not clear what exactly you are asking. With your examples:Document 1: little boy is runningDocument 2:boy is littlea phrase query for "little boy" will match the first and not thesecond. Is that what you want?a phrase query for "litter boy" won't match either, but a generalquery might match on boy depending on how you set your must/shouldqualifiers.So maybe you should have a 2 phase approach: do a phrase query andstop if you get hits or do a general non-phrase query if you don't.Alternatively issue both at the same time but with the phrase queryboosted.--Ian.On Mon, Mar 22, 2010 at 2:13 PM, luocanrao &amp;lt;luocan19826164@sohu.com&amp;gt; wrote:&amp;gt; I don't think the current phrasequery can meet my requirement.&amp;gt;&amp;gt; Can someone help me implement such a phrasequery?&amp;gt;&amp;gt;&amp;gt;&amp;gt; Exact match document add some score&amp;gt;&amp;gt; All other match document add 0 score.(no matter how big slop is)&amp;gt;&amp;gt;&amp;gt;&amp;gt; For example:&amp;gt;&amp;gt; Document 1: little boy is running&amp;gt;&amp;gt; Document 2:boy is little&amp;gt;&amp;gt;&amp;gt;&amp;gt; I query "little boy"&amp;gt;&amp;gt; Document 1 add score 100(Exact match)&amp;gt;&amp;gt; Document 2 add score 0( not Exact match)&amp;gt;&amp;gt; But the two document can match the query.&amp;gt;&amp;gt; user that search "litter boy" should see both the Document,&amp;gt;&amp;gt; but the Document 1 is on the top!!&amp;gt;&amp;gt;&amp;gt;&amp;gt;---------------------------------------------------------------------To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.orgFor additional commands, e-mail: java-user-help@lucene.apache.org

Re: another question about phrasequery?(thanks again)

Posted by lu...@sohu.com.
sorry, describle again.
&nbsp;
Document 1: little boy is runningDocument 2:boy is littleI mean that a&nbsp; query for "little boy" will match the both document.
the Document that only has term "boy" and "little" will match the query.
the document 1 add some sore beacuse it exactly match the query(term position totally match).do I describe clearly?

&nbsp;
&nbsp;
for example:
Document 1: little boy is runningDocument 2:boy is littleI query "little boy"
Document 1 add score 100(Exact match)Document 2 add score 0( not Exact match)



----- 原文 ----- 发件人: Ian Lea 主 题: Re: another question about phrasequery?(thanks again)时 间: 2010年3月22日 22:35:39
I'm not clear what exactly you are asking. With your examples:Document 1: little boy is runningDocument 2:boy is littlea phrase query for "little boy" will match the first and not thesecond. Is that what you want?a phrase query for "litter boy" won't match either, but a generalquery might match on boy depending on how you set your must/shouldqualifiers.So maybe you should have a 2 phase approach: do a phrase query andstop if you get hits or do a general non-phrase query if you don't.Alternatively issue both at the same time but with the phrase queryboosted.--Ian.On Mon, Mar 22, 2010 at 2:13 PM, luocanrao &lt;luocan19826164@sohu.com&gt; wrote:&gt; I don't think the current phrasequery can meet my requirement.&gt;&gt; Can someone help me implement such a phrasequery?&gt;&gt;&gt;&gt; Exact match document add some score&gt;&gt; All other match document add 0 score.(no matter how big slop is)&gt;&gt;&gt;&gt; For example:&gt;&gt; Document 1: little boy is running&gt;&gt; Document 2:boy is little&gt;&gt;&gt;&gt; I query "little boy"&gt;&gt; Document 1 add score 100(Exact match)&gt;&gt; Document 2 add score 0( not Exact match)&gt;&gt; But the two document can match the query.&gt;&gt; user that search "litter boy" should see both the Document,&gt;&gt; but the Document 1 is on the top!!&gt;&gt;&gt;&gt;---------------------------------------------------------------------To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.orgFor additional commands, e-mail: java-user-help@lucene.apache.org

Re: another question about phrasequery?(thanks again)

Posted by Ian Lea <ia...@gmail.com>.
I'm not clear what exactly you are asking.  With your examples:

Document 1: little boy is running
Document 2:boy is little

a phrase query for "little boy" will match the first and not the
second.  Is that what you want?

a phrase query for "litter boy" won't match either, but a general
query might match on boy depending on how you set your must/should
qualifiers.

So maybe you should have a 2 phase approach: do a phrase query and
stop if you get hits or do a general non-phrase query if you don't.
Alternatively issue both at the same time but with the phrase query
boosted.


--
Ian.

On Mon, Mar 22, 2010 at 2:13 PM, luocanrao <lu...@sohu.com> wrote:
> I don't think the current phrasequery can meet my requirement.
>
> Can someone help me implement such a phrasequery?
>
>
>
> Exact match document add some score
>
> All other match document add 0 score.(no matter how big slop is)
>
>
>
> For example:
>
> Document 1: little boy is running
>
> Document 2:boy is little
>
>
>
> I query "little boy"
>
> Document 1 add score 100(Exact match)
>
> Document 2 add score 0( not Exact match)
>
> But the two document can match the query.
>
> user that search "litter boy" should see both the Document,
>
> but the Document 1 is on the top!!
>
>
>
>

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