當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。