2017-12-13 10 views
0

インデックス作成を実行するテーブルが4つあります。私の問題は、テーブルに優先度を設定する方法は?

私は重量ではなくテーブルの優先度による検索結果を得たいと思います。 I 平均的なテーブル1の一致した結果が最初に表2のように表示されます。

現在、最も高い重み付けで検索しています。

クエリ

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; 

答えて

0

まあまだ元SphinxAPIを使用している場合、SetIndexWeightsがあります。 http://sphinxsearch.com/docs/current.html#api-func-setindexweights データを別々の実際のインデックスに分割する必要があります。

... SphinxQLには等価物がありません。クエリを実行しているときに、その要因

sphinxQL> SELECT id,WEIGHT()*multiplier AS w FROM index WHERE MATCH(..) ORDER BY w DESC; 
を使用することができ、インデックス

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

sql_attr_uint = multiplier 

に新しい属性を追加するには私の知る限り

おそらく最も簡単な

関連する問題