Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

189
Views
Azure Cognitive Search : Sort result by particular result String

Is there a way in azure search, to bring data orderby value to top and remaining below. Bringing the hotel's in user's location country to top and then other results

For example: See the sample data below

HotelName City Country RoomType rating
XYZ City1 India abc 4
UVW City2 Australia def 5
KWHK City3 India 6
KHUK City4 China 2

I want to get all the data, but country India should be at top result and remaining should be below. (which includes pagination).

I am doing lucene query POST search for same , and below is my query json body for same .

Query: { search: *, queryType: 'full', count: true, skip: 0, top: 10, scoringStatistics: 'global', searchMode: 'any', }

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

I believe if you include the country in your search should work, for example:

search=term OR (term and Country eq 'India')

a Similar question was answered by a MSFT product manager with more information:

https://stackoverflow.com/a/44766731/1384539

about 4 years ago · Juan Pablo Isaza Report

0

You should consider using the geo.distance function in Search, basically when querying, you need to pass the current user's location as a edm.GeographyPoint in the Function, then when ordering the results, you can order them by closest to fartest location from the user. Documentation on this, there you will also see some examples https://docs.microsoft.com/en-us/azure/search/search-query-odata-geo-spatial-functions

POST /indexes/hotels/docs/search?api-version=2020-06-30
    {  
      "search": "*",  
      "orderby": "geo.distance(Location, geography'POINT(-122.12315 47.88121)')"
    }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!