Search and Replace Service

A Search and Replace Service is now available. It lets managers search through all documents of a site, and replace a word or phrase with a string of your choice.

Adding the Search and Replace Service

Go to the Services tab in the ZMI and choose ‘Silva Search and Replace Service’ from the Add drop down menu. Go to the Search and Replace Service and you’ll see the main screen for performing a search.

Search screen

The first screen is the Search screen that includes all fields and options for searching. (Fig. 1.)

Fig. 1. The search screen.

Search query

The textual string to search for.

Search root

The location of the publication or folder to start the search. This should be a valid path from the site root, starting with a slash. Leave this field empty to search the whole Silva instance.

Case sensitivity

Controls whether case is ignored. When checked, the search is case–insensitive.

Note: be careful with this, since the replace string is applied exactly as entered in the replacement box (in the next screen). It may yield undesired results such as a lowercase character at the beginning of a sentence, or uppercase characters in paths, etc. Use with care!

Batch size

The amount of results displayed on the search results page. If there are more results than this number, they’re displayed on separate pages.

Search targets

Controls what parts of objects are searched:

  • Text contents (document text and title attributes), enabled by default
  • External links (path, link and url attributes)
  • Paths (path, link and url attributes)

Text contents

Means that all visible text, including attributes that are displayed to the user, is searched and replaced. This field is enabled/checked by default.

External links

Means that all external URLs in attributes of links (in other words URLs to external web pages, email mailtos, etc.) are searched and replaced.

Paths

Means that all internal paths in XML attributes of images and paths (path, url, link) are searched and replaced.

Performing the search

After filling in all desired fields and selecting desired options click the Perform search button. (Fig. 1.)

Results screen

Overview

After performing the search, you will see a second screen, the Results screen. (Fig. 2.)
This provides information such as the number of processed objects, the total number of occurrences, and a list of objects that match your search criteria. This list displays the path, title, and state of the object, and also the number of occurrences in the object.

Fig. 2. Results screen.

Replacing

  1. Select the checkbox of objects for which you would like to replace the string. If you intend to replace them all this step is not needed.
  2. Fill in the replacement text in the Replacement string field.
  3. Click the Replace selected or the Replace all button.

The replacement string will be inserted for all the chosen objects.

Replace results

After a replace action is performed you’ll see a feedback message about the number of replacements done. (Fig. 3.)

Fig. 3. Replace feedback.