Skip to main content

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.

PyPI Python License

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flapjack_search-1.0.0.tar.gz (403.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flapjack_search-1.0.0-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file flapjack_search-1.0.0.tar.gz.

File metadata

  • Download URL: flapjack_search-1.0.0.tar.gz
  • Upload date:
  • Size: 403.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.14.5 Darwin/25.3.0

File hashes

Hashes for flapjack_search-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8b764e9c11d8b12bd608ed87adec85d683410580d608e2d355d7588a39cd7d25
MD5 0b97655d1593df2e832027879a831bc7
BLAKE2b-256 26dfa7479877262b91214fac05c7f3dbb9819b854e4b891cc898595ab458d15c

See more details on using hashes here.

File details

Details for the file flapjack_search-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: flapjack_search-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.14.5 Darwin/25.3.0

File hashes

Hashes for flapjack_search-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a6cbc7a1996cddcbfbe9310709af311905285c3511ece692ed8c3f351b12683
MD5 a19c072919b1823822e388b39f2ffffd
BLAKE2b-256 b3d14970b71a2744be961fbd11620638caf1e2dccbdcc79d85ba301f920ecf10

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