Class SearchParam.Builder

  • Enclosing class:
    SearchParam

    public static class SearchParam.Builder
    extends java.lang.Object
    Builder for SearchParam
    • Constructor Detail

      • Builder

        public Builder​(@Nonnull
                       java.lang.String collectionName)
        Parameters:
        collectionName - collection to search from
    • Method Detail

      • withFloatVectors

        public SearchParam.Builder withFloatVectors​(@Nonnull
                                                    java.util.List<java.util.List<java.lang.Float>> floatVectors)
        Default to an empty ArrayList. You can search either float or binary vectors, not both.
        Parameters:
        floatVectors - a List of float vectors to be queries. Each inner List represents a float vector.
        Returns:
        Builder
      • withBinaryVectors

        public SearchParam.Builder withBinaryVectors​(@Nonnull
                                                     java.util.List<java.nio.ByteBuffer> binaryVectors)
        Default to an empty ArrayList. You can search either float or binary vectors, not both.
        Parameters:
        binaryVectors - a List of binary vectors to be queried. Each ByteBuffer object represents a binary vector, with every 8 bits constituting a byte.
        Returns:
        Builder
        See Also:
        ByteBuffer
      • withPartitionTags

        public SearchParam.Builder withPartitionTags​(@Nonnull
                                                     java.util.List<java.lang.String> partitionTags)
        Optional. Search vectors with corresponding partitionTags. Default to an empty List
        Parameters:
        partitionTags - a List of partition tags
        Returns:
        Builder
      • withTopK

        public SearchParam.Builder withTopK​(long topK)
        Optional. Limits search result to topK. Default to 1024.
        Parameters:
        topK - a topK number
        Returns:
        Builder
      • withParamsInJson

        public SearchParam.Builder withParamsInJson​(@Nonnull
                                                    java.lang.String paramsInJson)
        Optional. Default to empty String. Search parameters are different for different index types. Refer to https://milvus.io/docs/milvus_operation.md for more information.
           FLAT/IVFLAT/SQ8/IVFPQ: {"nprobe": 32}
           nprobe range:[1,999999]
        
           NSG: {"search_length": 100}
           search_length range:[10, 300]
        
           HNSW: {"ef": 64}
           ef range:[topk, 4096]
        
           ANNOY: {search_k", 0.05 * totalDataCount}
           search_k range: none
         
        Parameters:
        paramsInJson - extra parameters in JSON format
        Returns:
        Builder