问题
Is there any possibility of using Dismax Query Parser like capabilities in Azure search. e.g. Query Fields (qf), Phrase Fields (pf), boost function or boost query.
I am aware of the fact that currently Azure Search supports lucene query syntax. Want to check if there is some another term / parser available for equivalent functionalities or if not then is AzureSearch team is looking to incorporate it in coming time.
Here is the link for reference to DismaxQueryParser https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser
Thanks
回答1:
Azure Search doesn't support DisMax queries. Depending on what you need out of DisMax queries you may be able to obtain similar results in other ways.
From the recall standpoint, DisMax queries are the same as Boolean queries in that for disjunctions both consider a document a match under the same conditions. The difference is that DisMax scores the resulting match by taking the highest individual match (plus an optional tie breaker) and Boolean queries add up the scores by default.
If what you need from DisMax is the simple syntax with quotes, +/-, etc. then using queryType=simple (the default) will give you most of that in Azure Search, with the exception of "~" (fuzzy/slop).
If what you need is the actual disjunction-maximum way of scoring matches, then that's not doable today.
As for the other features you mention:
- Query fields: there's a "searchFields" option in Azure Search queries that does that.
- Phrase fields: you can achieve this manually (although painfully) by querying for the individual terms and then groups of terms in quotes, and use different boosts (you'll need to use full lucene queries for this, simple queries won't do because of the individual term/group boosting).
- Boost function/query: there's nothing that maps 1:1 to this in Azure Search, but scoring profiles allow you to model many of the scenarios that you'd model with this.
For details on searchFields and other query options: https://docs.microsoft.com/en-us/rest/api/searchservice/search-documents
For details on scoring profiles: https://docs.microsoft.com/en-us/rest/api/searchservice/add-scoring-profiles-to-a-search-index
来源:https://stackoverflow.com/questions/40602738/azuresearch-dismax-query-parser-capabilities