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?
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.
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.
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.
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:
If anybody knows how to access this value e.g. the alias for the Culture property it would be greatly appreciated.
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
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
N.B. So another example would be by default Examine indexes the following fields:
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.
Jason,
It's not a standard property according to examine so you will have to inject it in using gatheringnode data.
Regards
Ismail
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.
is working on a reply...