示例#1
0
  private Documents<FindDocument> executeQuery(
      final AciService aciService, final AciParameters aciParameters) {
    QueryResponseData responseData;
    try {
      responseData = aciService.executeAction(aciParameters, queryResponseProcessor);
    } catch (final AciErrorException e) {
      final String errorString = e.getErrorString();
      if (MISSING_RULE_ERROR.equals(errorString) || INVALID_RULE_ERROR.equals(errorString)) {
        aciParameters.remove(QmsActionParams.Blacklist.name());
        responseData = aciService.executeAction(aciParameters, queryResponseProcessor);
      } else {
        throw e;
      }
    }

    final List<Hit> hits = responseData.getHit();
    final List<FindDocument> results = parseQueryHits(hits);
    return new Documents<>(results, responseData.getTotalhits(), null);
  }
示例#2
0
  @Override
  public List<FindDocument> findSimilar(final Set<String> indexes, final String reference)
      throws AciErrorException {
    final AciParameters aciParameters = new AciParameters(QueryActions.Suggest.name());
    aciParameters.add(SuggestParams.Reference.name(), new Reference(reference));
    if (!indexes.isEmpty()) {
      aciParameters.add(SuggestParams.DatabaseMatch.name(), new Databases(indexes));
    }
    aciParameters.add(SuggestParams.Print.name(), PrintParam.None);
    aciParameters.add(SuggestParams.MaxResults.name(), MAX_SIMILAR_DOCUMENTS);
    aciParameters.add(SuggestParams.Summary.name(), SummaryParam.Concept);

    final SuggestResponseData responseData =
        contentAciService.executeAction(aciParameters, suggestResponseProcessor);
    final List<Hit> hits = responseData.getHit();
    return parseQueryHits(hits);
  }