> ## Documentation Index
> Fetch the complete documentation index at: https://docs.quivr.thevibecompany.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Run your first search

> Add a short article and find it by keyword and by meaning.

Add one article to Quivr, then find it twice. First search for a word in the article, then describe the same idea in your own words.

[Launch Quivr](https://docs.quivr.thevibecompany.co/get-started/launch-quivr.md) and keep its API address and key in this shell as `QUIVR_API_URL` and `QUIVR_API_KEY`. You need `curl`, `jq` and a key with `corpora:read`, `corpora:write`, `content:read`, `content:write` and `search:query` access. The local launch paths give you that key.

**1. Create a collection**

A collection groups documents you want to search together. The API calls it a Corpus. Create a collection named News.

```bash theme={null}
curl -fsS -X POST "$QUIVR_API_URL/v0/corpora" \
  -H "Authorization: Bearer $QUIVR_API_KEY" \
  -H "Content-Type: application/json" \
  -d @- <<EOF | jq '{corpus_id, name}'
{"name": "News", "idempotency_key": "quickstart-news"}
EOF
```

```json theme={null}
{"corpus_id": "{{CORPUS_ID}}", "name": "News"}
```

Replace `<corpus_id>` with the value returned above.

```bash theme={null}
export CORPUS_ID='<corpus_id>'
```

**2. Add an article**

Send the article as plain text. Quivr calls each document a Record. The `namespace` names the source in the collection and the `record_key` identifies the article in that source.

```bash theme={null}
curl -fsS -X POST "$QUIVR_API_URL/v0/records" \
  -H "Authorization: Bearer $QUIVR_API_KEY" \
  -H "Content-Type: application/json" \
  -d @- <<EOF | jq '{receipt_id}'
{
  "idempotency_key": "quickstart-eclipse",
  "source": {
    "corpus_id": "$CORPUS_ID",
    "namespace": "news",
    "record_key": "eclipse"
  },
  "content": {
    "kind": "text",
    "text": "A total solar eclipse crossed the Pacific on Tuesday, turning day into night for four minutes."
  }
}
EOF
```

```json theme={null}
{"receipt_id": "{{RECEIPT_ID}}"}
```

Quivr returns a receipt when it accepts the article. Replace `<receipt_id>` with the returned value so you can check when it becomes searchable.

```bash theme={null}
export RECEIPT_ID='<receipt_id>'
```

```bash theme={null}
curl -fsS "$QUIVR_API_URL/v0/ingestion-receipts/$RECEIPT_ID" \
  -H "Authorization: Bearer $QUIVR_API_KEY" \
  | jq '{state, outcome, record_id, searchable: .availability.searchable}'
```

```json theme={null}
{
  "state": "resolved",
  "outcome": "created",
  "record_id": "{{RECORD_ID}}",
  "searchable": true
}
```

Run the receipt command again until `searchable` is `true`.

**3. Find the word eclipse**

Use `lexical` mode to find the word `eclipse` in the News collection.

```bash theme={null}
curl -fsS -X POST "$QUIVR_API_URL/v0/search" \
  -H "Authorization: Bearer $QUIVR_API_KEY" \
  -H "Content-Type: application/json" \
  -d @- <<EOF | jq '{
    items: [.items[] | {record_id, part_key, excerpt: .excerpt.text}]
  }'
{"query": "eclipse", "corpus_ids": ["$CORPUS_ID"], "mode": "lexical"}
EOF
```

```json theme={null}
{"items": [{"record_id": "{{RECORD_ID}}", "part_key": "body",
  "excerpt": "A total solar eclipse crossed the Pacific on Tuesday, turning day into night for four minutes."}]}
```

The hit gives you the article's ID, the section it matched, and the text from that section.

**4. Find the same idea**

Use `semantic` mode to search by meaning with the phrase `the moon blocked the sun`.

```bash theme={null}
curl -fsS -X POST "$QUIVR_API_URL/v0/search" \
  -H "Authorization: Bearer $QUIVR_API_KEY" \
  -H "Content-Type: application/json" \
  -d @- <<EOF | jq '{items: [.items[] | {record_id}]}'
{
  "query": "the moon blocked the sun",
  "corpus_ids": ["$CORPUS_ID"],
  "mode": "semantic"
}
EOF
```

```json theme={null}
{"items": [{"record_id": "{{RECORD_ID}}"}]}
```

Look for the same article ID. While Quivr prepares the article for meaning search, you may see an empty list or an HTTP `422` (`unsupported_search`). Give the background worker a moment to finish and run the search again.

## What you built

You have a collection with one searchable article. You can leave it in place and rerun the same requests. The request keys (`idempotency_key`) let Quivr return the same collection and receipt when you send the same requests again.

> [card] [Connect a source](https://docs.quivr.thevibecompany.co/guides/connect-a-source.md)
>
> Bring in new documents automatically.

> [card] [Set an alert](https://docs.quivr.thevibecompany.co/guides/alerts.md)
>
> Get notified when a new document matches a topic.

> [card] [Browse plugins](https://docs.quivr.thevibecompany.co/plugins.md)
>
> See which sources, file formats and search tools you can add.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.