当前位置: 首页>>代码示例>>Java>>正文


Java BooleanJunction.createQuery方法代码示例

本文整理汇总了Java中org.hibernate.search.query.dsl.BooleanJunction.createQuery方法的典型用法代码示例。如果您正苦于以下问题:Java BooleanJunction.createQuery方法的具体用法?Java BooleanJunction.createQuery怎么用?Java BooleanJunction.createQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hibernate.search.query.dsl.BooleanJunction的用法示例。


在下文中一共展示了BooleanJunction.createQuery方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: all

import org.hibernate.search.query.dsl.BooleanJunction; //导入方法依赖的package包/类
public Query all(Collection<Query> subQueries) {
    BooleanJunction<BooleanJunction> bool = queryBuilder.bool();
    for (Query subQuery : subQueries) {
        bool.must(subQuery);
    }
    return bool.createQuery();
}
 
开发者ID:snowdrop,项目名称:spring-data-snowdrop,代码行数:8,代码来源:LuceneQueryBuilder.java

示例2: any

import org.hibernate.search.query.dsl.BooleanJunction; //导入方法依赖的package包/类
public Query any(Collection<Query> subQueries) {
    BooleanJunction<BooleanJunction> bool = queryBuilder.bool();
    for (Query subQuery : subQueries) {
        bool.should(subQuery);
    }
    return bool.createQuery();
}
 
开发者ID:snowdrop,项目名称:spring-data-snowdrop,代码行数:8,代码来源:LuceneQueryBuilder.java

示例3: in

import org.hibernate.search.query.dsl.BooleanJunction; //导入方法依赖的package包/类
public Query in(String fieldName, Collection<?> values) {
    BooleanJunction<BooleanJunction> bool = queryBuilder.bool();
    for (Object value : values) {
        bool.should(equal(fieldName, value));
    }
    return bool.createQuery();
}
 
开发者ID:snowdrop,项目名称:spring-data-snowdrop,代码行数:8,代码来源:LuceneQueryBuilder.java

示例4: all

import org.hibernate.search.query.dsl.BooleanJunction; //导入方法依赖的package包/类
@Override
public Query all(QueryBuilder builder, Query ... queries) {
	BooleanJunction<?> junction = null;
	for (Query query : queries) {
		if (query != null) {
			junction = junction != null ? junction : builder.bool();
			junction.must(query);
		}
	}
	return junction != null ? junction.createQuery() : null;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:12,代码来源:HibernateSearchLuceneQueryFactoryImpl.java

示例5: any

import org.hibernate.search.query.dsl.BooleanJunction; //导入方法依赖的package包/类
@Override
public Query any(QueryBuilder builder, Query ... queries) {
	BooleanJunction<?> junction = null;
	for (Query query : queries) {
		if (query != null) {
			junction = junction != null ? junction : builder.bool();
			junction.should(query);
		}
	}
	return junction != null ? junction.createQuery() : null;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:12,代码来源:HibernateSearchLuceneQueryFactoryImpl.java

示例6: matchOneIfGiven

import org.hibernate.search.query.dsl.BooleanJunction; //导入方法依赖的package包/类
@Override
public <P> Query matchOneIfGiven(QueryBuilder builder, String fieldPath, Collection<? extends P> possibleValues) {
	if (possibleValues == null || possibleValues.isEmpty()) {
		return null;
	}
	BooleanJunction<?> subJunction = builder.bool();
	for (P possibleValue : possibleValues) {
		subJunction.should(builder.keyword()
				.onField(fieldPath)
				.matching(possibleValue)
				.createQuery());
	}
	return subJunction.createQuery();
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:15,代码来源:HibernateSearchLuceneQueryFactoryImpl.java

示例7: matchAllIfGiven

import org.hibernate.search.query.dsl.BooleanJunction; //导入方法依赖的package包/类
@Override
public <P> Query matchAllIfGiven(QueryBuilder builder, String fieldPath, Collection<? extends P> values) {
	if (values == null || values.isEmpty()) {
		return null;
	}
	BooleanJunction<?> subJunction = builder.bool();
	for (P possibleValue : values) {
		subJunction.must(builder.keyword()
				.onField(fieldPath)
				.matching(possibleValue)
				.createQuery());
	}
	return subJunction.createQuery();
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:15,代码来源:HibernateSearchLuceneQueryFactoryImpl.java

示例8: performSearch

import org.hibernate.search.query.dsl.BooleanJunction; //导入方法依赖的package包/类
private static List<Object> performSearch(Condition where, String cacheName, ObjectConnection connection)
		throws TranslatorException {
	
	LogManager.logTrace(LogConstants.CTX_CONNECTOR,
			"Using Lucene Searching."); //$NON-NLS-1$
	
	Class<?> type = connection.getType(cacheName);
	
	//Map<?, ?> cache, 
	SearchManager searchManager = Search
			.getSearchManager((Cache<?, ?>) connection.getCacheContainer().getCache(cacheName) );

	QueryBuilder queryBuilder = searchManager.buildQueryBuilderForClass(type).get();

	BooleanJunction<BooleanJunction> junction = queryBuilder.bool();
	boolean createdQueries = buildQueryFromWhereClause(where,
			junction, queryBuilder);

	Query query = null;
	if (createdQueries) {
		query = junction.createQuery();
		
	} else {
		query = queryBuilder.all().createQuery();
	}

	CacheQuery cacheQuery = searchManager.getQuery(query, type); // rootNodeType

	List<Object> results = cacheQuery.list();
	if (results == null || results.isEmpty()) {
		return Collections.emptyList();
	}

	return results;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:36,代码来源:LuceneSearch.java

示例9: createQuery

import org.hibernate.search.query.dsl.BooleanJunction; //导入方法依赖的package包/类
private Query createQuery(QueryBuilder builder, BooleanJunction<?> context, boolean valid) {
    try {
        if (valid) {
            return context.createQuery();
        } else {
            return builder.all().except(builder.all().createQuery()).createQuery();
        }
    } catch (Exception e) {
        throw propagate(e);
    }
}
 
开发者ID:jpasearch,项目名称:jpasearch,代码行数:12,代码来源:DefaultLuceneQueryBuilder.java

示例10: buildQuery

import org.hibernate.search.query.dsl.BooleanJunction; //导入方法依赖的package包/类
private Query buildQuery(String q, Member homeMember, StandingState standingState, boolean standingStateNot) {
	QueryBuilder queryBuilder = getSearchFactory().buildQueryBuilder()
			.forEntity(Affiliate.class).get();
	
	//Odd issue with Camel case text not finding exact matches. Workaround using lowercase.
	Query textQuery = buildWildcardQueryForTokens(queryBuilder, q.toLowerCase());

	if (homeMember == null && standingState == null) {
		return textQuery;
	} else {
		BooleanJunction <MustJunction> building = queryBuilder
				.bool()
				.must(textQuery);

		if (homeMember != null) {
			Query homeMemberQuery = buildQueryMatchingHomeMember(queryBuilder, homeMember);
			building = building.must(homeMemberQuery);
		}
		if (standingState != null) {
			Query standingStateQuery = buildQueryMatchingStandingState(queryBuilder, standingState);
			MustJunction standingStateBuilding = building.must(standingStateQuery);
			if (standingStateNot) {
				// Caught up in .not() returning boolean rather than must...
				building = standingStateBuilding.not();
			} else {
				building = standingStateBuilding;
			}
		}
		return building.createQuery();
	}
}
 
开发者ID:IHTSDO,项目名称:MLDS,代码行数:32,代码来源:AffiliateSearchRepository.java

示例11: buildWildcardQueryForTokens

import org.hibernate.search.query.dsl.BooleanJunction; //导入方法依赖的package包/类
Query buildWildcardQueryForTokens(QueryBuilder queryBuilder, String q) {
	BooleanJunction<?> bool = queryBuilder.bool();

	//Analyzer searchtokenAnalyzer = getSearchFactory().getAnalyzer("searchtokenanalyzer");

	try {
		// We're letting the default analyzer tokenize the main query for the ALL field
		Query allKeywordQuery = queryBuilder.keyword()
				.onField(FIELD_ALL).ignoreFieldBridge().matching(q)
				.createQuery();
		bool.should(allKeywordQuery);
	} catch (EmptyQueryException e) {
		// ignore it, and allow the full query since we have a limit.
	}

	// And then we do a dumb split on whitespace and turn every string into a wildcard query
	// on all the fields.
	String[] tokens = q.split("\\s+");
	for (String token : tokens) {
		bool.should(queryBuilder.keyword()
				.wildcard()
				.onField(FIELD_ALL).ignoreFieldBridge().matching(token+"*")
				.createQuery());
		bool.should(queryBuilder.keyword()
				.wildcard()
				.onField("address.ALL").ignoreFieldBridge().matching(token+"*")
				.createQuery());
		bool.should(queryBuilder.keyword()
				.wildcard()
				.onField("address.country.commonName").ignoreFieldBridge().matching(token+"*")
				.createQuery());
		bool.should(queryBuilder.keyword()
				.wildcard()
				.onField("billingAddress.ALL").matching(token+"*")
				.createQuery());
		bool.should(queryBuilder.keyword()
				.wildcard()
				.onField("billingAddress.country.commonName").matching(token+"*")
				.createQuery());
		bool.should(queryBuilder.keyword()
				.wildcard()
				.onField("email").matching(token+"*")
				.createQuery());
	}
	Query textQuery = bool.createQuery();

	return textQuery;
}
 
开发者ID:IHTSDO,项目名称:MLDS,代码行数:49,代码来源:AffiliateSearchRepository.java

示例12: handle

import org.hibernate.search.query.dsl.BooleanJunction; //导入方法依赖的package包/类
public <T> void handle(RestCriteria restCriteria,
		Map<String, Query> criteria, QueryBuilder queryBuilder)
		throws BadCriteriaValueException, CriteriaIDNotFoundException {
	
	BooleanJunction<?> booleanJunction = queryBuilder.bool();
	
	booleanJunction
	.must(queryBuilder.keyword().onField(restCriteria.readCriteriaName()).matching(restCriteria.getParsedValue()).createQuery()).not();
	
	Query query = booleanJunction.createQuery();
	
	criteria.put(restCriteria.readCriteriaId(), query);
}
 
开发者ID:mcraken,项目名称:spring-scaffy,代码行数:14,代码来源:NotEqualCriteriaHandler.java


注:本文中的org.hibernate.search.query.dsl.BooleanJunction.createQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。