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

Uploaded Python 3

File details

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

File metadata

  • Download URL: algoliaqb-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 872fae171c31672a841ed89f96454d5839b0782b1c7196a8f07f179fbf1bb406
MD5 fd425691dd3da9e865aae7810be5cf2e
BLAKE2b-256 86b8b12d0716ed3fccf1dba7be28ba9380d8c3b15be269b19ecbb479507288bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: algoliaqb-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9978eefcf691cae50192ef0b7a92d82e5306898dd98279827648882cc970554e
MD5 2b773380352b1a195016c4765971ea61
BLAKE2b-256 75104a41586159bbfc0adb8aadd920af491479b2047f0e82d7757a993ca8bf0e

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