Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c0c7655
Finder: Allow fuzzy word matching
Hackwar Jan 19, 2022
4c7ccd4
Update administrator/components/com_finder/config.xml
Hackwar Jan 20, 2022
c5f23d9
Update administrator/components/com_finder/src/Indexer/Query.php
Hackwar Jan 20, 2022
79d0d38
Reverting accidental change of todo
Hackwar Jan 20, 2022
6ab9cea
Reverting accidental deletion
Hackwar Jan 20, 2022
b7317b0
Merge branch '4.1-dev' into 4.2-finder-wordmatch
Hackwar Jan 20, 2022
25d4cee
Update administrator/components/com_finder/src/Indexer/Query.php
Hackwar Jan 24, 2022
13a25db
Merge branch '4.2-dev' into 4.2-finder-wordmatch
Hackwar Jan 24, 2022
cfbf6ef
Using strings to distinguish word matching modes
Hackwar Jan 26, 2022
09d5e1f
Update administrator/components/com_finder/config.xml
Hackwar Jan 26, 2022
c3f8e17
Update administrator/language/en-GB/com_finder.ini
Hackwar Jan 27, 2022
03e46d6
Update administrator/language/en-GB/com_finder.ini
Hackwar Jan 27, 2022
7e166c7
Update Query.php
Hackwar Feb 3, 2022
69f9152
Merge branch '4.2-dev' into 4.2-finder-wordmatch
Hackwar Feb 3, 2022
a51a36a
Update administrator/language/en-GB/com_finder.ini
Hackwar Feb 6, 2022
3dfada0
Update administrator/language/en-GB/com_finder.ini
Hackwar Feb 6, 2022
59f251b
Merge branch '4.2-dev' into 4.2-finder-wordmatch
richard67 Mar 10, 2022
7e56d0b
Merge branch '4.2-dev' into 4.2-finder-wordmatch
Hackwar Apr 2, 2022
f96ccc4
Merge branch '4.2-dev' of https://github.com/joomla/joomla-cms into 4…
Hackwar May 17, 2022
a1d1b4f
Fixing SQL
Hackwar May 17, 2022
f3a3c8f
Using prepared statements
Hackwar May 20, 2022
c809c80
Merge branch '4.2-dev' into 4.2-finder-wordmatch
Hackwar May 20, 2022
e0c7bd8
Merge branch '4.2-dev' into 4.2-finder-wordmatch
roland-d May 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions administrator/components/com_finder/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
description="COM_FINDER_CONFIG_WORD_MATCH_DESC"
default="0"
>
<option value="0">COM_FINDER_CONFIG_WORD_MATCH_OPTION_EXACT</option>
<option value="1">COM_FINDER_CONFIG_WORD_MATCH_OPTION_BEGIN</option>
<option value="2">COM_FINDER_CONFIG_WORD_MATCH_OPTION_FUZZY</option>
<option value="exact">COM_FINDER_CONFIG_WORD_MATCH_OPTION_EXACT</option>
<option value="begin">COM_FINDER_CONFIG_WORD_MATCH_OPTION_BEGIN</option>
<option value="fuzzy">COM_FINDER_CONFIG_WORD_MATCH_OPTION_FUZZY</option>
</field>

<field
Expand Down
16 changes: 8 additions & 8 deletions administrator/components/com_finder/src/Indexer/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class Query
/**
* Match search terms exactly or with a LIKE scheme
*
* @var integer
* @var string
* @since __DEPLOY_VERSION__
*/
public $wordmode;
Expand Down Expand Up @@ -205,7 +205,7 @@ public function __construct($options)
$this->mode = 'AND';

// Set the word matching mode
$this->wordmode = !empty($options['word_match']) ? $options['word_match'] : 0;
$this->wordmode = !empty($options['word_match']) ? $options['word_match'] : 'exact';

// Initialize the temporary date storage.
$this->dates = new Registry;
Expand Down Expand Up @@ -1357,18 +1357,18 @@ protected function getTokenData($token)

$searchTerm = $token->term;
$searchStem = $token->stem;
if ($this->wordmode == 1)

if ($this->wordmode == 'begin')
{
$searchTerm .= '%';
$searchStem .= '%';
}
elseif ($this->wordmode == 2)
elseif ($this->wordmode == 'fuzzy')
{
$searchTerm = '% . $searchTerm . '%';
$searchStem = '% . $searchStem . '%';
$searchTerm = '%' . $searchTerm . '%';
$searchStem = '%' . $searchStem . '%';
}

$query->where('(t.term = ' . $db->quote($searchTerm) . ' OR t.stem = ' . $db->quote($searchStem) . ')');
$query->where('t.phrase = 0')
->where('t.language IN (\'*\',' . $db->quote($token->language) . ')');
Expand Down
2 changes: 1 addition & 1 deletion components/com_finder/src/Model/SearchModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ protected function populateState($ordering = null, $direction = null)
$options['language'] = $request->getCmd('l', $params->get('l', $language->getTag()));

// Set the word match mode
$options['word_match'] = $params->get('word_match', 0);
$options['word_match'] = $params->get('word_match', 'exact');

// Get the start date and start date modifier filters.
$options['date1'] = $request->getString('d1', $params->get('d1', ''));
Expand Down