-
Notifications
You must be signed in to change notification settings - Fork 314
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
New Filter ep_highlight_number_of_fragments. #3600
Closed
dgnorrod
wants to merge
4
commits into
10up:develop
from
dgnorrod:filter_to_set_number_of_fragments_3579
Closed
New Filter ep_highlight_number_of_fragments. #3600
dgnorrod
wants to merge
4
commits into
10up:develop
from
dgnorrod:filter_to_set_number_of_fragments_3579
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add to ./includes/classes/Feature/Search/Search.php a new filter to set the maximum number of fragments to highlight.
felipeelia
requested changes
Sep 7, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind adding the documentation for the first parameter as well? Thanks!
Wow, what a stupid oversight. I can but not until the 18th. If you can wait that long, I’ll take care of it.
Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Felipe Elia ***@***.***>
Sent: Thursday, September 7, 2023 1:59:37 PM
To: 10up/ElasticPress ***@***.***>
Cc: Norrod, Dennis G. - US ***@***.***>; Author ***@***.***>
Subject: Re: [10up/ElasticPress] New Filter ep_highlight_number_of_fragments. (PR #3600)
EXTERNAL EMAIL - This email originated from outside of CACI. Do not click any links or attachments unless you recognize and trust the sender.
@felipeelia requested changes on this pull request.
Do you mind adding the documentation for the first parameter as well? Thanks!
________________________________
In includes/classes/Feature/Search/Search.php<#3600 (comment)>:
+ /**
+ * Filter the maximum number of fragments highlighted for a searched field.
+ *
+ * @SInCE 5.0.0
+ * @hook ep_highlight_number_of_fragments
+ * @param {string} $field Search field being setup.
+ * @return {int} New maximum number of fragments to highlight for the searched field.
+ */
+ 'number_of_fragments' => apply_filters( 'ep_highlight_number_of_fragments', 0, $field ),
⬇️ Suggested change
- /**
- * Filter the maximum number of fragments highlighted for a searched field.
- *
- * @SInCE 5.0.0
- * @hook ep_highlight_number_of_fragments
- * @param {string} $field Search field being setup.
- * @return {int} New maximum number of fragments to highlight for the searched field.
- */
- 'number_of_fragments' => apply_filters( 'ep_highlight_number_of_fragments', 0, $field ),
+ /**
+ * Filter the maximum number of fragments highlighted for a searched field.
+ *
+ * @SInCE 5.0.0
+ * @hook ep_highlight_number_of_fragments
+ * @param {int} $field Number of fragments
+ * @param {string} $field Search field being setup
+ * @return {int} New maximum number of fragments to highlight for the searched field
+ */
+ 'number_of_fragments' => apply_filters( 'ep_highlight_number_of_fragments', 0, $field ),
—
Reply to this email directly, view it on GitHub<#3600 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BBLGSD2OCHEMFZYVJGNJ2F3XZH4PTANCNFSM6AAAAAA3QBTNGU>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
…________________________________
This electronic message contains information from CACI International Inc or subsidiary companies, which may be company sensitive, proprietary, privileged or otherwise protected from disclosure. The information is intended to be used solely by the recipient(s) named above. If you are not an intended recipient, be aware that any review, disclosure, copying, distribution or use of this transmission or its contents is prohibited. If you have received this transmission in error, please notify the sender immediately.
|
Closing in favor of #3681 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add to ./includes/classes/Feature/Search/Search.php a new filter to set the maximum number of fragments to highlight.
Description of the Change
Added a filter that allows the dev to set the max number of fragments to highlight. This is just a convenience filter that relieves us from having to modify the formatted args directly. This maintains the current default setting of zero fragments.
Closes #3579
How to test the Change
Add this to a function:
Check the query body "highlight" section for the "number_of_fragments" setting.
Changelog Entry
Credits
Props @username, @username2, ...
Props @dgnorrod
Checklist: