Skip to content

Commit

Permalink
Merge branch '4.0-dev' into 4.0-dev-fix-todo
Browse files Browse the repository at this point in the history
  • Loading branch information
laoneo committed Feb 4, 2019
2 parents bb2756f + 8617350 commit 9b438ed
Show file tree
Hide file tree
Showing 44 changed files with 415 additions and 369 deletions.
46 changes: 23 additions & 23 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ plugins/fields/* @laoneo
plugins/systems/fields/* @laoneo

# Smart Search
administrator/components/com_finder/* @mbabker
components/com_finder/* @mbabker
modules/mod_finder/* @mbabker
plugins/content/finder/* @mbabker
plugins/finder/* @mbabker
#administrator/components/com_finder/*
#components/com_finder/*
#modules/mod_finder/*
#plugins/content/finder/*
#plugins/finder/*

# Language strings
administrator/language/en-GB/* @brianteeman
Expand All @@ -28,33 +28,33 @@ plugins/editors/codemirror/* @okonomiyaki3000
plugins/system/stats/* @mbabker @wilsonge

# Release Tools
build.xml @mbabker
build/build.php @mbabker @rdeutz @wilsonge
build/bump.php @mbabker @rdeutz @wilsonge
build/deleted_file_check.php @mbabker @rdeutz @wilsonge
build.xml @wilsonge
build/build.php @rdeutz @wilsonge
build/bump.php @rdeutz @wilsonge
build/deleted_file_check.php @rdeutz @wilsonge

# Core/Extension Install/Update Tools
administrator/components/com_joomlaupdate/* @mbabker @rdeutz @wilsonge @zero-24
libraries/src/Installer/* @mbabker @rdeutz @wilsonge @zero-24
libraries/src/Updater/* @mbabker @rdeutz @wilsonge @zero-24
administrator/components/com_joomlaupdate/* @rdeutz @wilsonge @zero-24
libraries/src/Installer/* @rdeutz @wilsonge @zero-24
libraries/src/Updater/* @rdeutz @wilsonge @zero-24

# Automated Testing
build/jenkins/* @mbabker @rdeutz
build/travis/* @mbabker @rdeutz
build/jenkins/* @rdeutz
build/travis/* @rdeutz
tests/codeception/* @rdeutz
tests/javascript/* @dgt41 @rdeutz
tests/unit/* @mbabker @rdeutz
.appveyor.yml @mbabker @rdeutz
tests/javascript/* @dgrammatiko @rdeutz
tests/unit/* @rdeutz
.appveyor.yml @rdeutz
.drone.yml @rdeutz
.hound.yml @mbabker
.travis.yml @mbabker @rdeutz
appveyor-phpunit.xml @mbabker @rdeutz
.hound.yml @wilsonge
.travis.yml @rdeutz
appveyor-phpunit.xml @rdeutz
codeception.yml @rdeutz
karma.conf.js @dgt41 @rdeutz
phpunit.xml.dist @mbabker @rdeutz
karma.conf.js @dgrammatiko @rdeutz
phpunit.xml.dist @rdeutz
RoboFile.dist.ini @rdeutz
RoboFile.php @rdeutz
travis-phpunit.xml @mbabker @rdeutz
travis-phpunit.xml @rdeutz

# Core JS
media/*/js/* @dgt41
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE `#__finder_terms`
DROP INDEX `idx_term`,
ADD UNIQUE INDEX `idx_term` (`term`, `language`);
ALTER TABLE `#__finder_terms`
ADD INDEX `language` (`language`);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ALTER TABLE "#__finder_terms"
DROP CONSTRAINT "#__finder_terms_idx_term",
ADD CONSTRAINT "#__finder_terms_idx_term_language" UNIQUE ("term", "language");
CREATE INDEX "#__finder_terms_idx_language" on "#__finder_terms" ("language");
6 changes: 6 additions & 0 deletions administrator/components/com_contact/Table/ContactTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ public function check()
return false;
}

if (!$this->id)
{
// Hits must be zero on a new item
$this->hits = 0;
}

/*
* Clean up keywords -- eliminate extra spaces between phrases
* and cr (\r) and lf (\n) characters from string.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ function (Toolbar $childBar) use ($checkedOut, $itemEditable, $canDo)
);


echo '<input type="hidden" class="form-control" id="' . $modalId . '_name" type="text" value="">';
echo '<input type="hidden" class="form-control" id="' . $modalId . '_name" value="">';
echo '<input type="hidden" id="' . $modalId . '_id" value="0">';
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
<td style="width:1%" class="text-center">
<?php echo HTMLHelper::_('grid.checkall'); ?>
</td>
<th scope="col" style="width:1%" class="text-center">
<?php echo HTMLHelper::_('searchtools.sort', 'JFEATURED', 'a.featured', $listDirn, $listOrder); ?>
</th>
<th scope="col" style="width:1%" class="text-center">
<?php echo HTMLHelper::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
</th>
Expand Down Expand Up @@ -226,10 +229,12 @@
<td class="text-center">
<?php echo HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->title); ?>
</td>
<td class="text-center">
<?php echo $featuredButton->render($item->featured, $i, ['disabled' => !$canChange]); ?>
</td>
<td class="article-status">
<div class="d-flex">
<div class="btn-group tbody-icon mr-1">
<?php echo $featuredButton->render($item->featured, $i, ['disabled' => !$canChange]); ?>
<?php

$options = [
Expand Down
22 changes: 22 additions & 0 deletions administrator/components/com_finder/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,28 @@
<option value="">COM_FINDER_CONFIG_LANGUAGE_DEFAULT_NONE</option>
</field>

<field
name="filter_commonwords"
type="radio"
label="COM_FINDER_CONFIG_FILTER_COMMONWORDS_LABEL"
class="switcher"
default="0"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>

<field
name="filter_numerics"
type="radio"
label="COM_FINDER_CONFIG_FILTER_NUMERICS_LABEL"
class="switcher"
default="0"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>

</fieldset>

<fieldset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ public function index($item, $format = 'html')
' FROM ' . $db->quoteName('#__finder_tokens') . ' AS t1' .
' WHERE t1.context = %d' .
' ) AS t1' .
' JOIN ' . $db->quoteName('#__finder_tokens') . ' AS t2 ON t2.term = t1.term' .
' LEFT JOIN ' . $db->quoteName('#__finder_terms') . ' AS t ON t.term = t1.term' .
' JOIN ' . $db->quoteName('#__finder_tokens') . ' AS t2 ON t2.term = t1.term AND t2.language = t1.language' .
' LEFT JOIN ' . $db->quoteName('#__finder_terms') . ' AS t ON t.term = t1.term AND t.language = t1.language' .
' WHERE t2.context = %d' .
' GROUP BY t1.term, t.term_id, t1.term, t1.stem, t1.common, t1.phrase, t1.weight, t1.context, t1.language' .
' ORDER BY t1.term DESC';
Expand Down Expand Up @@ -347,7 +347,7 @@ public function index($item, $format = 'html')
*/
$query = $db->getQuery(true)
->update($db->quoteName('#__finder_tokens_aggregate') . ' AS ta')
->join('INNER', $db->quoteName('#__finder_terms') . ' AS t ON t.term = ta.term')
->join('INNER', $db->quoteName('#__finder_terms') . ' AS t ON t.term = ta.term AND t.language = ta.language')
->set('ta.term_id = t.term_id')
->where('ta.term_id = 0');
$db->setQuery($query);
Expand Down
34 changes: 24 additions & 10 deletions administrator/components/com_finder/helpers/indexer/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,26 +269,40 @@ public static function addContentType($title, $mime = null)
*/
public static function isCommon($token, $lang)
{
static $data;
static $default;
static $data, $default, $multilingual;

$langCode = $lang;
if (is_null($multilingual))
{
$multilingual = Multilanguage::isEnabled();
$config = ComponentHelper::getParams('com_finder');

if ($config->get('language_default', '') == '')
{
$default = '*';
}
elseif ($config->get('language_default', '') == '-1')
{
$default = self::getPrimaryLanguage(self::getDefaultLanguage());
}
else
{
$default = self::getPrimaryLanguage($config->get('language_default'));
}
}

// If language requested is wildcard, use the default language.
if ($lang == '*')
if (!$multilingual || $lang == '*')
{
$default = $default === null ? substr(self::getDefaultLanguage(), 0, 2) : $default;
$langCode = $default;
$lang = $default;
}

// Load the common tokens for the language if necessary.
if (!isset($data[$langCode]))
if (!isset($data[$lang]))
{
$data[$langCode] = self::getCommonWords($langCode);
$data[$lang] = self::getCommonWords($lang);
}

// Check if the token is in the common array.
return in_array($token, $data[$langCode], true);
return in_array($token, $data[$lang], true);
}

/**
Expand Down
29 changes: 26 additions & 3 deletions administrator/components/com_finder/helpers/indexer/indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

defined('_JEXEC') or die;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\String\StringHelper;

JLoader::register('FinderIndexerHelper', __DIR__ . '/helper.php');
Expand Down Expand Up @@ -483,8 +484,8 @@ private function tokenizeToDbShort($input, $context, $lang, $format, $count)
/**
* Method to add a set of tokens to the database.
*
* @param mixed $tokens An array or single FinderIndexerToken object.
* @param mixed $context The context of the tokens. See context constants. [optional]
* @param FinderIndexerToken[] $tokens An array or single FinderIndexerToken object.
* @param mixed $context The context of the tokens. See context constants. [optional]
*
* @return integer The number of tokens inserted into the database.
*
Expand All @@ -493,6 +494,15 @@ private function tokenizeToDbShort($input, $context, $lang, $format, $count)
*/
protected function addTokensToDb($tokens, $context = '')
{
static $filterCommon, $filterNumeric;

if (is_null($filterCommon))
{
$params = ComponentHelper::getParams('com_finder');
$filterCommon = $params->get('filter_commonwords', false);
$filterNumeric = $params->get('filter_numerics', false);
}

// Get the database object.
$db = $this->db;

Expand All @@ -514,6 +524,16 @@ protected function addTokensToDb($tokens, $context = '')
// Iterate through the tokens to create SQL value sets.
foreach ($tokens as $token)
{
if ($filterCommon && $token->common)
{
continue;
}

if ($filterNumeric && $token->numeric)
{
continue;
}

$query->values(
$db->quote($token->term) . ', '
. $db->quote($token->stem) . ', '
Expand All @@ -526,7 +546,10 @@ protected function addTokensToDb($tokens, $context = '')
++$values;
}

$db->setQuery($query)->execute();
if ($query->values)
{
$db->setQuery($query)->execute();
}
}

return $values;
Expand Down

0 comments on commit 9b438ed

Please sign in to comment.