2017-12-13 14 views
0

Ich habe 4 Tabellen zur Indizierung. Mein Problem ist,Wie setzt man die Priorität auf Tabellen?

Ich möchte Suchergebnisse nicht nach Gewicht, sondern nach Tabellen Priorität bekommen. I Mittelwert Tabelle 1 übereinstimmende Ergebnisse zeigen zuerst dann für Tabelle 2 und so weiter.

Derzeit werden die Ergebnisse zuerst nach dem höchsten Gewicht abgerufen.

Abfrage

Select UUID_SHORT() AS sphinxid, info as keyword, 'column_name' as type from table 1 
UNION ALL 
Select UUID_SHORT() AS sphinxid, info as keyword, 'column_name' as type from table 2 
UNION ALL 
Select UUID_SHORT() AS sphinxid, info as keyword, 'column_name' as type from table 3 
UNION ALL 
Select UUID_SHORT() AS sphinxid, info as keyword, 'column_name' as type from table 4; 

Antwort

0

Nun, wenn noch original SphinxAPI verwendet wird, ist es ein SetIndexWeights. http://sphinxsearch.com/docs/current.html#api-func-setindexweights Obwohl müsste die Daten in separate tatsächliche Indizes aufgeteilt werden.

... gibt es in SphinxQL kein Äquivalent. AFAIK

Wahrscheinlich einfachsten ein neues Attribut auf den Index

sql_query = \ 
Select ...,8 as multiplier from table1 \ 
UNION ALL \ 
Select ...,4 as multiplier from table2 \ 
UNION ALL \ 
... 

sql_attr_uint = multiplier 

dann hinzuzufügen, wenn Abfragen ausgeführt wird, verwenden kann dieser Faktor

sphinxQL> SELECT id,WEIGHT()*multiplier AS w FROM index WHERE MATCH(..) ORDER BY w DESC; 
Verwandte Themen