protected function SearchApiSolrConnection::setLuke in Search API Solr 7
Sets $this->luke with the metadata about the index from admin/luke.
Parameters
int $num_terms: (optional) The number of "top terms" to return.
1 call to SearchApiSolrConnection::setLuke()
- SearchApiSolrConnection::getLuke in includes/
solr_connection.inc - Gets meta-data about the index.
File
- includes/
solr_connection.inc, line 340
Class
- SearchApiSolrConnection
- Represents a Solr server resource.
Code
protected function setLuke($num_terms = 0) {
if (empty($this->luke[$num_terms])) {
$cid = $this
->getCacheId(__FUNCTION__ . ":{$num_terms}");
if ($cid) {
$cache = cache_get($cid, 'cache_search_api_solr');
if (isset($cache->data)) {
$this->luke = $cache->data;
}
}
// Second pass to populate the cache if necessary.
if (empty($this->luke[$num_terms])) {
$params = array(
'numTerms' => "{$num_terms}",
'wt' => 'json',
'json.nl' => self::NAMED_LIST_FORMAT,
);
$url = $this
->constructUrl(self::LUKE_SERVLET, $params);
$this->luke[$num_terms] = $this
->sendRawGet($url);
if ($cid) {
cache_set($cid, $this->luke, 'cache_search_api_solr');
}
}
}
}