D
D
De YURII2016-01-18 19:31:57
PHP
De YURII, 2016-01-18 19:31:57

How to make relevant content with Sphinx?

There is a table with title, content posts. It is
necessary to display 5 role-playing pages, how to implement using php, I understand, I'm interested in indexing and correct display.
As I understand it, indexing occurs on individual fields, but how to search for relevant information based on the entire title + content text when I search

$query = SphinxQL::create($conn)->select('*')->from('site')->match(array('title','content'), $q);
$query = SphinxQL::create($conn)->select('*')->from('site')->match('title', $q)->match('content', $q);
//это не то что мне надо.

config
source site {
type = mysql
sql_host = localhost
sql_user = admin_site
sql_pass = ******
sql_db = admin_site_db
sql_port = 3306
sql_query_pre = SET NAMES utf8

sql_query = SELECT id,title,content,uri,ctime FROM search

sql_attr_bigint = id
sql_attr_timestamp = ctime
sql_attr_string = uri
sql_field_string = title
}

index site {
source = site
path = /home/admin/web/site.ru/sphinx_data/data
docinfo = extern
mlock = 0
morphology = stem_enru
min_word_len = 2
min_infix_len = 2
enable_star = 1
}

indexer {
mem_limit = 32M
}

searchd {
listen = 127.0.0.1:3307:mysql41
log = /home/admin/log/searchd.log
query_log = /home/admin/log/query.log
read_timeout = 5
max_children = 30
pid_file = /home/admin/log/searchd.pid
max_matches = 1000
compat_sphinxql_magics = 0
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xmoonlight, 2016-01-19
@xmoonlight

Form from two selections - an intermediate table of results, where in one field there will be both title and content and then again a query on this table.
Those. in 3 requests.

P
Puma Thailand, 2016-01-18
@opium

make an index on both fields

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question