如何以Solr的特定顺序获取相关的搜索结果。

时间:2016-01-25 07:28:26

标签: solr solrj edismax solr-query-syntax dismax

我想将我的Solr4.7.2结果分组到特定的相关顺序,这样我就有3列,即Title,Summary和Content,我正在进行solr搜索。

目前我通过执行此查询来使用Simple Query Parser。

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

现在,我想以一种方式对结果进行分组,即完全标题匹配应首先按相关性顺序显示>那么精确摘要匹配>那么Exact Contenct完全匹配。 在另一组中,它应该显示较少可评价的瓷砖>摘要>内容。

对于Ex。预期结果应为

{
  "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查询解析器,但它没有向我显示任何结果。

0 个答案:

没有答案