-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6d85be
commit 65ad3dc
Showing
11 changed files
with
111 additions
and
36 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
dist/search-index-esm-3.0.3.js → dist/search-index-esm-3.1.0.js
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
const si = require('../../') | ||
const test = require('tape') | ||
|
||
const sandbox = 'test/sandbox/' | ||
|
||
const docs = [ | ||
{ | ||
_id: 1, | ||
bandName: '*', | ||
description: 'The nice boys of pop' | ||
}, | ||
{ | ||
_id: 'two', | ||
bandName: 'The Rolling Stones', | ||
description: 'The bad boys of rock' | ||
}, | ||
{ | ||
_id: 3, | ||
bandName: 'The Who', | ||
description: 'Nearly as good as Led Zeppelin' | ||
} | ||
] | ||
|
||
test('set up as per issue #577', async function (t) { | ||
t.plan(2) | ||
|
||
const { PUT, SEARCH } = await si({ | ||
name: sandbox + '577', | ||
tokenSplitRegex: /[\p{L}\d*]+/gu | ||
}) | ||
|
||
t.deepEquals(await PUT(docs), [ | ||
{ _id: 1, operation: 'PUT', status: 'CREATED' }, | ||
{ _id: 'two', operation: 'PUT', status: 'CREATED' }, | ||
{ _id: 3, operation: 'PUT', status: 'CREATED' } | ||
]) | ||
|
||
t.deepEquals( | ||
await SEARCH(['*'], { | ||
DOCUMENTS: true | ||
}), | ||
{ | ||
RESULT: [ | ||
{ | ||
_id: 1, | ||
_match: [{ FIELD: 'bandname', VALUE: '*', SCORE: '1.00' }], | ||
_score: 1.39, | ||
_doc: { | ||
_id: 1, | ||
bandName: '*', | ||
description: 'The nice boys of pop' | ||
} | ||
} | ||
], | ||
RESULT_LENGTH: 1 | ||
} | ||
) | ||
}) | ||
|
||
test('set up as per issue #577', async function (t) { | ||
t.plan(2) | ||
|
||
const { PUT, SEARCH } = await si({ | ||
name: sandbox + '577-2' | ||
}) | ||
|
||
t.deepEquals( | ||
await PUT(docs, { | ||
tokenSplitRegex: /[\p{L}\d*]+/gu | ||
}), | ||
[ | ||
{ _id: 1, operation: 'PUT', status: 'CREATED' }, | ||
{ _id: 'two', operation: 'PUT', status: 'CREATED' }, | ||
{ _id: 3, operation: 'PUT', status: 'CREATED' } | ||
] | ||
) | ||
|
||
t.deepEquals( | ||
await SEARCH(['*'], { | ||
DOCUMENTS: true | ||
}), | ||
{ | ||
RESULT: [ | ||
{ | ||
_id: 1, | ||
_match: [{ FIELD: 'bandname', VALUE: '*', SCORE: '1.00' }], | ||
_score: 1.39, | ||
_doc: { | ||
_id: 1, | ||
bandName: '*', | ||
description: 'The nice boys of pop' | ||
} | ||
} | ||
], | ||
RESULT_LENGTH: 1 | ||
} | ||
) | ||
}) |