planetary-social / nos

nos.social social media for all of us, using nostr
https://nos.social
Mozilla Public License 2.0
121 stars 14 forks source link

[Autocomplete] Search relays during mentions autocomplete #1560

Open mplorentz opened 2 weeks ago

mplorentz commented 2 weeks ago

Currently the search function that powers our autocomplete of user mentions only searches Core Data locally. It should also search the relays in the user's relay list (and nostr.band). This fulfills the last part of the following user story:

Given that I am a user of Nos When I click the @ symbol in the editor Then it should place an @ in the editor AND Display the people in thread. AND The rest of the search should take place across the network.

Note: This ticket does not include the change to prioritize people participating in the thread at the top of the search results.

Implementation

We have already implemented searching for users by name on our Discover tab. This implementation uses a SearchController with a simple interface. The view set the query to the string the user is searching for and the SearchController populates the authorResults array with the results that should be displayed in the view. The current autocomplete UI uses AuthorListView.search() to build the list of search results from Core Data. Refactoring AuthorListView to use the SearchController is a good starting point for this ticket.

rabble commented 2 weeks ago

Make sure you also take in to account #1568 and that the mentions are sorted in order of engagement on the thread first and secondarily based on the number of mutual contacts with that person.

mplorentz commented 2 weeks ago

@rabble oh I didn't know about that ticket and filed a draft ticket that for this same thing. Thanks for linking the existing one. I moved it into the sprint.