Comments (3)
This is probably too late to answer your question but you can use pgroonga_query_expand function to achieve that.
Here is an example:
CREATE EXTENSION pgroonga;
-- create synonyms table
CREATE TABLE synonym_groups (
synonyms text[]
);
-- Add PGroonga Index
CREATE INDEX synonym_groups_synonyms
ON synonym_groups
USING pgroonga (synonyms pgroonga_text_array_term_search_ops_v2);
-- Insert synonyms words into table
INSERT INTO synonym_groups
VALUES (ARRAY['أحمد', 'احمد']);
-- Create sample data to try synonyms search
CREATE TABLE sample_texts (
sample text
);
-- Add PGroonga index
CREATE INDEX sample_texts_index
ON sample_texts
USING pgroonga (sample pgroonga_text_full_text_search_ops_v2);
-- I'm not familiar with Arabic Language so if something wrong with sample text down below, my apologies.
INSERT INTO sample_texts
VALUES ('أحمد عبدالواحد');
INSERT INTO sample_texts
VALUES (' لمعانٍ أخرى، طالع أحمد (توضيح).');
-- Now you can search either 'أحمد'OR 'احمد' and get both results back.
SELECT * FROM sample_texts
WHERE sample &@~ pgroonga_query_expand('synonym_groups', 'synonyms', 'synonyms', 'احمد');
-- sample
---------------------------------
-- أحمد عبدالواحد
-- لمعانٍ أخرى، طالع أحمد (توضيح).
-- (2 rows)
SELECT * FROM sample_texts
WHERE sample &@~ pgroonga_query_expand('synonym_groups', 'synonyms', 'synonyms', 'أحمد');
-- sample
---------------------------------
-- أحمد عبدالواحد
-- لمعانٍ أخرى، طالع أحمد (توضيح).
-- (2 rows)
Hope this will help you.
from pgroonga.github.io.
Thank you @askdkc , I will give it a try.
from pgroonga.github.io.
You can use NormalizerMySQLUnicode900
normalizer:
CREATE INDEX pgroonga_content_index
ON memos
USING pgroonga (content)
WITH (plugins='normalizers/mysql',
normalizers='NormalizerMySQLUnicode900');
Note that you need to install groonga-normalizer-mysql
package for this.
See also:
- https://github.com/groonga/groonga-normalizer-mysql
- https://pgroonga.github.io/reference/create-index-using-pgroonga.html#custom-normalizer
from pgroonga.github.io.
Related Issues (20)
- Remove prefix search from auto complete document
- how to set up chinese tokenizer ? HOT 1
- "How to implement auto complete feature" doesn't provide SELECT to be used HOT 1
- Cannot install groonga-tokenizer-mecab on CentOS8 HOT 1
- Re: Cannot install groonga-tokenizer-mecab on CentOS8 HOT 2
- Is fulltext search not work when input query just One character? HOT 6
- PGroongaのディレクトリについて HOT 1
- Update based PostgreSQL version on streaming replication document HOT 1
- doc: リリース手順を最新にする HOT 1
- doc: add description about tokenizer
- install: AlmaLinux 9 is missing
- Feature Request: Add Copy Button for Code Highlight Section
- Invalid link on windows installation page. HOT 1
- Invalid link on windows installation page HOT 1
- Failed to reinstall groonga with mecab on macOS ( Apple M1 Max ) HOT 1
- PGroonga の発音表記は間違っていると思いますが。 HOT 1
- Translation rake task generated differences in `.po` files
- Add reference for pgroonga_condition() function HOT 1
- pgroonga.enable_wal documenation has a dead link
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pgroonga.github.io.