mirror of https://github.com/apache/lucene.git
SOLR-3793: use livedocs when caching big terms
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1381568 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b87f664ba2
commit
77d5fba68f
|
@ -124,6 +124,12 @@ Bug Fixes
|
|||
|
||||
* SOLR-3668: DataImport : Specifying Custom Parameters (steffkes)
|
||||
|
||||
* SOLR-3793: UnInvertedField faceting cached big terms in the filter
|
||||
cache that ignored deletions, leading to duplicate documents in search
|
||||
later when a filter of the same term was specified.
|
||||
(Günter Hipler, hossman, yonik)
|
||||
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -125,11 +125,12 @@ public class UnInvertedField extends DocTermOrds {
|
|||
if (deState == null) {
|
||||
deState = new SolrIndexSearcher.DocsEnumState();
|
||||
deState.fieldName = field;
|
||||
// deState.termsEnum = te.tenum;
|
||||
deState.liveDocs = searcher.getAtomicReader().getLiveDocs();
|
||||
deState.termsEnum = te; // TODO: check for MultiTermsEnum in SolrIndexSearcher could now fail?
|
||||
deState.docsEnum = docsEnum;
|
||||
deState.minSetSizeCached = maxTermDocFreq;
|
||||
}
|
||||
|
||||
docsEnum = deState.docsEnum;
|
||||
DocSet set = searcher.getDocSet(deState);
|
||||
maxTermCounts[termNum] = set.size();
|
||||
|
|
|
@ -83,27 +83,39 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
|
|||
add_doc("id", "42",
|
||||
"range_facet_f", "35.3",
|
||||
"trait_s", "Tool", "trait_s", "Obnoxious",
|
||||
"name", "Zapp Brannigan");
|
||||
"name", "Zapp Brannigan",
|
||||
"foo_s","A", "foo_s","B"
|
||||
);
|
||||
add_doc("id", "43" ,
|
||||
"range_facet_f", "28.789",
|
||||
"title", "Democratic Order of Planets");
|
||||
"title", "Democratic Order of Planets",
|
||||
"foo_s","A", "foo_s","B"
|
||||
);
|
||||
add_doc("id", "44",
|
||||
"range_facet_f", "15.97",
|
||||
"trait_s", "Tool",
|
||||
"name", "The Zapper");
|
||||
"name", "The Zapper",
|
||||
"foo_s","A", "foo_s","B", "foo_s","C"
|
||||
);
|
||||
add_doc("id", "45",
|
||||
"range_facet_f", "30.0",
|
||||
"trait_s", "Chauvinist",
|
||||
"title", "25 star General");
|
||||
"title", "25 star General",
|
||||
"foo_s","A", "foo_s","B"
|
||||
);
|
||||
add_doc("id", "46",
|
||||
"range_facet_f", "20.0",
|
||||
"trait_s", "Obnoxious",
|
||||
"subject", "Defeated the pacifists of the Gandhi nebula");
|
||||
"subject", "Defeated the pacifists of the Gandhi nebula",
|
||||
"foo_s","A", "foo_s","B"
|
||||
);
|
||||
add_doc("id", "47",
|
||||
"range_facet_f", "28.62",
|
||||
"trait_s", "Pig",
|
||||
"text", "line up and fly directly at the enemy death cannons, clogging them with wreckage!",
|
||||
"zerolen_s","");
|
||||
"zerolen_s","",
|
||||
"foo_s","A", "foo_s","B", "foo_s","C"
|
||||
);
|
||||
}
|
||||
|
||||
static void indexSimpleGroupedFacetCounts() {
|
||||
|
@ -114,6 +126,28 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
|
|||
add_doc("id", "2004", "hotel_s1", "b", "airport_s1", "ams", "duration_i1", "5");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCachingBigTerms() throws Exception {
|
||||
assertQ( req("indent","true", "q", "id:[42 TO 47]",
|
||||
"facet", "true",
|
||||
"facet.field", "foo_s" // big terms should cause foo_s:A to be cached
|
||||
),
|
||||
"*[count(//doc)=6]"
|
||||
);
|
||||
|
||||
// now use the cached term as a filter to make sure deleted docs are accounted for
|
||||
assertQ( req("indent","true", "fl","id", "q", "foo_s:B",
|
||||
"facet", "true",
|
||||
"facet.field", "foo_s",
|
||||
"fq","foo_s:A"
|
||||
),
|
||||
"*[count(//doc)=6]"
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSimpleGroupedQueryRangeFacets() throws Exception {
|
||||
assertQ(
|
||||
|
|
Loading…
Reference in New Issue