0

私はこのようなDjapianインデクサーを持っています。

class SomeModelIndexer(Indexer):
   fields = ["body"]
   tags = [('title', 'title', 2),
           ('tag', 'strtags')]

space.add_index(SomeModel, SomeModelIndexer, attach_as="indexer")

これにより、「tag:sausages」のような検索でタグでSomeModelsを検索できます。これにより、「sausages」でタグ付けされたSomeModelsが検索されます。(strtagsは、SomeModelの@property装飾関数です)。

In [1]: from project.someapp.models import SomeModel
In [2]: from project.someapp import index
In [3]: SomeModel.indexer.search("tag:sausages").count()
Out[3]: 2L

これは機能しますが、SomeModelIndexerを含むCompositeIndexerもありますが、そのインデクサーで「tag:sausages」を検索しても結果はゼロになります。

composite_index = CompositeIndexer(SomeModel.indexer, AnotherModel.indexer)

In [4]: index.composite_index.search("tag:sausages").count()
Out[4]: 0L

それをどのように機能させるかについての手がかりはありますか?

4

1 に答える 1

2

バグを報告するべきだと思います。

あなたがsausagesそれだけを検索するならば、それはいくつかの結果を返すはずです。

チュートリアルに従って、いくつかのテストを行い、いくつかのクエリを実行しました。

Person.indexer.search("name:alex").count() --> 2L --> OK
Movie.indexer.search("director:alex").count() --> 1L --> OK

index.complete_indexer.search("name:alex").count() --> 0L --> WRONG
index.complete_indexer.search("director:alex").count() --> 0L --> WRONG
index.complete_indexer.search("alex").count() --> 3L --> OK

complete_indexerCompositeIndexer両方のインデックスの間です。

于 2012-09-19T14:45:18.900 に答える