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 Scott K <so...@skister.com> on 2010/10/29 23:49:48 UTC

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

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