2014-11-22 42 views
0
public FacetPage<SolrArticleDocument> facetSearch(String searchTerm, Pageable page) { 
    SimpleFacetQuery facetQuery = new SimpleFacetQuery(new SimpleStringCriteria(searchTerm)); 
    Sort sort = new Sort(Direction.DESC,"trendingCount"); 
    facetQuery.addSort(sort); 
    FacetOptions options = new FacetOptions(); 
    options.addFacetOnFlieldnames(getFacetFields()); 
    facetQuery.setFacetOptions(options); 
    facetQuery.setPageRequest(page); 
    return cmsTemplate.queryForFacetPage(facetQuery, SolrArticleDocument.class); 
} 

使用上面的方法,只返回10條記錄,但有望走出回報是所有記錄..Solr的搜索中使用的方法queryForFacetPage只有10條記錄返回

回答

0

我猜你正在使用Spring數據Solr的框架從你的方法名稱。在這裏,您可以set the facet.limit option through setFacetLimit,默認爲10.這設置每個方面返回的條款數。您可以將該值設置爲負值以返回所有條款,但是如果您需要一定數量的條款 - 請使用特定值,以便Lucene可以儘可能縮短構建構面。

0
facetQuery.setRows(999); // or any other big number =/ 

不如你所期望的那麼好,但它確實有效。