This feature was sponsored by QAD

Daisy allows you to perform cross-document search and replace.  Here is an example that shows you the basic search and replace use case:

Let's say we want to change the name of our content management system from Daisy to Tulip.

Using fulltext search, find occurrences of the word 'Daisy'.

serp-fulltextsearch

At the bottom of the search results page, click 'Start search and replace based on query results', which will take you to the search and replace form.

Complete the search and replace form:

serp-search-form

The 'Case sensible' option allows you not to worry about using uppercase or lowercase by using sensible defaults (hence the name). Of course not all replacements can be handled with 100% accuracy, but these simple rules should cover most use cases:

  • If the original text is all lowercase, the replacement text should become lowercase
  • If the original text is ALL UPPERCASE, the replacement text should become UPPERCASE.
  • If the original text is Capitalized, the replacement text should become Capitalized.
  • For all other cases (like MiXeD CaSiNg), the replacement text will be kept in its original form (as entered in the form)

Click 'Search' and wait for the search results to show up:

serp-searchresults

This screen allows you to review what will be replaced and to exclude documents from the replace operation.  Documents that are locked or where you do not have write permission will be marked.

In our case we want to change everything, so we click 'Replace' and wait for the next screen to appear:

serp-replaceresults

Other features

  • Ability to select which documents to include in search and replace operation
    • Single document selection
    • Selection based on search query.
    • Selection based on document basket.
  • Regular expressions
    • Regex support is based on java.util.regex.Pattern.
    • Capturing groups and back-references are also supported ($1, $2, ...)

Limitations & gotcha's

Double check the results.

Unfortunately, we can not always replace all occurrences automatically: Only text in daisy-html parts and in document names is replaced. Always make a detailed review of your site when performing a global search and replace.  Typically you will need to check PDFs, Word documents, Images and Navigation documents).

Fulltext search = live versions.

There is a slight mismatch between the versions used in fulltext searching and search-and-replace.  The fulltext index only contains information on live versions, while the search-and-replace tool operates on the LIVE versions of documents.

Case sensible replacement.

Take into account that 'case sensible' only capitalizes the first letter of the replacement term.  Pay attention if your replacement text consists of two capitalized words, chances are you will not get the desired effect.  If necessary it is always possible to achieve the correct result using multiple search and replace steps.

Locked documents and write access.

The search results page will notify you if documents are locked or if you do not have write access.  During the replace phase these documents are skipped.  The search and replace phase are separate steps, and documents are not locked during the search and replace process, so it is possible that documents become locked or are changed after the search phase but before the replace phase starts.

HTML tags

It is not possible to include html tags in the replacement text.  The replacement text is escaped (i.e. symbols like <, &, > are replaced with &lt;, &amp; and &gt;)