2017-02-15 158 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