lib/indexer.js
function formCluster(params, callback) {
  var query = formQueryLib.createFormQuery(params);
  var q = {
    "search_request" : {
      _source : sourceFields.concat(['text']),
      sort : [
        { "visitors.@timestamp" : {"order" : "desc"}},
      ],
      size : querySize(params),
      query: query
    },
    "query_hint": "*",
    "algorithm": "lingo",
    "field_mapping": {
      "title": ["_source.title"],
      "content": ["_source.text"],
      "url": ["_source.uri"]
    }
  };

  doPost('/contentItem/_search_with_clusters', JSON.stringify(q), function(err, res) {
    if (err) {
      GLOBAL.error('formCluster, carrot2 extension not installed?', err, q);
      callback(err);
      return;
    }
    res.query = q;
    if (!res || res.hits.hits.length < 1) {
      GLOBAL.info('NO HITS FOR', JSON.stringify(q, null, 2));
    }
    // FIXME don't send text
    callback(err, res);
  });
}
function formCluster(params, callback) {
  var query = formQueryLib.createFormQuery(params);
  var q = {
    "search_request" : {
      _source : sourceFields.concat(['text']),
      sort : [
        { "visitors.@timestamp" : {"order" : "desc"}},
      ],
      size : querySize(params),
      query: query
    },
    "query_hint": "*",
    "algorithm": "lingo",
    "field_mapping": {
      "title": ["_source.title"],
      "content": ["_source.text"],
      "url": ["_source.uri"]
    }
  };

  doPost('/contentItem/_search_with_clusters', JSON.stringify(q), function(err, res) {
    if (err) {
      GLOBAL.error('formCluster, carrot2 extension not installed?', err, q);
      callback(err);
      return;
    }
    res.query = q;
    if (!res || res.hits.hits.length < 1) {
      GLOBAL.info('NO HITS FOR', JSON.stringify(q, null, 2));
    }
    // FIXME don't send text
    callback(err, res);
  });
}
function formCluster ( params , callback ) { var query = formQueryLib . createFormQuery ( params ) ; var q = { "search_request" : { _source : sourceFields . concat ( [ 'text' ] ) , sort : [ { "visitors.@timestamp" : { "order" : "desc" } } , ] , size : querySize ( params ) , query : query } , "query_hint" : "*" , "algorithm" : "lingo" , "field_mapping" : { "title" : [ "_source.title" ] , "content" : [ "_source.text" ] , "url" : [ "_source.uri" ] } } ; doPost ( '/contentItem/_search_with_clusters' , JSON . stringify ( q ) , function ( err , res ) { if ( err ) { GLOBAL . error ( 'formCluster, carrot2 extension not installed?' , err , q ) ; callback ( err ) ; return ; } res . query = q ; if ( ! res || res . hits . hits . length < 1 ) { GLOBAL . info ( 'NO HITS FOR' , JSON . stringify ( q , null , 2 ) ) ; } // FIXME don't send text callback ( err , res ) ; } ) ; }
Executes carrot2 cluster query
Executes carrot2 cluster query