LibreOffice Writer Concordance File Indexing Guide
Creating an alphabetical index manually in a large document can be
tedious and prone to errors. LibreOffice Writer solves this by
supporting concordance files (.sdi), which are structured
plain-text files that automate the search and indexing process across an
entire manuscript. This guide details the essential techniques for
structuring, configuring, and applying concordance files to generate
accurate, automated document indexes in LibreOffice Writer.
Understanding the Concordance File Structure
A concordance file is a standard text file containing specific fields
separated by semicolons (;). Each line represents a single
search rule that LibreOffice evaluates when generating the index.
The standard syntax for a line in a concordance file consists of six parameters:
Search term;Alternative entry;1st key;2nd key;Match case;Word only
Parameter Breakdown
- Search term: The exact text string in the document you want LibreOffice to locate.
- Alternative entry: The text that will appear in the index instead of the search term. If left blank, the search term itself is displayed.
- 1st key: The primary category under which the entry is nested in a multi-level index.
- 2nd key: A secondary subcategory nested under the 1st key.
- Match case: Set to
1(oryes/true) for case-sensitive matching; set to0(orno/false) to ignore case. - Word only: Set to
1(oryes/true) to match whole words only; set to0to match the string even if it is part of a larger word.
Core Concordance File Techniques
1. Basic Exact Matching
To find standard terms throughout your document and list them directly in the index, define only the search term, match case, and word boundary parameters.
Example:
Kernel;;;;0;1Result: Finds occurrences of “Kernel”, “kernel”, or “KERNEL” as standalone words and lists them under “Kernel”.
2. Standardizing Synonyms with Alternative Entries
When different terms in the text refer to the same concept, use the second field to consolidate them under a single index entry.
Example:
RAM;Memory;;;0;1 Random Access Memory;Memory;;;0;1Result: Occurrences of both “RAM” and “Random Access Memory” point to the single index entry “Memory”.
3. Multi-Level Hierarchical Indexing
Organize complex subjects into primary and secondary categories using 1st and 2nd keys.
Example:
Python;Python;Programming Languages;Scripting;1;1 Ruby;Ruby;Programming Languages;Scripting;1;1 C++;C++;Programming Languages;Compiled;1;1Result:
- Programming Languages
- Compiled
- C++
- Scripting
- Python
- Ruby
- Compiled
- Programming Languages
4. Avoiding False Positives with Strict Flags
Acronyms and short terms often appear as substrings within unrelated words. Restrict matches using boolean flags in fields five and six.
Example:
AI;Artificial Intelligence;;;1;1Result: Matches only the uppercase whole word “AI”, preventing unintended matches in words like “sail”, “air”, or lowercase “ai”.
Applying the Concordance File in LibreOffice Writer
Once your .sdi file is created and saved, apply it to
your document using the following steps:
- Open your document in LibreOffice Writer.
- Place the cursor where the alphabetical index should appear (typically at the end of the document).
- Navigate to Insert > Table of Contents and Index > Table of Contents, Index or Bibliography….
- In the dialog box, set the Type dropdown to Alphabetical Index.
- Under the Options section, check the Concordance file checkbox.
- Click the File button next to the checkbox, select
Open, and browse to your
.sdifile. - Click OK to generate the automated index.
To refresh the index after making document edits, right-click inside the generated index and select Update Index.