如何停止.在SQLite FTS4中被视为分隔符 [英] How to stop . being treated as a separator in SQLite FTS4

查看:112
本文介绍了如何停止.在SQLite FTS4中被视为分隔符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够在SQLite中使用FTS4搜索数字,例如2.3.被视为令牌边界.除了编写完整的定制令牌生成器之外,还有其他方法可以排除.从标记边界字符列表中获得?

I want to be able to search for numbers like 2.3 using FTS4 in SQLite, but the . is being treated as a token boundary. Short of writing a full bespoke tokenizer is there any other way of excluding the . from the list of token boundary characters?

能够搜索十进制数字似乎是一个常见的用例,但是我找不到与SO/Google相关的任何内容.目前,我最好的解决方案是全部替换.在文本中包含一个已知(长)字母字符串的字符,并在每次搜索中相应地替换为该字符...

Being able to search for decimal numbers seems like a common use case, but I can't find anything relevant on SO / Google. My best solution at present is to replace all . chars in the text with a known (long) string of letters and substitute accordingly on each search...

彼得

推荐答案

令牌生成器定义了令牌,因此您确实需要编写自己的令牌.

The tokenizer defines what tokens are, so you would indeed need to write your own.

您可以搜索短语"2 3",它将找到带有分隔符的数字2和3.

You could search for the phrase "2 3", which would find the numbers 2 and 3 with any separator.

这篇关于如何停止.在SQLite FTS4中被视为分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆