Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitac254bd

Browse files
author
Artur Zakirov
committed
Dictionary modules documentations fix
1 parent020050f commitac254bd

File tree

3 files changed

+86
-48
lines changed

3 files changed

+86
-48
lines changed
Lines changed: 69 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,78 @@
11
CREATE EXTENSION hunspell_ru_ru;
22
CREATE TABLE table1(name varchar);
3-
INSERT INTO table1 VALUES ('распространённости'), ('межнационального'),
4-
('включается'), ('значу'), ('зевнув'),
5-
('зевоты'), ('землей'), ('волчатами'), ('мойтесь');
6-
SELECTts_lexize('public.russian_hunspell', name)FROM table1;
7-
ts_lexize
8-
----------------------
9-
{распространённость}
10-
{межнациональный}
11-
{включаться}
12-
{значить}
13-
{зевнуть}
14-
{зевота}
15-
{земля}
16-
{волчонок}
17-
{мыться}
3+
INSERT INTO table1 VALUES ('земля'), ('землей'), ('землями'), ('земли'),
4+
('туши'), ('тушь'), ('туша'), ('тушат'),
5+
('тушью');
6+
SELECTd.* FROM table1 AS t, LATERAL ts_debug('public.russian',t.name)AS d;
7+
alias |description | token | dictionaries | dictionary | lexemes
8+
-------+-------------------+---------+---------------------------------+------------------+------------------------
9+
word | Word, all letters | земля | {russian_hunspell,russian_stem} | russian_hunspell | {земля}
10+
word | Word, all letters | землей | {russian_hunspell,russian_stem} | russian_hunspell | {земля}
11+
word | Word, all letters | землями | {russian_hunspell,russian_stem} | russian_hunspell | {земля}
12+
word | Word, all letters | земли | {russian_hunspell,russian_stem} | russian_hunspell | {земля}
13+
word | Word, all letters | туши | {russian_hunspell,russian_stem} | russian_hunspell | {туша,тушь,тушить,туш}
14+
word | Word, all letters | тушь | {russian_hunspell,russian_stem} | russian_hunspell | {тушь}
15+
word | Word, all letters | туша | {russian_hunspell,russian_stem} | russian_hunspell | {туша,тушить,туш}
16+
word | Word, all letters | тушат | {russian_hunspell,russian_stem} | russian_hunspell | {тушить}
17+
word | Word, all letters | тушью | {russian_hunspell,russian_stem} | russian_hunspell | {тушь}
1818
(9 rows)
1919

2020
CREATE INDEX name_idx ON table1 USING GIN (to_tsvector('public.russian', "name"));
21-
SELECT d.* FROM table1 AS t, LATERAL ts_debug('public.russian', t.name) AS d;
22-
alias | description | token | dictionaries | dictionary | lexemes
23-
-------+-------------------+--------------------+---------------------------------+------------------+----------------------
24-
word | Word, all letters | распространённости | {russian_hunspell,russian_stem} | russian_hunspell | {распространённость}
25-
word | Word, all letters | межнационального | {russian_hunspell,russian_stem} | russian_hunspell | {межнациональный}
26-
word | Word, all letters | включается | {russian_hunspell,russian_stem} | russian_hunspell | {включаться}
27-
word | Word, all letters | значу | {russian_hunspell,russian_stem} | russian_hunspell | {значить}
28-
word | Word, all letters | зевнув | {russian_hunspell,russian_stem} | russian_hunspell | {зевнуть}
29-
word | Word, all letters | зевоты | {russian_hunspell,russian_stem} | russian_hunspell | {зевота}
30-
word | Word, all letters | землей | {russian_hunspell,russian_stem} | russian_hunspell | {земля}
31-
word | Word, all letters | волчатами | {russian_hunspell,russian_stem} | russian_hunspell | {волчонок}
32-
word | Word, all letters | мойтесь | {russian_hunspell,russian_stem} | russian_hunspell | {мыться}
33-
(9 rows)
21+
SELECT * FROM table1 WHERE to_tsvector('public.russian', name)
22+
@@ to_tsquery('public.russian', 'землей');
23+
name
24+
---------
25+
земля
26+
землей
27+
землями
28+
земли
29+
(4 rows)
30+
31+
SELECT * FROM table1 WHERE to_tsvector('public.russian', name)
32+
@@ to_tsquery('public.russian', 'тушь');
33+
name
34+
-------
35+
туши
36+
тушь
37+
тушью
38+
(3 rows)
39+
40+
SELECT * FROM table1 WHERE to_tsvector('public.russian', name)
41+
@@ to_tsquery('public.russian', 'туша');
42+
name
43+
-------
44+
туши
45+
туша
46+
тушат
47+
(3 rows)
3448

3549
DROP INDEX name_idx;
3650
CREATE INDEX name_idx ON table1 USING GIST (to_tsvector('public.russian', "name"));
37-
SELECT d.* FROM table1 AS t, LATERAL ts_debug('public.russian', t.name) AS d;
38-
alias | description | token | dictionaries | dictionary | lexemes
39-
-------+-------------------+--------------------+---------------------------------+------------------+----------------------
40-
word | Word, all letters | распространённости | {russian_hunspell,russian_stem} | russian_hunspell | {распространённость}
41-
word | Word, all letters | межнационального | {russian_hunspell,russian_stem} | russian_hunspell | {межнациональный}
42-
word | Word, all letters | включается | {russian_hunspell,russian_stem} | russian_hunspell | {включаться}
43-
word | Word, all letters | значу | {russian_hunspell,russian_stem} | russian_hunspell | {значить}
44-
word | Word, all letters | зевнув | {russian_hunspell,russian_stem} | russian_hunspell | {зевнуть}
45-
word | Word, all letters | зевоты | {russian_hunspell,russian_stem} | russian_hunspell | {зевота}
46-
word | Word, all letters | землей | {russian_hunspell,russian_stem} | russian_hunspell | {земля}
47-
word | Word, all letters | волчатами | {russian_hunspell,russian_stem} | russian_hunspell | {волчонок}
48-
word | Word, all letters | мойтесь | {russian_hunspell,russian_stem} | russian_hunspell | {мыться}
49-
(9 rows)
51+
SELECT * FROM table1 WHERE to_tsvector('public.russian', name)
52+
@@ to_tsquery('public.russian', 'землей');
53+
name
54+
---------
55+
земля
56+
землей
57+
землями
58+
земли
59+
(4 rows)
60+
61+
SELECT * FROM table1 WHERE to_tsvector('public.russian', name)
62+
@@ to_tsquery('public.russian', 'тушь');
63+
name
64+
-------
65+
туши
66+
тушь
67+
тушью
68+
(3 rows)
69+
70+
SELECT * FROM table1 WHERE to_tsvector('public.russian', name)
71+
@@ to_tsquery('public.russian', 'туша');
72+
name
73+
-------
74+
туши
75+
туша
76+
тушат
77+
(3 rows)
5078

‎contrib/hunspell_ru_ru/sql/hunspell_ru_ru--1.0.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ CREATE TEXT SEARCH CONFIGURATION public.russian (
1616

1717
ALTERTEXT SEARCH CONFIGURATIONpublic.russian
1818
ALTER MAPPING FOR asciiword, asciihword, hword_asciipart
19-
WITHpublic.russian_hunspell,pg_catalog.english_stem;
19+
WITHpg_catalog.english_stem;
2020

2121
ALTERTEXT SEARCH CONFIGURATIONpublic.russian
2222
ALTER MAPPING FOR word, hword, hword_part

‎doc/src/sgml/hunspell-dict.sgml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,31 @@ SELECT * FROM ts_debug('public.english', 'abilities');
7474

7575
<para>
7676
Or you can create your own text search configuration. For example, with
77-
the created dictionary and with the <literal>simple</> dictionary:
77+
the created dictionaries and with the <literal>Snowball</> dictionary you can
78+
create mixed russian-english configuration:
7879

7980
<programlisting>
80-
CREATE TEXT SEARCH CONFIGURATION public.english (
81+
CREATE TEXT SEARCH CONFIGURATION public.russian_en (
8182
COPY = pg_catalog.simple
8283
);
8384

84-
ALTER TEXT SEARCH CONFIGURATION public.english
85-
ALTER MAPPING FOR asciiword, asciihword, hword_asciipart,
86-
word, hword, hword_part
87-
WITH public.english_hunspell;
85+
ALTER TEXT SEARCH CONFIGURATION public.russian_en
86+
ALTER MAPPING FOR asciiword, asciihword, hword_asciipart
87+
WITH public.english_hunspell, pg_catalog.english_stem;
88+
89+
ALTER TEXT SEARCH CONFIGURATION public.russian_en
90+
ALTER MAPPING FOR word, hword, hword_part
91+
WITH public.russian_hunspell, pg_catalog.russian_stem;
8892
</programlisting>
8993

9094
</para>
9195

96+
<para>
97+
You can create mixed dictionaries only for languages with different alphabets.
98+
If languages have similar alphabets then <productname>&productname;</> can not
99+
decide which dictionary should be used.
100+
</para>
101+
92102
<para>
93103
A text search configuration which is created with a dictionary module is ready
94104
to use. For example, in this text you can search some words:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp