Solution to the blank page displayed when integrating Chinese Word Segmentation search with nutch

Source: Internet
Author: User
Tags blank page

Recently I have been studying nutch. Based on the online tutorial, I used plug-ins to integrate Chinese word segmentation into nutch1.2 to run crawlers. However, after converting the project ant into a war, A page can be displayed when you search for words that are not indexed on a webpage. However, if you search for the words in an index, a blank page will appear and there will be nothing. The Tomcat console will display the search results, no error is reported. So I addedCodeRemoved, and the result showed that the original word segmentation of the nutch was replaced. Some tutorials on the Internet say that you want to modify the original word segmentation of the nutchdocumentanalyzer. Java to replace the original word segmentation of the nutch with your own word segmentation. The code is

Public nutchdocumentanalyzer (configuration conf ){
This. conf = conf;
Content_analyzer = new contentanalyzer (CONF );
Anchor_analyzer = new anchoranalyzer ();
// Paoding = paodingmaker. Make (); add your own word divider.
// Paoding_analyzer = new paodinganalyzer (). querymode (paoding );
}

 

Public tokenstream (string fieldname, reader ){
Analyzer analyzer;

If ("anchor". Equals (fieldname ))
Analyzer = anchor_analyzer;
Else
Analyzer = content_analyzer;

// Analyzer = paoding_analyzer;

Return analyzer. tokenstream (fieldname, Reader );
}

I commented out my Chinese Word divider.

If you change the word segmentation to the original one, there will be no blank pages. I don't know why, and I haven't studied the source code in depth. Another problem is that if you only use the word segmentation in the plug-in to do not replace the word segmentation of nutch, the word splitting result obtained when the crawler is executed is strange. Sometimes the whole sentence is separated.

 

2010-10-4

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.