OramaSearch Inc. LogoOramaCore
APIs Reference

Search Documents

APIs to search documents in a Collection in OramaCore.

APIs

API Key type: read_api_key. Safe to expose to the public.

To search for documents in a collection, you can use the following API:

curl -X POST \
  http://localhost:8080/v1/collections/{COLLECTION_ID}/search?api-key=<read_api_key> \
  -H 'Content-Type: application/json' \
  -d '{ "term": "The quick brown fox" }'

The API will return a list of documents that match the search term. The documents will be sorted by relevance, with the most relevant documents appearing first.

Search Parameters

When performing search, you can use a number of parameters to customize the search results:

ParameterDescriptionDefault
termThe search term.-
modeThe search mode. Can be fulltext, vector, or hybrid.fulltext
limitThe maximum number of documents to return.10
offsetThe number of documents to skip.0
propertiesThe properties to search in.
Should be an array of strings (for example: ["title", "description", "author.name"])
All properties
whereA filter to apply to the search results. Read more here-

Where Filters

At index time, OramaCore will index different datatypes in different ways. For example, a string will be indexed differently than a number or a boolean.

When performing a search, you can use the where parameter to filter the search results based on the datatype of the property.

Filtering Numbers

To filter numbers, you can use the following operators:

OperatorDescriptionExample
eqEqual to{"where": {"age": {"eq": 25}}}
ltLess than{"where": {"age": {"lt": 25}}}
lteLess than or equal to{"where": {"age": {"lte": 25}}}
gtGreater than{"where": {"age": {"gt": 25}}}
gteGreater than or equal to{"where": {"age": {"gte": 25}}}
betweenBetween two values{"where": {"age": {"between": [20, 30]}}}

So a full query complete with a where filter might look like this:

{
  "term": "John Doe",
  "where": {
    "age": {
      "gte": 25
    }
  }
}

Filtering Booleans

To filter booleans, you can use the following operators:

OperatorDescriptionExample
trueTrue{"where": {"is_active": true}}
falseFalse{"where": {"is_active": false}}

So a full query complete with a where filter might look like this:

{
  "term": "John Doe",
  "where": {
    "is_active": true
  }
}

Facets

OramaCore supports faceted search. You can use the facets parameter to get a list of facets for a given property.

Numeric Facets

The facets parameter can be used to get numeric facets. For example, to get a histogram of the price property, you can use the following query:

{
  "term": "Bluetooth Airbuds",
  "facets": {
    "price": {
      "ranges": [
        { "from": 0, "to": 50 },
        { "from": 50, "to": 100 },
        { "from": 100, "to": 200 },
        { "from": 200, "to": 500 },
        { "from": 500, "to": 1000 },
        { "from": 1000 }
      ]
    }
  }
}

Boolean Facets

The facets parameter can also be used to get boolean facets. For example, to get a list of available values, you can use the following query:

{
  "term": "Bluetooth Airbuds",
  "facets": {
    "available": {
      "true": true,
      "false": false
    }
  }
}

On this page