JLK的博客
JLK · 共 84 篇文章
solr定制文档hash
我们知道,solr在添加文档建索引的时候,通过文档id来进行hash到具体哪一个shard上去,从而实现一个Collection上的数据平衡性。 但是这也有个弊端就是我们在做查询的时候,需要到每个shard并行查询,然后再将总结果返回,这一定程度上降低了性能。 solr支持一个特性就是我们可以通过特殊标记文档id,将这类文档都建立在特定的shard上,然后查询的时候只需要设置下一个参数 就可以支持直接到这个shard查询,从而提高了建索引的速度和查询速度。 (带来的弊端就是一个Collection上的几个shard上的文档数量可能不均衡 ) 注意:这里的路由到特定的shard,但是没办法路由…
2017-08-18 19:27 · solr · 评论(0)
Distributed Requests
Distributed Requests Query all shards of a collection (the collection is implicit in the URL): http://localhost:8983/solr/collection1/select? Query all shards of a compatible collection, explicitly specified: http://localhost:8983/solr/collection1/select?collection=collection1_recent Query all shar…
2017-08-15 13:22 · solr · 评论(0)
collection async
Asynchronous Calls Since some collection API calls can be long running tasks e.g. Shard Split, you can optionally have the calls run asynchronously. Specifying async=<request-id> enables you to make an asynchronous call, the status of which can be requested using the REQUESTSTATUS call at any time.…
2017-08-14 16:43 · solr · 评论(0)
Collections API timeouts
Such timeout can occur when Solr is not able to obtain cluster state. If following call is results in timeout, then this is the case http://solr-hostname:8983/solr/admin/collections?action=CLUSTERSTATUS&wt=json This may be caused by incorrect entries present in /clusterstate.json To fix this: get c…
2017-08-13 00:32 · solr · 评论(0)
apache权限问题
[root@localhost ~]# service httpd restart 停止 httpd: [失败] 正在启动 httpd:Syntax error on line 293 of /etc/httpd/conf/httpd.conf: DocumentRoot must be a directory [失败] [root@localhost ~]# service httpd restart 停止 httpd: [失败] 正在启动 httpd: [确定] 解决 方法 : 这是因为 selinux 的权限问题导致, 解决方法 : 给网站文件 加apache 的权限 : chcon …
2015-01-09 14:30 · 评论(0)
Solr原子更新
Solr4.0开始支持简单的原子更新和添加字段 参数说明 Solr支持多种修饰符,自动更新文档的值。 set – 更新一个字段 add – 添加一个字段 inc – 在原有值的基础上增加(看下面的例子更清楚) 备注: 所有原始字段必须存储(在fieldType 里面设置 stored=true) 操作例子 第一步、添加一条数据 $ curl http://localhost:8983/solr/update -H 'Content-type:application/json' -d ' [ {"id" : "book1", "title" : "Snow Crash", "copies_i"…
2014-12-30 17:13 · solr · 评论(0)
solr分组聚合
在大型电子商务网站中,在商品列表页,我们都可以看到商品按分类,品牌,价格的分类显示,如下图,这些我们可以使用solr中的facet功能实现。 facet的基本功能就是对搜索结果中的商品进行分类。 1.facet用法 facet.field:指定要分类的字段 facet=on 或 facet=true表示功能开启 facet.prefix 表示字段前缀 facet.limit 表示返回的记录数 facet.offict 表示从第几条开始,主要用于分页 facet.query可以任意定义查询 注:用于facet的字段的索引index一定要设为true 2..facet.field 这里我们查询产…
2014-12-30 17:12 · solr · 评论(0)
如何把jar包发布到maven私服
1.格式 mvn deploy:deploy-file -DgroupId=com.qiyi -DartifactId=sphinx -Dversion=1.0 -Dpackaging=jar -Dfile=D:\sphinxapi.jar -Durl=[url] -DrepositoryId=[id 2.实例 D:\develop\apache-maven-3.0.4\bin>mvn deploy:deploy-file -DgroupId=org.sphx -DartifactId=sphinxapi -Dversion=1.0 -Dpackaging=jar -Dfile=D:\sph…
2014-12-16 16:58 · 评论(0)
ImageMagick安装
参考:http://xupo.iteye.com/blog/1134986 http://logo32.blog.163.com/blog/static/668116902012825105651961/ 检查一些依赖包的安装,通过yum来安装,如果Redhat5无法用yum,参考本人的 另一篇文章: RHEL5 利用 CentOS的yum 安装openssl gc++及Nginx 1.确保系统已经安装以下包: Shell代码 # yum install libjpeg # yum install libjpeg-devel # yum install libpng # yum instal…
2013-04-07 01:41 · 评论(0)
document解析xml
示例: ---------------------------------------------------------- config.xml <?xml version="1.0" encoding="GBK"?> <param> <add name="pageSize" value="15">page</add> <add name="webSite" value="Rouselife">Test</add> </param> ---------------------------------------------------------- Class文件: import org.…
2013-02-25 23:21 · 评论(0)
servlet读取xml格式的post数据
服务器端代码: [java] view plain copy rundata.getModuleInfo().setLayoutTemplate(null); HttpServletRequest request = rundata.getRequest(); HttpServletResponse response = rundata.getResponse(); PrintWriter printWriter = null; ServletInputStream sis = null; String xmlData = null; try { printWriter = response…
2013-02-25 22:25 · 评论(0)
passbook定位问题
passbook通过gps定位,查看你passbook中是否在这个坐标附近有pass。 原理是这样,不需要通程网络,直接提醒你你下载的这个附近的pass。 但是gps定位和google地图的坐标会有一个的偏移 如果两个坐标规格不一样的话,算出来的结果也是会有偏差的,时常会发现标注的是这个附,而不提醒的状况。 所以,需要转换坐标,把地图上标注的坐标转换成gps规格的坐标,也称为地球坐标。 推荐一篇贴子,讲了把火星坐标怎么转成地球坐标 http://www.cnblogs.com/nolan022/articles/2601502.html
2012-12-10 17:27 · 移动开发 · 评论(0)
mac上更改jdk
mac 更改jdk其实只要把软链改一下就行 /usr/bin/java指向的是 /System/Library/Frameworks/JavaVM.framework/Versions/Current 这个软链 只要把这个软链指向到你想要的jdk版本就行 sudo ln -s 1.5.0-leopard Current
2012-12-05 16:45 · 评论(0)
lbs中从库中查询某经纬度2KM范围内的数据
sql 语句查询经纬度范围 指定一个经纬度,给定一个范围值(单位:千米),查出在经纬度周围这个范围内的 数据 。 经度:113.914619 纬度:22.50128 范围:2km longitude为数据表经度字段 latitude为数据表纬度字段 SQL在 mysql 下测试通过,其他 数据库 可能需要修改 SQL语句如下: select * from location where sqrt( ( ((113.914619-longitude)*PI()*6328*cos(((22.50128+latitude)/2)*PI()/180)/180) * ((113.914619-longi…
2012-11-02 12:44 · 移动开发 · 评论(0)