pgroonga
约 1 分钟阅读
- pgroonga/pgroongaGitHubpgroonga/pgroongapgroonga/pgroonga · 基于 Groonga · 支持索引 string int array jsonb · 支持操作 · &@ 搜索单个关键词 · &@ 搜索多个关键词 - 默认空格间隔为 AND 关系 · LIKE - ->笔记:pgroonga
- 基于 Groonga链接groonga.orgpgroonga/pgroonga · 基于 Groonga · 支持索引 string int array jsonb · 支持操作 · &@ 搜索单个关键词 · &@ 搜索多个关键词 - 默认空格间隔为 AND 关系 · LIKE - ->笔记:pgroonga
- 支持索引 string int array jsonb
- 支持操作
- &@ 搜索单个关键词
- &@~ 搜索多个关键词
Hello OR Hi- 默认空格间隔为 AND 关系 - LIKE -
like '%engine%'->&@ 'engine' - ILIKE
&~正则&@*相似搜索
- pgroonga_snippet_html - 高亮内容
<span class="keyword">fast</span>
- pgroonga_tokenize链接pgroonga.github.io/reference/functions/pgroonga-tokenize.htmlpgroonga/pgroonga · 基于 Groonga · 支持索引 string int array jsonb · 支持操作 · &@ 搜索单个关键词 · &@ 搜索多个关键词 - 默认空格间隔为 AND 关系 · LIKE - ->笔记:pgroonga
- 默认 TokenBigram
- double precision pgroonga_score(tableoid, ctid)
- 分数 - 多少个词匹配
# 基于 postgres:12-alpine
docker pull groonga/pgroonga:latest-alpine-12create extension if not exists pgroonga;
CREATE TABLE memos (
id integer,
content text
);
CREATE INDEX pgroonga_content_index ON memos USING pgroonga (content);
-- 测试禁用 seqscan 强制走索引
SET enable_seqscan = off;
-- 基于分数排序
SELECT *, pgroonga_score(tableoid, ctid) AS score
FROM score_memos
WHERE content &@ 'PGroonga' OR content &@ 'PostgreSQL'
ORDER BY pgroonga_score(tableoid, ctid) DESC;
-- 如果自己加了 friso 插件,可以注册
SELECT pgroonga_command('register tokenizer/friso');- tokenizer='TokenMecab'
- Yet Another Part-of-Speech and Morphological Analyzer
- taku910.github.io/mecab
- pgroonga.github.io/v1/reference/create-index-using-pgroonga.html
关联信息
反向链接、本文链接的其他页面和外部资料。
反向链接
- PostgreSQL 全文检索笔记 · pgroonga
简单场景 - 80%: like 或 fuzzystrmatch · 数据量少 - 业务数据 - 能够扫表 · 数据经常变化 · 基础场景 - 15%: 内建 tssearch + 中文分词插件 - zhparser,pgtrgm · 数据量大 - 需要索引
参考资料
GitHub1 条
- pgroonga/pgroongagithub.com/pgroonga/pgroonga
其他外链4 条
- groonga.orggroonga.org/
- pgroonga.github.io/reference/functions/pgroonga-tokenize.htmlpgroonga.github.io/reference/functions/pgroonga-tokenize.html
- pgroonga.github.io/v1/reference/create-index-using-pgroonga.htmlpgroonga.github.io/v1/reference/create-index-using-pgroonga.html
- taku910.github.io/mecabtaku910.github.io/mecab