index.js
function(error, newIndex) {
  if (error) {
    console.log('Data error for ' + dataurl + '\n' + error)
  }
  if (!error) {
    index = newIndex
    var timeStart = Date.now()
    request(dataurl)
      .pipe(JSONStream.parse())
      .pipe(index.defaultPipeline())
      .pipe(index.add())
      .on('data', function(data) {
        //console.dir(data) // What's going on in the indexing process
      })
      .on('end', () => {
        var timeEnd = Date.now()
        var timeUsed = Math.trunc((timeEnd - timeStart) / 1000)
        console.log('Indexed in ' +  timeUsed + ' seconds')
      })
  }
}
function(error, newIndex) {
  if (error) {
    console.log('Data error for ' + dataurl + '\n' + error)
  }
  if (!error) {
    index = newIndex
    var timeStart = Date.now()
    request(dataurl)
      .pipe(JSONStream.parse())
      .pipe(index.defaultPipeline())
      .pipe(index.add())
      .on('data', function(data) {
        //console.dir(data) // What's going on in the indexing process
      })
      .on('end', () => {
        var timeEnd = Date.now()
        var timeUsed = Math.trunc((timeEnd - timeStart) / 1000)
        console.log('Indexed in ' +  timeUsed + ' seconds')
      })
  }
}
function ( error , newIndex ) { if ( error ) { console . log ( 'Data error for ' + dataurl + '\n' + error ) } if ( ! error ) { index = newIndex var timeStart = Date . now ( ) request ( dataurl ) . pipe ( JSONStream . parse ( ) ) . pipe ( index . defaultPipeline ( ) ) . pipe ( index . add ( ) ) . on ( 'data' , function ( data ) { //console.dir(data) // What's going on in the indexing process } ) . on ( 'end' , ( ) => { var timeEnd = Date . now ( ) var timeUsed = Math . trunc ( ( timeEnd - timeStart ) / 1000 ) console . log ( 'Indexed in ' + timeUsed + ' seconds' ) } ) } }
indexData const with pipeline pipeline
indexData const with pipeline pipeline