Skip to content
OpenCms documentation
OpenCms documentation

Source search app

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

It displays it's results in an explorer-like list that enables you to work on this results directly.

To open the source search, go to the launchpad and click on the Source search icon.

Click on the 'Source search' icon to open the app

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.

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.

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.

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.

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.

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.

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.

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.

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 note 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.