Java Code Examples for org.apache.solr.handler.component.ResponseBuilder#STAGE_EXECUTE_QUERY
The following examples show how to use
org.apache.solr.handler.component.ResponseBuilder#STAGE_EXECUTE_QUERY .
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
Source File: AsyncBuildSuggestComponent.java From SearchServices with GNU Lesser General Public License v3.0 | 6 votes |
/** Dispatch shard request in <code>STAGE_EXECUTE_QUERY</code> stage */ @Override public int distributedProcess(ResponseBuilder rb) { SolrParams params = rb.req.getParams(); LOG.debug("SuggestComponent distributedProcess with : " + params); if (rb.stage < ResponseBuilder.STAGE_EXECUTE_QUERY) return ResponseBuilder.STAGE_EXECUTE_QUERY; if (rb.stage == ResponseBuilder.STAGE_EXECUTE_QUERY) { ShardRequest sreq = new ShardRequest(); sreq.purpose = ShardRequest.PURPOSE_GET_TOP_IDS; sreq.params = new ModifiableSolrParams(rb.req.getParams()); sreq.params.remove(ShardParams.SHARDS); rb.addRequest(this, sreq); return ResponseBuilder.STAGE_GET_FIELDS; } return ResponseBuilder.STAGE_DONE; }
Example 2
Source File: MtasSolrComponentFacet.java From mtas with Apache License 2.0 | 6 votes |
@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_FACET, 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); // shouldn't happen } } } } } }
Example 3
Source File: MtasSolrComponentStats.java From mtas with Apache License 2.0 | 6 votes |
@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_STATS, 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 4
Source File: MtasSolrComponentPrefix.java From mtas with Apache License 2.0 | 6 votes |
@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 5
Source File: MtasSolrComponentGroup.java From mtas with Apache License 2.0 | 5 votes |
@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) { // decode finished results for (ShardRequest sreq : rb.finished) { if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false) && sreq.params.getBool(PARAM_MTAS_GROUP, 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); // shouldn't happen } } } } } }
Example 6
Source File: MtasSolrComponentKwic.java From mtas with Apache License 2.0 | 5 votes |
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 7
Source File: MtasSolrComponentDocument.java From mtas with Apache License 2.0 | 5 votes |
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_DOCUMENT, false)) { // nothing to do } } } }
Example 8
Source File: MtasSolrComponentVersion.java From mtas with Apache License 2.0 | 5 votes |
@Override public void finishStage(ResponseBuilder rb) { if (rb.req.getParams().getBool(MtasSolrSearchComponent.PARAM_MTAS, false)) { if (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_VERSION, false)) { for (ShardResponse shardResponse : sreq.responses) { NamedList<Object> solrShardResponse = shardResponse.getSolrResponse().getResponse(); try { SimpleOrderedMap<Object> data = (SimpleOrderedMap<Object>) solrShardResponse .findRecursive(MtasSolrSearchComponent.NAME, NAME); // create shardInfo SimpleOrderedMap<Object> dataShard = new SimpleOrderedMap<>(); dataShard.add(NAME_MTAS_VERSION_SHARD, shardResponse.getShard()); dataShard.add(NAME, data.clone()); List<SimpleOrderedMap> dataShards = new ArrayList<>(); dataShards.add(dataShard); // create main data data.clear(); data.addAll(getVersion()); // add shardInfo data.add(NAME_MTAS_VERSION_SHARDS, dataShards); } catch (ClassCastException | IOException e) { log.debug(e); // shouldn't happen } } } } } } }
Example 9
Source File: MtasSolrComponentList.java From mtas with Apache License 2.0 | 5 votes |
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_LIST, false)) { // nothing to do } } } }
Example 10
Source File: MtasSolrResultMerge.java From mtas with Apache License 2.0 | 4 votes |
/** * Merge. * * @param rb * the rb */ @SuppressWarnings("unchecked") public void merge(ResponseBuilder rb) { if (rb.req.getParams().getBool(MtasSolrSearchComponent.PARAM_MTAS, false)) { // mtas response NamedList<Object> mtasResponse = null; boolean newResponse = false; try { mtasResponse = (NamedList<Object>) rb.rsp.getValues().get(MtasSolrSearchComponent.NAME); } catch (ClassCastException e) { log.debug(e); mtasResponse = null; } if (mtasResponse == null) { newResponse = true; mtasResponse = new SimpleOrderedMap<>(); } for (ShardRequest sreq : rb.finished) { if (rb.stage == ResponseBuilder.STAGE_EXECUTE_QUERY) { // merge version if (rb.req.getParams().getBool(MtasSolrComponentVersion.PARAM_MTAS_VERSION, false)) { mergeNamedList(sreq, mtasResponse, MtasSolrComponentVersion.NAME, null); } // merge stats if (rb.req.getParams().getBool(MtasSolrComponentStats.PARAM_MTAS_STATS, false)) { mergeNamedList(sreq, mtasResponse, MtasSolrComponentStats.NAME, null); } // merge group if (rb.req.getParams().getBool(MtasSolrComponentGroup.PARAM_MTAS_GROUP, false)) { mergeArrayList(sreq, mtasResponse, MtasSolrComponentGroup.NAME, null, false); } // merge facet if (rb.req.getParams().getBool(MtasSolrComponentFacet.PARAM_MTAS_FACET, false)) { mergeArrayList(sreq, mtasResponse, MtasSolrComponentFacet.NAME, null, false); } // merge collection if (rb.req.getParams().getBool(MtasSolrComponentCollection.PARAM_MTAS_COLLECTION, false)) { mergeArrayList(sreq, mtasResponse, MtasSolrComponentCollection.NAME, null, false); } // merge prefix if (rb.req.getParams().getBool(MtasSolrComponentPrefix.PARAM_MTAS_PREFIX, false)) { mergeArrayList(sreq, mtasResponse, MtasSolrComponentPrefix.NAME, null, false); } } else if (rb.stage == MtasSolrSearchComponent.STAGE_COLLECTION_INIT) { // merge collection if (rb.req.getParams().getBool(MtasSolrComponentCollection.PARAM_MTAS_COLLECTION, false)) { mergeArrayList(sreq, mtasResponse, MtasSolrComponentCollection.NAME, null, false); } } else if (rb.stage == MtasSolrSearchComponent.STAGE_TERMVECTOR_MISSING_KEY) { // merge termvector if (rb.req.getParams().getBool(MtasSolrComponentTermvector.PARAM_MTAS_TERMVECTOR, false)) { mergeArrayList(sreq, mtasResponse, MtasSolrComponentTermvector.NAME, null, false); } } else if (rb.stage == MtasSolrSearchComponent.STAGE_LIST) { // merge list if (rb.req.getParams().getBool(MtasSolrComponentList.PARAM_MTAS_LIST, false)) { mergeArrayList(sreq, mtasResponse, MtasSolrComponentList.NAME, ShardRequest.PURPOSE_PRIVATE, true); } } else if (rb.stage == ResponseBuilder.STAGE_GET_FIELDS) { // merge document if (rb.req.getParams().getBool(MtasSolrComponentDocument.PARAM_MTAS_DOCUMENT, false)) { mergeArrayList(sreq, mtasResponse, MtasSolrComponentDocument.NAME, ShardRequest.PURPOSE_PRIVATE, true); } // merge kwic if (rb.req.getParams().getBool(MtasSolrComponentKwic.PARAM_MTAS_KWIC, false)) { mergeArrayList(sreq, mtasResponse, MtasSolrComponentKwic.NAME, ShardRequest.PURPOSE_PRIVATE, true); } } } if (newResponse && mtasResponse.size() > 0) { rb.rsp.add(MtasSolrSearchComponent.NAME, mtasResponse); } } }
Example 11
Source File: MtasSolrSearchComponent.java From mtas with Apache License 2.0 | 4 votes |
@Override public void finishStage(ResponseBuilder rb) { // System.out // .println(System.nanoTime() + " - " + Thread.currentThread().getId() // + " - " + rb.req.getParams().getBool(ShardParams.IS_SHARD, false) // + " FINISHRESPONSES " + rb.stage + " " + rb.req.getParamString()); MtasSolrStatus solrStatus = Objects .requireNonNull((MtasSolrStatus) rb.req.getContext().get(MtasSolrStatus.class), "couldn't find status"); solrStatus.setStage(rb.stage); try { if (rb.stage == ResponseBuilder.STAGE_EXECUTE_QUERY) { Status status = solrStatus.status(); if (status.numberDocumentsFound == null) { status.numberDocumentsFound = rb.getNumberDocumentsFound(); } // try to finish status from get fields stage } else if (rb.stage >= ResponseBuilder.STAGE_GET_FIELDS) { finishStatus(solrStatus); } if (rb.req.getParams().getBool(PARAM_MTAS, false)) { if (rb.req.getParams().getBool(MtasSolrComponentVersion.PARAM_MTAS_VERSION, false)) { searchVersion.finishStage(rb); } if (rb.req.getParams().getBool(MtasSolrComponentStats.PARAM_MTAS_STATS, false)) { searchStats.finishStage(rb); } if (rb.req.getParams().getBool(MtasSolrComponentTermvector.PARAM_MTAS_TERMVECTOR, false)) { searchTermvector.finishStage(rb); } if (rb.req.getParams().getBool(MtasSolrComponentPrefix.PARAM_MTAS_PREFIX, false)) { searchPrefix.finishStage(rb); } if (rb.req.getParams().getBool(MtasSolrComponentFacet.PARAM_MTAS_FACET, false)) { searchFacet.finishStage(rb); } if (rb.req.getParams().getBool(MtasSolrComponentCollection.PARAM_MTAS_COLLECTION, false)) { searchCollection.finishStage(rb); } if (rb.req.getParams().getBool(MtasSolrComponentGroup.PARAM_MTAS_GROUP, false)) { searchGroup.finishStage(rb); } if (rb.req.getParams().getBool(MtasSolrComponentList.PARAM_MTAS_LIST, false)) { searchList.finishStage(rb); } if (rb.req.getParams().getBool(MtasSolrComponentDocument.PARAM_MTAS_DOCUMENT, false)) { searchDocument.finishStage(rb); } if (rb.req.getParams().getBool(MtasSolrComponentKwic.PARAM_MTAS_KWIC, false)) { searchKwic.finishStage(rb); } mtasSolrResultMerge.merge(rb); } } catch (ExitableDirectoryReader.ExitingReaderException e) { solrStatus.setError(e.getMessage()); } }