Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

199
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda