public function explodeSearchPhrase($searchString)
    {
        preg_match_all('/(\+|\-|\~|<|>)?\".*?"|[^ ]+/', $searchString, $matches);
        list($searchParts) = $matches;
        if (is_array($searchParts) && count($searchParts)) {
            foreach ($searchParts as $key => $word) {
                // check for boolean seperator
                if ($word === '|') {
                    continue;
                }

                // maybe we should check against the MySQL stoppword list:
                // Link: http://dev.mysql.com/doc/refman/5.0/en/fulltext-stopwords.html

                // don't check length if it is a phrase
                if (preg_match('/^(\+|\-|\~|<|>)?\"/', $word)) {
                    continue;
                }

                // prepare word for next check
                $word = trim($word, '+-~<>');

                // check for word length
                $searchWordLength = mb_strlen($word);
                if ($searchWordLength < $this->pObj->extConf['searchWordLength']) {
                    $this->pObj->hasTooShortWords = true;
                    $this->showShortMessage = true;
                    unset($searchParts[$key]);
                }
            }
            foreach ($searchParts as $key => $word) {
                if ($word != '|') {
                    // enable part searching by default. But be careful: Enabling this slows down the search engine
                    if (!isset($this->pObj->extConf['enablePartSearch']) || $this->pObj->extConf['enablePartSearch']) {
                        if ($this->pObj->extConfPremium['enableInWordSearch']) {
                            $searchParts[$key] = '*' . trim($searchParts[$key], '*') . '*';
                        } else {
                            $searchParts[$key] = rtrim($searchParts[$key], '*') . '*';
                        }
                    }

                    // add + explicit to all search words to make the searchresults equal to sphinx search results
                    if ($this->pObj->extConf['enableExplicitAnd']) {
                        $searchParts[$key] = '+' . ltrim($searchParts[$key], '+');
                    }
                }

                // make the words safe for the database
                // Todo quotes
//                $searchParts[$key] = Db::getQueryBuilder('tx_kesearch_index')
//                    ->quote($searchParts[$key], \PDO::PARAM_STR);

            }
            return array_values($searchParts);
        }
        return array();
    }
public function explodeSearchPhrase($searchString)
    {
        preg_match_all('/(\+|\-|\~|<|>)?\".*?"|[^ ]+/', $searchString, $matches);
        list($searchParts) = $matches;
        if (is_array($searchParts) && count($searchParts)) {
            foreach ($searchParts as $key => $word) {
                // check for boolean seperator
                if ($word === '|') {
                    continue;
                }

                // maybe we should check against the MySQL stoppword list:
                // Link: http://dev.mysql.com/doc/refman/5.0/en/fulltext-stopwords.html

                // don't check length if it is a phrase
                if (preg_match('/^(\+|\-|\~|<|>)?\"/', $word)) {
                    continue;
                }

                // prepare word for next check
                $word = trim($word, '+-~<>');

                // check for word length
                $searchWordLength = mb_strlen($word);
                if ($searchWordLength < $this->pObj->extConf['searchWordLength']) {
                    $this->pObj->hasTooShortWords = true;
                    $this->showShortMessage = true;
                    unset($searchParts[$key]);
                }
            }
            foreach ($searchParts as $key => $word) {
                if ($word != '|') {
                    // enable part searching by default. But be careful: Enabling this slows down the search engine
                    if (!isset($this->pObj->extConf['enablePartSearch']) || $this->pObj->extConf['enablePartSearch']) {
                        if ($this->pObj->extConfPremium['enableInWordSearch']) {
                            $searchParts[$key] = '*' . trim($searchParts[$key], '*') . '*';
                        } else {
                            $searchParts[$key] = rtrim($searchParts[$key], '*') . '*';
                        }
                    }

                    // add + explicit to all search words to make the searchresults equal to sphinx search results
                    if ($this->pObj->extConf['enableExplicitAnd']) {
                        $searchParts[$key] = '+' . ltrim($searchParts[$key], '+');
                    }
                }

                // make the words safe for the database
                // Todo quotes
//                $searchParts[$key] = Db::getQueryBuilder('tx_kesearch_index')
//                    ->quote($searchParts[$key], \PDO::PARAM_STR);

            }
            return array_values($searchParts);
        }
        return array();
    }
public function explodeSearchPhrase ( $ searchString ) { preg_match_all ( '/(\+|\-|\~|<|>)?\".*?"|[^ ]+/' , $ searchString , $ matches ) ; list ( $ searchParts ) = $ matches ; if ( is_array ( $ searchParts ) && count ( $ searchParts ) ) { foreach ( $ searchParts as $ key => $ word ) { // check for boolean seperator if ( $ word === '|' ) { continue ; } // maybe we should check against the MySQL stoppword list: // Link: http://dev.mysql.com/doc/refman/5.0/en/fulltext-stopwords.html // don't check length if it is a phrase if ( preg_match ( '/^(\+|\-|\~|<|>)?\"/' , $ word ) ) { continue ; } // prepare word for next check $ word = trim ( $ word , '+-~<>' ) ; // check for word length $ searchWordLength = mb_strlen ( $ word ) ; if ( $ searchWordLength < $ this -> pObj -> extConf [ 'searchWordLength' ] ) { $ this -> pObj -> hasTooShortWords = true ; $ this -> showShortMessage = true ; unset ( $ searchParts [ $ key ] ) ; } } foreach ( $ searchParts as $ key => $ word ) { if ( $ word != '|' ) { // enable part searching by default. But be careful: Enabling this slows down the search engine if ( ! isset ( $ this -> pObj -> extConf [ 'enablePartSearch' ] ) || $ this -> pObj -> extConf [ 'enablePartSearch' ] ) { if ( $ this -> pObj -> extConfPremium [ 'enableInWordSearch' ] ) { $ searchParts [ $ key ] = '*' . trim ( $ searchParts [ $ key ] , '*' ) . '*' ; } else { $ searchParts [ $ key ] = rtrim ( $ searchParts [ $ key ] , '*' ) . '*' ; } } // add + explicit to all search words to make the searchresults equal to sphinx search results if ( $ this -> pObj -> extConf [ 'enableExplicitAnd' ] ) { $ searchParts [ $ key ] = '+' . ltrim ( $ searchParts [ $ key ] , '+' ) ; } } // make the words safe for the database // Todo quotes //                $searchParts[$key] = Db::getQueryBuilder('tx_kesearch_index') //                    ->quote($searchParts[$key], \PDO::PARAM_STR); } return array_values ( $ searchParts ) ; } return array ( ) ; }
explode search string and remove too short words
@param string $searchString
@return array
explode search string and remove too short words