知识点
相关文章
更多最近更新
更多让Solr返回JSON数据
2019-03-27 01:07|来源: 网路
http://localhost:1985/solr/select/?q=*%3A*&version=2.2&start=0&rows=10&indent=on&wt=json solr的http请求后加一个wt参数 返回则是text/plain的json字符串。
如下图所示:
默认的是返回xml数据,将以上请求参数的wt去掉或者wt=xml,即可得xml数据,请求如:http://localhost:1985/solr/select/?q=*%3A*&version=2.2&start=0&rows=10&indent=on&wt=xml 结果如下图:
转自:http://www.cnblogs.com/likehua/archive/2013/01/07/2848619
相关问答
更多-
从solr访问有限的数据(Accessing limited data from solr)[2021-10-08]
而问题是? 只需将'fl'参数定义为要返回的字段列表,在这种情况下为'id'。 如果你从未真正返回其他字段,请不要费心存储它们,只将它们定义为索引。 如果您确实需要存储但很少需要它们,请使用solrconfig.xml中的 enableLazyFieldLoading设置进行测试 And the problem is? Just define the 'fl' parameter to be the list of fields you want to return, in which case 'id'. ... -
你必须提交更新。 向请求添加提交true或commitWithin 1000,例如 curl -X POST -d'{“add”:{“doc”:{“id”:“delete.me”,“title”:“change.me”},“commitWithin”:1000}}'-H“ Content-Type:application / json“ http:// localhost:8983 / solr / solr_sample / update 也可以工作: curl -X POST -d'{“add”:{“d ...
-
不,据我所知,目前这是不可能的(没有在服务器上创建文件,然后从文件创建核心)。 如果需要这种功能,您可能希望为架构使用更多无架构的结构,您可以在其中定义一组映射到字段的不同默认设置的字段前/后缀,然后使用通配符名称来避免定义架构中的每个字段。 基于Lucene的真正模式替代方案也可以是弹性搜索。 No, as far as I know, this is not possible at the moment (without creating the files on the server, then cr ...
-
使用solrj客户端,您可以创建SolrInputDocument对象并将它们发布到SolrServer实例,无论它是HttpSolrServer还是EmbeddedSolrServer。 SolrInputDocument是一个名称值对集合,它将等同于您要发布的json。 如https://wiki.apache.org/solr/Solrj#Adding_Data_to_Solr所述 如果你真的想把JSON发送到Solr服务器,你可以使用类似HTTPClient的东西将JSON发布到http://sol ...
-
也许这个链接可能会澄清: 来自Solrj的引用格式json 或许你可以通过Http请求实现你所需要的,因为我知道确实有json支持。 Perhaps this link may clarify: quoted format json from Solrj Else maybe you can achieve what you need just through an Http Request as I know that indeed has json support.
-
Solr Json支持(Solr Json Support)[2022-08-24]
SolrJ客户端将查询作为URL参数发送( q=memory&fq=inStock:true ),响应类型为javabin https://wiki.apache.org/solr/javabin 您可以使用apache http客户端并将您的JSON查询和触发请求设置为Solr。 Essentially, we can also set the parameter "json" and the query in SolrJ SolrQuery: SolrQuery.add("json", "{json q ... -
Solr dismax查询不返回数据,而标准查询则返回数据(Solr dismax query returns no data, while standard query does)[2022-06-01]
得到了解决方案,对于一些我不知道的原因,除非我们定义哪个字段应该用于过滤,否则q = king不起作用,在我的情况下: http://localhost:8983/solr/somecore/select?q=king&wt=json&defType=dismax&qf=title+body PS 当然也应该省略“标题:”。 我没有在原始问题中提及它,但我在查询中尝试使用和不使用它。 Got solution, for some unknown to me reason, q=king is not go ... -
Solr返回JSON(JSON returned by Solr)[2022-03-24]
事实证明,您使用的是所谓的“自定义JSON索引”方法, 此处将对此进行描述。 您可以按照wiki中的描述进行调整,以便提取所需的字段。 以下摘录供您参考: split :定义将输入JSON拆分为多个Solr文档的路径,如果单个JSON文件中有多个文档,则需要该路径。 如果整个JSON生成单个solr文档,则路径必须为“/”。 通过管道(|)示例分隔它们可以传递多个分割路径:split = / | / foo | / foo / bar。 如果一条路径是另一条路径的子路径,它们将自动成为子文档 f :这是一个 ... -
req.add_header('Content-type', 'application/json') 您需要在req对象中设置内容的标题。 请在调用urllib2.urlopen(req)之前使用上面的语句; req.add_header('Content-type', 'application/json') You need to set the header for the content in you req object. Please use the above statement just ...
-
100是Solr找到的记录总数,但默认情况下它一次只返回10。 尝试将&rows=100添加到网址,一次获取所有100个结果。 编辑:在一个真实的应用程序中,你可能想要在页面中获取结果,这样你就不会耗尽内存,试图一次获取数十亿个结果。 在这种情况下,您可以组合start和rows选项。 例如,一次获取20个结果: 第一个请求将使用&start=0&rows=20 第二个请求将使用&start=20&rows=20 ...等等,直到你获得了所有结果。 这类似于在SQL中使用OFFSET和LIMIT关键字,如果 ...