src/FilterSetting/Text.php
private function doComplexSearch($strTextSearch, $objFilter, $arrFilterUrl)
    {
        $objMetaModel  = $this->getMetaModel();
        $objAttribute  = $objMetaModel->getAttributeById($this->get('attr_id'));
        $arrLanguages  = $this->getAvailableLanguages($objMetaModel);
        $strParamName  = $this->getParamName();
        $strParamValue = $arrFilterUrl[$strParamName];
        $parentFilter  = null;
        $words         = [];

        // Type of search.
        switch ($strTextSearch) {
            case 'any':
                $words        = $this->getWords($strParamValue);
                $parentFilter = new ConditionOr();
                break;
            case 'all':
                $words        = $this->getWords($strParamValue);
                $parentFilter = new ConditionAnd();
                break;

            default:
                // Do nothing. Because the parent function saved us. The value have to be any or all.
                break;
        }

        if ($objAttribute && $strParamName && $strParamValue !== null && $parentFilter) {
            foreach ($words as $word) {
                $subFilter = $objMetaModel->getEmptyFilter();
                $subFilter->addFilterRule(new SearchAttribute($objAttribute, '%' . $word . '%', $arrLanguages));
                $parentFilter->addChild($subFilter);
            }

            $objFilter->addFilterRule($parentFilter);

            return;
        }

        $objFilter->addFilterRule(new StaticIdList(null));
    }
private function doComplexSearch($strTextSearch, $objFilter, $arrFilterUrl)
    {
        $objMetaModel  = $this->getMetaModel();
        $objAttribute  = $objMetaModel->getAttributeById($this->get('attr_id'));
        $arrLanguages  = $this->getAvailableLanguages($objMetaModel);
        $strParamName  = $this->getParamName();
        $strParamValue = $arrFilterUrl[$strParamName];
        $parentFilter  = null;
        $words         = [];

        // Type of search.
        switch ($strTextSearch) {
            case 'any':
                $words        = $this->getWords($strParamValue);
                $parentFilter = new ConditionOr();
                break;
            case 'all':
                $words        = $this->getWords($strParamValue);
                $parentFilter = new ConditionAnd();
                break;

            default:
                // Do nothing. Because the parent function saved us. The value have to be any or all.
                break;
        }

        if ($objAttribute && $strParamName && $strParamValue !== null && $parentFilter) {
            foreach ($words as $word) {
                $subFilter = $objMetaModel->getEmptyFilter();
                $subFilter->addFilterRule(new SearchAttribute($objAttribute, '%' . $word . '%', $arrLanguages));
                $parentFilter->addChild($subFilter);
            }

            $objFilter->addFilterRule($parentFilter);

            return;
        }

        $objFilter->addFilterRule(new StaticIdList(null));
    }
private function doComplexSearch ( $ strTextSearch , $ objFilter , $ arrFilterUrl ) { $ objMetaModel = $ this -> getMetaModel ( ) ; $ objAttribute = $ objMetaModel -> getAttributeById ( $ this -> get ( 'attr_id' ) ) ; $ arrLanguages = $ this -> getAvailableLanguages ( $ objMetaModel ) ; $ strParamName = $ this -> getParamName ( ) ; $ strParamValue = $ arrFilterUrl [ $ strParamName ] ; $ parentFilter = null ; $ words = [ ] ; // Type of search. switch ( $ strTextSearch ) { case 'any' : $ words = $ this -> getWords ( $ strParamValue ) ; $ parentFilter = new ConditionOr ( ) ; break ; case 'all' : $ words = $ this -> getWords ( $ strParamValue ) ; $ parentFilter = new ConditionAnd ( ) ; break ; default : // Do nothing. Because the parent function saved us. The value have to be any or all. break ; } if ( $ objAttribute && $ strParamName && $ strParamValue !== null && $ parentFilter ) { foreach ( $ words as $ word ) { $ subFilter = $ objMetaModel -> getEmptyFilter ( ) ; $ subFilter -> addFilterRule ( new SearchAttribute ( $ objAttribute , '%' . $ word . '%' , $ arrLanguages ) ) ; $ parentFilter -> addChild ( $ subFilter ) ; } $ objFilter -> addFilterRule ( $ parentFilter ) ; return ; } $ objFilter -> addFilterRule ( new StaticIdList ( null ) ) ; }
Do a complex search with each word. Search for all words or for any word.

@param string   $strTextSearch The mode any or all.

@param IFilter  $objFilter     The filter to append the rules to.

@param string[] $arrFilterUrl  The parameters to evaluate.

@return void
Do a complex search with each word . Search for all words or for any word .