Sphinx在SINPPET中搜索use_boundaries

时间:2017-02-15 05:53:42

标签: sphinx

我有一个带有以下配置的索引rt

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 index with snippet。 我为索引设置了边界。这样我就可以使用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通过'sentence'返回结果

1 个答案:

答案 0 :(得分:0)

没有看到use_boundaries无法工作的任何原因。

听起来像希望limit_passages=1只获得结果中的一个段落。

也许还allow_empty=1来处理第二个文档,它无法突出显示查询字。