If I have "ice cube" in my index(record). Now if search "icecube" against shingle field, then it should logically show the results since shingle will create "ice","cube" and "icecube" as three tokens. I can see three token in the debugQuery but results are not shown. Is the shingle token "icecube" getting lost or is it ignored during search ?
Related
We have an index set up in Azure cognitive search that has two string fields (hash1 & hash2) containing separate hashes. We would like to query the index for documents where the two hashes within a document aren't equal.
I tried applying the filter: $filter=hash1 ne hash2, expecting the query to return all documents with mismatched hashes. Instead, I was greeted with the following error message:
"Invalid expression: Comparison must be between a field, range variable or function call and a literal value.\r\nParameter name: $filter"
From what I can gather there seems to be some kind of limitation preventing comparisons between fields. Would it be possible to perform this type of query in Azure cognitive search using a different technique?
I would use content enrichment in this case. Even if comparing two hashes with a query was supported, it would be inefficient compared to pre-calculating the value using a content enrichment technique.
Introduce a new boolean property called something like HasEqualHashes
Populate that property with an appropriate boolean value
Use a $filter to filter your content as you wish
search=whatever&$filter=HasEqualHashes
Note that two different scenarios determine how you can enrich your content.
CONTENT SUBMITTED VIA SDK
When you use the SDK to submit content, you can enrich your items any way you want using regular code. Populating your HasEqualHashes property is a trivial one-liner in C#.
CONTENT SUBMITTED USING BUILT-IN INDEXERS
If you use one of the built-in indexers, you have to learn and understand the concept of skillsets.
https://learn.microsoft.com/en-us/azure/search/cognitive-search-working-with-skillsets
Here are 2 search examples,
you can see the first search for "yael0079"
return an object where the email filed is yael0079#gmail.com as top score.
The second search for "yael0079#gmail.com"
return the object from before somewhere far below.
Now, I know the '#' tag consider as space, but still, I would expect the same object will get the higher score.
In the second case, since the # sign is considered punctuation, your query becomes yael0079 OR gmail.com. The term gmail.com matches also in other fields of the documents returned what adds to the overall relevance score. To learn more about query processing and scoring in Azure Search, please read: How full text search works in Azure Search.
I am trying to use Projection Query in orchard to filter my Projection based on the current Page. Right now I have a contentItem with a field called PageName which I am trying to match the value of. Can this be achieved using projections? I know that Tokens doesn't work in this scenario. What would be the best step of achieving what I am trying to do?
The tokens is well suited for this scenario.
Get current content item by token:
{Request.Content}
Get field by token:
{Content.Fields.YourPartName.PageName}
By combining these two tokens you can get what you need:
{Request.Content.Fields.YourPartName.PageName}
You can find token 1 and 2 in the drop-down list of tokens when you edit query filter.
I'm been searching around, and I dont understand why it is, that if I create a query for the projection and I say I want to filter a field of the returned Content Type by a Field of the current user, that no rows are returned.
If I replace the token with a hard coded value, it does work. I'm just missing some important understanding about why the token has no value.
This is not how it works. You may use tokens in projections as long as they are not expected to vary per record. Tokens can be used if they are external data (querystring parameters, etc.) To make your scenario work, you'll have to build your own filter.
Im using Solr 3.5.0, and in Schema I have enabled the LowerCaseFilterFactory in all needed fields, bbut When I search for example "shirts" im able to get the results, also when I search for "SHIRTS" i'm able to get expected results, but when I try to search with "shiRTs" its not giving the results. I know I'm missing some thing in Schema.
Please help me on this.
Thanks
Jeyaprakash.
Apply the same analysers and filters at both index and query time, so the the queries you search for match the tokens index.
As in your case -
If you apply the Lower case filter at index time but not at query time :-
Index token will be shirts, However as the search query is not analyzed SHIRTS or even Shirts will not match indexed shirts token.
The same would apply if you are using stemmers, stopwords or other filters.
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#Analyzers
Analyzers are components that pre-process input text at index time
and/or at search time. It's important to use the same or similar
analyzers that process text in a compatible manner at index and query
time. For example, if an indexing analyzer lowercases words, then the
query analyzer should do the same to enable finding the indexed words.