Algolia Query Builder
Project description
A library to help build queries for searching Algolia.
This package is meant to be used with the algoliasearch library.
Problem:
An app I have been working on has a few points of code duplication and increased complexity. This package is a way for me to fix those issues and increase readability.
Installation
pip install algoliaqb
Example:
from algoliasearch.search_client import SearchClient
from algoliaqb import AlgoliaQueryBuilder
from flask import request
aqb = AlgoliaQueryBuilder(
search_param="search",
filter_map={
"group_id": "tenant_id",
"is_reported": "is_reported"
}
)
# Extract the search query from our flask apps request.args var.
search_query = aqb.get_search_query(request.args)
# Get the filter query from our request args.
filter_query = aqb.get_filter_query(request.args)
# Now that we have the filter string, we just pass it into the search function.
search_client = SearchClient()
index = search_client.init_index("contacts")
results = index.search(search_query, {"filters": filter_query})
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
algoliaqb-0.0.2.tar.gz
(2.5 kB
view hashes)
Built Distribution
Close
Hashes for algoliaqb-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7f0a8f25656baa6587b5f536570c335d23e03360b6f61ae0d813d7695f09fff |
|
MD5 | 7ef9a0cebeeca49490b5a8097def3a30 |
|
BLAKE2b-256 | 0b858c94013608cb6caf2cedd6e1ac236e96f85ad491659e5d086acf1c72eaec |