diff --git a/CHANGELOG.md b/CHANGELOG.md index e439741..71aa2e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# v2.0.31 + +- Fixed #10 so that exact search results now work correctly. +- Update scripture loader to version 3.0.3 + # v2.0.30 - Update scripture loader to version 3.0.2 diff --git a/README.md b/README.md index bbfb0f1..e2ca3d0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Get Bible (2.0.30) +# Get Bible (2.0.31) ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible") @@ -18,8 +18,8 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Get Bible](https://getbible.net) + *First Build*: 3rd December, 2015 -+ *Last Build*: 30th November, 2023 -+ *Version*: 2.0.30 ++ *Last Build*: 4th December, 2023 ++ *Version*: 2.0.31 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @@ -31,8 +31,8 @@ due to [Automated Component Builder](https://www.joomlacomponentbuilder.com)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **200920** -+ *File count*: **1742** ++ *Line count*: **200940** ++ *File count*: **1743** + *Folder count*: **167** **370 Hours** or **46 Eight Hour Days** (the actual time the author spent) diff --git a/admin/README.txt b/admin/README.txt index bbfb0f1..e2ca3d0 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -1,4 +1,4 @@ -# Get Bible (2.0.30) +# Get Bible (2.0.31) ![Get Bible image](https://git.vdm.dev/getBible/joomla-component/raw/branch/master/admin/assets/images/vdm-component.jpg "GetBible") @@ -18,8 +18,8 @@ In essence, The Bible for Joomla is designed to transform how the Word of God is + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Get Bible](https://getbible.net) + *First Build*: 3rd December, 2015 -+ *Last Build*: 30th November, 2023 -+ *Version*: 2.0.30 ++ *Last Build*: 4th December, 2023 ++ *Version*: 2.0.31 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @@ -31,8 +31,8 @@ due to [Automated Component Builder](https://www.joomlacomponentbuilder.com)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **200920** -+ *File count*: **1742** ++ *Line count*: **200940** ++ *File count*: **1743** + *Folder count*: **167** **370 Hours** or **46 Eight Hour Days** (the actual time the author spent) diff --git a/admin/sql/updates/mysql/2.0.30.sql b/admin/sql/updates/mysql/2.0.30.sql new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/admin/sql/updates/mysql/2.0.30.sql @@ -0,0 +1 @@ + diff --git a/getbible.xml b/getbible.xml index 006b29f..fb4b8db 100644 --- a/getbible.xml +++ b/getbible.xml @@ -1,15 +1,15 @@ COM_GETBIBLE - 30th November, 2023 + 4th December, 2023 Llewellyn van der Merwe joomla@vdm.io https://getbible.net Copyright (C) 2015. All Rights Reserved GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - 2.0.30 + 2.0.31 Get Bible (v.2.0.30) +

Get Bible (v.2.0.31)

Welcome to the next level of scripture engagement - The Bible for Joomla! Our purpose is to bring the Word of God to every person, in their native language, entirely free. This isn't just a typical extension; it's a groundbreaking tool developed to span language divides and deliver a rich, customizable Bible study experience to users worldwide. diff --git a/script.php b/script.php index dfc9590..48b7af3 100644 --- a/script.php +++ b/script.php @@ -1539,7 +1539,7 @@ class com_getbibleInstallerScript echo ' -

Upgrade to Version 2.0.30 Was Successful! Let us know if anything is not working as expected.

'; +

Upgrade to Version 2.0.31 Was Successful! Let us know if anything is not working as expected.

'; // Set db if not set already. if (!isset($db)) diff --git a/site/models/search.php b/site/models/search.php index e73ee6b..02a17e2 100644 --- a/site/models/search.php +++ b/site/models/search.php @@ -440,17 +440,23 @@ class GetbibleModelSearch extends ListModel // 3 = EXACT PHRASE elseif ($this->words == 3) { - if($this->match == 2) - { - // 2 = partial match - $search = $db->quote('%' . $db->escape($this->search, true) . '%'); - $conditions[] = '( ' . $case . ' a.text LIKE ' . $search . ')'; + // 2 = partial match + if ($this->match == 2) { + $words = $this->splitSentence($this->search); + $search = []; + foreach ($words as $word) { + $search[] = '%' . $db->escape($word, true) . '%'; + } + + // Construct the LIKE clause with wildcards between each word for partial matches + $conditions[] = '(' . $case . ' a.text LIKE ' . $db->quote(implode('%', $search)) . ')'; } - elseif($this->match == 1) + elseif ($this->match == 1) { - // exact match - $search = $case . ' a.text REGEXP ' . $db->quote('[[:<:]]' . $db->escape($this->search, true) . '[[:>:]]'); - $conditions[] = '( '. $search . ')'; + // 1 = exact match + // For exact phrase, escape and quote the entire phrase and use REGEXP to match it exactly + $search = $case . ' a.text REGEXP ' . $db->quote('[[:<:]]' . $db->escape($this->search, true) . '[[:>:]]'); + $conditions[] = '(' . $search . ')'; } } // 1 = ALL WORDS @@ -586,36 +592,26 @@ class GetbibleModelSearch extends ListModel $this->searchWords = array_map('mb_strtolower', $this->searchWords); } - // If we are looking for an exact match - if ($this->match == 1) + // 1 = exact match + if ($this->match == 3) { - if ($this->words == 3) + // The search string is considered as separate words + foreach ($this->searchWords as $search_word) { - // The search string is considered as one phrase - return $word == $this->search; - } - else - { - // The search string is considered as separate words - return in_array($word, $this->searchWords); + if ($word === $search_word) + { + return true; + } } } else { - if ($this->words == 3) + // The search string is considered as separate words + foreach ($this->searchWords as $search_word) { - // The search string is considered as one phrase - return mb_strpos($word, $this->search) !== false; - } - else - { - // The search string is considered as separate words - foreach ($this->searchWords as $search_word) + if (mb_strpos($word, $search_word) !== false) { - if (mb_strpos($word, $search_word) !== false) - { - return true; - } + return true; } } } diff --git a/update_server.xml b/update_server.xml index 9063d91..5e11a65 100644 --- a/update_server.xml +++ b/update_server.xml @@ -503,4 +503,22 @@ https://getbible.net + + Get Bible + The Bible for Joomla + pkg_getbible + package + site + 2.0.31 + https://getbible.net + + https://git.vdm.dev/api/v1/repos/getBible/joomla-pkg/archive/v2.0.31.zip + + + stable + + Llewellyn van der Merwe + https://getbible.net + + \ No newline at end of file