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

IBX-6878: Customize BO search suggestions #2222

Merged
merged 36 commits into from Apr 19, 2024
Merged

IBX-6878: Customize BO search suggestions #2222

merged 36 commits into from Apr 19, 2024

Conversation

adriendupuis
Copy link
Contributor

@adriendupuis adriendupuis commented Nov 15, 2023

Question Answer
JIRA Ticket IBX-6878
Versions 4.6
Edition All

How to customize Back Office search bar suggestions

  • Config
  • Suggestion source addition
  • Suggestion source replacement

Install and test "Add custom suggestion source" example:

cp -R $DOC_DIR/code_samples/back_office/search/* $DXP_DIR/
cd $DXP_DIR/
tail -n +2 config/append_to_services.yaml >> config/services.yaml && rm config/append_to_services.yaml
cat append_to_webpack.config.js >> webpack.config.js && rm append_to_webpack.config.js
composer run post-install-cmd

Maybe add some more contents if you're on clean install:

composer config minimum-stability dev
composer require ibexa/test-fixtures
php bin/console ibexa:test-fixtures:setup
  • Create a product named "Platform".
  • In the same browser to have the admin session cookie, open something like http://localhost/admin/suggestion?query=platform where your Platform product should be fist
  • Type 'platform" in the BO search bar, your product should be suggested first, before content (page and folder) from clean install.

Checklist

  • Text renders correctly
  • Text has been checked with vale
  • Description metadata is up to date
  • Redirects cover removed/moved pages
  • Code samples are working
  • PHP code samples have been fixed with PHP CS fixer
  • Added link to this PR in relevant JIRA ticket or code PR

@adriendupuis adriendupuis marked this pull request as ready for review February 14, 2024 16:43
@adriendupuis adriendupuis requested review from Steveb-p and alongosz and removed request for kisztof March 5, 2024 15:27
docs/administration/back_office/search_suggestion.md Outdated Show resolved Hide resolved
docs/administration/back_office/search_suggestion.md Outdated Show resolved Hide resolved
docs/administration/back_office/search_suggestion.md Outdated Show resolved Hide resolved
docs/administration/back_office/search_suggestion.md Outdated Show resolved Hide resolved
docs/administration/back_office/search_suggestion.md Outdated Show resolved Hide resolved
docs/administration/back_office/search_suggestion.md Outdated Show resolved Hide resolved
docs/administration/back_office/search_suggestion.md Outdated Show resolved Hide resolved
docs/administration/back_office/search_suggestion.md Outdated Show resolved Hide resolved
docs/administration/back_office/search_suggestion.md Outdated Show resolved Hide resolved
docs/administration/back_office/search_suggestion.md Outdated Show resolved Hide resolved
Co-authored-by: Tomasz Dąbrowski <64841871+dabrt@users.noreply.github.com>
@adriendupuis adriendupuis requested a review from dabrt April 4, 2024 08:41
Copy link
Contributor

@mnocon mnocon left a comment

Choose a reason for hiding this comment

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

Looks good! Just a couple of small suggestions

By default, suggestions start showing up after the user types in at least 3 characters, and 5 suggestions are presented.
This can be changed with [SiteAccess aware dynamic configuration](dynamic_configuration.md), by setting the following [scoped](multisite_configuration.md#scope) parameters:

```yaml
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it recommended to set the SiteAccess parameters directly?

I always thought that the ibexa.system.<scope> configuration is preferred (in this case: https://github.com/ibexa/search/blob/main/src/bundle/DependencyInjection/Configuration/Parser/SiteAccessAware/SuggestionParser.php#L20-L29)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modifications made above and below in 3d9e332.
@mnocon Is it solving your concern?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Side note:

We may need to add something to https://doc.ibexa.co/en/latest/administration/configuration/dynamic_configuration/

The example starts with something that could lead to bad practice:

parameters:
    # Internal configuration
    ibexa.site_access.config.default.content.default_ttl: 60
    ibexa.site_access.config.site_group.content.default_ttl: 3600

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think for our configuration you can always use the SiteAccess-aware configuration - and settings the parameters directly is not recommended (might be needed by partners for something custom, if they don't want to provide the configuration 🤔 )

Co-authored-by: Marek Nocoń <mnocon@users.noreply.github.com>
@adriendupuis adriendupuis merged commit 454b71e into master Apr 19, 2024
4 checks passed
@adriendupuis adriendupuis deleted the suggestion_php branch April 19, 2024 07:23
adriendupuis added a commit that referenced this pull request Apr 19, 2024
---------

Co-authored-by: adriendupuis <adriendupuis@users.noreply.github.com>
Co-authored-by: Tomasz Dąbrowski <64841871+dabrt@users.noreply.github.com>
Co-authored-by: Marek Nocoń <mnocon@users.noreply.github.com>
(cherry picked from commit 454b71e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants