如何搜索整个solr索引? [英] How to search whole solr index?

查看:65
本文介绍了如何搜索整个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索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆