Simple full-text search library with SQL backend
Project description
Sifts – Simple Full Text Search
Sifts is a simple Python full text search engine library with an SQLite or PostgreSQL backend.
It is meant to be used with Python libraries that need full-text search support, but where deploying something like ElasticSearch is overkill.
It supports both SQLite FTS5 and PostgreSQL FTS as backends.
Installation
pip install sifts
Usage
import sifts
# by default, creates a new SQLite database in the working directory
collection = sifts.Collection(name="my_collection")
# Add docs to the index. Can also update and delete.
collection.add(
documents=["Lorem ipsum dolor", "sit amet"],
metadatas=[{"foo": "bar"}, {"foo": "baz"}], # otpional, can filter on these
ids=["doc1", "doc2"], # unique for each doc. Uses UUIDs if omitted
)
results = collection.query(
"Lorem",
# limit=2, # optionally limit the number of results
# where={"foo": "bar"}, # optional filter
# order_by="foo", # sort by metadata key (rather than rank)
)
The API is inspired by chroma.
Search Syntax
Sifts supports the following search syntax:
- Search for individual words
- Search for multiple words (will match documents where all words are present)
and
operatoror
operator*
wildcard (in SQLite, supported anywhere in the search term, in PostgreSQL only at the end of the search term)
The search syntax is the same regardless of backend.
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
sifts-0.8.0.tar.gz
(13.4 kB
view hashes)
Built Distribution
sifts-0.8.0-py3-none-any.whl
(7.9 kB
view hashes)