Update search on Workshop and Resources#875
Conversation
| ) #{sort_order == "asc" ? "ASC" : "DESC"} | ||
| SQL | ||
| } | ||
| scope :title, ->(title) { where("workshops.title like ?", "%#{ title }%") } |
There was a problem hiding this comment.
This scope is already defined on line 123
|
@RJV333 this looks great!!! would love to get this in asap, once the merge conflict is handled. |
spec/models/resource_spec.rb
Outdated
| resource1 = Resource.create!(title: "One", user: user, kind: "Handout", rhino_body: random_string) | ||
| resource2 = Resource.create!(title: "Four", user: user, kind: "Handout", rhino_body: "Other") | ||
| resource1 = Resource.create!(title: "One", user: user, kind: "Handout", body: random_string) | ||
| resource2 = Resource.create!(title: "Four", user: user, kind: "Handout", body: "Other") |
There was a problem hiding this comment.
the "body" is not used in the UI, so we should maybe remove it from here and elsewhere in this test?
| scope { join_rich_texts } | ||
| attributes action_text_body: "action_text_rich_texts.plain_text_body" | ||
| options :action_text_body, type: :text, default: true, default_operator: :or | ||
| end |
There was a problem hiding this comment.
we'll need to add the joined rich text search to the search_by_params method so we're still able to use that keywords search box (unlike workshops where it really is searching just title). fine to be in this PR or next. prob best to get this PR in and then do this as followup?
|
|
||
| scope { join_rich_texts } | ||
| attributes action_text_body: "action_text_rich_texts.plain_text_body" | ||
| options :action_text_body, type: :text, default: true, default_operator: :or |
There was a problem hiding this comment.
we'll need to add the searching of rich text body to the workshop search service
|
I should have been more descriptive in my issue. The rich text search join works on other models such as story that include the concern I know for a fact Some AI confusion, I'm 99% we don't have "FULLTEXT" index's. We are just using the works full text. Two different things. |
|
Ah! I didn't notice that. Side note. We are not using the body column on Resource. All of the rich text is on the polymorphic "ActionText::RichText" table. That is where the join comes in to play. |
|
@RJV333 lets keep Workshop search how it is for the time being. The search queries the stakeholders asked about are working in production right now so I'd rather not change it yet. If you can open another issue with some example that don't work for you that would be great. For this PR, can you just comment out the rich text stuff on |

What is the goal of this PR and why is this important?
Closes #860. I noticed we had the same issue on the Workshops page, and in this case, I think the issue was originating from the same issue, which was the usage of 'join_rich_text' in the SearchCop.
So if we want to add the ability to search rich_text content associated with these records, maybe that's worth doing in a follow up? But at least for now the basic searches are working again.
I'm new using SearchCop but here's an explanation I got from debugging via AI about how this fix works
Videos of these searches fixed:
https://github.com/user-attachments/assets/a10c64b7-e736-49a7-ba4f-4fff7f975e43
https://github.com/user-attachments/assets/efda5ecb-ea11-4275-9cef-9ae491082b47