About Jive Forum Search culture support detailed!

Source: Internet
Author: User
Tags modify net pack tostring
Detailed explanation | Chinese
Jive's search borrowed the Lucene search engine provided by Apche. Lucene is a pure Java high-performance Full-text search engine, you can go to the Apache website to find more information about Lucene: http://jakarta.apache.org/lucene/docs/index.html

But in the jive use of the Lucene package, does not support Chinese search, the site's system is also built on the jive to expand, the Chinese search problem by the JR management system, one of the main developers Cherami solution. A lot of jive friends have sent us a letter asking for solutions to the Jive Chinese search problem, and I'm here to sort out our solutions and hope to help you. 1. Download the Lucene Chinese search Support pack to place the Lucene_cn.jar in your Lib directory.

2: Modify your Dbsearchmanager.java in Com.jivesoftware.forum.database.DbSearchManager.java, first import the Lucene Chinese pack:

Import org.apache.lucene.analysis.cn.*;

Find the following code in Dbsearchmanager.java:

/** * The analyzer governs how words are tokenized. The standard Anaylyzer * Does a decent job in most cases, but could is replaced under * certain. We make the analyzer protected so this dbquery class * can also reference it (indexing and searching should use th     E same * analyzer). * * Protected Static Analyzer Analyzer = new StandardAnalyzer ();

To be replaced by:

Protected Static Analyzer Analyzer = new Chineseanalyzer ();

3. Restart Jive, now your Jive support Chinese search.

4. Other issues

To use Chinese search, your search JSP page also needs to use GB2312 encoding: <%@ page contenttype= "text/html;" charset=gb2312 "%> in our implementation, we also encountered a problem. Is that when you search, if you use it directly on the search.jsp page, but if you jump to the search.jsp page from the search box on a different page, all the Chinese characters in the Search input box become "? "Up. This problem is related to the peace station, which causes a complex cause. My solution is to get a query string in search.jsp, you can refer to the use of:

Java.net.URLEncoder.encode (QueryText, "GB2312");

5: Finally summary: For Chinese search also need to modify two JSP pages: Search.jsp and post.jsp will include: Java.net.URLEncoder.encode (QueryText), Urlencoder.encode ( Url.tostring ()), Java.net.URLEncoder.encode (Postlink.tostring ()), Urlencoder.encode (name), Urlencoder.encode ( Email) is included in its encode (), "GBK" can make your JIVC forum fully support the search for culture.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.