How to get a search ranking for several factors in the sphinx?

Hi folks, stackoverflow,

We got a Rails project that grows and grows, and now we get the first search performance problems because we don’t know how to use sphinx for our needs. We have search queries such as "Java PHP Software developer." Our problem is that a rating should work with several things.

As search fields, we have a list of tags, a description and a name. If one of the terms is inside one of the fields, it should receive, for example, 2 points. More points if it is more in several fields, but not in several points if it is in the same field more than once. Next problem: I have a large file with synonyms, for which it also needs to be checked. It looks like this:

Java > Java
Java-EE > Java
...

So, if Java-EE is found, it should get some points, but with a penalty for a synonym.

The maximum number of points will be 5, as in 5 stars that will be displayed. Any quick solution would be good, because at the moment it is done in a regular ruby, and it is slowing down, because we cannot correctly rank in the sphinx.

, , .

. .

+3
2

, sphinx. , . , . -, , , , .

"title" , .

sphinx ( "title" "title_synonyms" ). : -

  • DISTINCT ( "Ruby Developer/Java Developer" "Ruby Developer/Java". . ""

  • DISTINCT . , . "Ruby Developer/Java-EE". . Java , . "title_synonyms"

, ; "title" "10" "title_synonyms" "3". , 4 , . .

, "Java Developer" . : -

  • Sphinx SPH_MATCH_EXTENDED

, : -

@title "Java Developer" | @title_synonyms "Java-EE"

lexemes, : -

@title ( "Java Developer" | "= Java = " ) | @title_synonyms ( "Java-EE" | "= Java-EE" )

SPH_RANK_PROXIMITY_BM25 SPH_RANK_SPH04, .

, , . SPH_RANK_MATCHANY SPH_RANK_WORDCOUNT .

SPH_RANK_PROXIMITY_BM25, SPH_RANK_SPH04 SPH_RANK_EXPR, .

. Ruby, sphinx ( ).

, ...

+2

.

-, sphinx , .

-, sphinx ( ) , . , , , , , , .

, , sphinx . sphinx . . , ruby ​​ , .

- , , .

, , N-. , .

- , b-. N-log-N (N N), , .

- , node ( , node) . . .

, , . .

, 100 . , . , 100 , .

101 . , , 99 ( ) .

, 100 . .

+1

All Articles