0
我不確定這是我的問題或bin問題(我使用Win64的二進制文件/ MySQL支持2.0.6版本)。問題在於,當我找到並按sql_attr_str2ordinal字段進行排序時,我的搜索結果不正確。下面我附上搜索範例的dump(例如,我搜索「test」找到7個結果,然後我想按照leng_id排序,並且鍵0有效,但是另一個鍵1和2不起作用) 從轉儲我想你可以瞭解問題)。 轉儲:獅身人面像和過濾sql_attr_str2ordinal
c:\server\sphinx\bin>search.exe -a test
Sphinx 2.0.6-release (r3473)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file './sphinx.conf'...
index 'topicsIndex': query 'test ': returned 7 matches of 7 total in 0.000 sec
displaying matches:
1. document=18, weight=2602, topic_date_add=Tue Oct 30 01:16:19 2012, topic_publ
ish=1, topic_lang=1, tag=(19)
2. document=1, weight=2577, topic_date_add=Sun Sep 30 14:32:05 2012, topic_publi
sh=1, topic_lang=1, tag=(2)
c:\server\sphinx\bin>search.exe -a test
Sphinx 2.0.6-release (r3473)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file './sphinx.conf'...
index 'topicsIndex': query 'test ': returned 7 matches of 7 total in 0.000 sec
displaying matches:
1. document=18, weight=2602, topic_date_add=Tue Oct 30 01:16:19 2012, topic_publ
ish=1, topic_lang=1, tag=(19)
2. document=1, weight=2577, topic_date_add=Sun Sep 30 14:32:05 2012, topic_publi
sh=1, topic_lang=1, tag=(2)
3. document=19, weight=2577, topic_date_add=Tue Oct 30 01:17:24 2012, topic_publ
ish=1, topic_lang=2, tag=(20)
4. document=20, weight=2577, topic_date_add=Tue Oct 30 02:11:30 2012, topic_publ
ish=1, topic_lang=1, tag=(21)
5. document=3, weight=1556, topic_date_add=Sun Sep 30 15:54:52 2012, topic_publi
sh=1, topic_lang=2, tag=(4)
6. document=4, weight=1556, topic_date_add=Mon Oct 01 00:48:09 2012, topic_publi
sh=1, topic_lang=0, tag=(5)
7. document=17, weight=1556, topic_date_add=Tue Oct 30 00:17:39 2012, topic_publ
ish=1, topic_lang=0, tag=(18)
words:
1. 'test': 7 documents, 15 hits
index 'commentsIndex': query 'test ': returned 3 matches of 3 total in 0.000 sec
displaying matches:
1. document=242, weight=1646, comment_date=Wed Oct 31 01:40:51 2012, comment_del
ete=0, comment_topic_lang=1
2. document=1, weight=1606, comment_date=Sun Sep 30 22:55:56 2012, comment_delet
e=0, comment_topic_lang=1
3. document=241, weight=1606, comment_date=Tue Oct 30 02:11:46 2012, comment_del
ete=0, comment_topic_lang=1
words:
1. 'test': 3 documents, 4 hits
c:\server\sphinx\bin>search.exe -a test -f topic_lang 0
Sphinx 2.0.6-release (r3473)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file './sphinx.conf'...
index 'topicsIndex': query 'test ': returned 2 matches of 2 total in 0.000 sec
displaying matches:
1. document=4, weight=1556, topic_date_add=Mon Oct 01 00:48:09 2012, topic_publi
sh=1, topic_lang=0, tag=(5)
2. document=17, weight=1556, topic_date_add=Tue Oct 30 00:17:39 2012, topic_publ
ish=1, topic_lang=0, tag=(18)
words:
1. 'test': 7 documents, 15 hits
index 'commentsIndex': search error: .
c:\server\sphinx\bin>search.exe -a test -f topic_lang 1
Sphinx 2.0.6-release (r3473)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file './sphinx.conf'...
index 'topicsIndex': query 'test ': returned 0 matches of 0 total in 0.000 sec
words:
1. 'test': 7 documents, 15 hits
index 'commentsIndex': search error: .
c:\server\sphinx\bin>
但是,查詢「search.exe -a test -f topic_lang 0」只給出了topic_lang = 0的元素。就像第一個查詢一樣,我會執行「search.exe -a test -f topic_lang 1」,但不會通過topic_lang = 1獲取主題。但我知道這個主題的存在(你可以在查詢「search.exe -a test」中看到這個) – user1156168
使用整數字段來編碼lang或sql_field_string(你可以在其上進行全文匹配(例如,@topic_lang en)也排序) – aditirex
不明白整數字段,sql_field_string也不給我結果。你能解釋更多細節嗎?我想問一下關於sql_attr_str2ordinal的問題,如果這個參數只用於排序,爲什麼「search.exe -a test -f topic_lang 0」只給出了10個結果,從10開始。謝謝 – user1156168