OpenCms Documentation

Source search

The "Source search" app allows to search resources in OpenCms and programmatically replace parts of content.

It displays it's results in an explorer-like list. That enables you to work on this results directly. Which is of great value.

Opening the source search

Since OpenCms 10.5.1 the Source search is an own app. In OpenCms 11 it's functionality has been extended. Before it was part of the Search management. To open the source search, go to the launchpad and click on the Source search icon.

Fig. [open source search]: Click on the "Source search" icon to open the app

Functionality

Source search works in two steps:

  1. Collect: A specified set of resources is collected (e.g., resources under a specific folder and/or with a specific type)
  2. Match: The collected resources are filter via a given search pattern (regular expression) and optionally the matches are replaced by another provided regular expression.

The resources that are matched, are displayed in an explorer-like resource list. Such you have all the context menu options for the resources that you would have in the explorer. E.g., you can display, edit, rename or publish the resources.

Search types

The source search provides several search types that are the combination of different collect types and different match types, as you will notice in the description below.

Plain text

Collection is performed via a database query directly on the VFS (get all values of the specified type under the specified folder). If you are in the online project, collection is performed for the online resources, if you are offline, the offline resources are collected.

From the collected resources all are matched by interpreting them as plain text. In particular, for XML contents, you can also match the XML-nodes, because the XML file is interpreted as plain text.

XML content values only

Collection is performed via a database query directly on the VFS (get all values of the specified type under the specified folder). If you are in the online project, collection is performed for the online resources, if you are offline, the offline resources are collected.

Matching on collected XML resources will only be performed on values in the XML content, not the XML structure itself. You additionally get options to restrict the parts of the content where matching should be performed, i.e., a locale and an XPath restriction.

Property search

Collects all resources where the selected property is set and where the value matches the search pattern. Optionally, the matching property values can be replaced.

Elements in pages

Collects all container pages where the specified element (path to the underlying XML content) is placed on. Optionally, the element can be replaced. Settings remain identically.

Rename nested containers

Similarly to the "Elements in page" mode, all container pages the provided content is placed on are collected. Now you can rename nested containers made up by the elements. This can be interesting if your formatter for the element has changed and now the nested container has a different name. Unless you rename the container in all exsisting container pages, the contents in that containers will not display anymore.

SOLR

Collection is performed using the Solr search engine. If you are in the online project, only online indexes can be used for collection (e.g. Solr Online), if you are offline, only offline indexes (e.g., Solr Offline) can be used for collection. You can specify a Solr query directly. Also the information you provided in "Search folder" and "Resource type" will be merged in your Solr query.

From the collected resources all are matched by interpreting them as plain text. In particular, for XML contents, you can also match the XML-nodes, because the XML file is interpreted as plain text.

SOLR content values only

Collection is performed using the Solr search engine. If you are in the online project, only online indexes can be used for collection (e.g. Solr Online), if you are offline, only offline indexes (e.g., Solr Offline) can be used for collection. You can specify a Solr query directly. Also the information you provided in "Search folder" and "Resource type" will be merged in your Solr query.

Matching on collected XML resources will only be performed on values in the XML content, not the XML structure itself. You additionally get options to restrict the parts of the content where matching should be performed, i.e., a locale and an XPath restriction.

Using Solr for the content collection allows you to apply very advanced collection criteria, it may also speed up collection. But for many cases, the "Plain text" search might be sufficient.

If using Solr, please not that it is only used in the collection phase, match (and replace) are performed in a separate phase, that just takes the resources you collected via Solr. Thus, having a "Search pattern" (used only in the match phase) and a "Solr query" used only in the Collection phase makes perfect sense.

You can improve this page

Please contribute your suggestions or comments regarding this topic on our wiki. For support questions, please use the OpenCms mailing list or go for professional support.