当我使用' a:*' (还有' i:*',' s:*',' t:*')
SELECT id FROM mv_fulltextsearch1 WHERE to_tsvector(text) @@ to_tsquery('a:*') LIMIT 50;
永远占用并打印以下PostgreSQL输出
NOTICE: text-search query contains only stop words or doesn't contain lexemes, ignored
但是当我使用' b:*' (与':*')之前的任何其他单个字母相同
SELECT id FROM mv_fulltextsearch1 WHERE to_tsvector(text) @@ to_tsquery('b:*') LIMIT 50;
一切都很好
a,i,s和t是某种特殊字符吗?我怎样才能逃脱它们/修复这种奇怪的行为?
答案 0 :(得分:2)
使用UITableView
和print("%i", session.subsessions.count) // prints 3
print("%i", self.iSessionNumber) // prints 6
print("%i", self.sessions.count - 1) // prints 6
if session.subsessions.count > 1 || self.iSessionNumber == self.sessions.count - 1
{
// if called
}
else
{
}
原因是“英语”regconfig删除stop words而“a”被视为停用词
但是,'simple'regconfig不会删除停用词
答案 1 :(得分:0)
https://www.postgresql.org/docs/current/static/textsearch-controls.html#textsearch-parsing-queries
此外,*可以附加到词位以指定前缀匹配:
https://www.postgresql.org/docs/current/static/textsearch-controls.html#TEXTSEARCH-PARSING-QUERIES
虽然基本的tsquery输入以面值to_tsquery获取标记 使用指定或默认值将每个标记规范化为词位 配置,并丢弃任何停用词的令牌 配置。
这让我得出结论,你的to_tsquery
抛出 a 和我作为停用词,保留NO TEXT来查询...(参见在上面的文档中使用the rat and cat
的示例
例如,如果你(没有to_tsquery
因此停止不被丢弃的话)
with c(t) as (values('a an also at bond'),('but by illegal'),('I in it aligator'))
select t,to_tsvector(t) @@ ('a:*')::tsquery from c;
t | ?column?
-------------------+----------
a an also at bond | t
but by illegal | f
I in it aligator | t
(3 rows)
它会起作用......
关于停用词的参考:
-bash-4.2$ grep "^t$" /usr/share/pgsql93/tsearch_data/english.stop
t
t 就是那个...但我对英语的谦虚知识缺乏理解为什么