Example for multi-locale and multi-site Setup #60
-
How do you guys configure Dynamic Search to work with a multi-locale and multi-site setup? The page structure does look something like this: Root
├── Site A
│ ├── de # Search only German contents of Site A.
│ ├── fr # Search only French contents of Site A.
│ ├── en # Search only English contents of Site A.
│ └── ...
├── Site B
│ ├── en # Search only English contents of Site B.
│ ├── zh # Search only Chinese contents of Site B.
│ ├── da # Search only Danish contents of Site B.
│ └── ...
└── ... I'd be very much interested in how to filter contents by language and site, which is a requirement in that case (see comments in tree structure above). My first intuition was to go for the web crawler approach, which would only crawl a certain site (via defined URL), but then I realized I have to create a context per site, which isn't ideal as well. Is there any best practice on how to solve such a use case? Thanks for any tips! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There are several ways to go: ContextUse multiple context blocks for each site. This allows you to completely configure your DS setup independently of each site. Depending on you're frontend request ( Field FlagsAdd two fields to each of your definition ( Example (ElasticSearch Provider):$locale = $this->requestStack->getMainRequest()->getLocale();
$localeQuery = new TermQuery('locale', $locale);
$boolQuery = new BoolQuery();
$boolQuery->add($localeQuery, BoolQuery::FILTER);
// ... todo: add site query |
Beta Was this translation helpful? Give feedback.
There are several ways to go:
Context
Use multiple context blocks for each site. This allows you to completely configure your DS setup independently of each site. Depending on you're frontend request (
/dynamic-search/context1/search?q=123
or/dynamic-search/context2/search?q=123
you're able to fetch site based results.Field Flags
Add two fields to each of your definition (
siteId
andlocale
). So every document, you're going to index, is identifiable by those fields. In your output channel, you're then able to filter your result.Example (ElasticSearch Provider):