場合によっては、Sphinxは、sql_attr_stringとして宣言したJOINフィールドなしで結果を返します。たとえば、次のソース/インデックス構成を考えてみましょう。
source myapp_recipe
{
type = pgsql
sql_host =
sql_user = me
sql_pass = secret
sql_db = myapp_db
sql_port =
sql_query = \
SELECT myapp_recipe.id as id, \
myapp_recipe.name as name, \
myapp_recipe.cookbook_id as cookbook_id, \
myapp_cookbook.name as cookbook_name, \
'recipe' as content_type \
FROM myapp_recipe \
INNER JOIN myapp_cookbook \
ON myapp_recipe.cookbook_id = myapp_cookbook.id
#content_type for django
sql_attr_string = content_type
# stored string fields in the document
sql_attr_string = cookbook_name
# stored and indexed string fields
sql_field_string = name
# ForeignKey's
sql_attr_uint = cookbook_id
}
index myapp_recipe
{
source = myapp_recipe
path = /var/data/myapp_recipe
docinfo = extern
morphology = none
stopwords =
min_word_len = 2
charset_type = utf-8
min_prefix_len = 0
min_infix_len = 3
enable_star = 0
}
一部の検索では、結果ドキュメントがcontent_type
と以外の属性なしで戻ってきますname
。同じドキュメントを返す別の検索の場合、Sphinxは、期待されるすべての属性を含む同じ結果ドキュメントを返す可能性があります。
例:「pizza」のクエリは、JOINされた文字列属性のない不完全な結果ドキュメント(documentA)を返します。
「ピザポケット」をクエリすると、予想されるすべてのJOIN属性を持つ同じドキュメント(documentA)が返されます。
誰かがこの不可解な行動を説明できますか?