mirror of
https://github.com/MrSleeps/jellyfin-scene-search.git
synced 2026-11-19 00:03:36 +00:00
Add caption-only lexical retrieval to Meilisearch client
This commit is contained in:
@@ -144,6 +144,32 @@ class Meili:
|
||||
self.session.get(f"{self.url}/indexes/{self.index}/stats")
|
||||
).json()
|
||||
|
||||
def search_caption_text(
|
||||
self,
|
||||
query: str,
|
||||
limit: int = 20,
|
||||
filter_expression: str | None = None,
|
||||
) -> dict:
|
||||
"""Find literal caption matches without visual-vector dilution.
|
||||
|
||||
The field restriction prevents title and tag matches from masquerading
|
||||
as caption hits. Requiring all terms avoids loose one-word matches
|
||||
displacing ordinary Jellyfin search results.
|
||||
"""
|
||||
payload = {
|
||||
"q": query,
|
||||
"limit": limit,
|
||||
"attributesToSearchOn": ["caption"],
|
||||
"matchingStrategy": "all",
|
||||
"showRankingScore": True,
|
||||
}
|
||||
if filter_expression:
|
||||
payload["filter"] = filter_expression
|
||||
return self._check(self.session.post(
|
||||
f"{self.url}/indexes/{self.index}/search",
|
||||
json=payload,
|
||||
)).json()
|
||||
|
||||
def search_vector(
|
||||
self,
|
||||
vector: Iterable[float],
|
||||
|
||||
Reference in New Issue
Block a user