J
J
JeanLouis2010-11-21 19:46:22
Sphinx
JeanLouis, 2010-11-21 19:46:22

SphinxQL and search by given fields?

Good evening!
I just can not find how to make it so that you can search for certain fields of the table.
For example, there is a table like:
Id
Field1
Field2
Field3

FieldN
It is specified as a source for indexing.
If you run queries against the created index, then the search will be performed on all fields of the strass. But the user has the opportunity to specify which fields to search for, for example, only Field2 and Field3.
Is it possible to make it possible to search for matches on different fields without generating all possible indexes from a combination of different fields?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Shedar, 2010-11-21
@JeanLouis

SELECT * FROM test WHERE MATCH('@title hello @body world')

S
Stepanow, 2020-05-20
@Stepanow

If you need to search only in the fields field1, field2 and field3, and the same search phrase, then the best option is this syntax:

SELECT * FROM index_name WHERE MATCH('@(field1,field2,field3) поисковая фраза')

no spaces after commas in field listing

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question