Solr Cookbook学习记录 - 第6,8,9章

来源:互联网 发布:cf网络异常的解决办法 编辑:程序博客网 时间:2024/06/06 12:44

第6章 改进solr的性能

1. Paging your results quickly,编辑solrconfig.xml:<queryResultWindowSize>160</queryResultWindowSize><queryResultMaxDocsCached>160</queryResultMaxDocsCached>2. 配置document缓存,编辑solrconfig.xml:<documentCache class="solr.LRUCache"   size="2560"    initialSize="2560"/>3. 配置query result缓存,编辑solrconfig.xml:<queryResultCache    class="solr.LRUCache"   size="16000"    initialSize="16000"   autowarmCount="4000"/>4. 配置filter缓存,编辑solrconfig.xml:<filterCache    class="solr.FastLRUCache"   size="2000"    initialSize="2000"    autowarmCount="1000"/>5. 。。。

第8章

1. 相似度查询/select?q=cookbook second&mm=2&qf=name&defType=edismax&mlt=true&mlt.fl=name&&mlt.mintf=1&mlt.mindf=12. 高亮显示/select?q=name:book&hl=true3. 高亮显示指定的字段/select?q=name:book&hl=true&hl.fl=name,description4. 改变高亮显示词两边的html标签/select?q=name:book&hl=true&hl.simple.pre=<b>&hl.simple.post=</b>5. 如何高亮显示长文本中的词<field name="name" type="text" indexed="true" stored="true"  termVectors="true" termPositions="true" termOffsets="true" />/select?q=name:book&hl=true&hl.useFastVectorHighlighter=true6. 计算统计搜索结果/select?q=name:book&stats=true&stats.field=price7. 检查用户的拼写错误/spell?q=name:(othar boak)配置solrconfig.xml:<searchComponent name="spellcheck" class="solr.SpellCheckComponent"><str name="queryAnalyzerFieldType">name</str><lst name="spellchecker"><str name="name">direct</str><str name="field">name</str><str name="classname">solr.DirectSolrSpellChecker</str><str name="buildOnCommit">true</str></lst></searchComponent><requestHandler name="/spell" class="solr.SearchHandler" startup="lazy">    <lst name="defaults">        <str name="df">name</str>        <str name="spellcheck.dictionary">direct</str>        <str name="spellcheck">on</str>        <str name="spellcheck.collate">true</str>    </lst>    <arr name="last-components">         <str>spellcheck</str>    </arr></requestHandler>8. Using field value to group results/select?q=*:*&group=true&group.field=category9. More than a single document in a group/select?q=*:*&group=true&group.field=category&group.limit=1010. Using queries to group results/select?q=*:*&group=true&group.query=price: [20.0 TO 50.0]&group.query=price:[1.0 TO 19.99]11. Using function queries to group results/select?q=*:*&group=true&group.func=geodist(geo,0.0,0.0)

第9章

1. How to deal with too many opened files异常:java.io.FileNotFoundException: /use/share/solr/data/index/_1.fdx (Too many open files)编辑/etc/security/limits.confsolr soft nofile 32000solr hard nofile 32000Now let's add the following line to the .bash_profile file in the solr user home  directory: ulimit -n 32000编辑solrconfig.xml<mergeFactor>2</mergeFactor>2. How to deal with out-of-memory problems异常:SEVERE: java.lang.OutOfMemoryError: Java heap spacejava –Xmx1024M –Xms512m –jar start.jarMonitoring heap when an out-of-memory error occursjava –jar –XX:+HeapDumpOnOutOfMemoryError –XX:HeapDumpPath=/var/log/dump/ start.jar3. 诊断solr的问题vmstat, dstat, and iostatjconsole and jvisualvm使用http://sematext.com/spm/index.html监测solr还可以使用:http://ganglia.sourceforge.net/http://munin-monitoring.org/http://www.zabbix.com/http://www.cacti.nethttp://newrelic.com/4. 查询某分类下的产品数量(以牛奶开头的产品)/select?q=*:*&rows=0&facet=true&facet.field=category&facet.mincount=1&facet.limit=5&facet.prefix=牛奶5. ???/select?q=*:*&defType=edismax&fq={!term f=category}Books And Tutorials6. 提交xml文档curl 'http://localhost:8983/solr/update' --data-binary @data.xml -H 'Content-type:application/xml'curl 'http://localhost:8983/solr/update?softCommit=true'7. solrconfig.xml中配置autoCommit<autoCommit>    <maxTime>60000</maxTime>    <openSearcher>false</openSearcher></autoCommit><autoSoftCommit>    <maxTime>1000</maxTime></autoSoftCommit>8. ???/select?q=solr book&defType=edismax&mm=1&qf=name^10000 description


0 0
原创粉丝点击