Skip to content
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
10 changes: 8 additions & 2 deletions redisearch/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,10 @@ def create_index(self, fields, no_term_offsets=False,

args.append('SCHEMA')

args += list(itertools.chain(*(f.redis_args() for f in fields)))
try:
args += list(itertools.chain(*(f.redis_args() for f in fields)))
except TypeError:
args += fields.redis_args()

return self.redis.execute_command(*args)

Expand All @@ -323,7 +326,10 @@ def alter_schema_add(self, fields):

args = [self.ALTER_CMD, self.index_name, 'SCHEMA', 'ADD']

args += list(itertools.chain(*(f.redis_args() for f in fields)))
try:
args += list(itertools.chain(*(f.redis_args() for f in fields)))
except TypeError:
args += fields.redis_args()

return self.redis.execute_command(*args)

Expand Down
4 changes: 2 additions & 2 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,10 +826,10 @@ def testAlterSchemaAdd(self):
client.redis.flushdb()

# Creating the index definition and schema
client.create_index((TextField('title'),))
client.create_index(TextField('title'))

# Using alter to add a field
client.alter_schema_add((TextField('body'),))
client.alter_schema_add(TextField('body'))

# Indexing a document
client.add_document('doc1', title='MyTitle', body='Some content only in the body')
Expand Down