Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -696,18 +696,19 @@ public String getEqualToFilter(EqualToFilterClause filterClause) {
@Override
public String getAnyTagEqualToFilter(AnyTagEqualToFilterClause filterClause) {
String fieldName = JDBCVectorStoreQueryProvider
.validateSQLidentifier(filterClause.getFieldName());
.validateSQLidentifier(filterClause.getFieldName());

return String.format("%s LIKE ?", fieldName);
}

@Override
public <Record> VectorStoreRecordMapper<Record, ResultSet> getVectorStoreRecordMapper(Class<Record> recordClass,
VectorStoreRecordDefinition recordDefinition) {
public <Record> VectorStoreRecordMapper<Record, ResultSet> getVectorStoreRecordMapper(
Class<Record> recordClass,
VectorStoreRecordDefinition recordDefinition) {
return JDBCVectorStoreRecordMapper.<Record>builder()
.withRecordClass(recordClass)
.withVectorStoreRecordDefinition(recordDefinition)
.build();
.withRecordClass(recordClass)
.withVectorStoreRecordDefinition(recordDefinition)
.build();
}

/**
Expand Down Expand Up @@ -765,5 +766,4 @@ public JDBCVectorStoreQueryProvider build() {
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ <Record> VectorSearchResults<Record> search(String collectionName,
* @return the record mapper that maps JDBC result sets to the given record.
*/
<Record> VectorStoreRecordMapper<Record, ResultSet> getVectorStoreRecordMapper(
final Class<Record> recordClass,
final VectorStoreRecordDefinition recordDefinition);
final Class<Record> recordClass,
final VectorStoreRecordDefinition recordDefinition);

/**
* The builder for the JDBC vector store query provider.
Expand Down
7 changes: 7 additions & 0 deletions data/semantickernel-data-oracle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -442,18 +442,19 @@ public List<Object> getFilterParameters(VectorSearchFilter filter) {
@Override
public String getAnyTagEqualToFilter(AnyTagEqualToFilterClause filterClause) {
String fieldName = JDBCVectorStoreQueryProvider
.validateSQLidentifier(filterClause.getFieldName());
.validateSQLidentifier(filterClause.getFieldName());

return String.format("%s @> ?::jsonb", fieldName);
}

@Override
public <Record> VectorStoreRecordMapper<Record, ResultSet> getVectorStoreRecordMapper(Class<Record> recordClass,
VectorStoreRecordDefinition recordDefinition) {
public <Record> VectorStoreRecordMapper<Record, ResultSet> getVectorStoreRecordMapper(
Class<Record> recordClass,
VectorStoreRecordDefinition recordDefinition) {
return PostgreSQLVectorStoreRecordMapper.<Record>builder()
.withRecordClass(recordClass)
.withVectorStoreRecordDefinition(recordDefinition)
.build();
.withRecordClass(recordClass)
.withVectorStoreRecordDefinition(recordDefinition)
.build();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@ public static void main(String[] args) throws SQLException {
.build();

// Get a collection from the vector store
VectorStoreRecordCollection<String, Hotel> collection =
vectorStore.getCollection("skhotels",
JDBCVectorStoreRecordCollectionOptions.<Hotel>builder()
.withRecordClass(Hotel.class)
.build());
VectorStoreRecordCollection<String, Hotel> collection = vectorStore.getCollection(
"skhotels",
JDBCVectorStoreRecordCollectionOptions.<Hotel>builder()
.withRecordClass(Hotel.class)
.build());

// Create the collection if it doesn't exist yet.
collection.createCollectionAsync().block();

collection.upsertAsync(new Hotel("1",
"HotelOne",
"Desc for HotelOne",
Collections.emptyList(), Collections.emptyList()),
null)
"HotelOne",
"Desc for HotelOne",
Collections.emptyList(), Collections.emptyList()),
null)
.block();

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@

public class Book {

public Book() {}
public Book() {
}

public Book(String isbn, String title, String author, int pages,
List<String> tags, String summary, List<Float> summaryEmbedding) {
Expand Down Expand Up @@ -60,7 +61,7 @@ public Book(String isbn, String title, String author, int pages,
@VectorStoreRecordData(isFilterable = true)
private List<String> tags;

@VectorStoreRecordData( isFilterable = true, isFullTextSearchable = true )
@VectorStoreRecordData(isFilterable = true, isFullTextSearchable = true)
private String summary;

@VectorStoreRecordVector(dimensions = 2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,11 @@ public static VectorStoreRecordDefinition fromRecordClass(Class<?> recordClass)
dataFields.add(VectorStoreRecordDataField.builder()
.withName(field.getName())
.withStorageName(storageName)
.withFieldType(field.getType(), List.class.equals(field.getType()) ? (Class<?>)((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0] : null)
.withFieldType(field.getType(),
List.class.equals(field.getType())
? (Class<?>) ((ParameterizedType) field.getGenericType())
.getActualTypeArguments()[0]
: null)
.isFilterable(dataAttribute.isFilterable())
.build());
}
Expand All @@ -210,7 +214,11 @@ public static VectorStoreRecordDefinition fromRecordClass(Class<?> recordClass)
vectorFields.add(VectorStoreRecordVectorField.builder()
.withName(field.getName())
.withStorageName(storageName)
.withFieldType(field.getType(), List.class.equals(field.getType()) ? (Class<?>)((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0] : null)
.withFieldType(field.getType(),
List.class.equals(field.getType())
? (Class<?>) ((ParameterizedType) field.getGenericType())
.getActualTypeArguments()[0]
: null)
.withDimensions(vectorAttribute.dimensions())
.withIndexKind(vectorAttribute.indexKind())
.withDistanceFunction(vectorAttribute.distanceFunction())
Expand Down
5 changes: 5 additions & 0 deletions semantickernel-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@
<artifactId>semantickernel-data-hsqldb</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.microsoft.semantic-kernel</groupId>
<artifactId>semantickernel-data-oracle</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.microsoft.semantic-kernel</groupId>
<artifactId>semantickernel-data-redis</artifactId>
Expand Down
Loading