SOLR-5624: check for elevated documents in hashCode()

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1567640 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Joel Bernstein 2014-02-12 15:09:24 +00:00
parent 531d3a5744
commit 9e2995ee01
1 changed files with 14 additions and 0 deletions

View File

@ -153,6 +153,20 @@ public class CollapsingQParserPlugin extends QParserPlugin {
}
public int hashCode() {
/*
* Checking for boosted here because the request context will not have the elevated docs
* until after the query is constructed. So to be sure there are no elevated docs in the query
* while checking the cache we must check the request context during the call to hashCode().
*/
if(this.boosted == null) {
SolrRequestInfo info = SolrRequestInfo.getRequestInfo();
if(info != null) {
this.boosted = (Set<String>)info.getReq().getContext().get(QueryElevationComponent.BOOSTED);
}
}
int hashCode = field.hashCode();
hashCode = max!=null ? hashCode+max.hashCode():hashCode;
hashCode = min!=null ? hashCode+min.hashCode():hashCode;