Skip to content

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.

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.

  1. Drops the existing full-text index tables
  2. Recreates the index structure
  3. Refills the index with data
Terminal window
# 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>
Terminal window
# 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-virtuoso

Use virtuoso-rebuild-index --help to see all available options:

ArgumentDescriptionDefault
--hostVirtuoso hostlocalhost
--portVirtuoso ISQL port1111
--userVirtuoso usernamedba
--passwordVirtuoso passworddba
ArgumentDescriptionDefault
--docker-containerName or ID of the running Virtuoso Docker container. If specified, isql commands are run via docker exec-
--restart-containerRestart Docker container after rebuilding the index. Only applicable when using --docker-containerfalse
--docker-pathPath to docker executabledocker
--docker-isql-pathPath to isql inside containerisql
--isql-pathPath to isql executable on hostisql