Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Duarte Carreira 47 posts 66 karma points
    Apr 25, 2011 @ 18:09
    Duarte Carreira
    0

    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

  • Sebastiaan Janssen 5044 posts 15475 karma points MVP admin hq
    Apr 26, 2011 @ 08:32
    Sebastiaan Janssen
    0

    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.

  • Duarte Carreira 47 posts 66 karma points
    Apr 26, 2011 @ 12:20
    Duarte Carreira
    0

    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

  • Markus Johansson 1902 posts 5706 karma points MVP c-trib
    Jun 04, 2012 @ 13:53
    Markus Johansson
    0

    Hi!

    How did you go about solving this one? Is there any property on the search resualt item that I could use to filter?

  • Markus Johansson 1902 posts 5706 karma points MVP c-trib
    Jun 04, 2012 @ 14:07
    Markus Johansson
    0

    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.
    }

Please Sign in or register to post replies

Write your reply to:

Draft