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

How to search in repeater ? #131

Open
PubliAlex opened this issue Apr 6, 2023 · 3 comments
Open

How to search in repeater ? #131

PubliAlex opened this issue Apr 6, 2023 · 3 comments

Comments

@PubliAlex
Copy link
Contributor

Hello,

I wonder if the search plugin support search in a repeater field, for example, when you use a repeater with different groups to handle different kind of content.

If yes, what do you have to put in your yaml file of tailor to search in that fields ?

Thank you

Alex

@tobias-kuendig
Copy link
Member

We currently use a like query to search in specific fields:
https://github.com/OFFLINE-GmbH/oc-site-search-plugin/blob/develop/classes/providers/TailorResultsProvider.php#L56

If the field is a repeater that contains json data that matches the query, it should show up in the results. It will show you any records that have matching data and completely ignore the repater groups.

To get the search for specific repeater groups working, we would have to add some SQL JSON functions.

@PubliAlex
Copy link
Contributor Author

Ok thank you for your answer @tobias-kuendig. I think the default behavior to look for the whole big string that a jsonable create in database is OK.

As an improvement in the future, maybe it would be cool to search directly in some internal value of that json like this :

searchFields:
- title
- description
- repeater[key1]
- repeater[key2]

etc...

@noezansithole
Copy link

How would search the blocks
fields:
title:
label: Title
type: text

block_builder: ????
    type: mixin
    source: Fields\Blocks
    tab: Build By Blocks

siteSearch:


handle: Fields\Blocks
type: mixin
name: Page Blocks

fields:
blocks:
label: Blocks
type: repeater
displayMode: builder
span: adaptive
tab: Blocks
groups:

        paragraph_block:
            name: Paragraph Block
            description: Simple paragraph with image
            icon: octo-icon-text-h1
            fields:
                _mixin:
                    type: mixin
                    source: Blocks\ParagraphBlock

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

3 participants