@Override public void finishStage(ResponseBuilder rb) { if (rb.stage == ResponseBuilder.STAGE_GET_FIELDS) { // We may not have been able to retrieve all the docs due to an // index change. Remove any null documents. for (Iterator<SolrDocument> iter = rb._responseDocs.iterator(); iter.hasNext();) { if (iter.next() == null) { iter.remove(); rb._responseDocs.setNumFound(rb._responseDocs.getNumFound()-1); } } rb.rsp.add("response", rb._responseDocs); } }
String v = parser.getAttributeValue( i ); if( "numFound".equals( n ) ) { docs.setNumFound( Long.parseLong( v ) );
String v = parser.getAttributeValue( i ); if( "numFound".equals( n ) ) { docs.setNumFound( Long.parseLong( v ) );
String v = parser.getAttributeValue( i ); if( "numFound".equals( n ) ) { docs.setNumFound( Long.parseLong( v ) );
public SolrDocumentList readSolrDocumentList(FastInputStream dis) throws IOException { SolrDocumentList solrDocs = new SolrDocumentList(); List list = (List) readVal(dis); solrDocs.setNumFound((Long) list.get(0)); solrDocs.setStart((Long)list.get(1)); solrDocs.setMaxScore((Float)list.get(2)); List l = (List) readVal(dis); solrDocs.addAll(l); return solrDocs; }
public SolrDocumentList readSolrDocumentList(DataInputInputStream dis) throws IOException { SolrDocumentList solrDocs = new SolrDocumentList(); List list = (List) readVal(dis); solrDocs.setNumFound((Long) list.get(0)); solrDocs.setStart((Long) list.get(1)); solrDocs.setMaxScore((Float) list.get(2)); @SuppressWarnings("unchecked") List<SolrDocument> l = (List<SolrDocument>) readVal(dis); solrDocs.addAll(l); return solrDocs; }
public SolrDocumentList readSolrDocumentList(DataInputInputStream dis) throws IOException { SolrDocumentList solrDocs = new SolrDocumentList(); List list = (List) readVal(dis); solrDocs.setNumFound((Long) list.get(0)); solrDocs.setStart((Long) list.get(1)); solrDocs.setMaxScore((Float) list.get(2)); @SuppressWarnings("unchecked") List<SolrDocument> l = (List<SolrDocument>) readVal(dis); solrDocs.addAll(l); return solrDocs; }
public SolrSearchResultDocumentList(SolrDocumentList solrDocs) { if (solrDocs == null) { SolrDocumentList list = new SolrDocumentList(); list.setStart(0L); list.setNumFound(0L); list.setMaxScore(0.0F); this.solrDocs = list; } else { this.solrDocs = solrDocs; } }
list.setNumFound(totalNumFound);
@Override public SolrDocumentList readSolrDocumentList(DataInputInputStream dis) throws IOException { SolrDocumentList solrDocs = new SolrDocumentList(); List list = (List) readVal(dis); solrDocs.setNumFound((Long) list.get(0)); solrDocs.setStart((Long) list.get(1)); solrDocs.setMaxScore((Float) list.get(2)); callback.streamDocListInfo( solrDocs.getNumFound(), solrDocs.getStart(), solrDocs.getMaxScore() ); // Read the Array tagByte = dis.readByte(); if( (tagByte >>> 5) != (ARR >>> 5) ) { throw new RuntimeException( "doclist must have an array" ); } int sz = readSize(dis); for (int i = 0; i < sz; i++) { // must be a SolrDocument readVal( dis ); } return solrDocs; } };) {
results.setNumFound(collectedDocs.keySet().size()); } else { results.setNumFound(resultDocuments.size());
@Override public SolrDocumentList readSolrDocumentList(DataInputInputStream dis) throws IOException { SolrDocumentList solrDocs = new SolrDocumentList(); List list = (List) readVal(dis); solrDocs.setNumFound((Long) list.get(0)); solrDocs.setStart((Long) list.get(1)); solrDocs.setMaxScore((Float) list.get(2)); callback.streamDocListInfo( solrDocs.getNumFound(), solrDocs.getStart(), solrDocs.getMaxScore() ); // Read the Array tagByte = dis.readByte(); if( (tagByte >>> 5) != (ARR >>> 5) ) { throw new RuntimeException( "doclist must have an array" ); } int sz = readSize(dis); for (int i = 0; i < sz; i++) { // must be a SolrDocument readVal( dis ); } return solrDocs; } };
@Override public SolrDocumentList getResults() { SolrDocumentList results = new SolrDocumentList(); for (int i = 0; i < 1000; i++) { results.add(new SolrDocument()); } results.setNumFound(1000); counter++; return results; }
documentList.add(solrDocument); documentList.setNumFound(bitSet.cardinality()); NamedList collapsedGroupResult = getCollapseGroupResult(id, result); collapsedGroupResult.add("collapsedDocs", documentList);
results.setNumFound(numFound); results.setMaxScore(maxScore); results.setStart(start);
results.setNumFound(numFound); results.setMaxScore(maxScore); results.setStart(start);
private void mergeDistributedResultsIntSingleResponse(ResponseBuilder rb, List<AcGroupResult> resultsToMerge, String responseTagName) { int docs = 0; float maxScore = 0.0f; // if groups have to be displayed in some custom order, other than the order specified in // ac_grouping_field_def String groupingSort = rb.req.getParams().get(AC_GROUPING_SORT_PARAM_NAME); if (groupSorts.containsKey(groupingSort)) { groupSorts.get(groupingSort).sort(rb, resultsToMerge); } SolrDocumentList docList = new SolrDocumentList(); // first find count of documents for (AcGroupResult acGroupResult : resultsToMerge) { // if slice contains more results than requested, take requested count; if it contains less results than // requested, we have to take what we got, not more docs += ((acGroupResult.getDistributedResultingDocs().size() > acGroupResult.getAcGroupingFieldValue().getRequestedCountOfSuggestions() == true) ? acGroupResult.getAcGroupingFieldValue().getRequestedCountOfSuggestions() : acGroupResult.getDistributedResultingDocs().size()); if (acGroupResult.getDistributedResultingDocs().getMaxScore() > maxScore) { maxScore = acGroupResult.getDistributedResultingDocs().getMaxScore(); } docList.addAll(acGroupResult.getDistributedResultingDocs()); } docList.setStart(0); docList.setNumFound(docs); rb.rsp.add(responseTagName, docList); }
list.setNumFound(docs.matches()); list.setMaxScore(docs.maxScore()); list.setStart(docs.offset());
list.setNumFound(docs.matches()); list.setMaxScore(docs.maxScore()); list.setStart(docs.offset());
@Test public void testMultipleUpdates() throws Exception { LMSEstimator lmsEstimator = new LMSEstimator(); Filter filter = mock(Filter.class); FullTextExpression fte = new FullTextTerm("foo", "bar", false, false, ""); when(filter.getFullTextConstraint()).thenReturn(fte); SolrDocumentList docs = new SolrDocumentList(); lmsEstimator.update(filter, docs); long actualCount = 10; docs.setNumFound(actualCount); long estimate = lmsEstimator.estimate(filter); assertEquals(estimate, lmsEstimator.estimate(filter)); long diff = actualCount - estimate; // update causes weights adjustment lmsEstimator.update(filter, docs); long estimate2 = lmsEstimator.estimate(filter); assertEquals(estimate2, lmsEstimator.estimate(filter)); long diff2 = actualCount - estimate2; assertTrue(diff2 < diff); // new estimate is more accurate than previous one // update doesn't cause weight adjustments therefore estimates stays unchanged lmsEstimator.update(filter, docs); long estimate3 = lmsEstimator.estimate(filter); assertEquals(estimate3, lmsEstimator.estimate(filter)); long diff3 = actualCount - estimate3; assertTrue(diff3 < diff2); }