Answer the question
In order to leave comments, you need to log in
How to search for words in sphinx?
How to search for words in sphinx?
conf:
source base {
type = mysql
sql_host = 0.0.0.0
sql_user = user
sql_pass = pass
sql_db = base
sql_port = 3306 # optional, default is 3306
sql_query_pre = SET NAMES utf8
}
source src_videos: base {
sql_range_step = 1000
sql_query_range = SELECT MIN(id), MAX(id) FROM table
sql_query = \
SELECT title, description, tags, UNIX_TIMESTAMP(date) as date, остальные поля FROM table WHERE id BETWEEN $start AND $end
sql_attr_string = title
sql_attr_string = description
sql_attr_string = tags
sql_attr_timestamp = date
}
index table {
source = src_videos
path = C:/sphinx/data/table/data_index
morphology = stem_enru
dict = keywords
index_exact_words = 1
expand_keywords = 1
min_word_len = 1
min_prefix_len = 3
}
indexer {
mem_limit = 200M
}
searchd {
listen = 9312
listen = 127.0.0.1:9306:mysql41
log = C:/sphinx/log/searchd.log
query_log = C:/sphinx/log/query.log
read_timeout = 5
max_children = 30
pid_file = C:/sphinx/log/searchd.pid
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
workers = threads # for RT to work
binlog_path = C:/sphinx/data
}
$pdo = new PDO('mysql:host=127.0.0.1;port=9306');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $pdo->query("SELECT * FROM table WHERE MATCH('фраза поиска или одно слово')");
$results = $stmt->fetchAll();
var_dump($results);
$stmt = $pdo->query("SELECT * FROM table WHERE MATCH('')");
Answer the question
In order to leave comments, you need to log in
according to the developers, then
sphinxsearch.com/docs/current/conf-min-word-len.html
min_word_len
Minimum indexed word length. Optional, default is 1 (index everything).
the problem is that "oven" is not the same as "stove". here "oven *" is equal to "stove".
read here
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question