??xml version="1.0" encoding="utf-8" standalone="yes"?>欧洲精品在线观看,色天使久久综合网天天,综合日韩avhttp://www.aygfsteel.com/xiaohuzi2008/category/53075.html面朝大vQ春暖花开zh-cnMon, 03 Dec 2012 10:33:19 GMTMon, 03 Dec 2012 10:33:19 GMT60【{】Solr ~存配置http://www.aygfsteel.com/xiaohuzi2008/archive/2012/12/03/392376.html胡?/dc:creator>胡?/author>Mon, 03 Dec 2012 08:54:00 GMThttp://www.aygfsteel.com/xiaohuzi2008/archive/2012/12/03/392376.htmlhttp://www.aygfsteel.com/xiaohuzi2008/comments/392376.htmlhttp://www.aygfsteel.com/xiaohuzi2008/archive/2012/12/03/392376.html#Feedback0http://www.aygfsteel.com/xiaohuzi2008/comments/commentRss/392376.htmlhttp://www.aygfsteel.com/xiaohuzi2008/services/trackbacks/392376.html
~存?Solr 中充当了一个非帔R要的角色QSolr 中主要有q三U缓存:
  • Filter cacheQ过滤器~存Q,用于保存qo器(fq 参数Q和层面搜烦的结?/li>
  • Document cacheQ文档缓存)Q用于保?lucene 文档存储的字D?/li>
  • Query resultQ查询缓存)Q用于保存查询的l果
q有W四U缓存,lucene 内部的缓存,不过该缓存外部无法控制到?br />
通过q?3 U缓存,可以?solr 的搜索实例进行调优。调整这些缓存,需要根据烦引库中文档的数量Q每ơ查询结果的条数{?br /> 在调整参数前Q需要事先得?solr CZ中的以下信息Q?br />
  • 索引中文档的数量
  • 每秒钟搜索的ơ数
  • qo器的数量
  • 一ơ查询返回最大的文档数量
  • 不同查询和不同排序的个数
q些数量可以?solr admin 面的日志模块找到。假设以上的值分别ؓQ?br />
  • 索引中文档的数量Q?000000
  • 每秒钟搜索的ơ数Q?00
  • qo器的数量Q?00
  • 一ơ查询返回最大的文档数量Q?00
  • 不同查询和不同排序的个数Q?00
然后可以开始修?solrconfig.xml 中缓存的配置了,W一个是qo器缓存:

<filterCache class="solr.FastLRUCache" size="200" initialSize="200"  autowarmCount="100"/>
W二个是查询l果~存Q?/div>
<queryResultCache class="solr.FastLRUCache" size="500" initialSize="500" autowarmCount="250"/>
W三个是文档~存Q?/div>
<documentCache class="solr.FastLRUCache" size="11000" initialSize="11000" />
q几个配|是Z以上的几个假讄D行调优的?/div>
原文Q?div>http://insolr.com/forum.php?mod=viewthread&tid=7&reltid=880&pre_thread_id=19&pre_pos=5&ext=


]]>【{】solr导入数据?/title><link>http://www.aygfsteel.com/xiaohuzi2008/archive/2012/12/03/392375.html</link><dc:creator>胡?/dc:creator><author>胡?/author><pubDate>Mon, 03 Dec 2012 08:51:00 GMT</pubDate><guid>http://www.aygfsteel.com/xiaohuzi2008/archive/2012/12/03/392375.html</guid><wfw:comment>http://www.aygfsteel.com/xiaohuzi2008/comments/392375.html</wfw:comment><comments>http://www.aygfsteel.com/xiaohuzi2008/archive/2012/12/03/392375.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/xiaohuzi2008/comments/commentRss/392375.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/xiaohuzi2008/services/trackbacks/392375.html</trackback:ping><description><![CDATA[<div>一.首先准备好solr的dataimport功能需要的东西Q在solr的下载包中。分别在Q?<br /> 1》Solr-1.3.0\dist\apache-solr-dataimporthandler-1.3.0.jar <br /> 2》E:\education\search\Solr-1.3.0\example\example-DIH\solr\ <br /> 3》你是哪U数据库Q提供该数据库的jdbc驱动?<br /> <br /> ?如果你还不会q行solrQ请参考本人的前几博客。这里要做的是,先把E:\education\search\Solr-1.3.0 \example\example-DIH\solr\下面的东西拷贝到solr的HOME目录Q然后删除rssQ这个是另外一个功能是导入rss订阅?息到solr中,实很强Q这都想C。将jar文gQ实际就两个拯到tomcat的webapps下面的solr的WEB-INF的lib文g夹下 面?<br /> <br /> ?更改solr Home目录下的conf/solrconfig.xmlQ其实就是提交一个solrRequestHandler,代码如下Q?<ul type="1"><li><strong><requestHandler</strong> name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler"<strong>></strong>  </li><li>    <strong><lst</strong> name="defaults"<strong>></strong>  </li><li>      <strong><str</strong> name="config"<strong>></strong>C:\solr-tomcat\solr\db\conf\db-data-config.xml<strong></str></strong>  </li><li>    <strong></lst></strong>  </li><li>  <strong></requestHandler></strong>  <br /> </li></ul><br /> <requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">    <lst name="defaults">      <str name="config">C:\solr-tomcat\solr\db\conf\db-data-config.xml</str>    </lst>  </requestHandler><br /> <br /> ?solr Home目录下面的solrconfig.xml和schema.xml拯到db文g夹下面的conf中?<br /> <br /> ?修改db\conf\db-data-config.xml <ul type="1"><li><strong><dataConfig></strong>  </li><li>        <strong><dataSource</strong> type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/tuitui" user="root" password="mysql"<strong>/></strong>  </li><li>    <strong><document</strong> name="shop"<strong>></strong>  </li><li>            <strong><entity</strong> name="tuitui_shop" pk="shopId" query="select * from tuitui_shop"<strong>></strong>  </li><li>            <strong><field</strong> column="shopid" name="shopId" <strong>/></strong>  </li><li>            <strong><field</strong> column="shopName" name="shopName" <strong>/></strong>  </li><li>            <strong><field</strong> column="shopUrl" name="shopUrl" <strong>/></strong>  </li><li>            <strong><field</strong> column="keyword" name="keyword" <strong>/></strong>  </li><li>            <strong><field</strong> column="synopsis" name="synopsis" <strong>/></strong>  </li><li>            <strong><field</strong> column="province" name="province" <strong>/></strong>  </li><li>            <strong><field</strong> column="city" name="city" <strong>/></strong>  </li><li>            <strong><field</strong> column="domain" name="domain" <strong>/></strong>  </li><li>            <strong><field</strong> column="address" name="address" <strong>/></strong>  </li><li>            <strong><field</strong> column="coordinate" name="coordinate" <strong>/></strong>  </li><li>            <strong><field</strong> column="shopSspn" name="shopSspn" <strong>/></strong>  </li><li>            <strong><field</strong> column="phone" name="phone" <strong>/></strong>  </li><li>            <strong><field</strong> column="createTime" name="createTime" <strong>/></strong>  </li><li>        <strong></entity></strong>  </li><li>    <strong></document></strong>  </li><li><strong></dataConfig></strong>  <br /> </li></ul><br /> <dataConfig>                <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/tuitui" user="root" password="mysql"/>    <document name="shop">            <entity name="tuitui_shop" pk="shopId" query="select * from tuitui_shop">            <field column="shopid" name="shopId" />            <field column="shopName" name="shopName" />            <field column="shopUrl" name="shopUrl" />            <field column="keyword" name="keyword" />            <field column="synopsis" name="synopsis" />            <field column="province" name="province" />            <field column="city" name="city" />            <field column="domain" name="domain" />            <field column="address" name="address" />            <field column="coordinate" name="coordinate" />            <field column="shopSspn" name="shopSspn" />            <field column="phone" name="phone" />            <field column="createTime" name="createTime" />        </entity>    </document></dataConfig><br /> <br /> 其中的意思我做简单解释,具体大家可以ȝ看官方wiki?<br /> documentQ一个文档也是lucene的documentq个没什么解释的Q?<br /> entityQ主要针对的是一个数据库表; <br /> filedQ属性column是数据库的字D,name是filed的名字,即schema中的field name <br /> <a target="_blank">http://wiki.apache.org/solr/DataImportHandler</a> <br /> <br /> ?启动TOMCATQ输入地址q行导入Q导入分为很多模式:我选用的全部倒入模式?<br /> <br /> http://localhost/solr/dataimport?command=full-import </div>原文Q?div>http://insolr.com/forum.php?mod=viewthread&tid=128&reltid=880&pre_thread_id=19&pre_pos=4&ext=</div><img src ="http://www.aygfsteel.com/xiaohuzi2008/aggbug/392375.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/xiaohuzi2008/" target="_blank">胡?/a> 2012-12-03 16:51 <a href="http://www.aygfsteel.com/xiaohuzi2008/archive/2012/12/03/392375.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【{】solr与tomcat 集成http://www.aygfsteel.com/xiaohuzi2008/archive/2012/12/03/392374.html胡?/dc:creator>胡?/author>Mon, 03 Dec 2012 08:50:00 GMThttp://www.aygfsteel.com/xiaohuzi2008/archive/2012/12/03/392374.htmlhttp://www.aygfsteel.com/xiaohuzi2008/comments/392374.htmlhttp://www.aygfsteel.com/xiaohuzi2008/archive/2012/12/03/392374.html#Feedback0http://www.aygfsteel.com/xiaohuzi2008/comments/commentRss/392374.htmlhttp://www.aygfsteel.com/xiaohuzi2008/services/trackbacks/392374.html先从|址
http://labs.mop.com/apache-mirror/lucene/solr/3.6.1/apache-solr-3.6.1.zip 下蝲E序文g

1.解压开扑ֈapache-solr-3.6.1\apache-solr-3.6.1\dist目录下的apache-solr-3.6.1.war
直接攑ֈtomcat/webapps下面

2.先别急着启动慢慢?修改配置文gapache-solr-3.6.1\WEB-INF\web.xml
扑ֈ:
  <!-- People who want to hardcode their "Solr Home" directly into the
       WAR File can set the JNDI property here...
   -->
  <!--
    <env-entry>
       <env-entry-name>solr/home</env-entry-name>
       <env-entry-value>/put/your/solr/home/here</env-entry-value>
       <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>
   -->
更改qؓ
  <!-- People who want to hardcode their "Solr Home" directly into the
       WAR File can set the JNDI property here...
   -->
    <env-entry>
       <env-entry-name>solr/home</env-entry-name>
       <env-entry-value>d:/solr_work/solr</env-entry-value>
       <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>
  ?U色字体的文件夹为apache-solr-3.6.1\example\solr 该应用(此ؓ单核应用,多核以后会讲刎ͼ攑֤D盘的新徏I目录solr_work目录下就可以


3.启动tomcat,输入http://localhost:8080/solr  solr应用搭徏成功
原文Q?div>http://insolr.com/forum.php?mod=viewthread&tid=3&reltid=880&pre_thread_id=19&pre_pos=6&ext=

]]>
【{】Solr 4.0部vhttp://www.aygfsteel.com/xiaohuzi2008/archive/2012/12/03/392373.html胡?/dc:creator>胡?/author>Mon, 03 Dec 2012 08:48:00 GMThttp://www.aygfsteel.com/xiaohuzi2008/archive/2012/12/03/392373.htmlhttp://www.aygfsteel.com/xiaohuzi2008/comments/392373.htmlhttp://www.aygfsteel.com/xiaohuzi2008/archive/2012/12/03/392373.html#Feedback0http://www.aygfsteel.com/xiaohuzi2008/comments/commentRss/392373.htmlhttp://www.aygfsteel.com/xiaohuzi2008/services/trackbacks/392373.html 本文只是Solr 4.0的基教程Q本Zl常写东西,写的不好误谅,Ƣ迎到群233413850q行讨论学习?br />       先说一炚w|之后肯定会有h用solrjQsolr 4.0好像d了不东西,其中CommonsHttpSolrServerq个cL

名ؓHttpSolrServerQ我是找了半天才发现Q大家以后可以注意?/p>

     部v前准?


Solr 4.0 目录:

        

        q里是我的部|方式,Tomcat安装好之后把apache-solr-4.0.0\example\webapps下的solr.war文g拯到Tomcat下的

Tomcat7.0\webapps目录下,然后启动Tomcat 报错不用,solr.war会自动解压,之后打开Tomcat7.0\webapps\solr\WEB-

INF\web.xmlQ把下面代码复制q去攑ֈ后面Q?/p>

  1. <env-entry>   
  2.       <env-entry-name>solr/home</env-entry-name>   
  3.       <env-entry-value>E:\SolrHome</env-entry-value>   
  4.       <env-entry-type>java.lang.String</env-entry-type>
  5.     </env-entry>
复制代码

            其中  E:\SolrHome  是存放solr配置文g{,修改己文件的位置Qؓ了看着更清晰直观,你可以这h:


            E:\Tomcat7.0


            E:\apache-solr-4.0.0


            E:\SolrHome


            现在可以重新启动Tomcat了,没有报错Q通过q个地址q入Solr4.0面:http://localhost:8080/solr

        

            如果q入以上界面说明成功了,没有成功的话面会有ERROR提示?/p>

            如图Q左侧core0,core1{是solr 4.0中的CZQcore0和core1位于apache-solr-4.0.0\example\multicore所有文仉下拷?/p>

到E:\SoleHome下,core0和core1可以理解Z个库Q都是独立的Q用来存攄引以及生成这些烦引文件所需要的配置文gQsolrtest是我试建立的目录,如图Q?/p>

        没添加一个库都需要在solr.xml里面q行配置Q这个比较简?/p>

  1. <solr persistent="false">  
  2.            <cores adminPath="/admin/cores" host="${host:}" hostPort="${jetty.port:}">   
  3.                  <core name="core0" instanceDir="core0" />   
  4.                  <core name="core1" instanceDir="core1" />   
  5.                  <core name="collection1" instanceDir="collection1" />   
  6.                  <core name="solrtest" instanceDir="solrtest"/>
  7.           </cores>
  8.    </solr>
复制代码
name=""Q是库的名字QinstanceDir=""Q是目录

        每个目录下包含两个文件夹conf和dataQdata下有两个文g夹index和tlogQindex是存攄成的索引文gQtlog存放logQ?/p>

conf下是必要的配|文件schema.xml和solrconfig.xmlQ可以参考官Ҏ者core里面的配|文Ӟ

  1. <?xml version="1.0" ?>
  2. <schema name="example solr test" version="1.1">
  3.   <types>
  4.    <fieldtype name="string"  class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
  5.    <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
  6.   </types>

  7. <fields>   
  8.   <!-- general -->
  9.   <field name="id" type="string" indexed="true" stored="true" multiValued="false" required="true"/>
  10.   <field name="type" type="string" indexed="true" stored="true" multiValued="false" />
  11.   <field name="name" type="string" indexed="true" stored="true" multiValued="false" />
  12.   <field name="_version_" type="long" indexed="true" stored="true"/>
  13. </fields>

  14. <!-- field to use to determine and enforce document uniqueness. -->
  15. <uniqueKey>id</uniqueKey>

  16. <!-- field for the QueryParser to use when an explicit fieldname is absent -->
  17. <defaultSearchField>name</defaultSearchField>

  18. <!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
  19. <solrQueryParser defaultOperator="OR"/>
  20. </schema>
复制代码

        solrconfig.xml我还不是很懂Q在q里׃讲了Q但是必配|(好像是必配Q:

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!-- 可以从core文g中copyq来 -->
  3. <config>
  4.   <luceneMatchVersion>LUCENE_40</luceneMatchVersion>
  5.   
  6.   <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>

  7.   <dataDir>${solr.solrtest.data.dir:}</dataDir>   q里solr.后面名字Ҏ

  8.   <updateHandler class="solr.DirectUpdateHandler2">
  9.     <updateLog>
  10.       <str name="dir">${solr.solrtest.data.dir:}</str>
  11.     </updateLog>
  12.   </updateHandler>

  13.   <requestHandler name="/get" class="solr.RealTimeGetHandler">
  14.     <lst name="defaults">
  15.       <str name="omitHeader">true</str>
  16.     </lst>
  17.   </requestHandler>
  18.   
  19.   <requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy" />

  20.   <requestDispatcher handleSelect="true" >
  21.     <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
  22.   </requestDispatcher>
  23.   
  24.   <requestHandler name="standard" class="solr.StandardRequestHandler" default="true" />
  25.   <requestHandler name="/analysis/field" startup="lazy" class="solr.FieldAnalysisRequestHandler" />
  26.   <requestHandler name="/update" class="solr.UpdateRequestHandler"  />
  27.   <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />

  28.   <requestHandler name="/admin/ping" class="solr.PingRequestHandler">
  29.     <lst name="invariants">
  30.       <str name="q">solrpingquery</str>
  31.     </lst>
  32.     <lst name="defaults">
  33.       <str name="echoParams">all</str>
  34.     </lst>
  35.   </requestHandler>

  36.   <!-- config for the admin interface -->
  37.   <admin>
  38.     <defaultQuery>solr</defaultQuery>
  39.   </admin>

  40. </config>
复制代码

        之后在exampledocs目录下手动创Z个solr1.xml文gQ?/p>

  1. <?xml version="1.0" ?>
  2. <add>
  3.   <doc>
  4.     <field name="id">solr1</field>
  5.     <field name="type">type1</field>
  6.     <field name="name">my solr test</field>
  7.   </doc>
  8. </add>
复制代码

         跟schema.xml中的字段对应Q好了现在可以提交数据了Q这里在window命oH口提交数据Q把E:\apache-solr-

4.0.0\example\exampledocs下的post.jar复制?E:\SolrHome\exampledocs?/p>

        打开命oH口CD 到E:\SolrHome\exampledocs下用命令,Tomcat不要忘了开Q?/p>

java -Durl=http://localhost:8080/solr/solrtest/update -Ddata=files -jar post.jar solr1.xml






如图成功的添加的索引Q看下E:\SolrHome\solrtest\data\index下的文gQ?/p>


        q入solr面Q?br />

        

        点击Executu Query查询Q右侧生成了地址可以打开查看Q到此结束?/p>

原文地址Q?a target="_blank">http://insolr.com/forum.php?mod=viewthread&tid=880&page=1&extra=#pid969


]]>
վ֩ģ壺 н| ׿| Ͽ| | ˴| | | | | ¦| | ̨| | ʡ| | | | ɽ| ϴ| Դ| | | | | ߰| °| | | ɽ| | | ¦| ³ľ| ׶| | | ¡| ƽ| | ˳| |