Indexing metadata of documents

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Search MCP server lets your agent work with files on your machine; they are never uploaded. It runs in Docker: replace /path/to/documents with the folder it may use.

claude mcp add groupdocs-search -- docker run --rm -i -v /path/to/documents:/data ghcr.io/groupdocs-search/search-net-mcp:latest
Folders, licensing and more →

GroupDocs.Search allows creating a full-text index or a metadata index of documents. To index only metadata without the main content of documents, set the index_type property of the index settings to IndexType.METADATA_INDEX when creating an index. The size of an index of this type will be very small. The index type is fixed when the index is created, so it cannot be changed for an existing index.

The following example demonstrates the creation of the metadata index.

from groupdocs.search import Index, IndexSettings
from groupdocs.search.options import IndexType

# Creating an instance of index settings
settings = IndexSettings()
settings.index_type = IndexType.METADATA_INDEX  # Setting index type

# Creating a new index in the specified folder
index = Index("./index", settings, True)

# Indexing documents from the specified folder
index.add("./documents")

# Searching in the index
result = index.search("Einstein")
print("Documents found:", result.document_count)

The following sample files are used in this example: documents/Lecture.docx, documents/Biography.docx

Documents found: 1

Download full output

More resources

GitHub examples

You may find more code examples in our GitHub repository:

Free online document search App

Along with the full-featured library, we provide a free online document search app. You are welcome to search over your PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX and more with our Free Online Document Search App.