Is it possible to do search.in
on a numeric field, or number only? I have a productId field that is defined as Edm.Int32
and would like to filter on this e.g. `search.in(productId, '1,2,5', ','). However this comes up with an error which I believe is because it's an int, not a string,
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@ADringer, Thanks for the question! We are taking a look into this and will get back to you soon.
@ADringer The search.in
function supports string fields only.
@ADringer, As Bruce mentioned 'The search.in function supports string fields only'. Kindly let us know if this helps and this issue is good to be closed. Thanks again for your feedback!
@ADringer here is a link to the $filter reference doc, if that helps at all: https://docs.microsoft.com/en-us/azure/search/search-query-odata-filter#examples.
I can also recommend this forum if you want engineering or community feedback on your approach: https://stackoverflow.com/questions/tagged/azure-search
This is still unsolved as far as I can see? I can't a good solution to this anywhere online. Do you have a recommended solution? If not, imo the issue should still be open.
The only "solution" I can think of is to add another field to my document with a stringified version of the int alongside the actually int id. Like so:
{id: 123, name: "James", idAsString: "123"}
Then I would be able to use search.in
on it. However, that is quite a hack imo. It seems strange that there is no way to filter on a list of (int) ids?
Hi @drhumlen, you can filter on numeric data: https://docs.microsoft.com/en-us/azure/search/search-filters#numeric-filter-fundamentals
You just can't use search.in on a numeric field. Does this help?