public DelegatingCollector getFilterCollector(IndexSearcher indexSearcher) { try { SolrIndexSearcher searcher = (SolrIndexSearcher) indexSearcher; SortedDocValues docValues = null; FunctionQuery funcQuery = null; docValues = DocValues.getSorted(searcher.getLeafReader(), this.field); FieldType fieldType = null; if (this.max != null) { if (this.max.indexOf("(") == -1) { fieldType = searcher.getSchema().getField(this.max).getType(); } else { LocalSolrQueryRequest request = null; try { SolrParams params = new ModifiableSolrParams(); request = new LocalSolrQueryRequest(searcher.getCore(), params); FunctionQParser functionQParser = new FunctionQParser(this.max, null, null, request); funcQuery = (FunctionQuery) functionQParser.parse(); } catch (Exception e) { throw new IOException(e); } finally { request.close(); } } } if (this.min != null) { if (this.min.indexOf("(") == -1) { fieldType = searcher.getSchema().getField(this.min).getType(); } else { LocalSolrQueryRequest request = null; try { SolrParams params = new ModifiableSolrParams(); request = new LocalSolrQueryRequest(searcher.getCore(), params); FunctionQParser functionQParser = new FunctionQParser(this.min, null, null, request); funcQuery = (FunctionQuery) functionQParser.parse(); } catch (Exception e) { throw new IOException(e); } finally { request.close(); } } } int maxDoc = searcher.maxDoc(); int leafCount = searcher.getTopReaderContext().leaves().size(); // Deal with boosted docs. // We have to deal with it here rather then the constructor because // because the QueryElevationComponent runs after the Queries are constructed. IntIntOpenHashMap boostDocs = null; Map context = null; SolrRequestInfo info = SolrRequestInfo.getRequestInfo(); if (info != null) { context = info.getReq().getContext(); } if (this.boosted == null && context != null) { this.boosted = (Map<BytesRef, Integer>) context.get(QueryElevationComponent.BOOSTED_PRIORITY); } boostDocs = getBoostDocs(searcher, this.boosted, context); if (this.min != null || this.max != null) { return new CollapsingFieldValueCollector( maxDoc, leafCount, docValues, this.nullPolicy, max != null ? this.max : this.min, max != null, this.needsScores, fieldType, boostDocs, funcQuery, searcher); } else { return new CollapsingScoreCollector( maxDoc, leafCount, docValues, this.nullPolicy, boostDocs); } } catch (Exception e) { throw new RuntimeException(e); } }