1

django-sphinx のドキュメントは、django-sphinx レイヤーが複数のインデックスに対するいくつかの基本的なクエリもサポートしていることを示しています。

http://github.com/dcramer/django-sphinx/blob/master/README.rst

from djangosphinx.models import SphinxSearch

SphinxSearch('index1 index2 index3').query('hello')

SphinxSearch には query() 関数が含まれていないようです。また、django-sphinx のドキュメントに記載されているように、sphinx.conf sql_query 構成に content_type を含めようとしました。何も機能していません。

Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'SphinxSearch' object has no attribute 'query'

スフィンクスの複数のインデックスからランク付けされた結果を取得する方法について、誰でも光を当てることができますか

4

1 に答える 1

6

を使用する代わりに、使用しSphinxSearchたいSphinxQuerySet

たとえば、3 つのインデックスを照会する場合、、、、およびフィールドを使用して結果を重み付けし、カスタム マッチング ( title)およびランキング ( ) モードを設定します。tagscontentSPH_MATCH_EXTENDED2SPH_RANK_NONE

from djangosphinx.models import SphinxQuerySet

search = SphinxQuerySet(
    index = "index_1 index_2 index_n",
    weights = {
        'title': 100,
        'tags': 80,
        'content': 20
    },
    mode = 'SPH_MATCH_EXTENDED2',
    rankmode = 'SPH_RANK_NONE')

results = search.query('what is the answer to life, the universe, and everything?')

for result in results:
    print result
于 2009-11-22T20:29:21.207 に答える