Java Code Examples for org.apache.solr.common.params.SolrParams#getLong()

The following examples show how to use org.apache.solr.common.params.SolrParams#getLong() . 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: QueryComponent.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
private int getMinExactCount(SolrParams params) {
  long minExactCount = params.getLong(CommonParams.MIN_EXACT_COUNT, Integer.MAX_VALUE);
  if (minExactCount < 0 || minExactCount > Integer.MAX_VALUE) {
    minExactCount = Integer.MAX_VALUE;
  }
  return (int)minExactCount;
}
 
Example 2
Source File: RealTimeGetComponent.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public void processGetFingeprint(ResponseBuilder rb) throws IOException {
  TestInjection.injectFailIndexFingerprintRequests();

  SolrQueryRequest req = rb.req;
  SolrParams params = req.getParams();

  long maxVersion = params.getLong("getFingerprint", Long.MAX_VALUE);
  if (TestInjection.injectWrongIndexFingerprint())  {
    maxVersion = -1;
  }
  IndexFingerprint fingerprint = IndexFingerprint.getFingerprint(req.getCore(), Math.abs(maxVersion));
  rb.rsp.add("fingerprint", fingerprint);
}
 
Example 3
Source File: AlfrescoCoreAdminHandler.java    From SearchServices with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Find transactions and acls missing or duplicated in the cores and
 * add them to be reindexed on the next maintenance operation
 * performed by MetadataTracker and AclTracker.
 *
 * Asynchronous execution
 *
 * @param params
 * - core, optional: The name of the SOLR Core
 * @return Response including the action result:
 * - action.status: scheduled, as it will be executed by Trackers on the next maintenance operation
 * - txToReindex: list of Transaction Ids that are going to be reindexed
 * - aclChangeSetToReindex: list of ACL Change Set Ids that are going to be reindexed
 */
NamedList<Object> actionFIX(SolrParams params) throws JSONException
{
    String requestedCoreName = coreName(params);

    var wrapper = new Object()
    {
        final NamedList<Object> response = new SimpleOrderedMap<>();
    };

    if (isNullOrEmpty(requestedCoreName))
    {
        return wrapper.response;
    }

    if (!coreNames().contains(requestedCoreName))
    {
        wrapper.response.add(ACTION_ERROR_MESSAGE_LABEL, UNKNOWN_CORE_MESSAGE + requestedCoreName);
        return wrapper.response;
    }

    if (!isMasterOrStandalone(requestedCoreName)) {
        wrapper.response.add(ACTION_ERROR_MESSAGE_LABEL, UNPROCESSABLE_REQUEST_ON_SLAVE_NODES);
        return wrapper.response;
    }

    Long fromTxCommitTime = params.getLong(FROM_TX_COMMIT_TIME_PARAMETER_NAME);
    Long toTxCommitTime = params.getLong(TO_TX_COMMIT_TIME_PARAMETER_NAME);
    boolean dryRun = params.getBool(DRY_RUN_PARAMETER_NAME, true);
    int maxTransactionsToSchedule = getMaxTransactionToSchedule(params);

    LOGGER.debug("FIX Admin request on core {}, parameters: " +
                FROM_TX_COMMIT_TIME_PARAMETER_NAME + " = {}, " +
                TO_TX_COMMIT_TIME_PARAMETER_NAME + " = {}, " +
                DRY_RUN_PARAMETER_NAME + " = {}, " +
                    MAX_TRANSACTIONS_TO_SCHEDULE_PARAMETER_NAME + " = {}",
                requestedCoreName,
                ofNullable(fromTxCommitTime).map(Object::toString).orElse("N.A."),
                ofNullable(toTxCommitTime).map(Object::toString).orElse("N.A."),
                dryRun,
                maxTransactionsToSchedule);

    coreNames().stream()
            .filter(coreName -> requestedCoreName == null || coreName.equals(requestedCoreName))
            .filter(this::isMasterOrStandalone)
            .forEach(coreName ->
                    wrapper.response.add(
                                coreName,
                                fixOnSpecificCore(coreName, fromTxCommitTime, toTxCommitTime, dryRun, maxTransactionsToSchedule)));

    if (wrapper.response.size() > 0)
    {
        wrapper.response.add(DRY_RUN_PARAMETER_NAME, dryRun);

        ofNullable(fromTxCommitTime).ifPresent(value -> wrapper.response.add(FROM_TX_COMMIT_TIME_PARAMETER_NAME, value));
        ofNullable(toTxCommitTime).ifPresent(value -> wrapper.response.add(TO_TX_COMMIT_TIME_PARAMETER_NAME, value));

        wrapper.response.add(MAX_TRANSACTIONS_TO_SCHEDULE_PARAMETER_NAME, maxTransactionsToSchedule);
        wrapper.response.add(ACTION_STATUS_LABEL, dryRun ? ACTION_STATUS_NOT_SCHEDULED : ACTION_STATUS_SCHEDULED);
    }

    return wrapper.response;
}