Skip to content
This repository has been archived by the owner on Jun 13, 2019. It is now read-only.

Ostylować wyszukiwarkę #12

Open
ad-m opened this issue Dec 25, 2016 · 2 comments
Open

Ostylować wyszukiwarkę #12

ad-m opened this issue Dec 25, 2016 · 2 comments
Assignees

Comments

@ad-m
Copy link
Member

ad-m commented Dec 25, 2016

Hej,

Zrobiłem faceting na wyszukiwarkę, więc możesz ją stylować. Zobacz na https://django-haystack.readthedocs.io/en/v2.5.0/tutorial.html#setting-up-the-views i https://bitbucket.org/ad_m/rownosc-info/src/c08e0bd5f9881c841e69bd175fb2e3ec205aa07c/search/templates/search/?at=master . Zważ, że django-haystack może mieć inną wersje.

In [1]: from haystack.query import SearchQuerySet

In [2]: SearchQuerySet().all()
Out[2]: <SearchQuerySet: query=<elasticsearch2_backend.ElasticsearchSearchQuery object at 0x7efdf2a44320>, using=None>

In [3]: SearchQuerySet().all()[0]
Out[3]: <SearchResult: organizations.organization (pk='104')>

In [4]: o = SearchQuerySet().all()

In [5]: o.__dict__
Out[5]: 
{'_cache_full': False,
 '_ignored_result_count': 0,
 '_load_all': False,
 '_result_cache': [],
 '_result_count': None,
 '_using': None,
 'log': <haystack.utils.log.LoggingFacade at 0x7efdf29f4748>,
 'query': <elasticsearch2_backend.ElasticsearchSearchQuery at 0x7efdf29f4710>}

In [6]: o = SearchQuerySet().all()[0]

In [7]: o.__dict__
Out[7]: 
{'_additional_fields': ['name',
  'user',
  'modified',
  'id',
  'text',
  'created',
  'jst'],
 '_distance': None,
 '_model': None,
 '_object': None,
 '_point_of_origin': None,
 '_verbose_name': None,
 'app_label': 'organizations',
 'created': None,
 'id': 'organizations.organization.104',
 'jst': 'Peclaw',
 'log': <haystack.utils.log.LoggingFacade at 0x7efdf2a04940>,
 'model_name': 'organization',
 'modified': None,
 'name': None,
 'pk': '104',
 'score': 1.0,
 'stored_fields': None,
 'text': 'Deleniti tempora corpori\[email protected]\n\n',
 'user': None}

In [8]: o.object
Out[8]: <Organization: Deleniti tempora corpori>

In [9]: o.__dict__
Out[9]: 
{'_additional_fields': ['name',
  'user',
  'modified',
  'id',
  'text',
  'created',
  'jst'],
 '_distance': None,
 '_model': watchdog_kj_kultura.organizations.models.Organization,
 '_object': <Organization: Deleniti tempora corpori>,
 '_point_of_origin': None,
 '_verbose_name': None,
 'app_label': 'organizations',
 'created': None,
 'id': 'organizations.organization.104',
 'jst': 'Peclaw',
 'log': <haystack.utils.log.LoggingFacade at 0x7efdf2a04940>,
 'model_name': 'organization',
 'modified': None,
 'name': None,
 'pk': '104',
 'score': 1.0,
 'stored_fields': None,
 'text': 'Deleniti tempora corpori\[email protected]\n\n',
 'user': None}

Z poważaniem,

@ad-m
Copy link
Member Author

ad-m commented Dec 25, 2016

Nie wykluczam, że w przyszłości będziemy przeszukiwać więcej rodzajów treści, więc obczaj https://django-haystack.readthedocs.io/en/v2.5.0/best_practices.html#well-constructed-templates .

@ad-m
Copy link
Member Author

ad-m commented Jan 12, 2017

@mik-laj , zamierzasz podejmować w tym zakresie jeszcze prace?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants