Сообщество IT-специалистов
Ответы на любые вопросы об IT
Профессиональное развитие в IT
Удаленная работа для IT-специалистов
index testIndex { source = testDocSrc path = /var/lib/sphinxsearch/data/test morphology = stem_enru, soundex, metaphone min_word_len = 3 charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42C->U+430..U+44C, U+42E..U+42F->U+44E..U+44F, U+430..U+44C, U+44E..U+44F, U+0401->U+0435, U+0451->U+0435, U+042D->U+0435, U+044D->U+0435 min_prefix_len = 3 min_infix_len = 0 html_strip = 1 expand_keywords = 1 index_exact_words = 1 dict = keywords # mlock = 0 # docinfo = extern # morphology = stem_en, stem_ru, soundex # morphology = libstemmer_german # morphology = libstemmer_sv # min_stemming_len = 1 wordforms = /var/lib/sphinxsearch/data/wordforms.txt # ngram_chars = U+3000..U+2FA1F # phrase_boundary = ., ?, !, U+2026 # horizontal ellipsis } indexer { mem_limit = 256M } searchd { listen = 127.0.0.1:9306:mysql41 listen = 127.0.0.1:9313 read_timeout = 5 max_children = 30 pid_file = /var/run/sphinxsearch/searchd.pid seamless_rotate = 1 max_matches = 10000 preopen_indexes = 1 unlink_old = 1 workers = threads # for RT to work binlog_path = /var/lib/sphinxsearch/data }
и текст запроса
$ar_post = Static_Func::getJson (); include('include/api/sphinxapi.php'); $sphinx = new SphinxClient(); $sphinx->SetServer( 'localhost', 9313 ); $gTitle = 'Результаты поиска'; $query = $_GET['sought']; $sphinx->SetLimits(0,3000,100000); $result = $sphinx->Query($query); if ( $result === false ) { echo "Query failed: " . $sphinx->GetLastError() . ".\n"; // выводим ошибку если произошла } else { if ( ! empty($result["matches"]) ) { ?> <? // если есть результаты поиска - обрабатываем их foreach ( $result["matches"] as $doc => $docinfo ) { echo $docinfo['attrs']['product_name']; } } }