I am using Joomla 3.9 version.Basically I am developing search page where user can type keyword in search input and get list of all related list of article as result.Below is some sort of code I am working

$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
//set the application parameters
        $appParams = JFactory::getApplication()->getParams();

        //start the list of content from the beginning

        //gets how many to stop at from parameters or sets as 5
        $model->setState('list.limit',(int) $params->get('count',5));

        //filters out unpublished content

      $model->setState('a.id, a.fulltext, a.title, a.alias, a.title_alias, a.introtext, a.state, a.catid');

    //sorts out the ordering
            case 'pubAsc':
                $model->setState('list.direction', 'ASC');
            case 'pubDesc':
                $model->setState('list.direction', 'DESC');
                $model->setState('list.ordering', 'a.created');
                $model->setState('list.direction', 'DESC');


    //filter out other languages
        if($params->get('feat') == 1){

        $items = $model->getItems();
        return $items;                      

Note : This code is working fine with other filter in switch case But when  try to search article with  article name 
$model->setState('filter.search', 'Some article name or title keyword');

Result is not filtered,  getting  full list of article(no search filter applied). Please any body can suggest how can I filter article by name

0 Answers