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?
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 :)
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 :)
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?
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:
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.
Is there any way of just searching the site your currently in? than searching the whole website in the cms database?
Thank you
Shinsuke
okay i manage to get it working. This is what i've done
ExamineIndex.config
ExamineSettings.config
SearchController.cs
Only my concern is this search result returns type of
ISearchResults
and not iPublishedContent, but i can live with that :)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
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
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
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
is working on a reply...