Skip to content

Update search on Workshop and Resources#875

Merged
RJV333 merged 9 commits intorubyforgood:mainfrom
RJV333:860_filter_workshops_by_title_search
Feb 10, 2026
Merged

Update search on Workshop and Resources#875
RJV333 merged 9 commits intorubyforgood:mainfrom
RJV333:860_filter_workshops_by_title_search

Conversation

@RJV333
Copy link
Collaborator

@RJV333 RJV333 commented Feb 9, 2026

  • This work Closes [link an issue]

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

Screenshot 2026-02-08 at 10 06 39 PM

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

@RJV333 RJV333 marked this pull request as draft February 9, 2026 01:49
) #{sort_order == "asc" ? "ASC" : "DESC"}
SQL
}
scope :title, ->(title) { where("workshops.title like ?", "%#{ title }%") }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This scope is already defined on line 123

@RJV333 RJV333 closed this Feb 9, 2026
@RJV333 RJV333 reopened this Feb 9, 2026
@RJV333 RJV333 marked this pull request as ready for review February 9, 2026 03:16
@maebeale
Copy link
Collaborator

maebeale commented Feb 9, 2026

@RJV333 this looks great!!! would love to get this in asap, once the merge conflict is handled.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'll need to add the searching of rich text body to the workshop search service

@jmilljr24
Copy link
Collaborator

jmilljr24 commented Feb 9, 2026

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 RichTextSearchable. I thought I had it working on Resource. Unless we add another search field, Resource should match on title and rich text.

I know for a fact Workshop was working with the combine title/rich text on the "full text contains" query param. Thought it doesn't necessarily need to be combine in the search_cop but it was working before.

Some AI confusion, I'm 99% we don't have "FULLTEXT" index's. We are just using the works full text. Two different things.

@RJV333 RJV333 requested a review from maebeale February 9, 2026 17:23
@RJV333
Copy link
Collaborator Author

RJV333 commented Feb 9, 2026

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 RichTextSearchable. I thought I had it working on Resource. Unless we add another search field, Resource should match on title and rich text.

I know for a fact Workshop was working with the combine title/rich text on the "full text contains" query param. Thought it doesn't necessarily need to be combine in the search_cop but it was working before.

Some AI confusion, I'm 99% we don't have "FULLTEXT" index's. We are just using the works full text. Two different things.

I see we do have this fulltext index on resources (though to be honest, I'm not really familiar with these yet)

Screenshot 2026-02-09 at 12 49 46 PM

@jmilljr24
Copy link
Collaborator

jmilljr24 commented Feb 9, 2026

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.

@jmilljr24
Copy link
Collaborator

jmilljr24 commented Feb 10, 2026

@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 Resource. The title is the most important thing right now and we can dive into the text at a later time.

@RJV333 RJV333 merged commit f2967a0 into rubyforgood:main Feb 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resource Index: Keyword search not matching

3 participants

Comments