lib/query-builder.js
function term() {
  var args = mlutil.asArray.apply(null, arguments);
  var text = [];
  var weight = null;
  var termOptions = null;
  var arg = null;
  for (var i=0; i < args.length; i++) {
    arg = args[i];
    if (weight === null && arg instanceof WeightDef) {
      weight = arg.weight;
      continue;
    }
    if (termOptions === null && arg instanceof TermOptionsDef) {
      termOptions = arg['term-option'];
      continue;
    }
    if (arg instanceof Array){
      Array.prototype.push.apply(text, arg);
    } else {
      text.push(arg);
    }
  }

  return new TermDef(new TextDef(null, null, text, weight, termOptions, null));
}
function term() {
  var args = mlutil.asArray.apply(null, arguments);
  var text = [];
  var weight = null;
  var termOptions = null;
  var arg = null;
  for (var i=0; i < args.length; i++) {
    arg = args[i];
    if (weight === null && arg instanceof WeightDef) {
      weight = arg.weight;
      continue;
    }
    if (termOptions === null && arg instanceof TermOptionsDef) {
      termOptions = arg['term-option'];
      continue;
    }
    if (arg instanceof Array){
      Array.prototype.push.apply(text, arg);
    } else {
      text.push(arg);
    }
  }

  return new TermDef(new TextDef(null, null, text, weight, termOptions, null));
}
function term ( ) { var args = mlutil . asArray . apply ( null , arguments ) ; var text = [ ] ; var weight = null ; var termOptions = null ; var arg = null ; for ( var i = 0 ; i < args . length ; i ++ ) { arg = args [ i ] ; if ( weight === null && arg instanceof WeightDef ) { weight = arg . weight ; continue ; } if ( termOptions === null && arg instanceof TermOptionsDef ) { termOptions = arg [ 'term-option' ] ; continue ; } if ( arg instanceof Array ) { Array . prototype . push . apply ( text , arg ) ; } else { text . push ( arg ) ; } } return new TermDef ( new TextDef ( null , null , text , weight , termOptions , null ) ) ; }
Builds a query for matching words in a JSON, text, or XML document.
@method
@since 1.0
@memberof queryBuilder#
@param {string} [...text] - one or more words to match
@param {queryBuilder.WeightParam} [weight] - a weight returned
by {@link queryBuilder#weight} to increase or decrease the score
of the query relative to other queries in the complete search
@param {queryBuilder.TermOptionsParam} [options] - options
from {@link queryBuilder#termOptions} modifying the default behavior
@returns {queryBuilder.Query} a composable query
Builds a query for matching words in a JSON text or XML document .