Solr返回JSON(JSON returned by Solr)
我正在使用Solr来索引我的数据。
通过Solr的UI,我在Schema窗口中添加了两个字段:word,messageid
我做了以下查询帖子后:
curl -X POST -H "Content-Type: application/json" 'http://localhost:8983/solr/messenger/update.json/docs' --data-binary '{"word":"hello","messageid":"23523}'
我收到了以下JSON:
{ "responseHeader": { "status": 0, "QTime": 55 } }
当我要进入API中的查询窗口并执行不带参数的查询时,我得到以下JSON:
{ { "responseHeader": { "status": 0, "QTime": 0, "params": { "q": "*:*", "indent": "on", "wt": "json", "_": "1488911768817" } }, "response": { "numFound": 1, "start": 0, "docs": [ { "id": "92db6722-d10d-447a-b5b1-13ad9b70b3e2", "_src_": "{\"word\":\"hello\",\"messageid\":\"23523\"}", "_version_": 1561232739042066432 } } } }
我的JSON不应该更像下一个吗?:
//More Code "response": { "numFound": 1, "start": 0, "docs": [ { "id": "92db6722-d10d-447a-b5b1-13ad9b70b3e2", "word": "hello", "messageid": "23523", "_version_": 1561232739042066432 } //More Code
为了以后能够通过以下选项使用参数进行过滤?:
I'm using Solr in order to index my data.
Through the Solr's UI I added, in the Schema window, two fields: word, messageid
After I made the following query post:
curl -X POST -H "Content-Type: application/json" 'http://localhost:8983/solr/messenger/update.json/docs' --data-binary '{"word":"hello","messageid":"23523}'
I received the following JSON:
{ "responseHeader": { "status": 0, "QTime": 55 } }
When I'm going to the Query Window in the API and Execute a query without parameters I get the following JSON:
{ { "responseHeader": { "status": 0, "QTime": 0, "params": { "q": "*:*", "indent": "on", "wt": "json", "_": "1488911768817" } }, "response": { "numFound": 1, "start": 0, "docs": [ { "id": "92db6722-d10d-447a-b5b1-13ad9b70b3e2", "_src_": "{\"word\":\"hello\",\"messageid\":\"23523\"}", "_version_": 1561232739042066432 } } } }
Shouldn't my JSON appear more like the following one?:
//More Code "response": { "numFound": 1, "start": 0, "docs": [ { "id": "92db6722-d10d-447a-b5b1-13ad9b70b3e2", "word": "hello", "messageid": "23523", "_version_": 1561232739042066432 } //More Code
In order to be able later on to filter using parameters through the following option?:
原文:https://stackoverflow.com/questions/42655951
最满意答案
您可以使用协议和协议扩展将相同的功能注入到这两个类中:
@objc protocol MyProto { func someFunc() } extension MyProto { func someFunc() { print("howdy") } } class MyTableViewCell : UITableViewCell, MyProto { } class MyCollectionViewCell : UICollectionViewCell, MyProto { } let cell1 = MyTableViewCell() cell1.someFunc() // "howdy" let cell2 = MyCollectionViewCell() cell2.someFunc() // "howdy"
...显示他们都做同样的事情,而不重复代码。
You can inject identical functionality into both class using a protocol plus a protocol extension:
@objc protocol MyProto { func someFunc() } extension MyProto { func someFunc() { print("howdy") } } class MyTableViewCell : UITableViewCell, MyProto { } class MyCollectionViewCell : UICollectionViewCell, MyProto { } let cell1 = MyTableViewCell() cell1.someFunc() // "howdy" let cell2 = MyCollectionViewCell() cell2.someFunc() // "howdy"
...showing that they both do the same thing, without repetition of the code.
相关问答
更多-
电脑会越来越神中的神是什么意思[2022-01-31]
功能 -
功能内的功能(Functions within functions)[2021-10-03]
这是一个标签声明 。 你可以用goto , break或continue使用它。 来自docs : 定义从未使用过的标签是非法的。 与其他标识符相比,标签不是块作用域,也不与非标签的标识符冲突。 标签的范围是声明它的函数体,并排除任何嵌套函数的主体。 它们在您需要以某种方式更改流量的情况下非常有用,即。 K: for i:=0; i<10; i++ { for j:=0; j<10; j++{ if (somefunction(j)) { continue K ... -
继承自asp:GridView(Inheriting from asp:GridView)[2022-02-09]
执行此操作的常用方法是在UserControl中包含GridView 如果将网格放在用户控件上,并订阅那里的所有事件,那么您可以在应用程序中的任何位置重用此实现 - 您实际上只是使用所需的功能包装用户控件,然后重用此包装器到处。 巧妙的是你只需编写一次连线代码。 这就是我认为你想做的事情。 但是,如果要在usercontrol之外扩展或处理这些事件,则需要重新实现它们(即添加自己的事件处理程序并让它们冒泡)。 但是,您不能强迫任何人订阅您的活动。 如果要强制执行事件,则可以将事件放在接口上,并在类或控件上实 ... -
首先,公开继承std::vector和其他标准库容器被认为是个坏主意 。 记住这一点,从另一个类模板继承的类模板所需的语法是 template
class NewVector : public vector { // .... }; First of all, publicly inheriting from std::vector and other standard library containers is considered a bad idea. Keeping t ... -
虚拟只在需要运行时多态性的地方使用。 使用虚拟方法确保方法的正确版本(BASE / DERIVED)得到调用,并且根据调用者对象的类型在运行时解析调用。 有关更多参考虚拟功能 和YES,你的理解是正确的。 Virtual is used only where runtime polymorphism is needed. Use of virtual make sure that correct version (BASE/DERIVED) of the method is getting called a ...
-
问题是当你定义类prod和声明函数bind时 virtual module& bind(mixer &mix); 在类范围中,您隐藏了具有相同基类名称的所有其他函数。 那么你打来电话 prod1.bind(prod2); 编译器在类范围中只看到一个候选者:上面显示的函数。 并且它无法将参考产品转换为参考混频器。 你应该写在类定义中 using in_out::bind; 正如@Alex在他的评论中指出的那样,如果你使用多态,你必须使类模块的析构函数成为虚拟。 编辑:如果要将pfn_inout替换为in ...
-
JavaScript - 继承Array后,过滤器功能被破坏(JavaScript - After inheriting Array the filter function becomes broken)[2022-03-18]
将Symbol.species设置为原始Array构造函数可修复此问题 class Pipeline extends Array { static get [Symbol.species]() { return Array; } // ... } 编辑 : Array.prototype.filter实现不会改变原始对象,而是创建一个新的对象来存储结果。在这种情况下,派生的构造函数用于此,它在每个init上使用正好2个值填充对象。 您可以在派生类上设置Symbol.species以专门告 ... -
根据您上面给出的解释,继承通用图表是不正确的。 继承是一种工具,可帮助将具有其他属性,方法和功能的相同类型的现有类扩展为一个类。 因此,如果您要做的就是通过指定边和权重的类型来获取通用图并使其成为特定图,而不向原始类的结构或功能添加任何其他内容,则继承是不必要的。 话虽如此,有很多情况下,人们可能需要继承模板类,并根据手头的任务将其保留为通用模板类或特定模板类。 例如,如果您被赋予创建一个类的任务,该类表示列表上的常规操作的整数列表,另外还要实现一个返回的函数(假设这些数字的平均值或任何其他不支持的操作)由 ...
-
继承功能(Inheriting functions)[2023-02-11]
您可以使用协议和协议扩展将相同的功能注入到这两个类中: @objc protocol MyProto { func someFunc() } extension MyProto { func someFunc() { print("howdy") } } class MyTableViewCell : UITableViewCell, MyProto { } class MyCollectionViewCell : UICollectionViewCell, MyPr ...