Global.helma.Search.Document.prototype.addField (name, value, param)
Adds a field to this document.

  • Parameter {String}:
    name The name of the field
  • Parameter {String}:
    value The value of the field
  • Parameter {Object}:
    param Optional parameter object containing the following properties:
    • .store (Boolean) defaults to true
    • .index (Boolean) defaults to true
    • .tokenize (Boolean) defaults to true
Sourcecode in /home/hannes/helma/modules/helma/Search.js:
1044:   helma.Search.Document.prototype.addField = function(name, value, param) {
1045:       if (!param) {
1046:           param = {};
1047:       }
1048:       if (value != null) {
1049:           var pkg = Packages.org.apache.lucene.document;
1050:           if (value.constructor == Date) {
1051:               // Convert the value 
1052:               value = pkg.DateTools.timeToString(value.getTime(),
1053:                              pkg.DateTools.Resolution.MINUTE);
1054:          } else if (value.constructor != String) {
1055:              value = String(value);
1056:          }
1057:          var f = new pkg.Field(String(name),
1058:                                value,
1059:                                typeof(param.store) == "boolean" ? param.store : true,
1060:                                typeof(param.index) == "boolean" ? param.index : true,
1061:                                typeof(param.tokenize) == "boolean" ? param.tokenize : true);
1062:          this.getDocument().add(f);
1063:      }
1064:      return;
1065:  }