chore: small consistency and documentation fixes#60
Open
erimicel wants to merge 2 commits intotypesense:masterfrom
Open
chore: small consistency and documentation fixes#60erimicel wants to merge 2 commits intotypesense:masterfrom
erimicel wants to merge 2 commits intotypesense:masterfrom
Conversation
- AnalyticsRules and CurationSets now memoize their resource proxies in `[]`, matching the pattern every other collection class already uses (Collections, Documents, Aliases, Keys, Presets, SynonymSets, etc). Calls like `client.curation_sets['x']` now return the same instance across calls, which is the documented contract elsewhere. - Remove an unreachable `|| 3` fallback from `Configuration#num_retries`: the LHS is always an integer because `validate!` rejects empty `nodes`. - Replace `node.send(:[], attr)` with `node[attr]` in `Configuration#node_missing_parameters?` — same behaviour, less indirection. - Document `Typesense::Error#data` in the README so callers know how to read the HTTP status and body from a raised exception.
Contributor
|
Looks like some tests are failing |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A handful of unrelated small fixes that don't really warrant individual PRs.
AnalyticsRules#[]andCurationSets#[]now memoizeEvery other resource collection in the gem caches its proxy on first
[]access —Collections,Documents,Aliases,Keys,Presets,Synonyms,SynonymSets,NlSearchModels,StemmingDictionaries,Overrides,CurationSetItems,AnalyticsRulesV1.AnalyticsRulesandCurationSetswere the only two that built a fresh wrapper on every call.This is purely a consistency fix — there was no shared mutable state on the proxies, so the previous behaviour wasn't a bug, just surprising.
Drop unreachable
|| 3fallback inConfiguration#num_retriesThe LHS is always a positive integer —
validate!raises before we get here if@nodesis empty — so|| 3can never fire. Just deletes the dead tail.Drop
node.send(:[], attr)innode_missing_parameters?Same behaviour, less indirection.
README: document
Typesense::Error#dataTypesense::Errorexposes a.datareader that holds the underlying Faraday response, but the README didn't mention it. Adds a short error-handling section showing how to pull the status / body off a raised exception, plus the list of status-code-to-class mappings.Tests
bundle exec rspec spec/typesense/configuration_spec.rb spec/typesense/analytics_rules_spec.rb spec/typesense/curation_sets_spec.rb— all green.bundle exec rubocopon the touched files — no offences.PR Checklist