bungiesearch icon indicating copy to clipboard operation
bungiesearch copied to clipboard

Index not defined in the settings (though it appears to be)

Open JoshStegmaier opened this issue 8 years ago • 0 comments

When I use Event.objects.search.query, I receive warning/error:

WARNING:root:Returned object of type Event (<Hit(fbevents/Event/1): {u'long_name': u'blah', u...}>) is not defined in the settings, or is not associated to the same index as in the settings.

However, creating and updating the index with management commands works fine.

My index looks like, in fbevents/bungiesearch_indices.py:

class EventIndex(ModelIndex):
    class Meta:
        model = Event
        indexing_query = Event.objects.all()
        fields = ('id', 'name', 'long_name', 'event_date')

And my settings look like:

BUNGIESEARCH = {
    'URLS': ['http://localhost:9200'],
    'INDICES': {
        'fbevents': 'fbevents.bungiesearch_indices',
    },
    'SIGNALS': {'BUFFER_SIZE': 1}
}

I've done an almost identical setup several times before with no problem--only the model details are different.

When I examine the Bungiesearch class, it shows Bungiesearch._index_to_model - defaultdict(list, {}) Bungiesearch._model_to_index - defaultdict(list, {fbevents.models.Event: []})

It seems to find the model, but not the index. I can't figure out why.

JoshStegmaier avatar Aug 11 '17 23:08 JoshStegmaier