Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Readme
A library to help build queries for searching Algolia.
This package is meant to be used with the algoliasearch <https://github.com/algolia/algoliasearch-client-python>
_ library.
.. image:: https://badge.fury.io/py/algoliaqb.svg :target: https://badge.fury.io/py/algoliaqb :alt: 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 ^^^^^^^^^^^^
.. code-block::
pip install algoliaqb
Filter Strings ^^^^^^^^^^^^^^
By default filter_map
considers all input as strings. This is pretty straight forward. Lets say for example you have the following filter map:
.. code-block::
filter_map = { "group_id": "tenant_id", }
with the following flask.args
\ :
.. code-block::
{ "group_id": 1 }
AlgoliaQB will look for group_id
within flask.args
\ , grab the value, then remap the key and value for you.
.. code-block::
tenant_id:1
Now lets try an example with a few more filters.
.. code-block::
filter_map = { "group_id": "tenant_id", "is_reported": "is_reported" }
with the following flask.args
\ :
.. code-block::
{ "group_id": 1, "is_reported": "true }
The returned filter_string is as follows.
.. code-block::
tenant_id:1 AND is_reported:true
Library Usage Example: ^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
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" } )
search_query = aqb.get_search_query(request.args)
filter_query = aqb.get_filter_query(request.args)
search_client = SearchClient() index = search_client.init_index("contacts") results = index.search(search_query, {"filters": filter_query})
FAQs
Algolia Query Builder
We found that algoliaqb demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.