$q_terms_count = count(explode(' ', $q));
         $pattern1 = '[^\\s]*';
         for ($i = 0; $i < $q_terms_count - 1; $i++) {
             $pattern1 .= '\\s[^\\s]*';
         }
         $pattern2 = $pattern1 . '\\s[^\\s]*';
         $pattern = '/^(' . $pattern1 . '|' . $pattern2 . ')$/';
         $values = array_values(preg_grep($pattern, $values));
         $arr = array();
         $arr["options"] = $values;
         $res = json_encode($arr);
     }
 }
 if ($action == "fiedvalues") {
     $field = getRequestParam("field");
     $values = $solr->getFiedvalues($field);
     $res = '';
     if (!empty($values)) {
         foreach ($values[$field] as $key => $value) {
             if ($res != "") {
                 $res .= "|";
             }
             $res .= $key . ":" . $value;
         }
     }
 }
 if ($action == "gettagcloud") {
     $field = getRequestParam("field");
     $data = $solr->getCloud($field, 20, '', '', 0, 3, true, false);
     $tags = array();
     $aData = explode("|", $data);