You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by 郑华斌 <hu...@qq.com> on 2014/06/06 14:48:00 UTC

span query with SHOUD semantic instead of MUST HAVE

hi,


I have two docs, 
    a) "aa bb cc" and,
    b) "aa cc bb". 
The query is "aa bb". What I expected is the doc a comes first with a higher score than doc b because the term distance in query and that in doc a are more similar. 
After google for a while I get it down with the span query q: "aa bb"~10. However, when I change my query into "aa bb dd"~10, the span query return nothing 
hits becuase dd can not be found in any doc. So what's a solution to this problem? 


Thanks.

Re: span query with SHOUD semantic instead of MUST HAVE

Posted by Erick Erickson <er...@gmail.com>.
What is your problem? I mean what kind of real-world issue are you
requiring this behavior for? Or is this mostly so you can understand
scoring better?

Very often this kind of question is a test artifact. As far as I know,
the distance isn't part of the scoring, the fact that there's an extra
token between just isn't considered relevant (I may be dead wrong on
this, but...)...

So if this is theoretical, I believe the answer is "because distance
isn't part of the scoring formula".
If this is practical in that you need terms closer together to bubble
up to the top, then something phrase queries with slop and boosts
would help, something like
"aa bb"^100 OR "aa bb"~10^10 OR field:(aa bb)....

Best,
Erick

On Fri, Jun 6, 2014 at 5:48 AM, 郑华斌 <hu...@qq.com> wrote:
> hi,
>
>
> I have two docs,
>     a) "aa bb cc" and,
>     b) "aa cc bb".
> The query is "aa bb". What I expected is the doc a comes first with a higher score than doc b because the term distance in query and that in doc a are more similar.
> After google for a while I get it down with the span query q: "aa bb"~10. However, when I change my query into "aa bb dd"~10, the span query return nothing
> hits becuase dd can not be found in any doc. So what's a solution to this problem?
>
>
> Thanks.

Re: span query with SHOUD semantic instead of MUST HAVE

Posted by Ahmet Arslan <io...@yahoo.com.INVALID>.
Hi,

How come query "aa bb" returns document b?



On Friday, June 6, 2014 3:48 PM, 郑华斌 <hu...@qq.com> wrote:
hi,


I have two docs, 
    a) "aa bb cc" and,
    b) "aa cc bb". 
The query is "aa bb". What I expected is the doc a comes first with a higher score than doc b because the term distance in query and that in doc a are more similar. 
After google for a while I get it down with the span query q: "aa bb"~10. However, when I change my query into "aa bb dd"~10, the span query return nothing 
hits becuase dd can not be found in any doc. So what's a solution to this problem? 


Thanks. 

Re: span query with SHOUD semantic instead of MUST HAVE

Posted by wanggaohang <ga...@gmail.com>.
设置q.op=OR试试
On 2014年06月06日 20:48, 郑华斌 wrote:
> hi,
>
>
> I have two docs,
>      a) "aa bb cc" and,
>      b) "aa cc bb".
> The query is "aa bb". What I expected is the doc a comes first with a higher score than doc b because the term distance in query and that in doc a are more similar.
> After google for a while I get it down with the span query q: "aa bb"~10. However, when I change my query into "aa bb dd"~10, the span query return nothing
> hits becuase dd can not be found in any doc. So what's a solution to this problem?
>
>
> Thanks.