solr

solr的缓存机制及调优方法

元气小坏坏 提交于 2020-03-06 19:03:03
solr缓存大小的调整 1.缓存调的越大越好? 错误的 如果把内存大量的都给了solr那么操作系统的内存就会变小,操作系统可以利用空闲的内存提升io的效率,操作系统本身也有缓存 oscache,solr通过id来获取doc的时候如果可以命中oscache不发生磁盘的读写也会极大的提升速度; 大内存也可以是大垃圾,当大量内存不被命中的时候就是垃圾,而且这些垃圾会触发jvm的GC操作,GC的时候会降低整个系统的效率 查看缓存的命中情况 cumulative_hitratio: 是一个0〜1之间的数,代表请求命中缓存的百分比。 cumulative_inserts: 在缓存的整个生存期中,有多少缓存实体对象被加入的缓存当中。 cumulative_evictions: 在缓存的整个生存期中,有多少缓存实体对象从缓存中被移除。 最终衡量缓存性能的是命中率。你需要做实验调整缓存大小,但时刻要关注命中率,看命中率是不是越来越高。下面是调整缓存大小的一些提示: 如果发现cumulative_evictions比cumulative_inserts高一些,那么可以试着增加缓存大小,观察命中率,有可能是因为缓存实体被移除得太快了。 如果发现缓存的命中率很高,而且cumulative_evictions值很小,那么说明缓存大小设置有点大了。试着减少缓存大小,观察命中率,直到命中率有变化。

Solr的学习使用之(三)IKAnalyzer中文分词器的配置

倖福魔咒の 提交于 2020-03-06 06:10:42
1、为什么要配置? 1、我们知道要使用Solr进行搜索,肯定要对词语进行分词,但是由于 Solr的analysis包并没有带支持中文的包或者对中文的分词效果不好,需要自己添加中文分词器;目前呼声较高的是IKAnalyzer中文分词器,其他的还没有对比过,等以后有空了再说。 2、如何配置 1)、 下载IK Analyzer 2012FF_hf1.zip压缩包。下载网址: http://code.google.com/p/ik-analyzer/downloads/list 2)、解压压缩包,把IKAnalyzer2012FF_u1.jar拷贝到webapps\solr\WEB-INF\lib 3)、把解压包里面的 IKAnalyzer.cfg.xml 和 stopword.dic拷贝到webapps\solr\WEB-INF\classes目录(第一篇文章已经创建了该文件夹) 4)、 配置F:\JAVA\Solr\src\solr\collection1\conf(自己机子的具体目录) 目录中的 schema.xml 配置文件,    a)、<types></types>节点里配置以下内容(最好是在最后一行,比较有规则一些) <!-- IKAnalyzer 中文分词 --> <fieldType name="text_ik" class="solr.TextField">

Creating custom FunctionQuery in Solr

喜夏-厌秋 提交于 2020-03-05 01:30:56
问题 I want to create a custom Solr FunctionQuery so that I would be able to get the actual length of field (in terms). The results might look like this : { "responseHeader":{ "status":0, "QTime":8, "params":{ "q":"python", "indent":"on", "fl":"title,score,[features efi.query=python store=myfeature_store]", "wt":"json"}}, "response":{"numFound":793,"start":0,"maxScore":0.33828905,"docs":[ { "title":"Newest 'python' Questions - Stack Overflow", "score":0.33828905, "[features]":"titleLength=5"}, ] }

SOLR: Copy record from second field if 1st field is null or not available

别等时光非礼了梦想. 提交于 2020-03-04 21:33:56
问题 Followed by this question: SOLR: how to copy data to another field with filtered values? I have these types of values in solr "Price":"0.07 AUD" "Price":"10.00" "Price":"AUD" So, I copied the above records into another field as below "CustomPrice":0.07 "CustomPrice":10.00 "CustomPrice": 0.0 Now I have another field PriceSale , So If the Price is NULL I want to copy PriceSale into CustomPrice "PriceSale":"45.43 AUD", "PriceSale":"5.40 AUD", "PriceSale":"40.30 AUD", so if the "CustomPrice": 0.0

Solr系列五:solr搜索详解(solr搜索流程介绍、查询语法及解析器详解)

空扰寡人 提交于 2020-03-04 19:00:42
一、solr搜索流程介绍 1. 前面我们已经学习过Lucene搜索的流程,让我们再来回顾一下 流程说明: 首先获取用户输入的查询串,使用查询解析器QueryParser解析查询串生成查询对象Query,使用所有搜索器IndexSearcher执行查询对象Query得到TopDocs,遍历TopDocs得到文档Document 2. Solr搜索的工作流程: 流程说明: 用户输入查询字符串,根据用户的请求类型qt(查询为/select)选择请求处理器RequestHandler,根据用户输入的参数defType来选择一个查询解析器解析用户的查询串(默认使用RequestHander中配置的默认查询解析器),查询解析器解析完以后根据用户输入的参数qf指定的字段进行搜索(默认是所有索引字段),查询到结果以后做一些特殊的处理(fq,sort,start,rows,wt)以后使用响应处理器ResponseWriter返回给用户 3. 查看内核的solrconfig.xml文件,了解搜索的请求处理器配置 <requestHandler name="/select" class="solr.SearchHandler"> <lst name="defaults"> <str name="echoParams">explicit</str> <int name="rows">10</int>

It is possible to restore document in solr usinf tlog file

北战南征 提交于 2020-03-04 18:41:48
问题 Every time when i add/update document in solr , tlog file maintains the request query for each commit. example: when i commit using update command: curl -XPOST -H 'Content-Type: application/json' 'http://localhost:8983/solr/sample_list/update' --data-binary '{"add":{"doc":{ "id":"7","name":"test dfasdata jan565765"}},"commit":{}}' tlog file content look likes: ^B ^B)SOLR_TLOGA'strings<83>"id$name) version ^@^@^@)<83>A^G^VYîÖ·^@^@^@^P^C^H?<80>^@^@á!7â7test dfasdata jan565765ã^G^VYîÖ·^@^@^@^@^@

How do I properly do a dismax query using solrnet

十年热恋 提交于 2020-03-03 12:33:29
问题 I know I need to add the following code to change to dismax. ExtraParams = new Dictionary<string, string> { {"qt", "dismax"} } But how do I pass the "qf" values? I tried this with no avail: new Dictionary<string, string> { {"qt", "dismax"},{"qf","field1 field2"} } and var matchingItems = solr.Query(new LocalParams {{"type", "dismax"},{"qf","field1 field2"}} + BuildQuery(parameters) ... Even passing only the ExtraParams I get a 404 bad request. This is the logged queries Local parameters +

Solr评分修改

这一生的挚爱 提交于 2020-03-01 15:56:48
最近要提供一个地点查找的API给IOS组调用,其主要需求是通过距离,星级和地标的星级三者排序,距离越短和星级越高的地点优先显示 关于距离排序可以看这篇文章: http://blog.csdn.net/awj3584/article/details/11760757 要是实现方式还是Solr wiki中提供的如下方法来实现的 http://localhost:8983/solr/select?q={!boost b=recip(ms(NOW,manufacturedate_dt),3.16e-11,1,1)}ipod 或者 http://localhost:8983/solr/select?q={!boost b=$dateboost v=$qq}&dateboost=recip(ms(NOW,manufacturedate_dt),3.16e-11,1,1)&qq=ipod 根据我的需求可改成: http://localhost:8983/solr/select?q={!boost b=$dateboost v=$qq}&dateboost=sum(div(landmarkRank,10),div(star,10),recip(geodist(),1,10,10))&qq=ipod&fl=*,score 此时会看到评分会改变。 此需求的实现代码如下: [java] view

Apache solr configuration with tomcat 6.0

試著忘記壹切 提交于 2020-03-01 06:13:19
问题 Can you help me configuring Apache Solr using Tomcat and how to index in MS SQL database using Solr. What are the steps to configure Tomcat to run Apache Solr in Tomcat. 回答1: Here is the step by step procedure that would help. PART 1: SETTING UP SOLR with TOMCAT Step 1: Download Solr. It's just a zip file. Step 2: Copy from your SOLR_HOME_DIR/dist/apache-solr-1.3.0.war to your tomcat webapps directory: $CATALINA_HOME/webapps/solr.war – Note the war file name change. That’s important. Step 3:

Apache solr configuration with tomcat 6.0

自作多情 提交于 2020-03-01 06:13:08
问题 Can you help me configuring Apache Solr using Tomcat and how to index in MS SQL database using Solr. What are the steps to configure Tomcat to run Apache Solr in Tomcat. 回答1: Here is the step by step procedure that would help. PART 1: SETTING UP SOLR with TOMCAT Step 1: Download Solr. It's just a zip file. Step 2: Copy from your SOLR_HOME_DIR/dist/apache-solr-1.3.0.war to your tomcat webapps directory: $CATALINA_HOME/webapps/solr.war – Note the war file name change. That’s important. Step 3: