0
我有一個Djapian索引是這樣的..怎麼辦標籤搜索上Djapian複合索引
class SomeModelIndexer(Indexer):
fields = ["body"]
tags = [('title', 'title', 2),
('tag', 'strtags')]
space.add_index(SomeModel, SomeModelIndexer, attach_as="indexer")
這讓我按標籤與像搜索搜索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
這樣的作品,但我也有一個CompositeIndexer其中包括SomeModelIndexer但搜索是索引器「標籤:香腸」返回零個結果。
composite_index = CompositeIndexer(SomeModel.indexer, AnotherModel.indexer)
In [4]: index.composite_index.search("tag:sausages").count()
Out[4]: 0L
任何線索我如何可以得到它的工作?