不幸的是,我无法评论它与狮身人面像的比较,但我会坚持你的问题:)
Crate 的全文搜索具有 SQL 和 Lucene 的匹配能力,因此应该能够处理复杂的查询。我将只提供与您的输出匹配的查询,我认为它应该非常易读。
(“黑猫”-目录)| (了不起的生物)
select *
from mytable
where
(match(indexed_column, 'black cat') using phrase
and not match(indexed_column, 'catalog'))
or match(indexed_column, 'awesome creature') using best_fields with (operator='and');
黑<<大<<猫
select *
from mytable
where
match(indexed_column, 'black big cat') using phrase with (slob=100000);
这很棘手,似乎没有一个操作符与 Sphinx 中的操作符完全相同,但可以使用“slop”值进行调整。根据用例,可能还有另一种(更好的)解决方案......
你好 NEAR/10(妈妈|爸爸-亲爱的)
select *
from mytable
where
(match(indexed_column, 'hello mother') using phrase with (slop=10)
or match(indexed_column, 'hello father') using phrase with (slop = 10))
and not match(indexed_column, 'hello dear') using phrase with (slop = 10)
与 Sphinx 的语言相比,它们可能看起来有点笨拙,但它们工作正常 :)
性能方面,它们应该仍然非常快,这要归功于 Lucene。
干杯,克劳斯