我将数据从数据库直接导入到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索引?
发布评论