username suggestions are random #92

Closed
opened 2021-05-03 13:50:51 +00:00 by prandnum · 10 comments
prandnum commented 2021-05-03 13:50:51 +00:00 (Migrated from gitlab.com)
Moving this ticket from Peerplays DEX based n the following comment 
https://gitlab.com/PBSA/peerplays-dex/-/issues/173#note_563935507

For the below given screenshot on typing j it gives suggestion with users name starting and containing the letter j

image

but now when we give k, it doesn't provide me jkr as a suggestion

image

But when we give m it gives me suggestion where the character is contained in the username

image

``` Moving this ticket from Peerplays DEX based n the following comment https://gitlab.com/PBSA/peerplays-dex/-/issues/173#note_563935507 ``` For the below given screenshot on typing j it gives suggestion with users name starting and containing the letter j ![image](/uploads/d28864e557aefd37256b0f406b6bf265/image.png) but now when we give k, it doesn't provide me jkr as a suggestion ![image](/uploads/efce91e43250680d8670a66778a5ad9e/image.png) But when we give m it gives me suggestion where the character is contained in the username ![image](/uploads/b0e0e16fa1fe99b11cae91f591e6b929/image.png)
prandnum commented 2021-05-03 13:52:10 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
prandnum commented 2021-05-03 13:53:00 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
prandnum commented 2021-05-03 13:53:49 +00:00 (Migrated from gitlab.com)

mentioned in issue peerplays-dex#173

mentioned in issue peerplays-dex#173
prandnum commented 2021-05-03 13:54:20 +00:00 (Migrated from gitlab.com)

@bobinson @serkixenos @sierra19XX

CC: @hbelakon

@bobinson @serkixenos @sierra19XX CC: @hbelakon
serkixenos commented 2021-05-19 18:45:22 +00:00 (Migrated from gitlab.com)

Looks like there is a misunderstanding on how lookup_accounts function works.

lookup_accounts (and many other APIs) are using "lower bound" parameter. This parameter is passed to a lower_bound method of a index (in this case account_index by_name), inside boost multi_index_container, where the objects are stored.

lower_bound is described in Boost docs as:

template<typename CompatibleKey>
iterator lower_bound(const CompatibleKey& x)const;
Requires: CompatibleKey is a compatible key of key_compare.
Effects: Returns an iterator pointing to the first element with key not less than x, or end() if such an element does not exist.
Complexity: O(log(n)).

lookup accounts is not kind of "wildcard" search, which will return anything that contains characters passed as a parameter. It is a "less or equal" kind of search, which will return any account names that are "less than" a parameter.

Use the following call to get actual results returned from the node

curl --data '{"jsonrpc": "2.0", "method": "lookup_accounts", "params": ["jkr", 10], "id": 1}' http://127.0.0.1:8090/rpc | jq -r
Looks like there is a misunderstanding on how lookup_accounts function works. lookup_accounts (and many other APIs) are using "lower bound" parameter. This parameter is passed to a lower_bound method of a index (in this case account_index by_name), inside boost multi_index_container, where the objects are stored. lower_bound is described in Boost docs as: ``` template<typename CompatibleKey> iterator lower_bound(const CompatibleKey& x)const; Requires: CompatibleKey is a compatible key of key_compare. Effects: Returns an iterator pointing to the first element with key not less than x, or end() if such an element does not exist. Complexity: O(log(n)). ``` lookup accounts is not kind of "wildcard" search, which will return anything that contains characters passed as a parameter. It is a "less or equal" kind of search, which will return any account names that are "less than" a parameter. Use the following call to get actual results returned from the node ``` curl --data '{"jsonrpc": "2.0", "method": "lookup_accounts", "params": ["jkr", 10], "id": 1}' http://127.0.0.1:8090/rpc | jq -r ```
serkixenos commented 2021-05-19 18:48:13 +00:00 (Migrated from gitlab.com)

assigned to @prandnum

assigned to @prandnum
prandnum commented 2021-10-30 18:05:30 +00:00 (Migrated from gitlab.com)

@bobinson The username suggestions provided in the screens(mentioned above) are random. This is not usable for an enduser. Should we deprecate the existing behaviour or look for another function to implement username suggestions?

CC: @serkixenos

@bobinson The username suggestions provided in the screens(mentioned above) are random. This is not usable for an enduser. Should we deprecate the existing behaviour or look for another function to implement username suggestions? CC: @serkixenos
bobinson commented 2021-10-30 18:46:00 +00:00 (Migrated from gitlab.com)

I have found this useless too. We are not planning to use this anywhere. To be honest, I don't even know what this contact option is all about. We can kill those screens and ignore this search feature.

I have found this useless too. We are not planning to use this anywhere. To be honest, I don't even know what this contact option is all about. We can kill those screens and ignore this search feature.
prandnum commented 2021-11-01 12:52:38 +00:00 (Migrated from gitlab.com)

closing as per above comment.

closing as per above comment.
prandnum (Migrated from gitlab.com) closed this issue 2021-11-01 12:52:39 +00:00
serkixenos commented 2021-12-10 20:28:13 +00:00 (Migrated from gitlab.com)

Actually, its "greater or equal".

Effects: Returns an iterator pointing to the first element with key not less than x, or end() if such an element does not exist.
Actually, its "greater or equal". ``` Effects: Returns an iterator pointing to the first element with key not less than x, or end() if such an element does not exist. ```
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Peerplays_Blockchain/peerplays_migrated#92
No description provided.