Repository Public
1#!/usr/bin/env python32# SP Notes Core3# File: Scripts/recorders/search.py4# Description: Records the fixtures of the search routes: quick and hybrid search (always `semantic=0`: the query never5# leaves the server), grouped results with references, duplicates, index state.6#7# Author: Simon-Pierre Boucher8# Contact: contact@spboucher.ai9from _parity_support import ParityRecorder, new_id1011r = ParityRecorder("search")12doc = {"type": "doc", "content": [13 {"type": "heading", "attrs": {"level": 2}, "content": [{"type": "text", "text": "Hypothèse zyxwparity"}]},14 {"type": "paragraph", "content": [{"type": "text", "text": "La volatilité zyxwparity des loyers de Gatineau augmente avec le taux directeur."}]}]}15page = r.page("recherche zyxwparity", section="research", content=doc)16other = r.page("zyxwparity annexe", section="notes")17ref = r.call("POST", "/api/research/references", {"id": new_id(), "title": "Fixture · Zyxwparity and rents", "authors": ["Jane Doe"], "year": 2021, "journal": "Journal of Housing Finance"}).json1819r.call("GET", "/api/search?q=zyxwparity&mode=quick&limit=5", save="quick")20r.call("GET", "/api/search?q=&mode=quick&limit=3", save="quick-empty-query")21r.call("GET", "/api/search?q=zyxwparity", save="quick-default-mode")22r.call("GET", "/api/search?q=zyxwparity&mode=hybrid&semantic=0&limit=10", save="hybrid")23r.call("GET", "/api/search?q=zyxwparity&mode=hybrid&semantic=0&group=1", save="hybrid-grouped")24r.call("GET", "/api/search?q=zyxwparity&mode=hybrid&semantic=0&group=1&kinds=reference", save="hybrid-references")25r.call("GET", "/api/search?q=zyxwparity&mode=hybrid&semantic=0&kinds=page,entry,file§ion=research&since=2026-01-01&until=2030-01-01&archived=1", save="hybrid-filters")26r.call("GET", "/api/search?q=z&mode=hybrid&semantic=0", save="hybrid-short-query")27r.call("GET", "/api/search?q=zyxwparity&mode=hybrid&semantic=0&since=hier", save="hybrid-bad-date")28r.call("GET", "/api/search?q=zyxwparity&mode=hybrid&semantic=0§ion=unicorn", save="hybrid-bad-section")29r.call("GET", "/api/search/duplicates", save="duplicates")30r.call("GET", "/api/search/index-state", save="index-state")31r.call("POST", "/api/search/index-state", {"scope": "everything"}, save="index-state-validation")3233r.call("DELETE", "/api/research/references/" + ref["id"])34r.finish()35