represents a semantic search index object.
SemanticSearchIndex[source]
attempts to recreate a SemanticSearchIndex from source.
SemanticSearchIndex
represents a semantic search index object.
SemanticSearchIndex[source]
attempts to recreate a SemanticSearchIndex from source.
Details and Options
- SemanticSearchIndex represents a corpus of documents that can be searched by semantic similarity.
- Usually created by CreateSemanticSearchIndex, this symbolic object enables common semantic index operations such as adding additional documents, searching and listing content and properties.
- Possible values of source include:
-
"name" a named index from SemanticSearchIndices[] File[…] a local file LocalObject[…] a local object CloudObject[…] a cloud object - Index properties can be accessed via SemanticSearchIndex[…]["prop"].
- The following properties are supported:
-
"Database" vector database backing the index "DocumentCount" number of documents stored in the index "Embeddings" vector embeddings of the entries "FeatureExtractor" how features are extracted from text chunks "ID" index ID "ItemCount" number of chunks stored in the index "Items" stored chunks "Label" item labels "Location" where the index is stored "TagKeys" keys of the tag association "Tags" tags associated with each entry {prop1,…} a list of properties - The following options can be specified:
-
GeneratedAssetLocation $GeneratedAssetLocation where to save the index OverwriteTarget Automatic whether to overwrite an existing location
Examples
open all close allBasic Examples (2)
Create a semantic search index:
index = CreateSemanticSearchIndex[{"The dog runs in the park", "The sun shines brightly", "The car is parked outside"}]index["Items"]Create a semantic search index based on a single source:
index = CreateSemanticSearchIndex[ResourceData["Alice in Wonderland"], "Alice"]Perform a semantic search operation:
Short /@ SemanticSearch[index, "strange hare", MaxItems -> 4]Scope (7)
Properties (3)
Extract a list of index properties:
index = CreateSemanticSearchIndex[ResourceData["Declaration of Independence"]]index["Properties"]Short[index["Items"]]Extract multiple properties at once:
index = CreateSemanticSearchIndex[ResourceData["Declaration of Independence"]]index[{"ID", "ItemCount"}]Retrieve the VectorDatabaseObject storing the embeddings:
index = CreateSemanticSearchIndex[ResourceData["Declaration of Independence"]]index["Database"]Annotations (3)
Create an index where each source is associated with a label:
index = CreateSemanticSearchIndex[{ResourceData["Declaration of Independence"] -> "Declaration of Independence", ResourceData["Alice in Wonderland"] -> "Alice in Wonderland"}]Short[index["Label"]]Labels can also be accessed via the "Tags" property:
Short[index["Tags"]]Explicitly specify a label and other tags:
index = CreateSemanticSearchIndex[ResourceData["Declaration of Independence"] -> <|"Label" -> "Declaration of Independence", "Country" -> "USA"|>]index["Label"]Create a semantic search index with multiple custom tags:
index = CreateSemanticSearchIndex[{ResourceData["Alice in Wonderland"] -> <|"Author" -> "Lewis Carroll", "Date" -> 1865, "Label" -> "Alice in Wonderland"|>,
ResourceData["Through the Looking Glass"] -> <|"Author" -> "Lewis Carroll", "Date" -> 1871, "Label" -> "Through the Looking Glass"|>,
ResourceData["Railway Children"] -> <|"Author" -> "Edith Nesbit", "Date" -> 1906, "Label" -> "Railway Children"|>,
ResourceData["The Wind in the Willows"] -> <|"Author" -> "Kenneth Grahame", "Date" -> 1908, "Label" -> "The Wind in the Willows"|>} ]Short[index["Tags" -> "Date"]]Short[index["Tags" -> {"Date", "Author"}]]Access tags and other properties:
Short /@ index[{"Tags" -> {"Date", "Author"}, "Embeddings"}]Retrieval (1)
Store a SemanticSearchIndex in a file:
CreateSemanticSearchIndex[{"text one", "text two"}, "myIndex", GeneratedAssetLocation -> File["myIndex"]]Recreate the index from the file:
SemanticSearchIndex[File["myIndex"]]Recreate the index from the name:
SemanticSearchIndex["myIndex"]Options (2)
GeneratedAssetLocation (1)
Create a SemanticSearchIndex:
index = CreateSemanticSearchIndex[{"some text"}]Copy the index in a new location:
indexcopy = SemanticSearchIndex[index, GeneratedAssetLocation -> LocalObject["index_copy"]]DeleteObject[index]Retrieve the index from its new location:
SemanticSearchIndex[LocalObject["index_copy"]]OverwriteTarget (1)
index = CreateSemanticSearchIndex[{"some text"}]file = CreateFile[]By default, copying a index to an existing file will fail:
SemanticSearchIndex[index, GeneratedAssetLocation -> file]Use OverwriteTarget -> True to override the existing file:
SemanticSearchIndex[index, GeneratedAssetLocation -> file, OverwriteTarget -> True]Applications (1)
Properties & Relations (3)
In many situations, an existing semantic search index can be referred to by name only:
object = CreateSemanticSearchIndex[{"Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do.", "Once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, \"and what is the use of a book,\" thought Alice, \"without pictures or conversations?\""}, "Alice"]Search using the index's name:
SemanticSearch["Alice", "what was the sister reading?", "MaxItems" -> 1]SemanticSearch[object, "what was the sister reading?", "MaxItems" -> 1]A semantic search index is backed by a VectorDatabaseObject:
index = CreateSemanticSearchIndex[{"Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do.", "Once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, \"and what is the use of a book,\" thought Alice, \"without pictures or conversations?\""}, "Alice"]Retrieve the underlying index:
database = index["Database"]Detailed information on the database can be extracted using vector database properties:
database["Properties"]index = CreateSemanticSearchIndex[{"Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do.", "Once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, \"and what is the use of a book,\" thought Alice, \"without pictures or conversations?\""}, "myIndex", GeneratedAssetLocation -> File[FileNameJoin[{"myIndexes", "myFile"}]]]Index information is stored in the "WXF" format:
index["Location"]//FileFormatMore files may be generated for efficiently storing the index information:
FileNames["*", "myIndexes"]Possible Issues (2)
Create an index in a specified location:
db = CreateSemanticSearchIndex[{"text one", "text two"}, GeneratedAssetLocation -> File["my_obj_file"]]A naked string is interpreted as the index name:
SemanticSearchIndex["my_obj_file"]Use the File wrapper to specify the source is a file path:
SemanticSearchIndex[File["my_obj_file"]]file = FileNameJoin[{"myIndexes", "myFile"}]Create an index in the specified location:
index = CreateSemanticSearchIndex[StringRiffle[RandomWord[20]], "myIndex", GeneratedAssetLocation -> file]RenameDirectory["myIndexes", "myIndexes_new"]The original index is no longer usable:
index["Items"]Use SemanticSearchIndex on the moved file with OverwriteTarget True to recreate the index and update the location data:
SemanticSearchIndex[File[FileNameJoin[{"myIndexes_new", "myFile"}]], OverwriteTarget -> True]Related Guides
Text
Wolfram Research (2024), SemanticSearchIndex, Wolfram Language function, https://reference.wolfram.com/language/ref/SemanticSearchIndex.html (updated 2025).
CMS
Wolfram Language. 2024. "SemanticSearchIndex." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/SemanticSearchIndex.html.
APA
Wolfram Language. (2024). SemanticSearchIndex. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SemanticSearchIndex.html
BibTeX
@misc{reference.wolfram_2026_semanticsearchindex, author="Wolfram Research", title="{SemanticSearchIndex}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/SemanticSearchIndex.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_semanticsearchindex, organization={Wolfram Research}, title={SemanticSearchIndex}, year={2025}, url={https://reference.wolfram.com/language/ref/SemanticSearchIndex.html}, note=[Accessed: 12-June-2026]}