SiteSearch plugin

Does the SiteSearch plugin support searching in a multisite tailor model?

I have integrated it as follows:

siteSearch:
providerBadge: null # Display this beside each search result.

pageName: 'camps/camp-details'   # Filename of the target CMS page, used to build links.
searchFields:          # Fields to search in.
- title
- description

thumbFrom: image       # Use the `image` field as thumbnail. Must be a fileupload.
resultFields:
    title: title       # Use the "title" field as the search result title
    text: description  # Use the "description" field as the search result text

I appreciate your assistance.

Best regards,
Zs

Hi @OFFLINE-TK ,

Could you help me please with the question above:

Does the SiteSearch plugin support searching in a multisite tailor model/content?

Kind regards,
Zsolt

@ngyzsolt I don’t think it currently does. Here is the Tailor search query built:

By default, Tailor will probably apply the Multisite global query scope, so only results form the current site are returned.

Can you check if modifying the query to include ->withoutGlobalScopes() will return your desired results?

I would like to return the current site content. If I search in default language content, it is works well, but if I switch to another language and I woult like to search the translated content, does not return anything.

I observed that it search only in default language.

It seams weird for me.

Zsolt

I’ve created an issue on GitHub for this. Please reply there if you find any solution. I will take a look at this issue sometime.

@ngyzsolt I cannot reproduce this issue. SiteSearch always only returns content from the current site.

Can you share your blueprint?

Hi @OFFLINE-TK ,

Here is the blueprint:

siteSearch:
providerBadge: null # Display this beside each search result.

pageName: 'about-us/child-story'   # Filename of the target CMS page, used to build links.
# urlParams:             # Given a page URL: /target-cms-page/:slug/:something
#   slug: $slug          # Use the value of the "slug" field, since it is prefixed with a "$"
#   something: else      # Use the literal string "else", since there is no $-prefix
                       # the output is: /target-cms-page/slug-field-value/else

# See "Custom URL Resolver" below
# This is used *instead of* pageName + urlParams
# urlResolver: '\App\Provider::resolveSiteSearchUrl'

searchFields:          # Fields to search in.
- title
- description

thumbFrom: image       # Use the `image` field as thumbnail. Must be a fileupload.
resultFields:
    title: title       # Use the "title" field as the search result title
    text: description  # Use the "description" field as the search result text

I am still facing with this issue, or am I doing something wrong?

Kind regards,
Zsolt

@ngyzsolt your blueprint looks okay. I am still unable to reproduce the issue. If I search on my primary site, the primary site content is displayed. If I switch to the secondary site, the secondary content is displayed.

I wonder if your multisite setup is not right? Do you see the right content on other pages if you switch to the seconary site?

Maybe you are able to debug this issue yourself. The query is happening here:

If you add a ->dd() before the ->get() you’ll see the results. You can debug the generated query there.