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


Java TermQueryPrefixTreeStrategy类代码示例

本文整理汇总了Java中org.apache.lucene.spatial.prefix.TermQueryPrefixTreeStrategy的典型用法代码示例。如果您正苦于以下问题:Java TermQueryPrefixTreeStrategy类的具体用法?Java TermQueryPrefixTreeStrategy怎么用?Java TermQueryPrefixTreeStrategy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TermQueryPrefixTreeStrategy类属于org.apache.lucene.spatial.prefix包,在下文中一共展示了TermQueryPrefixTreeStrategy类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testEqualsHashCode

import org.apache.lucene.spatial.prefix.TermQueryPrefixTreeStrategy; //导入依赖的package包/类
@Test
public void testEqualsHashCode() {

  final SpatialPrefixTree gridQuad = new QuadPrefixTree(ctx,10);
  final SpatialPrefixTree gridGeohash = new GeohashPrefixTree(ctx,10);

  Collection<SpatialStrategy> strategies = new ArrayList<>();
  strategies.add(new RecursivePrefixTreeStrategy(gridGeohash, "recursive_geohash"));
  strategies.add(new TermQueryPrefixTreeStrategy(gridQuad, "termquery_quad"));
  strategies.add(new PointVectorStrategy(ctx, "pointvector"));
  strategies.add(new BBoxStrategy(ctx, "bbox"));
  strategies.add(new SerializedDVStrategy(ctx, "serialized"));
  for (SpatialStrategy strategy : strategies) {
    testEqualsHashcode(strategy);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:17,代码来源:QueryEqualsHashCodeTest.java

示例2: testBadPrefixTreePrune

import org.apache.lucene.spatial.prefix.TermQueryPrefixTreeStrategy; //导入依赖的package包/类
/**
 * A PrefixTree pruning optimization gone bad.
 * See <a href="https://issues.apache.org/jira/browse/LUCENE-4770>LUCENE-4770</a>.
 */
@Test
public void testBadPrefixTreePrune() throws Exception {

  trie = new QuadPrefixTree(ctx, 12);
  TermQueryPrefixTreeStrategy strategy = new TermQueryPrefixTreeStrategy(trie, "geo");
  Document doc = new Document();
  doc.add(new TextField("id", "1", Store.YES));

  Shape area = ctx.makeRectangle(-122.82, -122.78, 48.54, 48.56);

  Field[] fields = strategy.createIndexableFields(area, 0.025);
  for (Field field : fields) {
    doc.add(field);
  }
  addDocument(doc);

  Point upperleft = ctx.makePoint(-122.88, 48.54);
  Point lowerright = ctx.makePoint(-122.82, 48.62);

  Query query = strategy.makeQuery(new SpatialArgs(SpatialOperation.Intersects, ctx.makeRectangle(upperleft, lowerright)));

  commit();

  TopDocs search = indexSearcher.search(query, 10);
  ScoreDoc[] scoreDocs = search.scoreDocs;
  for (ScoreDoc scoreDoc : scoreDocs) {
    System.out.println(indexSearcher.doc(scoreDoc.doc));
  }

  assertEquals(1, search.totalHits);
}
 
开发者ID:europeana,项目名称:search,代码行数:36,代码来源:SpatialPrefixTreeTest.java

示例3: newPrefixTreeStrategy

import org.apache.lucene.spatial.prefix.TermQueryPrefixTreeStrategy; //导入依赖的package包/类
@Override
protected TermQueryPrefixTreeStrategy newPrefixTreeStrategy(String fieldName) {
  return new TermQueryPrefixTreeStrategy(grid,fieldName);
}
 
开发者ID:europeana,项目名称:search,代码行数:5,代码来源:SpatialTermQueryPrefixTreeFieldType.java


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