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


Java QueryResultKey类代码示例

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


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

示例1: testFiltersOutOfOrder1

import org.apache.solr.search.QueryResultKey; //导入依赖的package包/类
public void testFiltersOutOfOrder1() {
  // the hashcode should be the same even when the list
  // of filters is in a different order
  
  Sort sort = new Sort(new SortField("test", SortField.Type.BYTE));
  BooleanQuery query = new BooleanQuery();
  query.add(new TermQuery(new Term("test", "field")), Occur.MUST);
  
  List<Query> filters = Arrays.<Query>asList(new TermQuery(new Term("test", "field")),
                                             new TermQuery(new Term("test2", "field2")));
  QueryResultKey qrk1 = new QueryResultKey(query , filters, sort, 1);
  
  List<Query> filters2 = Arrays.<Query>asList(new TermQuery(new Term("test2", "field2")),
                                              new TermQuery(new Term("test", "field")));
  QueryResultKey qrk2 = new QueryResultKey(query , filters2, sort, 1);
  assertKeyEquals(qrk1, qrk2);
}
 
开发者ID:europeana,项目名称:search,代码行数:18,代码来源:QueryResultKeyTest.java

示例2: testFiltersHashCode

import org.apache.solr.search.QueryResultKey; //导入依赖的package包/类
@Test
public void testFiltersHashCode() {
  // the hashcode should be the same even when the list
  // of filters is in a different order
  
  Sort sort = new Sort(new SortField("test", SortField.Type.BYTE));
  List<Query> filters = new ArrayList<Query>();
  filters.add(new TermQuery(new Term("test", "field")));
  filters.add(new TermQuery(new Term("test2", "field2")));
  
  BooleanQuery query = new BooleanQuery();
  query.add(new TermQuery(new Term("test", "field")), Occur.MUST);
  
  QueryResultKey qrk1 = new QueryResultKey(query , filters, sort, 1);
  
  List<Query> filters2 = new ArrayList<Query>();
  filters2.add(new TermQuery(new Term("test2", "field2")));
  filters2.add(new TermQuery(new Term("test", "field")));
  QueryResultKey qrk2 = new QueryResultKey(query , filters2, sort, 1);
  
  assertEquals(qrk1.hashCode(), qrk2.hashCode());
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:23,代码来源:QueryResultKeyTest.java

示例3: testFiltersOutOfOrder2

import org.apache.solr.search.QueryResultKey; //导入依赖的package包/类
@Test
public void testFiltersOutOfOrder2() {
  Query fq1 = new TermQuery(new Term("test1", "field1"));
  Query fq2 = new TermQuery(new Term("test2", "field2"));

  Query query = new TermQuery(new Term("test3", "field3"));
  List<Query> filters = Arrays.asList(fq1, fq2);

  QueryResultKey key = new QueryResultKey(query, filters, null, 0);

  List<Query> newFilters = Arrays.asList(fq2, fq1);
  QueryResultKey newKey = new QueryResultKey(query, newFilters, null, 0);

  assertKeyEquals(key, newKey);
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:QueryResultKeyTest.java

示例4: testQueryResultKeyUnSortedFiltersWithDups

import org.apache.solr.search.QueryResultKey; //导入依赖的package包/类
public void testQueryResultKeyUnSortedFiltersWithDups() {
  Query query = new TermQuery(new Term("main", "val"));

  // we need Query clauses that have identical hashCodes 
  // but are not equal unless the term is equals
  Query fq_aa = new FlatHashTermQuery("fq_a");
  Query fq_ab = new FlatHashTermQuery("fq_a");
  Query fq_ac = new FlatHashTermQuery("fq_a");
  Query fq_zz = new FlatHashTermQuery("fq_z");

  assertEquals(fq_aa.hashCode(), fq_ab.hashCode());
  assertEquals(fq_aa.hashCode(), fq_ac.hashCode());
  assertEquals(fq_aa.hashCode(), fq_zz.hashCode());

  assertEquals(fq_aa, fq_ab);
  assertEquals(fq_aa, fq_ac);
  assertEquals(fq_ab, fq_aa);
  assertEquals(fq_ab, fq_ac);
  assertEquals(fq_ac, fq_aa);
  assertEquals(fq_ac, fq_ab);

  assertTrue( ! fq_aa.equals(fq_zz) );
  assertTrue( ! fq_ab.equals(fq_zz) );
  assertTrue( ! fq_ac.equals(fq_zz) );
  assertTrue( ! fq_zz.equals(fq_aa) );
  assertTrue( ! fq_zz.equals(fq_ab) );
  assertTrue( ! fq_zz.equals(fq_ac) );

  List<Query> filters1 = Arrays.asList(fq_aa, fq_ab);
  List<Query> filters2 = Arrays.asList(fq_zz, fq_ac);

  QueryResultKey key1 = new QueryResultKey(query, filters1, null, 0);
  QueryResultKey key2 = new QueryResultKey(query, filters2, null, 0);
  
  assertEquals(key1.hashCode(), key2.hashCode());

  assertKeyNotEquals(key1, key2);
}
 
开发者ID:europeana,项目名称:search,代码行数:39,代码来源:QueryResultKeyTest.java

示例5: assertKeyEquals

import org.apache.solr.search.QueryResultKey; //导入依赖的package包/类
/**
 * does bi-directional equality check as well as verifying hashCode
 */
public void assertKeyEquals(QueryResultKey key1, QueryResultKey key2) {
  assertNotNull(key1);
  assertNotNull(key2);
  assertEquals(key1.hashCode(), key2.hashCode());
  assertEquals(key1, key2);
  assertEquals(key2, key1);
}
 
开发者ID:europeana,项目名称:search,代码行数:11,代码来源:QueryResultKeyTest.java

示例6: assertKeyNotEquals

import org.apache.solr.search.QueryResultKey; //导入依赖的package包/类
/**
 * does bi-directional check that the keys are <em>not</em> equals
 */
public void assertKeyNotEquals(QueryResultKey key1, QueryResultKey key2) {
  assertTrue( ! key1.equals(key2) );
  assertTrue( ! key2.equals(key1) );
}
 
开发者ID:europeana,项目名称:search,代码行数:8,代码来源:QueryResultKeyTest.java


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