Chatterbot: Key too large to index

Created on 27 Aug 2016  路  11Comments  路  Source: gunthercox/ChatterBot

Traceback (most recent call last):
  File "./run.py", line 8, in <module>
    read_only=True)
  File "/home/nikhil/PycharmProjects/chatterbot/lib/python3.3/site-packages/chatterbot/chatterbot.py", line 51, in __init__
    self.storage = StorageAdapterClass(**kwargs)
  File "/home/nikhil/PycharmProjects/chatterbot/lib/python3.3/site-packages/chatterbot/adapters/storage/mongodb.py", line 32, in __init__
    self.statements.create_index('text', unique=True)
  File "/home/nikhil/PycharmProjects/chatterbot/lib/python3.3/site-packages/pymongo/collection.py", line 1387, in create_index
    self.__create_index(keys, kwargs)
  File "/home/nikhil/PycharmProjects/chatterbot/lib/python3.3/site-packages/pymongo/collection.py", line 1298, in __create_index
    sock_info, cmd, read_preference=ReadPreference.PRIMARY)
  File "/home/nikhil/PycharmProjects/chatterbot/lib/python3.3/site-packages/pymongo/collection.py", line 208, in _command
    read_concern=read_concern)
  File "/home/nikhil/PycharmProjects/chatterbot/lib/python3.3/site-packages/pymongo/pool.py", line 239, in command
    read_concern)
  File "/home/nikhil/PycharmProjects/chatterbot/lib/python3.3/site-packages/pymongo/network.py", line 102, in command
    helpers._check_command_response(response_doc, None, allowable_errors)
  File "/home/nikhil/PycharmProjects/chatterbot/lib/python3.3/site-packages/pymongo/helpers.py", line 205, in _check_command_response
    raise OperationFailure(msg % errmsg, code, response)
pymongo.errors.OperationFailure: WiredTigerIndex::insert: key too large to index, failing  1132 { : "First of all, basement sales like tonight aren't gonna last much longer.  It's too risky, one, and two, everything's going on the internet.  Anyone wi..." }

Long sentences causing error.

bug

Most helpful comment

Just hit this recently.

All 11 comments

@nikhil-pandey Exactly what code you executed which resulted that error ?

@navyad I was training the bot. It happens when there are long sentences that exceed the mongodb's index limit.

Happened with me too. I had to split long replies, only taking first sentence or discarding it if it's too long, but it's still a bad solution imho

Just a note on this, newer versions of ChatterBot include more verbose error handling for MongoDB and part of message for this error now also states distinct too big, 16mb cap.

Is this still not fixed? 馃

Is this still not fixed?

Just hit this recently.

Is this still not fixed?

how can I fix it?

@Daniel-csvw What corpus are you training on?

I have a 200000K line corpus, I only got this on the ubuntu corpus or a custom corpus that indexed wiki articles that were very long,

I've removed the index from the Mongo DB storage adapter. This error should no longer occur as a result.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

juanpialbano picture juanpialbano  路  4Comments

hemangsk picture hemangsk  路  4Comments

decode007 picture decode007  路  3Comments

coolrb picture coolrb  路  3Comments

AmusingThrone picture AmusingThrone  路  3Comments