- 浏览: 1130789 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (411)
- Java Foundation (41)
- AI/机器学习/数据挖掘/模式识别/自然语言处理/信息检索 (2)
- 云计算/NoSQL/数据分析 (11)
- Linux (13)
- Open Source (12)
- J2EE (52)
- Data Structures (4)
- other (10)
- Dev Error (41)
- Ajax/JS/JSP/HTML5 (47)
- Oracle (68)
- FLEX (19)
- Tools (19)
- 设计模式 (4)
- Database (12)
- SQL Server (9)
- 例子程序 (4)
- mysql (2)
- Web Services (4)
- 面试 (8)
- 嵌入式/移动开发 (18)
- 软件工程/UML (15)
- C/C++ (7)
- 架构Architecture/分布式Distributed (1)
最新评论
-
a535114641:
LZ你好, 用了这个方法后子页面里的JS方法就全不能用了呀
页面局部刷新的两种方式:form+iframe 和 ajax -
di1984HIT:
学习了,真不错,做个记号啊
Machine Learning -
赵师傅临死前:
我一台老机器,myeclipse9 + FB3.5 可以正常使 ...
myeclipse 10 安装 flash builder 4.6 -
Wu_Jiang:
触发时间在将来的某个时间 但是第一次触发的时间超出了失效时间, ...
Based on configured schedule, the given trigger will never fire. -
cylove007:
找了好久,顶你
Editable Select 可编辑select
Params of solr query (参见 solrj - CommonParams.class & solr-core - QueryParsing.class):
Apache LuceneTM 4.4.0 Documentation:
http://lucene.apache.org/core/4_4_0/index.html
http://khaidoan.wikidot.com/solr
http://www.cnblogs.com/TerryLiang/archive/2012/08/30/2664483.html
http://www.cnblogs.com/ukouryou/articles/2683463.html
引用
注意solr 中的 AND OR NOT + - 这5个 boolean operators 必须为大写,在 solr 中它们都是大小写敏感的;
q.op 指 query 的 operator,可以在 schema.xml中指定:
待续。。。
example:q.op 指 query 的 operator,可以在 schema.xml中指定:
<solrQueryParser defaultOperator="AND"/>如果未指定,则默认的 op 是 OR;
待续。。。
String uri = UriComponent.encode(this.solrUserQueryUrl, UriComponent.Type.QUERY); WebResource wr = jerseyClient.resource(uri); MultivaluedMap<String, String> formData = new MultivaluedMapImpl(); formData.add("q", StringUtils.collectionToDelimitedString(userIdList, " ")); formData.add("q.op", "OR"); formData.add("df", "userID"); formData.add("fq", "flag:(s OR t)"); formData.add("fl", "userID"); formData.add("rows", String.valueOf(userIdList.size())); formData.add("wt", "json"); formData.add("indent", "true"); //only for formatting output String respStr = wr.type(MediaType.APPLICATION_FORM_URLENCODED).post(String.class, formData);
solr-core Constant Field Values:
http://lucene.apache.org/solr/4_1_0/solr-core/constant-values.html
查询时 AND OR 等 boolean operators 的混合使用:
http://robotlibrarian.billdueber.com/solr-and-boolean-operators/
CloudSolrServer & collection:
http://wiki.apache.org/solr/Solrj#Using_with_SolrCloud
引用
SolrJ includes a 'smart' client for SolrCloud, which is ZooKeeper aware. This means that your Java application only needs to know about your Zookeeper instances, and not where your Solr instances are, as this can be derived from ZooKeeper.
To interact with SolrCloud, you should use an instance of CloudSolrServer, and pass it your ZooKeeper host or hosts.
Beyond the instantiation of the CloudSolrServer, the behaviour should be the same as regular SolrJ.
https://issues.apache.org/jira/browse/SOLR-4046To interact with SolrCloud, you should use an instance of CloudSolrServer, and pass it your ZooKeeper host or hosts.
Beyond the instantiation of the CloudSolrServer, the behaviour should be the same as regular SolrJ.
import org.apache.solr.client.solrj.impl.CloudSolrServer; import org.apache.solr.common.SolrInputDocument; CloudSolrServer server = new CloudSolrServer("localhost:9983"); server.setDefaultCollection("collection1"); SolrInputDocument doc = new SolrInputDocument(); doc.addField( "id", "1234"); doc.addField( "name", "A lovely summer holiday"); server.add(doc); server.commit();
引用
通过一个 CloudSolrServer 实例做查询时,指定 collection 的方式为
solrQuery.add(CoreAdminParams.COLLECTION, "collection_name");
Solr request 之 get & post:
使用 solrj 时,如果做查询时使用的是 post 方式做提交:
QueryResponse response = solrServer.query(solrQuery, METHOD.POST);则传给 solr Server 的 SolrParams(superclass of SolrQuery) 就是 Form 的形式,详见 solrj.jar 的 HttpSolrServer.request(request, responseParser):
//HttpSolrServer.request(request, responseParser) 节选 public NamedList<Object> request(final SolrRequest request, final ResponseParser processor) throws SolrServerException, IOException { ... try { while( tries-- > 0 ) { // Note: since we aren't do intermittent time keeping // ourselves, the potential non-timeout latency could be as // much as tries-times (plus scheduling effects) the given // timeAllowed. try { if( SolrRequest.METHOD.GET == request.getMethod() ) { if( streams != null ) { throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "GET can't send streams!" ); } method = new HttpGet( baseUrl + path + ClientUtils.toQueryString( params, false ) ); } else if( SolrRequest.METHOD.POST == request.getMethod() ) { String url = baseUrl + path; boolean isMultipart = ( streams != null && streams.size() > 1 ); LinkedList<NameValuePair> postParams = new LinkedList<NameValuePair>(); if (streams == null || isMultipart) { HttpPost post = new HttpPost(url); post.setHeader("Content-Charset", "UTF-8"); if (!this.useMultiPartPost && !isMultipart) { post.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); } List<FormBodyPart> parts = new LinkedList<FormBodyPart>(); Iterator<String> iter = params.getParameterNamesIterator(); while (iter.hasNext()) { String p = iter.next(); String[] vals = params.getParams(p); if (vals != null) { for (String v : vals) { if (this.useMultiPartPost || isMultipart) { parts.add(new FormBodyPart(p, new StringBody(v, Charset.forName("UTF-8")))); } else { postParams.add(new BasicNameValuePair(p, v)); } } } } if (isMultipart) { for (ContentStream content : streams) { String contentType = content.getContentType(); if(contentType==null) { contentType = "application/octet-stream"; // default } parts.add(new FormBodyPart(content.getName(), new InputStreamBody( content.getStream(), contentType, content.getName()))); } } if (parts.size() > 0) { MultipartEntity entity = new MultipartEntity(HttpMultipartMode.STRICT); for(FormBodyPart p: parts) { entity.addPart(p); } post.setEntity(entity); } else { //not using multipart post.setEntity(new UrlEncodedFormEntity(postParams, "UTF-8")); } method = post; ... }http://wiki.apache.org/solr/ContentStream
引用
If the contentType is "application/x-www-form-urlencoded" the full POST body is parsed as parameters and inlcuded in the SolrParams.
Spring Data Solr - a small layer above solrj providing some fluent API and repository abstractions:
http://stackoverflow.com/questions/15307737/difference-between-solr-core-solrj-spring-data-solr
http://static.springsource.org/spring-data/data-solr/docs/current-SNAPSHOT/reference/htmlsingle/
Errors of solr:
1 too many boolean clauses
http://stackoverflow.com/questions/3802367/solr-search-for-lots-of-values
A example of custom SolrServerFactory:
http://sillycat.iteye.com/blog/1530915
发表评论
-
Authentication & Authorization & Access Control - OAuth 2.0 & ABAC
2016-04-08 16:14 1486Access Control RBAC(role-b ... -
Virtualization & Docker
2016-03-23 09:43 628Docker up & running: 引用A co ... -
Scala
2014-09-30 11:31 1098twitter 的 scala 教程: Scala S ... -
M2M & IoT: MQTT
2014-09-25 11:42 1307Pract ... -
Continuous Integration Server:Jenkins & Hudson
2013-04-15 16:15 1423Jenkins: http://jenkins-ci.org/ ... -
Ruby
2013-03-31 00:44 1169Ruby on Rails Tutorial: http:// ... -
Spring Integration
2013-03-26 16:52 3008Spring Integration Reference ... -
Open Source Explosion
2013-03-19 13:55 1204好用的开源java第三方开源包: rapid-framewor ... -
高可用与负载均衡:Haproxy(or lVS) + keepalived
2013-01-29 20:35 3112sources: Setting Up A High ... -
Spring Batch: 大数据量批量并行处理框架
2013-01-11 16:19 4805Spring Batch Documentati ... -
AOP: Aspect Oriented Programming
2013-01-06 11:13 2752The AspectJ Programming Gu ... -
Performance & Load test tool : JMeter
2012-12-18 14:28 1250Official: http://jmeter.apa ... -
rabbitmq & spring amqp
2012-12-04 00:09 8662My main AMQP post on blogger ... -
javaMail 邮件
2012-11-23 20:14 3436SMTP POP3的区别到底是什么? http://w ... -
未完 Spring MVC
2012-11-15 22:41 2068Annotations for Http pa ... -
JUnit 单元测试
2012-10-30 12:27 2526测试的分类: http://s ... -
Gerrit : Code Review Tool based on Git
2012-09-21 18:52 12846Gerrit Code Review for Git: htt ... -
Hibernate
2011-08-02 11:48 1129Hibernate缓存: 一级缓存的生命周期和session的 ... -
Maven Repository Management & Nexus
2011-07-30 11:39 1368Why do I need a Repositor ... -
XStream
2011-07-13 00:18 1331XStream 内置 Converters: http://x ...
相关推荐
lucene和solr笔记
lucene&solr原理分析,lucene搜索引擎和solr搜索服务器原理分析。
Lucene&solr简介及使用,首先介绍了lucene,之后介绍了solr,中间有各种相关插件的应用.
关键词:Lucene solr 搜索引擎 Lucene实战 随书源码 本书随书光盘文件有1G,压缩后有>400MB, 我单个文件的权限是80MB 故分为下面6个包上传: 解密搜索引擎技术实战Lucene&Java精华版(1) 解密搜索引擎技术实战Lucene&...
信息检索-泛化翻译模型该存储库包含本文的Lucene&Solr实现: 概率相关框架中的通用翻译模型Rekabsaz,Lupu,Hanbury,Zuccon-CIKM '16( )执行该存储库允许使用Solr解析器和Lucene查询扩展Lucene&Solr。...
关键词:Lucene solr 搜索引擎 Lucene实战 随书源码 本书随书光盘文件有1G,压缩后有>400MB, 我单个文件的权限是80MB 故分为下面6个包上传: 解密搜索引擎技术实战Lucene&Java精华版(第3版)源码(1) 解密搜索引擎技术...
关键词:Lucene solr 搜索引擎 Lucene实战 随书源码 本书随书光盘文件有1G,压缩后有>400MB, 我单个文件的权限是80MB 故分为下面6个包上传: 解密搜索引擎技术实战Lucene&Java精华版(1) 解密搜索引擎技术实战Lucene&...
lucene,solr的使用lucene,solr的使用lucene,solr的使用lucene,solr的使用lucene,solr的使用lucene,solr的使用lucene,solr的使用lucene,solr的使用lucene,solr的使用lucene,solr的使用lucene,solr的使用
关键词:Lucene solr 搜索引擎 Lucene实战 随书源码 本书随书光盘文件有1G,压缩后有>400MB, 我单个文件的权限是80MB 故分为下面6个包上传: 解密搜索引擎技术实战Lucene&Java精华版(1) 解密搜索引擎技术实战Lucene&...
我已经将lucene&solr源代码和solr Web UI组合到一个普通的Java Web项目中,因此我们可以将其直接导入Eclipse,然后部署并启动solr,更重要的是,您可以在源代码中创建一个断点,并进行跟踪源代码执行,真正了解...
关键词:Lucene solr 搜索引擎 Lucene实战 随书源码 本书随书光盘文件有1G,压缩后有>400MB, 我单个文件的权限是80MB 故分为下面6个包上传: 解密搜索引擎技术实战Lucene&Java精华版(第3版)源码(1) 解密搜索引擎技术...
关键词:Lucene solr 搜索引擎 Lucene实战 随书源码 本书随书光盘文件有1G,压缩后有>400MB, 我单个文件的权限是80MB 故分为下面6个包上传: 解密搜索引擎技术实战Lucene&Java精华版(第3版)源码(1) 解密搜索引擎技术...
lucene使用总结笔记lucene使用总结笔记lucene使用总结笔记lucene使用总结笔记lucene使用总结笔记
精华版(第3版)》总结搜索引擎相关理论与实际解决方案,并给出了Java实现,其中利用了流行的开源项目Lucene和Solr,而且还包括原创的实现。 《解密搜索引擎技术实战——Lucene&Java;精华版(第3版)》主要包括总体...
搜索引擎核心技术和实现是基于Lucene和Solr实现的一本书,该书详细讲解了搜索引擎的实现原来和当前最新的互联网行业应用架构,很实用。
本人用ant idea命令花了214分钟,35秒编译的lucene-solr源码,可以用idea打开,把项目放在D:\space\study\java\lucene-solr路径下,再用idea打开就行了
lucene4 solr4j arIk4
lucene solr 全文搜索框架,该教程有助于深入了解lucene solr的用法以及他么们之间的比较
IK中文分词器, 这是在学习Lucene与Solr过程中使用到的分词器, 需要的请在这里下载. 具体使用请参见我关于Lucene与Solr的博客. PS. 资源不能设置为0分是为什么...
公司培训讲义:搜索引擎解密Lucene与Solr的前世今生