Search abstraction layer
Project description
Salinic
Salinic - provides modular search. It features a unified, familiar API that allows you to plug in different search backends. Currently it supports only Xapian backend.
Usage
Declare your search schema:
from typing import Optional
from salinic.field import IdField, KeywordField, TextField
from salinic.schema import Schema
class IndexEntity(Schema):
id: str = IdField(primary_key=True)
user_id: str
parent_id: str
title: str = TextField()
text: Optional[str] = TextField()
tags: list[str] | None = KeywordField()
Index your documents:
from salinic import Session, create_engine
engine = create_engine("xapian:////search_index")
session = Session(engine)
for document in all_your_documents():
entity = IndexEntity(
id=str(document.id),
user_id=str(document.user_id),
parent_id=document.parent_id,
title=document.title,
text=document.text,
tags=document.tags
)
session.add(entity)
Search your documents:
from salinic import Session, create_engine
engine = create_engine("xapian:////search_index")
session = Session(engine)
sq = Search(IndexEntity).query(" your query string ")
for found in session.exec(sq):
print(found) # found is instance of IndexEntity
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
salinic-0.2.0.tar.gz
(6.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file salinic-0.2.0.tar.gz.
File metadata
- Download URL: salinic-0.2.0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1041-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7cb997689d6dfd6f9e18041fbecea9d3379768388c76264abf2f09cc156a7a5
|
|
| MD5 |
8bf68a8aafba00456757d0cc414fcccc
|
|
| BLAKE2b-256 |
9451bb461b0bf7494b112e675b20dbb95cc8ccd2360012b12688260f00e5b3a4
|
File details
Details for the file salinic-0.2.0-py3-none-any.whl.
File metadata
- Download URL: salinic-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1041-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a20485a26c6cd46149d4a1c67854914a0ac27634680467a98afecf33191ac5b
|
|
| MD5 |
5df517beda540e0d4eff91588bdf3928
|
|
| BLAKE2b-256 |
c4edb51bc2a146577898b773debd8029a5de744d86439fe42eebbad87d76f050
|