Query only the required index fields
This commit is contained in:
parent
60f8c21398
commit
777568bc7c
|
@ -241,6 +241,15 @@ class tx_dlf_list implements ArrayAccess, Countable, Iterator, \TYPO3\CMS\Core\S
|
|||
|
||||
if ($this->solrConnect()) {
|
||||
|
||||
// Restrict the fields to the required ones
|
||||
$params['fl'] = "uid,id,toplevel,thumbnail,page";
|
||||
|
||||
foreach ($this->solrConfig as $solr_name) {
|
||||
|
||||
$params['fl'] .= ",".$solr_name;
|
||||
|
||||
}
|
||||
|
||||
// Get document's thumbnail and metadata from Solr index.
|
||||
$result = $this->solr->service->search('uid:'.tx_dlf_solr::escapeQuery($record['uid']), 0, $this->solr->limit);
|
||||
|
||||
|
|
|
@ -343,37 +343,37 @@ class tx_dlf_solr {
|
|||
*/
|
||||
public function search($query = '') {
|
||||
|
||||
// Perform search.
|
||||
$results = $this->service->search((string) $query, 0, $this->limit, $this->params);
|
||||
|
||||
$this->numberOfHits = count($results->response->docs);
|
||||
|
||||
$toplevel = array ();
|
||||
|
||||
$checks = array ();
|
||||
|
||||
// Restrict the fields to the required ones
|
||||
$this->params['fl'] = "uid,id,toplevel";
|
||||
|
||||
// Get metadata configuration.
|
||||
if ($this->numberOfHits > 0) {
|
||||
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
|
||||
'tx_dlf_metadata.index_name AS index_name',
|
||||
'tx_dlf_metadata',
|
||||
'tx_dlf_metadata.is_sortable=1 AND tx_dlf_metadata.pid='.intval($this->cPid).tx_dlf_helper::whereClause('tx_dlf_metadata'),
|
||||
'',
|
||||
'',
|
||||
''
|
||||
);
|
||||
|
||||
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
|
||||
'tx_dlf_metadata.index_name AS index_name',
|
||||
'tx_dlf_metadata',
|
||||
'tx_dlf_metadata.is_sortable=1 AND tx_dlf_metadata.pid='.intval($this->cPid).tx_dlf_helper::whereClause('tx_dlf_metadata'),
|
||||
'',
|
||||
'',
|
||||
''
|
||||
);
|
||||
$sorting = array ();
|
||||
|
||||
$sorting = array ();
|
||||
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
|
||||
|
||||
while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
|
||||
|
||||
$sorting[$resArray['index_name']] = $resArray['index_name'].'_sorting';
|
||||
|
||||
}
|
||||
$sorting[$resArray['index_name']] = $resArray['index_name'].'_sorting';
|
||||
$this->params['fl'] .= ','.$sorting[$resArray['index_name']];
|
||||
|
||||
}
|
||||
|
||||
// Perform search.
|
||||
$results = $this->service->search((string) $query, 0, $this->limit, $this->params);
|
||||
|
||||
$this->numberOfHits = count($results->response->docs);
|
||||
|
||||
// Keep track of relevance.
|
||||
$i = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue