0

我想将我的 Solr4.7.2 结果按特定的相关顺序分组,这样我就有 3 列,即标题、摘要和内容,我正在对这些列进行 solr 搜索。

目前我正在通过执行此查询来使用简单查询解析器。

select?q=2016&fl=title%2Csummary%2Ccontent%2Cscore&wt=json&indent=true

它通过搜索字符串“2016”向我显示结果

{
  "responseHeader": {
    "status": 0,
    "QTime": 1,
    "params": {
      "q": "2016",
      "indent": "true",
      "fl": "title,summary,content,score",
      "wt": "json"
    }
  },
  "response": {
    "numFound": 5,
    "start": 0,
    "maxScore": 0.643841,
    "docs": [{
      "title": "Title",
      "summary": "2016 which u",
      "score": 0.643841
    }, {
      "title": "2016 which U The Most",
      "summary": "Summary",
      "score": 0.48288077
    }, {
      "content": [" \n \n  \n  \n  \n  \n  \n \n  def 2016 which U abcd\n \n  "],
      "score": 0.3219205
    }, {
      "content": [" \n \n  \n  \n  \n  \n  \n \n  def 2016 which U abcd\n \n  "],
      "score": 0.3219205
    }, {
      "content": [" \n \n  \n  \n  \n  \n  \n \n  2016 which U The most Important \n \n  "],
      "score": 0.3219205
    }]
  }
}

现在我想以一种方式对我的结果进行分组,确切的标题匹配应该首先以相关性顺序显示>然后是精确摘要匹配>然后是精确内容精确匹配。在另一组中,它应该显示较少得分的磁贴 > 摘要 > 内容。

对于前。预期结果应该是

{
  "responseHeader": {
    "status": 0,
    "QTime": 1,
    "params": {
      "q": "2016",
      "indent": "true",
      "fl": "title,summary,content,score",
      "wt": "json"
    }
  },
  "response": {
    "numFound": 5,
    "start": 0,
    "maxScore": 0.643841,
    "docs": [{
      "title": "2016 which U The Most",
      "summary": "Summary",
      "score": 0.48288077
    },{
      "title": "Title",
      "summary": "2016 which u",
      "score": 0.643841
    },{
      "content": [" \n \n  \n  \n  \n  \n  \n \n  2016 which U The most Important \n \n  "],
      "score": 0.3219205
    },{
      "content": [" \n \n  \n  \n  \n  \n  \n \n  def 2016 which U abcd\n \n  "],
      "score": 0.3219205
    }, {
      "content": [" \n \n  \n  \n  \n  \n  \n \n  def 2016 which U abcd\n \n  "],
      "score": 0.3219205
    }, ]
  }
}

我尝试通过应用 qf=title^2 摘要内容来使用 dismax 查询解析器,但它没有显示任何结果。

4

0 回答 0