A fully-featured and blazing-fast Python API client to interact with Flapjack Search. Drop-in replacement for algoliasearch.
Project description
Flapjack Search Python SDK
A fully-featured Python API client for Flapjack Search. Drop-in replacement for algoliasearch.
Getting Started
pip install flapjack-search
Basic usage
from flapjacksearch.search.client import SearchClientSync
from flapjacksearch.search.config import SearchConfig
from flapjacksearch.http.hosts import Host, HostsCollection, CallType
# For self-hosted Flapjack server
config = SearchConfig("my-app", "my-api-key")
config.hosts = HostsCollection([
Host(url="search.example.com", scheme="https", accept=CallType.READ | CallType.WRITE)
])
client = SearchClientSync.create_with_config(config=config)
# Index some data
client.save_objects(
index_name="products",
objects=[
{"objectID": "1", "name": "iPhone 15", "brand": "Apple", "price": 999},
{"objectID": "2", "name": "Galaxy S24", "brand": "Samsung", "price": 899},
],
)
# Search
from flapjacksearch.search.models import SearchMethodParams, SearchForHits, SearchQuery
result = client.search(
search_method_params=SearchMethodParams(
requests=[SearchQuery(SearchForHits(index_name="products", query="iphone"))]
)
)
for hit in result.results[0].actual_instance.hits:
print(hit.name, hit.price)
Local development
config = SearchConfig("test-app", "test-api-key")
config.hosts = HostsCollection([
Host(url="localhost:7700", scheme="http", accept=CallType.READ | CallType.WRITE)
])
client = SearchClientSync.create_with_config(config=config)
Async support
from flapjacksearch.search.client import SearchClient
# Async client — same API, just use await
client = SearchClient.create_with_config(config=config)
result = await client.search(...)
Migrating from Algolia?
Switching from algoliasearch takes about 5 minutes:
pip uninstall algoliasearch
pip install flapjack-search
- from algoliasearch.search.client import SearchClientSync
+ from flapjacksearch.search.client import SearchClientSync
- from algoliasearch.search.models import SearchMethodParams, SearchForHits, SearchQuery
+ from flapjacksearch.search.models import SearchMethodParams, SearchForHits, SearchQuery
All method signatures, parameters, and response types are identical. Your existing code works with just the import change.
See MIGRATION.md for the full migration guide.
API compatibility
Every method from Algolia's Python v4 SDK works identically:
| Operation | Method | Works? |
|---|---|---|
| Search | client.search(...) |
Yes |
| Save objects | client.save_objects(...) |
Yes |
| Get object | client.get_object(...) |
Yes |
| Partial update | client.partial_update_object(...) |
Yes |
| Delete object | client.delete_object(...) |
Yes |
| Get settings | client.get_settings(...) |
Yes |
| Set settings | client.set_settings(...) |
Yes |
| Synonyms | client.save_synonyms(...) |
Yes |
| Rules | client.save_rules(...) |
Yes |
| List indices | client.list_indices() |
Yes |
| Wait for task | client.wait_for_task(...) |
Yes |
| API keys | client.add_api_key(...) |
Yes |
Troubleshooting
Encountering an issue? Open a GitHub issue and we'll help.
License
MIT
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
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 flapjack_search-0.1.0b1.tar.gz.
File metadata
- Download URL: flapjack_search-0.1.0b1.tar.gz
- Upload date:
- Size: 403.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c043b5db3ef98512a68de9986b58cc26193e6a056ebf5f03a21c638b8c0bde0
|
|
| MD5 |
838d0bfd042f6697d15e6fc6f28fe8ca
|
|
| BLAKE2b-256 |
b1c108eb2a406b10c2fbcd8aec0474cb625262f7d881141db1a7d723911c99e2
|
File details
Details for the file flapjack_search-0.1.0b1-py3-none-any.whl.
File metadata
- Download URL: flapjack_search-0.1.0b1-py3-none-any.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10c18cb879167cce7f9b3116d17c640bd3401b726ed6be92440a9fbb421977e4
|
|
| MD5 |
a3bb51f11744a30efcaeeaf54b67115d
|
|
| BLAKE2b-256 |
cf30106271d4fc4cbc07484c26988dd5843ad958db94ec9c99e693293561c958
|