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

# Text indexes

> Create BM25 indexes for ranked full-text search

<div className="flex flex-wrap gap-2"><Badge color="blue" size="sm">Guide</Badge></div>

Text indexes provide durable BM25 search over string properties on nodes or edges.

## Create a text index

<CodeGroup>
  ```rust Rust theme={"languages":{"custom":["languages/helixql.json"]}}
  write_batch()
      .var_as(
          "index",
          g().create_text_index_nodes("Doc", "body", None::<&str>),
      )
      .returning(["index"]);
  ```

  ```ts TypeScript theme={"languages":{"custom":["languages/helixql.json"]}}
  writeBatch()
    .varAs("index", g().createTextIndexNodes("Doc", "body", null))
    .returning(["index"]);
  ```

  ```go Go theme={"languages":{"custom":["languages/helixql.json"]}}
  helix.WriteQuery("create_doc_text_index").
  	VarAs(
  		"index",
  		helix.G().CreateTextIndexNodes("Doc", "body"),
  	).
  	Returning("index")
  ```

  ```python Python theme={"languages":{"custom":["languages/helixql.json"]}}
  (
      write_batch()
      .var_as("index", g().create_text_index_nodes("Doc", "body"))
      .returning(["index"])
  )
  ```

  ```json JSON theme={"languages":{"custom":["languages/helixql.json"]}}
  {
    "request_type": "write",
    "query_name": "create_doc_text_index",
    "query": {
      "write": {
        "entries": [{
          "query": {
            "name": "index",
            "root": {
              "create_index": {
                "spec": {
                  "node_text": {
                    "label": "Doc",
                    "property": "body"
                  }
                },
                "if_not_exists": true
              }
            }
          }
        }],
        "returns": ["index"]
      }
    }
  }
  ```
</CodeGroup>

Pass a tenant property as the final argument to partition the index.

## Search indexed text

Start with the SDK's text-search operation for label `Doc`, property `body`, query
text `"consensus protocol"`, and a result limit of `10`. The hit stream is ordered
by BM25 relevance. Project the rank field before traversing away from a hit.

## Indexed values

* Store searchable text in a top-level property.
* Keep tenant property names and values consistent with the definition.
* Treat analyzer and term-position behavior as part of the index definition.
* Fix invalid source values before retrying a blocked backfill.

## Next steps

<CardGroup cols={2}>
  <Card title="Project search results" icon="table-columns" href="/database/helix-db/query-guides/projections">
    Preserve ranked hit metadata before continuing a traversal.
  </Card>

  <Card title="Troubleshoot index operations" icon="wrench" href="/database/helix-cloud/operate/troubleshooting#index-operation-is-blocked">
    Resolve blocked builds and lifecycle errors.
  </Card>
</CardGroup>
