本文整理汇总了Java中org.jai.search.model.SearchCriteria.isNoFacets方法的典型用法代码示例。如果您正苦于以下问题:Java SearchCriteria.isNoFacets方法的具体用法?Java SearchCriteria.isNoFacets怎么用?Java SearchCriteria.isNoFacets使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jai.search.model.SearchCriteria
的用法示例。
在下文中一共展示了SearchCriteria.isNoFacets方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: searchProducts
import org.jai.search.model.SearchCriteria; //导入方法依赖的package包/类
@Override
public ProductSearchResult searchProducts(SearchCriteria searchCriteria)
{
QueryBuilder queryBuilder = getQueryBuilder(searchCriteria);
SearchRequestBuilder requestBuilder = getSearchRequestBuilder(searchCriteria.getIndexes(),
searchCriteria.getDocumentTypes(),
searchCriteria.getFrom(),
searchCriteria.getSize());
requestBuilder.addFields(SearchDocumentFieldName.productQueryFields);
if(searchCriteria.isRescoreOnSoldOut())
{
Rescorer rescorer = RescoreBuilder.queryRescorer(QueryBuilders.termQuery(SearchDocumentFieldName.SOLD_OUT.getFieldName(), false))
.setQueryWeight(1.0f) //default
.setRescoreQueryWeight(1.5f)
;
requestBuilder.setRescorer(rescorer);
}
if (searchCriteria.hasFilters())
{
AndFilterBuilder andFilterBuilder = getFilterBuilderForSearchCriteria(searchCriteria);
requestBuilder.setQuery(QueryBuilders.filteredQuery(queryBuilder, andFilterBuilder));
} else
{
requestBuilder.setQuery(queryBuilder);
}
if (!searchCriteria.isNoFacets() && searchCriteria.getFacets().size() > 0)
{
addFacets(searchCriteria, requestBuilder);
}
//Add sorting
if(searchCriteria.getSortOrder() !=null)
{
//First on given field
requestBuilder.addSort(SortBuilders.fieldSort(SearchDocumentFieldName.AVAILABLE_DATE.getFieldName()).order(searchCriteria.getSortOrder()).missing("_last"));
//then on score based
requestBuilder.addSort(SortBuilders.scoreSort());
}
logger.debug("Executing following search request:" + requestBuilder.internalBuilder().toString());
SearchResponse searchResponse = requestBuilder.execute().actionGet();
printSearchResponseForDebug(searchResponse);
return getProductSearchResults(searchResponse);
}
示例2: searchProducts
import org.jai.search.model.SearchCriteria; //导入方法依赖的package包/类
@Override
public ProductSearchResult searchProducts(final SearchCriteria searchCriteria)
{
final QueryBuilder queryBuilder = getQueryBuilder(searchCriteria);
final SearchRequestBuilder requestBuilder = getSearchRequestBuilder(searchCriteria.getIndexes(), searchCriteria.getDocumentTypes(),
searchCriteria.getFrom(), searchCriteria.getSize());
requestBuilder.addFields(SearchDocumentFieldName.productQueryFields);
if (searchCriteria.isRescoreOnSoldOut())
{
final Rescorer rescorer = RescoreBuilder
.queryRescorer(QueryBuilders.termQuery(SearchDocumentFieldName.SOLD_OUT.getFieldName(), false)).setQueryWeight(1.0f) // default
.setRescoreQueryWeight(1.5f);
requestBuilder.setRescorer(rescorer);
}
if (searchCriteria.hasFilters())
{
final AndFilterBuilder andFilterBuilder = getFilterBuilderForSearchCriteria(searchCriteria);
requestBuilder.setQuery(QueryBuilders.filteredQuery(queryBuilder, andFilterBuilder));
}
else
{
requestBuilder.setQuery(queryBuilder);
}
if (!searchCriteria.isNoFacets() && searchCriteria.getFacets().size() > 0)
{
addFacets(searchCriteria, requestBuilder);
}
// Add sorting
if (searchCriteria.getSortOrder() != null)
{
// First on given field
requestBuilder.addSort(SortBuilders.fieldSort(SearchDocumentFieldName.AVAILABLE_DATE.getFieldName())
.order(searchCriteria.getSortOrder()).missing("_last"));
// then on score based
requestBuilder.addSort(SortBuilders.scoreSort());
}
logger.debug("Executing following search request:" + requestBuilder.internalBuilder().toString());
final SearchResponse searchResponse = requestBuilder.execute().actionGet();
printSearchResponseForDebug(searchResponse);
return getProductSearchResults(searchResponse);
}
示例3: searchProducts
import org.jai.search.model.SearchCriteria; //导入方法依赖的package包/类
@Override
public ProductSearchResult searchProducts(
final SearchCriteria searchCriteria) {
final QueryBuilder queryBuilder = getQueryBuilder(searchCriteria);
final SearchRequestBuilder requestBuilder = getSearchRequestBuilder(
searchCriteria.getIndexes(), searchCriteria.getDocumentTypes(),
searchCriteria.getFrom(), searchCriteria.getSize());
requestBuilder.addFields(SearchDocumentFieldName.productQueryFields);
if (searchCriteria.isRescoreOnSoldOut()) {
final Rescorer rescorer = RescoreBuilder
.queryRescorer(
QueryBuilders.termQuery(
SearchDocumentFieldName.SOLD_OUT
.getFieldName(), false))
.setQueryWeight(1.0f) // default
.setRescoreQueryWeight(1.5f);
requestBuilder.setRescorer(rescorer);
}
if (searchCriteria.hasFilters()) {
final AndFilterBuilder andFilterBuilder = getFilterBuilderForSearchCriteria(searchCriteria);
requestBuilder.setQuery(QueryBuilders.filteredQuery(queryBuilder,
andFilterBuilder));
} else {
requestBuilder.setQuery(queryBuilder);
}
if (!searchCriteria.isNoFacets()
&& searchCriteria.getFacets().size() > 0) {
addFacets(searchCriteria, requestBuilder);
}
// Add sorting
if (searchCriteria.getSortOrder() != null) {
// First on given field
requestBuilder.addSort(SortBuilders
.fieldSort(
SearchDocumentFieldName.AVAILABLE_DATE
.getFieldName())
.order(searchCriteria.getSortOrder()).missing("_last"));
// then on score based
requestBuilder.addSort(SortBuilders.scoreSort());
}
logger.debug("Executing following search request:"
+ requestBuilder.internalBuilder().toString());
final SearchResponse searchResponse = requestBuilder.execute()
.actionGet();
printSearchResponseForDebug(searchResponse);
return getProductSearchResults(searchResponse);
}