From a32d0800a731b4ec5b0fee6d9d2e33855121ca99 Mon Sep 17 00:00:00 2001 From: HK321 Date: Wed, 8 Aug 2018 19:56:28 +0500 Subject: [PATCH 1/4] Fix on category less search --- components/com_jsolr/site/models/search.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/com_jsolr/site/models/search.php b/components/com_jsolr/site/models/search.php index d79c16e..e0ad452 100755 --- a/components/com_jsolr/site/models/search.php +++ b/components/com_jsolr/site/models/search.php @@ -493,9 +493,9 @@ public function getAppliedFacetFilters() foreach ($this->getForm()->getFieldset('facets') as $facet) { if (array_search("JSolr\Form\Fields\Facetable", class_implements($facet)) !== false) { - if ($facet->value) { + $fields[] = $facet; - } + } } From 818154a620b639c152cf899319d8f2671e3b59af Mon Sep 17 00:00:00 2001 From: HK321 Date: Thu, 9 Aug 2018 13:59:09 +0500 Subject: [PATCH 2/4] Fixes on Facet value --- components/com_jsolr/site/models/search.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/com_jsolr/site/models/search.php b/components/com_jsolr/site/models/search.php index e0ad452..e8ea8c5 100755 --- a/components/com_jsolr/site/models/search.php +++ b/components/com_jsolr/site/models/search.php @@ -493,8 +493,12 @@ public function getAppliedFacetFilters() foreach ($this->getForm()->getFieldset('facets') as $facet) { if (array_search("JSolr\Form\Fields\Facetable", class_implements($facet)) !== false) { - + if(isset($facet->value)){ $fields[] = $facet; + }else{ + $fields[] = $facet; + + } } } From 0b87056e1d7d55d2368d1f0e177e6a05b3ae5cba Mon Sep 17 00:00:00 2001 From: HK321 Date: Sun, 12 Aug 2018 18:03:48 +0500 Subject: [PATCH 3/4] Removed isset check --- components/com_jsolr/site/models/search.php | 66 ++++++++++----------- 1 file changed, 30 insertions(+), 36 deletions(-) diff --git a/components/com_jsolr/site/models/search.php b/components/com_jsolr/site/models/search.php index e8ea8c5..71a6642 100755 --- a/components/com_jsolr/site/models/search.php +++ b/components/com_jsolr/site/models/search.php @@ -32,7 +32,7 @@ public function __construct($config = array()) { parent::__construct($config); - $this->context = $this->option.'.'.$this->name; + $this->context = $this->option . '.' . $this->name; JFactory::getApplication()->setUserState('com_jsolr.search.results', null); @@ -159,8 +159,8 @@ public function getQuery() $query ->addFilterQuery( array( - 'key'=>'access', - 'query'=>'access_i:'.'('.$access.') OR null')); + 'key' => 'access', + 'query' => 'access_i:' . '(' . $access . ') OR null')); } } @@ -168,16 +168,16 @@ public function getQuery() $query ->addFilterQuery( array( - 'key'=>'lang', - 'query'=>'lang_s:('.$lang. " OR *)")); + 'key' => 'lang', + 'query' => 'lang_s:(' . $lang . " OR *)")); } if ($fq = $params->get('fq')) { $query ->addFilterQuery( array( - 'key'=>'param_fq', - 'query'=>$fq)); + 'key' => 'param_fq', + 'query' => $fq)); } if ($pf = $params->get('pf')) { @@ -246,7 +246,7 @@ public function getQuery() JFactory::getApplication()->setUserState('com_jsolr.search.results', $this->cache[$store]); } catch (Exception $e) { - JLog::add($e->getCode().' '.$e->getMessage(), JLog::ERROR, 'jsolr'); + JLog::add($e->getCode() . ' ' . $e->getMessage(), JLog::ERROR, 'jsolr'); JLog::add((string)$e, JLog::ERROR, 'jsolr'); throw $e; @@ -358,38 +358,38 @@ public function getPagination() * different modules that might need different sets of data or different * ordering requirements. * - * @param string $id An identifier string to generate the store id. + * @param string $id An identifier string to generate the store id. * * @return string A store id. */ protected function getStoreId($id = '') { // Add some of the querying params to the store id. - $id .= ':'.$this->getState('query.q'); + $id .= ':' . $this->getState('query.q'); if ($params = $this->getState('params')) { - $id .= ':'.$params->get('fq'); + $id .= ':' . $params->get('fq'); } if ($dimension = $this->getState('query.dimension')) { - $id .= ':'.$dimension; + $id .= ':' . $dimension; } // Add the list state to the store id. - $id .= ':'.$this->getState('list.start'); - $id .= ':'.$this->getState('list.limit'); - $id .= ':'.$this->getState('list.ordering'); - $id .= ':'.$this->getState('list.direction'); + $id .= ':' . $this->getState('list.start'); + $id .= ':' . $this->getState('list.limit'); + $id .= ':' . $this->getState('list.ordering'); + $id .= ':' . $this->getState('list.direction'); - return md5($this->context.':'.$id); + return md5($this->context . ':' . $id); } /** * Method to get the search form. * - * @param array $data An optional array of data for the form to + * @param array $data An optional array of data for the form to * interrogate. - * @param bool $loadData True if the form is to load its own data + * @param bool $loadData True if the form is to load its own data * (default case), false if not. * * @return JForm A JForm object on success, false on failure. @@ -400,7 +400,7 @@ public function getForm($data = array(), $loadData = true) return $this->form; } - $context = $this->get('option').'.'.$this->getName(); + $context = $this->get('option') . '.' . $this->getName(); // load a custom form xml based on the dimension alias. $source = 'search'; @@ -408,7 +408,7 @@ public function getForm($data = array(), $loadData = true) if ($alias = $this->getState('query.dimension')) { if ($table = $this->fetchDimension($alias)) { $template = JFactory::getApplication()->getTemplate(); - $overridePath = JPATH_ROOT.'/templates/'.$template.'/html/com_jsolr/forms/'.$table->alias.'.xml'; + $overridePath = JPATH_ROOT . '/templates/' . $template . '/html/com_jsolr/forms/' . $table->alias . '.xml'; if (JFile::exists($overridePath)) { $source = $table->alias; @@ -416,7 +416,7 @@ public function getForm($data = array(), $loadData = true) } } - $this->form = $this->loadForm($context, $source, array('load_data'=>$loadData)); + $this->form = $this->loadForm($context, $source, array('load_data' => $loadData)); if (empty($this->form)) { return false; @@ -439,7 +439,7 @@ protected function loadFormData() $data = $query; } - $context = $this->get('option').'.'.$this->getName(); + $context = $this->get('option') . '.' . $this->getName(); if (version_compare(JVERSION, "3.0", "ge")) { $this->preprocessData($this->get('context'), $data); @@ -451,7 +451,7 @@ protected function loadFormData() /** * Get's the language, either from the item or from the Joomla environment. * - * @param bool $includeRegion True if the region should be included, false + * @param bool $includeRegion True if the region should be included, false * otherwise. E.g. If true, en-AU would be returned, if false, just en * would be returned. * @@ -467,12 +467,12 @@ protected function getLanguage($lang, $includeRegion = true) } if ($includeRegion) { - $result = $lang; + $result = $lang; } else { $parts = explode('-', $lang); // just return the xx part of the xx-XX language. - $result = JArrayHelper::getValue($parts, 0); + $result = JArrayHelper::getValue($parts, 0); } if (empty($result)) { @@ -493,13 +493,7 @@ public function getAppliedFacetFilters() foreach ($this->getForm()->getFieldset('facets') as $facet) { if (array_search("JSolr\Form\Fields\Facetable", class_implements($facet)) !== false) { - if(isset($facet->value)){ - $fields[] = $facet; - }else{ - $fields[] = $facet; - - } - + $fields[] = $facet; } } @@ -575,7 +569,7 @@ public function getDimensions() /** * Fetch the dimension based on the alias. * - * @param string $alias The dimension alias. + * @param string $alias The dimension alias. * * @return JSolrTableDimension The dimension record or null if no record * is found. @@ -584,7 +578,7 @@ private function fetchDimension($alias) { $table = $this->getTable('Dimension', 'JSolrTable'); - if ($table->load(array('alias'=>$alias))) { + if ($table->load(array('alias' => $alias))) { return $table; } else { return null; @@ -611,7 +605,7 @@ public function getDimensionTemplate() if ($alias = $this->getState('query.dimension')) { if ($table = $this->fetchDimension($alias)) { $template = JFactory::getApplication()->getTemplate(); - $overridePath = JPATH_ROOT.'/templates/'.$template.'/html/com_jsolr/search/results_'.$table->alias.'.php'; + $overridePath = JPATH_ROOT . '/templates/' . $template . '/html/com_jsolr/search/results_' . $table->alias . '.php'; if (JFile::exists($overridePath)) { $tmpl = $table->alias; From 751695fa268fd34ce20142ca2a71742af2cc1ef9 Mon Sep 17 00:00:00 2001 From: HK321 Date: Mon, 13 Aug 2018 10:46:18 +0500 Subject: [PATCH 4/4] fix --- components/com_jsolr/site/models/search.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/com_jsolr/site/models/search.php b/components/com_jsolr/site/models/search.php index e8ea8c5..ec40350 100755 --- a/components/com_jsolr/site/models/search.php +++ b/components/com_jsolr/site/models/search.php @@ -493,13 +493,13 @@ public function getAppliedFacetFilters() foreach ($this->getForm()->getFieldset('facets') as $facet) { if (array_search("JSolr\Form\Fields\Facetable", class_implements($facet)) !== false) { - if(isset($facet->value)){ + if (isset($facet->value)) { $fields[] = $facet; - }else{ - $fields[] = $facet; + } else { + $fields[] = $facet; + + } - } - } }