mirror of https://github.com/apache/lucene.git
SOLR-1825: SolrQuery.addFacetQuery now enables facets automatically
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1144564 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
038a555aef
commit
5c2923a1de
|
@ -260,6 +260,9 @@ Other Changes
|
|||
|
||||
* SOLR-2027: FacetField.getValues() now returns an empty list if there are no
|
||||
values, instead of null (Chris Male)
|
||||
|
||||
* SOLR-1825: SolrQuery.addFacetQuery now enables facets automatically, like
|
||||
addFacetField (Chris Male)
|
||||
|
||||
Documentation
|
||||
----------------------
|
||||
|
|
|
@ -292,6 +292,7 @@ public class SolrQuery extends ModifiableSolrParams
|
|||
*/
|
||||
public SolrQuery addFacetQuery(String f) {
|
||||
this.add(FacetParams.FACET_QUERY, f);
|
||||
this.set(FacetParams.FACET, true);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -195,4 +195,10 @@ public class SolrQueryTest extends LuceneTestCase {
|
|||
q.setTermsRegexFlag("multiline");
|
||||
assertEquals(2, q.getTermsRegexFlags().length);
|
||||
}
|
||||
|
||||
public void testAddFacetQuery() {
|
||||
SolrQuery solrQuery = new SolrQuery();
|
||||
solrQuery.addFacetQuery("field:value");
|
||||
assertTrue("Adding a Facet Query should enable facets", solrQuery.getBool(FacetParams.FACET));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue