Full-text index rebuilder
This script provides a utility to rebuild the Virtuoso full-text index, which is essential for optimal querying of RDF object values using the bif:contains function in SPARQL queries. The implementation is based on the official OpenLink Software documentation.
Why rebuild the full-text index?
Section titled “Why rebuild the full-text index?”In some cases, the Full-Text index may need to be recreated if unexpected results are returned when using the bif:contains Full-Text index search function in SPARQL queries. The Virtuoso RDF Quad store supports optional Full-Text indexing of RDF object values, providing much better performance compared to the SPARQL regex feature, which is very inefficient in most cases.
What the script does
Section titled “What the script does”- Drops the existing full-text index tables
- Recreates the index structure
- Refills the index with data
Basic usage
Section titled “Basic usage”# With pipx (global installation)virtuoso-rebuild-index --password <your_virtuoso_password>
# With uv (development)uv run python virtuoso_utilities/rebuild_fulltext_index.py --password <your_virtuoso_password>Usage with Docker
Section titled “Usage with Docker”# With pipx (global installation)virtuoso-rebuild-index \ --password <your_virtuoso_password> \ --docker-container my-virtuoso
# With uv (development)uv run python virtuoso_utilities/rebuild_fulltext_index.py \ --password <your_virtuoso_password> \ --docker-container my-virtuosoArguments
Section titled “Arguments”Use virtuoso-rebuild-index --help to see all available options:
Connection parameters
Section titled “Connection parameters”| Argument | Description | Default |
|---|---|---|
--host | Virtuoso host | localhost |
--port | Virtuoso ISQL port | 1111 |
--user | Virtuoso username | dba |
--password | Virtuoso password | dba |
Docker parameters
Section titled “Docker parameters”| Argument | Description | Default |
|---|---|---|
--docker-container | Name or ID of the running Virtuoso Docker container. If specified, isql commands are run via docker exec | - |
--restart-container | Restart Docker container after rebuilding the index. Only applicable when using --docker-container | false |
--docker-path | Path to docker executable | docker |
--docker-isql-path | Path to isql inside container | isql |
--isql-path | Path to isql executable on host | isql |