Build the SearchCondition object using the groups and fields.
184746
public function getSearchCondition(): SearchCondition
    {
        if ($this->parent) {
            return $this->parent->getSearchCondition();
        }

        // This the root of the condition so now traverse back up the hierarchy.
        // We need to re-create the condition using actual objects.
        $rootValuesGroup = new ValuesGroup($this->valuesGroup->getGroupLogical());
        $this->normalizeValueGroup($this->valuesGroup, $rootValuesGroup);

        return new SearchCondition($this->fieldSet, $rootValuesGroup);
    }
514317
protected function buildHavingConditions()
    {
        $join = ($this->havingType == 'AND') ? 'AND' : 'OR';
        $this->havingType = null;

        return $this->makeConditions('having', $join);
    }
1080840
function checkGroup(query, group) {
    if (group instanceof Array) {
      // check each condition from group
      for ( var c in group) {
        check(query, group[c]);
      }
    }
  }
696556
def search( self, base=False, trim=False, objects=False, **kwargs ):
        
        scope = pyldap.SCOPE_SUBTREE
        if not base:
            base = self.users

        filterstr =''
        for key, value in kwargs.iteritems():
            filterstr += '({0}={1})'.format(key,value)
            if key == 'dn':
                filterstr = '(objectClass=*)'
                base = value
                scope = pyldap.SCOPE_BASE
                break

        if len(kwargs) > 1:
            filterstr = '(&'+filterstr+')'

        result = self.ldap.search_s(base, pyldap.SCOPE_SUBTREE, filterstr, ['*','+'])
        if base == self.users:
            for member in result:
                groups = self.getGroups(member[0])
                member[1]['groups'] = groups
                if 'eboard' in member[1]['groups']:
                    member[1]['committee'] = self.search(base=self.committees, \
                           head=member[0])[0][1]['cn'][0]
        if objects:
            return self.memberObjects(result)
        finalResult = self.trimResult(result) if trim else result
        return finalResult
337665
protected function getFieldConditionsGroup()
    {
        if (!$this->fieldConditionsGroup) {
            $this->fieldConditionsGroup = $this->selectorFactory->createFieldConditionGroup(
                IFieldConditionGroup::MODE_AND
            );
        }

        return $this->fieldConditionsGroup;
    }
111582
public function generateSearchConditions()
    {
        $tabs = $this->generateRelations();		
                       
        $columns = [];
        if (($table = $this->getTableSchema()) === false) {
            $class = $this->modelClass;
            /* @var $model \yii\base\Model */
            $model = new $class();
            foreach ($model->attributes() as $attribute) {
                $columns[$attribute] = 'unknown';
            }
        } else {
            foreach ($table->columns as $column) {
                $columns[$column->name] = $column->type;
            }
        }

		$numConditions = [];
        $likeConditions = [];
        $hashConditions = [];
        $timeConditions = [];
        $nf = [];
        $hf = [];
        $tf = [];
        $lf = [];
        
        foreach ($tabs as $tab)
        {        
			if (!$tab)
			{
				foreach ($columns as $column => $type) {
					switch ($type) {
						case Schema::TYPE_SMALLINT:
						case Schema::TYPE_INTEGER:
						case Schema::TYPE_BIGINT:						
						case Schema::TYPE_FLOAT:
						case Schema::TYPE_DECIMAL:
						case Schema::TYPE_MONEY:
							$numConditions[] = "['{$column}'".($column == "id"?",\$this->tableName()":"")."]";
							break;
						case Schema::TYPE_BOOLEAN:
						case Schema::TYPE_DATE:
						case Schema::TYPE_TIME:
						case Schema::TYPE_DATETIME:
							$hashConditions[] = "'{$column}'".($tab?",'{{%{$tab}}}'":"")." => \$this->{$column},";
							break;
						case Schema::TYPE_TIMESTAMP:
							$timeConditions[] = "['{$column}'".($tab?",'{{%{$tab}}}'":"")."]";
							break;
						default:
							$likeConditions[] = "['{$column}'".($tab?",'{{%{$tab}}}'":"")."]";
							break;
					}
				}
			}
			else
			{
				$nf[] = "['id'".($tab?",'{{%{$tab}}}'":"")."]";	
				$hf[] = "'id'".($tab?",'{{%{$tab}}}'":"")." => \$this->".$tab."Id,";
				$tf[] = "['id'".($tab?",'{{%{$tab}}}'":"")."]";	
				$lf[] = "['id'".($tab?",'{{%{$tab}}}'":"")."]";	
			}
		}
		
        $conditions = [];
        if (!empty($hashConditions)) {
            $conditions[] = "\$query->andFilterWhere([\n"
                . str_repeat(' ', 12) . implode("\n" . str_repeat(' ', 12), $hashConditions)."\n"
                . str_repeat(' ', 12) .'/*'. implode("\n" . str_repeat(' ', 12), $nf).'*/'
                . "\n" . str_repeat(' ', 8) . "]);\n";
        }
        if (!empty($numConditions)) {
            $conditions[] = "\$params = self::queryNumber([".implode(",",$numConditions)."".(count($hf) == 0?"":"/*".implode(",",$nf)."*/")."]);
		foreach (\$params as \$p)
		{
			\$query->andFilterWhere(\$p);
		}";
        }
        if (!empty($likeConditions)) {
            $conditions[] = "\$params = self::queryString([".implode(",",$likeConditions)."".(count($lf) == 0?"":"/*".implode(",",$lf)."*/")."]);
		foreach (\$params as \$p)
		{
			\$query->andFilterWhere(\$p);
		}";
        }
        if (!empty($timeConditions)) {
            $conditions[] = "\$params = self::queryTime([".implode(",",$timeConditions)."".(count($tf) == 0?"":"/*".implode(",",$tf)."*/")."]);
		foreach (\$params as \$p)
		{
			\$query->andFilterWhere(\$p);
		}";
        }

        return $conditions;
    }
724517
def runSearchReadGroupSets(self, request):
        
        return self.runSearchRequest(
            request, protocol.SearchReadGroupSetsRequest,
            protocol.SearchReadGroupSetsResponse,
            self.readGroupSetsGenerator)
14636
def where(self, field, value = None, operator = '='):
        
        if field is None:
            return self
        conjunction = None
        if value is None and isinstance(field, dict):
            for field, value in field.items():
                operator, value = value if isinstance(value, tuple) else ('=', value)
                self.where(field, value, operator)
        else:
            if self.where_criteria.size() > 0:
                    conjunction = 'AND'
            self.where_criteria.append(expressions.ConditionExpression(field, value, operator=operator, conjunction=conjunction))
        return self
506486
static JpaRolloutGroup prepareRolloutGroupWithDefaultConditions(final RolloutGroupCreate create,
            final RolloutGroupConditions conditions) {
        final JpaRolloutGroup group = ((JpaRolloutGroupCreate) create).build();

        if (group.getSuccessCondition() == null) {
            group.setSuccessCondition(conditions.getSuccessCondition());
        }
        if (group.getSuccessConditionExp() == null) {
            group.setSuccessConditionExp(conditions.getSuccessConditionExp());
        }
        if (group.getSuccessAction() == null) {
            group.setSuccessAction(conditions.getSuccessAction());
        }
        if (group.getSuccessActionExp() == null) {
            group.setSuccessActionExp(conditions.getSuccessActionExp());
        }

        if (group.getErrorCondition() == null) {
            group.setErrorCondition(conditions.getErrorCondition());
        }
        if (group.getErrorConditionExp() == null) {
            group.setErrorConditionExp(conditions.getErrorConditionExp());
        }
        if (group.getErrorAction() == null) {
            group.setErrorAction(conditions.getErrorAction());
        }
        if (group.getErrorActionExp() == null) {
            group.setErrorActionExp(conditions.getErrorActionExp());
        }

        return group;
    }
401231
private function buildSearchCriteria() {
        $this->buildSearchFieldsRecursive($this->getIndexCriteria()->getSearch(), $this->getEntityFactory());
        if(!is_null($this->getIndexCriteria()->getSearchTerm())) {
            $this->buildSearchTerm();
        }
    }
68787
protected void addIdInCollectionCondition(final Expression<?> property, final Collection<?> values) {
        if (values == null || values.isEmpty()) {
            fieldConditions.add(getCriteriaBuilder().equal(property, -1));
        } else {
            fieldConditions.add(property.in(values));
        }
    }
1284287
protected void prepareResourceCondition(CmsUUID projectId, int mode, StringBuffer conditions) {

        if ((mode & CmsDriverManager.READMODE_ONLY_FOLDERS) > 0) {
            // C_READMODE_ONLY_FOLDERS: add condition to match only folders
            conditions.append(BEGIN_INCLUDE_CONDITION);
            conditions.append(m_sqlManager.readQuery(projectId, "C_RESOURCES_SELECT_ONLY_FOLDERS"));
            conditions.append(END_CONDITION);
        } else if ((mode & CmsDriverManager.READMODE_ONLY_FILES) > 0) {
            // C_READMODE_ONLY_FILES: add condition to match only files
            conditions.append(BEGIN_INCLUDE_CONDITION);
            conditions.append(m_sqlManager.readQuery(projectId, "C_RESOURCES_SELECT_ONLY_FILES"));
            conditions.append(END_CONDITION);
        }
    }
851809
String buildConditionExpression(SubstitutionContext context) {
        return condition == null ? null : condition.asSubstituted(context);
    }
947679
private static Map<String, QueryBuilder> buildFilters(RuleQuery query) {
    Map<String, QueryBuilder> filters = new HashMap<>();

    /* Add enforced filter on main type Rule */
    filters.put(
      FIELD_INDEX_TYPE,
      boolQuery().must(QueryBuilders.termsQuery(FIELD_INDEX_TYPE, TYPE_RULE.getType())));

    /* Add enforced filter on rules that are REMOVED */
    filters.put(FIELD_RULE_STATUS,
      boolQuery().mustNot(
        QueryBuilders.termQuery(FIELD_RULE_STATUS,
          RuleStatus.REMOVED.toString())));

    if (StringUtils.isNotEmpty(query.getInternalKey())) {
      filters.put(FIELD_RULE_INTERNAL_KEY,
        QueryBuilders.termQuery(FIELD_RULE_INTERNAL_KEY, query.getInternalKey()));
    }

    if (StringUtils.isNotEmpty(query.getRuleKey())) {
      filters.put(FIELD_RULE_RULE_KEY,
        QueryBuilders.termQuery(FIELD_RULE_RULE_KEY, query.getRuleKey()));
    }

    if (isNotEmpty(query.getLanguages())) {
      filters.put(FIELD_RULE_LANGUAGE,
        QueryBuilders.termsQuery(FIELD_RULE_LANGUAGE, query.getLanguages()));
    }

    if (isNotEmpty(query.getRepositories())) {
      filters.put(FIELD_RULE_REPOSITORY,
        QueryBuilders.termsQuery(FIELD_RULE_REPOSITORY, query.getRepositories()));
    }

    if (isNotEmpty(query.getSeverities())) {
      filters.put(FIELD_RULE_SEVERITY,
        QueryBuilders.termsQuery(FIELD_RULE_SEVERITY, query.getSeverities()));
    }

    if (StringUtils.isNotEmpty(query.getKey())) {
      filters.put(FIELD_RULE_KEY,
        QueryBuilders.termQuery(FIELD_RULE_KEY, query.getKey()));
    }

    if (isNotEmpty(query.getTags())) {
      filters.put(FIELD_RULE_EXTENSION_TAGS,
        buildTagsFilter(query.getTags(), query.getOrganization()));
    }

    Collection<RuleType> types = query.getTypes();
    if (isNotEmpty(types)) {
      List<String> typeNames = types.stream().map(RuleType::toString).collect(MoreCollectors.toList());
      filters.put(FIELD_RULE_TYPE,
        QueryBuilders.termsQuery(FIELD_RULE_TYPE, typeNames));
    }

    if (query.getAvailableSinceLong() != null) {
      filters.put("availableSince", QueryBuilders.rangeQuery(FIELD_RULE_CREATED_AT)
        .gte(query.getAvailableSinceLong()));
    }

    if (isNotEmpty(query.getStatuses())) {
      Collection<String> stringStatus = new ArrayList<>();
      for (RuleStatus status : query.getStatuses()) {
        stringStatus.add(status.name());
      }
      filters.put(FIELD_RULE_STATUS,
        QueryBuilders.termsQuery(FIELD_RULE_STATUS, stringStatus));
    }

    Boolean isTemplate = query.isTemplate();
    if (isTemplate != null) {
      filters.put(FIELD_RULE_IS_TEMPLATE,
        QueryBuilders.termQuery(FIELD_RULE_IS_TEMPLATE, Boolean.toString(isTemplate)));
    }

    boolean includeExternal = query.includeExternal();
    if (!includeExternal) {
      filters.put(FIELD_RULE_IS_EXTERNAL,
        QueryBuilders.termQuery(FIELD_RULE_IS_EXTERNAL, false));
    }

    String template = query.templateKey();
    if (template != null) {
      filters.put(FIELD_RULE_TEMPLATE_KEY,
        QueryBuilders.termQuery(FIELD_RULE_TEMPLATE_KEY, template));
    }

    /* Implementation of activation query */
    QProfileDto profile = query.getQProfile();
    if (query.getActivation() != null && profile != null) {
      QueryBuilder childQuery = buildActivationFilter(query, profile);

      if (TRUE.equals(query.getActivation())) {
        filters.put("activation",
          JoinQueryBuilders.hasChildQuery(TYPE_ACTIVE_RULE.getName(),
            childQuery, ScoreMode.None));
      } else if (FALSE.equals(query.getActivation())) {
        filters.put("activation",
          boolQuery().mustNot(
            JoinQueryBuilders.hasChildQuery(TYPE_ACTIVE_RULE.getName(),
              childQuery, ScoreMode.None)));
      }
      QProfileDto compareToQProfile = query.getCompareToQProfile();
      if (compareToQProfile != null) {
        filters.put("comparison",
          JoinQueryBuilders.hasChildQuery(
            TYPE_ACTIVE_RULE.getName(),
            boolQuery().must(QueryBuilders.termQuery(FIELD_ACTIVE_RULE_PROFILE_UUID, compareToQProfile.getRulesProfileUuid())),
            ScoreMode.None));
      }
    }

    return filters;
  }
651263
function createSearchConfig(sFieldToSearch) {
		var oConfig = {
			fields: {},
			expand: true
		};

		oConfig.fields[sFieldToSearch] = {};
		return oConfig;
	}
431526
public static List<org.fcrepo.server.types.gen.Condition> convertConditionsListToGenConditionsArray(List<Condition> conditions) {
        List<org.fcrepo.server.types.gen.Condition> genConditions =
                new ArrayList<org.fcrepo.server.types.gen.Condition>();

        for (Condition condition : conditions) {
            genConditions.add(convertConditionToGenCondition(condition));
        }

        return genConditions;
    }
593031
def search(self, field_name, search_terms, operator=QueryOperator.OR):
        

        if field_name is None:
            raise ValueError("None field_name is invalid")

        field_name = Query.escape_if_needed(field_name)
        self._add_operator_if_needed()
        self.negate_if_needed(field_name)

        self.last_equality = {field_name: "(" + search_terms + ")" if ' ' in search_terms else search_terms}
        token = _Token(field_name=field_name, token="search", value=self.add_query_parameter(search_terms),
                       search_operator=operator)
        token.write = self.rql_where_write(token)
        self._where_tokens.append(token)
        return self