Answer the question
In order to leave comments, you need to log in
Linking the user's status to products
For example, there are two tables in the database
and the
User can mark any product with status 1, 2, 3 or 4. Then, through sphinx, I need to get products by @user_id and @status.
There is still a weak implementation option:
Create MVA attributes:
The selection is done like this: SetFilter('status_1', id user)
But, if a lot of users set the status, this data will run through the network in the response ...
How else can you implement this?
TABLE `produces` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(200) NOT NULL,
PRIMARY KEY (`id`)
TABLE `produces_user_status` (
`produce` int(11) unsigned NOT NULL,
`user` int(11) unsigned NOT NULL,
`status` enum('1','2','3','4') NOT NULL,
UNIQUE KEY `key` (`produce`,`user`)
uint status_1 = produce, user ... where status=1
uint status_2 = produce, user ... where status=2
...
Answer the question
In order to leave comments, you need to log in
If the problem is that this data will run over the network in response, you can use SetSelect to not receive these MVA attributes.
If there are a lot of goods planned, then you can think about introducing special words. Since the sphinx makes the search by attributes a fullscan. It works fast by keeping the attributes in memory, but still. Therefore, for highly selective queries (the user cannot put down statuses for a million products purely physically), you can enter words with the user id and status id, or just the user id. And create a full-text field where to enter them. When searching, filter accordingly by this field according to the formed special word.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question