V
V
Valery2015-08-14 20:04:04
PHP
Valery, 2015-08-14 20:04:04

sphinx + php. Why is the Weight in the response calculated incorrectly?

Sphinx is installed and more or less configured. When executed, displays the correct answers, and specifies the weight and sorts by it. Downloaded, configured the library to work with php. Connection and call code:
seacrh "проект"

$this->_cl = new \SphinxClient();
        $this->_cl->SetServer( "localhost", 9312 ); 
        $this->_cl->SetConnectTimeout( 1 ); 
        $this->_cl->SetMaxQueryTime(1000);
        $this->_cl->SetRankingMode( SPH_RANK_BM25 ) ;
        $this->_cl->SetMatchMode( SPH_MATCH_ALL  ); 
        $this->_cl->SetSortMode( SPH_SORT_RELEVANCE ) ;

        $result = $this->_cl->Query( $this->_q, $this->_indexName );

No errors - number of matches, list of words, etc. everything is right. BUT the weight of all results = 1. Ie. always the same and sorting does not occur.
Tried to change SetRankingMode - to no avail. What could be causing this behavior and how to overcome it.
Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Valery, 2015-08-16
@supervaleha

$this->_cl = new \SphinxClient();
        $this->_cl->SetServer( "localhost", 9312 );
        $this->_cl->SetConnectTimeout( 1 ); 
        $this->_cl->SetMaxQueryTime(1000); 

        $this->_cl->SetMatchMode( SPH_MATCH_EXTENDED  );     // <--------
        $this->_cl->SetSortMode( SPH_SORT_RELEVANCE ) ;
        $result = $this->_cl->Query( $this->_q, $this->_indexName );

D
Dimonchik, 2015-08-14
@dimonchik2013

you need to fight the library, of course,
try to expose this trinity

$this->_cl->SetRankingMode( SPH_RANK_BM25 ) ;
 $this->_cl->SetMatchMode( SPH_MATCH_ALL  ); 
 $this->_cl->SetSortMode( SPH_SORT_RELEVANCE ) ;

in the same modes as on the naked sphinx

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question