Add decimal properties to a numeric index definition

This procedure describes how to add decimal properties to a numeric index definition.

The decimal properties element in a numeric index definition tells TEXTML Server how to interpret the decimal numbers encountered in documents. This definition is particularly useful when creating an index definition for elements that deal with monetary values. For example, if you have a document in which the <price> element contains the value "15.856", does the search engine index it as "15.86" or "15,85" (or something else)? The answer depends on the decimal properties definition—in this case, the value of the <decimalsymbol> and <decimalprecision> elements.

Tip: Each numeric index definition (and there can be several) within your Index Definition document can contain either a decimalindexproperties element or an integerindexproperties element; it cannot contain both. For example, a "monetary units" numeric index definition would include a decimalindexproperties element, whereas a "population" numeric index would include an integerindexproperties element.

To add decimal properties for a numeric index definition:

  1. Create a numeric index definition. (See Create a numeric index definition.)
  2. Add a <decimalindexproperties> element.
  3. To limit the range of values indexed, add an <interval> element. Use the <start> and <end> elements to specify the range. Set the value of the INCLUSIVE attribute to True to include the start and/or end numbers in the range. In the example below, decimal values of 1.00 and higher will be indexed:
    <decimalindexproperties> 
       <interval> 
          <start INCLUSIVE="True"> 
             <number>1.00</number> 
          </start> 
       </interval>
    </decimalindexproperties>
    Note: The <start> and <end> elements are optional; thus in the example above, where <end> is not defined, all values above 1.00 will be indexed.
    Note: Enter range numbers with no thousand separator and a period as the decimal separator.
  4. To ignore non-numeric content around numbers, add a <contenttrim> element. Value can be any of the following:
    • Left: TEXTML Server ignores non-numeric strings to the left of the number.
    • Right: TEXTML Server ignores non-numeric strings to the right of the number.
    • Both: TEXTML Server ignores non-numeric strings on both sides of the number.
    • None: Numeric strings that include non-numeric characters are not indexed.
    <decimalindexproperties>
       <contenttrim VALUE="Both">
       </contenttrim>
    </decimalindexproperties>
  5. To specify which symbol should be interpreted as a thousands symbol, add a <thousandsymbol> element. Value can be any of the following:
    • Comma, as in 12,000
    • Space, as in 12 000
    • Period as in 12.000
    • All, all separators (comma, space and period) are ignored. (All the above examples indexed as 12000).
    • None: TEXTML Server does not recognize any symbol as a thousands separator, and numbers will be rendered exactly as written.
    <decimalindexproperties> 
       <thousandsymbol VALUE="Comma"/> 
    </decimalindexproperties>
    Note: The option "Both" is listed in the DTD but not used; it is available only for compatibility with pre-4.X versions of the TEXTML Server DTD.
  6. To specify which symbol should be interpreted as decimal separator, add a <decimalsymbol> element. Value can be any of the following:
    • Period, as in 12.89 (usage in the USA)
    • Comma, as in 12,89 (usage in Europe)
    • Both, both separators (period and comma) are recognized.
    <decimalindexproperties> 
       <decimalsymbol VALUE="Period"/> 
    </decimalindexproperties>
  7. To specify the number of decimal places in numbers, add a <decimalprecision> element (0 to 14) and an ONOVERFLOW attribute to indicate how numbers after the cutoff point are handled. The ONOVERFLOW options are as follows:
    • Reject: TEXTML Server drops the numbers after the decimal limit.
    • Round: TEXTML Server rounds up or down to the nearest decimal place.
    • RoundUp: TEXTML Server rounds decimal numbers up to the next decimal place.
    • RoundDown: TEXTML Server rounds decimal numbers down to the next decimal place.

    Table 1 shows how a sample decimal number would be rendered in the indexes using the various ONOVERFLOW options.

    Table 1. Decimal precision and rounding examples
    Number <decimalprecision> value ONOVERFLOW attribute Rendering
    50.388 2 Reject 50.38
    50.388 2 Round 50.40
    50.388 2 RoundUp 50.39
    50.388 2 RoundDown 50.38
    <decimalindexproperties>
       <decimalprecision VALUE="2" ONOVERFLOW="Reject"/>
    </decimalindexproperties>