djangoとsphinxを使用して検索アプリを作成しています。セットアップは機能しましたが、検索すると無関係な結果が表示されます。これが私がすることです-
# this is in my trial_data Model
search = SphinxSearch(
index = 'trial_data trial_datastemmed',
weights = {'name': 100,},
mode = 'SPH_MATCH_ALL',
rankmode = 'SPH_RANK_BM25',
)
検索すると、これが(トライアルデータから)取得されます-
from trial.models import *
res = trial_data.search.query('godfather')
for i in res: print i
3 Godfathers (7.000000) Bonanno: A Godfather's Story (1999) (6.400000) Disco Godfather (4.300000) Godfather (6.100000) Godfather: The Legend Continues (0.000000) Herschell Gordon Lewis: The Godfather of Gore (2010) (6.900000) Mafia: Farewell to the Godfather (0.000000) Mumbai Godfather (2.600000) Russian Godfathers (2005) (7.000000) Stan Tracey: The Godfather of British Jazz (2003) (6.200000) The Black Godfather (3.500000) The Burglar's Godfather (0.000000) The Fairy Godfather (0.000000) The Fairy Godfather (0.000000) The Godfather (9.200000) The Godfather (1991) (6.400000)
問題は、「ゴッドファーザー」の最も関連性の高い結果が19番目の位置に表示されていることです。上位の結果はすべてジャンクです。を使用して、どのように私order
またはsort
私の結果を使用できますかDjango-sphinx
。
むしろ、この設定を使用して結果をより適切にするために何ができるでしょうか。
注:私はpython 2.6.x + django 1.2.x + sphinx 0.99 + django-sphinx 2.3.3+mysqlを使用しています
また、カスタムメイドのデータは約100行で、name
検索可能なフィールドは1つだけです。もう1つのフィールドがありますrating
(括弧内に表示されているものです)。rating
フィールドは属性です(検索不可)。