2017-02-15 156 views
0

use_boundaries我有一個索引室溫用下面的配置獅身人面像搜索在SINPPET

index rt 
{ 

    type   = rt 
    min_stemming_len = 4 
    morphology = stem_en 
    wordforms = /home/mis/syns.txt 
    exceptions = /home/mis/exp.txt 
    # english charset defined with alias 
    #charset_table = 0..9, english, _ 
    phrase_boundary = ., ?, ! 
    path   = /var/lib/sphinxsearch/data/rt 
    rt_field  = title 
    rt_field  = content 
    rt_attr_string  = content 
    rt_attr_string  = title 
    rt_attr_uint  = gid 
} 
在指數

和數據是

mysql> select * from rt; 
+------+------+--------------------------------------------------------------------+-------+ 
| id | gid | content               | title | 
+------+------+--------------------------------------------------------------------+-------+ 
| 1 | 2 | This is a test with walks. Then No data shown. Wow This is fine. | test1 | 
| 2 | 2 | This is a test with walks           | test1 | 
+------+------+--------------------------------------------------------------------+-------+ 
2 rows in set (0.00 sec) 

我想只得到「哇,這是好的。」從rt索引與片段。 我設定了索引的邊界。所以我可以使用use_boundaries選項來執行spippent。但是我仍然沒有得到例外的結果。

SELECT id, SNIPPET(content, 'wow', 'use_boundaries=1') as t FROM rt; 
+------+---------------------------------------------------------------------------+ 
| id | t                   | 
+------+---------------------------------------------------------------------------+ 
| 1 | This is a test with walks. Then No data shown. <b>Wow</b> This is fine. | 
| 2 | This is a test with walks            | 
+------+---------------------------------------------------------------------------+ 
2 rows in set (0.01 sec) 

任何方式,我可以使用phrase_boundary通過「一句」

回答

0

不要返回結果的任何理由use_boundaries難道不工作。

聽起來像你想要limit_passages=1只得到一個結果的一段。

也許還allow_empty=1,處理第二個文件,其中它已經無法突出查詢詞。

+0

謝謝@barryhunter。有點奇怪 。我試圖從很長一段時間來使它工作:( –

+0

另外,如果你嘗試在www.unicourt.com上搜索,你可以在代碼片段中找到許多其他問題。 –

+0

雖然對那裏的問題有很好的描述,但需要給予更多的幫助那麼'很多問題' - 要真正知道你的問題是什麼...... – barryhunter