简体   繁体   English

如何搜索整个solr索引?

[英]How to search whole solr index?

I import data from database directly into the solr index. 我将数据从数据库直接导入solr索引。 Now I want to search it using php-solr-client . 现在我想用php-solr-client搜索它。 Now I want to search it: 现在我想搜索它:

$offset = 0;
$limit = 10;

$queries = array(
    'details:Server'
); 

$response = $solr->search( $query, $offset, $limit );

For now I can only search when I specify the field, eg details . 现在我只能在指定字段时搜索,例如details Is there a way to search all fields at a time? 有没有办法一次搜索所有字段?

If you omit the details: , doesn't it search all fields that are indexed? 如果省略details: ,是否不会搜索所有已建立索引的字段?

Otherwise, you can always combine multiple fields in one query like this: 否则,您始终可以在一个查询中组合多个字段,如下所示:

details:Server OR field2:Server OR field3:Server

EDIT: 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"/>

Then have copyField entries for all fields that would be searched: 然后为要搜索的所有字段提供copyField条目:

<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>

That should work. 这应该工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM