1
我希望能夠一次查詢不同的模型並獲得全文搜索的聚合結果。即書籍和作者作爲單個列表,按照相關性排序。Django/Sphinx:如何查詢多個模型?
據我瞭解,在文檔中也提到,這是可能的,但有一個巨大的限制:
... The django-sphinx layer also supports some basic querying over multiple indexes ... Your indexes must contain exactly the same fields. These fields must also include a content_type selection which should be the content_type id associated with that table (model) ...
這是否意味着,該模型應具有完全相同的字段或如果只就足夠索引中的字段是常見的?這仍然是一個巨大的限制。爲什麼模型在可以從類本身獲取時應該包含content_type屬性?
如果爲不同型號的索引指定了相同的索引名稱會怎麼樣?是否有可能通過該索引進行搜索並獲得不同模型的結果?
此外,它說,這是需要配置獅身人面像搜索多個型號如下文檔中:
model_classes = (ModelOne, ModelTwoWhichResemblesModelOne)
output = generate_config_for_models(model_classes)
是否有人對此有什麼經驗嗎?