Java 类org.apache.lucene.search.PrefixFilter 实例源码

项目:t4f-data    文件:FilterTest.java   
public void testPrefixFilter() throws Exception {
  Filter prefixFilter = new PrefixFilter(
                          new Term("category",
                                   "/technology/computers"));
  assertEquals("only /technology/computers/* books",
               8,
               TestUtil.hitCount(searcher,
                                 allBooks,
                                 prefixFilter));
}
项目:GeoprocessingAppstore    文件:QueryProvider.java   
/**
 * Creates new prefix query. Depending on {@link getUseConstantScoreQuery()}
 * it's either {@link org.apache.lucene.search.ConstantScoreQuery} with
 * {@link org.apache.lucene.search.PrefixFilter} or just
 * {@link org.apache.lucene.search.PrefixQuery}.
 * @param term term
 * @return prefix query
 */
private Query newPrefixQuery(String fieldName, String term) {
  return this.getUseConstantScoreQuery()?
    new ConstantScoreQuery(new PrefixFilter(new Term(fieldName,term))):
    new PrefixQuery(new Term(fieldName,term));
}
项目:usgin-geoportal    文件:QueryProvider.java   
/**
 * Creates new prefix query. Depending on {@link getUseConstantScoreQuery()}
 * it's either {@link org.apache.lucene.search.ConstantScoreQuery} with
 * {@link org.apache.lucene.search.PrefixFilter} or just
 * {@link org.apache.lucene.search.PrefixQuery}.
 * @param term term
 * @return prefix query
 */
private Query newPrefixQuery(String fieldName, String term) {
  return this.getUseConstantScoreQuery()?
    new ConstantScoreQuery(new PrefixFilter(new Term(fieldName,term))):
    new PrefixQuery(new Term(fieldName,term));
}