__init__ constructor
Leave feedback
On this page
Initializes a new in-memory Index instance.
def __init__(self):
...
from groupdocs.search import Index
index = Index()
Initializes a new Index instance in memory with the specified index settings.
def __init__(self, settings):
...
| Parameter | Type | Description |
|---|---|---|
| settings | IndexSettings |
The index settings object. |
from groupdocs.search import Index, IndexSettings
from groupdocs.search.options import IndexType
settings = IndexSettings()
settings.index_type = IndexType.COMPACT_INDEX
index = Index(settings)
Initializes a new Index, creating a new or opening an existing index on disk.
def __init__(self, index_folder):
...
| Parameter | Type | Description |
|---|---|---|
| index_folder | str |
The index folder path. |
from groupdocs.search import Index
# Create or open an index located at "./index"
index = Index("./index")
Initializes a new Index with the specified folder and settings.
def __init__(self, index_folder, settings):
...
| Parameter | Type | Description |
|---|---|---|
| index_folder | str |
The index folder path. |
| settings | IndexSettings |
The index settings object. |
from groupdocs.search import Index, IndexSettings
from groupdocs.search.options import IndexType
settings = IndexSettings()
settings.index_type = IndexType.COMPACT_INDEX
index = Index("./MyIndex", settings)
Initializes a new Index instance.
Loads an existing index from disk if overwrite_if_exists is False; otherwise creates a new index on disk.
def __init__(self, index_folder, overwrite_if_exists):
...
| Parameter | Type | Description |
|---|---|---|
| index_folder | str |
The index folder path. |
| overwrite_if_exists | bool |
The flag of overwriting the index folder. |
from groupdocs.search import Index
# Create a new index, overwriting any existing index in the folder
index = Index("./MyIndex", overwrite_if_exists=True)
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.
def __init__(self, index_folder, settings, overwrite_if_exists):
...
| Parameter | Type | Description |
|---|---|---|
| index_folder | str |
The index folder path. |
| settings | IndexSettings |
The index settings object. |
| overwrite_if_exists | bool |
Flag indicating whether to overwrite the index folder. |
from groupdocs.search import Index, IndexSettings
from groupdocs.search.options import IndexType
index_folder = "./MyIndex"
settings = IndexSettings()
settings.index_type = IndexType.COMPACT_INDEX
index = Index(index_folder, settings, overwrite_if_exists=True)
- class
Index
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.