Answer the question
In order to leave comments, you need to log in
Why might wordforms Sphinx not work on RealTime indexes?
I started small, opened the official article about wordforms and created an index exactly as shown in the example:
https://sphinxsearch.com/blog/2014/12/04/how-to-us...
My config became like this:
indexer
{
mem_limit = 128M
}
searchd
{
listen = 9312
listen = 9306:mysql41
log = /var/log/sphinx/searchd.log
query_log = /var/log/sphinx/query.log
read_timeout = 5
max_children = 30
pid_file = /var/run/sphinx/searchd.pid
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
workers = threads # for RT to work
binlog_path = /var/lib/sphinx/
}
source tsv_test
{
type = tsvpipe
tsvpipe_command = cat sample.tsv
tsvpipe_field_string = title
}
index tsv_test
{
source = tsv_test
path = /var/lib/sphinx/tsv_test
wordforms = syns.txt
}
mysql -h0 -P9306
select * from tsv_test where match('c2d');
+------+------------+
| id | title |
+------+------------+
| 1 | Core 2 Duo |
+------+------------+
1 row in set (0.00 sec)
indexer
{
mem_limit = 128M
}
searchd
{
listen = 9312
listen = 9306:mysql41
log = /var/log/sphinx/searchd.log
query_log = /var/log/sphinx/query.log
read_timeout = 5
max_children = 30
pid_file = /var/run/sphinx/searchd.pid
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
workers = threads # for RT to work
binlog_path = /var/lib/sphinx/
}
source tsv_test
{
type = tsvpipe
tsvpipe_command = cat sample.tsv
tsvpipe_field_string = title
}
index tsv_test
{
source = tsv_test
path = /var/lib/sphinx/tsv_test
wordforms = syns.txt
}
index rt
{
type = rt
path = /var/lib/sphinx/rt
rt_field = title
rt_field = content
rt_attr_uint = gid
wordforms = syns.txt
}
INSERT INTO rt VALUES ( 1, 'Core 2 Duo', 'Core 2 Duo' , 5);
mysql> SELECT * FROM rt WHERE MATCH('Core 2 Duo');
+------+------+
| id | gid |
+------+------+
| 1 | 5 |
+------+------+
1 row in set (0.00 sec)
mysql> SELECT * FROM rt WHERE MATCH('c2d');
Empty set (0.00 sec)
c2d > Core 2 Duo
e6600 > Core 2 Duo
core 2duo > Core 2 Duo
Answer the question
In order to leave comments, you need to log in
This article helped me:
chakrygin.ru/2013/07/sphinx-search.html
Namely, this:
option The wordforms option specifies the path to a custom wordform file, which has two main purposes.
First, this file can be used to specify the correct normalized form of a word in cases where the stemmer does it wrong. For example, if you need to specify that the word "girls" is still a word form from the word "girl", then the following line can be added to the word forms file:
Please note that when using a stemmer, after the => sign, it is the stem of the word (“girl”, not “girl”) that must go. it is on the basis of the word that the search will subsequently be performed. Also note that if you use an index in utf-8 encoding, then the wordform file must also be saved in the same encoding.
As a result, the words "girl" and "girls" will be reduced to the same stem "girls" and will be considered the same in the search.
Most likely, you first created the RT index, and then wrote the wordforms. In this case, you should now see something like this:
mysql> show index rt settings;
+---------------+-----------------------+
| Variable_name | Value |
+---------------+-----------------------+
| settings | charset_type = utf-8
|
+---------------+-----------------------+
1 row in set (0.00 sec)
mysql> show index rt settings;
+---------------+--------------------------------------------+
| Variable_name | Value |
+---------------+--------------------------------------------+
| settings | charset_type = utf-8
wordforms = syns.txt
|
+---------------+--------------------------------------------+
1 row in set (0.00 sec)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question