Copied to clipboard

Flag this post as spam?

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


  • Yan Xuekai 12 posts 42 karma points
    Apr 24, 2013 @ 04:58
    Yan Xuekai
    0

    Use Lucene to search Chinese website

    Hi, all, I create a chinese website using umbraco, and implement the search function with umbraco examine. To search the chinese content, I change the analyzer to Lucene.Net.Analysis.Cn.ChineseAnalyzer, like bellow:

     

     <add name="ForumEntryIndexer" 
                type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine" 
                dataService="UmbracoExamine.DataServices.UmbracoDataService, UmbracoExamine" 
                indexSet="ForumEntrySet" 
                supportUnpublished="false" 
                supportProtected="false" 
                runAsync="true" 
                interval="10" 
                analyzer="Lucene.Net.Analysis.Cn.ChineseAnalyzer, Lucene.Net" 
                enableDefaultEventHandler="true"/>

     

    but when I open the website, I got a server error:

     

    Server Error in '/' Application.

    Configuration Error

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: Value cannot be null.
    Parameter name: type

    Source Error:

    Line 11:     <providers>
    Line 12:         <add name="ForumEntryIndexer" 
    Line 13:             type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine" 
    Line 14:             dataService="UmbracoExamine.DataServices.UmbracoDataService, UmbracoExamine" 
    Line 15:             indexSet="ForumEntrySet" 

    Could anyone kindly tell me how to deal with this issue?

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Apr 25, 2013 @ 09:50
    Dave Woestenborghs
    100

    Do you have the dll for the analyzer in your bin folder ? Because Lucene.Net.Analysis.Cn.ChineseAnalyzer is not in the Lucene.Net dll provided by Umbraco.

    Dave

  • Yan Xuekai 12 posts 42 karma points
    Apr 26, 2013 @ 08:00
    Yan Xuekai
    0

    hi, Dave,

    Thanks for your reply, you are right, after building the  Lucene.Net.Analysis.Cn and copying the dll to the bin folder, the error don't display anymore. But I have another issue, I still can't search the chinese content, and the english cotent still can be searched out?

    PS: I get the ChineseAnalyzer code from https://svn.apache.org/repos/asf/lucene.net/tags/Lucene.Net_2_9_4_RC3/src/contrib/Analyzers/Cn/

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Apr 26, 2013 @ 08:02
    Dave Woestenborghs
    0

    can you post both your examine config files ?

    Dave

  • Yan Xuekai 12 posts 42 karma points
    Apr 26, 2013 @ 08:18
    Yan Xuekai
    0

    Oh, thank you very much for such quick reply, I have changed my examine searcher and indexer in  the ExamineSettings.config, See below:

    <Examine>
      <ExamineIndexProviders>
        <providers>
            <add name="ForumEntryIndexer" 
                type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine" 
                dataService="UmbracoExamine.DataServices.UmbracoDataService, UmbracoExamine" 
                indexSet="ForumEntrySet" 
                supportUnpublished="false" 
                supportProtected="false" 
                runAsync="true" 
                interval="10" 
                analyzer="Lucene.Net.Analysis.Cn.ChineseAnalyzer, Lucene.Net.Analysis.Cn" 
                enableDefaultEventHandler="true"/>
    
          <add name="InternalIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
               supportUnpublished="true"
               supportProtected="true"
               interval="10"
               analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>
    
          <add name="InternalMemberIndexer" type="UmbracoExamine.UmbracoMemberIndexer, UmbracoExamine"
               supportUnpublished="true"
               supportProtected="true"
               interval="10"
               analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"/>
    
    
            <add name="ExternalIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
                supportUnpublished="false"
                supportProtected="false"
                interval="10"
                analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>
        </providers> </ExamineIndexProviders> 
    <ExamineSearchProviders defaultProvider="ExternalSearcher"> <providers> <add name="ForumEntrySearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine" indexSet="ForumEntrySet" analyzer="Lucene.Net.Analysis.Cn.ChineseAnalyzer, Lucene.Net.Analysis.Cn" /> <add name="InternalSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine" analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/> <add name="ExternalSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine" analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net" enableLeadingWildcards="true"/> <add name="InternalMemberSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine" analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" enableLeadingWildcards="true"/> </providers> </ExamineSearchProviders> </Examine>
  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Apr 26, 2013 @ 08:19
    Dave Woestenborghs
    0

    All seems okay here. Can you post your search code ?

    Dave

  • Yan Xuekai 12 posts 42 karma points
    Apr 26, 2013 @ 08:24
    Yan Xuekai
    0

     public IEnumerable<ForumPost> SearchPosts(string searchTerm)

            {

                var criteria = ExamineManager.Instance.SearchProviderCollection["ForumEntrySearcher"].CreateSearchCriteria();

                var query = criteria.GroupedOr(new string[] { "nodeName", "forumPostContent"}, searchTerm).And().NodeTypeAlias("ForumPost"");

                var results = ExamineManager.Instance.SearchProviderCollection["ForumEntrySearcher"].Search(query.Compile());

                return results.Select(searchResult => Mapper.MapForumPost(searchResult)).OrderByDescending(x => x.CreatedOn);

            }

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Apr 26, 2013 @ 08:26
    Dave Woestenborghs
    0

    Did you create a entry in ExameIndex.config for the index ?

    If yes. Try using luke for checking if you index is being populated

  • Yan Xuekai 12 posts 42 karma points
    Apr 26, 2013 @ 08:34
    Yan Xuekai
    0

    Ok, I will have a try, thanks, Dave

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Jun 27, 2016 @ 10:21
    Jeroen Breuer
    0

    Hello,

    Is it possible to use the StandardAnalyzer for Chinese? I have a 1-1 multilingual website that uses Vorto. So the same node has English and Chinese content which means we can't change the analyzer.

    Jeroen

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Jun 27, 2016 @ 10:50
    Jeroen Breuer
    0

    I could index the same content twice in different indexes with different analyzers, but it isn't ideal. Any other solutions?

    Jeroen

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Jun 27, 2016 @ 11:01
    Jeroen Breuer
    0

    We're building a faceted search based on this 24 days blogpost: http://24days.in/umbraco/2014/search-with-bobo/

    In there a QueryParser is used and there you can pass the analyzer as a querystring. So I can use 1 index and change the analyzer in the code.

    Jeroen

  • Ravi Motha 290 posts 500 karma points MVP 7x c-trib
    Jun 27, 2016 @ 14:29
    Ravi Motha
    0

    I think you may find it easier/better to have 2 index one for chinese and one for the others obviously that's a bit nastier for maintenence.

    i think with fuzzy searches because of the way chinese is written it is hard for the pattern matching to work correctly.. Ravi

Please Sign in or register to post replies

Write your reply to:

Draft