public function rewrite(&$left, &$op, &$right)
 {
     // note the grouping of the db queries
     $left = new OpExpr(new DocumentTextField(), ExprOp::CONTAINS, $right);
     $op = ExprOp::OP_OR;
     $value = $right;
     $right = null;
     $registry = ExprFieldRegistry::getRegistry();
     $classes = $registry->getGeneralTextClasses();
     while (!empty($classes)) {
         $classname = array_pop($classes);
         $obj = new $classname();
         $exprop = $obj->general_op;
         $newexpr = new OpExpr($obj, $exprop, $value);
         if (empty($right)) {
             $right = $newexpr;
         } else {
             $right = new OpExpr($right, ExprOp::OP_OR, $newexpr);
         }
     }
 }
Exemplo n.º 2
0
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License version 3 as published by the
 * Free Software Foundation.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, 
 * California 94120-7775, or email info@knowledgetree.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * KnowledgeTree" logo and retain the original copyright notice. If the display of the 
 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
 * must display the words "Powered by KnowledgeTree" and retain the original 
 * copyright notice.
 * Contributor( s): ______________________________________
 *
 */
require_once 'ajax.inc.php';
$reg = ExprFieldRegistry::getRegistry();
AjaxSearchHelper::getSearchFields();
Exemplo n.º 3
0
 /**
  * A static method to lookup a field by fieldname.
  *
  * @param string $fieldname
  * @return unknown
  */
 public static function lookupField($fieldname)
 {
     $registry = ExprFieldRegistry::get();
     return $registry->getField($fieldname);
 }
Exemplo n.º 4
0
 function do_queryBuilder()
 {
     $this->oPage->setBreadcrumbDetails(_kt("Query Editor"));
     $this->oPage->title = _kt("Query Editor");
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate("ktcore/search2/adv_query_search");
     $registry = ExprFieldRegistry::getRegistry();
     $aliases = $registry->getAliasNames();
     sort($aliases);
     $edit = is_numeric($this->savedSearchId);
     $name = '';
     if ($edit) {
         list($name, $expr) = $this->getSavedExpression();
     } else {
         $expr = $_SESSION['search2_query'];
     }
     $aTemplateData = array("context" => $this, 'aliases' => $aliases, 'bSave' => $edit, 'edtSaveQueryName' => $name, 'txtQuery' => $expr, 'iSavedSearchId' => $this->savedSearchId);
     return $oTemplate->render($aTemplateData);
 }
Exemplo n.º 5
0
 public static function getSearchFields()
 {
     $registry = ExprFieldRegistry::getRegistry();
     $fields = $registry->getFields();
     $results = array();
     foreach ($fields as $field) {
         $type = $field->getInputRequirements();
         $type = $type['value']['type'];
         $results[] = array('alias' => $field->getAlias(), 'display' => $field->getDisplay(), 'type' => $type);
     }
     usort($results, search_alias_compare);
     return $results;
 }
Exemplo n.º 6
0
 function yy_r14()
 {
     $registry = ExprFieldRegistry::getRegistry();
     $field = $registry->resolveAlias($this->yystack[$this->yyidx + 0]->minor);
     $this->_retvalue = $field;
 }