Azure-docs: Performing search.in on an Int32 field

Created on 7 Aug 2019  Â·  7Comments  Â·  Source: MicrosoftDocs/azure-docs

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,


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri2 cxp product-question searcsvc triaged

All 7 comments

@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

please-close

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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JeffLoo-ong picture JeffLoo-ong  Â·  3Comments

monteledwards picture monteledwards  Â·  3Comments

jharbieh picture jharbieh  Â·  3Comments

JamesDLD picture JamesDLD  Â·  3Comments

jamesgallagher-ie picture jamesgallagher-ie  Â·  3Comments