本文整理汇总了Java中org.jai.search.model.SearchCriteria.isUseBoostingFactor方法的典型用法代码示例。如果您正苦于以下问题:Java SearchCriteria.isUseBoostingFactor方法的具体用法?Java SearchCriteria.isUseBoostingFactor怎么用?Java SearchCriteria.isUseBoostingFactor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jai.search.model.SearchCriteria
的用法示例。
在下文中一共展示了SearchCriteria.isUseBoostingFactor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getQueryBuilder
import org.jai.search.model.SearchCriteria; //导入方法依赖的package包/类
protected QueryBuilder getQueryBuilder(SearchCriteria searchCriteria)
{
QueryBuilder matchQueryBuilder = null;
String queryString = searchCriteria.getQuery();
if (StringUtils.isBlank(queryString))
{
matchQueryBuilder = QueryBuilders.matchAllQuery();
}
else
{
final String filterSpecialCharsQueryString = escapeQueryChars(queryString);
final QueryStringQueryBuilder queryStringQueryBuilder = QueryBuilders.queryString(filterSpecialCharsQueryString);
// Add fields
queryStringQueryBuilder.field(SearchDocumentFieldName.TITLE.getFieldName(), (float) 0.5)
.field(SearchDocumentFieldName.DESCRIPTION.getFieldName(), (float) 0.15)
;
for (final String contentCategoryFieldName : SearchFacetName.categoryFacetFields)
{
queryStringQueryBuilder.field(SearchDocumentFieldName.CATEGORIES_ARRAY.getFieldName() + "."
+ contentCategoryFieldName, 1);
}
matchQueryBuilder = queryStringQueryBuilder;
}
if(searchCriteria.isUseBoostingFactor())
{
FunctionScoreQueryBuilder queryBuilder = new FunctionScoreQueryBuilder(matchQueryBuilder);
ScoreFunctionBuilder scoreFunctionBuilder = new ScriptScoreFunctionBuilder().script(SearchDocumentFieldName
.getCalculatedScoreScriptForBostFactor());
queryBuilder.add(scoreFunctionBuilder);
return queryBuilder;
}
return matchQueryBuilder;
}
示例2: getQueryBuilder
import org.jai.search.model.SearchCriteria; //导入方法依赖的package包/类
protected QueryBuilder getQueryBuilder(final SearchCriteria searchCriteria)
{
QueryBuilder matchQueryBuilder = null;
final String queryString = searchCriteria.getQuery();
if (StringUtils.isBlank(queryString))
{
matchQueryBuilder = QueryBuilders.matchAllQuery();
}
else
{
final String filterSpecialCharsQueryString = escapeQueryChars(queryString);
final QueryStringQueryBuilder queryStringQueryBuilder = QueryBuilders.queryString(filterSpecialCharsQueryString);
// Add fields
queryStringQueryBuilder.field(SearchDocumentFieldName.TITLE.getFieldName(), (float) 0.5).field(
SearchDocumentFieldName.DESCRIPTION.getFieldName(), (float) 0.15);
for (final String contentCategoryFieldName : SearchFacetName.categoryFacetFields)
{
queryStringQueryBuilder.field(SearchDocumentFieldName.CATEGORIES_ARRAY.getFieldName() + "." + contentCategoryFieldName, 1);
}
matchQueryBuilder = queryStringQueryBuilder;
}
if (searchCriteria.isUseBoostingFactor())
{
final FunctionScoreQueryBuilder queryBuilder = new FunctionScoreQueryBuilder(matchQueryBuilder);
final ScoreFunctionBuilder scoreFunctionBuilder = new ScriptScoreFunctionBuilder().script(SearchDocumentFieldName
.getCalculatedScoreScriptForBostFactor());
queryBuilder.add(scoreFunctionBuilder);
return queryBuilder;
}
return matchQueryBuilder;
}
示例3: getQueryBuilder
import org.jai.search.model.SearchCriteria; //导入方法依赖的package包/类
protected QueryBuilder getQueryBuilder(final SearchCriteria searchCriteria) {
QueryBuilder matchQueryBuilder = null;
final String queryString = searchCriteria.getQuery();
if (StringUtils.isBlank(queryString)) {
matchQueryBuilder = QueryBuilders.matchAllQuery();
} else {
final String filterSpecialCharsQueryString = escapeQueryChars(queryString);
final QueryStringQueryBuilder queryStringQueryBuilder = QueryBuilders
.queryString(filterSpecialCharsQueryString);
// Add fields
queryStringQueryBuilder.field(
SearchDocumentFieldName.TITLE.getFieldName(), (float) 0.5)
.field(SearchDocumentFieldName.DESCRIPTION.getFieldName(),
(float) 0.15);
for (final String contentCategoryFieldName : SearchFacetName.categoryFacetFields) {
queryStringQueryBuilder.field(
SearchDocumentFieldName.CATEGORIES_ARRAY.getFieldName()
+ "." + contentCategoryFieldName, 1);
}
matchQueryBuilder = queryStringQueryBuilder;
}
if (searchCriteria.isUseBoostingFactor()) {
final FunctionScoreQueryBuilder queryBuilder = new FunctionScoreQueryBuilder(
matchQueryBuilder);
final ScoreFunctionBuilder scoreFunctionBuilder = new ScriptScoreFunctionBuilder()
.script(SearchDocumentFieldName
.getCalculatedScoreScriptForBostFactor());
queryBuilder.add(scoreFunctionBuilder);
return queryBuilder;
}
return matchQueryBuilder;
}