nutch2.2.1用solr4.1建立索引

1、首先下载jetty8.1,用于昨晚solr的容器。

2、然后下载solr4.1

 1)ant ivy-bootstrap 这是安装ivy。

   2)运行ant compile

 3)进入solr的子目录solr 运行ant dist。编译成功后,会在solr下面生成solr-4.1-SNAPSHOT.war,改名为solr.war后复制到jetty/webapps里面。修改jetty/etc/jetty.xml port由8080变成8983。将solr4.1.0/example/contexts/solr.xml 放到jetty下面contexts目录里。在jetty目录下创建solr 目录。将solr4.1.0/example/solr目录的下的内容复制到jetty/solr目录下。然后将编译好的nutch下面的 untimelocalconf目录下的schema-solr4.xml,重新命名为schema.xml,增加<field name=”_version_” type=”long” stored=”true” indexed=”true” multiValued=”false”/>。然后在jetty中运行命令java -jar start.jar,即可启动jetty,成功即可看到如下界面:

  4)运行./nutch crawl urls -depth 2 -topN 2 -solr http://localhost:8983/solr/。即可将nutch的结果发送给solr,在solr中检索的界面如下所示:

原文地址:https://www.cnblogs.com/fengjiaoan/p/3376337.html