The search backend does store the model object.

Once the property `object` is accessed, it gets lazy loaded.

Refer to the official docs:
https://django-haystack.readthedocs.io/en/master/searchresult_api.html#attribute-reference

And the implementation of the same:
https://github.com/django-haystack/django-haystack/blob/v2.6.1/haystack/models.py#L72

On Tue, Jul 25, 2017 at 7:10 PM, <tanmay.g...@utradesolutions.com> wrote:

> >>> results=SearchQuerySet().all()>>> results[0]<SearchResult: 
> >>> kyc_connect_data_models.storypost (pk=u'429')>>>> 
> >>> results[0].object<StoryPost: <sarahh:First Channel 
> >>> POst>=QmVDXJvQXTZU9DWLy7kTAmyYwRvWao9PD98KPYvZ1JXRMG>
>
>
> Using djangoHaystack, postgres as db, elasticsearch for search.
>
> I have a 'StoryPost' model which I have indexed. SearchquerySet() returns the 
> result whic is of type `SearchResult` which is fine.
>
> But the object it contains is the actual model object, how come? Is it 
> referring to the actual backend db 'postgres' is this case,
>
> or have stored the exact replica in 'elasticsearch' db.
>
> --
> You received this message because you are subscribed to the Google Groups
> "django-haystack" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-haystack+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Thanks,
Subhranath Chunder.

-- 
You received this message because you are subscribed to the Google Groups 
"django-haystack" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-haystack+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to