本文整理汇总了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;
}