Imagine being paid to improve your favorite CMS!

It could be you! Umbraco HQ are hiring and are looking for both talents and senior developers. Wonderful workplace, friendly colleagues and competitive salary.

Copied to clipboard

Flag this post as spam?

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


  • Michael 121 posts 395 karma points
    Apr 20, 2017 @ 07:50
    Michael
    0

    What about multiple root nodes

    Hi Darren,

    I'm going to start using your plugin, but I have question about multiple hostnames:

    websitename/en

    websitename/de

    websitename/dk

    How I can index separately this content and search directly in relevant index. Is it possible to add multiple indexes, or we can manage this in single?

    Thanks, Mike

  • Ryan McDonough 7 posts 80 karma points c-trib
    Apr 20, 2017 @ 09:13
    Ryan McDonough
    0

    In your /config/ExamineIndex.config you'll see the current indexes.

    You can create a new index per language:

      <IndexSet SetName="en_SiteSearchIndexSet"  IndexPath="~/App_Data/TEMP/ExamineIndexes/enSiteSearch/"  IndexParentId="1250" >
           <IndexAttributeFields>
      <add Name="id" />
      <add Name="nodeName"/>
      <add Name="updateDate" />
      <add Name="writerName" />
      <add Name="loginName" />
      <add Name="email" />
      <add Name="nodeTypeAlias" />
    </IndexAttributeFields>     
      </IndexSet>
    

    Noting the IndexParentId=1250, that would be the ID of the root node for the language you want to index.

  • Michael 121 posts 395 karma points
    Apr 20, 2017 @ 13:15
    Michael
    0

    Hi Rayan,

    Thanks for this, currently I'm using the same structure for Examine. I see that Azure Search plugin has a bit different config with single Index name. Also free tier support up to 3 indexes.

    Thanks, Mike

  • Darren Ferguson 1006 posts 3146 karma points mvp c-trib
    Apr 21, 2017 @ 07:14
    Darren Ferguson
    0

    Hi Ryan,

    I'd always advise against doing this if using Examine. The more indexes you have - the slower Umbraco is to startup.

    A better way is to filter at query level, ensuring that the parent node Id is in the path.

    Thanks.

  • Darren Ferguson 1006 posts 3146 karma points mvp c-trib
    Apr 21, 2017 @ 07:20
    Darren Ferguson
    101

    Hi Mike,

    Sorry for the delay. I'm on holiday just now.

    I'd take the approach of filtering results at query level, the package doesn't support multiple indexes.

    You can use the search client to filter results based on the Path field in the index (which is a list of Ids), or filter based on the Url property in the index - using a wildcard. e.g.

    client.Filter("path", 1042).Results();

    or client.Filter("Url", "/en/*").Results();

    A slightly nicer way to do it may be to store the country name for a node in a custom field in the index and filter on that - there is an indexing event that allows you to add custom fields - just be careful not to do anything to inefficient in an indexing event, or the process will slow right down.

    As mentioned I'm away from the office just now. I could put together a real code example when I am back - the snippets above are guessed/from memory.

    Thanks.

Please Sign in or register to post replies

Write your reply to:

Draft