Пример #1
0
 public function remExcludeValuesFromSearchTags($searchheader_val)
 {
     $text_to_search = $searchheader_val;
     $symbol_arr = array(',', '.', '?', '*');
     $text_to_search = str_replace($symbol_arr, ' ', $text_to_search);
     //echo $text_to_search;
     $search_arr = explode(" ", $text_to_search);
     $search_arr = CUtil::arraytolower(array_filter($search_arr));
     //Fetch the allowed tags from csv file
     //$include_tagslist_arr = CUtil::arraytolower($this->fetchIncludeTagsFromCsv());
     //Checked the csv values matched the search values
     //$matched_array_values = array_intersect($include_tagslist_arr, $search_arr);
     $search_arr = array_filter($search_arr, 'Agriya\\Webshoppack\\CUtil::remminLength');
     //Merge the matched csv values into the array
     //$merged_arr = array_merge($search_arr, $matched_array_values);
     //$search_arr = array_unique(CUtil::arraytolower($merged_arr));
     $result_arr = $stop_words_arr = array();
     if (count($search_arr)) {
         $stop_words_arr = $this->fetchExcludedTags($search_arr);
         if (!empty($stop_words_arr)) {
             foreach ($search_arr as $word) {
                 if (!in_array($word, $stop_words_arr)) {
                     $word = strtolower($word);
                     $result_arr[] = $word;
                 }
             }
         } else {
             $result_arr = array_values($search_arr);
         }
     }
     return $result_arr;
 }