括号内纯粹否定查询的解析不一致

时间:2016-07-15 09:29:54

标签: solr lucene

这两个查询只是通过在否定查询周围添加括号来返回不同的结果。我无法理解为什么第二个查询只是通过添加括号来返回空结果。

没有括号:

{
  "responseHeader": {
    "status": 0,
    "QTime": 0,
    "params": {
      "q": "*:*",
      "indent": "true",
      "fq": "-fl_monitoring_channel: 36 AND (title: salesforce)",
      "wt": "json",
      "_": "1467637035433"
    }
  },
  "response": {
    "numFound": 35541,
    "start": 0,
    "docs": [...

使用括号:

{
  "responseHeader": {
    "status": 0,
    "QTime": 0,
    "params": {
      "q": "*:*",
      "indent": "true",
      "fq": "(-fl_monitoring_channel: 36) AND (title: salesforce)",
      "wt": "json",
      "_": "1467637344339"
    }
  },
  "response": {
    "numFound": 0,
    "start": 0,
    "docs": []
  }
}

添加debugQuery = true后:

我仍然不明白这里发生了什么。 没有括号:

"debug": {
    "rawquerystring": "*:*",
    "querystring": "*:*",
    "parsedquery": "MatchAllDocsQuery(*:*)",
    "parsedquery_toString": "*:*",
    "explain": {
      "brief.1054522": "\n1.0 = *:*, product of:\n  1.0 = boost\n  1.0 = queryNorm\n",
      "brief.1070810": "\n1.0 = *:*, product of:\n  1.0 = boost\n  1.0 = queryNorm\n",
      "brief.1067146": "\n1.0 = *:*, product of:\n  1.0 = boost\n  1.0 = queryNorm\n",
      "brief.1067658": "\n1.0 = *:*, product of:\n  1.0 = boost\n  1.0 = queryNorm\n",
      "brief.1112418": "\n1.0 = *:*, product of:\n  1.0 = boost\n  1.0 = queryNorm\n",
      "brief.1112426": "\n1.0 = *:*, product of:\n  1.0 = boost\n  1.0 = queryNorm\n",
      "brief.1058810": "\n1.0 = *:*, product of:\n  1.0 = boost\n  1.0 = queryNorm\n",
      "brief.1070274": "\n1.0 = *:*, product of:\n  1.0 = boost\n  1.0 = queryNorm\n",
      "brief.1062330": "\n1.0 = *:*, product of:\n  1.0 = boost\n  1.0 = queryNorm\n",
      "brief.1064650": "\n1.0 = *:*, product of:\n  1.0 = boost\n  1.0 = queryNorm\n"
    },
    "QParser": "LuceneQParser",
    "filter_queries": [
      "-fl_monitoring_channel: 36 AND (title: salesforce)"
    ],
    "parsed_filter_queries": [
      "-fl_monitoring_channel:36 +title:salesforc"
    ],
    "timing": {
      "time": 33,
      "prepare": {
        "time": 0,
        "query": {
          "time": 0
        },
        "facet": {
          "time": 0
        },
        "facet_module": {
          "time": 0
        },
        "mlt": {
          "time": 0
        },
        "highlight": {
          "time": 0
        },
        "stats": {
          "time": 0
        },
        "expand": {
          "time": 0
        },
        "debug": {
          "time": 0
        }
      },
      "process": {
        "time": 32,
        "query": {
          "time": 28
        },
        "facet": {
          "time": 0
        },
        "facet_module": {
          "time": 0
        },
        "mlt": {
          "time": 0
        },
        "highlight": {
          "time": 0
        },
        "stats": {
          "time": 0
        },
        "expand": {
          "time": 0
        },
        "debug": {
          "time": 4
        }
      }
    }

使用括号:

"debug": {
    "rawquerystring": "*:*",
    "querystring": "*:*",
    "parsedquery": "MatchAllDocsQuery(*:*)",
    "parsedquery_toString": "*:*",
    "explain": {},
    "QParser": "LuceneQParser",
    "filter_queries": [
      "(-fl_monitoring_channel: 36) AND (title: salesforce)"
    ],
    "parsed_filter_queries": [
      "+(-fl_monitoring_channel:36) +title:salesforc"
    ],
    "timing": {
      "time": 0,
      "prepare": {
        "time": 0,
        "query": {
          "time": 0
        },
        "facet": {
          "time": 0
        },
        "facet_module": {
          "time": 0
        },
        "mlt": {
          "time": 0
        },
        "highlight": {
          "time": 0
        },
        "stats": {
          "time": 0
        },
        "expand": {
          "time": 0
        },
        "debug": {
          "time": 0
        }
      },

0 个答案:

没有答案