/** * Lists fields that have highlighting applied on the found text. */ public final function onJSolrSearchHLAdd() { $hl = array(); foreach ($this->highlighting as $higlighting) { if ($higlighting) { $hl[] = \JSolr\Helper::localize($higlighting); } } return $hl; }
defined('_JEXEC') or die('Restricted access'); ?> <article class="jsolrsearch-result"> <header> <h4> <a href="<?php echo $this->item->link; ?> "><?php echo \JSolr\Helper::highlight($this->item->key, 'title', $this->item->title); ?> </a> </h4> </header> <p><?php echo \JSolr\Helper::highlight($this->item->key, \JSolr\Helper::localize('body_*')); ?> </p> <footer> <dl> <?php if ($this->item->created) { ?> <dt><?php echo JText::_("COM_JSOLRSEARCH_RESULT_CREATED_LABEL"); ?> </dt> <dd> <time datetime="<?php echo JFactory::getDate($this->item->created)->toISO8601(); ?>
<ul> <?php foreach ($this->items as $keyi => $valuei) { ?> <?php $field = JArrayHelper::getValue($operators, $keyi); ?> <?php foreach ($valuei as $keyj => $valuej) { ?> <?php $vars = array(JFactory::getApplication()->input->get('name') => Helper::getOriginalFacet($keyj), 'o' => JFactory::getApplication()->input->get('o')); if ($this->params->get('show_count')) { $facet = JText::sprintf('%s [%s]', Helper::getOriginalFacet($keyj), $valuej); } else { $facet = JText::sprintf('%s', Helper::getOriginalFacet($keyj)); } ?> <li><?php echo JHTML::_('link', JRoute::_(\JSolr\Search\Factory::getSearchRoute($vars)), $facet); ?> </li> <?php } ?> <?php } ?> </ul> </div>
/** * Gets a formatted facet based on the JSolrIndex configuration. * * @param string $facet * * @return string A formatted facet based on the JSolrIndex configuration. */ protected function getFacet($facet) { switch (intval($this->params->get('component.casesensitivity'))) { case 1: return JString::strtolower($facet); break; case 2: return \JSolr\Helper::toCaseInsensitiveFacet($facet); break; default: return $facet; break; } }
/** * (non-PHPdoc) * @see JFormFieldList::getOptions() */ protected function getOptions() { // Initialize variables. $options = array(); $facets = $this->getFacets(); foreach ($facets as $key => $value) { $html = array("<li>", "%s", "</li>"); $key = \JSolr\Helper::getOriginalFacet($key); if ($this->isSelected($key)) { $html = array("<li class=\"active\">", "%s", "</li>"); } $count = ''; if (JArrayHelper::getValue($this->element, 'count', 'false', 'string') === 'true') { $count = '<span>(' . $value . ')</span>'; } $facet = '<a href="' . $this->getFilterURI($key) . '">' . $key . '</a>' . $count; $options[] = JText::sprintf(implode($html), $facet); } reset($options); return $options; }