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.
The first screen is the Search screen that includes all fields and options for searching. (Fig. 1.)
Fig. 1. The search screen.
The textual string to search for.
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.
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!
The amount of results displayed on the search results page. If there are more results than this number, they’re displayed on separate pages.
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)
Means that all visible text, including attributes that are displayed to the user, is searched and replaced. This field is enabled/checked by default.
Means that all external URLs in attributes of links (in other words URLs to external web pages, email mailtos, etc.) are searched and replaced.
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.)
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.
- 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.
- Fill in the replacement text in the Replacement string field.
- Click the Replace selected or the Replace all button.
The replacement string will be inserted for all the chosen objects.
After a replace action is performed you’ll see a feedback message about the number of replacements done. (Fig. 3.)
Fig. 3. Replace feedback.