Copied to clipboard

Flag this post as spam?

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


  • Jason Espin 368 posts 1335 karma points
    Apr 29, 2015 @ 11:20
    Jason Espin
    0

    Indexing page culture in Examine

    Hi all,

    We are in the process of creating a multi-language site with search functionality however, when running a search on the English site we are getting results for the Icelandic version of the site.

    Is there a way in which we can add the culture of a page to the Examine index?

    I have tried the following to no avail:

    <IndexAttributeFields>
      <add Name="id" />
      <add Name="nodeName"/>
      <add Name="updateDate" />
      <add Name="writerName" />
      <add Name="nodeTypeAlias" />
      <add Name="culture" />
    </IndexAttributeFields>
    

    If anybody knows how to access this value e.g. the alias for the Culture property it would be greatly appreciated.

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Apr 29, 2015 @ 12:47
    Ismail Mayat
    0

    Jason,

    Is culture a field that is present on every document and it has been set?  If not then you will need to use gathering node data event and inject in that field although up front you will need to know what culture to set.  You could for the page being indexed get the path which will be something like 1050,1232,1555 (made up some numbers) and then replace the , with space and inject that into new field called searchablePath then as part of your query you could set the filter where searchablePath contains 1050 where 1050 say is home page id of your english site or whatever language home page  see http://thecogworks.co.uk/blog/posts/2012/november/examiness-hints-and-tips-from-the-trenches-part-2/ on how to do this.

    Ideally for different languages you should put them in their own index becuase different languages have different stop words and you can for different languages get different analysers.  I highly recommend a read of elasticsearch the definitive guide (http://www.amazon.co.uk/dp/1449358543) there is a whole chapter on working with different languages, while this is not examine specific examine and elastic both use lucene under the hood so concepts apply.

    Regards

    Ismail

  • Jason Espin 368 posts 1335 karma points
    Apr 29, 2015 @ 17:53
    Jason Espin
    0

    Hi Ismail,

    What I mean is in Umbraco I can access the culture assigned to a page using .GetCulture(); How do I access this as a generic/standard property in Examine. I just need to know the Alias. This is not a custom property.

    Then when I run my examine query I can just ensure that the culture from the page (which is always set on the homepage and propagates downwards in my sites) is passed into the search to ensure only the pages that are ancestors of the search page being used are returned if that makes sense.

    Kind regards,

    Jason

  • Jason Espin 368 posts 1335 karma points
    Apr 29, 2015 @ 17:55
    Jason Espin
    0

    N.B. So another example would be by default Examine indexes the following fields:

      <add Name="id" />
      <add Name="nodeName"/>
      <add Name="updateDate" />
      <add Name="writerName" />
      <add Name="loginName" />
      <add Name="email" />
    

    All I need to know is which name do I use for culture as it should be a generic property/standard property applied to the page.

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Apr 30, 2015 @ 09:52
    Ismail Mayat
    0

    Jason,

    It's not a standard property according to examine so you will have to inject it in using gatheringnode data.

    Regards

    Ismail

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Dec 09, 2018 @ 19:49
    Hendy Racher
    0

    Hi, thought I'd reply, as this can be done with the package Look - it'll automatically create a field called "Look_Culture" populated with the int LCID value of the CultureInfo.

Please Sign in or register to post replies

Write your reply to:

Draft