Fix date_range filter: use DatetimeRange for RFC3339 strings; set TEAM_ID=35230 in Makefiles, add release target
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
6a25927813
commit
7e40bb6e17
3 changed files with 27 additions and 31 deletions
|
|
@ -1,24 +1,26 @@
|
|||
LOGIN ?=
|
||||
PASSWORD ?=
|
||||
TEAM_ID ?=
|
||||
TEAM_ID ?= 35230
|
||||
DOCKER_REGISTRY_URL ?= 83.166.249.64:5000
|
||||
PORT ?= 8000
|
||||
|
||||
IMAGE = $(DOCKER_REGISTRY_URL)/$(TEAM_ID)/index-service:latest
|
||||
|
||||
.PHONY: login build run push
|
||||
.PHONY: login build run push release
|
||||
|
||||
login:
|
||||
@: $(if $(LOGIN),,$(error LOGIN is required for make login))
|
||||
@: $(if $(PASSWORD),,$(error PASSWORD is required for make login))
|
||||
@: $(if $(LOGIN),,$(error LOGIN is required))
|
||||
@: $(if $(PASSWORD),,$(error PASSWORD is required))
|
||||
docker login $(DOCKER_REGISTRY_URL) -u $(LOGIN) -p $(PASSWORD)
|
||||
|
||||
build:
|
||||
@: $(if $(TEAM_ID),,$(error TEAM_ID is required for make build))
|
||||
docker build --platform linux/amd64 -t $(IMAGE) ./
|
||||
|
||||
run: build
|
||||
docker run --rm -p $(PORT):8000 $(IMAGE)
|
||||
|
||||
push: login build
|
||||
push:
|
||||
docker push $(IMAGE)
|
||||
|
||||
release: build push
|
||||
@echo "index-service pushed → $(IMAGE)"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
LOGIN ?=
|
||||
PASSWORD ?=
|
||||
TEAM_ID ?=
|
||||
TEAM_ID ?= 35230
|
||||
DOCKER_REGISTRY_URL ?= 83.166.249.64:5000
|
||||
PORT ?= 8000
|
||||
QDRANT_URL ?=
|
||||
|
|
@ -16,15 +16,14 @@ REQUIRED_RUN_VARS := QDRANT_URL EMBEDDINGS_DENSE_URL API_KEY RERANKER_URL
|
|||
|
||||
IMAGE = $(DOCKER_REGISTRY_URL)/$(TEAM_ID)/search-service:latest
|
||||
|
||||
.PHONY: login build run push check-run-env
|
||||
.PHONY: login build run push release
|
||||
|
||||
login:
|
||||
@: $(if $(LOGIN),,$(error LOGIN is required for make login))
|
||||
@: $(if $(PASSWORD),,$(error PASSWORD is required for make login))
|
||||
@: $(if $(LOGIN),,$(error LOGIN is required))
|
||||
@: $(if $(PASSWORD),,$(error PASSWORD is required))
|
||||
docker login $(DOCKER_REGISTRY_URL) -u $(LOGIN) -p $(PASSWORD)
|
||||
|
||||
build:
|
||||
@: $(if $(TEAM_ID),,$(error TEAM_ID is required for make build))
|
||||
docker build --platform linux/amd64 -t $(IMAGE) ./
|
||||
|
||||
run: build
|
||||
|
|
@ -41,5 +40,8 @@ run: build
|
|||
-e QDRANT_SPARSE_VECTOR_NAME=$(QDRANT_SPARSE_VECTOR_NAME) \
|
||||
$(IMAGE)
|
||||
|
||||
push: login build
|
||||
push:
|
||||
docker push $(IMAGE)
|
||||
|
||||
release: build push
|
||||
@echo "search-service pushed → $(IMAGE)"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
from datetime import datetime
|
||||
from typing import Any
|
||||
|
||||
from qdrant_client import AsyncQdrantClient, models
|
||||
|
|
@ -15,13 +14,6 @@ from config import (
|
|||
from schemas import Question, SparseVector
|
||||
|
||||
|
||||
def _iso_to_unix(s: str) -> float:
|
||||
try:
|
||||
return datetime.fromisoformat(s.replace("Z", "+00:00")).timestamp()
|
||||
except (ValueError, AttributeError):
|
||||
return 0.0
|
||||
|
||||
|
||||
def _build_filter(question: Question) -> models.Filter | None:
|
||||
must_conditions: list[models.Condition] = []
|
||||
|
||||
|
|
@ -29,9 +21,9 @@ def _build_filter(question: Question) -> models.Filter | None:
|
|||
must_conditions.append(
|
||||
models.FieldCondition(
|
||||
key="metadata.start",
|
||||
range=models.Range(
|
||||
gte=_iso_to_unix(question.date_range.from_),
|
||||
lte=_iso_to_unix(question.date_range.to),
|
||||
datetime_range=models.DatetimeRange(
|
||||
gte=question.date_range.from_,
|
||||
lte=question.date_range.to,
|
||||
),
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue