Skip to content

Commit

Permalink
fix semantic text yaml tests and updated comment to reflect correct c…
Browse files Browse the repository at this point in the history
…ode change
  • Loading branch information
Samiul-TheSoccerFan committed Sep 13, 2024
1 parent ef057cc commit bbbd688
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ private void hitExecute(FetchSourceContext fetchSourceContext, HitContext hitCon
final boolean nestedHit = hitContext.hit().getNestedIdentity() != null;
Source source = hitContext.source();

// If this is a parent document and there are no source filters and include_vector is set as true, then add the source
// as-is.
// If this is a parent document and there are no source filters, then add the source as-is.
if (nestedHit == false && sourceFilter.isEmpty()) {
hitContext.hit().sourceRef(source.internalSourceRef());
fastPath++;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
setup:
- requires:
cluster_features: "gte_v8.15.0"
reason: semantic_text introduced in 8.15.0
cluster_features: "gte_v8.16.0"
reason: _source filtering for Semantic text added in 8.16.0

- do:
inference.put:
Expand Down Expand Up @@ -38,15 +38,7 @@ setup:

---
"Exclude embeddings from _source by default":

- requires:
cluster_features: "gte_v8.16.0"
reason: _source filtering for Semantic text added in 8.16.0

- do:
headers:
# Force JSON content type so that we use a parser that interprets the floating-point score as a double
Content-Type: application/json
search:
index: test-index
body:
Expand All @@ -55,20 +47,11 @@ setup:
field: "sparse_field"
query: "inference test"

- not_exists: _source.sparse_field.inference.chunks.0.embeddings
- not_exists: _source.sparse_field.inference.chunks.1.embeddings
- not_exists: hits.hits.0._source.sparse_field.inference.chunks.0.embeddings

---
"Exclude embeddings from _source":

- requires:
cluster_features: "gte_v8.16.0"
reason: _source filtering for Semantic text added in 8.16.0

- do:
headers:
# Force JSON content type so that we use a parser that interprets the floating-point score as a double
Content-Type: application/json
search:
index: test-index
body:
Expand All @@ -79,20 +62,11 @@ setup:
field: "sparse_field"
query: "inference test"

- not_exists: _source.sparse_field.inference.chunks.0.embeddings
- not_exists: _source.sparse_field.inference.chunks.1.embeddings
- not_exists: hits.hits.0._source.sparse_field.inference.chunks.0.embeddings

---
"Include embedding in _source":

- requires:
cluster_features: "gte_v8.16.0"
reason: _source filtering for Semantic text added in 8.16.0

- do:
headers:
# Force JSON content type so that we use a parser that interprets the floating-point score as a double
Content-Type: application/json
search:
index: test-index
body:
Expand All @@ -103,23 +77,4 @@ setup:
field: "sparse_field"
query: "inference test"

- exists: _source.sparse_field.inference.chunks.0.embeddings
- exists: _source.sparse_field.inference.chunks.1.embeddings

---
"Include embeddings in _source by default":

- do:
headers:
# Force JSON content type so that we use a parser that interprets the floating-point score as a double
Content-Type: application/json
search:
index: test-index
body:
query:
semantic:
field: "sparse_field"
query: "inference test"

- exists: _source.sparse_field.inference.chunks.0.embeddings
- exists: _source.sparse_field.inference.chunks.1.embeddings
- exists: hits.hits.0._source.sparse_field.inference.chunks.0.embeddings

0 comments on commit bbbd688

Please sign in to comment.