Answer the question
In order to leave comments, you need to log in
How to search in sphinx using and and or?
Good day.
There is a code with something like this logic:
$condition = '';
$order = 'id desc';
$limit = '0,30';
if($params['id'] == 0){
$condition = '
(user_id = :user_id and !user_deleted)
or (from_id = :user_id and !from_deleted)
';
} else {
$condition = '
(user_id = :user_id and from_id = :from_id and !user_deleted)
or (user_id = :from_id and from_id = :user_id and !from_deleted)
';
}
if(isset($params['lastId']) && $params['lastId']){
$condition = '('.$condition.') and id > :lastId';
if(!isset($params['firstId']) || !$params['firstId']){
$order = 'id asc';
}
}
if(isset($params['firstId']) && $params['firstId']){
$condition = '('.$condition.') and id < :firstId';
}
if(isset($params['text']) && $params['text']){
$condition = '('.$condition.') and text like :text';
/* :text = '%'.$params['text'].'%' */
$limit = -1;
}
Answer the question
In order to leave comments, you need to log in
What does it mean to rewrite through sphinx and why is it needed?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question