如何搜索整个solr索引?

编程入门 行业动态 更新时间:2024-10-17 00:26:48
本文介绍了如何搜索整个solr索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我将数据从数据库直接导入到solr索引中.现在,我要使用 php-solr-client 进行搜索.现在我要搜索它:

I import data from database directly into the solr index. Now I want to search it using php-solr-client. Now I want to search it:

$offset = 0; $limit = 10; $queries = array( 'details:Server' ); $response = $solr->search( $query, $offset, $limit );

目前,我只能在指定字段时进行搜索,例如details.是否可以一次搜索所有字段?

For now I can only search when I specify the field, e.g. details. Is there a way to search all fields at a time?

推荐答案

如果省略details:,它是否不搜索所有被索引的字段?

If you omit the details:, doesn't it search all fields that are indexed?

否则,您始终可以在一个查询中组合多个字段,如下所示:

Otherwise, you can always combine multiple fields in one query like this:

details:Server OR field2:Server OR field3:Server

关于要搜索的默认字段,请指定一个虚拟"字段,该字段将填充多个值:

Regarding default field to search, specify a "dummy" field that would be populated with multiple values:

<field name="text" type="text" indexed="true" stored="false" multiValued="true"/>

然后为所有要搜索的字段提供copyField条目:

Then have copyField entries for all fields that would be searched:

<copyField source="title" dest="text"/> <copyField source="akatitle" dest="text"/> <copyField source="year" dest="text"/>

最后,指定此字段应为默认字段:

And finally, specify that this field should be the default one:

<defaultSearchField>text</defaultSearchField>

应该可以.

更多推荐

如何搜索整个solr索引?

本文发布于:2023-06-06 00:32:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/531130.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:索引   solr

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!