Create a unit definition

Units (also known as custom units) are elements that can be searched as a block using a unit operator.

By defining units, one can search for terms within the same element that may be far apart from one another. Whereas the adj and near operators require that search values be within a specified maximum number of words apart, the unit operator requires only that the values appear within the same unit. For example, if the element <p> is defined as a unit, a unit operator search for two values would return only documents where the two values appear within the same paragraph.

To create a unit definition:

  1. Open the Index Definition document for the docbase using a text editor or the TEXTML Server Administration Console. (See Open the Index Definition document for a docbase).
  2. Under the <unit> element, add a new units element, and give it a unique name:
    <units>
       <unit NAME="Movies">
       </unit>
    </units>
  3. Add a <unitelements> element. You may also add an <admindescription> element if desired.
    <units>
       <unit NAME="Movies">
          <unitelements>
             <admindescription>Movie titles</admindescription>
          </unitelements>
       </unit>
    </units>
  4. Add an XPATH attribute to hold the list of XML elements whose content you want indexed.
    <units> 
       <unit NAME = "Movies"> 
          <admindescription>Movie titles</admindescription> 
          <unitelements> 
             <unitelement XPATH="//MovieTitle"/> 
          </unitelements> 
       </unit> 
    </units>
  5. Optionally, to define the unit as a sentence unit, add a <unitsentence> element:
    <units> 
       <unit NAME = "Movies"> 
          <admindescription>Movie titles</admindescription> 
          <unitelements> 
             <unitelement XPATH="//MovieTitle"/>
          </unitelements>
          <unitsentence/>
       </unit> 
    </units>
    Note:

    A sentence unit allows end users to search for words that appear within the same sentence. For example, when end users of your application search for 'Harry Hallows', where the <MovieTitle> unit has been defined as a sentence unit, TEXTML Server will return Harry Potter and the Deathly Hallows but not Harry Potter and the Sorcerer's Stone.