# qdrant
import "github.com/ansys/aali-flowkit/pkg/privatefunctions/qdrant"
## Index
- [func CreateCollectionIfNotExists\(ctx context.Context, client \*qdrant.Client, collectionName string, vectorsConfig \*qdrant.VectorsConfig, sparseVectorsConfig \*qdrant.SparseVectorConfig\) error](<#CreateCollectionIfNotExists>)
- [func DbFiltersAsQdrant\(dbFilters sharedtypes.DbFilters\) \*qdrant.Filter](<#DbFiltersAsQdrant>)
- [func QdrantClient\(\) \(\*qdrant.Client, error\)](<#QdrantClient>)
- [func QdrantPayloadToMap\(payload map\[string\]\*qdrant.Value\) map\[string\]any](<#QdrantPayloadToMap>)
- [func QdrantPayloadToType\[T any\]\(payload map\[string\]\*qdrant.Value\) \(T, error\)](<#QdrantPayloadToType>)
- [func RetrieveChildNodes\(ctx \*logging.ContextMap, client \*qdrant.Client, collectionName string, data \*\[\]sharedtypes.DbResponse\) \(funcError error\)](<#RetrieveChildNodes>)
- [func RetrieveDirectSiblingNodes\(ctx \*logging.ContextMap, client \*qdrant.Client, collectionName string, data \*\[\]sharedtypes.DbResponse\) \(funcError error\)](<#RetrieveDirectSiblingNodes>)
- [func RetrieveLeafNodes\(ctx \*logging.ContextMap, client \*qdrant.Client, collectionName string, data \*\[\]sharedtypes.DbResponse\) \(funcError error\)](<#RetrieveLeafNodes>)
- [func RetrieveParentNodes\(ctx \*logging.ContextMap, client \*qdrant.Client, collectionName string, data \*\[\]sharedtypes.DbResponse\) \(funcError error\)](<#RetrieveParentNodes>)
- [func ToQdrantPayload\[T any\]\(t T\) \(map\[string\]\*qdrant.Value, error\)](<#ToQdrantPayload>)
- [func VectorDistance\(distance string\) qdrant.Distance](<#VectorDistance>)
- [type AsQdrantFilterConditions](<#AsQdrantFilterConditions>)
## func CreateCollectionIfNotExists
func CreateCollectionIfNotExists(ctx context.Context, client *qdrant.Client, collectionName string, vectorsConfig *qdrant.VectorsConfig, sparseVectorsConfig *qdrant.SparseVectorConfig) error
## func DbFiltersAsQdrant
func DbFiltersAsQdrant(dbFilters sharedtypes.DbFilters) *qdrant.Filter
Transform \`sharedtypes.DbFilters\` into a qdrant filter.
## func QdrantClient
func QdrantClient() (*qdrant.Client, error)
Create a new qdrant client from your config.
## func QdrantPayloadToMap
func QdrantPayloadToMap(payload map[string]*qdrant.Value) map[string]any
## func QdrantPayloadToType
func QdrantPayloadToType[T any](payload map[string]*qdrant.Value) (T, error)
## func RetrieveChildNodes
func RetrieveChildNodes(ctx *logging.ContextMap, client *qdrant.Client, collectionName string, data *[]sharedtypes.DbResponse) (funcError error)
RetrieveChildNodes retrieves the child nodes for each of the documents provided.
Parameters:
- ctx: ContextMap.
- client: the qdrant client
- collectionName: Name of the collection in the qdrant database to retrieve the children from.
- data: Data to retrieve the children for.
Returns:
- error: Error if any issue occurs while retrieving the children.
## func RetrieveDirectSiblingNodes
func RetrieveDirectSiblingNodes(ctx *logging.ContextMap, client *qdrant.Client, collectionName string, data *[]sharedtypes.DbResponse) (funcError error)
RetrieveDirectSiblingNodes retrieves the nodes associated with the next & previous sibling \(if any\) for each of the documents provided.
Parameters:
- ctx: ContextMap.
- client: the qdrant client
- collectionName: Name of the collection in the qdrant database to retrieve the siblings from.
- data: Data to retrieve the siblings for.
Returns:
- error: Error if any issue occurs while retrieving the siblings.
## func RetrieveLeafNodes
func RetrieveLeafNodes(ctx *logging.ContextMap, client *qdrant.Client, collectionName string, data *[]sharedtypes.DbResponse) (funcError error)
RetrieveLeafNodes retrieves all leaf nodes from the similarity search result branch \(ultimate children containing the original document\).
Parameters:
- ctx: ContextMap.
- client: the qdrant client
- collectionName: Name of the collection in the qdrant database to retrieve the leaves from.
- data: Data to retrieve the leaf nodes for.
Returns:
- error: Error if any issue occurs while retrieving the leaves.
## func RetrieveParentNodes
func RetrieveParentNodes(ctx *logging.ContextMap, client *qdrant.Client, collectionName string, data *[]sharedtypes.DbResponse) (funcError error)
RetrieveParentNodes retrieves the parent node for each of the documents provided.
Parameters:
- ctx: ContextMap.
- client: the qdrant client
- collectionName: Name of the collection in the qdrant database to retrieve the parents from.
- data: Data to retrieve the parent nodes for.
Returns:
- error: Error if any issue occurs while retrieving the parents.
## func ToQdrantPayload
func ToQdrantPayload[T any](t T) (map[string]*qdrant.Value, error)
## func VectorDistance
func VectorDistance(distance string) qdrant.Distance
Get a qdrant vector distance metric from string
Available options are:
- cosine
- dot
- euclid
- manhattan
## type AsQdrantFilterConditions
type AsQdrantFilterConditions interface {
AsQdrantFilterConditions(field string) []*qdrant.Condition
}
Generated by [gomarkdoc]()