Skip to content

Commit

Permalink
Merge pull request #16 from mumez/feature/1.4_support
Browse files Browse the repository at this point in the history
Feature/1.4 support
  • Loading branch information
mumez authored Oct 7, 2023
2 parents f418124 + 63f9b1e commit f480d7d
Show file tree
Hide file tree
Showing 14 changed files with 104 additions and 0 deletions.
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 ]
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 ]
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 ]
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ converting
asDictionary
| dict |
dict := Dictionary new.
self dictionary ifNotNil: [:v | dict at: 'dictionary' put: v].
self displayedAttributes ifNotNil: [:v | dict at: 'displayedAttributes' put: v].
self distinctAttribute ifNotNil: [:v | dict at: 'distinctAttribute' put: v].
self faceting ifNotNil: [:v | dict at: 'faceting' put: v].
self filterableAttributes ifNotNil: [:v | dict at: 'filterableAttributes' put: v].
self pagination ifNotNil: [:v | dict at: 'pagination' put: v].
self rankingRules ifNotNil: [:v | dict at: 'rankingRules' put: v].
self searchableAttributes ifNotNil: [:v | dict at: 'searchableAttributes' put: v].
self separatorTokens ifNotNil: [:v | dict at: 'separatorTokens' put: v].
self nonSeparatorTokens ifNotNil: [:v | dict at: 'nonSeparatorTokens' put: v].
self sortableAttributes ifNotNil: [:v | dict at: 'sortableAttributes' put: v].
self stopWords ifNotNil: [:v | dict at: 'stopWords' put: v].
self synonyms ifNotNil: [:v | dict at: 'synonyms' put: v].
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
dictionary: anObject

dictionary := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
dictionary

^ dictionary
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
initialization
initFromDictionary: aDictionary
aDictionary at: 'dictionary' ifPresent: [ :v | self dictionary: v ].
aDictionary at: 'displayedAttributes' ifPresent: [ :v | self displayedAttributes: v ].
aDictionary at: 'distinctAttribute' ifPresent: [ :v | self distinctAttribute: v ].
aDictionary at: 'faceting' ifPresent: [ :v | self faceting: v ].
aDictionary at: 'filterableAttributes' ifPresent: [ :v | self filterableAttributes: v ].
aDictionary at: 'pagination' ifPresent: [ :v | self pagination: v ].
aDictionary at: 'rankingRules' ifPresent: [ :v | self rankingRules: v ].
aDictionary at: 'searchableAttributes' ifPresent: [ :v | self searchableAttributes: v ].
aDictionary at: 'separatorTokens' ifPresent: [ :v | self separatorTokens: v ].
aDictionary at: 'nonSeparatorTokens' ifPresent: [ :v | self nonSeparatorTokens: v ].
aDictionary at: 'sortableAttributes' ifPresent: [ :v | self sortableAttributes: v ].
aDictionary at: 'stopWords' ifPresent: [ :v | self stopWords: v ].
aDictionary at: 'synonyms' ifPresent: [ :v | self synonyms: v ].
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
nonSeparatorTokens: anObject

nonSeparatorTokens := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
nonSeparatorTokens

^ nonSeparatorTokens
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
separatorTokens: anObject

separatorTokens := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
separatorTokens

^ separatorTokens
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"dictionary",
"displayedAttributes",
"distinctAttribute",
"faceting",
"filterableAttributes",
"pagination",
"rankingRules",
"searchableAttributes",
"separatorTokens",
"nonSeparatorTokens",
"sortableAttributes",
"stopWords",
"synonyms",
Expand Down
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.
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.

0 comments on commit f480d7d

Please sign in to comment.