Java Code Examples for org.apache.solr.handler.component.ResponseBuilder

The following examples show how to use org.apache.solr.handler.component.ResponseBuilder. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * Update the returned facet sections to reference ACS properties rather than Solr fields.
 *
 * @param rb the response builder.
 * @param mappingName The name of the mapping definition created in {@link RewriteFacetParametersComponent}.
 * @param sections The names of the sections to be updated.
 */
private void rewrite(ResponseBuilder rb, String mappingName, String ... sections)
{
    BiMap<String, String> mappings = (BiMap<String, String>) rb.rsp.getValues().get(mappingName);
    if(mappings != null)
    {
        NamedList<Object>  found = (NamedList<Object>) rb.rsp.getValues();
        for (String section : sections)
        {
            found = (NamedList<Object>) found.get(section);
            if (found == null)
            {
                return;
            }
        }
        // This found already contains the private buckets
        updateToACSNaming(mappings, found);
    }
}
 
Example 2
Source Project: BioSolr   Source File: FacetTreeGenerator.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Get a reference to the searcher for the required collection. If the collection is
 * not the same as the search collection, we assume it is under the same Solr instance.
 * @param rb the response builder holding the facets.
 * @return a counted reference to the searcher.
 * @throws SolrException if the collection cannot be found.
 */
private RefCounted<SolrIndexSearcher> getSearcherReference(ResponseBuilder rb) throws SolrException {
	RefCounted<SolrIndexSearcher> searcherRef;
	
	SolrCore currentCore = rb.req.getCore();
	if (StringUtils.isBlank(collection)) {
		searcherRef = currentCore.getSearcher();
	} else {
		// Using an alternative core - find it
		SolrCore reqCore = currentCore.getCoreDescriptor().getCoreContainer().getCore(collection);
		if (reqCore == null) {
			throw new SolrException(ErrorCode.BAD_REQUEST, "Collection \"" + collection
					+ "\" cannot be found");
		}
		searcherRef = reqCore.getSearcher();
	}
	
	return searcherRef;
}
 
Example 3
Source Project: ranger   Source File: RangerSolrAuthorizer.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void prepare(ResponseBuilder responseBuilder) throws IOException {

	if(LOG.isDebugEnabled()) {
		LOG.debug("==> RangerSolrAuthorizer.prepare()");
	}

	try {
		activatePluginClassLoader();

		rangerSearchComponentImpl.prepare(responseBuilder);
	} finally {
		deactivatePluginClassLoader();
	}

	if(LOG.isDebugEnabled()) {
		LOG.debug("<== RangerSolrAuthorizer.prepare()");
	}
}
 
Example 4
Source Project: BioSolr   Source File: FacetTreeGenerator.java    License: Apache License 2.0 6 votes vote down vote up
public List<SimpleOrderedMap<Object>> generateTree(ResponseBuilder rb, NamedList<Integer> facetValues) throws IOException {
	List<SimpleOrderedMap<Object>> retVal = null;
	
	// First get the searcher for the required collection
	RefCounted<SolrIndexSearcher> searcherRef = getSearcherReference(rb);
	
	try {
		// Build the facet tree(s)
		Collection<TreeFacetField> fTrees = treeBuilder.processFacetTree(searcherRef.get(), extractFacetValues(facetValues));
		LOGGER.debug("Extracted {} facet trees", fTrees.size());
		
		if (pruner != null) {
			// Prune the trees
			fTrees = pruner.prune(fTrees);
		}

		// Convert the trees into a SimpleOrderedMap
		retVal = convertTreeFacetFields(fTrees);
	} finally {
		// Make sure the search ref count is decreased
		searcherRef.decref();
	}
	
	return retVal;
}
 
Example 5
Source Project: querqy   Source File: QuerqyQueryComponent.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void process(final ResponseBuilder rb) throws IOException {
    
    super.process(rb);
    
    QParser parser = rb.getQparser();
    
    if (parser instanceof QuerqyDismaxQParser) {

        final SearchEngineRequestAdapter searchEngineRequestAdapter =
                ((QuerqyDismaxQParser) parser).getSearchEngineRequestAdapter();

        final Map<String, Object> context = searchEngineRequestAdapter.getContext();
        if (context != null) {

            @SuppressWarnings("unchecked")
            Set<Object> decorations = (Set<Object>) context.get(DecorateInstruction.CONTEXT_KEY);
            if (decorations != null) {
                rb.rsp.add("querqy_decorations", decorations);
            }
        }

        searchEngineRequestAdapter.getInfoLoggingContext().ifPresent(InfoLoggingContext::endOfRequest);
    }

}
 
Example 6
@Override
public void prepare(ResponseBuilder rb) throws IOException
{
    SolrQueryRequest req = rb.req;
    SolrParams params = req.getParams();

    ModifiableSolrParams fixed = new ModifiableSolrParams();
    ModifiableSolrParams allParamsWithFix = new ModifiableSolrParams(params);
    fixFilterQueries(fixed, params, rb);
    fixFacetParams(fixed, params, rb);
    fixRows(fixed, params, rb);
    
    Set<String> fixedParameterNames = fixed.getParameterNames();
    for (String fixedParam : fixedParameterNames)
    {
        allParamsWithFix.set(fixedParam, fixed.getParams(fixedParam));
    }

    if (allParamsWithFix.get(CommonParams.SORT) != null)
    {
        allParamsWithFix.remove(CommonParams.RQ);
    }
    
    req.setParams(allParamsWithFix);
}
 
Example 7
public void doProcess(ResponseBuilder rb) {
  ReSearcherRequestContext ctx = new ReSearcherRequestContext(rb);
  ctx.setCore(getCore());
  ctx.setQueryOnlyComponents(getQueryOnlyComponents());
  ctx.setShardHandlerFactory(getShardHandlerFactory());
  
  try {
    doProcess(ctx, rb);
  } catch (Exception e) {
    String msg = "ReSearcher error";
    LOG.error(msg, e);
    throw new RuntimeException(msg, e);
  }

  ctx.restoreContext(rb);
}
 
Example 8
Source Project: mtas   Source File: MtasSolrComponentPrefix.java    License: Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public void finishStage(ResponseBuilder rb) {
  if (rb.req.getParams().getBool(MtasSolrSearchComponent.PARAM_MTAS, false)
      && rb.stage >= ResponseBuilder.STAGE_EXECUTE_QUERY
      && rb.stage < ResponseBuilder.STAGE_GET_FIELDS) {
    for (ShardRequest sreq : rb.finished) {
      if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)
          && sreq.params.getBool(PARAM_MTAS_PREFIX, false)) {
        for (ShardResponse shardResponse : sreq.responses) {
          NamedList<Object> response = shardResponse.getSolrResponse()
              .getResponse();
          try {
            ArrayList<NamedList<Object>> data = (ArrayList<NamedList<Object>>) response
                .findRecursive("mtas", NAME);
            if (data != null) {
              MtasSolrResultUtil.decode(data);
            }
          } catch (ClassCastException e) {
            log.debug(e);
            // shouldnt happen
          }
        }
      }
    }
  }
}
 
Example 9
Source Project: lucene-solr   Source File: DelayingSearchComponent.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void process(ResponseBuilder rb) throws IOException {
  final long totalSleepMillis = rb.req.getParams().getLong("sleep",0);
  if (totalSleepMillis > 0) {
    final long totalSleepNanos = TimeUnit.NANOSECONDS.convert(totalSleepMillis, TimeUnit.MILLISECONDS);
    final long startNanos = System.nanoTime();
    try {
      // Thread.sleep() (and derivatives) are not garunteed to sleep the full amount:
      //   "subject to the precision and accuracy of system timers and schedulers."
      // This is particularly problematic on Windows VMs, so we do a retry loop
      // to ensure we sleep a total of at least as long as requested
      //
      // (Tests using this component do so explicitly to ensure 'timeAllowed'
      // has exceeded in order to get their expected results, we would rather over-sleep
      // then under sleep)
      for (long sleepNanos = totalSleepNanos;
           0 < sleepNanos;
           sleepNanos = totalSleepNanos - (System.nanoTime() - startNanos)) {
        TimeUnit.NANOSECONDS.sleep(sleepNanos);
      }
    } catch (InterruptedException e) {
      // Do nothing?
    }
  }
}
 
Example 10
Source Project: mtas   Source File: MtasSolrComponentKwic.java    License: Apache License 2.0 5 votes vote down vote up
public void finishStage(ResponseBuilder rb) {
  if (rb.req.getParams().getBool(MtasSolrSearchComponent.PARAM_MTAS, false)
      && rb.stage >= ResponseBuilder.STAGE_EXECUTE_QUERY
      && rb.stage < ResponseBuilder.STAGE_GET_FIELDS) {
    for (ShardRequest sreq : rb.finished) {
      if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)
          && sreq.params.getBool(PARAM_MTAS_KWIC, false)) {
        // nothing to do
      }
    }
  }
}
 
Example 11
Source Project: wiseowl   Source File: PassageRankingComponent.java    License: MIT License 5 votes vote down vote up
@Override
public void prepare(ResponseBuilder rb) throws IOException {
  SolrParams params = rb.req.getParams();
  if (!params.getBool(COMPONENT_NAME, false)) {
    return;
  }


}
 
Example 12
/**
 * @param rb
 * @param mappings 
 * @param group 
 */
public MimetypeGroupingCollector(ResponseBuilder rb, HashMap<String, String> mappings, boolean doGroup)
{
    this.rb = rb;
    this.mappings = mappings;
    this.doGroup = doGroup;
    schemaFieldName = AlfrescoSolrDataModel.getInstance().mapProperty("content.mimetype", FieldUse.FACET, rb.req);
    schemaField = rb.req.getSchema().getFieldOrNull(schemaFieldName);
}
 
Example 13
Source Project: lucene-solr   Source File: FacetModule.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void handleResponses(ResponseBuilder rb, ShardRequest sreq) {
  FacetComponentState facetState = getFacetComponentState(rb);
  if (facetState == null) return;

  for (ShardResponse shardRsp : sreq.responses) {
    SolrResponse rsp = shardRsp.getSolrResponse();
    NamedList<Object> top = rsp.getResponse();
    if (top == null) continue; // shards.tolerant=true will cause this to happen on exceptions/errors
    Object facet = top.get("facets");
    if (facet == null) {
      @SuppressWarnings("rawtypes") SimpleOrderedMap shardResponseHeader = (SimpleOrderedMap) rsp.getResponse().get("responseHeader");
      if (Boolean.TRUE.equals(shardResponseHeader.getBooleanArg(SolrQueryResponse.RESPONSE_HEADER_PARTIAL_RESULTS_KEY))) {
        rb.rsp.getResponseHeader().asShallowMap().put(SolrQueryResponse.RESPONSE_HEADER_PARTIAL_RESULTS_KEY, Boolean.TRUE);
      }
      continue;
    }
    if (facetState.merger == null) {
      facetState.merger = facetState.facetRequest.createFacetMerger(facet);
      facetState.mcontext = new FacetMerger.Context(sreq.responses.size());
    }

    if ((sreq.purpose & PURPOSE_REFINE_JSON_FACETS) != 0) {
      // System.err.println("REFINE FACET RESULT FROM SHARD = " + facet);
      // call merge again with a diff flag set on the context???
      facetState.mcontext.root = facet;
      facetState.mcontext.setShard(shardRsp.getShard());  // TODO: roll newShard into setShard?
      facetState.merger.merge(facet, facetState.mcontext);
      return;
    }

    // System.err.println("MERGING FACET RESULT FROM SHARD = " + facet);
    facetState.mcontext.root = facet;
    facetState.mcontext.newShard(shardRsp.getShard());
    facetState.merger.merge(facet, facetState.mcontext);
  }
}
 
Example 14
@SuppressWarnings("unchecked")
protected void performHighlighting(ReSearcherRequestContext ctx, ResponseBuilder rb) {
  // check if highlighting is needed
  SolrParams params = rb.req.getParams();
  String highlightRemoved = params.get(RES_HIGHLIGHT_REMOVED_TAG_PARAM_NAME);
  String highlightReplaced = params.get(RES_HIGHLIGHT_REPLACED_TAG_PARAM_NAME);
  boolean ignoreQuotes = params.get(RES_HIGHLIGHT_IGNORE_QUOTES_PARAM_NAME, "true").equals("true") ? true : false;

  if (highlightRemoved == null && highlightReplaced == null) {
    // nothing to do, so just return;
    return;
  }

  // else, fetch suggestions produced by the component and perform highlighting
  List<String> sugs = (List<String>) rb.rsp.getValues().get(getSuggestionsTagName());
  if (sugs == null) {
    // if component didn't generate suggestions, there is nothing to highlight
    return;
  }

  List<String> sugsHighlighted = new ArrayList<String>();

  for (String sug : sugs) {
    sugsHighlighted.add(CorrectionHighlighter.highlightCorrections(ctx.getOriginalQueryString(), sug,
        highlightRemoved, highlightReplaced, ignoreQuotes));
  }

  rb.rsp.getValues().add(getSuggestionsTagName() + "_highlighted", sugsHighlighted);
}
 
Example 15
@Override
public void finishStage(ResponseBuilder rb)
{
    super.finishStage(rb);
    if (rb.stage != ResponseBuilder.STAGE_GET_FIELDS)
        return;
    try
    {
        log(rb);
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
}
 
Example 16
Source Project: BioSolr   Source File: FacetTreeProcessorTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void process_noFacetTreeParams() throws Exception {
	// Cannot mock local variable in ResponseBuilder...
	ResponseBuilder rb = new ResponseBuilder(null, null, null);
	rb.doFacets = true;
	
	SolrQueryRequest req = mock(SolrQueryRequest.class);
	FacetTreeParameters ftParams = mock(FacetTreeParameters.class);
	
	HierarchicalFacets ftp = new HierarchicalFacets(req, null, null, rb, ftParams);
	assertNull(ftp.process(null));
}
 
Example 17
Source Project: chronix.server   Source File: SolrFacetService.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @param req          the solr query request
 * @param rsp          the solr query response
 * @param matchingDocs the set of matching documents
 * @param solrParams   the solr request params
 * @return pivot processor
 */
PivotFacetProcessor pivotFacetProcessor(SolrQueryRequest req,
                                        SolrQueryResponse rsp,
                                        DocSet matchingDocs,
                                        SolrParams solrParams) {
    ResponseBuilder rb = new ResponseBuilder(req, rsp, emptyList());
    rb.doFacets = true;
    return new PivotFacetProcessor(req, matchingDocs, solrParams, rb);
}
 
Example 18
Source Project: solr-researcher   Source File: DymReSearcher.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
private Set<String> createSuggestions(ResponseBuilder rb, NamedList suggestions,
    SuggestionsFoundRatioCalculator ratioCalc, int spellcheckCount, long originalQueryHits, Float highestRatio) {
  SuggestionRatioProcessor ratioCalcProcessor = new SuggestionRatioProcessor(originalQueryHits, spellcheckCount,
      ratioCalc, highestRatio);
  ReSearcherUtils.iterateOverSpellcheckerSuggestionsForAllIncorrectWords(suggestions, ratioCalcProcessor);

  Set<String> newSuggestions = null;

  if (ratioCalcProcessor.getSuggestionWithHighestRatio() != null) {
    CreateNewSuggestionsProcessor newSuggestionsProcessor = new CreateNewSuggestionsProcessor(rb.getQueryString(),
        ratioCalcProcessor.getSuggestionWithHighestRatio());
    ReSearcherUtils.iterateOverSpellcheckerSuggestionsForWord(ratioCalcProcessor.getSuggestionWithHighestRatio(),
        newSuggestionsProcessor);
    newSuggestions = newSuggestionsProcessor.getNewSuggestions();
  }

  if (ignoreCollation == false) {
    //newSuggestions.add((String) suggestions.get("collation"));
      if (rb.rsp.getValues().get("spellcheck") != null) {
          if (((SimpleOrderedMap) rb.rsp.getValues().get("spellcheck")).get("collations") != null) {
              newSuggestions.add((String) (((NamedList) ((SimpleOrderedMap) rb.rsp.getValues().get("spellcheck")).get("collations")).get("collation")));
          }
      }
  }

  return newSuggestions;
}
 
Example 19
@Override
public void prepare(ResponseBuilder responseBuilder) throws IOException {
    if (!isEnabled(responseBuilder)) {
        return;
    }

    responseBuilder.setNeedDocSet(true);
}
 
Example 20
Source Project: solr-researcher   Source File: ReSearcherUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static long extractOriginalQueryHits(ResponseBuilder rb) {
  long hits = 0;
  if (rb.rsp != null) {
    Number hitsInteger = (Number) rb.rsp.getToLog().get("hits");
    if (hitsInteger == null) {
      hits = rb.getNumberDocumentsFound();
    } else {
      hits = hitsInteger.longValue();
    }
  }
  return hits;
}
 
Example 21
TextLogisticRegressionCollector(ResponseBuilder rbsp, IndexSearcher searcher,
                                TrainingParams trainingParams) {
  this.trainingParams = trainingParams;
  this.workingDeltas = new double[trainingParams.weights.length];
  this.weights = Arrays.copyOf(trainingParams.weights, trainingParams.weights.length);
  this.rbsp = rbsp;
  this.classificationEvaluation = new ClassificationEvaluation();
  this.searcher = searcher;
  positiveDocsSet = new SparseFixedBitSet(searcher.getIndexReader().numDocs());
  docsSet = new SparseFixedBitSet(searcher.getIndexReader().numDocs());
}
 
Example 22
Source Project: BioSolr   Source File: MergeSearchComponent.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void modifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest sreq) {
  // do the filterQParser stuff first
  super.modifyRequest(rb, who, sreq);
  
  if (! doMerge(rb)) {
    return;
  }
  
  ReturnFields rf = rb.rsp.getReturnFields();
  if (rf.wantsAllFields()) {
    // we already have what we need since we ask for everything...
    return;
  }

  IndexSchema schema = rb.req.getCore().getLatestSchema();
  for (SchemaField field : schema.getFields().values()) {
    if (! rf.wantsField(field.getName())) {
      continue;
    }
    for (String source : schema.getCopySources(field.getName())) {
      if (rf.wantsField(source)) {
        continue;
      }
      sreq.params.add(CommonParams.FL, source);
    }
  }
}
 
Example 23
public void aggregate() throws IOException {
    FacetModule mod = new FacetModule();
    SolrQueryResponse resp = new SolrQueryResponse();
    ResponseBuilder rb = getResponseBuilder(resp);
    mod.prepare(rb);
    mod.process(rb);
    parseResponse(resp);
}
 
Example 24
Source Project: lucene-solr   Source File: LocalStatsCache.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected ShardRequest doRetrieveStatsRequest(ResponseBuilder rb) {
  log.debug("## RSR {}", rb.req);
  // already incremented the stats - decrement it now
  statsCacheMetrics.retrieveStats.decrement();
  return null;
}
 
Example 25
@Override
public int distributedProcess(ResponseBuilder rb) throws IOException {
  if (searchHandler != null && checkComponentShouldProcess(rb)) {
    doProcess(rb);
  }
  
  return ResponseBuilder.STAGE_DONE;
}
 
Example 26
Source Project: lucene-solr   Source File: MockShardHandlerFactory.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public ShardHandler getShardHandler() {
  return new ShardHandler() {
    @Override
    public void prepDistributed(ResponseBuilder rb) {}

    @Override
    public void submit(ShardRequest sreq, String shard,
        ModifiableSolrParams params) {}

    @Override
    public ShardResponse takeCompletedIncludingErrors() {
      return null;
    }

    @Override
    public ShardResponse takeCompletedOrError() {
      return null;
    }

    @Override
    public void cancelAll() {}

    @Override
    public ShardHandlerFactory getShardHandlerFactory() {
      return MockShardHandlerFactory.this;
    }
  };
}
 
Example 27
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);
}
 
Example 28
Source Project: lucene-solr   Source File: ClusteringComponent.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void prepare(ResponseBuilder rb) throws IOException {
  SolrParams params = rb.req.getParams();
  if (!params.getBool(COMPONENT_NAME, false)) {
    return;
  }
}
 
Example 29
Source Project: lucene-solr   Source File: SignificantTermsQParserPlugin.java    License: Apache License 2.0 5 votes vote down vote up
public SignifcantTermsCollector(ResponseBuilder rb, IndexSearcher searcher, String field, int numTerms, float minDocs, float maxDocs, int minTermLength) {
  this.rb = rb;
  this.searcher = searcher;
  this.field = field;
  this.numTerms = numTerms;
  this.docs = new SparseFixedBitSet(searcher.getIndexReader().maxDoc());
  this.numDocs = searcher.getIndexReader().numDocs();
  this.minDocs = minDocs;
  this.maxDocs = maxDocs;
  this.minTermLength = minTermLength;
}
 
Example 30
Source Project: lucene-solr   Source File: ClusteringComponent.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void finishStage(ResponseBuilder rb) {
  SolrParams params = rb.req.getParams();
  if (!params.getBool(COMPONENT_NAME, false) || 
      !params.getBool(ClusteringParams.USE_SEARCH_RESULTS, false)) {
    return;
  }

  if (rb.stage == ResponseBuilder.STAGE_GET_FIELDS) {
    String name = getClusteringEngineName(rb);
    SearchClusteringEngine engine = searchClusteringEngines.get(name);
    if (engine != null) {
      checkAvailable(name, engine);
      SolrDocumentList solrDocList = (SolrDocumentList) rb.rsp.getResponse();
      // TODO: Currently, docIds is set to null in distributed environment.
      // This causes CarrotParams.PRODUCE_SUMMARY doesn't work.
      // To work CarrotParams.PRODUCE_SUMMARY under distributed mode, we can choose either one of:
      // (a) In each shard, ClusteringComponent produces summary and finishStage()
      //     merges these summaries.
      // (b) Adding doHighlighting(SolrDocumentList, ...) method to SolrHighlighter and
      //     making SolrHighlighter uses "external text" rather than stored values to produce snippets.
      Map<SolrDocument,Integer> docIds = null;
      Object clusters = engine.cluster(rb.getQuery(), solrDocList, docIds, rb.req);
      rb.rsp.add("clusters", clusters);
    } else {
      log.warn("No engine named: {}", name);
    }
  }
}