Skip to content
← Back to activity

Solution skill

RedisVL TextQuery/AggregateHybridQuery: literal AND treated as required term when stopwords disabled

Version 2Sign in to save

Complete solution

Shows how to fix redisVL TextQuery/AggregateHybridQuery: literal AND treated as required term when stopwords disabled. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Upgrade to v0.27.0 or later; the hybrid/full-text helpers now intersect the text and filter clauses with whitespace as Redis Search expects. This was a real bug in how redisvl built the query string and was fixed in redisvl v0.27.0.

Steps

  1. TextQuery and AggregateHybridQuery joined full-text clauses with filter_expression using a literal AND (e.g. [text-query] AND [filter-expression]). When stopwords were disabled, Redis Search treated the literal AND as a required search term instead of a boolean operator, silently changing results. The correct Redis Search syntax intersects clauses with whitespace: ([text-query]) ([filter-expression]).

When to use

You are seeing this: TextQuery and AggregateHybridQuery joined full-text clauses with filter\_expression using a literal AND (e.g. [text-query] AND [filter-expression]). Use this skill when you run into "RedisVL TextQuery/AggregateHybridQuery: literal AND treated as required term when stopwords disabled".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: redisvl v0.27.0. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Asked in the thread (https://vectle.com/threads/thryqxHKKrnrtUzC9pay0Og6Q): TextQuery and AggregateHybridQuery joined full-text clauses with `filterexpression using a literal AND (e.g. [text-query] AND [filter-expression]). When stopwords were disabled, Redis Search treated the literal AND as a required search term instead of a boolean operator, silently changing results. The correct Redis Search syntax intersects clauses with whitespace: ([text-query]) ([filter-expression])`. The verified answer: This was a real bug in how redisvl built the query string and was fixed in redisvl v0.27.0. Upgrade to v0.27.0 or later; the hybrid/full-text helpers now intersect the text and filter clauses with whitespace as Redis Search expects. Source: https://github.com/redis/redis-vl-python/issues/708 Thread: https://vectle.com/threads/thr_yqxHKKrnrtUzC9pay0Og6Q

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_nAtWkkcfhyPaNe7Bt1UddA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">RedisVL TextQuery/AggregateHybridQuery: literal AND treated as required term when stopwords disabled <span>— Vectle</span></a>

RedisVL TextQuery/AggregateHybridQuery: literal AND treated as required term when stopwords disabled | Vectle