Plots2: Search results should include words mentioned in Title

Created on 5 Dec 2018  路  11Comments  路  Source: publiclab/plots2

Dear everyone,
When i type in the built-in search box in our menu bar for barnraising and texas, i get this page of results: https://publiclab.org/search/barnraising%20texas ...which doesn't list the actual wiki that has "barnraising" and "texas" in the title and as tags: https://publiclab.org/wiki/barnraising-texas-2019.

Similarly, this wiki with "barnraising" and "texas" in the title and tags _doesn't_ show at https://publiclab.org/search/wikis/barnraising+texas

But if you click "Most recent" sorting on https://publiclab.org/search/wikis/barnraising+texas?order=default -- it does show up.

Thanks for reading!

(Updated: we've written a test to demonstrate this bug at https://github.com/publiclab/plots2/pull/4149 - now we should be able to confirm that any solution resolves this test @dinaelhanan wrote. Still looking for help actually resolving it!)

Ruby break-me-up bug help wanted search

All 11 comments

@publiclab/mentors cc @jywarren this looks like a good issue for gci... I would even consider taking it up myself. Thanks for sharing!

Here's where the search is initiated in the controller:

https://github.com/publiclab/plots2/blob/26079dbbc10e13ce1e1874b50faac3de1e47f8ea/app/controllers/search_controller.rb#L11-L14

I wonder if it's doing a default boolean search? We can check that in the logs when running it locally.

It'll be doing one of these three types of search query, in any case:

https://github.com/publiclab/plots2/blob/master/app/models/node.rb#L39-L60

One of them seems to work much better than the others!

This could be broken up to see if we could debug both the observation that it should match the TAGS, and separately that it should match the TITLE. Just a note that here's a test demonstrating matching ONE tag, but not two:

https://github.com/publiclab/plots2/blob/26079dbbc10e13ce1e1874b50faac3de1e47f8ea/test/unit/node_test.rb#L52-L60

So maybe we need to make a new test to test two-tag matches?

There are also a number of search service based tests in this file which we could add to to try to capture these observed bugs within our tests, and then solve the issues by getting the tests to pass:

https://github.com/publiclab/plots2/blob/master/test/unit/api/search_service_full_text_search_test.rb

@jywarren Since I've now gotten familiar with writing tests, I'll be happy to write a test for two-tag matches, like you've mentioned above. I'll open an issue on that. Please add this to the GCI tasks, I'd be more than happy to take it up! (just waiting for approval on this one task:https://codein.withgoogle.com/dashboard/task-instances/5643246135934976/)

@jywarren while trying to open an issue for the tag tests, I was pointed to this issue that might be similar. Is it the same or different? https://github.com/publiclab/plots2/issues/3480

It's similar in that it tests tag-related functions, but it's testing a distinct function. Thanks! 馃憤

@jywarren Ok then, I'll start a new issue. Just a reminder that this should be added to GCI, and that I've still got a task waiting for review, so if you get a second, please check it out!
https://codein.withgoogle.com/dashboard/task-instances/5643246135934976/

Made the GCI task! And approved yours. For people showing up here, you only have to solve one part of it, and we can start by making tests for each of these issues, then trying to get the tests to pass. So that's at least 4 tasks! 馃槃 鉁旓笍

Hey could I help out as well? This task seems to be available on GCI

Completed in #5978

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jywarren picture jywarren  路  3Comments

grvsachdeva picture grvsachdeva  路  3Comments

grvsachdeva picture grvsachdeva  路  3Comments

bronwen9 picture bronwen9  路  3Comments

keshavsethi picture keshavsethi  路  3Comments