Class HibernateEmbeddingStore.BaseBuilder<E>
java.lang.Object
dev.langchain4j.store.embedding.hibernate.HibernateEmbeddingStore.BaseBuilder<E>
- Direct Known Subclasses:
HibernateEmbeddingStore.DynamicBuilder, HibernateEmbeddingStore.DynamicDatasourceBuilder
- Enclosing class:
HibernateEmbeddingStore<E>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Booleanprotected Booleanprotected DatabaseKindprotected Integerprotected DistanceFunctionprotected Booleanprotected Stringprotected Stringprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.hibernate.cfg.Configurationprotected org.hibernate.cfg.ConfigurationcreateConfiguration(DatabaseKind databaseKind) Creates the Hibernate configuration for the embedding table.createIndex(Boolean createIndex) protected org.hibernate.SessionFactorycreateSessionFactory(org.hibernate.cfg.Configuration cfg, DatabaseKind databaseKind) createTable(Boolean createTable) databaseKind(DatabaseKind databaseKind) distanceFunction(DistanceFunction distanceFunction) dropTableFirst(Boolean dropTableFirst) indexOptions(String indexOptions) queryHints(Map<String, Object> queryHints) Sets query hints that are applied to every similarity search (search(...)andquery(...)).
-
Field Details
-
databaseKind
-
table
-
dimension
-
createIndex
-
indexType
-
indexOptions
-
createTable
-
dropTableFirst
-
distanceFunction
-
queryHints
-
-
Constructor Details
-
BaseBuilder
public BaseBuilder()
-
-
Method Details
-
createConfiguration
protected org.hibernate.cfg.Configuration createConfiguration() -
createConfiguration
Creates the Hibernate configuration for the embedding table.- Parameters:
databaseKind- the database kind of the store, which provides the index options of the table, seeDatabaseKind.tableIndexOptions(boolean, DistanceFunction, String, String, String, String), ornullfor no index options- Returns:
- the configuration
-
createSessionFactory
protected org.hibernate.SessionFactory createSessionFactory(org.hibernate.cfg.Configuration cfg, DatabaseKind databaseKind) -
databaseKind
-
table
-
dimension
-
createIndex
-
indexType
-
indexOptions
-
createTable
-
dropTableFirst
-
distanceFunction
-
queryHints
Sets query hints that are applied to every similarity search (search(...)andquery(...)). They are not applied when embeddings are added or removed.Each entry is passed to Hibernate's
SelectionQuery.setHint(String, Object). The value ofHibernateHints.HINT_QUERY_DATABASEis written into the generated query, so it is specific to one database. To pass more than one such database hint, use aCollectionofStrings as the value.A database kind can add default hints, see
DatabaseKind.defaultQueryHints(). A hint set here replaces the default hint with the same name. For example, a Milvus search uses the session consistency level by default, so it sees the embeddings that this application added just before it. To also see the embeddings that other applications added just before it, use the strong consistency level:.queryHints(Map.of(HibernateHints.HINT_QUERY_DATABASE, MilvusDatabaseHints.CONSISTENCY_LEVEL + "=STRONG"))- Parameters:
queryHints- the query hints, ornullfor only the default hints of the database kind- Returns:
- this builder
-