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 Naga Darbha <nd...@opentext.com> on 2010/04/29 06:09:06 UTC

NOT keyword - doesn't work with dismax?

Hi,

I am trying the NOT clause with dismax query type, and it is not working.  It works with the standard query type.  I tried the following query:

q=NOT+keyword&fq=&qt=dismax&start=0&rows=26&fl=score

But, when I replace qt=standard, it works.

How to make it work with dismax query type?

regards,
Naga

Re: NOT keyword - doesn't work with dismax?

Posted by Scott K <so...@skister.com>.
I couldn't even get the bq= to work with negated queries, although
with edismax, negated queries work with just q=-term

Works:
/solr/select?qt=edismax&q=-red

Here is the failed attempt with dismax
/solr/select?qt=dismax&rows=1&indent=true&q=-red&bq=*:*^0.001&echoParams=all&debugQuery=true

{
  "responseHeader":{
    "status":0,
    "QTime":20,
    "params":{
      "mm":"2<-1 5<-2 6<90%",
      "pf":"title^10.0 sbody^2.0",
      "echoParams":"all",
      "tie":"0.01",
      "qf":"title^10.0 sbody^2.0 tags^1.0 text^1.0",
      "q.alt":"*:*",
      "hl.fl":"body",
      "wt":"json",
      "ps":"100",
      "defType":"dismax",
      "bq":"*:*^0.001",
      "echoParams":"all",
      "debugQuery":"true",
      "indent":"true",
      "q":"-red",
      "qt":"dismax",
      "rows":"1"}},
  "response":{"numFound":0,"start":0,"docs":[]
  },
  "debug":{
    "rawquerystring":"-red",
    "querystring":"-red",
    "parsedquery":"+(-DisjunctionMaxQuery((tags:red | text:red |
title:red^10.0 | sbody:red^2.0)~0.01))
DisjunctionMaxQuery((title:red^10.0 | sbody:red^2.0)~0.01)
MatchAllDocsQuery(*:*^0.0010)",
    "parsedquery_toString":"+(-(tags:red | text:red | title:red^10.0 |
sbody:red^2.0)~0.01) (title:red^10.0 | sbody:red^2.0)~0.01
*:*^0.0010",
    "explain":{},
    "QParser":"DisMaxQParser",
    "altquerystring":null,
    "boost_queries":["*:*^0.001"],
    "parsed_boost_queries":["MatchAllDocsQuery(*:*^0.0010)"],
    "boostfuncs":null,
    "timing":{
      "time":20.0,
      "prepare":{
        "time":19.0,
        "org.apache.solr.handler.component.QueryComponent":{
          "time":19.0},
        "org.apache.solr.handler.component.FacetComponent":{
          "time":0.0},
        "org.apache.solr.handler.component.MoreLikeThisComponent":{
          "time":0.0},
        "org.apache.solr.handler.component.HighlightComponent":{
          "time":0.0},
        "org.apache.solr.handler.component.StatsComponent":{
          "time":0.0},
        "org.apache.solr.handler.component.DebugComponent":{
          "time":0.0}},
      "process":{
        "time":1.0,
        "org.apache.solr.handler.component.QueryComponent":{
          "time":0.0},
        "org.apache.solr.handler.component.FacetComponent":{
          "time":0.0},
        "org.apache.solr.handler.component.MoreLikeThisComponent":{
          "time":0.0},
        "org.apache.solr.handler.component.HighlightComponent":{
          "time":0.0},
        "org.apache.solr.handler.component.StatsComponent":{
          "time":0.0},
        "org.apache.solr.handler.component.DebugComponent":{
          "time":1.0}}}}}


On Wed, Apr 28, 2010 at 23:35, Chris Hostetter <ho...@fucit.org> wrote:
>
> : Ah, dismax doesn't support top-level NOT query.
>
> Hmm, yeah i don' think support for purely negated queries was ever added
> to dismax.
>
> I'm pretty sure that as a workarround you can use add
> something like...
>        bq=*:*^0.001
> ...to your query.  based on the dismax structure, that should allow purely
> negative queries to work.
>
>
>
> -Hoss
>
>

Re: NOT keyword - doesn't work with dismax?

Posted by Chris Hostetter <ho...@fucit.org>.
: Ah, dismax doesn't support top-level NOT query.

Hmm, yeah i don' think support for purely negated queries was ever added 
to dismax.

I'm pretty sure that as a workarround you can use add 
something like...
	bq=*:*^0.001
...to your query.  based on the dismax structure, that should allow purely 
negative queries to work.



-Hoss


Re: NOT keyword - doesn't work with dismax?

Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
Naga Darbha wrote:
> I tried "-" even, but it works only with standard queries, but not "dismax".
>
> regards,
> Naga
>
> -----Original Message-----
> From: Koji Sekiguchi [mailto:koji@r.email.ne.jp] 
> Sent: Thursday, April 29, 2010 9:46 AM
> To: solr-user@lucene.apache.org
> Subject: Re: NOT keyword - doesn't work with dismax?
>
> Naga Darbha wrote:
>   
>> Hi,
>>
>> I am trying the NOT clause with dismax query type, and it is not working.  It works with the standard query type.  I tried the following query:
>>
>> q=NOT+keyword&fq=&qt=dismax&start=0&rows=26&fl=score
>>
>> But, when I replace qt=standard, it works.
>>
>> How to make it work with dismax query type?
>>
>> regards,
>> Naga
>>
>>   
>>     
> Use "-" instead of NOT when you use dismax.
>
> http://wiki.apache.org/solr/DisMaxRequestHandler#q
>
> Koji
>
>   
Ah, dismax doesn't support top-level NOT query.
I'm not sure extended dismax supports it because JIRA is not
currently available, but try to check:

https://issues.apache.org/jira/browse/SOLR-1553

Koji

-- 
http://www.rondhuit.com/en/


RE: NOT keyword - doesn't work with dismax?

Posted by Naga Darbha <nd...@opentext.com>.
I tried "-" even, but it works only with standard queries, but not "dismax".

regards,
Naga

-----Original Message-----
From: Koji Sekiguchi [mailto:koji@r.email.ne.jp] 
Sent: Thursday, April 29, 2010 9:46 AM
To: solr-user@lucene.apache.org
Subject: Re: NOT keyword - doesn't work with dismax?

Naga Darbha wrote:
> Hi,
>
> I am trying the NOT clause with dismax query type, and it is not working.  It works with the standard query type.  I tried the following query:
>
> q=NOT+keyword&fq=&qt=dismax&start=0&rows=26&fl=score
>
> But, when I replace qt=standard, it works.
>
> How to make it work with dismax query type?
>
> regards,
> Naga
>
>   
Use "-" instead of NOT when you use dismax.

http://wiki.apache.org/solr/DisMaxRequestHandler#q

Koji

-- 
http://www.rondhuit.com/en/


Re: NOT keyword - doesn't work with dismax?

Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
Naga Darbha wrote:
> Hi,
>
> I am trying the NOT clause with dismax query type, and it is not working.  It works with the standard query type.  I tried the following query:
>
> q=NOT+keyword&fq=&qt=dismax&start=0&rows=26&fl=score
>
> But, when I replace qt=standard, it works.
>
> How to make it work with dismax query type?
>
> regards,
> Naga
>
>   
Use "-" instead of NOT when you use dismax.

http://wiki.apache.org/solr/DisMaxRequestHandler#q

Koji

-- 
http://www.rondhuit.com/en/