예제 #1
0
  @Inject
  public PercolatorService(
      Settings settings,
      IndicesService indicesService,
      CacheRecycler cacheRecycler,
      PageCacheRecycler pageCacheRecycler,
      BigArrays bigArrays,
      HighlightPhase highlightPhase,
      ClusterService clusterService,
      FacetPhase facetPhase,
      AggregationPhase aggregationPhase,
      ScriptService scriptService,
      MappingUpdatedAction mappingUpdatedAction) {
    super(settings);
    this.indicesService = indicesService;
    this.cacheRecycler = cacheRecycler;
    this.pageCacheRecycler = pageCacheRecycler;
    this.bigArrays = bigArrays;
    this.clusterService = clusterService;
    this.highlightPhase = highlightPhase;
    this.facetPhase = facetPhase;
    this.aggregationPhase = aggregationPhase;
    this.scriptService = scriptService;
    this.mappingUpdatedAction = mappingUpdatedAction;
    this.sortParseElement = new SortParseElement();

    final long maxReuseBytes =
        settings
            .getAsBytesSize(
                "indices.memory.memory_index.size_per_thread",
                new ByteSizeValue(1, ByteSizeUnit.MB))
            .bytes();
    cache =
        new CloseableThreadLocal<MemoryIndex>() {
          @Override
          protected MemoryIndex initialValue() {
            return new ExtendedMemoryIndex(true, maxReuseBytes);
          }
        };
    single = new SingleDocumentPercolatorIndex(cache);
    multi = new MultiDocumentPercolatorIndex(cache);

    percolatorTypes = new ByteObjectOpenHashMap<>(6);
    percolatorTypes.put(countPercolator.id(), countPercolator);
    percolatorTypes.put(queryCountPercolator.id(), queryCountPercolator);
    percolatorTypes.put(matchPercolator.id(), matchPercolator);
    percolatorTypes.put(queryPercolator.id(), queryPercolator);
    percolatorTypes.put(scoringPercolator.id(), scoringPercolator);
    percolatorTypes.put(topMatchingPercolator.id(), topMatchingPercolator);
  }
예제 #2
0
 public ReduceResult reduce(byte percolatorTypeId, List<PercolateShardResponse> shardResults) {
   PercolatorType percolatorType = percolatorTypes.get(percolatorTypeId);
   return percolatorType.reduce(shardResults);
 }