2

我在 Solr 8.7.0 建议器中使用多个字典。每个都用于不同的类型字段,因为我需要使用不同的标记器。它们都使用相同的分析器(AnalyzingInfixLookupFactory),当我构建它们时,它们工作得很好。但是当我重新加载核心时,当调用一个字典时,答案来自另一个。我不明白这种行为。

     <lst name="suggester">
        <str name="name">autoSuggest</str>
        <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
        <str name="storeDir">suggester_infix_dir</str>
        <str name="dictionaryImpl">HighFrequencyDictionaryFactory</str>
        <str name="field">SUGESTAO</str>
        <str name="suggestAnalyzerFieldType">text_suggest</str>
        <str name="allTermsRequired">true</str>
        <str name="highlight">false</str>
    </lst>

    <lst name="suggester">
        <str name="name">autoSuggestWS</str>
        <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
        <str name="storeDir">suggest_ws_dict</str>
        <str name="dictionaryImpl">HighFrequencyDictionaryFactory</str>
        <str name="field">SUGESTAOTITULO</str>
        <str name="suggestAnalyzerFieldType">text_suggest_ws</str>
        <str name="allTermsRequired">true</str>
        <str name="highlight">false</str>
    </lst>
  </searchComponent>
  
  <requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy" >
    <lst name="defaults">
      <str name="suggest">true</str>
      <str name="suggest.count">5</str>
    </lst>

    <arr name="components">
      <str>suggest</str>
    </arr>
  </requestHandler>

使用 </p> 查询两个字典时的预期响应

“.../suggest?suggest=true&suggest.dictionary=autoSuggest&suggest.dictionary=autoSuggestWS&wt=json&suggest.build=true”

将会:

{
  "responseHeader":{
    "zkConnected":true,
    "status":0,
    "QTime":201},
  "suggest":{
    "autoSuggest":{
      "32":{
        "numFound":5,
        "suggestions":[{
            "term":"32",
            "weight":9284,
            "payload":""},
          {
            "term":"ata 32",
            "weight":8955,
            "payload":""},
          {
            "term":"32 2015",
            "weight":1177,
            "payload":""},
          {
            "term":"2015 ata 32",
            "weight":1174,
            "payload":""},
          {
            "term":"2015 ata 32 2015",
            "weight":1174,
            "payload":""}]}},
    "autoSuggestWS":{
      "32":{
        "numFound":5,
        "suggestions":[{
            "term":"32/2015",
            "weight":1177,
            "payload":""},
          {
            "term":"32/2015 ",
            "weight":1174,
            "payload":""},
          {
            "term":"ata 32/2015",
            "weight":1174,
            "payload":""},
          {
            "term":"ata 32/2015 ",
            "weight":1174,
            "payload":""},
          {
            "term":"32/2019",
            "weight":1077,
            "payload”:””}]}}}}

重新加载核心后我得到了什么:

{
  "responseHeader":{
    "zkConnected":true,
    "status":0,
    "QTime":1},
  "suggest":{
    "autoSuggest":{
      "32":{
        "numFound":5,
        "suggestions":[{
            "term":"32/2015",
            "weight":1177,
            "payload":""},
          {
            "term":"32/2015 ",
            "weight":1174,
            "payload":""},
          {
            "term":"ata 32/2015",
            "weight":1174,
            "payload":""},
          {
            "term":"ata 32/2015 ",
            "weight":1174,
            "payload":""},
          {
            "term":"32/2019",
            "weight":1077,
            "payload":""}]}},
    "autoSuggestWS":{
      "32":{
        "numFound":5,
        "suggestions":[{
            "term":"32/2015",
            "weight":1177,
            "payload":""},
          {
            "term":"32/2015 ",
            "weight":1174,
            "payload":""},
          {
            "term":"ata 32/2015",
            "weight":1174,
            "payload":""},
          {
            "term":"ata 32/2015 ",
            "weight":1174,
            "payload":""},
          {
            "term":"32/2019",
            "weight":1077,
            "payload":""}]}}}}
4

0 回答 0