Skip to content

Fixing search module dropindex function not to send invalid third parameter. Updating pipeline infra #3564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
max-parallel: 15
fail-fast: false
matrix:
redis-version: ['8.0-M04-pre', '${{ needs.redis_version.outputs.CURRENT }}', '7.2.7', '6.2.17']
redis-version: ['8.0-M05-pre', '${{ needs.redis_version.outputs.CURRENT }}', '7.2.7', '6.2.17']
python-version: ['3.8', '3.13']
parser-backend: ['plain']
event-loop: ['asyncio']
Expand Down
14 changes: 12 additions & 2 deletions redis/commands/search/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,18 @@ def dropindex(self, delete_documents: bool = False):

For more information see `FT.DROPINDEX <https://redis.io/commands/ft.dropindex>`_.
""" # noqa
delete_str = "DD" if delete_documents else ""
return self.execute_command(DROPINDEX_CMD, self.index_name, delete_str)
args = [DROPINDEX_CMD, self.index_name]

delete_str = (
"DD"
if isinstance(delete_documents, bool) and delete_documents is True
else ""
)

if delete_str:
args.append(delete_str)

return self.execute_command(*args)

def _add_document(
self,
Expand Down
8 changes: 4 additions & 4 deletions tests/test_asyncio/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -1603,14 +1603,14 @@ async def test_withsuffixtrie(decoded_r: redis.Redis):
if is_resp2_connection(decoded_r):
info = await decoded_r.ft().info()
assert "WITHSUFFIXTRIE" not in info["attributes"][0]
assert await decoded_r.ft().dropindex("idx")
assert await decoded_r.ft().dropindex()

# create withsuffixtrie index (text field)
assert await decoded_r.ft().create_index(TextField("t", withsuffixtrie=True))
await waitForIndex(decoded_r, getattr(decoded_r.ft(), "index_name", "idx"))
info = await decoded_r.ft().info()
assert "WITHSUFFIXTRIE" in info["attributes"][0]
assert await decoded_r.ft().dropindex("idx")
assert await decoded_r.ft().dropindex()

# create withsuffixtrie index (tag field)
assert await decoded_r.ft().create_index(TagField("t", withsuffixtrie=True))
Expand All @@ -1620,14 +1620,14 @@ async def test_withsuffixtrie(decoded_r: redis.Redis):
else:
info = await decoded_r.ft().info()
assert "WITHSUFFIXTRIE" not in info["attributes"][0]["flags"]
assert await decoded_r.ft().dropindex("idx")
assert await decoded_r.ft().dropindex()

# create withsuffixtrie index (text fields)
assert await decoded_r.ft().create_index(TextField("t", withsuffixtrie=True))
await waitForIndex(decoded_r, getattr(decoded_r.ft(), "index_name", "idx"))
info = await decoded_r.ft().info()
assert "WITHSUFFIXTRIE" in info["attributes"][0]["flags"]
assert await decoded_r.ft().dropindex("idx")
assert await decoded_r.ft().dropindex()

# create withsuffixtrie index (tag field)
assert await decoded_r.ft().create_index(TagField("t", withsuffixtrie=True))
Expand Down
10 changes: 5 additions & 5 deletions tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ def test_max_text_fields(client):
with pytest.raises(redis.ResponseError):
client.ft().alter_schema_add((TextField(f"f{x}"),))

client.ft().dropindex("idx")
client.ft().dropindex()
# Creating the index definition
client.ft().create_index((TextField("f0"),), max_text_fields=True)
# Fill the index with fields
Expand Down Expand Up @@ -2575,14 +2575,14 @@ def test_withsuffixtrie(client: redis.Redis):
if is_resp2_connection(client):
info = client.ft().info()
assert "WITHSUFFIXTRIE" not in info["attributes"][0]
assert client.ft().dropindex("idx")
assert client.ft().dropindex()

# create withsuffixtrie index (text fields)
assert client.ft().create_index(TextField("t", withsuffixtrie=True))
waitForIndex(client, getattr(client.ft(), "index_name", "idx"))
info = client.ft().info()
assert "WITHSUFFIXTRIE" in info["attributes"][0]
assert client.ft().dropindex("idx")
assert client.ft().dropindex()

# create withsuffixtrie index (tag field)
assert client.ft().create_index(TagField("t", withsuffixtrie=True))
Expand All @@ -2592,14 +2592,14 @@ def test_withsuffixtrie(client: redis.Redis):
else:
info = client.ft().info()
assert "WITHSUFFIXTRIE" not in info["attributes"][0]["flags"]
assert client.ft().dropindex("idx")
assert client.ft().dropindex()

# create withsuffixtrie index (text fields)
assert client.ft().create_index(TextField("t", withsuffixtrie=True))
waitForIndex(client, getattr(client.ft(), "index_name", "idx"))
info = client.ft().info()
assert "WITHSUFFIXTRIE" in info["attributes"][0]["flags"]
assert client.ft().dropindex("idx")
assert client.ft().dropindex()

# create withsuffixtrie index (tag field)
assert client.ft().create_index(TagField("t", withsuffixtrie=True))
Expand Down
Loading