H
H
Hint2012-09-26 21:00:36
PHP
Hint, 2012-09-26 21:00:36

How to search in Sphinx across different tables with different fields?

There are different tables with different sets of fields. Created sources (source) and indexes (index) for all. There are no relationships between tables. I am using PHP API. Does sphinx allow searching these tables at the same time? Can id's in tables intersect (each table has an autoincrement primary key id from 1 and above)? Or is the only option to do multiple queries (per query for each index)?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Artem Bondarenko, 2012-09-26
@mr_avi

I'm making a special search table with example fields:
id | table_name | external_id | search_data...

D
Denis Pushkarev, 2012-09-26
@rock

Yes, you can. It used to be like it is now - I don't know.
Attention, shitcode!
In the config, in each source -

sql_attr_uint = tab

The request is something like:
1 as tab

(shit, but, like, just like that) The number is the identifier of the table.
At some conference I asked Aksenov - he did not offer a better option.
We are looking for several indexes. For each occurrence, the table id will be in ['attrs']['tab'].
Ids can intersect, but only one will be returned, the rest are ignored.

B
betal, 2012-09-26
@betal

I didn't know much about Sphinx. I can offer a simple crutch using union select, then the source will be one for two tables or make a representation from the same opera, which is also bony.

E
Eugen Typalchuk, 2013-12-25
@tipalchuk

I also had the same question, here's what helped
Sphinx search on different tables
If the topic is still relevant

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question