`
guohf
  • 浏览: 414803 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

solrconfig.xml 解说

    博客分类:
  • Solr
阅读更多

solrconfig .xml 文件包含了大部分的参数用来配置Solr本身的。

  1. dataDir parameter:<dataDir>/var/data/solr</dataDir>    
  2. 用来指定一个替换原先在Solr目录下默认存放所有的索引数据,可以在Solr目录以外的任意目录中。如果复制使用后应该符合该参数。如果这个目录不是绝对路径的话,那么应该以当前的容器为相对路径。    
  3. mainIndex :    
  4. 这个参数的值用来控制合并多个索引段。    
  5. <useCompoundFile>:通过将很多 Lucene 内部文件整合到单一一个文件来减少使用中的文件的数量。这可有助于减少 Solr 使用的文件句柄数目,代价是降低了性能。除非是应用程序用完了文件句柄,否则 false 的默认值应该就已经足够。    
  6. mergeFactor:    
  7. 决定低水平的 Lucene 段被合并的频率。较小的值(最小为  2 )使用的内存较少但导致的索引时间也更慢。较大的值可使索引时间变快但会牺牲较多的内存。    
  8. maxBufferedDocs:    
  9. 在合并内存中文档和创建新段之前,定义所需索引的最小文档数。段 是用来存储索引信息的 Lucene 文件。较大的值可使索引时间变快但会牺牲较多的内存。    
  10. maxMergeDocs:    
  11. 控制可由 Solr , 000 ) 最适合于具有合并的 Document 的最大数。较小的值 (<  10 大量更新的应用程序。该参数不允许lucene在任何索引段里包含比这个值更多的文档,但是,多余的文档可以创建一个新的索引段进行替换。    
  12. maxFieldLength:    
  13. 对于给定的 Document,控制可添加到 Field 的最大条目数,进而截断该文档。如果文档可能会很大,就需要增加这个数值。然而,若将这个值设置得过高会导致内存不足错误。    
  14. unlockOnStartup:    
  15. unlockOnStartup 告知 Solr 忽略在多线程环境中用来保护索引的锁定机制。在某些情况下,索引可能会由于不正确的关机或其他错误而一直处于锁定,这就妨碍了添加和更新。将其设置为 true 可以禁用启动锁定,进而允许进行添加和更新。    
  16. <mainIndex>    
  17.     <!-- lucene options specific to the main on-disk lucene index -->    
  18.     <useCompoundFile>false</useCompoundFile>    
  19.     <mergeFactor> 10 </mergeFactor>    
  20.     <maxBufferedDocs> 1000 </maxBufferedDocs>    
  21.     <maxMergeDocs> 2147483647 </maxMergeDocs>    
  22.     <maxFieldLength> 10000 </maxFieldLength>    
  23.   </mainIndex>    
  24.   
  25. updateHandler:    
  26. 这个更新处理器主要涉及底层的关于如何更新处理内部的信息。(此参数不能跟高层次的配置参数Request Handlers对处理发自客户端的更新相混淆)。    
  27. <updateHandler class= "solr.DirectUpdateHandler2" >    
  28.   
  29.     <!-- Limit the number of deletions Solr will buffer during doc updating.    
  30.            
  31.         Setting this lower can help bound memory use during indexing.    
  32.     -->    
  33. 缓冲更新这么多的数目,设置如下比较低的值,可以约束索引时候所用的内存    
  34.     <maxPendingDeletes> 100000 </maxPendingDeletes>    
  35. 等待文档满足一定的标准后将自动提交,未来版本可以扩展现有的标准    
  36.     <!-- autocommit pending docs if certain criteria are met.  Future versions may expand the available    
  37.      criteria -->    
  38.     <autoCommit>     
  39.       <maxDocs> 10000 </maxDocs> <!-- maximum uncommited docs before autocommit triggered -->    
  40. 触发自动提交前最多可以等待提交的文档数量    
  41.       <maxTime> 86000 </maxTime> <!-- maximum time (in MS) after adding a doc before an autocommit is triggered -->    
  42. 在添加了一个文档之后,触发自动提交之前所最大的等待时间    
  43.     </autoCommit>    
  44.   
  45. 这个参数用来配置执行外部的命令。    
  46. 一个postCommit的事件被触发当每一个提交之后    
  47. <listener event= "postCommit"  class= "solr.RunExecutableListener" >    
  48.       <str name= "exe" >snapshooter</str>    
  49.       <str name= "dir" >solr/bin</str>    
  50.       <bool name= "wait" >true</bool>    
  51.       <!--    
  52.       <arr name= "args" > <str>arg1</str> <str>arg2</str> </arr>    
  53.       <arr name= "env" > <str>MYVAR=val1</str> </arr>    
  54.         -->    
  55.     </listener>    
  56. exe--可执行的文件类型    
  57. dir--可以用该目录做为当前的工作目录。默认为 "."     
  58. wait--调用线程要等到可执行的返回值    
  59. args--传递给程序的参数 默认nothing    
  60. env--环境变量的设置 默认nothing    
  61.   
  62. <query>    
  63.     <!-- Maximum number of clauses in a boolean query... can affect range    
  64.          or wildcard queries that expand to big boolean queries.     
  65. 一次布尔查询的最大数量,可以影响查询的范围或者进行通配符的查询,借此来扩展一个更强大的查询。    
  66.          An exception is thrown if exceeded.    
  67.     -->    
  68.     <maxBooleanClauses> 1024 </maxBooleanClauses>    
  69.   
  70. <query>:    
  71. 控制跟查询相关的一切东东。    
  72.   
  73. Caching:修改这个参数可以做为索引的增长和变化。    
  74.   
  75. <!-- Cache used by SolrIndexSearcher for filters (DocSets),    
  76.          unordered sets of *all* documents that match a query.    
  77. 在过滤器中过滤文档集合的时候,或者是一个无序的所有的文档集合中将在在SolrIndexSearcher中使用缓存来匹配符合查询的所有文档。    
  78.          When a new searcher is opened, its caches may be prepopulated    
  79.          or  "autowarmed"  using data from caches in the old searcher.    
  80. 当一次搜索被打开,它可以自动的或者预先从旧的搜索中使用缓存数据。    
  81.          autowarmCount is the number of items to prepopulate.    
  82. autowarmCount这个值是预先设置的数值项。    
  83.   For LRUCache,    
  84.          the autowarmed items will be the most recently accessed items.    
  85. 在LRUCache中,这个autowarmed 项中保存的是最近访问的项。    
  86.        Parameters: 参数选项    
  87.          class - the SolrCache implementation (currently only LRUCache)实现SolrCache接口的类 当前仅有LRUCache    
  88.                
  89.          size - the maximum number of entries in the cache    
  90. 在cache中最大的上限值    
  91.          initialSize - the initial capacity (number of entries) of    
  92.            the cache.  (seel java.util.HashMap)    
  93. 在cache中初始化的数量    
  94.          autowarmCount - the number of entries to prepopulate from    
  95.            and old cache.    
  96. 从旧的缓存中预先设置的项数。    
  97.          -->    
  98.     <filterCache    
  99.       class= "solr.LRUCache"     
  100.       size= "512"     
  101.       initialSize= "512"     
  102.       autowarmCount= "256" />    
  103.   
  104.    <!-- queryResultCache caches results of searches - ordered lists of    
  105.          document ids (DocList) based on a query, a sort, and the range    
  106.          of documents requested.  -->    
  107. 查询结果缓存    
  108.     <queryResultCache    
  109.       class= "solr.LRUCache"     
  110.       size= "512"     
  111.       initialSize= "512"     
  112.       autowarmCount= "256" />    
  113.   
  114.   <!-- documentCache caches Lucene Document objects (the stored fields for each document).    
  115. documentCache缓存Lucene的文档对象(存储领域的每一个文件)    
  116.        Since Lucene internal document ids are transient, this cache will not be autowarmed.  -->    
  117. 由于Lucene的内部文档ID标识(文档名称)是短暂的,所以这种缓存不会被自动warmed。    
  118.     <documentCache    
  119.       class= "solr.LRUCache"     
  120.       size= "512"     
  121.       initialSize= "512"     
  122.       autowarmCount= "0" />    
  123.   
  124.     <!-- Example of a generic cache.     
  125. 一个通用缓存的列子。    
  126. These caches may be accessed by name    
  127.          through SolrIndexSearcher.getCache().cacheLookup(), and cacheInsert().    
  128. 这些缓存可以通过在SolrIndexSearcher.getCache().cacheLookup()和cacheInsert()中利用缓存名称访问得到。    
  129.          The purpose is to enable easy caching of user/application level data.    
  130. 这样做的目的就是很方便的缓存用户级或应用程序级的数据。    
  131.          The regenerator argument should be specified as an implementation    
  132.          of solr.search.CacheRegenerator if autowarming is desired.  -->    
  133. 这么做的的关键就是应该明确规定实现solr.search.CacheRegenerator接口如果autowarming是比较理想化的设置。    
  134.     <!--    
  135.     <cache name= "myUserCache"     
  136.       class= "solr.LRUCache"     
  137.       size= "4096"     
  138.       initialSize= "1024"     
  139.       autowarmCount= "1024"     
  140.       regenerator= "org.mycompany.mypackage.MyRegenerator"     
  141.       />    
  142.     -->    
  143.   
  144.     <!-- An optimization that attempts to use a filter to satisfy a search.    
  145. 一种优化方式就是利用一个过滤器,以满足搜索需求。    
  146.          If the requested sort does not include a score,    
  147. 如果请求的不是要求包括得分的类型,filterCache 这种过滤器将检查与过滤器相匹配的结果。如果找到,过滤器将被用来作为文档的来源识别码,并在这个基础上进行排序。    
  148. then the filterCache    
  149.          will be checked for a filter matching the query.  If found, the filter    
  150.          will be used as the source of document ids, and then the sort will be    
  151.          applied to that.    
  152.       -->    
  153.     <useFilterForSortedQuery>true</useFilterForSortedQuery>    
  154.   
  155.     <!-- An optimization for use with the queryResultCache.  When a search    
  156.          is requested, a superset of the requested number of document ids    
  157.          are collected.  For example, of a search for a particular query    
  158.          requests matching documents  10  through  19 , and queryWindowSize is  50 ,    
  159.          then documents  0  through  50  will be collected and cached. Any further    
  160.          requests in that range can be satisfied via the cache.    
  161.     -->    
  162.   
  163. 一种优化用于queryResultCache,当一个搜索被请求,也会收集一定数量的文档ID做为一个超集。举个例子,一个特定的查询请求匹配的文档是 10 19 ,此时,queryWindowSize是 50 ,这样,文档从 0 50 都会被收集并缓存。这样,任何更多的在这个范围内的请求都会通过缓存来满足查询。    
  164.     <queryResultWindowSize> 50 </queryResultWindowSize>    
  165.   
  166.     <!-- This entry enables an int hash representation for filters (DocSets)    
  167.          when the number of items in the set is less than maxSize. For smaller    
  168.          sets, this representation is more memory efficient, more efficient to    
  169.          iterate over, and faster to take intersections.    
  170.      -->    
  171.     <HashDocSet maxSize= "3000"  loadFactor= "0.75" />    
  172.   
  173.   
  174.     <!-- boolToFilterOptimizer converts boolean clauses with zero boost    
  175.          cached filters if the number of docs selected by the clause exceeds the    
  176.          threshold (represented as a fraction of the total index)    
  177.     -->    
  178.     <boolTofilterOptimizer enabled= "true"  cacheSize= "32"  threshold= ".05" />    
  179.   
  180.     <!-- Lazy field loading will attempt to read only parts of documents on disk that are    
  181.          requested.  Enabling should be faster if you aren't retrieving all stored fields.    
  182.     -->    
  183.     <enableLazyFieldLoading>false</enableLazyFieldLoading>
分享到:
评论

相关推荐

    solrconfig.xml和schema.xml说明

    ### Solrconfig.xml 和 Schema.xml 说明 #### Solrconfig.xml 概述 Solrconfig.xml 是 Apache Solr 的核心配置文件之一,主要用于定义 Solr 实例如何处理文档的索引与查询请求。该文件中包含了多种配置项,用于...

    解决solr启动404问题

    Solr的核心配置文件是`solrconfig.xml`和`schema.xml`,它们定义了索引的结构和处理查询的方式。 当你遇到404错误,首先检查Solr是否成功启动。查看日志文件(通常是`logs/solr.log`)以获取更详细的错误信息。如果...

    solr schema solrconfig 配置文件解析

    Solr,作为一款开源的全文搜索引擎,其核心配置文件包括`schema.xml`和`solrconfig.xml`,它们是Solr工作方式的基础。在深入理解这两个文件之前,我们需要先了解Solr的基本架构。 **1. Solr架构简介** Solr采用...

    solr使用指南1

    在 Solr 中,需要配置分词功能,例如使用 smartcn 分词器,需要在 solrconfig.xml 文件中添加相应的配置。然后,需要在 schema.xml 文件中添加分词器的配置。这样,Solr 就可以对中文文本进行分词和索引。 Solr 的...

    wpsolr配置文件

    本文将深入探讨两个关键的配置文件——`schema.xml`和`solrconfig.xml`,它们对于WPSOLR的正确配置和高效运行至关重要。 ### 1. `schema.xml` 文件 `schema.xml`是Apache Solr的核心配置文件之一,它定义了索引的...

    solr 学习笔记

    在主服务器的 `solrconfig.xml` 中添加相关配置,如 `replicateAfter` 设置在提交或启动后进行复制,`confFiles` 指定需要同步的配置文件。 从服务器的配置中,也需要添加 ReplicationHandler,但其配置稍有不同,...

    solr4的IK中文分词器IKAnalyzer2012FF_u1.jar和相关xml文件

    这通常涉及到添加库依赖、配置solrconfig.xml和schema.xml,以及可能的系统环境设置。 中文分词是自然语言处理的重要步骤,对于搜索引擎来说尤其关键,因为它直接影响到搜索结果的相关性和检索效率。IK Analyzer...

    solr 5.4.0 完整包,包含ikanalyzer 中文分词器

    "索引目录指向地址" 是指 Solr 存储索引文件的位置,这通常是在 `solrconfig.xml` 或 `web.xml` 中配置。你需要确保该路径指向你的数据目录,以便 Solr 可以正确地读取和写入索引。 安装 Solr 5.4.0 的步骤大致如下...

    solr全文检索

    `solrconfig.xml`则包含Solr服务器的行为配置,如请求处理器、查询解析器、更新处理器链等。这两份文件的配置对于Solr的正确运作至关重要,也是优化性能的关键。 在"配置说明"文件中,你会了解到如何调整这些配置以...

    Apache Solr Reference Guide 6.0.pdf

    solrconfig.xml包含服务器实例的配置信息,比如DataDir、DirectoryFactory、Lib Directives、Schema Factory等。solr.xml用于定义solr core,包括每个core的名称和配置信息。solrconfig.xml中还定义了IndexConfig、...

    跟益达学Solr5之增量索引MySQL数据库表数据

    1. **安装和配置Solr**: 首先,我们需要下载并安装Solr 5,然后根据项目需求配置solrconfig.xml和schema.xml文件。solrconfig.xml定义了索引和查询的行为,而schema.xml则定义了字段类型和字段。 2. **连接MySQL...

    搜索引擎开发现实文档(solr)

    solrconfig.xml文件中包括lib、dataDir、indexConfig、directoryFactory、requestHandler等配置项。schema.xml文件中包括Field、Field类型、分词器等配置项。 Solr数据操作 Solr支持数据导入、索引构建、搜索等操作...

    solr 3.5 msg整合可直接使用

    创建一个新的核心,定义其目录结构、schema.xml(定义字段和类型)和solrconfig.xml(配置索引和查询行为)。 4. **部署到Tomcat**:将解压后的Solr 3.5的web应用程序目录复制到Tomcat的webapps目录下,通常命名为`...

    solr-redis:Solr Redis扩展

    Solr Redis扩展该扩展是一个ParserPlugin,它基于Redis中存储的数据提供Solr查询... 将以下内容添加到solrconfig.xml的“ config”部分: &lt; queryParser xss=removed xss=removed&gt; &lt; str xss=removed&gt;localhost&lt;/

    ikanalyzer-solr6.zip

    配置`&lt;fieldType&gt;`标签,设置`class`为`solr.TextField`,并在`&lt;analyzer&gt;`部分引用之前在`solrconfig.xml`中定义的Analyzer。 4. **字段定义**:接着,为文档的各个字段指定使用这个新定义的字段类型,例如`...

    solr7.5手动倒mysql库需要用到的jar.zip 两个jar都在压缩包里

    2. **编辑solrconfig.xml**:在`solrconfig.xml`中添加DataImportHandler的配置,定义DataImportHandler的名称、数据源、请求处理器等信息。 3. **编写data-config.xml**:这是DIH的主要配置文件,定义了从数据库中...

    apache-tomcat-8.5.45_solr.zip

    以及`solrconfig.xml`和`schema.xml`(位于Solr的`conf`目录下),用于定义Solr的索引配置和字段类型。 Solr的配置文件`solrconfig.xml`定义了索引的创建、更新和查询行为。例如,你可以配置搜索请求处理器、缓存...

    solr笔记教案solr笔记教案

    - `conf`目录下的`solrconfig.xml`和`schema.xml`是最重要的配置文件,需要根据实际应用定制。 7. **配置SolrCore** - 修改`solrconfig.xml`可以配置索引更新策略、缓存机制、查询处理等。 - 修改`schema.xml`...

Global site tag (gtag.js) - Google Analytics