首页 \ 问答 \ 检索Solr查询中的特定字段?(Retrieving specific fields in a Solr query?)

检索Solr查询中的特定字段?(Retrieving specific fields in a Solr query?)

我在Jetty上运行一个Solr实例,当我使用Solr管理面板进行搜索时,它返回整个文档。 我应该怎么做才能从搜索返回的每个Solr文档中只获取指定的字段?


I am running a Solr instance on Jetty and when I search using the Solr admin panel, it returns the entire document. What should I do to get only specified fields from each Solr document returned by the search?


原文:https://stackoverflow.com/questions/264907
更新时间:2022-09-19 22:09

最满意答案

main.show()调用show(Object... a)方法并传递零长度数组。

Varargs允许你有零个或多个参数,这就是为什么用main.show()调用它是合法的。

顺便提一下,我建议您不要在System.out.println语句中嵌入\n - printlnln位会为您打印一个适合您正在运行的系统的换行符。 \n不可携带。


main.show() invokes the show(Object... a) method and passes a zero-length array.

Varargs allows you to have zero or more arguments, which is why it is legal to call it with main.show().

Incidentally, I'd recommend that you don't embed \n in your System.out.println statements - the ln bit in println prints a newline for you that will be appropriate for the system you're running on. \n isn't portable.

相关问答

更多
  • 也许这篇文章会有帮助http://boyns.blogspot.fr/2007/12/java-15-explained-varargs.html 最后,结论是编译器将varargs转换为字节码中的数组。 Maybe this post will be helpfull http://boyns.blogspot.fr/2007/12/java-15-explained-varargs.html In the end the conclusion is that compiler transforms va ...
  • main.show()调用show(Object... a)方法并传递零长度数组。 Varargs允许你有零个或多个参数,这就是为什么用main.show()调用它是合法的。 顺便提一下,我建议您不要在System.out.println语句中嵌入\n - println的ln位会为您打印一个适合您正在运行的系统的换行符。 \n不可携带。 main.show() invokes the show(Object... a) method and passes a zero-length array. Vara ...
  • 那么编译器警告会告诉你你需要知道的一切。 它不知道是否将null视为Class[]直接传递到getMethod ,或者作为新的Class[]数组中的单个null条目。 我怀疑你想要以前的行为,所以将null Class[] : Method method = aClass.getMethod("getInstance", (Class[]) null); 如果您希望使用单个零元素创建Class[] ,则可以将其转换为Class : Method method = aCl ...
  • Varargs 对于需要处理不确定数量的对象的任何方法都是有用的。 一个很好的例子是String.format 。 格式字符串可以接受任意数量的参数,因此您需要一个传递任意数量对象的机制。 String.format("This is an integer: %d", myInt); String.format("This is an integer: %d and a string: %s", myInt, myString); Varargs are useful for any method tha ...
  • 所以我的问题可变参数将基元类型转换为对象? 它转换为数组的类型。 如果你有 a(int... ints) 他们将是int 如果你有 b(double... doubles) 即使你写b (1, 2.0f, 10L)他们也会翻倍。 如果你有一个 c(Object... obj) 它会autobox原语。 这不是var-args的一个特性,但是如何根据需要自动复制类型。 So my question does varargs cast primitive types to object? It casts ...
  • 这是一个错字 void varagrs(long... l){ ^^ 这就是为什么有一个带拼写检查的IDE(例如IntelliJ)的好处 修复错字后,编译器选择(int...) over (long...)因为int是long (4.10.1)的子类型,所以第一种方法更具体(15.12.2.5) 。 注意,虽然int[]不是long[] (4.10.3)的子类型。 It's a typo void varagrs(long... l){ ^^ That's why ...
  • elipsis( ... )运算符只能用于方法签名。 您可以显式声明和创建数组: Map hm = new HashMap<>(); hm.put("Zara", new String[]{"Pony", "Cars", "Magic"}); hm.put("John", new String[]{"Horse", "Flying", "Loving"}); 如果你绝对必须使用varags,你可以使用自己的方法将调用包装到Map#put : public static ...
  • 这是不可能的,因为第二个参数无法确定。 要理解为什么它应该是最后一个参数,请考虑您的方法 public void myMethod(Foo... f, Foo f1){} 现在假设你使用myMethod(fooObj1, fooObj2, fooObj3);调用它myMethod(fooObj1, fooObj2, fooObj3); 所有foo参数都将应用于var-arg方法参数。 因此,没有办法告诉特定对象作为第二个参数传递。 现在,当你将var-arg作为最后一个参数时, public void ...
  • 考虑以下两个假设调用stuff() : int a = 14; Integer b = new Integer(14); stuff(a, b); stuff(b, a); 编译器如何知道应该在这里调用哪个方法? 由于自动装箱规则,任一调用都可以指重载方法。 更新: 我的回答在逻辑上是正确的,或者至少在正确的轨道上,但对于更正式的答案,我们可以参考这个问题: 使用原始类型和包装类的varargs重载时为什么会出现模糊错误? 在松散的调用上下文中调用两个varargs方法。 因此,编译器将尝试通过JLS ...
  • 方法 public static void main(String... args) { //code } 也完全合法 代码的问题是Java中不允许方法内部的方法声明 可编译的代码必须是这样的 class TryVariableArgumentList { public static void main(String[] args) { x("first","second"); } public static void x(String... list) ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)