private BooleanQuery buildLineageQuery(final Collection<String> flowFileUuids) { // Create a query for all Events related to the FlowFiles of interest. We do this by adding all ID's as // "SHOULD" clauses and then setting the minimum required to 1. final BooleanQuery lineageQuery; if (flowFileUuids == null || flowFileUuids.isEmpty()) { lineageQuery = null; } else { lineageQuery = new BooleanQuery(); for (final String flowFileUuid : flowFileUuids) { lineageQuery.add(new TermQuery(new Term(SearchableFields.FlowFileUUID.getSearchableFieldName(), flowFileUuid)), Occur.SHOULD); } lineageQuery.setMinimumNumberShouldMatch(1); } return lineageQuery; }
flowFileIdQuery.add(new TermQuery(new Term(SearchableFields.FlowFileUUID.getSearchableFieldName(), flowFileUuid)), Occur.SHOULD); flowFileIdQuery.setMinimumNumberShouldMatch(1);
public SearchEngineQueryBuilder.SearchEngineBooleanQueryBuilder setMinimumNumberShouldMatch(int min) { boolQuery.setMinimumNumberShouldMatch(min); return this; }
if (!AND_PARAM.equals(op)) query.setMinimumNumberShouldMatch(minimum_match);
public Collection<PluginHistory> listHudsonPlugins() throws PlexusContainerException, ComponentLookupException, IOException, UnsupportedExistingLuceneIndexException, AbstractArtifactResolutionException { BooleanQuery q = new BooleanQuery(); q.setMinimumNumberShouldMatch(1); q.add(indexer.constructQuery(ArtifactInfo.PACKAGING,"hpi"), Occur.SHOULD); q.add(indexer.constructQuery(ArtifactInfo.PACKAGING,"jpi"), Occur.SHOULD);
/** * If enabled and allowed, wraps the given query with a boolean query that adds a must match on the alias). */ public static Query andAliasQueryIfNeeded(Query query, ResourcePropertyLookup lookup, boolean addAliasQueryWithDotPath, SearchEngineFactory searchEngineFactory) { if (query == null) { return query; } if (!addAliasQueryWithDotPath) { return query; } if (lookup == null) { return query; } String alias = lookup.getDotPathAlias(); if (alias == null) { return query; } BooleanQuery booleanQuery = new BooleanQuery(); booleanQuery.add(query, BooleanClause.Occur.MUST); BooleanQuery aliasQuery = new BooleanQuery(); aliasQuery.add(new TermQuery(new Term(searchEngineFactory.getAliasProperty(), alias)), BooleanClause.Occur.SHOULD); aliasQuery.add(new TermQuery(new Term(searchEngineFactory.getExtendedAliasProperty(), alias)), BooleanClause.Occur.SHOULD); aliasQuery.setMinimumNumberShouldMatch(1); booleanQuery.add(aliasQuery, BooleanClause.Occur.MUST); return booleanQuery; }
BooleanClause.Occur.SHOULD); query.setMinimumNumberShouldMatch(jsonQuery.optInt(MINIMUM_NUMBER_SHOULD_MATCH_PARAM, 0));
builder.setMinimumNumberShouldMatch((int) (Math.ceil(minhashes.size() * similarity)));
builder.setMinimumNumberShouldMatch((int) (Math.ceil(minhashes.size() * similarity)));
public BooleanQuery build(QueryNode queryNode) throws QueryNodeException { AnyQueryNode andNode = (AnyQueryNode) queryNode; BooleanQuery bQuery = new BooleanQuery(); List<QueryNode> children = andNode.getChildren(); if (children != null) { for (QueryNode child : children) { Object obj = child.getTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID); if (obj != null) { Query query = (Query) obj; try { bQuery.add(query, BooleanClause.Occur.SHOULD); } catch (TooManyClauses ex) { throw new QueryNodeException(new MessageImpl( /* * IQQQ.Q0028E_TOO_MANY_BOOLEAN_CLAUSES, * BooleanQuery.getMaxClauseCount() */ QueryParserMessages.EMPTY_MESSAGE), ex); } } } } bQuery.setMinimumNumberShouldMatch(andNode.getMinimumMatchingElements()); return bQuery; }
public BooleanQuery build(QueryNode queryNode) throws QueryNodeException { AnyQueryNode andNode = (AnyQueryNode) queryNode; BooleanQuery bQuery = new BooleanQuery(); List<QueryNode> children = andNode.getChildren(); if (children != null) { for (QueryNode child : children) { Object obj = child.getTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID); if (obj != null) { Query query = (Query) obj; try { bQuery.add(query, BooleanClause.Occur.SHOULD); } catch (TooManyClauses ex) { throw new QueryNodeException(new MessageImpl( /* * IQQQ.Q0028E_TOO_MANY_BOOLEAN_CLAUSES, * BooleanQuery.getMaxClauseCount() */ QueryParserMessages.EMPTY_MESSAGE), ex); } } } } bQuery.setMinimumNumberShouldMatch(andNode.getMinimumMatchingElements()); return bQuery; }
final BooleanQuery originalQuery = queryBucket.getOriginalBooleanQuery(); query.setBoost(originalQuery.getBoost()); query.setMinimumNumberShouldMatch(originalQuery.getMinimumNumberShouldMatch()); notWithMatchAll.setMinimumNumberShouldMatch(((BooleanQuery)notQuery).getMinimumNumberShouldMatch()); ((BooleanQuery)notQuery).setMinimumNumberShouldMatch(0); notWithMatchAll.add(transformBooleanQuery((BooleanQuery) notQuery), BooleanClause.Occur.MUST_NOT);
@Override public List<ArtifactDTO> searchTextAndPackaging(String searchText, String packaging, String classifier) throws IOException { BooleanQuery bq = new BooleanQuery(); if (StringUtils.isNotBlank(searchText)) { BooleanQuery textQuery = createTextSearchQuery(searchText); textQuery.setMinimumNumberShouldMatch(1); bq.add(textQuery, Occur.MUST); } if (StringUtils.isNotBlank(packaging)) { bq.add(indexer.constructQuery(MAVEN.PACKAGING, new SourcedSearchExpression(packaging)), Occur.MUST); } if (StringUtils.isNotBlank(classifier)) { bq.add(indexer.constructQuery(MAVEN.CLASSIFIER, new SourcedSearchExpression(classifier)), Occur.MUST); } return searchGrouped(bq); }
private BooleanQuery handleContainsMust(final QueryBucket queryBucket) { BooleanQuery query = new BooleanQuery(); // There is nothing to do here except complete a deep dive on each query final BooleanQuery originalBooleanQuery = queryBucket.getOriginalBooleanQuery(); query.setBoost(originalBooleanQuery.getBoost()); query.setMinimumNumberShouldMatch(originalBooleanQuery.getMinimumNumberShouldMatch()); final BooleanClause[] booleanClauses = originalBooleanQuery.getClauses(); for (BooleanClause booleanClause : booleanClauses) { final Query subQuery = booleanClause.getQuery(); final BooleanClause.Occur subOccur = booleanClause.getOccur(); if (subQuery instanceof BooleanQuery) { query.add(transformBooleanQuery((BooleanQuery) subQuery), subOccur); } else { query.add((Query) subQuery.clone(), subOccur); } } return query; }
private BooleanQuery handleOnlyNot(final QueryBucket queryBucket) { BooleanQuery query = new BooleanQuery(); BooleanQuery originalQuery = queryBucket.getOriginalBooleanQuery(); query.setBoost(originalQuery.getBoost()); query.setMinimumNumberShouldMatch(originalQuery.getMinimumNumberShouldMatch()); // We always add a match all in this case query.add(new MatchAllDocsQuery(), BooleanClause.Occur.MUST); for (Query origNotQuery : queryBucket.getNotQueries()) { Query notQuery = (Query) origNotQuery.clone(); // Make sure we continue to dive the tree if we need to if (notQuery instanceof BooleanQuery) { query.add(transformBooleanQuery((BooleanQuery) notQuery), BooleanClause.Occur.MUST_NOT); } else { query.add(notQuery, BooleanClause.Occur.MUST_NOT); } } return query; }
BooleanQuery replaced = new BooleanQuery(original.isCoordDisabled()); replaced.setBoost(original.getBoost()); replaced.setMinimumNumberShouldMatch(original.getMinimumNumberShouldMatch()); for (BooleanClause clause : original.getClauses()) { replaced.add(visit(clause.getQuery(), visitor), clause.getOccur());
newBoolQuery.setMinimumNumberShouldMatch(boolQuery.getMinimumNumberShouldMatch());