提交 092708a0 编写于 作者: W Wu Jian Ping

update readme

上级 056fac27
...@@ -15,7 +15,7 @@ try { ...@@ -15,7 +15,7 @@ try {
const searcher = Searcher.newWithFileOnly(dbPath) const searcher = Searcher.newWithFileOnly(dbPath)
// 查询 // 查询
const data = await searcher.search('218.4.167.70') const data = await searcher.search('218.4.167.70')
// data: '中国|0|江苏省|苏州市|电信' // data: {region: '中国|0|江苏省|苏州市|电信', ioCount: 3, took: 1.342389}
} catch(e) { } catch(e) {
console.log(e) console.log(e)
} }
...@@ -37,7 +37,7 @@ try { ...@@ -37,7 +37,7 @@ try {
const searcher = Searcher.newWithVectorIndex(dbPath, vectorIndex) const searcher = Searcher.newWithVectorIndex(dbPath, vectorIndex)
// 查询 await 或 promise均可 // 查询 await 或 promise均可
const data = await searcher.search('218.4.167.70') const data = await searcher.search('218.4.167.70')
// data: '中国|0|江苏省|苏州市|电信' // data: {region: '中国|0|江苏省|苏州市|电信', ioCount: 2, took: 0.402874}
} catch(e) { } catch(e) {
console.log(e) console.log(e)
} }
...@@ -58,7 +58,7 @@ try { ...@@ -58,7 +58,7 @@ try {
const searcher = Searcher.newWithVectorIndex(buffer) const searcher = Searcher.newWithVectorIndex(buffer)
// 查询 await 或 promise均可 // 查询 await 或 promise均可
const data = await searcher.search('218.4.167.70') const data = await searcher.search('218.4.167.70')
// data: '中国|0|江苏省|苏州市|电信' // data: {region:'中国|0|江苏省|苏州市|电信', ioCount: 0, took: 0.063833}
} catch(e) { } catch(e) {
console.log(e) console.log(e)
} }
......
...@@ -14,19 +14,16 @@ const searcher3 = Searcher.newWithFileOnly(dbPath) ...@@ -14,19 +14,16 @@ const searcher3 = Searcher.newWithFileOnly(dbPath)
describe('ip2region', () => { describe('ip2region', () => {
it('#newWithFileOnly and search', async () => { it('#newWithFileOnly and search', async () => {
const d = await searcher3.search('218.4.167.70') const d = await searcher3.search('218.4.167.70')
console.log(d)
expect(d.region).equal('中国|0|江苏省|苏州市|电信') expect(d.region).equal('中国|0|江苏省|苏州市|电信')
}) })
it('#newWithVectorIndex and search', async () => { it('#newWithVectorIndex and search', async () => {
const d = await searcher2.search('218.4.167.70') const d = await searcher2.search('218.4.167.70')
console.log(d)
expect(d.region).equal('中国|0|江苏省|苏州市|电信') expect(d.region).equal('中国|0|江苏省|苏州市|电信')
}) })
it('#newWithBuffer and search', async () => { it('#newWithBuffer and search', async () => {
const d = await searcher1.search('218.4.167.70') const d = await searcher1.search('218.4.167.70')
expect(d.region).equal('中国|0|江苏省|苏州市|电信') expect(d.region).equal('中国|0|江苏省|苏州市|电信')
}) })
}) })
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册