如何处理Postgres全文搜索中的错字错误

时间:2019-06-28 09:54:45

标签: sql postgresql full-text-search

我想使用Postgres中的全文本搜索来搜索某些文本 这是我的查询示例

select name, artist, texte
from testsearch
where to_tsvector(texte) @@ to_tsquery('randomname');

它只给我完全匹配'randomname'的结果,我希望它也匹配'ran','rand'radom'等...

2 个答案:

答案 0 :(得分:0)

select name, artist, texte
from testsearch
where to_tsvector(texte) @@ to_tsquery('rand:*');

答案 1 :(得分:-1)

尝试

merged <- merge(x = dt, y = dt2, by= "id", all.x = TRUE)
merged[!is.na(merged$val.y), ]$val.x <- paste0(
  merged[!is.na(merged$val.y), ]$val.x, ".",
  merged[!is.na(merged$val.y), ]$val.y)
merged[, val.y := NULL]
setnames(x = merged, old = "val.x", new = "val")
merged