Skip to main content

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.

PyPI version

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


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.6.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

algoliaqb-0.0.6-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file algoliaqb-0.0.6.tar.gz.

File metadata

  • Download URL: algoliaqb-0.0.6.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for algoliaqb-0.0.6.tar.gz
Algorithm Hash digest
SHA256 b81ca407cdfac67611e1a0376d3e944618c7b959b919a3b4dc90c4587e2ed26d
MD5 5c54dcf93d92c9df67af8d260f0bbe06
BLAKE2b-256 abe3084cc372b6f12108342740eec02a5526b8d5907e211edd495b6f34c47444

See more details on using hashes here.

File details

Details for the file algoliaqb-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: algoliaqb-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for algoliaqb-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 855ae7f25c18ed3b2d27c2012c8299f190187ab425840170eec0e0834111471e
MD5 95ce83d56f2469cfd4e5610b09694f41
BLAKE2b-256 ade824be78950122aa63e14b47ba011d3a9db5a035892023422c388cf9e51187

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page