Skip to main content

No project description provided

Project description

Build Status License: MIT

tantivy-py

Python bindings for Tantivy.

Installation

The bindings can be installed using from pypi using pip:

pip install tantivy

If no binary wheel is present for your operating system the bindings will be build from source, this means that Rust needs to be installed before building can succeed.

Note that the bindings are using PyO3, which only supports python3.

Development

Setting up a development environment can be done in a virtual environment using nox or using local packages using the provided Makefile.

For the nox setup install the virtual environment and build the bindings using:

python3 -m pip install nox
nox

For the Makefile based setup run:

make

Running the tests is done using:

make test

Usage

The Python bindings have a similar API to Tantivy. To create a index first a schema needs to be built. After that documents can be added to the index and a reader can be created to search the index.

import tantivy

# Declaring our schema.
schema_builder = tantivy.SchemaBuilder()
schema_builder.add_text_field("title", stored=True)
schema_builder.add_text_field("body", stored=True)
schema = schema_builder.build()

# Creating our index (in memory, but filesystem is available too)
index = tantivy.Index(schema)


# Adding one document.
writer = index.writer()
writer.add_document(tantivy.Document(
    title=["The Old Man and the Sea"],
    body=["""He was an old man who fished alone in a skiff in the Gulf Stream and he had gone eighty-four days now without taking a fish."""],
))
# ... and committing
writer.commit()


# Reload the index to ensure it points to the last commit.
index.reload()
searcher = index.searcher()
query = index.parse_query("fish days", ["title", "body"])

(best_score, best_doc_address) = searcher.search(query, 3).hits[0]
best_doc = searcher.doc(best_doc_address)
assert best_doc["title"] == ["The Old Man and the Sea"]
print(best_doc)

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

tantivy_mirror-0.17.0.tar.gz (21.3 kB view details)

Uploaded Source

Built Distributions

tantivy_mirror-0.17.0-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl (2.9 MB view details)

Uploaded PyPy manylinux: glibc 2.5+ x86-64

tantivy_mirror-0.17.0-cp310-none-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.10 Windows x86-64

tantivy_mirror-0.17.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.5+ x86-64

tantivy_mirror-0.17.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (3.7 MB view details)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

tantivy_mirror-0.17.0-cp39-none-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.9 Windows x86-64

tantivy_mirror-0.17.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.5+ x86-64

tantivy_mirror-0.17.0-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (3.7 MB view details)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

tantivy_mirror-0.17.0-cp38-none-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.8 Windows x86-64

tantivy_mirror-0.17.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.5+ x86-64

tantivy_mirror-0.17.0-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (3.7 MB view details)

Uploaded CPython 3.8 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

tantivy_mirror-0.17.0-cp37-none-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.7 Windows x86-64

tantivy_mirror-0.17.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.5+ x86-64

tantivy_mirror-0.17.0-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (3.7 MB view details)

Uploaded CPython 3.7m macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

File details

Details for the file tantivy_mirror-0.17.0.tar.gz.

File metadata

  • Download URL: tantivy_mirror-0.17.0.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.12.17

File hashes

Hashes for tantivy_mirror-0.17.0.tar.gz
Algorithm Hash digest
SHA256 aa15d9e5ac35a74c28f14da0ea1d2a132443d71bce2f68b938629687bb1ea0df
MD5 19e69111bc07987be1bd2918fb89b51f
BLAKE2b-256 cfba719212ce64930e5a1a408e7deec71a278c39b8fcdf76ebfd81227418c3a4

See more details on using hashes here.

File details

Details for the file tantivy_mirror-0.17.0-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for tantivy_mirror-0.17.0-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9dc33f8d24bc212fe8728bda5ba645e282de5a81656ce7e69993052b7af9a87c
MD5 1042f4ce13fb453a8d124f4e2f79df34
BLAKE2b-256 17904fb56e812abdca5b9282f5f208344e4877c27bf8de63b42db7f0bbb8a740

See more details on using hashes here.

File details

Details for the file tantivy_mirror-0.17.0-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for tantivy_mirror-0.17.0-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 72c39ce415ebbeae4dd2f16e9acfbe0665ede28bfd1f24e8dc807308d62a8196
MD5 665d9f00a4983c83fd65a0cd7dc2aca9
BLAKE2b-256 84f3523c9bd8a889f6d39f8ee1cd1f49521ef0384c13b22e908dcabe79a8df20

See more details on using hashes here.

File details

Details for the file tantivy_mirror-0.17.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for tantivy_mirror-0.17.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a6b9d65d444c9a394ab0b92286e330108b992ca01b5884f343790fda98ab292c
MD5 af368641333da6bd16e609401691a91e
BLAKE2b-256 92ea33ebdeea7aa7f92f616a06fe91c0315beaf3fcecf7d9935e2bf49628a65a

See more details on using hashes here.

File details

Details for the file tantivy_mirror-0.17.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for tantivy_mirror-0.17.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 c0c5b3f0533717c1253586342e5d490ae75fea7aa173324b33fb753f32ba9925
MD5 c6c970dcb409a6fd94cfc4d348afe9b6
BLAKE2b-256 05bf008eb4390cbdea1f6887e8a434c185284c0f1d0fd4f0611802420d1edda2

See more details on using hashes here.

File details

Details for the file tantivy_mirror-0.17.0-cp39-none-win_amd64.whl.

File metadata

File hashes

Hashes for tantivy_mirror-0.17.0-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 5da737f878301f1f00e483b61181646d489625395ef13e5bfabc32028bfa0f32
MD5 eb8732c575f07279ec1829dfbac41b92
BLAKE2b-256 663a206b74c5606e0f05932c8d128cad09024b4053df6d1a77c5d63b8fdaa886

See more details on using hashes here.

File details

Details for the file tantivy_mirror-0.17.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for tantivy_mirror-0.17.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 fd486f271c4fa30d864b99c0021593b2d926e8c437a4b573c7f231061c416493
MD5 5abd6f6ef23c0bd966f683ddd8f1f59e
BLAKE2b-256 9e00cf543d72f844033796a9e9f577a42b767037eba91c320d3c02a0dc748f5e

See more details on using hashes here.

File details

Details for the file tantivy_mirror-0.17.0-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for tantivy_mirror-0.17.0-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 13e717dd7cd6a95b95ee8f3094e5b6ce29343feb3840eaa27e1e05419fdd960f
MD5 f3553590db409387631167bff8e12350
BLAKE2b-256 82ad65b1a8516036d934129ef7b59811187d1a55233856d3b0f6456aeada275e

See more details on using hashes here.

File details

Details for the file tantivy_mirror-0.17.0-cp38-none-win_amd64.whl.

File metadata

File hashes

Hashes for tantivy_mirror-0.17.0-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 0be49e4f8dc4a9eacc536dd9b6eb3dbc156a24bdec83be9144d3b3dc943dcbc5
MD5 6b4225d6e7e48d5fcdad98ed182612f1
BLAKE2b-256 6d2df4084c83d3ad258d802aeddb3412bb2d25900f65d34ce8ad4f5f8c835d7e

See more details on using hashes here.

File details

Details for the file tantivy_mirror-0.17.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for tantivy_mirror-0.17.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 57c7c6233202612615c55e6b55ba91c315e15968cab38ae036fac97a53e49662
MD5 0a6f1ce857070507e16eb9a449201815
BLAKE2b-256 5e79314b9216f8353f21af28a844ac2f2e378dc5180efc89140b3a9731dd4ce9

See more details on using hashes here.

File details

Details for the file tantivy_mirror-0.17.0-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for tantivy_mirror-0.17.0-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 52e24cda6a1d94a5aa7c82b142a2e23256f27fefd3b8904ced1dfceb3f10124b
MD5 15b8d0e2a80eb7118af349f552616869
BLAKE2b-256 7531afe07ca1909921048d981dd40ca4334af654e62a39381b15f2e93160698f

See more details on using hashes here.

File details

Details for the file tantivy_mirror-0.17.0-cp37-none-win_amd64.whl.

File metadata

File hashes

Hashes for tantivy_mirror-0.17.0-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 d6385b470cc1e520bb4b28d334a0c39dc45b0a25364920268a526af2a3b4dd77
MD5 e5e98103eacb308413f554f8666b168a
BLAKE2b-256 c5f84eb9c7b3d3d5fd9e142817660e8351643e3168dc05723968d5f0a76e0537

See more details on using hashes here.

File details

Details for the file tantivy_mirror-0.17.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for tantivy_mirror-0.17.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 408a0a6f0b67b69b253bc167c565cd829b39fade72fa15f7686d6889a7770628
MD5 9919b654a9a65e204a0d2b5b7783a73f
BLAKE2b-256 8d69ab3b7acbb975232f82c930dd0138defaa8ac607c1fbbb3c5ff585f47018e

See more details on using hashes here.

File details

Details for the file tantivy_mirror-0.17.0-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for tantivy_mirror-0.17.0-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 55a973603fad7889b4e7932a0892f65e6448396b7c66b27341c3a1a33687bef9
MD5 000bcbab23f97096cbe84c93d49fe3c8
BLAKE2b-256 115bb1f034ccca11a51387c0c2f866f11e378f32d56cf2bf4f3cfd166a8d1466

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page