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.

Algolia Query Builder

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.3.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.3-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: algoliaqb-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 f6a20c81a4fdaba1fe09bbed9bdafac22596fa91e56d05ef9ffa37b91cac0641
MD5 b4b038c1ce1f836dbf371be15e9a64cd
BLAKE2b-256 7c5a1beca3dab211460b933ff3eb1e0304b1bac0282e4e8dce5591eeb914f2be

See more details on using hashes here.

File details

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

File metadata

  • Download URL: algoliaqb-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.2 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0466c62290b834696bfa3b97d95856f9741b7d65c42b0d314a9a9b7f5bcddc3d
MD5 9a846daffb4c1a2cec4252e3b86830d1
BLAKE2b-256 2d9d01fa840750267bc5757e6261c39b09919c326b68f0edb98f2ee92b7d5480

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