P
P
Pauletto2014-10-10 13:29:04
Yii
Pauletto, 2014-10-10 13:29:04

What is the best way to organize search with pagination in Yii?

Good afternoon! Help to understand please. There are articles on the site, there will be a lot of them. You need to organize a search by tags, the name of the article, the text inside the news. I can't figure out if I do a search like this with pagination:

$criteria = new CDbCriteria;
        $criteria->addSearchCondition('t.name', $this->name);
        $pagination = new CPagination();
        $pagination->pageSize = 20;
        $pagination->applyLimit($criteria);

        return new CActiveDataProvider($this, array(
            'criteria' => $criteria,
            'pagination' => $pagination
        ));

And in the name there will be only 1 character (the site is in English and Chinese, in Chinese there are words in 1 character), should this not load the database much? I use MySQL, you can put a fulltext index and use match, you can use like. Naturally, this search will not be very accurate, as in the case of using some kind of sphinx. It is interesting in terms of the load on the database, is it worth doing this or what is the best way to implement such a search on MySQL (without a sphinx)?
Is it worth it with such a condition (search by 1 character) to highlight the titles of articles that fall under the search condition?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question