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)
是否有人对此有什么经验吗?