summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--python-solrq.spec606
-rw-r--r--sources1
3 files changed, 608 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..e0edffa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/solrq-1.1.2.tar.gz
diff --git a/python-solrq.spec b/python-solrq.spec
new file mode 100644
index 0000000..0189fb0
--- /dev/null
+++ b/python-solrq.spec
@@ -0,0 +1,606 @@
+%global _empty_manifest_terminate_build 0
+Name: python-solrq
+Version: 1.1.2
+Release: 1
+Summary: Python Solr query utility
+License: BSD
+URL: https://github.com/swistakm/solrq
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/2c/d8/ba3d98034f149f3707dee33f5b1b5020c264006ba5caa87270c41580e314/solrq-1.1.2.tar.gz
+BuildArch: noarch
+
+
+%description
+[![Build Status](https://travis-ci.org/swistakm/solrq.svg?branch=master)](https://travis-ci.org/swistakm/solrq)
+[![Coverage Status](https://coveralls.io/repos/swistakm/solrq/badge.svg)](https://coveralls.io/r/swistakm/solrq)
+[![Documentation Status](https://readthedocs.org/projects/solrq/badge/?version=latest)](https://readthedocs.org/projects/solrq/?badge=latest)
+
+# solrq
+`solrq` is a Python Solr query utility. It helps making query strings for Solr
+and also helps with escaping reserved characters. `solrq` is has no external
+dependencies and is compatibile with `python3.7`, `python3,8`, `python3.9`, `python3.10`, `python3.11`, `pypy` and `pypy3`.
+It might be compatibile with other python releases/implentations but this has
+not been tested yet or is no longer tested (e.g `python3.2` or `python2.7`).
+
+ pip install solrq
+
+And you're ready to go!
+
+
+# usage
+
+Everything in `solrq` is about `Q()` object. Drop into python repl and just
+feed it with bunch of field and search terms to see how it works:
+
+```python
+>>> from solrq import Q
+>>> # note: all terms in single Q object are implicitely joined with 'AND'
+>>> query = Q(type="animal", species="dog")
+>>> query
+<Q: type:animal AND species:dog>
+
+>>> # ohh, forgot about cats?
+>>> query | Q(type="animal", species="cat")
+<Q: (type:animal AND species:dog) OR (type:animal AND species:cat)>
+
+>>># more a cat lover? Let's give them a boost boost
+>>> Q(type="animal") & (Q(species="cat")^2 | Q(species="dog"))
+<Q: type:animal AND ((species:cat^2) OR species:dog)>
+```
+
+But what to do with this `Q`? Simply pass it to your Solr library of choice,
+like [pysolr](https://github.com/toastdriven/pysolr) or
+[mysolr](https://github.com/RedTuna/mysolr). Most of python Solr libraries
+expect simple string as a query parameter and do not bother with escaping
+of reserved characters so you must take care of that by yourself. This is why
+`solrq` integrates so easily. Here is an example how you can use it with
+[pysolr](https://github.com/toastdriven/pysolr):
+
+```python
+from solrq import Q
+import pysolr
+
+solr = Solr("<your solr url>")
+
+# simply using Q object
+solr.search(Q(text="easy as f***"))
+
+# or explicitely making it string
+solr.search(str(Q(text="easy as f***")))
+```
+
+## quick reference
+
+Full reference can be found in [API reference documentation page](http://solrq.readthedocs.org/en/latest/api-reference.html)
+but here is a short reference.
+
+### boosting queries
+
+Use python `^` operator:
+
+```python
+>>> Q(text='cat') ^ 2
+<Q: text:cat^2>
+```
+
+### AND queries
+
+Use python `&` operator:
+
+```python
+>>> Q(text='cat') & Q(text='dog')
+<Q: text:cat AND text:dog>
+```
+
+### OR queries
+
+Use python `|` operator:
+
+```python
+>>> Q(text='cat') | Q(text='dog')
+<Q: text:cat OR text:dog>
+```
+
+### NOT queries
+
+Use python `~` operator:
+
+```python
+>>> ~ Q(text='cat')
+<Q: !text:cat>
+```
+
+### ranges
+
+Use `solrq.Range` wrapper:
+
+```python
+>>> from solrq import Range
+>>> Q(age=Range(18, 25))
+<Q: age:[18 TO 25]>
+```
+
+### proximity searches
+
+Use `solrq.Proximity` wrapper:
+
+```python
+>>> from solrq import Proximity
+>>> Q(age=Proximity("cat dogs", 5))
+<Q: age:"cat\ dogs"~5>
+```
+
+### safe strings
+
+All raw string values are treated as unsafe by default and will be escaped to
+ensure that final query string will not be broken by some rougue search value.
+This of course can be disabled if you know what you're doing using
+`Value` wrapper:
+
+```python
+>>> from solrq import Q, Value
+>>> Q(type='foo bar[]')
+<Q: type:foo\ bar\[\]>
+>>> Q(type=Value('foo bar[]', safe=True))
+<Q: type:foo bar[]>
+```
+
+### timedeltas, datetimes
+
+Simply as:
+
+```python
+>>> from datetime import datetime, timedelta
+>>> Q(date=datetime(1970, 1, 1))
+<Q: date:"1970-01-01T00:00:00Z">
+>>> # note that timedeltas has any sense mostly with ranges
+>>> Q(delta=timedelta(days=1))
+<Q: delta:NOW+1DAYS+0SECONDS+0MILLISECONDS>
+```
+
+### field wildcard
+
+If you need to use wildcards in field names just use dict and unpack it inside
+of `Q()` instead of using keyword arguments:
+
+```python
+ >>> Q(**{"*_t": "text_to_search"})
+ <Q: *_t:text_to_search>
+```
+
+# contributing
+
+Any contribution is welcome. Issues, suggestions, pull requests - whatever.
+There are no strict contribution guidelines beyond PEP-8 and sanity.
+Code style is checked with flakes8 and any PR that has failed build
+will not be merged.
+
+One thing: if you submit a PR please do not rebase it later unless you
+are asked for that explicitely. Reviewing pull requests that suddenly had
+their history rewritten just drives me crazy.
+
+# testing
+
+Tests are run using tox. Simply install it and run:
+
+ pip install tox
+ tox
+
+And that's all.
+
+
+
+
+%package -n python3-solrq
+Summary: Python Solr query utility
+Provides: python-solrq
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-solrq
+[![Build Status](https://travis-ci.org/swistakm/solrq.svg?branch=master)](https://travis-ci.org/swistakm/solrq)
+[![Coverage Status](https://coveralls.io/repos/swistakm/solrq/badge.svg)](https://coveralls.io/r/swistakm/solrq)
+[![Documentation Status](https://readthedocs.org/projects/solrq/badge/?version=latest)](https://readthedocs.org/projects/solrq/?badge=latest)
+
+# solrq
+`solrq` is a Python Solr query utility. It helps making query strings for Solr
+and also helps with escaping reserved characters. `solrq` is has no external
+dependencies and is compatibile with `python3.7`, `python3,8`, `python3.9`, `python3.10`, `python3.11`, `pypy` and `pypy3`.
+It might be compatibile with other python releases/implentations but this has
+not been tested yet or is no longer tested (e.g `python3.2` or `python2.7`).
+
+ pip install solrq
+
+And you're ready to go!
+
+
+# usage
+
+Everything in `solrq` is about `Q()` object. Drop into python repl and just
+feed it with bunch of field and search terms to see how it works:
+
+```python
+>>> from solrq import Q
+>>> # note: all terms in single Q object are implicitely joined with 'AND'
+>>> query = Q(type="animal", species="dog")
+>>> query
+<Q: type:animal AND species:dog>
+
+>>> # ohh, forgot about cats?
+>>> query | Q(type="animal", species="cat")
+<Q: (type:animal AND species:dog) OR (type:animal AND species:cat)>
+
+>>># more a cat lover? Let's give them a boost boost
+>>> Q(type="animal") & (Q(species="cat")^2 | Q(species="dog"))
+<Q: type:animal AND ((species:cat^2) OR species:dog)>
+```
+
+But what to do with this `Q`? Simply pass it to your Solr library of choice,
+like [pysolr](https://github.com/toastdriven/pysolr) or
+[mysolr](https://github.com/RedTuna/mysolr). Most of python Solr libraries
+expect simple string as a query parameter and do not bother with escaping
+of reserved characters so you must take care of that by yourself. This is why
+`solrq` integrates so easily. Here is an example how you can use it with
+[pysolr](https://github.com/toastdriven/pysolr):
+
+```python
+from solrq import Q
+import pysolr
+
+solr = Solr("<your solr url>")
+
+# simply using Q object
+solr.search(Q(text="easy as f***"))
+
+# or explicitely making it string
+solr.search(str(Q(text="easy as f***")))
+```
+
+## quick reference
+
+Full reference can be found in [API reference documentation page](http://solrq.readthedocs.org/en/latest/api-reference.html)
+but here is a short reference.
+
+### boosting queries
+
+Use python `^` operator:
+
+```python
+>>> Q(text='cat') ^ 2
+<Q: text:cat^2>
+```
+
+### AND queries
+
+Use python `&` operator:
+
+```python
+>>> Q(text='cat') & Q(text='dog')
+<Q: text:cat AND text:dog>
+```
+
+### OR queries
+
+Use python `|` operator:
+
+```python
+>>> Q(text='cat') | Q(text='dog')
+<Q: text:cat OR text:dog>
+```
+
+### NOT queries
+
+Use python `~` operator:
+
+```python
+>>> ~ Q(text='cat')
+<Q: !text:cat>
+```
+
+### ranges
+
+Use `solrq.Range` wrapper:
+
+```python
+>>> from solrq import Range
+>>> Q(age=Range(18, 25))
+<Q: age:[18 TO 25]>
+```
+
+### proximity searches
+
+Use `solrq.Proximity` wrapper:
+
+```python
+>>> from solrq import Proximity
+>>> Q(age=Proximity("cat dogs", 5))
+<Q: age:"cat\ dogs"~5>
+```
+
+### safe strings
+
+All raw string values are treated as unsafe by default and will be escaped to
+ensure that final query string will not be broken by some rougue search value.
+This of course can be disabled if you know what you're doing using
+`Value` wrapper:
+
+```python
+>>> from solrq import Q, Value
+>>> Q(type='foo bar[]')
+<Q: type:foo\ bar\[\]>
+>>> Q(type=Value('foo bar[]', safe=True))
+<Q: type:foo bar[]>
+```
+
+### timedeltas, datetimes
+
+Simply as:
+
+```python
+>>> from datetime import datetime, timedelta
+>>> Q(date=datetime(1970, 1, 1))
+<Q: date:"1970-01-01T00:00:00Z">
+>>> # note that timedeltas has any sense mostly with ranges
+>>> Q(delta=timedelta(days=1))
+<Q: delta:NOW+1DAYS+0SECONDS+0MILLISECONDS>
+```
+
+### field wildcard
+
+If you need to use wildcards in field names just use dict and unpack it inside
+of `Q()` instead of using keyword arguments:
+
+```python
+ >>> Q(**{"*_t": "text_to_search"})
+ <Q: *_t:text_to_search>
+```
+
+# contributing
+
+Any contribution is welcome. Issues, suggestions, pull requests - whatever.
+There are no strict contribution guidelines beyond PEP-8 and sanity.
+Code style is checked with flakes8 and any PR that has failed build
+will not be merged.
+
+One thing: if you submit a PR please do not rebase it later unless you
+are asked for that explicitely. Reviewing pull requests that suddenly had
+their history rewritten just drives me crazy.
+
+# testing
+
+Tests are run using tox. Simply install it and run:
+
+ pip install tox
+ tox
+
+And that's all.
+
+
+
+
+%package help
+Summary: Development documents and examples for solrq
+Provides: python3-solrq-doc
+%description help
+[![Build Status](https://travis-ci.org/swistakm/solrq.svg?branch=master)](https://travis-ci.org/swistakm/solrq)
+[![Coverage Status](https://coveralls.io/repos/swistakm/solrq/badge.svg)](https://coveralls.io/r/swistakm/solrq)
+[![Documentation Status](https://readthedocs.org/projects/solrq/badge/?version=latest)](https://readthedocs.org/projects/solrq/?badge=latest)
+
+# solrq
+`solrq` is a Python Solr query utility. It helps making query strings for Solr
+and also helps with escaping reserved characters. `solrq` is has no external
+dependencies and is compatibile with `python3.7`, `python3,8`, `python3.9`, `python3.10`, `python3.11`, `pypy` and `pypy3`.
+It might be compatibile with other python releases/implentations but this has
+not been tested yet or is no longer tested (e.g `python3.2` or `python2.7`).
+
+ pip install solrq
+
+And you're ready to go!
+
+
+# usage
+
+Everything in `solrq` is about `Q()` object. Drop into python repl and just
+feed it with bunch of field and search terms to see how it works:
+
+```python
+>>> from solrq import Q
+>>> # note: all terms in single Q object are implicitely joined with 'AND'
+>>> query = Q(type="animal", species="dog")
+>>> query
+<Q: type:animal AND species:dog>
+
+>>> # ohh, forgot about cats?
+>>> query | Q(type="animal", species="cat")
+<Q: (type:animal AND species:dog) OR (type:animal AND species:cat)>
+
+>>># more a cat lover? Let's give them a boost boost
+>>> Q(type="animal") & (Q(species="cat")^2 | Q(species="dog"))
+<Q: type:animal AND ((species:cat^2) OR species:dog)>
+```
+
+But what to do with this `Q`? Simply pass it to your Solr library of choice,
+like [pysolr](https://github.com/toastdriven/pysolr) or
+[mysolr](https://github.com/RedTuna/mysolr). Most of python Solr libraries
+expect simple string as a query parameter and do not bother with escaping
+of reserved characters so you must take care of that by yourself. This is why
+`solrq` integrates so easily. Here is an example how you can use it with
+[pysolr](https://github.com/toastdriven/pysolr):
+
+```python
+from solrq import Q
+import pysolr
+
+solr = Solr("<your solr url>")
+
+# simply using Q object
+solr.search(Q(text="easy as f***"))
+
+# or explicitely making it string
+solr.search(str(Q(text="easy as f***")))
+```
+
+## quick reference
+
+Full reference can be found in [API reference documentation page](http://solrq.readthedocs.org/en/latest/api-reference.html)
+but here is a short reference.
+
+### boosting queries
+
+Use python `^` operator:
+
+```python
+>>> Q(text='cat') ^ 2
+<Q: text:cat^2>
+```
+
+### AND queries
+
+Use python `&` operator:
+
+```python
+>>> Q(text='cat') & Q(text='dog')
+<Q: text:cat AND text:dog>
+```
+
+### OR queries
+
+Use python `|` operator:
+
+```python
+>>> Q(text='cat') | Q(text='dog')
+<Q: text:cat OR text:dog>
+```
+
+### NOT queries
+
+Use python `~` operator:
+
+```python
+>>> ~ Q(text='cat')
+<Q: !text:cat>
+```
+
+### ranges
+
+Use `solrq.Range` wrapper:
+
+```python
+>>> from solrq import Range
+>>> Q(age=Range(18, 25))
+<Q: age:[18 TO 25]>
+```
+
+### proximity searches
+
+Use `solrq.Proximity` wrapper:
+
+```python
+>>> from solrq import Proximity
+>>> Q(age=Proximity("cat dogs", 5))
+<Q: age:"cat\ dogs"~5>
+```
+
+### safe strings
+
+All raw string values are treated as unsafe by default and will be escaped to
+ensure that final query string will not be broken by some rougue search value.
+This of course can be disabled if you know what you're doing using
+`Value` wrapper:
+
+```python
+>>> from solrq import Q, Value
+>>> Q(type='foo bar[]')
+<Q: type:foo\ bar\[\]>
+>>> Q(type=Value('foo bar[]', safe=True))
+<Q: type:foo bar[]>
+```
+
+### timedeltas, datetimes
+
+Simply as:
+
+```python
+>>> from datetime import datetime, timedelta
+>>> Q(date=datetime(1970, 1, 1))
+<Q: date:"1970-01-01T00:00:00Z">
+>>> # note that timedeltas has any sense mostly with ranges
+>>> Q(delta=timedelta(days=1))
+<Q: delta:NOW+1DAYS+0SECONDS+0MILLISECONDS>
+```
+
+### field wildcard
+
+If you need to use wildcards in field names just use dict and unpack it inside
+of `Q()` instead of using keyword arguments:
+
+```python
+ >>> Q(**{"*_t": "text_to_search"})
+ <Q: *_t:text_to_search>
+```
+
+# contributing
+
+Any contribution is welcome. Issues, suggestions, pull requests - whatever.
+There are no strict contribution guidelines beyond PEP-8 and sanity.
+Code style is checked with flakes8 and any PR that has failed build
+will not be merged.
+
+One thing: if you submit a PR please do not rebase it later unless you
+are asked for that explicitely. Reviewing pull requests that suddenly had
+their history rewritten just drives me crazy.
+
+# testing
+
+Tests are run using tox. Simply install it and run:
+
+ pip install tox
+ tox
+
+And that's all.
+
+
+
+
+%prep
+%autosetup -n solrq-1.1.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-solrq -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 1.1.2-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..eaa6f76
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+c22c41eaf1f732d2281823ffc8e84e40 solrq-1.1.2.tar.gz