%global _empty_manifest_terminate_build 0 Name: python-lucyfer Version: 0.7.0 Release: 1 Summary: Lucene search for DRF and elasticsearch-dsl License: MIT License URL: https://github.com/ncopiy/django_lucy Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ad/9f/04659f7d056fbc03448611720bfb978ae59a6911f5e0ac72f6b6aa81eee2/lucyfer-0.7.0.tar.gz BuildArch: noarch Requires: python3-lucyparser Requires: python3-Django Requires: python3-djangorestframework Requires: python3-elasticsearch-dsl %description # Lucene way search in django #### ("Django" AND "DRF") OR "Elasticserach-DSL" _________________ ## Installation Only for Django with DRF: ``` pip install lucyfer ``` For Django with DRF and Elasticsearch-dsl: ``` pip install lucyfer[full] ``` ## Dependencies | | lucyfer | lucyfer[full] | |---------------------------|---------|-------| | lucyparser | + | + | | Django | + | + | | djangorestframework | + | + | | elasticsearch-dsl | - | + | ## Usage Example ________________ Create your search backend class: ```python from lucyfer.backend import LuceneSearchFilter, DjangoLuceneSearchFilterMixin, ElasticLuceneSearchFilterMixin class SearchBackend(DjangoLuceneSearchFilterMixin, ElasticLuceneSearchFilterMixin, LuceneSearchFilter): pass ``` Copy reference to `SearchBackend` class and include it in `DEFAULT_FILTER_BACKENDS` in `settings.py` instead of default search backend: ```python REST_FRAMEWORK = { 'DEFAULT_FILTER_BACKENDS': ('path.to.SearchBackend',) } ``` Create `searchsets.py` file in your django-application and fill it: ```python from lucyfer.searchset import DjangoSearchSet from lucyfer.searchset.fields.django import DjangoCharField from .models import MyModel class MyModelSearchSet(DjangoSearchSet): some_field = DjangoCharField(sources=["another_field__name"], exclude_sources_from_mapping=True) class Meta: model = MyModel fields_to_exclude_from_mapping = ['field_to_exclude_from_mapping', ] ``` Include searchset class in your `ModelViewSet`: ```python from rest_framework.viewsets import ModelViewSet from .searchsets import MyModelSearchSet class MyModelViewSet(ModelViewSet): search_class = MyModelSearchSet ``` You have to save `search_fields` in your `ModelViewSet` if you want to save custom search possibility. Now you can use lucene-way syntax for your view. Tests execution: ``` pytest tests/test_* -c tests/pytest.ini ``` %package -n python3-lucyfer Summary: Lucene search for DRF and elasticsearch-dsl Provides: python-lucyfer BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-lucyfer # Lucene way search in django #### ("Django" AND "DRF") OR "Elasticserach-DSL" _________________ ## Installation Only for Django with DRF: ``` pip install lucyfer ``` For Django with DRF and Elasticsearch-dsl: ``` pip install lucyfer[full] ``` ## Dependencies | | lucyfer | lucyfer[full] | |---------------------------|---------|-------| | lucyparser | + | + | | Django | + | + | | djangorestframework | + | + | | elasticsearch-dsl | - | + | ## Usage Example ________________ Create your search backend class: ```python from lucyfer.backend import LuceneSearchFilter, DjangoLuceneSearchFilterMixin, ElasticLuceneSearchFilterMixin class SearchBackend(DjangoLuceneSearchFilterMixin, ElasticLuceneSearchFilterMixin, LuceneSearchFilter): pass ``` Copy reference to `SearchBackend` class and include it in `DEFAULT_FILTER_BACKENDS` in `settings.py` instead of default search backend: ```python REST_FRAMEWORK = { 'DEFAULT_FILTER_BACKENDS': ('path.to.SearchBackend',) } ``` Create `searchsets.py` file in your django-application and fill it: ```python from lucyfer.searchset import DjangoSearchSet from lucyfer.searchset.fields.django import DjangoCharField from .models import MyModel class MyModelSearchSet(DjangoSearchSet): some_field = DjangoCharField(sources=["another_field__name"], exclude_sources_from_mapping=True) class Meta: model = MyModel fields_to_exclude_from_mapping = ['field_to_exclude_from_mapping', ] ``` Include searchset class in your `ModelViewSet`: ```python from rest_framework.viewsets import ModelViewSet from .searchsets import MyModelSearchSet class MyModelViewSet(ModelViewSet): search_class = MyModelSearchSet ``` You have to save `search_fields` in your `ModelViewSet` if you want to save custom search possibility. Now you can use lucene-way syntax for your view. Tests execution: ``` pytest tests/test_* -c tests/pytest.ini ``` %package help Summary: Development documents and examples for lucyfer Provides: python3-lucyfer-doc %description help # Lucene way search in django #### ("Django" AND "DRF") OR "Elasticserach-DSL" _________________ ## Installation Only for Django with DRF: ``` pip install lucyfer ``` For Django with DRF and Elasticsearch-dsl: ``` pip install lucyfer[full] ``` ## Dependencies | | lucyfer | lucyfer[full] | |---------------------------|---------|-------| | lucyparser | + | + | | Django | + | + | | djangorestframework | + | + | | elasticsearch-dsl | - | + | ## Usage Example ________________ Create your search backend class: ```python from lucyfer.backend import LuceneSearchFilter, DjangoLuceneSearchFilterMixin, ElasticLuceneSearchFilterMixin class SearchBackend(DjangoLuceneSearchFilterMixin, ElasticLuceneSearchFilterMixin, LuceneSearchFilter): pass ``` Copy reference to `SearchBackend` class and include it in `DEFAULT_FILTER_BACKENDS` in `settings.py` instead of default search backend: ```python REST_FRAMEWORK = { 'DEFAULT_FILTER_BACKENDS': ('path.to.SearchBackend',) } ``` Create `searchsets.py` file in your django-application and fill it: ```python from lucyfer.searchset import DjangoSearchSet from lucyfer.searchset.fields.django import DjangoCharField from .models import MyModel class MyModelSearchSet(DjangoSearchSet): some_field = DjangoCharField(sources=["another_field__name"], exclude_sources_from_mapping=True) class Meta: model = MyModel fields_to_exclude_from_mapping = ['field_to_exclude_from_mapping', ] ``` Include searchset class in your `ModelViewSet`: ```python from rest_framework.viewsets import ModelViewSet from .searchsets import MyModelSearchSet class MyModelViewSet(ModelViewSet): search_class = MyModelSearchSet ``` You have to save `search_fields` in your `ModelViewSet` if you want to save custom search possibility. Now you can use lucene-way syntax for your view. Tests execution: ``` pytest tests/test_* -c tests/pytest.ini ``` %prep %autosetup -n lucyfer-0.7.0 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-lucyfer -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Tue May 30 2023 Python_Bot - 0.7.0-1 - Package Spec generated