本文整理匯總了Java中org.apache.lucene.search.SortField.DOUBLE屬性的典型用法代碼示例。如果您正苦於以下問題:Java SortField.DOUBLE屬性的具體用法?Java SortField.DOUBLE怎麽用?Java SortField.DOUBLE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.lucene.search.SortField
的用法示例。
在下文中一共展示了SortField.DOUBLE屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: extractProducts
public Map<Integer , List<Products>> extractProducts( String id , int page ) {
FullTextEntityManager fullTextEntityManager = org.hibernate.search.jpa.Search.getFullTextEntityManager(
em );
QueryBuilder queryBuilder = fullTextEntityManager.getSearchFactory().buildQueryBuilder().forEntity(
Products.class ).get();
org.apache.lucene.search.Query query = queryBuilder.keyword().onField( "category.id" ).matching(
id ).createQuery();
FullTextQuery fullTextQuery = fullTextEntityManager.createFullTextQuery( query ,
Products.class );
Sort sort = new Sort( new SortField( "price" , SortField.DOUBLE ) );
fullTextQuery.setSort( sort );
//fullTextQuery.initializeObjectsWith(ObjectLookupMethod.SKIP, DatabaseRetrievalMethod.FIND_BY_ID);
fullTextQuery.setFirstResult( page * 3 );
fullTextQuery.setMaxResults( 3 );
List<Products> results = fullTextQuery.getResultList();
Map<Integer , List<Products>> results_and_total = new HashMap<Integer , List<Products>>();
results_and_total.put( fullTextQuery.getResultSize() , results );
return results_and_total;
}
示例2: extractPromotionalProducts
public List<Products> extractPromotionalProducts() {
FullTextEntityManager fullTextEntityManager = org.hibernate.search.jpa.Search.getFullTextEntityManager(
em );
org.apache.lucene.search.Query query = NumericRangeQuery.newDoubleRange( "old_price" , 0.0d ,
1000d , false ,
true );
FullTextQuery fullTextQuery = fullTextEntityManager.createFullTextQuery( query ,
Products.class );
Sort sort = new Sort( new SortField( "price" , SortField.DOUBLE ) );
fullTextQuery.setSort( sort );
//fullTextQuery.initializeObjectsWith(ObjectLookupMethod.SKIP, DatabaseRetrievalMethod.FIND_BY_ID);
List results = fullTextQuery.getResultList();
return results;
}