Skip to main content

infinity

Project description

dependency

python

pip install -r requirements.txt

cpp

thrift

sudo apt-get install thrift-compiler

build

python setup.py bdist_wheel

install

pip install dist/infinity-0.0.1-py3-none-any.whl

using

import infinity
import infinity.index as index
from infinity.common import REMOTE_HOST
from infinity.remote_thrift.query_builder import InfinityThriftQueryBuilder

# infinity
infinity_obj = infinity.connect(REMOTE_HOST)
db = infinity_obj.get_database("default")
db.drop_table("my_table")
db.create_table(
    "my_table", {"num": "integer", "body": "varchar", "vec": "vector,5,float"}, None)

table = db.get_table("my_table")
res = table.insert(
    [{"num": 1, "body": "undesirable, unnecessary, and harmful", "vec": [1.0] * 5}])
assert res.success
res = table.insert(
    [{"num": 2, "body": "publisher=US National Office for Harmful Algal Blooms", "vec": [4.0] * 5}])
assert res.success
res = table.insert(
    [{"num": 3, "body": "in the case of plants, growth and chemical", "vec": [7.0] * 5}])
assert res.success

res = table.create_index("my_index",
                         [index.IndexInfo("body",
                                          index.IndexType.IRSFullText,
                                          [index.InitParameter("ANALYZER", "segmentation")]),
                          ], None)
assert res.success

query_builder = InfinityThriftQueryBuilder(table)
query_builder.output(["num", "body"])
query_builder.knn('vec', [3.0] * 5, 'float', 'ip', 2)
query_builder.match('body', 'harmful', 'topn=2')
query_builder.fusion('rrf')
res = query_builder.to_pl()
print(res)

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

infinity_sdk-0.1.0.dev1-py3-none-any.whl (38.5 kB view details)

Uploaded Python 3

File details

Details for the file infinity_sdk-0.1.0.dev1-py3-none-any.whl.

File metadata

File hashes

Hashes for infinity_sdk-0.1.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 b0c58175cdd7e4001d6f8d7a8c96423de71fe76e7278ac46433207782ea76949
MD5 7f2b6fe5d43d7131c87e8ab7673c8b56
BLAKE2b-256 4eb6f2da85e018ad0b78ddb83c44944084a8641a7c9de571e4dcca5ae21e53f4

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