Index class
Leave feedback
On this page
Represents the main class for indexing documents and searching through them.
Learn more:
- Creating an index: https://docs.groupdocs.com/search/python-net/creating-an-index/
- Indexing: https://docs.groupdocs.com/search/python-net/indexing/
- Searching: https://docs.groupdocs.com/search/python-net/searching/
The Index type exposes the following members:
| Constructor | Description |
|---|---|
| init | Initializes a new in-memory Index instance. |
| init | Initializes a new Index instance in memory with the specified index settings. |
| init | Initializes a new Index, creating a new or opening an existing index on disk. |
| init | Initializes a new Index with the specified folder and settings. |
| init | Initializes a new Index instance. |
| init | Initializes a new Index instance. Loads an existing index from disk if overwrite_if_exists is False; otherwise creates a new index on disk with the specified index settings. |
| Method | Description |
|---|---|
| add | Performs indexing operation by adding a file or folder specified by an absolute or relative path; documents in all subfolders are indexed. |
| add | Adds a file or folder by an absolute or relative path, indexing documents from all subfolders. |
| add | Performs indexing operation. Adds files or folders by an absolute or relative path. Documents from all subfolders will be indexed. |
| add | Adds files or folders by an absolute or relative path, indexing documents from all subfolders. |
| add | Indexes documents from the file system, a stream, or a structured source. |
| add | Performs an indexing operation and adds the extracted data to the index. |
| change_attributes | Applies the specified batch of attribute changes to indexed documents without reindexing during the update operation. |
| check_segments | Checks the index for damaged segment files on the disk and optionally fixes index functionality if fix_index_functionality is True. |
| delete | Deletes indexed files or folders from the index and updates the index without the deleted paths. |
| delete | Deletes documents indexed from streams or structures and updates the index without the deleted documents. |
| dispose | Releases all resources used by the Index. |
| get_attributes | Gets all the attributes associated with the specified indexed document. |
| get_document_text | Generates the text of an indexed document and passes it through an output adapter. |
| get_document_text | Generates HTML formatted text for an indexed document and transfers it through the output adapter. |
| get_indexed_document | Gets an indexed document by document key. |
| get_indexed_document_items | Gets an array of nested items of the specified document (for container documents such as ZIP, OST, PST). |
| get_indexed_documents | Gets an array of all indexed documents. |
| get_indexed_paths | Returns a list of indexed paths – documents or folders. |
| get_indexing_reports | Gets the reports on indexing operations. |
| get_search_reports | Retrieves the reports on search operations. |
| highlight | Generates HTML formatted text with highlighted found terms. |
| highlight | Generates HTML formatted text with highlighted found terms. |
| load_into_memory_completely | Loads the entire index into memory. |
| load_into_memory_completely | Loads the entire index into memory. |
| merge | Merges the specified index into the current index. |
| merge | Merges indexes from the specified index repository into the current index. |
| notify | Passes the specified notification object to the index to perform the notification. |
| optimize | Minimizes the number of index segments by merging them, improving search performance. |
| optimize | Minimizes the number of index segments by merging them, improving search performance. |
| save_to | Saves the in‑memory or regular index to a specified folder on disk without changing its settings. |
| search | Searches in index. |
| search | Searches in the index. |
| search | Searches in index. |
| search | Searches in index. |
| search | Performs a reverse image search in the index. |
| search_next | Continues the chunk search started with method Search. |
| search_next | Continues the chunk search started with Index.search. |
| update | Re-indexes documents that have been changed or deleted since the last update and adds new files that have been added to the indexed folders. |
| update | Re-indexes documents that have been changed or deleted since the last update and adds new files that have been added to the indexed folders. |
| Property | Description |
|---|---|
| dictionaries | The dictionary repository. |
| events | The event hub for subscribing to events. |
| index_info | The basic information on the index. |
| index_settings | The index settings. |
| repository | The index repository object if the index is contained in it. |
from groupdocs.search import Index
def on_file_indexing(sender, args):
print("Indexing:", args.document_full_path)
with Index("./index") as index:
index.events.file_indexing += on_file_indexing
index.add("./documents")
Task guides that use Index:
- Hello, World!
- Build your first search solution
- Build search query
- Work with search results
- Search index events
- Phrase search
- Wildcard search
- Fuzzy search
- Regular expression search
- Boolean search
- Faceted search
- Highlighting search results
- Custom text extractors
- module
groupdocs.search
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.