Skip to content

Instantly share code, notes, and snippets.

@AnnamrajuSarvani
Last active June 29, 2017 08:23
Show Gist options
  • Save AnnamrajuSarvani/bed1f578e3ab0a0ee99d7f0fe17ca864 to your computer and use it in GitHub Desktop.
Save AnnamrajuSarvani/bed1f578e3ab0a0ee99d7f0fe17ca864 to your computer and use it in GitHub Desktop.
Sample Application for Search Index
var JSONStream = require('JSONStream');
Readable = require('stream').Readable;
var fs= require('fs');
exports.Search= function(){
var index;
function indexData(err, newIndex){
if (!err) {
var result=[];
var result=[];
index = newIndex;
index.search({
query: [{
AND: {
'*': ['linseed','argentina']
}
}]
}).on('data', function(data){
result.push(data);
})
.on('end',function(){
console.log('---->',result);
})
//created index from json
// fs.createReadStream('sample.json')
// .pipe(JSONStream.parse())
// .pipe(index.defaultPipeline())
// .pipe(index.add())
// .on('finish', function() {
// // complete
// console.log("complete===>" )
// })
// console.log("search-->")
}
else{console.log(err)}
}
var ops = {
indexPath: 'myCoolIndex',
logLevel: 'error'
}
require('search-index')(ops, indexData)
}
exports.Search();
{
"title":"BAHIA COCOA REVIEW",
"body":"Showers continued throughout the week in\nthe Bahia cocoa zone, alleviating the drought since early\nJanuary and improving prospects for the coming temporao,\nalthough normal humidity levels have not been restored,\nComissaria Smith said in its weekly review.\n The dry period means the temporao will be late this year.\n Arrivals for the week ended February 22 were 155,221 bags\nof 60 kilos making a cumulative total for the season of 5.93\nmln against 5.81 at the same stage last year. Again it seems\nthat cocoa delivered earlier on consignment was included in the\narrivals figures.\n Comissaria Smith said there is still some doubt as to how\nmuch old crop cocoa is still available as harvesting has\npractically come to an end. With total Bahia crop estimates\naround 6.4 mln bags and sales standing at almost 6.2 mln there\nare a few hundred thousand bags still in the hands of farmers,\nmiddlemen, exporters and processors.\n There are doubts as to how much of this cocoa would be fit\nfor export as shippers are now experiencing dificulties in\nobtaining +Bahia superior+ certificates.\n In view of the lower quality over recent weeks farmers have\nsold a good part of their cocoa held on consignment.\n Comissaria Smith said spot bean prices rose to 340 to 350\ncruzados per arroba of 15 kilos.\n Bean shippers were reluctant to offer nearby shipment and\nonly limited sales were booked for March shipment at 1,750 to\n1,780 dlrs per tonne to ports to be named.\n New crop sales were also light and all to open ports with\nJune/July going at 1,850 and 1,880 dlrs and at 35 and 45 dlrs\nunder New York july, Aug/Sept at 1,870, 1,875 and 1,880 dlrs\nper tonne FOB.\n Routine sales of butter were made. March/April sold at\n4,340, 4,345 and 4,350 dlrs.\n April/May butter went at 2.27 times New York May, June/July\nat 4,400 and 4,415 dlrs, Aug/Sept at 4,351 to 4,450 dlrs and at\n2.27 and 2.28 times New York Sept and Oct/Dec at 4,480 dlrs and\n2.27 times New York Dec, Comissaria Smith said.\n Destinations were the U.S., Covertible currency areas,\nUruguay and open ports.\n Cake sales were registered at 785 to 995 dlrs for\nMarch/April, 785 dlrs for May, 753 dlrs for Aug and 0.39 times\nNew York Dec for Oct/Dec.\n Buyers were the U.S., Argentina, Uruguay and convertible\ncurrency areas.\n Liquor sales were limited with March/April selling at 2,325\nand 2,380 dlrs, June/July at 2,375 dlrs and at 1.25 times New\nYork July, Aug/Sept at 2,400 dlrs and at 1.25 times New York\nSept and Oct/Dec at 1.25 times New York Dec, Comissaria Smith\nsaid.\n Total Bahia sales are currently estimated at 6.13 mln bags\nagainst the 1986/87 crop and 1.06 mln bags against the 1987/88\ncrop.\n Final figures for the period to February 28 are expected to\nbe published by the Brazilian Cocoa Trade Commission after\ncarnival which ends midday on February 27.\n Reuter\n\u0003",
"date":"26-FEB-1987 15:01:01.79",
"topics":[
"cocoa"
],
"places":[
{"city":"el-salvador"},
{"city": "usa"},
{"city": "uruguay"}
],
"id":"1"
}{
"title":"STANDARD OIL <SRD> TO FORM FINANCIAL UNIT",
"body":"Standard Oil Co and BP North America\nInc said they plan to form a venture to manage the money market\nborrowing and investment activities of both companies.\n BP North America is a subsidiary of British Petroleum Co\nPlc <BP>, which also owns a 55 pct interest in Standard Oil.\n The venture will be called BP/Standard Financial Trading\nand will be operated by Standard Oil under the oversight of a\njoint management committee.\n\n Reuter\n\u0003",
"date":"26-FEB-1987 15:02:20.00",
"places":[
{"city": "usa"}
],
"id":"2"
}{
"title":"TEXAS COMMERCE BANCSHARES <TCB> FILES PLAN",
"body":"Texas Commerce Bancshares Inc's Texas\nCommerce Bank-Houston said it filed an application with the\nComptroller of the Currency in an effort to create the largest\nbanking network in Harris County.\n The bank said the network would link 31 banks having\n13.5 billion dlrs in assets and 7.5 billion dlrs in deposits.\n \n Reuter\n\u0003",
"date":"26-FEB-1987 15:03:27.51",
"places":[
{"city": "usa"}
],
"id":"3"
}{
"title":"TALKING POINT/BANKAMERICA <BAC> EQUITY OFFER",
"body":"BankAmerica Corp is not under\npressure to act quickly on its proposed equity offering and\nwould do well to delay it because of the stock's recent poor\nperformance, banking analysts said.\n Some analysts said they have recommended BankAmerica delay\nits up to one-billion-dlr equity offering, which has yet to be\napproved by the Securities and Exchange Commission.\n BankAmerica stock fell this week, along with other banking\nissues, on the news that Brazil has suspended interest payments\non a large portion of its foreign debt.\n The stock traded around 12, down 1/8, this afternoon,\nafter falling to 11-1/2 earlier this week on the news.\n Banking analysts said that with the immediate threat of the\nFirst Interstate Bancorp <I> takeover bid gone, BankAmerica is\nunder no pressure to sell the securities into a market that\nwill be nervous on bank stocks in the near term.\n BankAmerica filed the offer on January 26. It was seen as\none of the major factors leading the First Interstate\nwithdrawing its takeover bid on February 9.\n A BankAmerica spokesman said SEC approval is taking longer\nthan expected and market conditions must now be re-evaluated.\n \"The circumstances at the time will determine what we do,\"\nsaid Arthur Miller, BankAmerica's Vice President for Financial\nCommunications, when asked if BankAmerica would proceed with\nthe offer immediately after it receives SEC approval.\n \"I'd put it off as long as they conceivably could,\" said\nLawrence Cohn, analyst with Merrill Lynch, Pierce, Fenner and\nSmith.\n Cohn said the longer BankAmerica waits, the longer they\nhave to show the market an improved financial outlook.\n Although BankAmerica has yet to specify the types of\nequities it would offer, most analysts believed a convertible\npreferred stock would encompass at least part of it.\n Such an offering at a depressed stock price would mean a\nlower conversion price and more dilution to BankAmerica stock\nholders, noted Daniel Williams, analyst with Sutro Group.\n Several analysts said that while they believe the Brazilian\ndebt problem will continue to hang over the banking industry\nthrough the quarter, the initial shock reaction is likely to\nease over the coming weeks.\n Nevertheless, BankAmerica, which holds about 2.70 billion\ndlrs in Brazilian loans, stands to lose 15-20 mln dlrs if the\ninterest rate is reduced on the debt, and as much as 200 mln\ndlrs if Brazil pays no interest for a year, said Joseph\nArsenio, analyst with Birr, Wilson and Co.\n He noted, however, that any potential losses would not show\nup in the current quarter.\n With other major banks standing to lose even more than\nBankAmerica if Brazil fails to service its debt, the analysts\nsaid they expect the debt will be restructured, similar to way\nMexico's debt was, minimizing losses to the creditor banks.\n Reuter\n\u0003",
"date":"26-FEB-1987 15:07:13.72",
"places":[
{"city": "usa"},
{"city": "brazil"}
],
"id":"4"
}{
"title":"NATIONAL AVERAGE PRICES FOR FARMER-OWNED RESERVE",
"body":"The U.S. Agriculture Department\nreported the farmer-owned reserve national five-day average\nprice through February 25 as follows (Dlrs/Bu-Sorghum Cwt) -\n Natl Loan Release Call\n Avge Rate-X Level Price Price\n Wheat 2.55 2.40 IV 4.65 --\n V 4.65 --\n VI 4.45 --\n Corn 1.35 1.92 IV 3.15 3.15\n V 3.25 --\n X - 1986 Rates.\n\n Natl Loan Release Call\n Avge Rate-X Level Price Price\n Oats 1.24 0.99 V 1.65 -- \n Barley n.a. 1.56 IV 2.55 2.55\n V 2.65 -- \n Sorghum 2.34 3.25-Y IV 5.36 5.36\n V 5.54 -- \n Reserves I, II and III have matured. Level IV reflects\ngrain entered after Oct 6, 1981 for feedgrain and after July\n23, 1981 for wheat. Level V wheat/barley after 5/14/82,\ncorn/sorghum after 7/1/82. Level VI covers wheat entered after\nJanuary 19, 1984. X-1986 rates. Y-dlrs per CWT (100 lbs).\nn.a.-not available.\n Reuter\n\u0003",
"date":"26-FEB-1987 15:10:44.60",
"topics":[
"grain",
"wheat",
"corn",
"barley",
"oat",
"sorghum"
],
"places":[
{"city": "usa"}
],
"id":"5"
}{
"title":"ARGENTINE 1986/87 GRAIN/OILSEED REGISTRATIONS",
"body":"Argentine grain board figures show\ncrop registrations of grains, oilseeds and their products to\nFebruary 11, in thousands of tonnes, showing those for futurE\nshipments month, 1986/87 total and 1985/86 total to February\n12, 1986, in brackets:\n Bread wheat prev 1,655.8, Feb 872.0, March 164.6, total\n2,692.4 (4,161.0).\n Maize Mar 48.0, total 48.0 (nil).\n Sorghum nil (nil)\n Oilseed export registrations were:\n Sunflowerseed total 15.0 (7.9)\n Soybean May 20.0, total 20.0 (nil)\n The board also detailed export registrations for\nsubproducts, as follows,\n SUBPRODUCTS\n Wheat prev 39.9, Feb 48.7, March 13.2, Apr 10.0, total\n111.8 (82.7) .\n Linseed prev 34.8, Feb 32.9, Mar 6.8, Apr 6.3, total 80.8\n(87.4).\n Soybean prev 100.9, Feb 45.1, MAr nil, Apr nil, May 20.0,\ntotal 166.1 (218.5).\n Sunflowerseed prev 48.6, Feb 61.5, Mar 25.1, Apr 14.5,\ntotal 149.8 (145.3).\n Vegetable oil registrations were : \n Sunoil prev 37.4, Feb 107.3, Mar 24.5, Apr 3.2, May nil,\nJun 10.0, total 182.4 (117.6). \n Linoil prev 15.9, Feb 23.6, Mar 20.4, Apr 2.0, total 61.8,\n(76.1). \n Soybean oil prev 3.7, Feb 21.1, Mar nil, Apr 2.0, May 9.0,\nJun 13.0, Jul 7.0, total 55.8 (33.7). REUTER\n\u0003",
"date":"26-FEB-1987 15:14:36.41",
"topics":[
"veg-oil",
"linseed",
"lin-oil",
"soy-oil",
"sun-oil",
"soybean",
"oilseed",
"corn",
"sunseed",
"grain",
"sorghum",
"wheat"
],
"places":[
{"city": "argentina"}
],
"id":"6"
}{
"title":"RED LION INNS FILES PLANS OFFERING",
"body":"Red Lion Inns Limited Partnership\nsaid it filed a registration statement with the Securities and\nExchange Commission covering a proposed offering of 4,790,000\nunits of limited partnership interests.\n The company said it expects the offering to be priced at 20\ndlrs per unit.\n It said proceeds from the offering, along with a 102.5 mln\ndlr mortgage loan, will be used to finance its planned\nacquisition of 10 Red Lion hotels.\n Reuter\n\u0003",
"date":"26-FEB-1987 15:14:42.83",
"places":[
{"city": "usa"}
],
"id":"7"
}{
"title":"USX <X> DEBT DOWGRADED BY MOODY'S",
"body":"Moody's Investors Service Inc said it\nlowered the debt and preferred stock ratings of USX Corp and\nits units. About seven billion dlrs of securities is affected.\n Moody's said Marathon Oil Co's recent establishment of up\nto one billion dlrs in production payment facilities on its\nprolific Yates Field has significant negative implications for\nUSX's unsecured creditors.\n The company appears to have positioned its steel segment\nfor a return to profit by late 1987, Moody's added.\n Ratings lowered include those on USX's senior debt to BA-1\nfrom BAA-3.\n Reuter\n\u0003",
"date":"26-FEB-1987 15:15:40.12",
"places":[
{"city": "usa"}
],
"id":"8"
}{
"title":"CHAMPION PRODUCTS <CH> APPROVES STOCK SPLIT",
"body":"Champion Products Inc said its\nboard of directors approved a two-for-one stock split of its\ncommon shares for shareholders of record as of April 1, 1987.\n The company also said its board voted to recommend to\nshareholders at the annual meeting April 23 an increase in the\nauthorized capital stock from five mln to 25 mln shares.\n Reuter\n\u0003",
"date":"26-FEB-1987 15:17:11.20",
"topics":[
"earn"
],
"places":[
{"city": "usa"}
],
"id":"9"
}{
"title":"COMPUTER TERMINAL SYSTEMS <CPML> COMPLETES SALE",
"body":"Computer Terminal Systems Inc said\nit has completed the sale of 200,000 shares of its common\nstock, and warrants to acquire an additional one mln shares, to\n<Sedio N.V.> of Lugano, Switzerland for 50,000 dlrs.\n The company said the warrants are exercisable for five\nyears at a purchase price of .125 dlrs per share.\n Computer Terminal said Sedio also has the right to buy\nadditional shares and increase its total holdings up to 40 pct\nof the Computer Terminal's outstanding common stock under\ncertain circumstances involving change of control at the\ncompany.\n The company said if the conditions occur the warrants would\nbe exercisable at a price equal to 75 pct of its common stock's\nmarket price at the time, not to exceed 1.50 dlrs per share.\n Computer Terminal also said it sold the technolgy rights to\nits Dot Matrix impact technology, including any future\nimprovements, to <Woodco Inc> of Houston, Tex. for 200,000\ndlrs. But, it said it would continue to be the exclusive\nworldwide licensee of the technology for Woodco.\n The company said the moves were part of its reorganization\nplan and would help pay current operation costs and ensure\nproduct delivery.\n Computer Terminal makes computer generated labels, forms,\ntags and ticket printers and terminals.\n Reuter\n\u0003",
"date":"26-FEB-1987 15:18:06.67",
"topics":[
"acq"
],
"places":[
{"city": "usa"}
],
"id":"10"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment