All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yahoo.schema.parser.ParsedIndex Maven / Gradle / Ivy

There is a newer version: 8.441.21
Show newest version
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.schema.parser;

import com.yahoo.schema.document.HnswIndexParams;
import com.yahoo.schema.document.Stemming;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

/**
 * This class holds the extracted information after parsing an "index"
 * block, using simple data structures as far as possible.  Do not put
 * advanced logic here!
 * @author arnej27959
 **/
public class ParsedIndex extends ParsedBlock {

    private Boolean enableBm25 = null;
    private Boolean isPrefix = null;
    private HnswIndexParams hnswParams = null;
    private final List aliases = new ArrayList<>();
    private Stemming stemming = null;
    private Integer arity = null;
    private Long lowerBound = null;
    private Long upperBound = null;
    private Double densePLT = null;
    
    public ParsedIndex(String name) {
        super(name, "index");
    }

    Optional getEnableBm25() { return Optional.ofNullable(this.enableBm25); }
    Optional getPrefix() { return Optional.ofNullable(this.isPrefix); }
    Optional getHnswIndexParams() { return Optional.ofNullable(this.hnswParams); }
    List getAliases() { return List.copyOf(aliases); }
    boolean hasStemming() { return stemming != null; }
    Optional getStemming() { return Optional.ofNullable(stemming); }
    Optional getArity() { return Optional.ofNullable(this.arity); }
    Optional getLowerBound() { return Optional.ofNullable(this.lowerBound); }
    Optional getUpperBound() { return Optional.ofNullable(this.upperBound); }
    Optional getDensePostingListThreshold() { return Optional.ofNullable(this.densePLT); }

    public void addAlias(String alias) {
        aliases.add(alias);
    }

    public void setArity(int arity) {
        this.arity = arity;
    }

    public void setDensePostingListThreshold(double threshold) {
        this.densePLT = threshold;
    }

    public void setEnableBm25(boolean value) {
        this.enableBm25 = value;
    }

    public void setHnswIndexParams(HnswIndexParams params) {
        this.hnswParams = params;
    }

    public void setLowerBound(long value) {
        this.lowerBound = value;
    }

    public void setPrefix(boolean value) {
        this.isPrefix = value;
    }

    public void setStemming(Stemming stemming) {
        this.stemming = stemming;
    }

    public void setUpperBound(long value) {
        this.upperBound = value;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy