Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M4.1 | Generico filter is not applied on Moodle search results using global search functionality #40

Open
gemguardian opened this issue Jan 24, 2023 · 4 comments

Comments

@gemguardian
Copy link

Hi Justin,
Hope you are well!

I just noticed the Generico filter is not working on the https://xxx/search/index.php page. Generico is not the only filter with this issue, see: https://moodle.org/mod/forum/discuss.php?d=437887 as well as https://tracker.moodle.org/browse/MDL-67847

since that the tracker is already open since 31-01-2020, I dont expect that Moodle HQ will short this soon. Do you think there is a way to make it work for Generico?

Thank you
Gemma

@justinhunt
Copy link
Owner

Hi Gemma. I read that tracker. Thats very interesting.

Generico does not use HTML tags, so I would have thought it would work.
But I guess they didn't bother to apply format_string to the search results because it would not fix the multilang issue (which wont work because the HTML tags will have already been stripped).

@justinhunt
Copy link
Owner

justinhunt commented Jan 25, 2023

I tested it. Yeah its not running filter_string
It will require the addition of format_string() in: search/classes/output/renderer.php function render_result.
So the line would look like:
$docdata['title'] = shorten_text(format_string($docdata['title']), static::SEARCH_RESULT_STRING_SIZE, true);

I probably should submit a patch to Moodle for that, but I seem to get lost in the wilderness when I do that.

For your own use you could:
i) hack the Moodle code to add that
OR
ii) override the renderer and include that modified function in your renderer

@gemguardian
Copy link
Author

Hi Justin,
thank you for your time to take a look at it.

I did an attempt to do what you suggested, but it did not fix the issue. I think it's because it's not in the title but in the content?
image

I hope you can find some time for a patch :) if it helps I am happy to contribute in a financial way since I don't have your programming skilss/knowledge to fix this myself.

Gemma

@justinhunt
Copy link
Owner

Hi Gemma, let me see what I can do ..

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

No branches or pull requests

2 participants