vjav: fall back to keyword search when an implicit uploader/tag match is empty

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUYdCh2nCVsQYgJAT7gwSi
This commit is contained in:
Simon
2026-10-10 09:24:56 +00:00
parent 0824941c23
commit 5176178607
2 changed files with 21 additions and 4 deletions

View File

@@ -1568,11 +1568,28 @@ impl Provider for VjavProvider {
.filter(|value| !value.is_empty())
.map(ToOwned::to_owned);
let target = self.pick_target(normalized_query.as_deref(), &options).await;
// A generic keyword can exactly match a category or member name
// ("girl" is a member with no uploads), which would hijack the search
// and return nothing. Remember to fall back to keyword search then.
let keyword_fallback = normalized_query
.as_ref()
.filter(|_| matches!(target, Target::Uploader { .. } | Target::Tag { .. }))
.map(|query| Target::Search {
query: query.clone(),
});
match self
let result = self
.fetch_target_items(target, &sort, page, per_page, &options)
.await
{
.await;
let result = match (result, keyword_fallback) {
(Ok(items), Some(fallback)) if items.is_empty() => {
self.fetch_target_items(fallback, &sort, page, per_page, &options)
.await
}
(result, _) => result,
};
match result {
Ok(items) => items,
Err(error) => {
report_provider_error(CHANNEL_ID, "get_videos", &error.to_string()).await;