I want to be able to have an actual list of objects returned when I query, instead of a ResultSet with Hit objects.
Example:
indexer.search(word).prefetch()
this would return a ResultSet object with matching hits, but I would like to have access to the objects themselves. Similar to what:
model.objects.filter(name__icontains=word)
would return.
the reason I don’t just use the second option is that I cannot search cross-objects of different models, which can be done with indexing.
thanks
I figured it out. The object is returned afterall. It can be accessed with:
where
model_attributewould be an existing variable of the object returnedI believe class functions can be called upon as well in the model_attribute spot, (with bracket added in the end)
but note that when searching cross-models, the ‘
model_attribute‘ may or may not exist for different models. So that may lead to errors.I wish djapian had more documentation on this, as I couldn’t find it at all