diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-lunr.spec | 370 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 372 insertions, 0 deletions
@@ -0,0 +1 @@ +/lunr-0.6.2.tar.gz diff --git a/python-lunr.spec b/python-lunr.spec new file mode 100644 index 0000000..b5bdfcb --- /dev/null +++ b/python-lunr.spec @@ -0,0 +1,370 @@ +%global _empty_manifest_terminate_build 0 +Name: python-lunr +Version: 0.6.2 +Release: 1 +Summary: A Python implementation of Lunr.js +License: MIT +URL: https://github.com/yeraydiazdiaz/lunr.py +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/6c/7b/f50c889c833e6a5b9186bf62a94833e95cf84caad051ae289670f3dc7b06/lunr-0.6.2.tar.gz +BuildArch: noarch + +Requires: python3-nltk + +%description +[](https://github.com/yeraydiazdiaz/lunr.py/actions?workflow=CI) +[](https://codecov.io/gh/yeraydiazdiaz/lunr.py) +[](https://pypi.org/project/lunr/) +[](https://pypi.org/project/lunr/) +[](http://lunr.readthedocs.io/en/latest/) +[](http://pepy.tech/project/lunr) +[](https://shoutouts.dev/projects/yeraydiazdiaz/lunr.py) + +# Lunr.py + +A Python implementation of [Lunr.js](https://lunrjs.com) by [Oliver Nightingale](https://github.com/olivernn). + +> A bit like Solr, but much smaller and not as bright. + +This Python version of Lunr.js aims to bring the simple and powerful full text search +capabilities into Python guaranteeing results as close as the original +implementation as possible. + +- [Documentation](http://lunr.readthedocs.io/en/latest/) + +## What does this even do? + +Lunr is a simple full text search solution for situations where deploying a full +scale solution like Elasticsearch isn't possible, viable or you're simply prototyping. +Lunr parses a set of documents and creates an inverted index for quick full text +searches in the same way other more complicated solution. + +The trade-off is that Lunr keeps the inverted index in memory and requires you +to recreate or read the index at the start of your application. + +## Interoperability with Lunr.js + +A core objective of Lunr.py is to provide +[interoperability with the JavaScript version](https://lunr.readthedocs.io/en/latest/lunrjs-interop). + +An example can be found in the [MkDocs documentation library](http://www.mkdocs.org/). +MkDocs produces a set of documents from the pages of the documentation and uses +[Lunr.js](https://lunrjs.com) in the frontend to power its built-in searching +engine. This set of documents is in the form of a JSON file which needs to be +fetched and parsed by Lunr.js to create the inverted index at startup of your application. + +While this is not a problem for most sites, depending on the size of your document +set, this can take some time. + +Lunr.py provides a backend solution, allowing you to parse the documents in Python +of time and create a serialized Lunr.js index you can pass have the browser +version read, minimizing start up time of your application. + +Each version of lunr.py +[targets a specific version of lunr.js](https://github.com/yeraydiazdiaz/lunr.py/blob/master/lunr/__init__.py#L12) +and produces the same results for a +[non-trivial corpus of documents](https://github.com/yeraydiazdiaz/lunr.py/blob/master/tests/acceptance_tests/fixtures/mkdocs_index.json). + +## Installation + +`pip install lunr` + +An optional and experimental support for other languages thanks to the +[Natural Language Toolkit](http://www.nltk.org/) stemmers is also available via +`pip install lunr[languages]`. The usage of the language feature is subject to +[NTLK corpus licensing clauses](https://github.com/nltk/nltk#redistributing). + +Please refer to the +[documentation page on languages](https://lunr.readthedocs.io/en/latest/languages/) +for more information. + +## Usage + +First, you'll need a list of dicts representing the documents you want to search on. +These documents must have a unique field which will serve as a reference and a +series of fields you'd like to search on. + +Lunr provides a convenience `lunr` function to quickly index this set of documents: + +```python +>>> from lunr import lunr +>>> +>>> documents = [{ +... 'id': 'a', +... 'title': 'Mr. Green kills Colonel Mustard', +... 'body': 'Mr. Green killed Colonel Mustard in the study with the candlestick.', +... }, { +... 'id': 'b', +... 'title': 'Plumb waters plant', +... 'body': 'Professor Plumb has a green plant in his study', +... }] +>>> idx = lunr( +... ref='id', fields=('title', 'body'), documents=documents +... ) +>>> idx.search('kill') +[{'ref': 'a', 'score': 0.6931722372559913, 'match_data': <MatchData "kill">}] +>>> idx.search('study') +[{'ref': 'b', 'score': 0.23576799568081389, 'match_data': <MatchData "studi">}, {'ref': 'a', 'score': 0.2236629211724517, 'match_data': <MatchData "studi">}] +``` + +Please refer to the [documentation](http://lunr.readthedocs.io/en/latest/) +for more usage examples. + + + + +%package -n python3-lunr +Summary: A Python implementation of Lunr.js +Provides: python-lunr +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-lunr +[](https://github.com/yeraydiazdiaz/lunr.py/actions?workflow=CI) +[](https://codecov.io/gh/yeraydiazdiaz/lunr.py) +[](https://pypi.org/project/lunr/) +[](https://pypi.org/project/lunr/) +[](http://lunr.readthedocs.io/en/latest/) +[](http://pepy.tech/project/lunr) +[](https://shoutouts.dev/projects/yeraydiazdiaz/lunr.py) + +# Lunr.py + +A Python implementation of [Lunr.js](https://lunrjs.com) by [Oliver Nightingale](https://github.com/olivernn). + +> A bit like Solr, but much smaller and not as bright. + +This Python version of Lunr.js aims to bring the simple and powerful full text search +capabilities into Python guaranteeing results as close as the original +implementation as possible. + +- [Documentation](http://lunr.readthedocs.io/en/latest/) + +## What does this even do? + +Lunr is a simple full text search solution for situations where deploying a full +scale solution like Elasticsearch isn't possible, viable or you're simply prototyping. +Lunr parses a set of documents and creates an inverted index for quick full text +searches in the same way other more complicated solution. + +The trade-off is that Lunr keeps the inverted index in memory and requires you +to recreate or read the index at the start of your application. + +## Interoperability with Lunr.js + +A core objective of Lunr.py is to provide +[interoperability with the JavaScript version](https://lunr.readthedocs.io/en/latest/lunrjs-interop). + +An example can be found in the [MkDocs documentation library](http://www.mkdocs.org/). +MkDocs produces a set of documents from the pages of the documentation and uses +[Lunr.js](https://lunrjs.com) in the frontend to power its built-in searching +engine. This set of documents is in the form of a JSON file which needs to be +fetched and parsed by Lunr.js to create the inverted index at startup of your application. + +While this is not a problem for most sites, depending on the size of your document +set, this can take some time. + +Lunr.py provides a backend solution, allowing you to parse the documents in Python +of time and create a serialized Lunr.js index you can pass have the browser +version read, minimizing start up time of your application. + +Each version of lunr.py +[targets a specific version of lunr.js](https://github.com/yeraydiazdiaz/lunr.py/blob/master/lunr/__init__.py#L12) +and produces the same results for a +[non-trivial corpus of documents](https://github.com/yeraydiazdiaz/lunr.py/blob/master/tests/acceptance_tests/fixtures/mkdocs_index.json). + +## Installation + +`pip install lunr` + +An optional and experimental support for other languages thanks to the +[Natural Language Toolkit](http://www.nltk.org/) stemmers is also available via +`pip install lunr[languages]`. The usage of the language feature is subject to +[NTLK corpus licensing clauses](https://github.com/nltk/nltk#redistributing). + +Please refer to the +[documentation page on languages](https://lunr.readthedocs.io/en/latest/languages/) +for more information. + +## Usage + +First, you'll need a list of dicts representing the documents you want to search on. +These documents must have a unique field which will serve as a reference and a +series of fields you'd like to search on. + +Lunr provides a convenience `lunr` function to quickly index this set of documents: + +```python +>>> from lunr import lunr +>>> +>>> documents = [{ +... 'id': 'a', +... 'title': 'Mr. Green kills Colonel Mustard', +... 'body': 'Mr. Green killed Colonel Mustard in the study with the candlestick.', +... }, { +... 'id': 'b', +... 'title': 'Plumb waters plant', +... 'body': 'Professor Plumb has a green plant in his study', +... }] +>>> idx = lunr( +... ref='id', fields=('title', 'body'), documents=documents +... ) +>>> idx.search('kill') +[{'ref': 'a', 'score': 0.6931722372559913, 'match_data': <MatchData "kill">}] +>>> idx.search('study') +[{'ref': 'b', 'score': 0.23576799568081389, 'match_data': <MatchData "studi">}, {'ref': 'a', 'score': 0.2236629211724517, 'match_data': <MatchData "studi">}] +``` + +Please refer to the [documentation](http://lunr.readthedocs.io/en/latest/) +for more usage examples. + + + + +%package help +Summary: Development documents and examples for lunr +Provides: python3-lunr-doc +%description help +[](https://github.com/yeraydiazdiaz/lunr.py/actions?workflow=CI) +[](https://codecov.io/gh/yeraydiazdiaz/lunr.py) +[](https://pypi.org/project/lunr/) +[](https://pypi.org/project/lunr/) +[](http://lunr.readthedocs.io/en/latest/) +[](http://pepy.tech/project/lunr) +[](https://shoutouts.dev/projects/yeraydiazdiaz/lunr.py) + +# Lunr.py + +A Python implementation of [Lunr.js](https://lunrjs.com) by [Oliver Nightingale](https://github.com/olivernn). + +> A bit like Solr, but much smaller and not as bright. + +This Python version of Lunr.js aims to bring the simple and powerful full text search +capabilities into Python guaranteeing results as close as the original +implementation as possible. + +- [Documentation](http://lunr.readthedocs.io/en/latest/) + +## What does this even do? + +Lunr is a simple full text search solution for situations where deploying a full +scale solution like Elasticsearch isn't possible, viable or you're simply prototyping. +Lunr parses a set of documents and creates an inverted index for quick full text +searches in the same way other more complicated solution. + +The trade-off is that Lunr keeps the inverted index in memory and requires you +to recreate or read the index at the start of your application. + +## Interoperability with Lunr.js + +A core objective of Lunr.py is to provide +[interoperability with the JavaScript version](https://lunr.readthedocs.io/en/latest/lunrjs-interop). + +An example can be found in the [MkDocs documentation library](http://www.mkdocs.org/). +MkDocs produces a set of documents from the pages of the documentation and uses +[Lunr.js](https://lunrjs.com) in the frontend to power its built-in searching +engine. This set of documents is in the form of a JSON file which needs to be +fetched and parsed by Lunr.js to create the inverted index at startup of your application. + +While this is not a problem for most sites, depending on the size of your document +set, this can take some time. + +Lunr.py provides a backend solution, allowing you to parse the documents in Python +of time and create a serialized Lunr.js index you can pass have the browser +version read, minimizing start up time of your application. + +Each version of lunr.py +[targets a specific version of lunr.js](https://github.com/yeraydiazdiaz/lunr.py/blob/master/lunr/__init__.py#L12) +and produces the same results for a +[non-trivial corpus of documents](https://github.com/yeraydiazdiaz/lunr.py/blob/master/tests/acceptance_tests/fixtures/mkdocs_index.json). + +## Installation + +`pip install lunr` + +An optional and experimental support for other languages thanks to the +[Natural Language Toolkit](http://www.nltk.org/) stemmers is also available via +`pip install lunr[languages]`. The usage of the language feature is subject to +[NTLK corpus licensing clauses](https://github.com/nltk/nltk#redistributing). + +Please refer to the +[documentation page on languages](https://lunr.readthedocs.io/en/latest/languages/) +for more information. + +## Usage + +First, you'll need a list of dicts representing the documents you want to search on. +These documents must have a unique field which will serve as a reference and a +series of fields you'd like to search on. + +Lunr provides a convenience `lunr` function to quickly index this set of documents: + +```python +>>> from lunr import lunr +>>> +>>> documents = [{ +... 'id': 'a', +... 'title': 'Mr. Green kills Colonel Mustard', +... 'body': 'Mr. Green killed Colonel Mustard in the study with the candlestick.', +... }, { +... 'id': 'b', +... 'title': 'Plumb waters plant', +... 'body': 'Professor Plumb has a green plant in his study', +... }] +>>> idx = lunr( +... ref='id', fields=('title', 'body'), documents=documents +... ) +>>> idx.search('kill') +[{'ref': 'a', 'score': 0.6931722372559913, 'match_data': <MatchData "kill">}] +>>> idx.search('study') +[{'ref': 'b', 'score': 0.23576799568081389, 'match_data': <MatchData "studi">}, {'ref': 'a', 'score': 0.2236629211724517, 'match_data': <MatchData "studi">}] +``` + +Please refer to the [documentation](http://lunr.readthedocs.io/en/latest/) +for more usage examples. + + + + +%prep +%autosetup -n lunr-0.6.2 + +%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-lunr -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Thu Mar 09 2023 Python_Bot <Python_Bot@openeuler.org> - 0.6.2-1 +- Package Spec generated @@ -0,0 +1 @@ +df1c6d9783d6e13a05a445f9165fb9ca lunr-0.6.2.tar.gz |