Plots2: Profiles search page: search by user tag

Created on 27 Sep 2018  路  11Comments  路  Source: publiclab/plots2

Right now, the Profiles option on the search page (https://publiclab.org/search/profiles/balloons/) is searching for users by username and bio.

In the endpoint, we would like to add the option to also search for user tags. Here we already have the parameter/value field=username, it is used when we want to search only by username. One option would be to add field=tag.

JavaScript Ruby help wanted search

Most helpful comment

Hi @milaaraujo I would like to work on this issue

All 11 comments

Hi @milaaraujo I would like to work on this issue

Hello Cess! We'd love your help.

@milaaraujo do you think on this one we may need to expand the search method in user.rb to include indexing tags somehow? I'm not totally sure how that'd work. Would it be a combined SQL query joining in the user_tags table ?

https://github.com/publiclab/plots2/blob/0c0007fe7a64b9ee11aee33abaf6ee1eb2711195/app/models/user.rb#L45-L47

Perhaps it'd be a unique method like def self.search_by_tag(query) which would join in the user_tag table, or maybe something like:

def self.search_by_tag(query, limit: 25)
  user_tags.where('value LIKE ?', query + '%')
    .limit(limit)
  User.find user_tags.collect(&:uid)
end

What do you think?

We'd probably want to write a test against this, similar to:

https://github.com/publiclab/plots2/blob/0c0007fe7a64b9ee11aee33abaf6ee1eb2711195/test/unit/user_test.rb#L37-L44

Hey guys, sorry for the delay but I took the last week off! I will answer you tonight!

Hey @jywarren, I would follow your second suggestion (a unique method like def self.search_by_tag(query))!

However, @stefannibrasil started working on #3501 and by my understanding her solution would address this issue here as well... Am I right, @stefannibrasil?

yes, I'll see if I can break into smaller tasks :)

Hey @cesswairimu, it will be difficult to break #3501 solution into smaller tasks for now...

Actually, I found a way to use your help, @cesswairimu! I am working on #3767. Once the endpoint is up to date we will need help to make the page (https://publiclab.org/search/profiles/) use the option tag.

Awesome @milaaraujo I am interested and will take a look when its merged. Thanks a lot

Just merged that change! Great!!

Re-opening:

  • [x] Create tag option to the /profile endpoint (#3767)
  • [ ] Make the page (https://publiclab.org/search/profiles/) use the option tag

Re-opening:

  • [x] Create tag option to the /profile endpoint (#3767)
  • [ ] Make the page (https://publiclab.org/search/profiles/) use the option tag
Was this page helpful?
0 / 5 - 0 ratings

Related issues

first-timers[bot] picture first-timers[bot]  路  3Comments

first-timers[bot] picture first-timers[bot]  路  3Comments

grvsachdeva picture grvsachdeva  路  3Comments

first-timers[bot] picture first-timers[bot]  路  3Comments

grvsachdeva picture grvsachdeva  路  3Comments