-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unstructured index distance metric fix (#772)
- Loading branch information
Showing
22 changed files
with
1,507 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
tests/core/structured_vespa_index/test_schemas/structured_distance_metric_angular.sd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
schema marqo__test_00structured_00schema_00distance_00metric { | ||
document { | ||
field marqo__id type string { | ||
indexing: attribute | summary | ||
attribute: fast-search | ||
rank: filter | ||
} | ||
field title type string { | ||
indexing: summary | ||
} | ||
field description type string { | ||
indexing: summary | ||
} | ||
field marqo__chunks_title type array<string> { | ||
indexing: attribute | summary | ||
} | ||
field marqo__embeddings_title type tensor<float>(p{}, x[512]) { | ||
indexing: attribute | index | summary | ||
attribute { distance-metric: angular } | ||
index { hnsw { | ||
max-links-per-node: 16 | ||
neighbors-to-explore-at-insert: 100 | ||
}} | ||
} | ||
field marqo__chunks_description type array<string> { | ||
indexing: attribute | summary | ||
} | ||
field marqo__embeddings_description type tensor<float>(p{}, x[512]) { | ||
indexing: attribute | index | summary | ||
attribute { distance-metric: angular } | ||
index { hnsw { | ||
max-links-per-node: 16 | ||
neighbors-to-explore-at-insert: 100 | ||
}} | ||
} | ||
field marqo__vector_count type int { indexing: attribute | summary } | ||
} | ||
rank-profile embedding_similarity inherits default { | ||
inputs { | ||
query(marqo__query_embedding) tensor<float>(x[512]) | ||
query(title): 0 | ||
query(description): 0 | ||
} | ||
first-phase { | ||
expression: max(if(query(title) > 0, closeness(field, marqo__embeddings_title), 0), if(query(description) > 0, closeness(field, marqo__embeddings_description), 0)) | ||
} | ||
match-features: closest(marqo__embeddings_title) closest(marqo__embeddings_description) distance(field, marqo__embeddings_title) distance(field, marqo__embeddings_description) | ||
} | ||
document-summary all-non-vector-summary { | ||
summary marqo__id type string { } | ||
summary title type string { source: title } | ||
summary description type string { source: description } | ||
summary marqo__chunks_title type array<string> { } | ||
summary marqo__chunks_description type array<string> { } | ||
} | ||
document-summary all-vector-summary { | ||
summary marqo__id type string { } | ||
summary title type string { source: title } | ||
summary description type string { source: description } | ||
summary marqo__chunks_title type array<string> { } | ||
summary marqo__chunks_description type array<string> { } | ||
summary marqo__embeddings_title type tensor<float>(p{}, x[512]) { } | ||
summary marqo__embeddings_description type tensor<float>(p{}, x[512]) { } | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
tests/core/structured_vespa_index/test_schemas/structured_distance_metric_dotproduct.sd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
schema marqo__test_00structured_00schema_00distance_00metric { | ||
document { | ||
field marqo__id type string { | ||
indexing: attribute | summary | ||
attribute: fast-search | ||
rank: filter | ||
} | ||
field title type string { | ||
indexing: summary | ||
} | ||
field description type string { | ||
indexing: summary | ||
} | ||
field marqo__chunks_title type array<string> { | ||
indexing: attribute | summary | ||
} | ||
field marqo__embeddings_title type tensor<float>(p{}, x[512]) { | ||
indexing: attribute | index | summary | ||
attribute { distance-metric: dotproduct } | ||
index { hnsw { | ||
max-links-per-node: 16 | ||
neighbors-to-explore-at-insert: 100 | ||
}} | ||
} | ||
field marqo__chunks_description type array<string> { | ||
indexing: attribute | summary | ||
} | ||
field marqo__embeddings_description type tensor<float>(p{}, x[512]) { | ||
indexing: attribute | index | summary | ||
attribute { distance-metric: dotproduct } | ||
index { hnsw { | ||
max-links-per-node: 16 | ||
neighbors-to-explore-at-insert: 100 | ||
}} | ||
} | ||
field marqo__vector_count type int { indexing: attribute | summary } | ||
} | ||
rank-profile embedding_similarity inherits default { | ||
inputs { | ||
query(marqo__query_embedding) tensor<float>(x[512]) | ||
query(title): 0 | ||
query(description): 0 | ||
} | ||
first-phase { | ||
expression: max(if(query(title) > 0, closeness(field, marqo__embeddings_title), 0), if(query(description) > 0, closeness(field, marqo__embeddings_description), 0)) | ||
} | ||
match-features: closest(marqo__embeddings_title) closest(marqo__embeddings_description) distance(field, marqo__embeddings_title) distance(field, marqo__embeddings_description) | ||
} | ||
document-summary all-non-vector-summary { | ||
summary marqo__id type string { } | ||
summary title type string { source: title } | ||
summary description type string { source: description } | ||
summary marqo__chunks_title type array<string> { } | ||
summary marqo__chunks_description type array<string> { } | ||
} | ||
document-summary all-vector-summary { | ||
summary marqo__id type string { } | ||
summary title type string { source: title } | ||
summary description type string { source: description } | ||
summary marqo__chunks_title type array<string> { } | ||
summary marqo__chunks_description type array<string> { } | ||
summary marqo__embeddings_title type tensor<float>(p{}, x[512]) { } | ||
summary marqo__embeddings_description type tensor<float>(p{}, x[512]) { } | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
tests/core/structured_vespa_index/test_schemas/structured_distance_metric_euclidean.sd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
schema marqo__test_00structured_00schema_00distance_00metric { | ||
document { | ||
field marqo__id type string { | ||
indexing: attribute | summary | ||
attribute: fast-search | ||
rank: filter | ||
} | ||
field title type string { | ||
indexing: summary | ||
} | ||
field description type string { | ||
indexing: summary | ||
} | ||
field marqo__chunks_title type array<string> { | ||
indexing: attribute | summary | ||
} | ||
field marqo__embeddings_title type tensor<float>(p{}, x[512]) { | ||
indexing: attribute | index | summary | ||
attribute { distance-metric: euclidean } | ||
index { hnsw { | ||
max-links-per-node: 16 | ||
neighbors-to-explore-at-insert: 100 | ||
}} | ||
} | ||
field marqo__chunks_description type array<string> { | ||
indexing: attribute | summary | ||
} | ||
field marqo__embeddings_description type tensor<float>(p{}, x[512]) { | ||
indexing: attribute | index | summary | ||
attribute { distance-metric: euclidean } | ||
index { hnsw { | ||
max-links-per-node: 16 | ||
neighbors-to-explore-at-insert: 100 | ||
}} | ||
} | ||
field marqo__vector_count type int { indexing: attribute | summary } | ||
} | ||
rank-profile embedding_similarity inherits default { | ||
inputs { | ||
query(marqo__query_embedding) tensor<float>(x[512]) | ||
query(title): 0 | ||
query(description): 0 | ||
} | ||
first-phase { | ||
expression: max(if(query(title) > 0, closeness(field, marqo__embeddings_title), 0), if(query(description) > 0, closeness(field, marqo__embeddings_description), 0)) | ||
} | ||
match-features: closest(marqo__embeddings_title) closest(marqo__embeddings_description) distance(field, marqo__embeddings_title) distance(field, marqo__embeddings_description) | ||
} | ||
document-summary all-non-vector-summary { | ||
summary marqo__id type string { } | ||
summary title type string { source: title } | ||
summary description type string { source: description } | ||
summary marqo__chunks_title type array<string> { } | ||
summary marqo__chunks_description type array<string> { } | ||
} | ||
document-summary all-vector-summary { | ||
summary marqo__id type string { } | ||
summary title type string { source: title } | ||
summary description type string { source: description } | ||
summary marqo__chunks_title type array<string> { } | ||
summary marqo__chunks_description type array<string> { } | ||
summary marqo__embeddings_title type tensor<float>(p{}, x[512]) { } | ||
summary marqo__embeddings_description type tensor<float>(p{}, x[512]) { } | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
tests/core/structured_vespa_index/test_schemas/structured_distance_metric_geodegrees.sd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
schema marqo__test_00structured_00schema_00distance_00metric { | ||
document { | ||
field marqo__id type string { | ||
indexing: attribute | summary | ||
attribute: fast-search | ||
rank: filter | ||
} | ||
field title type string { | ||
indexing: summary | ||
} | ||
field description type string { | ||
indexing: summary | ||
} | ||
field marqo__chunks_title type array<string> { | ||
indexing: attribute | summary | ||
} | ||
field marqo__embeddings_title type tensor<float>(p{}, x[512]) { | ||
indexing: attribute | index | summary | ||
attribute { distance-metric: geodegrees } | ||
index { hnsw { | ||
max-links-per-node: 16 | ||
neighbors-to-explore-at-insert: 100 | ||
}} | ||
} | ||
field marqo__chunks_description type array<string> { | ||
indexing: attribute | summary | ||
} | ||
field marqo__embeddings_description type tensor<float>(p{}, x[512]) { | ||
indexing: attribute | index | summary | ||
attribute { distance-metric: geodegrees } | ||
index { hnsw { | ||
max-links-per-node: 16 | ||
neighbors-to-explore-at-insert: 100 | ||
}} | ||
} | ||
field marqo__vector_count type int { indexing: attribute | summary } | ||
} | ||
rank-profile embedding_similarity inherits default { | ||
inputs { | ||
query(marqo__query_embedding) tensor<float>(x[512]) | ||
query(title): 0 | ||
query(description): 0 | ||
} | ||
first-phase { | ||
expression: max(if(query(title) > 0, closeness(field, marqo__embeddings_title), 0), if(query(description) > 0, closeness(field, marqo__embeddings_description), 0)) | ||
} | ||
match-features: closest(marqo__embeddings_title) closest(marqo__embeddings_description) distance(field, marqo__embeddings_title) distance(field, marqo__embeddings_description) | ||
} | ||
document-summary all-non-vector-summary { | ||
summary marqo__id type string { } | ||
summary title type string { source: title } | ||
summary description type string { source: description } | ||
summary marqo__chunks_title type array<string> { } | ||
summary marqo__chunks_description type array<string> { } | ||
} | ||
document-summary all-vector-summary { | ||
summary marqo__id type string { } | ||
summary title type string { source: title } | ||
summary description type string { source: description } | ||
summary marqo__chunks_title type array<string> { } | ||
summary marqo__chunks_description type array<string> { } | ||
summary marqo__embeddings_title type tensor<float>(p{}, x[512]) { } | ||
summary marqo__embeddings_description type tensor<float>(p{}, x[512]) { } | ||
} | ||
} |
Oops, something went wrong.