I've got Examine searching working, and it's really slick.
Now this is a multi-lingual site, and now I have to make it work for the several languages it will have. I followed the "standard" approach of having each language in its own root node and setting a corresponding domain and culture.
I have also seen this great post on setting up Examine indexes for each language: Implement Search in a multi-lingual Umbraco site with Examine. This is a great walk-through for setting Examine with or without multi-langual sites. But the problem here is that this approach requires changing the configuration files for Examine for each language you add. I would rather avoid this, and let the site managers add languages by copying nodes in the content tree, setting the domain, etc. All through the web backoffice.
So my question is: can we limit the search results in Examine to a single parent Node? What would be the solution to Examine searching multi-lingual sites without having to edit the config files?
While I'm not sure that this is possible in the examine config file you could try to write a routine that (during the display of the results) would check if the root node is the same as the root node of the current site.
// Get the the root node for the current langugage DynamicNode parent = @Model.AncestorOrSelf(1); // See if the path of the current item starts with the same as the root. Then its the same langugage. if(@searchResults.ElementAt(i).Fields["path"].StartsWith(parent.Path)) { // this is an item from the correct language. }
examine - multi-lingual, filter by root node
Hi all.
I've got Examine searching working, and it's really slick.
Now this is a multi-lingual site, and now I have to make it work for the several languages it will have. I followed the "standard" approach of having each language in its own root node and setting a corresponding domain and culture.
I have also seen this great post on setting up Examine indexes for each language: Implement Search in a multi-lingual Umbraco site with Examine. This is a great walk-through for setting Examine with or without multi-langual sites. But the problem here is that this approach requires changing the configuration files for Examine for each language you add. I would rather avoid this, and let the site managers add languages by copying nodes in the content tree, setting the domain, etc. All through the web backoffice.
So my question is: can we limit the search results in Examine to a single parent Node? What would be the solution to Examine searching multi-lingual sites without having to edit the config files?
Thanks,
Duarte
While I'm not sure that this is possible in the examine config file you could try to write a routine that (during the display of the results) would check if the root node is the same as the root node of the current site.
Hi Sebastiaan.
Yes, that was my plan b. Just hoped we could filter this with Examine queries...
I'm deciding on wether to filter by a parent id, or by a language id. What do you think?
Duarte
Hi!
How did you go about solving this one? Is there any property on the search resualt item that I could use to filter?
This is how i managed to do at the moment:
// Get the the root node for the current langugage
DynamicNode parent = @Model.AncestorOrSelf(1);
// See if the path of the current item starts with the same as the root. Then its the same langugage.
if(@searchResults.ElementAt(i).Fields["path"].StartsWith(parent.Path))
{
// this is an item from the correct language.
}
is working on a reply...