Copied to clipboard

Flag this post as spam?

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


  • shinsuke nakayama 109 posts 250 karma points
    Nov 03, 2014 @ 04:19
    shinsuke nakayama
    0

    Umbraco 7 Search and Multi Language website

    Hi guys,

    I have this multi language website, lets say english and japanese.

    On the root of the each site, i have setup "Culture and hostnames", and it's all working fine, except search. When I was testing search functionality I noticed that it was retrieving English contents on the Japanese site search.

    My code for the search looks like this.

    public IList<SearchDto> Search(string keyword)
    {
        var list = new List<SearchDto>();
        var manager = new SearchManager();
    
        foreach (IPublishedContent item in Umbraco.Search(keyword))
        {
            list.Add(manager.ConvertToSearchDto(item));
        }
    
        return list;
    }
    

    Is there any way of just searching the site your currently in? than searching the whole website in the cms database?

    Thank you

    Shinsuke

  • shinsuke nakayama 109 posts 250 karma points
    Nov 03, 2014 @ 09:48
    shinsuke nakayama
    0

    okay i manage to get it working. This is what i've done

    ExamineIndex.config

    <IndexSet SetName="en-AU-ExternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/External-en-NZ" IndexParentId="2856" />
    

    ExamineSettings.config

    //in ExamineIndexProviders
    <add name="en-NZ-ExternalIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine" />
    
    //in ExamineSearchProviders
    <add name="ExternalSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine" />
    

    SearchController.cs

    var searcherName = CultureInfo.CurrentCulture + "-ExternalSearcher";
    var searcher = ExamineManager.Instance.SearchProviderCollection[searcherName];
    var results = searcher.Search(q, false);
    

    Only my concern is this search result returns type of ISearchResults and not iPublishedContent, but i can live with that :)

  • shinsuke nakayama 109 posts 250 karma points
    Nov 03, 2014 @ 09:51
    shinsuke nakayama
    0

    Only thing with this is i have to have Examine index setup for all extra language and define the site root ID identified in the ExamineIndex.config, so if there's any other way, please feel free to share your idea :)

    Cheers

    Shinsuke

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Nov 03, 2014 @ 10:48
    Ismail Mayat
    0

    Shinsuke,

    Your way works fine, one advantage this way is you could implement japanese analyser see http://stackoverflow.com/questions/2643348/lucene-search-for-japanese-characters however one other way would be you have one index and you use gatheringnode data event to inject in a new field called searchable path which is has the path field and then you as part of your query tell it to restict the search to the root id of the language see http://thecogworks.co.uk/blog/posts/2012/november/examiness-hints-and-tips-from-the-trenches-part-2/ on how to do this.

    Regards

    Ismail

  • Chris Roberts 74 posts 106 karma points c-trib
    Aug 10, 2015 @ 14:07
    Chris Roberts
    0

    Hi,

    We are having a problem getting search work on our Japanese website. From what I can find by searching, it appears that you need to use a Japanese-specific analyser for Examine to be able to work with Japanese.

    I'm having trouble finding a suitable .NET analyser, though - most of the things I can find appear to be for Java.

    Does anyone know where I can get an Examine-friendly Japanese analyser?

    Thanks, Chris

  • shinsuke nakayama 109 posts 250 karma points
    Aug 11, 2015 @ 02:32
    shinsuke nakayama
    1

    Hey,

    I had quick look at it, and i think i found something for .net But can you read japanese??

    article here http://www.atmarkit.co.jp/ait/articles/0903/27/news112.html

    dll file here http://www.atmarkit.co.jp/ait/files/20090327/JapaneseAnalyzer.zip

    there's some sample code on page 2 and 3.

    Let me know how it go, I'll probably have to implement this when i start building more Japanese sites.

    PS

    on the site, it also said something about MeCab, which go and fixes japanese characters. I'm not quite sure what it is. I just did google translate and the translation was quite spot on

    EDIT

    I found a blog, he talks about his experience on using this:

    http://blog.jnito.com/entry/20100903/1283482345

    he talks about what he did to improve performance, etc.

    Good Luck

Please Sign in or register to post replies

Write your reply to:

Draft