8000 Added quickstart guide. by writinwaters · Pull Request #1173 · infiniflow/infinity · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Added quickstart guide. #1173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for 8000 GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions docs/_category_.json

This file was deleted.

8 changes: 8 additions & 0 deletions docs/getstarted/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "Get started",
"position": 0,
"link": {
"type": "generated-index",
"description": "quickstart and more"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 1
slug: /
slug: /build_from_source
---

# Build from Source
Expand Down
102 changes: 102 additions & 0 deletions docs/getstarted/quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
sidebar_position: 1
slug: /
---

# Quickstart

## Prerequisites

CPU >= 4 cores, with FMA and SSE4_2
RAM >= 16 GB
Disk >= 50 GB
OS: Linux x86_64 or aarch64
Glibc >=2.17

## Deploy Infinity database

### Deploy Infinity using Docker on Linux x86_64 and MacOS x86_64

```bash
sudo mkdir -p /var/infinity && sudo chown -R $USER /var/infinity
docker pull infiniflow/infinity:nightly
docker run -d --name infinity -v /var/infinity/:/var/infinity --ulimit nofile=500000:500000 --network=host infiniflow/infinity:nightly
```

### Deploy Infinity using binary package on Linux x86_64

You can download the binary package (deb, rpm, or tgz) for your respective host operating system from https://github.com/infiniflow/infinity/releases. The prebuilt packages are compatible with Linux distributions based on glibc 2.17 or later, for example, RHEL 7, Debian 8, Ubuntu 14.04.

Fedora/RHEL/CentOS/OpenSUSE
```bash
sudo rpm -i infinity-0.2.0-dev-x86_64.rpm
sudo systemctl start infinity
```

Ubuntu/Debian
```bash
sudo dpkg -i infinity-0.2.0-dev-x86_64.deb
sudo systemctl start infinity
```
### 🛠️ Build from Source

See [Build from Source](./build_from_source.md).

## Install a Python client

`infinity-sdk` requires Python 3.10+.

```bash
pip3 install infinity-sdk==0.2.0.dev1
```

## Import necessary modules

```python
import infinity
import infinity.index as index
from infinity.common import REMOTE_HOST
from infinity.common import ConflictType
```

## Connect to the remote server

```python
infinity_obj = infinity.connect(REMOTE_HOST)
```

## Get a database

```python
db = infinity_obj.get_database("default_db")
```

## Create a table

```python
# Drop my_table if it already exists
db.drop_table("my_table", ConflictType.Ignore)
# Create a table named "my_table"
table = db.create_table(
"my_table", {
"num": {"type": "integer"},
"body": {"type": "varchar"},
"vec": {"type": "vector, 4, float"}
})
```

## Insert two records

```python
table.insert([{"num": 1, "body": "unnecessary and harmful", "vec": [1.0, 1.2, 0.8, 0.9]}])
table.insert([{"num": 2, "body": "Office for Harmful Blooms", "vec": [4.0, 4.2, 4.3, 4.5]}])
```

## Execute a vector search

```python
res = table.output(["*"]).knn("vec", [3.0, 2.8, 2.7, 3.1], "float", "ip", 2).to_pl()
print(res)
```

> 💡 For more information about the Python API, see the [Python API Reference](../references/pysdk_api_reference.md).
2 changes: 1 addition & 1 deletion docs/references/_category_.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"label": "References",
"position": 2,
"position": 3,
"link": {
"type": "generated-index",
"description": "miscellaneous references"
Expand Down
0