Skip to main content

Quickstart

Getting started with Objective Search requires the following steps:

  1. Add data to the Object Store
  2. Build an Index using the data
  3. Querying the Index to get results

Setup

For this quickstart we'll be using the python SDK. First, get an API key and install the SDK.

To get an API key, create an account at https://app.objective.inc.

pip install objective-sdk

Adding data

Push Objects to the Object Store using the CRUD APIs.

from objective import Client

client = Client(api_key="sk_...") # Insert your API key here

objects = []

objects.append(
{
"id": "1",
"object": {
"title": "Sevendayz Men's Shady Records Eminem Hoodie Hoody Black Medium",
"brand": "sevendayz",
},
},
)


client.object_store.upsert_objects(objects)

Building an Index

Build an index out of the Objects pushed to the API. This will create an Index and add all of the Objects in the Object Store to it, making them searchable.

index = client.indexes.create_index(
index_type="text", fields={"searchable": ["title", "brand"]}
)
index.status(watch=True)

Querying results

from objective import Client
import json

client = Client(api_key="sk_...")
index = client.indexes.get_index(<<INSERT INDEX ID HERE>>)

results = index.search(query="rapper hoodies", object_fields="*")
print(json.dumps(results, indent=4))

Learn more at these links:

  • managing data via the Object Store APIs
  • configuring indexes via the Index APIs
  • searching and filtering via the Search API

For help or to ask a question, email us: [email protected].