I have an Azure Search index composed of documents that can "occur" in multiple regions any number of times. For example Document1
has 5 occurrences in Region1
, 20 occurrences in Region2
. Document2
has 54 occurrences in Region1
, and 10 occurrences in Region3
. Document3
has 10 occurrences in Region3
. We want to use Azure Search for searching and suggestions, but base the order on number of occurrences on a region. For example the search for Document
from a user in Region1
should return in the order Document2
, Document1
, Document3
because Document2
has 54 occurrences in that region, while Document1
has 5 occurrences and Document3
has none.
[
{ 'name': 'Document1', 'regions': ['Region1|5', 'Region2|20'] },
{ 'name': 'Document2', 'regions': ['Region1|54', 'Region3|10'] },
{ 'name': 'Document3', 'regions': ['Region3|10'] }
]
I'm having a hard time figuring out how to structure the index or if it is even possible with Azure Search. Please note that the number of regions is potentially in the hundreds of thousands. I am ok with changing regions for center points and use geospatial functions instead, but I still don't see how to lay the data or query it.
What is the best way to structure the index and how would one make the query possible?