Make a simple search with a like.

@param string   $strTextSearch The mode for the search.

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

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

@return void
486386
private function doSimpleSearch($strTextSearch, $objFilter, $arrFilterUrl)
    {
        $objMetaModel  = $this->getMetaModel();
        $objAttribute  = $objMetaModel->getAttributeById($this->get('attr_id'));
        $arrLanguages  = $this->getAvailableLanguages($objMetaModel);
        $strParamName  = $this->getParamName();
        $strParamValue = $arrFilterUrl[$strParamName];

        // React on wildcard, overriding the search type.
        if (strpos($strParamValue, '*') !== false) {
            $strTextSearch = 'exact';
        }

        // Type of search.
        switch ($strTextSearch) {
            case 'beginswith':
                $strWhat = $strParamValue . '*';
                break;
            case 'endswith':
                $strWhat = '*' . $strParamValue;
                break;
            case 'exact':
                $strWhat = $strParamValue;
                break;
            default:
                $strWhat = '*' . $strParamValue . '*';
                break;
        }

        if ($objAttribute && $strParamName && $strParamValue !== null) {
            $objFilter->addFilterRule(new SearchAttribute($objAttribute, $strWhat, $arrLanguages));

            return;
        }

        $objFilter->addFilterRule(new StaticIdList(null));
    }
425416
function appendFilter(iFilterStream $filter, $rwFlag = STREAM_FILTER_ALL)
    {
        $filterRes = $filter->appendTo($this);

        // store attached filter resource, so we can remove it from stream handler later
        $this->attachedFilters[$filter->getLabel()] = $filterRes;
        return $this;
    }
42148
protected function parseExtendedSearchFilters($parseFilters, $qb, $expressions, &$parameters)
    {
        foreach ($parseFilters as $f) {
            if (isset($f->children)) {
                list($expr, $params) = $this->addExtendedAdvancedSearchWhereClause($qb, $f);
            } else {
                if (!empty($f->command)) {
                    // is this an Extended Field Filter?
                    if (in_array($f->command, array_keys($this->extendedFieldFilters))) {
                        // Change the where clause to use the extended table alias.
                        $extendedFilter = $this->extendedFieldFilters[$f->command];
                        $schema         = $this->leadFieldModel->getSchemaDefinition(
                            $extendedFilter['alias'],
                            $extendedFilter['type']
                        );
                        $secure              = 'extendedFieldSecure' === $extendedFilter['object'] ? '_secure' : '';
                        $tableAlias          = $schema['type'].$secure.$extendedFilter['id'];
                        list($expr, $params) = $this->addStandardCatchAllWhereClause($qb, $f, [$tableAlias.'.value']);
                    } elseif ($this->isSupportedSearchCommand($f->command, $f->string)) {
                        list($expr, $params) = $this->addSearchCommandWhereClause($qb, $f);
                    } else {
                        //treat the command:string as if its a single word
                        $f->string           = $f->command.':'.$f->string;
                        $f->not              = false;
                        $f->strict           = true;
                        list($expr, $params) = $this->addCatchAllWhereClause($qb, $f);
                    }
                } else {
                    list($expr, $params) = $this->addCatchAllWhereClause($qb, $f);
                }
            }
            if (!empty($params)) {
                $parameters = array_merge($parameters, $params);
            }

            $this->appendExpression($expressions, $expr);
        }
    }
261491
public function add($filterMethod, $regExpUrlMatch, $execute)
    {

        if (!is_array($filterMethod)) {
            $filterMethod = array($filterMethod);
        }

        if (!is_callable($execute) && !$execute instanceof Router) {
            throw new \Exception('The last parameter to Router::add must be a callable function or an instance of the Firelit\Router class');
        }

        $this->routes[] = array(
            'method' => $filterMethod,
            'matcher' => $regExpUrlMatch,
            'function' => $execute
        );
    }
1069629
protected function _generateSimListSearchStr($sArticleTable, $aList)
    {
        $sFieldList = $this->getSelectFields();
        $aList = array_slice($aList, 0, \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iNrofSimilarArticles'));

        $sSearch = "select $sFieldList from $sArticleTable where " . $this->getSqlActiveSnippet() . "  and $sArticleTable.oxissearch = 1 and $sArticleTable.oxid in ( ";

        $sSearch .= implode(',', \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aList)) . ')';

        // #524A -- randomizing articles in attribute list
        $sSearch .= ' order by rand() ';

        return $sSearch;
    }
1095660
private function parseFilterLink(): self
    {
        if (array_key_exists(static::PARAM_FILTER, $this->getParameters()) === false) {
            $this->setFiltersWithAnd()->setFilterParameters([]);

            return $this;
        }

        $filterSection = $this->getParameters()[static::PARAM_FILTER];
        if (is_array($filterSection) === false || empty($filterSection) === true) {
            throw new InvalidQueryParametersException($this->createParameterError(
                static::PARAM_FILTER,
                $this->getInvalidParamMessage()
            ));
        }

        $isWithAnd = true;
        reset($filterSection);

        // check if top level element is `AND` or `OR`
        $firstKey   = key($filterSection);
        $firstLcKey = strtolower(trim($firstKey));
        if (($hasOr = ($firstLcKey === 'or')) || $firstLcKey === 'and') {
            if (count($filterSection) > 1 ||
                empty($filterSection = $filterSection[$firstKey]) === true ||
                is_array($filterSection) === false
            ) {
                throw new InvalidQueryParametersException($this->createParameterError(
                    static::PARAM_FILTER,
                    $this->getInvalidParamMessage()
                ));
            } else {
                $this->setFilterParameters($filterSection);
                if ($hasOr === true) {
                    $isWithAnd = false;
                }
            }
        } else {
            $this->setFilterParameters($filterSection);
        }

        $isWithAnd === true ? $this->setFiltersWithAnd() : $this->setFiltersWithOr();

        return $this;
    }
730180
public function search($jql, $startAt = null, $maxResults = null, $validateQuery = null, $fields = null, $expand = null)
    {
        $parameters = array(
            'jql' => $jql,
            'startAt' => $startAt,
            'maxResults' => $maxResults,
            'validateQuery' => $validateQuery,
            'fields' => $fields,
            'expand' => $expand
        );
        return $this->apiClient->callEndpoint('search', $parameters);
    }
193668
protected function findFiles($searchTerm, $filter, $sortBy)
    {
        $filter = $filter !== self::FILTER_EVERYTHING ? $filter : null;

        return MediaLibrary::instance()->findFiles($searchTerm, $sortBy, $filter);
    }
391044
private function listStartHandler(array $attrs): void
    {
        $this->process_repeats++;
        if ($this->process_repeats > 1) {
            return;
        }

        $match = [];
        if (isset($attrs['sortby'])) {
            $sortby = $attrs['sortby'];
            if (preg_match("/\\$(\w+)/", $sortby, $match)) {
                $sortby = $this->vars[$match[1]]['id'];
                $sortby = trim($sortby);
            }
        } else {
            $sortby = 'NAME';
        }

        $listname = $attrs['list'] ?? 'individual';

        // Some filters/sorts can be applied using SQL, while others require PHP
        switch ($listname) {
            case 'pending':
                $xrefs = DB::table('change')
                    ->whereIn('change_id', function (Builder $query): void {
                        $query->select(DB::raw('MAX(change_id)'))
                            ->from('change')
                            ->where('gedcom_id', '=', $this->tree->id())
                            ->where('status', '=', 'pending')
                            ->groupBy('xref');
                    })
                    ->pluck('xref');

                $this->list = [];
                foreach ($xrefs as $xref) {
                    $this->list[] = GedcomRecord::getInstance($xref, $this->tree);
                }
                break;
            case 'individual':
                $query = DB::table('individuals')
                    ->where('i_file', '=', $this->tree->id())
                    ->select(['i_id AS xref', 'i_gedcom AS gedcom'])
                    ->distinct();

                foreach ($attrs as $attr => $value) {
                    if (strpos($attr, 'filter') === 0 && $value) {
                        $value = $this->substituteVars($value, false);
                        // Convert the various filters into SQL
                        if (preg_match('/^(\w+):DATE (LTE|GTE) (.+)$/', $value, $match)) {
                            $query->join('dates AS ' . $attr, static function (JoinClause $join) use ($attr): void {
                                $join
                                    ->on($attr . '.d_gid', '=', 'i_id')
                                    ->on($attr . '.d_file', '=', 'i_file');
                            });

                            $query->where($attr . '.d_fact', '=', $match[1]);

                            $date = new Date($match[3]);

                            if ($match[2] === 'LTE') {
                                $query->where($attr . '.d_julianday2', '<=', $date->maximumJulianDay());
                            } else {
                                $query->where($attr . '.d_julianday1', '>=', $date->minimumJulianDay());
                            }

                            // This filter has been fully processed
                            unset($attrs[$attr]);
                        } elseif (preg_match('/^NAME CONTAINS (.+)$/', $value, $match)) {
                            $query->join('name AS ' . $attr, static function (JoinClause $join) use ($attr): void {
                                $join
                                    ->on($attr . '.n_id', '=', 'i_id')
                                    ->on($attr . '.n_file', '=', 'i_file');
                            });
                            // Search the DB only if there is any name supplied
                            $names = explode(' ', $match[1]);
                            foreach ($names as $n => $name) {
                                $query->whereContains($attr . '.n_full', $name);
                            }

                            // This filter has been fully processed
                            unset($attrs[$attr]);
                        } elseif (preg_match('/^LIKE \/(.+)\/$/', $value, $match)) {
                            // Convert newline escape sequences to actual new lines
                            $match[1] = str_replace('\n', "\n", $match[1]);

                            $query->where('i_gedcom', 'LIKE', $match[1]);

                            // This filter has been fully processed
                            unset($attrs[$attr]);
                        } elseif (preg_match('/^(?:\w*):PLAC CONTAINS (.+)$/', $value, $match)) {
                            // Don't unset this filter. This is just initial filtering for performance
                            $query
                                ->join('placelinks AS ' . $attr . 'a', static function (JoinClause $join) use ($attr): void {
                                    $join
                                        ->on($attr . 'a.pl_file', '=', 'i_file')
                                        ->on($attr . 'a.pl_gid', '=', 'i_id');
                                })
                                ->join('places AS ' . $attr . 'b', static function (JoinClause $join) use ($attr): void {
                                    $join
                                        ->on($attr . 'b.p_file', '=', $attr . 'a.pl_file')
                                        ->on($attr . 'b.p_id', '=', $attr . 'a.pl_p_id');
                                })
                                ->whereContains($attr . 'b.p_place', $match[1]);
                        } elseif (preg_match('/^(\w*):(\w+) CONTAINS (.+)$/', $value, $match)) {
                            // Don't unset this filter. This is just initial filtering for performance
                            $match[3] = strtr($match[3], ['\\' => '\\\\', '%'  => '\\%', '_'  => '\\_', ' ' => '%']);
                            $like = "%\n1 " . $match[1] . "%\n2 " . $match[2] . '%' . $match[3] . '%';
                            $query->where('i_gedcom', 'LIKE', $like);
                        } elseif (preg_match('/^(\w+) CONTAINS (.+)$/', $value, $match)) {
                            // Don't unset this filter. This is just initial filtering for performance
                            $match[2] = strtr($match[2], ['\\' => '\\\\', '%'  => '\\%', '_'  => '\\_', ' ' => '%']);
                            $like = "%\n1 " . $match[1] . '%' . $match[2] . '%';
                            $query->where('i_gedcom', 'LIKE', $like);
                        }
                    }
                }

                $this->list = [];

                foreach ($query->get() as $row) {
                    $this->list[$row->xref] = Individual::getInstance($row->xref, $this->tree, $row->gedcom);
                }
                break;

            case 'family':
                $query = DB::table('families')
                    ->where('f_file', '=', $this->tree->id())
                    ->select(['f_id AS xref', 'f_gedcom AS gedcom'])
                    ->distinct();

                foreach ($attrs as $attr => $value) {
                    if (strpos($attr, 'filter') === 0 && $value) {
                        $value = $this->substituteVars($value, false);
                        // Convert the various filters into SQL
                        if (preg_match('/^(\w+):DATE (LTE|GTE) (.+)$/', $value, $match)) {
                            $query->join('dates AS ' . $attr, static function (JoinClause $join) use ($attr): void {
                                $join
                                    ->on($attr . '.d_gid', '=', 'f_id')
                                    ->on($attr . '.d_file', '=', 'f_file');
                            });

                            $query->where($attr . '.d_fact', '=', $match[1]);

                            $date = new Date($match[3]);

                            if ($match[2] === 'LTE') {
                                $query->where($attr . '.d_julianday2', '<=', $date->maximumJulianDay());
                            } else {
                                $query->where($attr . '.d_julianday1', '>=', $date->minimumJulianDay());
                            }

                            // This filter has been fully processed
                            unset($attrs[$attr]);
                        } elseif (preg_match('/^LIKE \/(.+)\/$/', $value, $match)) {
                            // Convert newline escape sequences to actual new lines
                            $match[1] = str_replace('\n', "\n", $match[1]);

                            $query->where('f_gedcom', 'LIKE', $match[1]);

                            // This filter has been fully processed
                            unset($attrs[$attr]);
                        } elseif (preg_match('/^NAME CONTAINS (.*)$/', $value, $match)) {
                            if ($sortby === 'NAME' || $match[1] !== '') {
                                $query->join('name AS ' . $attr, static function (JoinClause $join) use ($attr): void {
                                    $join
                                        ->on($attr . '.n_file', '=', 'f_file')
                                        ->where(static function (Builder $query): void {
                                            $query
                                                ->whereColumn('n_id', '=', 'f_husb')
                                                ->orWhereColumn('n_id', '=', 'f_wife');
                                        });
                                });
                                // Search the DB only if there is any name supplied
                                if ($match[1] != '') {
                                    $names = explode(' ', $match[1]);
                                    foreach ($names as $n => $name) {
                                        $query->whereContains($attr . '.n_full', $name);
                                    }
                                }
                            }

                            // This filter has been fully processed
                            unset($attrs[$attr]);
                        } elseif (preg_match('/^(?:\w*):PLAC CONTAINS (.+)$/', $value, $match)) {
                            // Don't unset this filter. This is just initial filtering for performance
                            $query
                                ->join('placelinks AS ' . $attr . 'a', static function (JoinClause $join) use ($attr): void {
                                    $join
                                        ->on($attr . 'a.pl_file', '=', 'f_file')
                                        ->on($attr . 'a.pl_gid', '=', 'f_id');
                                })
                                ->join('places AS ' . $attr . 'b', static function (JoinClause $join) use ($attr): void {
                                    $join
                                        ->on($attr . 'b.p_file', '=', $attr . 'a.pl_file')
                                        ->on($attr . 'b.p_id', '=', $attr . 'a.pl_p_id');
                                })
                                ->whereContains($attr . 'b.p_place', $match[1]);
                        } elseif (preg_match('/^(\w*):(\w+) CONTAINS (.+)$/', $value, $match)) {
                            // Don't unset this filter. This is just initial filtering for performance
                            $match[3] = strtr($match[3], ['\\' => '\\\\', '%'  => '\\%', '_'  => '\\_', ' ' => '%']);
                            $like = "%\n1 " . $match[1] . "%\n2 " . $match[2] . '%' . $match[3] . '%';
                            $query->where('f_gedcom', 'LIKE', $like);
                        } elseif (preg_match('/^(\w+) CONTAINS (.+)$/', $value, $match)) {
                            // Don't unset this filter. This is just initial filtering for performance
                            $match[2] = strtr($match[2], ['\\' => '\\\\', '%'  => '\\%', '_'  => '\\_', ' ' => '%']);
                            $like = "%\n1 " . $match[1] . '%' . $match[2] . '%';
                            $query->where('f_gedcom', 'LIKE', $like);
                        }
                    }
                }

                $this->list = [];

                foreach ($query->get() as $row) {
                    $this->list[$row->xref] = Family::getInstance($row->xref, $this->tree, $row->gedcom);
                }
                break;

            default:
                throw new DomainException('Invalid list name: ' . $listname);
        }

        $filters  = [];
        $filters2 = [];
        if (isset($attrs['filter1']) && count($this->list) > 0) {
            foreach ($attrs as $key => $value) {
                if (preg_match("/filter(\d)/", $key)) {
                    $condition = $value;
                    if (preg_match("/@(\w+)/", $condition, $match)) {
                        $id    = $match[1];
                        $value = "''";
                        if ($id === 'ID') {
                            if (preg_match('/0 @(.+)@/', $this->gedrec, $match)) {
                                $value = "'" . $match[1] . "'";
                            }
                        } elseif ($id === 'fact') {
                            $value = "'" . $this->fact . "'";
                        } elseif ($id === 'desc') {
                            $value = "'" . $this->desc . "'";
                        } else {
                            if (preg_match("/\d $id (.+)/", $this->gedrec, $match)) {
                                $value = "'" . str_replace('@', '', trim($match[1])) . "'";
                            }
                        }
                        $condition = preg_replace("/@$id/", $value, $condition);
                    }
                    //-- handle regular expressions
                    if (preg_match("/([A-Z:]+)\s*([^\s]+)\s*(.+)/", $condition, $match)) {
                        $tag  = trim($match[1]);
                        $expr = trim($match[2]);
                        $val  = trim($match[3]);
                        if (preg_match("/\\$(\w+)/", $val, $match)) {
                            $val = $this->vars[$match[1]]['id'];
                            $val = trim($val);
                        }
                        if ($val) {
                            $searchstr = '';
                            $tags      = explode(':', $tag);
                            //-- only limit to a level number if we are specifically looking at a level
                            if (count($tags) > 1) {
                                $level = 1;
                                foreach ($tags as $t) {
                                    if (!empty($searchstr)) {
                                        $searchstr .= "[^\n]*(\n[2-9][^\n]*)*\n";
                                    }
                                    //-- search for both EMAIL and _EMAIL... silly double gedcom standard
                                    if ($t === 'EMAIL' || $t === '_EMAIL') {
                                        $t = '_?EMAIL';
                                    }
                                    $searchstr .= $level . ' ' . $t;
                                    $level++;
                                }
                            } else {
                                if ($tag === 'EMAIL' || $tag === '_EMAIL') {
                                    $tag = '_?EMAIL';
                                }
                                $t         = $tag;
                                $searchstr = '1 ' . $tag;
                            }
                            switch ($expr) {
                                case 'CONTAINS':
                                    if ($t === 'PLAC') {
                                        $searchstr .= "[^\n]*[, ]*" . $val;
                                    } else {
                                        $searchstr .= "[^\n]*" . $val;
                                    }
                                    $filters[] = $searchstr;
                                    break;
                                default:
                                    $filters2[] = [
                                        'tag'  => $tag,
                                        'expr' => $expr,
                                        'val'  => $val,
                                    ];
                                    break;
                            }
                        }
                    }
                }
            }
        }
        //-- apply other filters to the list that could not be added to the search string
        if ($filters) {
            foreach ($this->list as $key => $record) {
                foreach ($filters as $filter) {
                    if (!preg_match('/' . $filter . '/i', $record->privatizeGedcom(Auth::accessLevel($this->tree)))) {
                        unset($this->list[$key]);
                        break;
                    }
                }
            }
        }
        if ($filters2) {
            $mylist = [];
            foreach ($this->list as $indi) {
                $key  = $indi->xref();
                $grec = $indi->privatizeGedcom(Auth::accessLevel($this->tree));
                $keep = true;
                foreach ($filters2 as $filter) {
                    if ($keep) {
                        $tag  = $filter['tag'];
                        $expr = $filter['expr'];
                        $val  = $filter['val'];
                        if ($val == "''") {
                            $val = '';
                        }
                        $tags = explode(':', $tag);
                        $t    = end($tags);
                        $v    = $this->getGedcomValue($tag, 1, $grec);
                        //-- check for EMAIL and _EMAIL (silly double gedcom standard :P)
                        if ($t === 'EMAIL' && empty($v)) {
                            $tag  = str_replace('EMAIL', '_EMAIL', $tag);
                            $tags = explode(':', $tag);
                            $t    = end($tags);
                            $v    = Functions::getSubRecord(1, $tag, $grec);
                        }

                        switch ($expr) {
                            case 'GTE':
                                if ($t === 'DATE') {
                                    $date1 = new Date($v);
                                    $date2 = new Date($val);
                                    $keep  = (Date::compare($date1, $date2) >= 0);
                                } elseif ($val >= $v) {
                                    $keep = true;
                                }
                                break;
                            case 'LTE':
                                if ($t === 'DATE') {
                                    $date1 = new Date($v);
                                    $date2 = new Date($val);
                                    $keep  = (Date::compare($date1, $date2) <= 0);
                                } elseif ($val >= $v) {
                                    $keep = true;
                                }
                                break;
                            default:
                                if ($v == $val) {
                                    $keep = true;
                                } else {
                                    $keep = false;
                                }
                                break;
                        }
                    }
                }
                if ($keep) {
                    $mylist[$key] = $indi;
                }
            }
            $this->list = $mylist;
        }

        switch ($sortby) {
            case 'NAME':
                uasort($this->list, GedcomRecord::nameComparator());
                break;
            case 'CHAN':
                uasort($this->list, GedcomRecord::lastChangeComparator());
                break;
            case 'BIRT:DATE':
                uasort($this->list, Individual::birthDateComparator());
                break;
            case 'DEAT:DATE':
                uasort($this->list, Individual::deathDateComparator());
                break;
            case 'MARR:DATE':
                uasort($this->list, Family::marriageDateComparator());
                break;
            default:
                // unsorted or already sorted by SQL
                break;
        }

        $this->repeats_stack[] = [$this->repeats, $this->repeat_bytes];
        $this->repeat_bytes    = xml_get_current_line_number($this->parser) + 1;
    }
1034298
public function search(SearchCondition\SearchConditionInterface $filter, SelectOrder\SelectOrderInterface $order = null)
	{
		if ( ! ($filter instanceof SearchCondition\ArraySearchCondition)) {
			throw new Exception\WrongInstance($filter, 'SearchCondition\ArraySearchCondition');
		}
		$filterClosure = $filter->getSearchClosure();

		$orderClosure = null;
		if ( ! \is_null($order)) {
			if ( ! ($order instanceof SelectOrder\ArraySelectOrder)) {
				throw new Exception\WrongInstance($order, 'SelectOrder\ArraySelectOrder');
			}
			$orderClosure = $order->getOrderClosure();
		}

		$result = $this->searchByClosure($filterClosure, $orderClosure);
		
		return $result;
	}
900885
public static function askBrowser($arrAccepted, $strDefault='de') {
		$res = array('lang' => $strDefault, 'other' => array());
		try {
			$lang_variable = (
				isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])
				? $_SERVER['HTTP_ACCEPT_LANGUAGE']
				: null
			);

			if ( empty($lang_variable) )
				return $res;

			$accepted_languages = preg_split('/,\s*/', $lang_variable);

			$current_lang = $strDefault;
			$current_q = 0;

			$other = array();
			foreach ($accepted_languages as $accepted_language) {
				$res = preg_match('/^([a-z]{1,8}(?:-[a-z]{1,8})*)'.
								   '(?:;\s*q=(0(?:\.[0-9]{1,3})?|1(?:\.0{1,3})?))?$/i', $accepted_language, $matches);
				if (!$res)
					continue;

				$lang_code = explode('-', $matches[1]);
				if (isset($matches[2]))
					$lang_quality = (float) $matches[2];
				else
					$lang_quality = 1.0;

				while (count($lang_code)) {
					$full_code = strtolower(join ('-', $lang_code));
					if (in_array($full_code, $arrAccepted)) {
						if ($lang_quality > $current_q) {
							if ($current_lang)
								$other[] = $current_lang;
							$current_lang = $full_code;
							$current_q = $lang_quality;
							break;
						} else
							$other[] = $full_code;
					} else
						$other[] = $full_code;

					array_pop($lang_code);
				}
			}
			return array('lang' => $current_lang, 'other' => $other);;
		} catch (\Exception $e) {
			return $res;
		}
	}
450879
static SearchRequestBuilder applyAliasMetadata(EsMajorVersion version,
                                                   Map<String, IndicesAliases.Alias> aliases,
                                                   SearchRequestBuilder searchRequestBuilder,
                                                   String index, String... indicesOrAliases) {
        if (QueryUtils.isExplicitlyRequested(index, indicesOrAliases)) {
            return searchRequestBuilder;
        }

        Set<String> routing = new HashSet<String>();
        List<QueryBuilder> aliasFilters = new ArrayList<QueryBuilder>();
        for (IndicesAliases.Alias alias : aliases.values()) {
            if (QueryUtils.isExplicitlyRequested(alias.getName(), indicesOrAliases)) {
                // The alias is explicitly requested
                if (StringUtils.hasLength(alias.getSearchRouting())) {
                    for (String value : alias.getSearchRouting().split(",")) {
                        routing.add(value.trim());
                    }
                }
                if (alias.getFilter() != null) {
                    try {
                        aliasFilters.add(new RawQueryBuilder(alias.getFilter(), false));
                    } catch (IOException e) {
                        throw new EsHadoopIllegalArgumentException("Failed to parse alias filter: [" + alias.getFilter() + "]");
                    }
                }
            }
        }
        if (aliasFilters.size() > 0) {
            QueryBuilder aliasQuery;
            if (aliasFilters.size() == 1) {
                aliasQuery = aliasFilters.get(0);
            } else {
                aliasQuery = new BoolQueryBuilder();
                for (QueryBuilder filter : aliasFilters) {
                    ((BoolQueryBuilder) aliasQuery).should(filter);
                }
            }
            if (searchRequestBuilder.query() == null) {
                searchRequestBuilder.query(aliasQuery);
            } else {
                BoolQueryBuilder mainQuery = new BoolQueryBuilder();
                mainQuery.must(searchRequestBuilder.query());
                if (version.after(EsMajorVersion.V_1_X)) {
                    mainQuery.filter(aliasQuery);
                } else {
                    mainQuery.must(new ConstantScoreQueryBuilder().filter(aliasQuery).boost(0.0f));
                }
                searchRequestBuilder.query(mainQuery);
            }
        }
        if (routing.size() > 0) {
            searchRequestBuilder.routing(StringUtils.concatenate(routing, ","));
        }
        return searchRequestBuilder;
    }
885183
public function prepareRules(IFilter $objFilter, $arrFilterUrl)
    {
        // Check if we can filter on anything.
        if (!$this->get('fromfield') && !$this->get('tofield')) {
            $objFilter->addFilterRule(new StaticIdList(null));

            return;
        }

        // No attribute, get out.
        $attribute = $this->getMetaModel()->getAttributeById($this->get('attr_id'));
        if (!($attribute)) {
            $objFilter->addFilterRule(new StaticIdList(null));

            return;
        }

        // No filter values, get out.
        $value = $this->getParameterValue($arrFilterUrl);
        if (empty($value)) {
            $objFilter->addFilterRule(new StaticIdList(null));

            return;
        }

        // Two values, apply filtering for a value range if both fields are allowed.
        if (\count($value) == 2) {
            if (!($this->get('fromfield') && $this->get('tofield'))) {
                throw new \LengthException('Only one value is allowed, please configure fromfield and tofield.');
            }

            // Add rule to the filter.
            $objFilter->addFilterRule(
                $this->createFromToRule($attribute, $this->formatEmpty($value[0]), $this->formatEmpty($value[1]))
            );

            return;
        }

        // Add rule to the filter.
        $objFilter->addFilterRule($this->createFromToRule($attribute, $this->formatEmpty($value[0]), null));
    }
465359
static function RecurseXmlObjToArr($obj, &$arr)
	{
		$children = $obj->children();
		foreach ($children as $elementName => $node)
		{
			$nextIdx = count($arr);
			$arr[$nextIdx] = array();
			$arr[$nextIdx]['@name'] = strtolower((string)$elementName);
			$arr[$nextIdx]['@attributes'] = array();
			$attributes = $node->attributes();
			foreach ($attributes as $attributeName => $attributeValue)
			{
				$attribName = strtolower(trim((string)$attributeName));
				$attribVal = trim((string)$attributeValue);
				$arr[$nextIdx]['@attributes'][$attribName] = $attribVal;
			}
			$text = (string)$node;
			$text = trim($text);
			if (strlen($text) > 0)
			{
				$arr[$nextIdx]['@text'] = $text;
			}
			$arr[$nextIdx]['@children'] = array();
			VerySimpleXmlUtil::RecurseXmlObjToArr($node, $arr[$nextIdx]['@children']);
		}
		return;
	}
1033223
function InlineSearchResultExplorer(registry, commandService, inlineSearchPane, preferences, fileClient, searcher) {
        this.registry = registry;
        this._commandService = commandService;
        this.fileClient = fileClient;
        this.defaulRows = 40;
		this._contentTypeService = new mContentTypes.ContentTypeRegistry(this.registry);
		this._inlineSearchPane = inlineSearchPane;
		this._preferences = preferences;
		this._searcher = searcher;
		this._replaceRenderer =  new SearchResultRenderer({
            checkbox: true,
            highlightSelection: false,
            getCheckedFunc: function(item) {
                return this.getItemChecked(item);
            }.bind(this),
            onCheckedFunc: function(rowId, checked, manually) {
                this.onRowChecked(rowId, checked, manually);
            }.bind(this)
        }, this);
        this.render = this._normalRenderer = new SearchResultRenderer({
            checkbox: false,
            highlightSelection: false
        }, this);
    	mFileDetailRenderer.getPrefs(this._preferences, "/inlineSearchPane", ["showFullPath", "viewByFile", "hidePerfectMatch", "hideNonMatch", "hidePossibleMatch"]).then(function(properties){ //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
    		this._shouldShowFullPath = properties ? properties[0] : false;
    		this._viewByFile = properties ? properties[1] : false;
    		this._matchFilter = {};
    		this._matchFilter["hidePerfectMatch"] = {flag: properties ? properties[2] : false,
    												 filterFunc: function(confidence, hide) {
    												 	return !hide && confidence === 100;
    												 }};
    		this._matchFilter["hideNonMatch"] = {flag: properties ? properties[3] : false,
    												 filterFunc: function(confidence, hide) {
    												 	return !hide && confidence === 0;
    												 }};
    		this._matchFilter["hidePossibleMatch"] = {flag: properties ? properties[4] : false,
    												 filterFunc: function(confidence, hide) {
    												 	return !hide && confidence !== 100 && confidence !== 0;
    												 }};
    		this.declareCommands();
     	}.bind(this));
    }
108160
static function urlByURL( $urlText )
    {
        $db = eZDB::instance();

        $url = false;
        $checkURLQuery = "SELECT * FROM ezurl WHERE url='" . $db->escapeString( $urlText ) . "'";
        $urlArray = $db->arrayQuery( $checkURLQuery );

        if ( count( $urlArray ) == 1 )
        {
            $url = new eZURL( $urlArray[0] );
        }
        return $url;
    }
300920
public void displayURL(String strURL)
    {
//        if ((path == null) || (path.length() == 0))
        {
            BaseApplet applet = this.getBaseApplet();
            if (applet != null)
            {
                String strError = applet.getString("Fax") + ' ' + applet.getString("Not Configured" + " (" + strURL + ")");
                applet.setStatusText(strError, JOptionPane.INFORMATION_MESSAGE);
            }
        }
    }