Product DocsMenu

Finding Available Metadata

You may find that it is often not simple to identify the metadata available in indexed documents. This topic explains how to use the AllFieldValues postconversion script to help you extract and review all the available metadata in the documents of a repository.

To find available metadata

  1. Make the AllFieldValues postconversion script available to CES:

    1. Save the content of the following script in the [Index_Path]\Scripts\Postconversion-allfieldvalues.txt text file on the Coveo Master server.

      '**************************************************************************** 
      ' This postconversion script sample adds a new metadata named 
      ' "AllFieldValues". This new metadata contains the name, the value and the 
      ' type of all document metadata. 
      '**************************************************************************** 
      Option Explicit 
      
      ' A double quote. 
      Dim DOUBLE_QUOTE: DOUBLE_QUOTE = chr(34) 
      
      ' This buffer variable holds all metadata names and values. 
      Dim allValues: allValues = "<AllFieldValues>" & vbNewLine 
      
      ' A collection of all field names. 
      Dim fieldNames: fieldNames = DocumentInfo.Fields 
      
      ' For each document field name. 
      Dim fieldName 
      For Each fieldName In fieldNames 
        ' Get the field value. 
        Dim fieldValue: fieldValue = DocumentInfo.GetFieldValue(CStr(fieldName)) 
        
        ' Add the metadata name and its value to the buffer variable. 
        allValues = allValues & "<Field" 
        allValues = allValues & " name=" & DOUBLE_QUOTE & CStr(fieldName) & DOUBLE_QUOTE 
        allValues = allValues & " value=" & DOUBLE_QUOTE & fieldValue & DOUBLE_QUOTE 
        allValues = allValues & " type=" & DOUBLE_QUOTE & TypeName(fieldValue) & DOUBLE_QUOTE 
        allValues = allValues & " />" & vbNewLine 
      Next 
      
      ' Add the new metadata. 
      Call DocumentInfo.SetFieldValue("AllFieldValues", allValues & "</AllFieldValues>" & vbNewLine)  
    2. Add the postconversion script in the Administration Tool using the following values (see Adding a Postconversion Script):

      • NameAllFieldValues

      • Script File[Index_Path]\Scripts\Postconversion-allfieldvalues.txt

      • Script Language: VBScript

  2. Associate the AllFieldValues postconversion script with the source for which you want to see all available metadata (see Applying a Source Conversion Script).

  3. Add the AllFieldValues custom field to the field set used by the source:

    1. If needed, create a new field set to be used by this source (see Adding a Field Set).

    2. Add the AllFieldValues custom field to the appropriate field set using the following values (see Adding or Modifying Custom Fields).

      • NameAllFieldValues

      • Type: String

      • Metadata NameAllFieldValues

    3. Ensure that the source uses the field set that contains the AllFieldValues custom field (see Modifying the Field Set Used by a Source).

  4. If not already done, rebuild the source to populate the AllFieldValues field for all documents of the source.

  5. Use the Index Browser to review the available metadata (see Reviewing Document Details from the Index Browser).

What's Next?

Create custom fields with the useful metadata listed in the AllFieldValues field. Use the Field name value as your metadata name (see Adding or Modifying Custom Fields).

People who viewed this topic also viewed