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


Java TermRangeQuery.setRewriteMethod方法代码示例

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


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

示例1: newRangeQuery

import org.apache.lucene.search.TermRangeQuery; //导入方法依赖的package包/类
/**
 * Builds a new {@link TermRangeQuery} instance
 * 
 * @param field
 *            Field
 * @param part1
 *            min
 * @param part2
 *            max
 * @param startInclusive
 *            true if the start of the range is inclusive
 * @param endInclusive
 *            true if the end of the range is inclusive
 * @return new {@link TermRangeQuery} instance
 */
protected Query newRangeQuery(String field, String part1, String part2, boolean startInclusive,
		boolean endInclusive) {
	final BytesRef start;
	final BytesRef end;

	if (part1 == null) {
		start = null;
	} else {
		start = analyzeRangeTerms ? getAnalyzer().normalize(field, part1) : new BytesRef(part1);
	}

	if (part2 == null) {
		end = null;
	} else {
		end = analyzeRangeTerms ? getAnalyzer().normalize(field, part2) : new BytesRef(part2);
	}

	final TermRangeQuery query = new TermRangeQuery(field, start, end, startInclusive, endInclusive);

	query.setRewriteMethod(multiTermRewriteMethod);
	return query;
}
 
开发者ID:easynet-cn,项目名称:resource-query-parser,代码行数:38,代码来源:QueryParserBase.java

示例2: convertDate

import org.apache.lucene.search.TermRangeQuery; //导入方法依赖的package包/类
/**
 * Converts a FreeTextDateQuery to a BooleanClause
 */
private BooleanClause convertDate(FreeTextDateQuery query)
{
	TermRangeQuery termQuery = new TermRangeQuery(query.getField(), convertDate(query.getStart(), query),
		convertDate(query.getEnd(), query), query.isIncludeStart(), query.isIncludeEnd());
	termQuery.setRewriteMethod(MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE);
	return new BooleanClause(termQuery, Occur.SHOULD);
}
 
开发者ID:equella,项目名称:Equella,代码行数:11,代码来源:ItemIndex.java

示例3: build

import org.apache.lucene.search.TermRangeQuery; //导入方法依赖的package包/类
@Override
public TermRangeQuery build(QueryNode queryNode) throws QueryNodeException {
  TermRangeQueryNode rangeNode = (TermRangeQueryNode) queryNode;
  FieldQueryNode upper = rangeNode.getUpperBound();
  FieldQueryNode lower = rangeNode.getLowerBound();
  
  String field = StringUtils.toString(rangeNode.getField());
  String lowerText = lower.getTextAsString();
  String upperText = upper.getTextAsString();
  
  if (lowerText.length() == 0) {
    lowerText = null;
  }
  
  if (upperText.length() == 0) {
    upperText = null;
  }
  
  TermRangeQuery rangeQuery = TermRangeQuery.newStringRange(field, lowerText, upperText, rangeNode
      .isLowerInclusive(), rangeNode.isUpperInclusive());
  
  MultiTermQuery.RewriteMethod method = (MultiTermQuery.RewriteMethod) queryNode
      .getTag(MultiTermRewriteMethodProcessor.TAG_ID);
  if (method != null) {
    rangeQuery.setRewriteMethod(method);
  }
  
  return rangeQuery;
  
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:TermRangeQueryNodeBuilder.java

示例4: newRangeQuery

import org.apache.lucene.search.TermRangeQuery; //导入方法依赖的package包/类
@Override
protected Query newRangeQuery(String field, String part1, String part2,
    boolean startInclusive, boolean endInclusive) {
  if (isPass2ResolvingPhrases) {
    // Must use old-style RangeQuery in order to produce a BooleanQuery
    // that can be turned into SpanOr clause
    TermRangeQuery rangeQuery = TermRangeQuery.newStringRange(field, part1, part2, startInclusive, endInclusive);
    rangeQuery.setRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE);
    return rangeQuery;
  }
  return super.newRangeQuery(field, part1, part2, startInclusive, endInclusive);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:ComplexPhraseQueryParser.java

示例5: newRangeQuery

import org.apache.lucene.search.TermRangeQuery; //导入方法依赖的package包/类
/**
 * Builds a new TermRangeQuery instance
 * 
 * @param field Field
 * @param part1 min
 * @param part2 max
 * @param inclusive true if range is inclusive
 * @return new TermRangeQuery instance
 */
protected Query newRangeQuery(String field, String part1, String part2, boolean inclusive) {
	final TermRangeQuery query = new TermRangeQuery(field, part1, part2, inclusive, inclusive, rangeCollator);
	query.setRewriteMethod(multiTermRewriteMethod);
	return query;
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:15,代码来源:QueryParser.java


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