Skip to content
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

Python - Is Index Exists #30

Closed
aviperetz34 opened this issue Mar 6, 2017 · 2 comments
Closed

Python - Is Index Exists #30

aviperetz34 opened this issue Mar 6, 2017 · 2 comments

Comments

@aviperetz34
Copy link

when upgrading from 0.4 to 0.9, creating an existing index raised a ResponseError.
is there a way to check if index exist without an exception?

@dvirsky
Copy link
Contributor

dvirsky commented Mar 6, 2017

First of all, if you are upgrading between 0.4 and 0.9 you need to delete the data and start fresh.

Second, the way to check the existence of an index is to call FT.INFO on it, and if the index does not exist you receive an error.

So basically:

try:
  client.info()
except ResponseError:
  client.create_index(...)

@dvirsky
Copy link
Contributor

dvirsky commented Mar 8, 2017

I'm closing the issue as this doesn't seem to be a bug.

I might change the key naming in a future version in a way that the usual redis EXISTS and TYPE commands will apply to inverted indexes.

@dvirsky dvirsky closed this as completed Mar 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants