Can we use Phonetic token and Synonyms together?

给你一囗甜甜゛ 提交于 2019-12-24 00:28:15

问题


I am trying to enable phonetic analyzer, and synonyms together. It doesn't seem to work. Is it wrong to use them together?

In the below implementation I would expect the search query be converted using synonyms and then phonetic analyzer be used to retrieve the results. But my synonyms are totally ignored in here.

If i remove the phonetic analyser as part of the index creation, then the synonyms are working fine.

Also, the synonyms work fine if i use the in built analyzers like en.microsoft; instead of custom analyzers. Is this a bug?

My Synonym map

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

Below is how the index is getting created

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



来源:https://stackoverflow.com/questions/54576138/can-we-use-phonetic-token-and-synonyms-together

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!