I am using Azure Search within a .Net application to search across several fields over multiple documents. When searching for a phrase by quoting the search keyword (for example "software developer"), the results include those that seem only to contain the word "software", ahead of those with the phrase "software developer". Are we misunderstanding how phrase searching should work?
I am using SearchMode.All and QueryType.Full
I am not supplying any filters in this case
Related
I've created Azure Search Suggester for "full_name" index field in order to support autocomplete functionality. Now when I use Azure autocomplete REST endpoint by using "search" parameter as a let's say "Lor" I only get back the result "Lorem" not the "Lorem Ipsum". Is there any way to disable tokenization for suggester and to get back full name like "Lorem Ipsum" for the search term "Lor" for autocomplete?
The Autocomplete API is meant to suggest search terms based on incomplete terms one is typing into to the search box (type-ahead). It supports three modes:
oneTerm – Only one term is suggested. If the query has two terms, only
the last term is completed. For example:
"washington medic" -> "medicaid", "medicare", "medicine"
twoTerms – Matching two-term phrases in the index will be suggested,
for example:
"medic" -> "medicare coverage", "medical assistant"
oneTermWithContext – Completes the last term in a query with two or
more terms, where the last two terms are a phrase that exists in the
index, for example:
"washington medic" -> "washington medicaid", "washington medical"
The twoTerms mode might work for you. If you're looking for an API that suggests documents based on an incomplete query term, try the Suggestions API. It returns the entire contents of a field that has a Suggester enabled for all documents that matched the query.
I have an index with nutritional information. A search for burger does not match hamburger or burgers.
What is the most appropriate & efficient way to be able to search for these with Azure Search? I can use wildcards to match burgers (i.e. burger*) but Azure Search does not support wildcards at the start of the query, so I can't figure out how to match hamburger.
You can achieve this by using Lucene query syntax (see link below) in azure search.
Construct your query by using querytype full (which enables Lucene query syntax) with your term as a search. As an example, to find all matches containing the word burger, construct your query like this (try it in the azure search, search explorer query window:
queryType=full&search=/.*burger.*/
Microsoft docs for Lucene query syntax
I'm using Azure Search and I have an index that has a field named 'keywords', which holds keywords (with type Collection(Edm.String)) related to a single document. I want to be able to use fuzzy search on my documents and as I understood from this link, all I have to do is put a '~' character to the end of my search query. However, this doesn't seem to work in my case.
I have a few documents in my index and one of them includes "fun" in its keywords. When I search for "run" with fuzzy search, I expect to see the documents with keyword "run", as well as "fun". If I know correctly, the edit distance between "fun" and "run" is only 1, which seems to be the default distance Azure Search's fuzzy search uses. Am I doing anything wrong here?
Or does the type Collection(Edm.String) not support fuzzy search? The attributes for 'keywords' are Searchable, Filterable and Retrievable.
Edit: I'm using the Standard Lucene Analyzer for the 'keywords' field. When I send the query
https://fakename.search.windows.net/indexes/fakeindex/docs?api-version=2016-09-01&search=run~
I would expect to get the following document as its keywords contain "fun"
"keywords": [
"balloon",
"message",
"text",
"monster",
"fun",
"evil",
"mad",
"cartoons",
"funny"
]
The fuzzy search feature is only supported in Lucene query syntax in Azure Search. Please specify queryType=full in the query string.
I am working on a search feature in which I have to perform search operation in about 300,000 documents.
For this I have created a compound index over four fields and have given weight to them as well. By default if I search for a phrase having multiple words then mongoose searches for all the keywords with OR operation. Eg:- If you search for small cell lung then mongoose will search all document in which either one of these is available.
It is working very fast.
But my requirement is to perform AND operation. To achieve this I split all the words in a phrase and then put them in double quotes.So when user searches for a phrase having multiple words, search operation is performed as AND operation on each word. Eg:- If you search for small cell lung ("small" "cell" "lung") then it should find all those documents in which all are available. It is also working but it is very slow now.
Is there any way to make it faster.
I will share the code if required.
Thanks
Give a shot to this :
db.table.find("text", {search:"\"small\" \"cell\" \"lung\""})
Now above code will do the following :
If the search string includes phrases, the search performs an AND with
any other terms in the search string; e.g. search for "\"kiss me on
\" cheeks lips" searches for "Kiss Me on" and ("cheecks" or
"lips").
You can read it from here:
Docs
When you want to match the complete phrase, enclose the phrase in escaped double quotes:
db.table.find( { $text: { $search: "small cell lung" } } )
Also see the $text documentation on the mongodb site
I have stemming enabled in my Solr instance, I had assumed that in order to perform an exact word search without disabling stemming, it would be as simple as putting the word into quotes. This however does not appear to be the case?
Is there a simple way to achieve this?
There is a simple way, if what you're referring to is the "slop" (required similarity) as part of a fuzzy search (see the Lucene Query Syntax here).
For example, if I perform this search:
q=field_name:determine
I see results that contain "determine", "determining", "determined", etc.. If I then modify the query like so:
q=field_name:determine~1
I only see results that contain the word "determine". This is because I'm specifying a required similarity of 1, which means "exact match". I can specify this value anywhere from 0 to 1.
Another thing you can do is index the same text without stemming in one field, and with stemming in another. Boost the non-stemmed field & that should prefer exact versions of words to stemmed versions. Of course you could also write your own query parser that directs quoted phrases to the non-stemmed field only.