Package org.zvec.binding
Class IndexParams
java.lang.Object
org.zvec.binding.IndexParams
- All Implemented Interfaces:
AutoCloseable
High-level wrapper for
zvec_index_params_t.
Use the static factory methods to create type-specific parameters:
createHNSW(MetricType, int, int)createHNSWQuantized(MetricType, int, int, QuantizeType)createIVF(MetricType, int, int, boolean)createFlat(MetricType)createDiskAnn(MetricType, int, int, int)createDiskAnnQuantized(MetricType, int, int, int, QuantizeType)createIvfRabitq(MetricType, int, int, int)createVamana(MetricType, int, int, float, boolean, boolean)createInvert(boolean, boolean)createFTS(String, String[], String)
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static IndexParamscreateDiskAnn(MetricType metricType, int maxDegree, int listSize, int pqChunkNum) Create DiskANN index parameters.static IndexParamscreateDiskAnnQuantized(MetricType metricType, int maxDegree, int listSize, int pqChunkNum, QuantizeType quantizeType) static IndexParamscreateFlat(MetricType metricType) static IndexParamsCreate an FTS (full-text search) index parameter set.static IndexParamscreateHNSW(MetricType metricType, int m, int efConstruction) static IndexParamscreateHNSWQuantized(MetricType metricType, int m, int efConstruction, QuantizeType quantizeType) static IndexParamscreateInvert(boolean enableRangeOpt, boolean enableWildcard) static IndexParamscreateIVF(MetricType metricType, int nList, int nIters, boolean useSoar) static IndexParamscreateIvfRabitq(MetricType metricType, int nlist, int totalBits, int sampleCount) Create IVF RaBitQ index parameters.static IndexParamscreateVamana(MetricType metricType, int maxDegree, int searchListSize, float alpha, boolean saturateGraph, boolean useContiguousMemory) Create Vamana index parameters.voiddestroy()intintintString[]Returns FTS params as an array: [tokenizerName, filters..., extraParams].intintgetHNSWM()boolean[]Returns Invert params as an array: [enableRangeOpt, enableWildcard].int[]Returns IVF params as an array: [nList, nIters, useSoar (0 or 1)].int[]Returns IVF RaBitQ params as an array: [nlist, totalBits, sampleCount].getType()Object[]Returns Vamana params: [maxDegree, searchListSize, alpha, saturateGraph, useContiguousMemory].booleanWhether Vamana two-pass graph construction is enabled.voidsetDiskAnnParams(int maxDegree, int listSize, int pqChunkNum) voidsetHNSWParams(int m, int efConstruction) voidsetInvertParams(boolean enableRangeOpt, boolean enableWildcard) voidsetIVFParams(int nList, int nIters, boolean useSoar) voidsetIvfRabitqParams(int nlist, int totalBits, int sampleCount) voidsetMetricType(MetricType metricType) voidsetQuantizeType(QuantizeType quantizeType) voidsetVamanaParams(int maxDegree, int searchListSize, float alpha, boolean saturateGraph, boolean useContiguousMemory) voidsetVamanaTwoPassBuild(boolean twoPassBuild) Enable or disable Vamana two-pass graph construction (VAMANA params only).
-
Method Details
-
createHNSW
-
createHNSWQuantized
public static IndexParams createHNSWQuantized(MetricType metricType, int m, int efConstruction, QuantizeType quantizeType) -
createIVF
-
createFlat
-
createDiskAnn
public static IndexParams createDiskAnn(MetricType metricType, int maxDegree, int listSize, int pqChunkNum) Create DiskANN index parameters.- Parameters:
metricType- distance metricmaxDegree- graph connectivity (max degree of the Vamana graph)listSize- build-time list size (candidate list during construction)pqChunkNum- PQ chunk count (0 disables PQ)
-
createDiskAnnQuantized
public static IndexParams createDiskAnnQuantized(MetricType metricType, int maxDegree, int listSize, int pqChunkNum, QuantizeType quantizeType) -
createIvfRabitq
public static IndexParams createIvfRabitq(MetricType metricType, int nlist, int totalBits, int sampleCount) Create IVF RaBitQ index parameters.- Parameters:
metricType- distance metricnlist- number of cluster centerstotalBits- total bits for RaBitQ quantizationsampleCount- sample count for training; 0 means use all vectors
-
createVamana
public static IndexParams createVamana(MetricType metricType, int maxDegree, int searchListSize, float alpha, boolean saturateGraph, boolean useContiguousMemory) Create Vamana index parameters.- Parameters:
metricType- distance metricmaxDegree- maximum out-degreesearchListSize- construction candidate list sizealpha- RobustPrune alpha factor (e.g. 1.2)saturateGraph- force every node to reach max_degreeuseContiguousMemory- allocate a contiguous memory arena
-
createInvert
-
createFTS
Create an FTS (full-text search) index parameter set.- Parameters:
tokenizerName- tokenizer name, e.g. "standard"filters- filter chain, e.g.new String[]{"lowercase"}extraParams- optional extra params JSON (may be null)
-
getType
-
getMetricType
-
setMetricType
-
getQuantizeType
-
setQuantizeType
-
getHNSWM
public int getHNSWM() -
getHNSWEfConstruction
public int getHNSWEfConstruction() -
setHNSWParams
public void setHNSWParams(int m, int efConstruction) -
setIVFParams
public void setIVFParams(int nList, int nIters, boolean useSoar) -
getIVFParams
public int[] getIVFParams()Returns IVF params as an array: [nList, nIters, useSoar (0 or 1)]. -
setDiskAnnParams
public void setDiskAnnParams(int maxDegree, int listSize, int pqChunkNum) -
getDiskAnnMaxDegree
public int getDiskAnnMaxDegree() -
getDiskAnnListSize
public int getDiskAnnListSize() -
getDiskAnnPqChunkNum
public int getDiskAnnPqChunkNum() -
setIvfRabitqParams
public void setIvfRabitqParams(int nlist, int totalBits, int sampleCount) -
getIvfRabitqParams
public int[] getIvfRabitqParams()Returns IVF RaBitQ params as an array: [nlist, totalBits, sampleCount]. -
setVamanaParams
public void setVamanaParams(int maxDegree, int searchListSize, float alpha, boolean saturateGraph, boolean useContiguousMemory) -
getVamanaParams
Returns Vamana params: [maxDegree, searchListSize, alpha, saturateGraph, useContiguousMemory]. -
setVamanaTwoPassBuild
public void setVamanaTwoPassBuild(boolean twoPassBuild) Enable or disable Vamana two-pass graph construction (VAMANA params only). -
getVamanaTwoPassBuild
public boolean getVamanaTwoPassBuild()Whether Vamana two-pass graph construction is enabled. -
getInvertParams
public boolean[] getInvertParams()Returns Invert params as an array: [enableRangeOpt, enableWildcard]. -
setInvertParams
public void setInvertParams(boolean enableRangeOpt, boolean enableWildcard) -
getFTSParams
Returns FTS params as an array: [tokenizerName, filters..., extraParams]. -
destroy
public void destroy() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-