Skip to content

Commit c0af91c

Browse files
docs: Update README with badges and Docker script references (#536)
* docs: Update README with badges and Docker script references * doc: Fix documentation for pysolr.Solr list argument to use a normal argument * Fixes suggested in code review --------- Co-authored-by: Christian Clauss <cclauss@me.com>
1 parent ebf608a commit c0af91c

File tree

1 file changed

+48
-9
lines changed

1 file changed

+48
-9
lines changed

README.rst

Lines changed: 48 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,35 @@ interface that queries the server and returns results based on the query.
77

88
.. _`Apache Solr`: https://solr.apache.org/
99

10+
11+
|PyPI| |Python| |Solr| |CI| |PyPI downloads| |GitHub Stars|
12+
13+
.. |PyPI| image:: https://img.shields.io/pypi/v/pysolr.svg
14+
:target: https://pypi.org/project/pysolr/
15+
:alt: PyPI
16+
17+
.. |Python| image:: https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14%20%7C%203.14t-3776AB?logo=python&logoColor=white
18+
:target: https://www.python.org/downloads/
19+
:alt: Python 3.10+
20+
21+
.. |Solr| image:: https://img.shields.io/badge/Solr-9+-d9411e?logo=apache&logoColor=white
22+
:target: https://solr.apache.org/
23+
:alt: Solr 9+
24+
25+
.. |CI| image:: https://github.com/django-haystack/pysolr/actions/workflows/ci.yml/badge.svg
26+
:target: https://github.com/django-haystack/pysolr/actions
27+
:alt: CI Status
28+
29+
.. |PyPI downloads| image:: https://img.shields.io/pypi/dm/pysolr.svg
30+
:target: https://pypi.org/project/pysolr/
31+
:alt: PyPI downloads
32+
33+
.. |GitHub Stars| image:: https://img.shields.io/github/stars/django-haystack/pysolr.svg?style=social
34+
:target: https://github.com/django-haystack/pysolr/stargazers
35+
:alt: GitHub Stars
36+
37+
----
38+
1039
Status
1140
======
1241

@@ -55,7 +84,8 @@ Basic usage looks like:
5584
import pysolr
5685
5786
# Create a client instance. The timeout and authentication options are not required.
58-
solr = pysolr.Solr('http://localhost:8983/solr/', always_commit=True, [timeout=10], [auth=<type of authentication>])
87+
# Solr URL format: http://host:port/solr/<CORE_NAME>
88+
solr = pysolr.Solr("http://localhost:8983/solr/my_core", always_commit=True, [timeout=10], [auth=<type of authentication>])
5989
6090
# Note that auto_commit defaults to False for performance. You can set
6191
# `auto_commit=True` to have commands always update the index immediately, make
@@ -139,7 +169,7 @@ Simply point the URL to the index core:
139169
.. code-block:: python
140170
141171
# Setup a Solr instance. The timeout is optional.
142-
solr = pysolr.Solr('http://localhost:8983/solr/core_0/', timeout=10)
172+
solr = pysolr.Solr("http://localhost:8983/solr/my_core", timeout=10)
143173
144174
145175
Custom Request Handlers
@@ -148,7 +178,7 @@ Custom Request Handlers
148178
.. code-block:: python
149179
150180
# Setup a Solr instance. The trailing slash is optional.
151-
solr = pysolr.Solr('http://localhost:8983/solr/core_0/', search_handler='/autocomplete', use_qt_param=False)
181+
solr = pysolr.Solr("http://localhost:8983/solr/my_core", search_handler="/autocomplete", use_qt_param=False)
152182
153183
154184
If ``use_qt_param`` is ``True`` it is essential that the name of the handler is
@@ -175,7 +205,7 @@ Custom Authentication
175205
from requests_kerberos import HTTPKerberosAuth, OPTIONAL
176206
kerberos_auth = HTTPKerberosAuth(mutual_authentication=OPTIONAL, sanitize_mutual_error_response=False)
177207
178-
solr = pysolr.Solr('http://localhost:8983/solr/', auth=kerberos_auth)
208+
solr = pysolr.Solr("http://localhost:8983/solr/my_core", auth=kerberos_auth)
179209
180210
.. code-block:: python
181211
@@ -193,14 +223,14 @@ If your Solr servers run off https
193223
.. code-block:: python
194224
195225
# Setup a Solr instance in an https environment
196-
solr = pysolr.Solr('http://localhost:8983/solr/', verify=path/to/cert.pem)
226+
solr = pysolr.Solr("http://localhost:8983/solr/my_core", verify="path/to/cert.pem")
197227
198228
.. code-block:: python
199229
200230
# Setup a CloudSolr instance in a kerborized environment
201231
202232
zookeeper = pysolr.ZooKeeper("zkhost1:2181/solr, zkhost2:2181,...,zkhostN:2181")
203-
solr = pysolr.SolrCloud(zookeeper, "collection", verify=path/to/cert.perm)
233+
solr = pysolr.SolrCloud(zookeeper, "collection", verify="path/to/cert.perm")
204234
205235
206236
Custom Commit Policy
@@ -210,7 +240,7 @@ Custom Commit Policy
210240
211241
# Setup a Solr instance. The trailing slash is optional.
212242
# All requests to Solr will be immediately committed because `always_commit=True`:
213-
solr = pysolr.Solr('http://localhost:8983/solr/core_0/', search_handler='/autocomplete', always_commit=True)
243+
solr = pysolr.Solr("http://localhost:8983/solr/my_core", search_handler="/autocomplete", always_commit=True)
214244
215245
``always_commit`` signals to the Solr object to either commit or not commit by
216246
default for any solr request. Be sure to change this to ``True`` if you are
@@ -255,9 +285,18 @@ recommended for testing by default unless you need more control.
255285
Running a test Solr instance
256286
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
257287

258-
Downloading, configuring and running Solr 4 looks like this::
288+
Downloading, configuring and running Solr 9 looks like this::
289+
290+
./solr-docker-test-env.sh setup
291+
292+
To specify a different Solr version::
293+
294+
export SOLR_VERSION=9.8.0
295+
./solr-docker-test-env.sh setup
296+
297+
To stop and remove the Solr test environment::
259298

260-
./start-solr-test-server.sh
299+
./solr-docker-test-env.sh destroy
261300

262301
Running the tests
263302
~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)