This repository has been archived by the owner on Jan 14, 2022. It is now read-only.
Search performance improvement - Closes #320 #321
Merged
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.
What we currently have:
We are making Api calls in this sequence:
searchHeight
,searchBlock
,searchTransaction
,searchPublicKey
,searchAccount
,searchDelegates
Meaning that to get the results of a search for delegate username, we had to make 6 Api calls.
What I do here:
I use the following regex statements
/^[0-9]{2,21}[L|l]$/g
for address/^[0-9a-f]{64}$/g
for publicKey/[a-z!@$&_.]/g
which covers pretty much all the delegatesand if all these cases fails, it will make these requests:
searchHeight
,searchBlock
,searchTransaction
,searchDelegates
.Since it's possible to choose a number as username, I've put
searchDelegate
here, but since practically all the existing usernames include at least one character, I've put thesearchDelegate
last Api call, so it's less likely to be called.Closes #320