Using the "Search Management" in the administration view of the OpenCms workplace, it's very simple to create a new search index which is based on the standard configuration of the lucene search engine in OpenCms.
Step 1: Defining a new index source
First, you must define which contents will be indexed.
In order to do this, change to the "Search Management", "View Index Sources". In this view,
create a new
index
source by providing a name for that source.
Back in the index source view, click to the name of the new index source and assign all documenttypes that should be indexed. Then, add all root folders containing the contents in "Assign resources".
Step 2: Defining a new index
Go up to the "Search management", select "New index" and provide a name for the new index.
Additionally, you can change the values for
- rebuild mode:
-
auto indicates that indexing will be done as part of each reasource publishing,
i.e.
resources are indexed when they are published. - manual indicates that indexing is done as a separate process, i.e. by a "scheduled job".
-
auto indicates that indexing will be done as part of each reasource publishing,
i.e.
- locale: the locale defines the language used for the indexing. This defines, which content elements in resources are indexed (only elements with a matching locale), and which analyzer is used to extract the relevant contents. Searching works bad if you have a mismatch in the locale and the real language of the contents, so ensure to store contents with the appropriate locale and don't mix several languages in one index!
- project: defines the project in which the resources are indexed.
Back in the index overview, click to the name of the new index, and assign at least one index source (i.e. the indexsource defined in step 1) to it.
Step 3: Creating the new index
After that, you can start the first indexing of the assigned contents by clicking to the
"Rebuild" action in the index overview and confirming the rebuild.
The system starts the indexing process and shows the progress.
When finished, you can try a search on the indexed contents using the "Search" action in the index overview.
Defining a field configuration
For special purposes, you can define an additional field configuration that defines what fields are available in the index and which content item will be indexed for that field.
In the "Field Configuration" of the search management, you can specify fields for a field configuration with the following values:
- Name: The name of the content item
- Index: Defines if and how the content is stored:
- true - The content is indexed using the analyzer configured for the index
- false - The content is not indexed, i.e. not searchable
- untokenized - The content is indexed as raw content without using the analyzer
- Store: Defines if the content is also completely stored in the index. If not selected, only the reverse references are stored for searching.
- Excerpt: Defines if an excerpt is generated if a search has hits in the field
- Display: Defines a "nice name" for the field
- Boost: Defines the weight of a hit in the field. The default value is 1.0, hits with larger boost factors are handled as more relevant.
- Default: Defines a default value for the field