code: @Override
      public void addDocument(@NotNull Document document) {
          if (documentsCache != null && rankingAlgorithm != null && documentIndexCache != null) {
              Set<FacetRank> facetRanks = rankingAlgorithm.calculate(buildFacets(document));
  
              documentsCache.put(document.getId(), document);
              documentIndexCache.put(document.getId(), new DocumentIndex(document, facetRanks));
          }
      }
docs: {@inheritDoc}