How can I search within comments in a topic?

You can create an index to search within comments in a topic.

Symptom

I want to search within comments that are encapsulated with <!– -->.

Problem

This index is not defined in the default configuration and must be added manually.

Solution

This index creates a column titled XML Comments that will indicate either no comment or contains comments.

In the TEXTML Administration perspective, perform the following:

  1. Edit the Index Definition file to add the following index:
    <index NAME="comments" SYNC="False">
              <stringindex KEEPEXTRACTEDVALUES="True">
                  <elements>
                  <element XPATH="if (//*[comment()]) then 'contains comments' else 'no comment'" DEPTH="INFINITE"/
                 </elements>
             </stringindex>
    </index>
  2. In the summaries section, add the following field:
    <field NAME="comments" TYPE="Index" VALUE="All"/>
  3. To add the index to the Advanced Search panel in the Search view, edit the system/conf/advancedSearchIndexes.xml file and add the following:
    <index attr="false" display="XML Comments" listable="true" name="comments" type="index" views="ALL"/>
  4. To display a column named XML Comments in the Search Results view and other views, edit the system/conf/display.xml file and add the following:
    <key halign="LEFT" label=" XML Comments" name="comments" sortOrder="ASC" sortType="ALPHA" type="Index" visibility="255" width="30"/>
  5. Right-click on your Content Store. Click Rebuild All Indexes.
  6. When the index has finished indexing, restart your DITA CMS Eclipse Client and add the new column to your Search Results view.