code: def to_index_value(self, value, index):
          
  
          # ZPublisher records can be passed to the catalog as is.
          if isinstance(value, HTTPRequest.record):
              return value
  
          if isinstance(index, basestring):
              index = self.get_index(index)
  
          if index.id == "portal_type":
              return filter(lambda x: x, _.to_list(value))
          if index.meta_type == "DateIndex":
              return DateTime(value)
          if index.meta_type == "BooleanIndex":
              return bool(value)
          if index.meta_type == "KeywordIndex":
              return value.split(",")
  
          return value
docs: Convert the value for a given index