A Solr client library written in Rust
Project description
Solrstice: A Solr 8+ Client for Rust and Python
Solrstice is a solr client library written in rust. With this wrapper you can use it in python.
Both asyncio and blocking clients are provided. All apis have type hints. Documentation can be found at sh1nku.github.io/solrstice/python
Installation
pip install solrstice
Basic Usage
Async
import asyncio
from solrstice.clients import AsyncSolrCloudClient
from solrstice.hosts import SolrSingleServerHost, SolrServerContext
from solrstice.auth import SolrBasicAuth
from solrstice.queries import UpdateQueryBuilder, SelectQueryBuilder, DeleteQueryBuilder
# A SolrServerContext specifies how the library should interact with Solr
context = SolrServerContext(SolrSingleServerHost('localhost:8983'), SolrBasicAuth('solr', 'SolrRocks'))
client = AsyncSolrCloudClient(context)
async def main():
# Create config and collection
await client.upload_config('example_config', 'path/to/config')
await client.create_collection('example_collection', 'example_config', shards=1, replication_factor=1)
# Index a document
await client.index(UpdateQueryBuilder(), 'example_collection', [{'id': 'example_document', 'title': 'Example document'}])
# Search for the document
response = await client.select(SelectQueryBuilder(fq=['title:Example document']), 'example_collection')
docs = response.get_response().docs
# Delete the document
await client.delete(DeleteQueryBuilder(ids=['example_document']), 'example_collection')
asyncio.run(main())
Blocking
from solrstice.clients import BlockingSolrCloudClient
from solrstice.hosts import SolrSingleServerHost, SolrServerContext
from solrstice.auth import SolrBasicAuth
from solrstice.queries import UpdateQueryBuilder, SelectQueryBuilder, DeleteQueryBuilder
# A SolrServerContext specifies how the library should interact with Solr
context = SolrServerContext(SolrSingleServerHost('localhost:8983'), SolrBasicAuth('solr', 'SolrRocks'))
client = BlockingSolrCloudClient(context)
# Create config and collection
client.upload_config('example_config', 'path/to/config')
client.create_collection('example_collection', 'example_config', shards=1, replication_factor=1)
# Index a document
client.index(UpdateQueryBuilder(), 'example_collection', [{'id': 'example_document', 'title': 'Example document'}])
# Search for the document
response = client.select(SelectQueryBuilder(fq=['title:Example document']), 'example_collection')
docs = response.get_response().docs
Notes
- Multiprocessing does not work, and will block forever. Normal multithreading works fine.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
solrstice-0.1.1.tar.gz
(59.3 kB
view hashes)
Built Distributions
Close
Hashes for solrstice-0.1.1-cp38-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9d83a80b6dd3954846b22c800d79f969a12e4898815cf37238b135789dd9ca3 |
|
MD5 | 894e17a81dfd10dd2f54ab009ff08fdf |
|
BLAKE2b-256 | 421ac0641768ea37ba63dbaed1f41b7d6efea27cdad4d92cb472119d937e102b |
Close
Hashes for solrstice-0.1.1-cp38-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06244e51bc93aa0d6406e434c200c0b56b2da25c93f4dd90cc00596e9cecaf68 |
|
MD5 | 221b5109df7841adc96dd0392a4c42c6 |
|
BLAKE2b-256 | 423102c54ae76569cf0a10e21c4251766fda2b01602c04d04cf10cf626342b72 |
Close
Hashes for solrstice-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dcd6da868ab76eda9d51a8d4464b73ddda9f1c0c092ce69055ac07c71a2391c |
|
MD5 | c444c4f1ae31af2745a9cf4e65fbea0e |
|
BLAKE2b-256 | 45312704f62727fd07eae567b620839b4f607f87a8987d6aaed4cda268647799 |
Close
Hashes for solrstice-0.1.1-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0aad0a6738b9ed66becfecf162bef30c99a62d83f7ec66728af844b1266525c |
|
MD5 | 0a10c6f4cbb819764342edae506eeaab |
|
BLAKE2b-256 | f7f5b8a324779142a10c82f8d489fbefafc2320cbb04e6da3e8d5e96c7986793 |
Close
Hashes for solrstice-0.1.1-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c711d8c537eb21c9260fc27f0c364c8a5634c5da227cae6160a0afcecf679bbb |
|
MD5 | cdb457e284f8e635c85f1a7a56940746 |
|
BLAKE2b-256 | 830df83dd87f6e960f59878a7c3f959c2700783a723b09bdb9f2d4878897c6bb |
Close
Hashes for solrstice-0.1.1-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a718cc57446c6b1647ac9110fc766175acf8f63589ebc4096222ec14b10a9c12 |
|
MD5 | 6b8e0cd514201b572381ab35e9ba0cbe |
|
BLAKE2b-256 | 0d6f7329942342a92dbcbf47e6d8ed840955eefe5833f369e6c7189d39d7eadc |
Close
Hashes for solrstice-0.1.1-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6dfe64ddc2906166ac0124da332079f2468dc2334a6808a46f40e11471f9d56a |
|
MD5 | 5ff05aa11da1cee3fc62f25fb5024252 |
|
BLAKE2b-256 | 46de3f7d4fad0cee48f133560d6a3a64f9f5fc03aea1ca9a2eba34259244c063 |
Close
Hashes for solrstice-0.1.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ead72ef047b558c64253bc3d457bbbb903a01c294bb2fb52f7098051837dbb62 |
|
MD5 | 5359eb989c36af6d545389055cb03628 |
|
BLAKE2b-256 | eb72ceff75f9f6bbba6f6ec7475fb6ac5077764bc563ba25472564ef963d15c9 |
Close
Hashes for solrstice-0.1.1-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ea4a0376d08ec728391209f9cef5239f44d9abf273d0b225302b174c01e2629 |
|
MD5 | c372934127451831a9a2ffd3ad073edf |
|
BLAKE2b-256 | bab7960c66d695eeb884bcfe9f7faa99a1086773b4f3340bb3f0b7b89939b073 |
Close
Hashes for solrstice-0.1.1-cp38-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57ad653c0bf387cd46e404aea620b8ea41d188d0d11de78fbf7ff934161393d6 |
|
MD5 | b220dbacce69d85e139557dc82595101 |
|
BLAKE2b-256 | c23194fabdbf5dabe2d5649b82f0a91b1e7db4f4228b638b13a8ca7610a555dc |