Skip to main content

Creating Query Sets

A query set can be created by uploading a file of queries in the Releval UI, or by using the Create Query Set API or Upload Query Set API.

Create in the Releval UI

The Create Query Set form gives you two ways to provide queries: upload a file of queries, or write them inline in the editor.

The form supports two file formats for query sets:

  1. Text file (.txt): a list of search terms, one per line.
  2. JSON Lines file (.jsonl): a list of JSON objects defining the search terms and any additional fields, one per line, following JSON Lines / newline-delimited JSON (NDJSON) format.

A line starting with { and ending with } is assumed to be JSON.

Create Query Set API

The Create Query Set API supports two formats for query sets:

  1. String Array: A list of search terms
  2. JSON Object Array: A list of JSON objects that define the search terms, and optionally other values

Simple String Array

{
"name": "Popular Movies",
"description": "Popular movies from the last week",
"queries": [
"The Godfather",
"Inception",
"Batman",
"Pulp Fiction",
"Forrest Gump",
"Fight Club"
]
}

JSON Object Array

The following example shows a set of queries with the search terms in the "query" property, along with other values defined by other properties:

{
"name": "Popular Movies",
"description": "Popular movies from the last week",
"queries": [
{ "query": "The Godfather", "popularity": 8.6, "genre": ["Crime", "Drama"] },
{ "query": "Inception", "popularity": 9.2, "genre": ["Action", "Sci-Fi", "Thriller"] },
{ "query": "Batman", "popularity": 7.8, "genre": ["Action", "Crime", "Drama"] },
{ "query": "Pulp Fiction", "popularity": 8.4, "genre": ["Crime", "Drama"] },
{ "query": "Forrest Gump", "popularity": 8.2, "genre": ["Drama", "Romance"] },
{ "query": "Fight Club", "popularity": 8.5, "genre": ["Drama"] }
]
}

Upload Query Set API

The Upload Query Set API supports two file formats for query sets:

  1. Text file (*.txt): A list of search terms, one per line
  2. JSON lines file (*.jsonl): A list of JSON objects that define the search terms, and optionally other values, one per line, following JSON Lines / newline delimited JSON (NDJSON) format.

A line starting with { and ending with } is assumed to be JSON.

Text file

The following example shows a set of queries in a text file, with a list of search terms, one per line:

The Godfather
Inception
Batman
Pulp Fiction
Forrest Gump
Fight Club

JSON Lines file

The following example shows a set of queries in a JSON lines file, with the search terms in the "query" property, along with other values defined by other properties:

{ "query": "The Godfather", "popularity": 8.6, "genre": ["Crime", "Drama"] }
{ "query": "Inception", "popularity": 9.2, "genre": ["Action", "Sci-Fi", "Thriller"] }
{ "query": "Batman", "popularity": 7.8, "genre": ["Action", "Crime", "Drama"] }
{ "query": "Pulp Fiction", "popularity": 8.4, "genre": ["Crime", "Drama"] }
{ "query": "Forrest Gump", "popularity": 8.2, "genre": ["Drama", "Romance"] }
{ "query": "Fight Club", "popularity": 8.5, "genre": ["Drama"] }
Tip

Deduplicate queries in the set before creating the query set in Releval. Both the Create Query Set API and Upload Query Set API remove duplicate queries when creating the query set, but you can lighten the load by deduplicating beforehand.