Search the documentation
 Show GitHub edit links  Hide GitHub edit links
Documented since: 10.5.1 Latest revision for: 10.5.1 Valid for OpenCms: 10.5.2

The "Source search" app allows to search resources in OpenCms and programmatically replace parts of the 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. 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 four search types that are the combination of two different collect types and two 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.

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.