Skip to content

creating an existing index throws #13

@ghost

Description

According to the sources:

    def create_index(self, fields, no_term_offsets=False,
                     no_field_flags=False, stopwords = None):
        """
        Create the search index. Creating an existing index juts updates its properties

However, if I do this:

client = Client('testIndex')
client.create_index([TextField('test', weight=1.0), TextField('body')])
client.create_index([TextField('test', weight=2.0), TextField('body')])

I get:

Traceback (most recent call last):
  File "test.py", line 11, in <module>
    client.create_index([TextField('test', weight=2.0), TextField('body')])
  File "/usr/local/lib/python2.7/dist-packages/redisearch/client.py", line 164, in create_index
    return self.redis.execute_command(*args)
  File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 668, in execute_command
    return self.parse_response(connection, command_name, **options)
  File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 680, in parse_response
    response = connection.read_response()
  File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 629, in read_response
    raise response
redis.exceptions.ResponseError: Index already exists. Drop it first!

I don't mind putting create_index in a try/except, but this seems inconsistent with the documentation if I understand them correctly.

Thanks!

Environment Details:
Ubuntu 16LTS
Redis server v=999.999.999 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=523270dd92165bcf
Python 2.7.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions