跳到主要内容

groonga

# macOS
brew install groonga
groonga -n /tmp/test/test.db # 创建数据库
groonga /tmp/test/test.db # 进入数据库

# Docker
docker run -v $PWD/db:/db groonga/groonga /db
  • status
  • table_list
  • column_list
  • table_create
  • column_create
  • select
  • load
  • quite
status

table_create --name Site --flags TABLE_HASH_KEY --key_type ShortText
select --table Site

column_create --table Site --name title --type ShortText
select --table Site
load --table Site

select --table Site --query _id:1
select --table Site --query '_key:"http://example.org/"'

table_create --name Terms --flags TABLE_PAT_KEY --key_type ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
column_create --table Terms --name blog_title --flags COLUMN_INDEX|WITH_POSITION --type Site --source title

# 全文搜索
select --table Site --query title:@this

select --table Site --match_columns title --query this
select --table Site --output_columns _key,title,_score --query title:@test
select --table Site --offset 0 --limit 3

select --table Site --sort_keys -_id