未加星标

Using Synonyms in Azure Search

字体大小 | |
[系统(windows) 所属分类 系统(windows) | 发布者 店小二03 | 时间 2018 | 作者 红领巾 ] 0人收藏点击收藏

Using Synonyms in Azure Search
Azure Search. Image from: https://azure.microsoft.com/en-us/services/search/

Azure search has been around for years now:

Azure Search is a search-as-a-service cloud solution that gives developers APIs and tools for adding a rich search experience over private, heterogenous content in web, mobile, and enterprise applications. Query execution is over a user-defined index.

* Build a search corpus containing only your data, sourced from multiple content types and platforms.

* Leverage AI-powered indexing to extract text and features from image files, or entities and key phrases from raw text.

* Create intuitive search experiences with facet navigation and filters, synonyms, auto-complete, and text analysis for “did you mean” auto-corrected search terms.

* Add geo-search for “find near me”, language analyzers for non-English full text search, and scoring logic for search rank.

But it is getting better everyday! Recently there a cool new feature available in Azure Search called Synonyms.

With Synonyms you can allow Azure Search to link equivalent terms that implicitly expand the scope of a query, without the you having to provide the synonym terms.

It does exactly what you guessed it does. You can define synonyms for certain terms and the query would return regardless of which one of the synonyms are searched for.

Synonym Maps

In Azure Search, synonym support is based on synonym maps that user defines and uploads to their search service.

These maps constitute an independent resource, such as indexes or data sources, and you can use them by any searchable field in any index in your search service.

Synonym maps use the Apache Solr format as outlined in the example synonym map below:

POST https://[servicename].search.windows.net/synonymmaps?api-version=2017-11-11
api-key: [admin key]
{
"name":"mysynonymmap",
"format":"solr",
"synonyms": "
USA, United States, United States of America\n
Washington, Wash., WA => WA\n"
}

In the above snippet, you can see there are two types of synonyms that are used.

The first example is a set of synonyms which indicate that a user could search using any of the three terms (“USA”, “United States”, or “United States of America”) in their query and any document that contains either of these terms will become viable search results.

The second example is an explicit mapping and is denoted by an arrow “=>” that states that a search query that matches the left hand side of “=>” will be replaced with the alternatives on the right hand side.

Given the rule below, search queries “Washington”, “Wash.”, or “WA” will all be rewritten to “WA”.

Explicit mapping only applies in the direction specified and does not rewrite the query “WA” to “Washington” in this case.

Which approach do Iuse?

The first optionis useful in situations where you have multiple ways of referring to the same thing in the index.

The secondis good when the data is normalized to single value in the index, but people would refer to the same thing by multiple terms in a query.

Once the synonym map has been created, you can then associate it with any fields within your indexes. Afterwards, the synonym map can be updated with new synonyms that will instantly be incorporated into subsequent searches. For example, if you were using the REST API to create your Azure Search index, you could apply it to a field called “description” as follows:

POST https://[servicename].search.windows.net/indexes?api-version=2017-11-11
api-key: [admin key]
{
"name":"myindex",
"fields":[
{
"name":"id",
"type":"Edm.String",
"key":true
},
{
"name":"description",
"type":"Edm.String",
"searchable":true,
"synonymMaps":[
"mysynonymmap"
]
}
]
}

Cheers!

本文系统(windows)相关术语:三级网络技术 计算机三级网络技术 网络技术基础 计算机网络技术

代码区博客精选文章
分页:12
转载请注明
本文标题:Using Synonyms in Azure Search
本站链接:https://www.codesec.net/view/610902.html


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(windows) | 评论(0) | 阅读(70)