best: score 0.5541 (recall 0.5759, ndcg 0.4670)

- DENSE_PREFETCH_K 80 → 120
- RERANK_LIMIT 25 → 35
- add question.text as extra dense when differs from search_text

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
q 2026-04-19 13:23:03 +03:00
parent c0f2d52f70
commit 4800e25dd6

View file

@ -162,10 +162,10 @@ async def lifespan(app: FastAPI):
app = FastAPI(title="Search Service", version="0.1.0", lifespan=lifespan)
DENSE_PREFETCH_K = 80
DENSE_PREFETCH_K = 120
SPARSE_PREFETCH_K = 200
RETRIEVE_K = 150
RERANK_LIMIT = 25
RERANK_LIMIT = 35
KEYWORD_BOOST_EXTRA = 10
@ -405,13 +405,16 @@ async def search(payload: SearchAPIRequest) -> SearchAPIResponse:
dense_vectors = [dense_vector]
extra_texts: list[str] = []
raw_text = question.text.strip()
if raw_text and raw_text != dense_query:
extra_texts.append(raw_text)
for v in (question.variants or []):
q_v = v.strip()
if q_v and q_v not in extra_texts:
if q_v and q_v != dense_query and q_v not in extra_texts:
extra_texts.append(q_v)
for h in (question.hyde or []):
q_h = h.strip()
if q_h and q_h not in extra_texts:
if q_h and q_h != dense_query and q_h not in extra_texts:
extra_texts.append(q_h)
extra_texts = extra_texts[:3]
if extra_texts: