<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    小魚的空氣

    記錄我所思

    2007年4月27日

    Nutch 0.9筆記

          一直留意Lucene,Nutch的進展,最近這兩個項目都發展得非??欤琇ucne已發展到 2.1,Nutch已發展到 0.9,改進了很多,令人欣喜。
          今天小試了一下Nutch-0.9,筆記如下:
          
    1、解壓Nutch包,在Nutch根目錄下建目錄urls,里面建一些包含URL的文本如urlt.txt,一行一個URL,內容如:http://m.tkk7.com
    http://www.javaeye.com/


    2、修改conf目錄下的crawl-urlfilter.txt,片斷如下:
    # accept hosts in MY.DOMAIN.NAME
    # +^http://([a-z0-9]*\.)*MY.DOMAIN.NAME/
    +^http://m.tkk7.com/
    +^http://www.javaeye.com/
    +^http://lucene.apache.org/

    3、修改conf目錄下的nutch-site.xml,內容如下:
    <?xml version="1.0"?>
    <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

    <!-- Put site-specific property overrides in this file. -->

    <configuration>

        
    <property>
          
    <name>http.agent.name</name>
          
    <value>Nutch</value>
          
    <description>HTTP 'User-Agent' request header. MUST NOT be empty - 
          please set this to a single word uniquely related to your organization.

          NOTE: You should also check other related properties:

            http.robots.agents
            http.agent.description
            http.agent.url
            http.agent.email
            http.agent.version

          and set their values appropriately.

          
    </description>
        
    </property>

        
    <property>
          
    <name>http.robots.agents</name>
          
    <value>Nutch,*</value>
          
    <description>The agent strings we'll look for in robots.txt files,
          comma-separated, in decreasing order of precedence. You should
          put the value of http.agent.name as the first agent name, and keep the
          default * at the end of the list. E.g.: BlurflDev,Blurfl,*
          
    </description>
        
    </property>

        
    <property>
          
    <name>http.agent.description</name>
          
    <value>Nutch Search Engineer</value>
          
    <description>Further description of our bot- this text is used in
          the User-Agent header.  It appears in parenthesis after the agent name.
          
    </description>
        
    </property>

        
    <property>
          
    <name>http.agent.url</name>
          
    <value>http://lucene.apache.org/nutch/bot.html</value>
          
    <description>A URL to advertise in the User-Agent header.  This will 
           appear in parenthesis after the agent name. Custom dictates that this
           should be a URL of a page explaining the purpose and behavior of this
           crawler.
          
    </description>
        
    </property>

        
    <property>
          
    <name>http.agent.email</name>
          
    <value>nutch-agent@lucene.apache.org</value>
          
    <description>An email address to advertise in the HTTP 'From' request
           header and User-Agent header. A good practice is to mangle this
           address (e.g. 'info at example dot com') to avoid spamming.
          
    </description>
        
    </property>

    </configuration>

    注意:在nutch-0.9.jar里面已包含nutch-site.xml,  conf目錄下的文件都復制過到classpath根下,如果是在WEB環境下運行classpath下的nutch-site.xml會優先加載,如果在在Application環境運行,應把如上nutch-site.xml打入到nutch-0.9.jar包里,否則,上面的一些屬性為空不能運行。


    4、在Windows下運行Nutch,很簡單,只要你能執行Crawl這個類就行,寫一個Ant腳本放在Nuthc的根目錄下執行它就OK,內容如下:
    <project name="nutch-crawl" default="crawl" basedir=".">
        
        
    <property name="lib.dir"  location="lib"/>
        
    <property name="conf.dir"  location="conf"/>
        

        
    <path id="project.classpath">
            
    <fileset dir="." includes="nutch-*.jar"/>
            
    <fileset dir="lib" />
            
    <pathelement path="."/>
            
    <pathelement path="${conf.dir}"/>
        
    </path>
        
        
        
    <target name="crawl" >
            
    <echo>crwaling starting</echo>
            
    <property name="JVM.extra.args" value="-Xmx512m" />
            
    <java classname="org.apache.nutch.crawl.Crawl" classpathref="project.classpath" fork="true">
                
    <jvmarg line="${JVM.extra.args}"/>
                
    <arg value="C:/dev-tools/nutch-0.9/urls"/>
                
    <arg value="-dir"/>
                
    <arg value="C:/dev-tools/nutch-0.9/crawl"/>
                
    <arg value="-depth"/>
                
    <arg value="3"/>
                
    <arg value="-threads"/>
                
    <arg value="15"/>
            
    </java>
            
    <echo>crwaling finished</echo>
        
    </target>
        
    </project>

    至此,如無意外,Nutch已經歡快地運行起來,最后在crawl目錄下你會發現你想要的東西,Enjoy it!

    posted @ 2007-04-27 11:09 小魚 閱讀(2092) | 評論 (0)編輯 收藏

    僅列出標題  
    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    導航

    統計

    常用鏈接

    留言簿(3)

    我參與的團隊

    隨筆檔案

    文章檔案

    搜索

    最新評論

    主站蜘蛛池模板: 免费黄色福利视频| 亚洲av日韩av欧v在线天堂| 亚洲人成77777在线播放网站不卡| 午夜毛片不卡高清免费| WWW免费视频在线观看播放| 亚洲欧洲国产经精品香蕉网| 国产大片免费观看中文字幕| 国产成人AV免费观看| 成人区精品一区二区不卡亚洲| 久久精品国产亚洲7777| 精品免费人成视频app| 全部在线播放免费毛片| 亚洲激情校园春色| 亚洲视频在线免费| 歪歪漫画在线观看官网免费阅读 | 精品视频免费在线| 亚洲ⅴ国产v天堂a无码二区| 日韩免费福利视频| 久久久久免费看成人影片| 黄色a三级免费看| 亚洲伊人色一综合网| 亚洲中文字幕无码专区| 免费看美女被靠到爽的视频| 免费国产黄网站在线观看可以下载| 日韩亚洲翔田千里在线| 亚洲天堂一区二区三区| 日本亚洲视频在线| 亚洲av午夜成人片精品电影| 四虎国产精品免费久久| 99精品视频在线观看免费播放| 成人免费网站视频www| 亚洲国产成人无码AV在线影院| 亚洲黄色免费网站| 亚洲夜夜欢A∨一区二区三区| 国产乱人免费视频| 国内精品免费视频自在线| 免费h片在线观看网址最新| 国产羞羞的视频在线观看免费| 免费的黄色的网站| 亚洲AV日韩综合一区| 亚洲一级黄色大片|