我正在drupal 7的apachesolr搜索模块上工作,我想根据两个条件来检索结果。我已经创建了Solr搜索查询,并在子查询中传递了60个分类术语,以搜索结果为空。
查询功能
$geography= new SolrFilterSubQuery('OR');
foreach($geographies as $c_geography) {
$geography_filter->addFilter('target_geographies', $c_geography);
}
$d_filter = new SolrFilterSubQuery('OR');
foreach($c_diseases as $c_disease) {
$d_filter->addFilter('field_disease', $c_disease);
}
$compiled_filter = new SolrFilterSubQuery('AND');
$compiled_filter->addFilterSubQuery($geography_filter);
$compiled_filter->addFilterSubQuery($d_filter);
$g_filter->addFilterSubQuery($compiled_filter);
$query->addFilterSubQuery($g_filter);
结果
stdClass Object
(
[data] =>
001.01.01.01.01.01.01.01.01.01.0
[protocol] => HTTP/1.1
[code] => 200
[status_message] => OK
[headers] => Array
(
[Transfer-Encoding] => chunked
[X-Hyperion-Response] => 1
[Server] => Apache-Coyote/1.1
[Connection] => close
[X-Pantheon-Host] => indexserver-9bdfba0f.c.pantheon-dmz.internal
[Date] => Wed, 18 Jul 2018 09:52:04 GMT
[Content-Type] => application/xml;charset=UTF-8
)
)