D
D
DeusModus2010-11-02 23:55:16
Sphinx
DeusModus, 2010-11-02 23:55:16

Sphinx: search result for a word?

Actually, I began to deal with the Sphinx. Delivered, configured, constructed an index. Performed a search (“find-> word”).
And here's what I don't quite understand - can Sphinx return all fields in the search results?
Let's say I install

sql_query = SELECT id,name,surname FROM test;

And I'm looking for the part of the word "you". How can I get name and surname besides id? Logic tells me that if I can find all "You" <b>, then the index stores both name and surname, so why would I need to ask the database again for their names by id, if I can get them from sphinx. Unclear.
PS: I admit that everything is very simple, but a cursory search through the documentation did not lead me to bright thoughts.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
Iskander Giniyatullin, 2010-11-03
@DeusModus

By default, it is not possible to store and receive fulltext fields in the sphinx (because they are simply not stored anywhere as a full value, this is how the sphinx indexes are arranged).
In 1.10-beta, it became possible to store string attributes (and receive them in the selection results).
If you want to use a string attribute for fulltext search, then it must be described as sql_field_string The
maximum value size for it is 4 megabytes
It must be remembered that the sphinx always keeps all attributes in RAM, so if you create a lot of string attributes, you may have problems with the RAM

E
Eugene, 2010-11-03
@Nc_Soft

Apparently, you initially did not understand how it works. The document id (primary key) is returned in the order that was specified during the search (sorting, relevance, etc.), then the rest of the data is pulled out by these id, and in order not to disturb the order, it is necessary to apply ORDER BY FIELD in the query

A
Alex Shinkevich, 2010-11-03
@aleXoid

Only from the console, otherwise it returns only id fields. Knowing the id of problems with finding additional. fields usually do not appear

S
sergey_novikov, 2010-11-03
@sergey_novikov

1.10-beta seems to have the ability to store strings (previously only numbers etc.):
sphinxsearch.com/docs/manual-1.10.html#conf-sql-attr-string
sphinxsearch.com/docs/manual- 1.10.html#conf-sql-field-string

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question