我们可以一起使用语音标记和同义词吗?

时间:2019-02-07 14:56:55

标签: azure elasticsearch solr lucene

我正在尝试同时启用语音分析器和同义词。它似乎不起作用。一起使用是不对的?

在下面的实现中,我希望搜索查询使用同义词进行转换,然后使用语音分析器检索结果。但是我的同义词在这里被完全忽略了。

如果在创建索引的过程中删除了语音分析器,则同义词工作正常。

此外,如果我使用en.microsoft之类的内置分析器,则同义词可以正常工作;而不是自定义分析器。这是错误吗?

我的同义词地图

{   
   "name":"mysynonymmap",   
   "format":"solr", 
   "synonyms": "    
    SW, Software, Softvare, software, softvare, sft\n   
    HW, Hardware, Hardvare, hardware, hardvare, hdw => hardware\n"  
}

下面是如何创建索引

     "name": "newphonetichotelswithsynonyms",  
     "fields": [
       {"name": "hotelId", "type": "Edm.String", "key":true, "searchable": false},
       {"name": "baseRate", "type": "Edm.Double"},
       {"name": "description", "type": "Edm.String", "filterable": false, "sortable": false, "facetable": false, "analyzer":"my_standard",  
        "synonymMaps":[ 
            "mysynonymmap"  
        ]},
       {"name": "hotelName", "type": "Edm.String", "analyzer":"my_standard",    
        "synonymMaps":[ 
            "mysynonymmap"  
        ]},
       {"name": "category", "type": "Edm.String", "analyzer":"my_standard", 
        "synonymMaps":[ 
            "mysynonymmap"  
        ]},
       {"name": "tags", "type": "Collection(Edm.String)", "analyzer":"my_standard", 
        "synonymMaps":[ 
            "mysynonymmap"  
        ]},
       {"name": "parkingIncluded", "type": "Edm.Boolean"},
       {"name": "smokingAllowed", "type": "Edm.Boolean"},
       {"name": "lastRenovationDate", "type": "Edm.DateTimeOffset"},
       {"name": "rating", "type": "Edm.Int32"},
       {"name": "location", "type": "Edm.GeographyPoint"}
      ],
  "analyzers":[
    {
      "name":"my_standard",
      "@odata.type":"#Microsoft.Azure.Search.CustomAnalyzer",
      "tokenizer":"standard_v2",
      "tokenFilters":[ "lowercase", "asciifolding", "phonetic" ]
    }
  ]
     }````



0 个答案:

没有答案