Consider instantiating bm25fIMS when setting module.exports
Closed this issue · 3 comments
prtksxna commented
Like express (HTTP server), and unlike other wink libraries, bm25 needs to be instantiated before using.
Express
var express = require('express');
var app = express();
NBC
var bm25 = require( 'wink-bm25-text-search' )();
In our source code, could we:
module.exports = bm25fIMS();
The function doesn't have any arguments so there aren't two ways of doing this any way.
sanjayaksaxena commented
It is required to aid user if s/he needs more than one instance; plus in future it may accept arguments for some additional behavior. In the example require( 'wink-bm25-text-search' )
()
is a shortcut!
prtksxna commented
I have a feeling that someone might miss the extra ()
(while writing their own code), we should at least split it in two lines, like in the case of express.
sanjayaksaxena commented
Updated clearly in the example section of README.