Distinguish main matches from related suggestions and ship 0.1.9
This commit is contained in:
1 parent
a8ba594d0e
commit
b0bdfc7816
40 files changed
+2463
-185
No files matched your search
@@ -1,6 +1,6 @@
|
||||
//! Actual query retrieval against the owned, verified README fixture index.
|
||||
use anyhow::{Context, Result};
|
||||
use searchi_service::{HybridSearch, SearchOptions};
|
||||
use searchi_service::{is_related_result, HybridSearch, SearchOptions};
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn required(name: &str) -> Result<PathBuf> {
|
||||
@@ -11,8 +11,7 @@ fn required(name: &str) -> Result<PathBuf> {
|
||||
|
||||
#[test]
|
||||
#[ignore = "Requires verified owned README fixture database and actual Google CPU model/runtime"]
|
||||
fn real_google_hybrid_shortlist_removes_unrelated_media_without_changing_raw_search() -> Result<()>
|
||||
{
|
||||
fn real_google_hybrid_evidence_retains_related_media_without_changing_raw_search() -> Result<()> {
|
||||
assert_eq!(std::env::var("SEARCHI_FORCE_CPU")?, "1");
|
||||
let db = required("SEARCHI_TEST_RELEVANCE_DATABASE")?;
|
||||
let model = required("SEARCHI_GEMMA_MODEL_DIR")?;
|
||||
@@ -27,9 +26,18 @@ fn real_google_hybrid_shortlist_removes_unrelated_media_without_changing_raw_sea
|
||||
.any(|result| result.filename == "Mountain Lake.jpg"));
|
||||
let measured = search.search_measured(contract, 50, &options, true)?;
|
||||
assert_eq!(measured.results[0].filename, "Supplier Agreement.pdf");
|
||||
assert!(measured.results.iter().all(
|
||||
|result| result.filename != "Mountain Lake.jpg" && result.filename != "Night Pier.jpg"
|
||||
));
|
||||
assert!(!is_related_result(&measured.results[0]));
|
||||
assert!(measured
|
||||
.results
|
||||
.iter()
|
||||
.filter(
|
||||
|result| result.filename == "Mountain Lake.jpg" || result.filename == "Night Pier.jpg"
|
||||
)
|
||||
.all(is_related_result));
|
||||
assert!(measured
|
||||
.results
|
||||
.iter()
|
||||
.any(|result| result.filename == "Mountain Lake.jpg"));
|
||||
assert!(measured
|
||||
.metrics
|
||||
.trace
|
||||
@@ -39,15 +47,17 @@ fn real_google_hybrid_shortlist_removes_unrelated_media_without_changing_raw_sea
|
||||
.any(|span| span.name == "hybrid.semantic_shortlist"
|
||||
&& span
|
||||
.counters
|
||||
.get("tail_candidates_pruned")
|
||||
.get("related_candidates")
|
||||
.is_some_and(|count| *count > 0)));
|
||||
let raw_after = search.search_semantic(contract, 50, &options)?;
|
||||
assert_eq!(raw_after.len(), raw.len());
|
||||
assert_eq!(raw_after[0].score, raw[0].score);
|
||||
let image = search.search("mountains reflected in calm water", 50, &options)?;
|
||||
assert_eq!(image[0].filename, "Mountain Lake.jpg");
|
||||
assert!(!is_related_result(&image[0]));
|
||||
assert!(image
|
||||
.iter()
|
||||
.filter(|result| !is_related_result(result))
|
||||
.all(|result| result.match_kind == "semantic_image"));
|
||||
assert_eq!(
|
||||
search.search("Mountain Lake.jpg", 1, &options)?[0].match_kind,
|
||||
|
||||
Reference in new issue
Block a user