Skip to content

Commit

Permalink
Update yaml tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kderusso committed Mar 29, 2024
1 parent ee00d6c commit 620cb5e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 170 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ teardown:
index: index-with-sparse-vector
body:
query:
text_expansion:
sparse_vector:
ml.tokens:
model_id: text_expansion_model
model_text: "octopus comforter smells"
Expand All @@ -154,7 +154,7 @@ teardown:
index: index-with-sparse-vector
body:
query:
text_expansion:
sparse_vector:
ml.tokens:
model_id: text_expansion_model
model_text: "octopus comforter smells"
Expand All @@ -174,7 +174,7 @@ teardown:
index: index-with-sparse-vector
body:
query:
text_expansion:
sparse_vector:
ml.tokens:
model_id: text_expansion_model
model_text: "octopus comforter smells"
Expand All @@ -190,7 +190,7 @@ teardown:
index: index-with-sparse-vector
body:
query:
text_expansion:
sparse_vector:
ml.tokens:
model_id: text_expansion_model
model_text: "octopus comforter smells"
Expand All @@ -215,7 +215,7 @@ teardown:
index: index-with-sparse-vector
body:
query:
text_expansion:
sparse_vector:
ml.tokens:
model_id: text_expansion_model
model_text: "octopus comforter smells"
Expand All @@ -234,7 +234,7 @@ teardown:
index: index-with-sparse-vector
body:
query:
text_expansion:
sparse_vector:
ml.tokens:
model_id: text_expansion_model
model_text: "octopus comforter smells"
Expand All @@ -243,82 +243,3 @@ teardown:
tokens_weight_threshold: 0.4
only_score_pruned_tokens: true
- match: { hits.total.value: 0 }

---
"Test weighted tokens search":
- skip:
version: " - 8.12.99"
reason: "weighted token search introduced in 8.13.0"

- do:
search:
index: index-with-sparse-vector
body:
query:
weighted_tokens:
ml.tokens:
tokens: [{"the": 1.0}, {"comforter":1.0}, {"smells":1.0}, {"bad": 1.0}]
pruning_config:
tokens_freq_ratio_threshold: 1
tokens_weight_threshold: 0.4
only_score_pruned_tokens: false
- match: { hits.total.value: 5 }
- match: { hits.hits.0._source.source_text: "the octopus comforter smells" }

---
"Test weighted tokens search with default pruning config":
- skip:
version: " - 8.12.99"
reason: "weighted token search introduced in 8.13.0"

- do:
search:
index: index-with-sparse-vector
body:
query:
weighted_tokens:
ml.tokens:
tokens: [{"the": 1.0}, {"comforter":1.0}, {"smells":1.0}, {"bad": 1.0}]
pruning_config: {}
- match: { hits.total.value: 5 }
- match: { hits.hits.0._source.source_text: "the octopus comforter smells" }

---
"Test weighted tokens search only scoring pruned tokens":
- skip:
version: " - 8.12.99"
reason: "weighted token search introduced in 8.13.0"

- do:
search:
index: index-with-sparse-vector
body:
query:
weighted_tokens:
ml.tokens:
tokens: [{"the": 1.0}, {"comforter":1.0}, {"smells":1.0}, {"bad": 1.0}]
pruning_config:
tokens_freq_ratio_threshold: 4
tokens_weight_threshold: 0.4
only_score_pruned_tokens: true
- match: { hits.total.value: 0 }

---
"Test weighted tokens search that prunes tokens based on frequency":
- skip:
version: " - 8.12.99"
reason: "weighted token search introduced in 8.13.0"

- do:
search:
index: index-with-sparse-vector
body:
query:
weighted_tokens:
ml.tokens:
tokens: [{"the": 1.0}, {"octopus":1.0}, {"comforter":1.0}, {"is": 1.0}, {"the": 1.0}, {"best": 1.0}, {"of": 1.0}, {"the": 1.0}, {"bunch": 1.0}]
pruning_config:
tokens_freq_ratio_threshold: 3
tokens_weight_threshold: 0.4
only_score_pruned_tokens: true
- match: { hits.total.value: 0 }
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ teardown:
index: index-with-sparse-vector
body:
query:
text_expansion:
sparse_vector:
ml.tokens:
model_id: text_expansion_model
model_text: "octopus comforter smells"
Expand All @@ -154,7 +154,7 @@ teardown:
index: index-with-sparse-vector
body:
query:
text_expansion:
sparse_vector:
ml.tokens:
model_id: text_expansion_model
model_text: "octopus comforter smells"
Expand All @@ -174,7 +174,7 @@ teardown:
index: index-with-sparse-vector
body:
query:
text_expansion:
sparse_vector:
ml.tokens:
model_id: text_expansion_model
model_text: "octopus comforter smells"
Expand All @@ -190,7 +190,7 @@ teardown:
index: index-with-sparse-vector
body:
query:
text_expansion:
sparse_vector:
ml.tokens:
model_id: text_expansion_model
model_text: "octopus comforter smells"
Expand All @@ -215,7 +215,7 @@ teardown:
index: index-with-sparse-vector
body:
query:
text_expansion:
sparse_vector:
ml.tokens:
model_id: text_expansion_model
model_text: "octopus comforter smells"
Expand All @@ -234,7 +234,7 @@ teardown:
index: index-with-sparse-vector
body:
query:
text_expansion:
sparse_vector:
ml.tokens:
model_id: text_expansion_model
model_text: "octopus comforter smells"
Expand All @@ -243,82 +243,3 @@ teardown:
tokens_weight_threshold: 0.4
only_score_pruned_tokens: true
- match: { hits.total.value: 0 }

---
"Test weighted tokens search":
- skip:
version: " - 8.12.99"
reason: "weighted token search introduced in 8.13.0"

- do:
search:
index: index-with-sparse-vector
body:
query:
weighted_tokens:
ml.tokens:
tokens: [{"the": 1.0}, {"comforter":1.0}, {"smells":1.0}, {"bad": 1.0}]
pruning_config:
tokens_freq_ratio_threshold: 1
tokens_weight_threshold: 0.4
only_score_pruned_tokens: false
- match: { hits.total.value: 5 }
- match: { hits.hits.0._source.source_text: "the octopus comforter smells" }

---
"Test weighted tokens search with default pruning config":
- skip:
version: " - 8.12.99"
reason: "weighted token search introduced in 8.13.0"

- do:
search:
index: index-with-sparse-vector
body:
query:
weighted_tokens:
ml.tokens:
tokens: [{"the": 1.0}, {"comforter":1.0}, {"smells":1.0}, {"bad": 1.0}]
pruning_config: {}
- match: { hits.total.value: 5 }
- match: { hits.hits.0._source.source_text: "the octopus comforter smells" }

---
"Test weighted tokens search only scoring pruned tokens":
- skip:
version: " - 8.12.99"
reason: "weighted token search introduced in 8.13.0"

- do:
search:
index: index-with-sparse-vector
body:
query:
weighted_tokens:
ml.tokens:
tokens: [{"the": 1.0}, {"comforter":1.0}, {"smells":1.0}, {"bad": 1.0}]
pruning_config:
tokens_freq_ratio_threshold: 4
tokens_weight_threshold: 0.4
only_score_pruned_tokens: true
- match: { hits.total.value: 0 }

---
"Test weighted tokens search that prunes tokens based on frequency":
- skip:
version: " - 8.12.99"
reason: "weighted token search introduced in 8.13.0"

- do:
search:
index: index-with-sparse-vector
body:
query:
weighted_tokens:
ml.tokens:
tokens: [{"the": 1.0}, {"octopus":1.0}, {"comforter":1.0}, {"is": 1.0}, {"the": 1.0}, {"best": 1.0}, {"of": 1.0}, {"the": 1.0}, {"bunch": 1.0}]
pruning_config:
tokens_freq_ratio_threshold: 3
tokens_weight_threshold: 0.4
only_score_pruned_tokens: true
- match: { hits.total.value: 0 }

0 comments on commit 620cb5e

Please sign in to comment.