-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for dictionary, separatorTokens and nonSeparatorTokens se…
…ttings.
- Loading branch information
Showing
5 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
src/Meilisearch-Core.package/MsIndex.class/instance/setDictionary..st
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,4 @@ | ||
actions-index-settings | ||
setDictionary: keys | ||
^ self applySettingsUsing: [ :opts | | ||
opts dictionary: keys ] |
4 changes: 4 additions & 0 deletions
4
src/Meilisearch-Core.package/MsIndex.class/instance/setNonSeparatorTokens..st
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,4 @@ | ||
actions-index-settings | ||
setNonSeparatorTokens: nonSeparatorTokens | ||
^ self applySettingsUsing: [ :opts | | ||
opts nonSeparatorTokens: nonSeparatorTokens ] |
4 changes: 4 additions & 0 deletions
4
src/Meilisearch-Core.package/MsIndex.class/instance/setSeparatorTokens..st
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,4 @@ | ||
actions-index-settings | ||
setSeparatorTokens: separatorTokens | ||
^ self applySettingsUsing: [ :opts | | ||
opts separatorTokens: separatorTokens ] |
28 changes: 28 additions & 0 deletions
28
...isearch-Tests.package/MeilisearchTest.class/instance/testSetGetIndexDictionarySettings.st
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,28 @@ | ||
tests | ||
testSetGetIndexDictionarySettings | ||
| originalIndexes newIndexId index settingsTask createIndexTask appliedSettings deleteIndexTask | | ||
originalIndexes := meilisearch indexes. | ||
newIndexId := 'mailisearch-st-test-index-dictionary-settings'. | ||
createIndexTask := meilisearch createIndex: newIndexId. | ||
createIndexTask waitEndedForAWhile. | ||
self assert: createIndexTask isSucceeded. | ||
|
||
index := (meilisearch index: newIndexId). | ||
settingsTask := index applySettingsUsing: [ :opts | | ||
opts dictionary: #('J. R. R.' 'J.R.R.'). | ||
]. | ||
settingsTask waitEndedForAWhile. | ||
|
||
appliedSettings := index getAllSettings. | ||
|
||
self assert: appliedSettings dictionary asSortedCollection equals: #('J. R. R.' 'J.R.R.') asSortedCollection. | ||
|
||
(index setDictionary: #('1')) waitEndedForAWhile. | ||
|
||
appliedSettings := index getAllSettings. | ||
|
||
self assert: appliedSettings dictionary asSortedCollection equals: #('1') asSortedCollection. | ||
|
||
deleteIndexTask := index delete. | ||
deleteIndexTask waitEndedForAWhile. | ||
self assert: deleteIndexTask isSucceeded. |
31 changes: 31 additions & 0 deletions
31
...ch-Tests.package/MeilisearchTest.class/instance/testSetGetIndexSeparatorTokensSettings.st
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,31 @@ | ||
tests | ||
testSetGetIndexSeparatorTokensSettings | ||
| originalIndexes newIndexId index settingsTask createIndexTask appliedSettings deleteIndexTask | | ||
originalIndexes := meilisearch indexes. | ||
newIndexId := 'mailisearch-st-test-index-separator-tokens-settings'. | ||
createIndexTask := meilisearch createIndex: newIndexId. | ||
createIndexTask waitEndedForAWhile. | ||
self assert: createIndexTask isSucceeded. | ||
|
||
index := (meilisearch index: newIndexId). | ||
settingsTask := index applySettingsUsing: [ :opts | | ||
opts separatorTokens: #('|' '…'); nonSeparatorTokens: #('@' '#' '&'). | ||
]. | ||
settingsTask waitEndedForAWhile. | ||
|
||
appliedSettings := index getAllSettings. | ||
|
||
self assert: appliedSettings separatorTokens asSortedCollection equals: #('|' '…') asSortedCollection. | ||
self assert: appliedSettings nonSeparatorTokens asSortedCollection equals: #('@' '#' '&') asSortedCollection. | ||
|
||
(index setSeparatorTokens: #('1')) waitEndedForAWhile. | ||
(index setNonSeparatorTokens: #('2')) waitEndedForAWhile. | ||
|
||
appliedSettings := index getAllSettings. | ||
|
||
self assert: appliedSettings separatorTokens asSortedCollection equals: #('1') asSortedCollection. | ||
self assert: appliedSettings nonSeparatorTokens asSortedCollection equals: #('2') asSortedCollection. | ||
|
||
deleteIndexTask := index delete. | ||
deleteIndexTask waitEndedForAWhile. | ||
self assert: deleteIndexTask isSucceeded. |