sui icon indicating copy to clipboard operation
sui copied to clipboard

[explorer] Search Disambiguation

Open apburnie opened this issue 3 years ago • 15 comments

The Problem

Suppose a user wishes to see results on the object 0000000000000000000000000000000000000002. If they search for this value, that get the address of this label (https://explorer.devnet.sui.io/addresses/0000000000000000000000000000000000000002) rather than the object. The only way for the user to find the results on the object is by directly typing in the correct URL (https://explorer.devnet.sui.io/objects/0000000000000000000000000000000000000002).

How can a user search for an entity when both an object and address share the same ID?

Proposed Solution

When both an address and object have the same ID and the user searches for this ID, they are redirected to a Search Results Page. The user then selects whether they want to see results on the address or the object.

apburnie avatar May 09 '22 15:05 apburnie

Wikipedia-style disambiguation page sounds fine - show links to the results with a type label beside them

for consideration, another way we could allow the search box to be used for type-specific nav:

an addition to the text in the search bar, like Twitter or Unity have (t|type):(address|transaction|object)

t:address 0000000000000000000000000000000000000002 type:object 0000000000000000000000000000000000000002

stella3d avatar May 09 '22 16:05 stella3d

@stella3d --> I like the idea of having a search filter. If the user specified the type of entity, then the search would only have to ping the one API resource. We could either have a dropdown box next to the search bar where the user specifies one category of entity to search within or provide a checklist where the user specifies one or more categories to search across.

Perhaps this is best handled under a separate issue?

apburnie avatar May 09 '22 16:05 apburnie

I've created a new issue for the search filter idea here: https://github.com/MystenLabs/sui/issues/1871

apburnie avatar May 09 '22 16:05 apburnie

Fixing this issue is blocked by the RPC API not providing a way of distinguishing objects owning objects from addresses owning objects. Following a Slack discussion, there is buy-in on adding the following two functions in the RPC API (exact labels may vary):

  • get_owned_objects_of_address: returns objects owned by an address.
  • get_owned_objects_of_object: returns objects owned by an object.

apburnie avatar May 13 '22 09:05 apburnie

For now, the address 0000000000000000000000000000000000000002 has had its owned objects removed thus facilitating searching for the object of this ID.

apburnie avatar May 13 '22 09:05 apburnie

anyone working on this for the backend? @mystenmark? If not I will take a look

patrickkuo avatar May 18 '22 10:05 patrickkuo

I can do this but I have a few other things to finish first so if you want to take it @patrickkuo go ahead

mystenmark avatar May 18 '22 16:05 mystenmark

Cool I will start working on it tomorrow

patrickkuo avatar May 18 '22 22:05 patrickkuo

Question, what if the user wants to find the address 0000000000000000000000000000000000000002? Right now the search defaults to the object.

bwann52 avatar May 27 '22 17:05 bwann52

@bwann52 , right now they have to use the filter box.

The proposed solution is that When both an address and object have the same ID and the user searches for this ID, they are redirected to a Search Results Page. The user then selects whether they want to see results on the address or the object.

666lcz avatar May 28 '22 17:05 666lcz

Per feedback from @adeabiodun , we will implement the proposed solution and remove the existing filter box.

666lcz avatar May 28 '22 17:05 666lcz

@666lcz so basically

  • we will display a result page whenever there are multiple results for the same search ID
  • The result page will present the user with the option to select either the Address or Object

Jibz1 avatar May 31 '22 14:05 Jibz1

This is done https://github.com/MystenLabs/sui/pull/2434

Jibz1 avatar Jun 06 '22 16:06 Jibz1

@Jibz1 --> Please see comments in PR - I've specified line-by-line changes to expedite the process.

apburnie avatar Jun 06 '22 16:06 apburnie

this is done.

Jibz1 avatar Jun 07 '22 09:06 Jibz1