diff --git a/search/main.py b/search/main.py index 974fd8f..f3aa8e7 100644 --- a/search/main.py +++ b/search/main.py @@ -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: