mirror of https://github.com/apache/lucene.git
adding some solr query tests.
deprecating setMissing( String ) and replacing it with setFacetMissing( Boolean ) git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@701740 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dbf9fc8683
commit
bd776e916b
|
@ -184,11 +184,18 @@ public class SolrQuery extends ModifiableSolrParams
|
|||
return this.getInt(FacetParams.FACET_MINCOUNT, 1);
|
||||
}
|
||||
|
||||
public SolrQuery setMissing(String fld) {
|
||||
this.set(FacetParams.FACET_MISSING, fld);
|
||||
public SolrQuery setFacetMissing(Boolean v) {
|
||||
this.set(FacetParams.FACET_MISSING, v);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #setFacetMissing(String)}
|
||||
*/
|
||||
public SolrQuery setMissing(String fld) {
|
||||
return setFacetMissing(Boolean.valueOf(fld));
|
||||
}
|
||||
|
||||
/** get facet sort
|
||||
*
|
||||
* @return facet sort or default of true
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package org.apache.solr.client.solrj;
|
||||
|
||||
import org.apache.solr.common.params.FacetParams;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
|
@ -113,5 +115,18 @@ public class SolrQueryTest extends TestCase {
|
|||
assertEquals(10, q.setStart(10).getStart().intValue());
|
||||
assertEquals("foo", q.setQueryType("foo").getQueryType());
|
||||
assertEquals(10, q.setTimeAllowed(10).getTimeAllowed().intValue());
|
||||
|
||||
// non-standard
|
||||
assertEquals("foo", q.setFacetPrefix("foo").get( FacetParams.FACET_PREFIX, null ) );
|
||||
assertEquals("foo", q.setFacetPrefix("a", "foo").getFieldParam( "a", FacetParams.FACET_PREFIX, null ) );
|
||||
|
||||
assertEquals( Boolean.TRUE, q.setMissing(Boolean.TRUE.toString()).getBool( FacetParams.FACET_MISSING ) );
|
||||
assertEquals( Boolean.FALSE, q.setFacetMissing( Boolean.FALSE ).getBool( FacetParams.FACET_MISSING ) );
|
||||
assertEquals( "true", q.setParam( "xxx", true ).getParams( "xxx" )[0] );
|
||||
}
|
||||
|
||||
public void testOrder() {
|
||||
assertEquals( SolrQuery.ORDER.asc, SolrQuery.ORDER.desc.reverse() );
|
||||
assertEquals( SolrQuery.ORDER.desc, SolrQuery.ORDER.asc.reverse() );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue