Java Code Examples for org.apache.solr.common.params.SolrParams

The following examples show how to use org.apache.solr.common.params.SolrParams. 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
Source Project: lucene-solr   Source File: DaemonStreamApiTest.java    License: Apache License 2.0 6 votes vote down vote up
private List<Tuple> getTuples(final SolrParams params, String ofInterest) throws IOException {
  //log.info("Tuples from params: {}", params);
  TupleStream tupleStream = new SolrStream(url, params);

  tupleStream.open();
  List<Tuple> tuples = new ArrayList<>();
  for (; ; ) {
    Tuple t = tupleStream.read();
    //log.info(" ... {}", t.fields);
    if (t.EOF) {
      break;
    } else if (ofInterest == null || t.getString("id").equals(ofInterest) || t.getString(ofInterest).equals("null") == false) {
      // a failed return is a bit different, the onlyh key is DaemonOp
      tuples.add(t);
    }
  }
  tupleStream.close();
  Collections.sort(tuples, (o1, o2) -> (o1.getString("id").compareTo(o2.getString("id"))));
  return tuples;
}
 
Example 2
Source Project: lucene-solr   Source File: CollectionsHandler.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Places all prefixed properties in the sink map (or a new map) using the prefix as the key and a map of
 * all prefixed properties as the value. The sub-map keys have the prefix removed.
 *
 * @param params The solr params from which to extract prefixed properties.
 * @param sink   The map to add the properties too.
 * @param prefix The prefix to identify properties to be extracted
 * @return The sink map, or a new map if the sink map was null
 */
private static Map<String, Object> convertPrefixToMap(SolrParams params, Map<String, Object> sink, String prefix) {
  Map<String, Object> result = new LinkedHashMap<>();
  Iterator<String> iter = params.getParameterNamesIterator();
  while (iter.hasNext()) {
    String param = iter.next();
    if (param.startsWith(prefix)) {
      result.put(param.substring(prefix.length() + 1), params.get(param));
    }
  }
  if (sink == null) {
    sink = new LinkedHashMap<>();
  }
  sink.put(prefix, result);
  return sink;
}
 
Example 3
Source Project: BioSolr   Source File: PrunerFactoryTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test(expected=org.apache.solr.search.SyntaxError.class)
public void constructPruner_datapointsPruner_noDatapoints() throws Exception {
	final String prunerParam = PrunerFactory.DATAPOINTS_PRUNER_VALUE;
	final FacetTreeParameters ftParams = mock(FacetTreeParameters.class);
	when(ftParams.getDefault(FacetTreeParameters.PRUNE_PARAM)).thenReturn(null);
	when(ftParams.getIntDefault(FacetTreeParameters.DATAPOINTS_PARAM)).thenReturn(0);
	final SolrParams params = mock(SolrParams.class);
	when(params.get(FacetTreeParameters.PRUNE_PARAM, null)).thenReturn(prunerParam);
	when(params.getInt(FacetTreeParameters.DATAPOINTS_PARAM, 0)).thenReturn(0);
	
	PrunerFactory factory = new PrunerFactory(ftParams);
	factory.constructPruner(params);
	
	verify(params).get(FacetTreeParameters.PRUNE_PARAM, null);
	verify(ftParams).getIntDefault(FacetTreeParameters.DATAPOINTS_PARAM);
}
 
Example 4
Source Project: lucene-solr   Source File: MetricsHandler.java    License: Apache License 2.0 6 votes vote down vote up
private List<MetricType> parseMetricTypes(SolrParams params) {
  String[] typeStr = params.getParams(TYPE_PARAM);
  List<String> types = Collections.emptyList();
  if (typeStr != null && typeStr.length > 0)  {
    types = new ArrayList<>();
    for (String type : typeStr) {
      types.addAll(StrUtils.splitSmart(type, ','));
    }
  }

  List<MetricType> metricTypes = Collections.singletonList(MetricType.all); // include all metrics by default
  try {
    if (types.size() > 0) {
      metricTypes = types.stream().map(String::trim).map(MetricType::valueOf).collect(Collectors.toList());
    }
  } catch (IllegalArgumentException e) {
    throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Invalid metric type in: " + types +
        " specified. Must be one of " + MetricType.SUPPORTED_TYPES_MSG, e);
  }
  return metricTypes;
}
 
Example 5
Source Project: lucene-solr   Source File: TestCloudPseudoReturnFields.java    License: Apache License 2.0 6 votes vote down vote up
public void testGlobsRTG() throws Exception {
  // behavior shouldn't matter if we are committed or uncommitted
  for (String id : Arrays.asList("42","99")) {
    
    SolrDocument doc = getRandClient(random()).getById(id, params("fl","val_*"));
    String msg = id + ": fl=val_* => " + doc;
    assertEquals(msg, 1, doc.size());
    assertTrue(msg, doc.getFieldValue("val_i") instanceof Integer);
    assertEquals(msg, 1, doc.getFieldValue("val_i"));
    
    for (SolrParams p : Arrays.asList(params("fl","val_*,subj*,ss*"),
                                      params("fl","val_*","fl","subj*,ss*"))) {
      doc = getRandClient(random()).getById(id, p);
      msg = id + ": " + p + " => " + doc;
      
      assertEquals(msg, 3, doc.size());
      assertTrue(msg, doc.getFieldValue("val_i") instanceof Integer);
      assertEquals(msg, 1, doc.getFieldValue("val_i"));
      assertTrue(msg, doc.getFieldValue("subject") instanceof String); 
      // NOTE: 'subject' is diff between two docs
      assertTrue(msg, doc.getFieldValue("ssto") instanceof String); // TODO: val_ss: List<String>
      assertEquals(msg, "X", doc.getFieldValue("ssto"));
    }
  }
}
 
Example 6
private ResponseBuilder runComponent(String user, NamedList args, SolrParams params)
throws Exception {
  ResponseBuilder builder = getResponseBuilder();
  prepareCollAndUser(core, builder.req, "collection1", user);

  if (params != null) {
    builder.req.setParams(params);
  } else {
    builder.req.setParams(new ModifiableSolrParams());
  }

  QueryDocAuthorizationComponent component =
    new QueryDocAuthorizationComponent(sentryInstance);
  component.init(args);
  component.prepare(builder);
  return builder;
}
 
Example 7
Source Project: BioSolr   Source File: FacetTreeBuilderFactoryTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void constructFTB_derivedChildnodeStrategy() throws Exception {
	final String strategy = null;
	final String childField = "child_nodes";
	final String nodeField = "node_id";
	final SolrParams params = mock(SolrParams.class);
	when(params.get(FacetTreeParameters.STRATEGY_PARAM)).thenReturn(strategy);
	when(params.get(FacetTreeParameters.CHILD_FIELD_PARAM)).thenReturn(childField);
	when(params.get(FacetTreeParameters.NODE_FIELD_PARAM)).thenReturn(nodeField);
	
	FacetTreeBuilderFactory factory = new FacetTreeBuilderFactory();
	FacetTreeBuilder ftb = factory.constructFacetTreeBuilder(params);
	
	assertNotNull(ftb);
	assertTrue(ftb instanceof ChildNodeFacetTreeBuilder);
	
	verify(params).get(FacetTreeParameters.STRATEGY_PARAM);
	verify(params, atLeastOnce()).get(FacetTreeParameters.CHILD_FIELD_PARAM);
	verify(params, atLeastOnce()).get(FacetTreeParameters.NODE_FIELD_PARAM);
}
 
Example 8
@Override
public void init(@SuppressWarnings({"rawtypes"})final NamedList args) {
  if (args != null) {
    SolrParams params = args.toSolrParams();
    boolean enabled = params.getBool("enabled", true);
    this.enabled = enabled;

    overwriteDupes = params.getBool("overwriteDupes", true);

    signatureField = params.get("signatureField", "signatureField");

    signatureClass = params.get("signatureClass",
        "org.apache.solr.update.processor.Lookup3Signature");
    this.params = params;

    Object fields = args.get("fields");
    sigFields = fields == null ? null: StrUtils.splitSmart((String)fields, ",", true); 
    if (sigFields != null) {
      Collections.sort(sigFields);
    }
  }
}
 
Example 9
Source Project: lucene-solr   Source File: TestCloudPseudoReturnFields.java    License: Apache License 2.0 6 votes vote down vote up
public void testAugmentersAndExplicit() throws Exception {
  for (SolrParams p : Arrays.asList(params("q", "*:*", "fl","id,[docid],[explain],x_alias:[value v=10 t=int]"),
                                    params("q", "*:*", "fl","id","fl","[docid],[explain],x_alias:[value v=10 t=int]"),
                                    params("q", "*:*", "fl","id","fl","[docid]","fl","[explain]","fl","x_alias:[value v=10 t=int]"))) {
    SolrDocumentList docs = assertSearch(p);
    assertEquals(p + " => " + docs, 5, docs.getNumFound());
    // shouldn't matter what doc we pick...
    for (SolrDocument doc : docs) {
      String msg = p + " => " + doc;
      assertEquals(msg, 4, doc.size());
      assertTrue(msg, doc.getFieldValue("id") instanceof String);
      assertTrue(msg, doc.getFieldValue("[docid]") instanceof Integer);
      assertTrue(msg, doc.getFieldValue("[explain]") instanceof String);
      assertTrue(msg, doc.getFieldValue("x_alias") instanceof Integer);
      assertEquals(msg, 10, doc.getFieldValue("x_alias"));
    }
  }
}
 
Example 10
/**
 * Asserts that the input {@link ShardState} and the CoreAdmin.SUMMARY response give the same information.
 *
 * @param state the {@link ShardState} instance.
 * @param core the target {@link SolrCore} instance.
 */
public static void assertShardAndCoreSummaryConsistency(ShardState state, SolrCore core) {
    SolrParams params =
            new ModifiableSolrParams()
                    .add(CoreAdminParams.CORE, core.getName())
                    .add(CoreAdminParams.ACTION, "SUMMARY");

    SolrQueryRequest request = new LocalSolrQueryRequest(core, params);
    SolrQueryResponse response = new SolrQueryResponse();
    coreAdminHandler(core).handleRequest(request, response);

    NamedList<?> summary =
            ofNullable(response.getValues())
                    .map(values -> values.get("Summary"))
                    .map(NamedList.class::cast)
                    .map(values -> values.get(core.getName()))
                    .map(NamedList.class::cast)
                    .orElseGet(NamedList::new);

    assertEquals(state.getLastIndexedChangeSetId(), summary.get("Id for last Change Set in index"));
    assertEquals(state.getLastIndexedChangeSetCommitTime(), summary.get("Last Index Change Set Commit Time"));
    assertEquals(state.getLastIndexedTxCommitTime(), summary.get("Last Index TX Commit Time"));
    assertEquals(state.getLastIndexedTxId(), summary.get("Id for last TX in index"));
}
 
Example 11
Source Project: lucene-solr   Source File: StatusOp.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void execute(CoreAdminHandler.CallInfo it) throws Exception {
  SolrParams params = it.req.getParams();

  String cname = params.get(CoreAdminParams.CORE);
  String indexInfo = params.get(CoreAdminParams.INDEX_INFO);
  boolean isIndexInfoNeeded = Boolean.parseBoolean(null == indexInfo ? "true" : indexInfo);
  NamedList<Object> status = new SimpleOrderedMap<>();
  Map<String, Exception> failures = new HashMap<>();
  for (Map.Entry<String, CoreContainer.CoreLoadFailure> failure : it.handler.coreContainer.getCoreInitFailures().entrySet()) {
    failures.put(failure.getKey(), failure.getValue().exception);
  }
  if (cname == null) {
    for (String name : it.handler.coreContainer.getAllCoreNames()) {
      status.add(name, CoreAdminOperation.getCoreStatus(it.handler.coreContainer, name, isIndexInfoNeeded));
    }
    it.rsp.add("initFailures", failures);
  } else {
    failures = failures.containsKey(cname)
        ? Collections.singletonMap(cname, failures.get(cname))
            : Collections.<String, Exception>emptyMap();
        it.rsp.add("initFailures", failures);
        status.add(cname, CoreAdminOperation.getCoreStatus(it.handler.coreContainer, cname, isIndexInfoNeeded));
  }
  it.rsp.add("status", status);
}
 
Example 12
Source Project: lucene-solr   Source File: ResponseLogComponent.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void process(ResponseBuilder rb) throws IOException {
  SolrParams params = rb.req.getParams();
  if (!params.getBool(COMPONENT_NAME, false)) return;
  
  SolrIndexSearcher searcher = rb.req.getSearcher();
  IndexSchema schema = searcher.getSchema();
  if (schema.getUniqueKeyField() == null) return;

  ResultContext rc = (ResultContext) rb.rsp.getResponse();

  DocList docs = rc.getDocList();
  if (docs.hasScores()) {
    processScores(rb, docs, schema, searcher);
  } else {
    processIds(rb, docs, schema, searcher);
  }
}
 
Example 13
Source Project: lucene-solr   Source File: ReplicationHandler.java    License: Apache License 2.0 6 votes vote down vote up
public DirectoryFileStream(SolrParams solrParams) {
  params = solrParams;
  delPolicy = core.getDeletionPolicy();

  fileName = validateFilenameOrError(params.get(FILE));
  cfileName = validateFilenameOrError(params.get(CONF_FILE_SHORT));
  tlogFileName = validateFilenameOrError(params.get(TLOG_FILE));
  
  sOffset = params.get(OFFSET);
  sLen = params.get(LEN);
  compress = params.get(COMPRESSION);
  useChecksum = params.getBool(CHECKSUM, false);
  indexGen = params.getLong(GENERATION);
  if (useChecksum) {
    checksum = new Adler32();
  }
  //No throttle if MAX_WRITE_PER_SECOND is not specified
  double maxWriteMBPerSec = params.getDouble(MAX_WRITE_PER_SECOND, Double.MAX_VALUE);
  rateLimiter = new RateLimiter.SimpleRateLimiter(maxWriteMBPerSec);
}
 
Example 14
private void queryAndAssertResultSize(String collection, int expectedResultSize, int timeoutMS)
    throws SolrServerException, IOException, InterruptedException {
  long startTimestamp = System.nanoTime();

  long actualResultSize = 0;
  while(true) {
    if (System.nanoTime() - startTimestamp > TimeUnit.MILLISECONDS.toNanos(timeoutMS) || actualResultSize > expectedResultSize) {
      fail("expected: " + expectedResultSize + ", actual: " + actualResultSize);
    }
    SolrParams queryAll = new SolrQuery("*:*");
    cloudClient.setDefaultCollection(collection);
    try {
      QueryResponse queryResponse = cloudClient.query(queryAll);
      actualResultSize = queryResponse.getResults().getNumFound();
      if(expectedResultSize == actualResultSize) {
        return;
      }
    } catch (SolrServerException | IOException e) {
      log.warn("Querying solr threw an exception. This can be expected to happen during restarts.", e);
    }

    Thread.sleep(1000);
  }
}
 
Example 15
Source Project: BioSolr   Source File: FacetTreeBuilderFactory.java    License: Apache License 2.0 5 votes vote down vote up
private String deriveStrategyFromLocalParams(SolrParams params) {
	String strategy = params.get(FacetTreeParameters.STRATEGY_PARAM);
	
	if (StringUtils.isBlank(strategy)) {
		// Attempt to derive strategy from given parameters
		if (StringUtils.isNotBlank(params.get(FacetTreeParameters.CHILD_FIELD_PARAM))) {
			strategy = CHILD_NODE_STRATEGY;
		} else if (StringUtils.isNotBlank(params.get(FacetTreeParameters.PARENT_FIELD_PARAM))) {
			strategy = PARENT_NODE_STRATEGY;
		}
	}
	
	return strategy;
}
 
Example 16
Source Project: lucene-solr   Source File: RuntimeLibSearchComponent.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, true)) {
    rb.rsp.add(COMPONENT_NAME, RuntimeLibSearchComponent.class.getName());
    rb.rsp.add("loader",  getClass().getClassLoader().getClass().getName() );
    rb.rsp.add("Version", "2" );
  }
  super.process(rb);
}
 
Example 17
Source Project: solr-redis   Source File: LIndex.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Map<String, Float> execute(final JedisCommands client, final SolrParams params) {
  final String key = ParamUtil.assertGetStringByName(params, "key");
  final int index = ParamUtil.tryGetIntByName(params, "index", 0);

  log.debug("Fetching LINDEX from Redis for key: {} ({})", key, index);

  return ResultUtil.stringIteratorToMap(Collections.singletonList(client.lindex(key, index)));
}
 
Example 18
Source Project: lucene-solr   Source File: SolrTestCaseJ4.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Generates a SolrQueryRequest
 */
public static SolrQueryRequest req(SolrParams params, String... moreParams) {
  ModifiableSolrParams mp = new ModifiableSolrParams(params);
  for (int i=0; i<moreParams.length; i+=2) {
    mp.add(moreParams[i], moreParams[i+1]);
  }
  return new LocalSolrQueryRequest(h.getCore(), mp);
}
 
Example 19
Source Project: lucene-solr   Source File: TermsComponent.java    License: Apache License 2.0 5 votes vote down vote up
int resolveRegexpFlags(SolrParams params) {
    String[] flagParams = params.getParams(TermsParams.TERMS_REGEXP_FLAG);
    if (flagParams == null) {
        return 0;
    }
    int flags = 0;
    for (String flagParam : flagParams) {
        try {
          flags |= TermsParams.TermsRegexpFlag.valueOf(flagParam.toUpperCase(Locale.ROOT)).getValue();
        } catch (IllegalArgumentException iae) {
            throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unknown terms regex flag '" + flagParam + "'");
        }
    }
    return flags;
}
 
Example 20
Source Project: lucene-solr   Source File: StreamingTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
// commented out on: 17-Feb-2019   @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // 6-Sep-2018
public void testZeroParallelReducerStream() throws Exception {

  new UpdateRequest()
      .add(id, "0", "a_s", "hello0", "a_i", "0", "a_f", "1")
      .add(id, "2", "a_s", "hello0", "a_i", "2", "a_f", "2")
      .add(id, "3", "a_s", "hello3", "a_i", "3", "a_f", "3")
      .add(id, "4", "a_s", "hello4", "a_i", "4", "a_f", "4")
      .add(id, "1", "a_s", "hello0", "a_i", "1", "a_f", "5")
      .add(id, "5", "a_s", "hello3", "a_i", "10", "a_f", "6")
      .add(id, "6", "a_s", "hello4", "a_i", "11", "a_f", "7")
      .add(id, "7", "a_s", "hello3", "a_i", "12", "a_f", "8")
      .add(id, "8", "a_s", "hello3", "a_i", "13", "a_f", "9")
      .add(id, "9", "a_s", "hello0", "a_i", "14", "a_f", "10")
      .commit(cluster.getSolrClient(), COLLECTIONORALIAS);

  StreamContext streamContext = new StreamContext();
  SolrClientCache solrClientCache = new SolrClientCache();
  streamContext.setSolrClientCache(solrClientCache);
  try {
    SolrParams sParamsA = mapParams("q", "a_s:blah", "fl", "id,a_s,a_i,a_f", "sort", "a_s asc,a_f asc", "partitionKeys", "a_s", "qt", "/export");
    CloudSolrStream stream = new CloudSolrStream(zkHost, COLLECTIONORALIAS, sParamsA);
    ReducerStream rstream = new ReducerStream(stream,
        new FieldEqualitor("a_s"),
        new GroupOperation(new FieldComparator("a_s", ComparatorOrder.ASCENDING), 2));
    ParallelStream pstream = parallelStream(rstream, new FieldComparator("a_s", ComparatorOrder.ASCENDING));
    attachStreamFactory(pstream);
    pstream.setStreamContext(streamContext);
    List<Tuple> tuples = getTuples(pstream);
    assert (tuples.size() == 0);
  } finally {
    solrClientCache.close();
  }

}
 
Example 21
Source Project: mmseg4j-solr   Source File: MMseg4jHandler.java    License: Apache License 2.0 5 votes vote down vote up
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
	rsp.setHttpCaching(false);
	final SolrParams solrParams = req.getParams();

	String dicPath = solrParams.get("dicPath");
	Dictionary dict = Utils.getDict(dicPath, loader);

	NamedList<Object> result = new NamedList<Object>();
	result.add("dicPath", dict.getDicPath().toURI());

	boolean check = solrParams.getBool("check", false);	//仅仅用于检测词库是否有变化
	//用于尝试加载词库,有此参数, check 参数可以省略。
	boolean reload = solrParams.getBool("reload", false);	

	check |= reload;

	boolean changed = false;
	boolean reloaded = false;
	if(check) {
		changed = dict.wordsFileIsChange();
		result.add("changed", changed);
	}
	if(changed && reload) {
		reloaded = dict.reload();
		result.add("reloaded", reloaded);
	}
	rsp.add("result", result);
}
 
Example 22
public MimetypeGroupingQParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req, NamedList<Object> args, HashMap<String, String> mappings)
{
    super(qstr, localParams, params, req, args);
    Boolean doGroup = localParams.getBool("group");
    if(doGroup != null)
    {
        group = doGroup.booleanValue();
    }
       
    this.mappings = mappings;
}
 
Example 23
private String[] getDeleteParamValuesFromRequest(DeleteUpdateCommand cmd) {
  SolrParams params = cmd.getReq().getParams();
  String[] returnArr = new String[deleteVersionParamNames.length];
  for (int i = 0; i < deleteVersionParamNames.length; i++) {
    String deleteVersionParamName = deleteVersionParamNames[i];
    String deleteParamValue = params.get(deleteVersionParamName);
    returnArr[i] = deleteParamValue;
  }
  return returnArr;
}
 
Example 24
Source Project: lucene-solr   Source File: CoreAdminRequest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public SolrParams getParams() {
  if( action == null ) {
    throw new RuntimeException( "no action specified!" );
  }
  ModifiableSolrParams params = new ModifiableSolrParams();
  params.set( CoreAdminParams.ACTION, action.toString() );
 
  params.set( CoreAdminParams.CORE, core );

  return params;
}
 
Example 25
Source Project: lucene-solr   Source File: BaseDistributedSearchTestCase.java    License: Apache License 2.0 5 votes vote down vote up
protected UpdateResponse del(SolrClient client, SolrParams params, Object... ids) throws IOException, SolrServerException {
  UpdateRequest ureq = new UpdateRequest();
  ureq.setParams(new ModifiableSolrParams(params));
  for (Object id: ids) {
    ureq.deleteById(id.toString());
  }
  return ureq.process(client);
}
 
Example 26
Source Project: lucene-solr   Source File: ShardAugmenterFactory.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public DocTransformer create(String field, SolrParams params, SolrQueryRequest req) {
  String v = req.getParams().get(ShardParams.SHARD_URL);
  if( v == null ) {
    if( req.getParams().getBool(ShardParams.IS_SHARD, false) ) {
      v = "[unknown]";
    }
    else {
      v = "[not a shard request]";
    }
  }
  return new ValueAugmenterFactory.ValueAugmenter( field, v );
}
 
Example 27
Source Project: lucene-solr   Source File: SpellingOptions.java    License: Apache License 2.0 5 votes vote down vote up
public SpellingOptions(Collection<Token> tokens, IndexReader reader,
    int count, int alternativeTermCount, SuggestMode suggestMode,
    boolean extendedResults, float accuracy, SolrParams customParams) {
  this.tokens = tokens;
  this.reader = reader;
  this.count = count;
  this.alternativeTermCount = alternativeTermCount;
  this.suggestMode = suggestMode;
  this.extendedResults = extendedResults;
  this.accuracy = accuracy;
  this.customParams = customParams;
}
 
Example 28
Source Project: lucene-solr   Source File: CdcrReplicatorScheduler.java    License: Apache License 2.0 5 votes vote down vote up
CdcrReplicatorScheduler(final CdcrReplicatorManager replicatorStatesManager, final SolrParams replicatorConfiguration) {
  this.replicatorManager = replicatorStatesManager;
  this.statesQueue = new ConcurrentLinkedQueue<>(replicatorManager.getReplicatorStates());
  if (replicatorConfiguration != null) {
    poolSize = replicatorConfiguration.getInt(CdcrParams.THREAD_POOL_SIZE_PARAM, DEFAULT_POOL_SIZE);
    timeSchedule = replicatorConfiguration.getInt(CdcrParams.SCHEDULE_PARAM, DEFAULT_TIME_SCHEDULE);
    batchSize = replicatorConfiguration.getInt(CdcrParams.BATCH_SIZE_PARAM, DEFAULT_BATCH_SIZE);
  }
}
 
Example 29
Source Project: BioSolr   Source File: OfferXJoinResultsFactory.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Use 'offers' REST API to fetch current offer data. 
 */
@Override
public XJoinResults<String> getResults(SolrParams params)
throws IOException {
  try (HttpConnection http = new HttpConnection(url)) {
    JsonArray offers = (JsonArray)http.getJson();
    return new OfferResults(offers);
  }
}
 
Example 30
Source Project: lucene-solr   Source File: CollectionAdminRequest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public SolrParams getParams() {
  ModifiableSolrParams params = (ModifiableSolrParams) super.getParams();
  if (requestId != null)
    params.set(CoreAdminParams.REQUESTID, requestId);
  if (flush != null)
    params.set(CollectionAdminParams.FLUSH, flush);
  return params;
}