mirror of https://github.com/apache/lucene.git
in facet refinement, skip over facet queries that don't look like refinements. add test that exercizes refinements.
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@670028 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0150aeaf61
commit
8557aa1fde
|
@ -40,7 +40,7 @@ import org.apache.lucene.queryParser.ParseException;
|
|||
* @version $Id$
|
||||
* @since solr 1.3
|
||||
*/
|
||||
public class FacetComponent extends SearchComponent
|
||||
public class FacetComponent extends SearchComponent
|
||||
{
|
||||
public static final String COMPONENT_NAME = "facet";
|
||||
|
||||
|
@ -167,7 +167,7 @@ public class FacetComponent extends SearchComponent
|
|||
dff.initialLimit = dff.limit;
|
||||
}
|
||||
|
||||
// Uncomment the following line when testing to supress over-requesting facets and
|
||||
// TEST: Uncomment the following line when testing to supress over-requesting facets and
|
||||
// thus cause more facet refinement queries.
|
||||
// if (dff.limit > 0) dff.initialLimit = dff.offset + dff.limit;
|
||||
|
||||
|
@ -300,13 +300,24 @@ public class FacetComponent extends SearchComponent
|
|||
|
||||
// expect {!field f=field}value style params
|
||||
SolrParams qparams = QueryParsing.getLocalParams(facet_q,null);
|
||||
if (qparams == null) continue; // not a refinement
|
||||
String field = qparams.get(QueryParsing.F);
|
||||
String val = qparams.get(QueryParsing.V);
|
||||
|
||||
// Find the right field.facet for this field
|
||||
DistribFieldFacet dff = fi.topFacets.get(field);
|
||||
if (dff == null) continue; // maybe this wasn't for facet count refinement
|
||||
|
||||
// Find the right constraint count for this value
|
||||
ShardFacetCount sfc = dff.counts.get(val);
|
||||
|
||||
if (sfc == null) {
|
||||
continue;
|
||||
// Just continue, since other components might have added
|
||||
// this facet.query for other purposes. But if there are charset
|
||||
// issues then the values coming back may not match the values sent.
|
||||
}
|
||||
|
||||
// TODO REMOVE
|
||||
// System.out.println("Got " + facet_q + " , refining count: " + sfc + " += " + count);
|
||||
|
||||
|
|
|
@ -487,10 +487,15 @@ public class TestDistributedSearch extends TestCase {
|
|||
"debugQuery", "true");
|
||||
|
||||
query("q","*:*", "rows",100, "facet","true", "facet.field",t1);
|
||||
query("q","*:*", "rows",100, "facet","true", "facet.field",t1,"facet.limit",1);
|
||||
query("q","*:*", "rows",100, "facet","true", "facet.query","quick", "facet.query","all", "facet.query","*:*");
|
||||
query("q","*:*", "rows",100, "facet","true", "facet.field",t1, "facet.offset",1);
|
||||
query("q","*:*", "rows",100, "facet","true", "facet.field",t1, "facet.mincount",2);
|
||||
|
||||
// test faceting multiple things at once
|
||||
query("q","*:*", "rows",100, "facet","true", "facet.query","quick", "facet.query","all", "facet.query","*:*"
|
||||
,"facet.field",t1);
|
||||
|
||||
// test field that is valid in schema but missing in all shards
|
||||
query("q","*:*", "rows",100, "facet","true", "facet.field",missingField, "facet.mincount",2);
|
||||
// test field that is valid in schema and missing in some shards
|
||||
|
|
Loading…
Reference in New Issue