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

211
Visualizações
postgres sphinx search order

I have a postgres install with Sphinx and when I run query I want that most relevant records to be selected first. In other words, I want the following query first:

query="word1 & word2 & word3"

and then, if nothing selected,

query="word1 | word2 | word3"

How to configure sphinx for that needs? Sphinx config is default

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Well https://github.com/andy128k/pg-sphinx says

sphinx_select(
/*index*/     varchar,
/*query*/     varchar,
/*condition*/ varchar,
/*order*/     varchar,
/*offset*/    int,
/*limit*/     int,
/*options*/   varchar)

And from http://sphinxsearch.com/docs/current.html#sphinxql-select you want a OPTIONS clause to change the ranking (a ranker option)

http://sphinxsearch.com/docs/current.html#weighting

So would try

sphinx_select(...., "word1 | word2 | word3", ..., "ranker=wordcount")

(edited to show the query in place too, need the OR query for this to work! see comments above)

(wordcount ranker, is very basic, but should do the exact criteria you want)

But can play with custom expressions, not great, but get you started...

sphinx_select(....,  "ranker=expr('sum(word_count+hit_count+lccs+exact_order)+bm25')")

MUCH more detail... http://sphinxsearch.com/blog/2010/08/17/how-sphinx-relevance-ranking-works/

over 4 years ago · Santiago Trujillo 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