首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SINPPET中的Sphinx Search use_boundaries

SINPPET中的Sphinx Search use_boundaries
EN

Stack Overflow用户
提问于 2017-02-15 13:53:42
回答 1查看 75关注 0票数 0

我有一个索引rt,配置如下

代码语言:javascript
复制
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
}

索引中的数据是

代码语言:javascript
复制
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索引到代码段。我为索引设置了边界。这样我就可以对spippent使用use_boundaries选项。但是我仍然没有得到预期的结果。

代码语言:javascript
复制
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通过‘语句’返回结果

EN

回答 1

Stack Overflow用户

发布于 2017-02-15 20:30:28

看不到任何use_boundaries不能工作的原因。

听起来你也想让limit_passages=1只得到结果中的一段。

也可能是allow_empty=1,用于处理第二个文档,其中无法突出显示查询单词。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42241671

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档