perf(session-search): project fields before enrichment
This commit is contained in:
committed by
kshitij
parent
f327c898e2
commit
ffb54305c4
@@ -113,6 +113,29 @@ class TestBrowseShape:
|
||||
# =========================================================================
|
||||
|
||||
class TestDiscoveryShape:
|
||||
def test_discovery_field_plan_preserves_full_default_result(self, db, monkeypatch):
|
||||
_seed_modpack_sessions(db)
|
||||
original = db.search_messages
|
||||
requested_fields = None
|
||||
|
||||
def search_spy(*args, **kwargs):
|
||||
nonlocal requested_fields
|
||||
requested_fields = kwargs.get("fields")
|
||||
return original(*args, **kwargs)
|
||||
|
||||
monkeypatch.setattr(db, "search_messages", search_spy)
|
||||
|
||||
result = json.loads(session_search(query="modpack", limit=1, db=db))
|
||||
|
||||
assert result["success"] is True
|
||||
assert requested_fields is not None
|
||||
assert "context" not in requested_fields
|
||||
assert len(result["results"]) == 1
|
||||
hit = result["results"][0]
|
||||
assert "bookend_start" in hit
|
||||
assert hit["messages"]
|
||||
assert "bookend_end" in hit
|
||||
|
||||
def test_discovery_result_has_bookends_and_window(self, db):
|
||||
_seed_modpack_sessions(db)
|
||||
result = json.loads(session_search(query="modpack", limit=3, db=db))
|
||||
|
||||
Reference in New Issue
Block a user