Attached Files |
search_all_keywords_483.patch [^] (3,942 bytes) 2011-11-01 05:47
[Show Content]
Index: install/english.lang
===================================================================
--- install/english.lang (revision 14707)
+++ install/english.lang (working copy)
@@ -179,6 +179,7 @@
<PHRASE Label="la_config_require_ssl" Module="Core" Type="1">UmVxdWlyZSBTU0wgZm9yIGxvZ2luICYgY2hlY2tvdXQ=</PHRASE>
<PHRASE Label="la_config_ResizableFrames" Module="Core" Type="1">RnJhbWVzIGluIGFkbWluaXN0cmF0aXZlIGNvbnNvbGUgYXJlIHJlc2l6YWJsZQ==</PHRASE>
<PHRASE Label="la_config_Search_MinKeyword_Length" Module="Core" Type="1">TWluaW1hbCBTZWFyY2ggS2V5d29yZCBMZW5ndGg=</PHRASE>
+ <PHRASE Label="la_config_SearchRequireAllKeywords" Module="Core" Type="1">U2VhcmNoIFJlcXVpcmUgQWxsIEtleXdvcmRz</PHRASE>
<PHRASE Label="la_config_SessionBrowserSignatureCheck" Module="Core" Type="1">U2Vzc2lvbiBTZWN1cml0eSBDaGVjayBiYXNlZCBvbiBCcm93c2VyIFNpZ25hdHVyZQ==</PHRASE>
<PHRASE Label="la_config_SessionCookieDomains" Module="Core" Type="1">U2Vzc2lvbiBDb29raWUgRG9tYWlucyAoc2luZ2xlIGRvbWFpbiBwZXIgbGluZSk=</PHRASE>
<PHRASE Label="la_config_SessionIPAddressCheck" Module="Core" Type="1">U2Vzc2lvbiBTZWN1cml0eSBDaGVjayBiYXNlZCBvbiBJUA==</PHRASE>
Index: install/install_data.sql
===================================================================
--- install/install_data.sql (revision 14707)
+++ install/install_data.sql (working copy)
@@ -132,6 +132,8 @@
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'CategoriesRebuildSerial', '0', 'In-Portal', '', '', '', '', NULL, NULL, 0, 0, 0, NULL);
+INSERT INTO ConfigurationValues VALUES (DEFAULT, 'SearchRequireAllKeywords', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_SearchRequireAllKeywords', 'checkbox', '', '', '10.10', '0', '0', NULL);
+
INSERT INTO ItemTypes VALUES (1, 'In-Portal', 'c', 'Category', 'Name', 'CreatedById', NULL, NULL, 'la_ItemTab_Categories', 1, 'admin/category/addcategory.php', 'clsCategory', 'Category');
INSERT INTO ItemTypes VALUES (6, 'In-Portal', 'u', 'PortalUser', 'Login', 'PortalUserId', NULL, NULL, '', 0, '', 'clsPortalUser', 'User');
Index: install/upgrades.sql
===================================================================
--- install/upgrades.sql (revision 14707)
+++ install/upgrades.sql (working copy)
@@ -2193,3 +2193,5 @@
UPDATE ConfigurationValues
SET DisplayOrder = DisplayOrder + 0.01
WHERE `Section` = 'in-portal:configure_advanced' AND Heading = 'la_section_SettingsWebsite';
+
+INSERT INTO ConfigurationValues VALUES (DEFAULT, 'SearchRequireAllKeywords', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_SearchRequireAllKeywords', 'checkbox', '', '', '10.10', '0', '0', NULL);
\ No newline at end of file
Index: units/categories/categories_event_handler.php
===================================================================
--- units/categories/categories_event_handler.php (revision 14707)
+++ units/categories/categories_event_handler.php (working copy)
@@ -256,6 +256,26 @@
$event->SetRedirectParam('opener', 'u');
}
+ protected function _ensureAllKeywords()
+ {
+ $keywords = $this->Application->GetVar('keywords');
+
+ if (!$keywords) {
+ return;
+ }
+ $a_keywords = explode(' ', $keywords);
+ foreach ($a_keywords AS $key => $keyword) {
+ $keyword = trim($keyword);
+
+ if (!in_array(substr($keyword, 1, 0), Array('+', '-'))) {
+ $keyword = '+'.$keyword;
+ }
+ $a_keywords[$key] = $keyword;
+ }
+ $this->Application->SetVar('keywords', join(' ', $a_keywords));
+ }
+
+
/**
* Apply system filter to categories list
*
@@ -524,6 +544,13 @@
$type = 'simple';
}
+ if (
+ $this->Application->GetVar('search_scope') == 'category'
+ && $this->Application->ConfigValue('SearchRequireAllKeywords')
+ ) {
+ $this->_ensureAllKeywords();
+ }
+
$search_event = $event_mapping[$type];
$this->$search_event($event);
search_all_keywords_483.2.patch [^] (4,835 bytes) 2011-11-02 09:02
[Show Content]
Index: install/english.lang
===================================================================
--- install/english.lang (revision 14719)
+++ install/english.lang (working copy)
@@ -171,6 +171,7 @@
<PHRASE Label="la_config_nopermission_template" Module="Core" Type="1">VGVtcGxhdGUgZm9yICJJbnN1ZmZpY2llbnQgUGVybWlzc2lvbnMiIEVycm9y</PHRASE>
<PHRASE Label="la_config_OutputCompressionLevel" Module="Core" Type="1">R1pJUCBjb21wcmVzc2lvbiBsZXZlbCAwLTk=</PHRASE>
<PHRASE Label="la_config_PathToWebsite" Module="Core" Type="1">UGF0aCB0byBXZWJzaXRl</PHRASE>
+ <PHRASE Label="la_config_PerformExactSearch" Module="Core" Type="1">UGVyZm9ybSBFeGFjdCBTZWFyY2g=</PHRASE>
<PHRASE Label="la_config_PerpageReviews" Module="Core" Type="1">Q29tbWVudHMgcGVyIHBhZ2U=</PHRASE>
<PHRASE Label="la_config_QuickCategoryPermissionRebuild" Module="Core" Type="1">UXVpY2sgU2VjdGlvbiBQZXJtaXNzaW9uIFJlYnVpbGQ=</PHRASE>
<PHRASE Label="la_config_RecycleBinFolder" Module="Core" Type="1">IlJlY3ljbGUgQmluIiBTZWN0aW9uSWQ=</PHRASE>
@@ -629,6 +630,7 @@
<PHRASE Label="la_hint_ImageFiles" Module="Core" Type="1">SW1hZ2UgRmlsZXM=</PHRASE>
<PHRASE Label="la_hint_MemcacheServers" Module="Core" Type="1">TXVsdGlwbGUgTWVtY2FjaGVkIHNlcnZlcnMgY2FuIGJlIGxpc3RlZCBzZXBhcmF0ZWQgYnkgc2VtaS1jb2xvbiAoOykuIEZvciBleGFtcGxlLCAxOTIuMTY4LjEuMToxMTIxOzE5Mi4xNjguMS4yOjExMjE7MTkyLjE2OC4xLjM6MTEyMQ==</PHRASE>
<PHRASE Label="la_hint_PageExpiration" Module="Core" Type="1">SG93IHNvb24gKGluIHNlY29uZHMpIHRoZSBzZWN0aW9uIGNhY2hlIHNob3VsZCBhdXRvLWV4cGlyZSBhZnRlciBpdCdzIGNyZWF0aW9uLiBCeSBkZWZhdWx0IHN5c3RlbSB0ZW5kcyB0byByZWJ1aWxkIHRoZSBjYWNoZSBvbmx5IHdoZW4gaXQncyBwcm9wZXJ0aWVzIG9yIGVsZW1lbnRzIGhhdmUgY2hhbmdlZC4=</PHRASE>
+ <PHRASE Label="la_hint_PerformExactSearch" Module="Core" Type="1">U2VhcmNoIGZvciBhbGwgZW50ZXJlZCBrZXl3b3JkcywgaW5zdGVhZCBvZiBhbnkgb25lIG9mIHRoZW0=</PHRASE>
<PHRASE Label="la_hint_PopPort" Module="Core" Type="1">UE9QMyBTZXJ2ZXIgUG9ydC4gRm9yIGV4LiAiMTEwIiBmb3IgcmVndWxhciBjb25uZWN0aW9uLCAiOTk1IiBmb3Igc2VjdXJlIGNvbm5lY3Rpb24u</PHRASE>
<PHRASE Label="la_hint_PopServer" Module="Core" Type="1">UE9QMyBTZXJ2ZXIgQWRkcmVzcy4gRm9yIGV4LiB1c2UgInNzbDovL3BvcC5nbWFpbC5jb20iIGZvciBHbWFpbCwgInBvcC5tYWlsLnlhaG9vLmNvbSIgZm9yIFlhaG9vLg==</PHRASE>
<PHRASE Label="la_hint_SSLUrl" Module="Core" Type="1">aHR0cHM6Ly93d3cuZG9tYWluLmNvbS9wYXRo</PHRASE>
Index: install/install_data.sql
===================================================================
--- install/install_data.sql (revision 14719)
+++ install/install_data.sql (working copy)
@@ -132,6 +132,8 @@
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'CategoriesRebuildSerial', '0', 'In-Portal', '', '', '', '', NULL, NULL, 0, 0, 0, NULL);
+INSERT INTO ConfigurationValues VALUES (DEFAULT, 'PerformExactSearch', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_PerformExactSearch', 'checkbox', '', '', '10.10', '0', '0', 'la_hint_PerformExactSearch');
+
INSERT INTO ItemTypes VALUES (1, 'In-Portal', 'c', 'Category', 'Name', 'CreatedById', NULL, NULL, 'la_ItemTab_Categories', 1, 'admin/category/addcategory.php', 'clsCategory', 'Category');
INSERT INTO ItemTypes VALUES (6, 'In-Portal', 'u', 'PortalUser', 'Login', 'PortalUserId', NULL, NULL, '', 0, '', 'clsPortalUser', 'User');
Index: install/upgrades.sql
===================================================================
--- install/upgrades.sql (revision 14719)
+++ install/upgrades.sql (working copy)
@@ -2193,3 +2193,5 @@
UPDATE ConfigurationValues
SET DisplayOrder = DisplayOrder + 0.01
WHERE `Section` = 'in-portal:configure_advanced' AND Heading = 'la_section_SettingsWebsite';
+
+INSERT INTO ConfigurationValues VALUES (DEFAULT, 'PerformExactSearch', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_PerformExactSearch', 'checkbox', '', '', '10.10', '0', '0', 'la_hint_PerformExactSearch');
Index: units/helpers/search_helper.php
===================================================================
--- units/helpers/search_helper.php (revision 14719)
+++ units/helpers/search_helper.php (working copy)
@@ -18,6 +18,20 @@
/**
+ * Perform Exact Search flag
+ *
+ * @var bool
+ */
+ protected $_perform_exact_search = true;
+
+ public function __construct()
+ {
+ parent::__construct();
+
+ $this->_perform_exact_search = $this->Application->ConfigValue('PerformExactSearch');
+ }
+
+ /**
* Splits search phrase into keyword using quotes,plus and minus sings and spaces as split criteria
*
* @param string $keyword
@@ -50,6 +64,14 @@
$final[$kw] = $res[1][$index];
}
+ if ($this->_perform_exact_search) {
+ foreach ($final AS $kw => $plus_minus) {
+ if (!$plus_minus) {
+ $final[$kw] = '+';
+ }
+ }
+ }
+
return $final;
}
search_all_keywords_v3.patch [^] (5,807 bytes) 2011-11-03 06:25
[Show Content]
Index: install/english.lang
===================================================================
--- install/english.lang (revision 14728)
+++ install/english.lang (working copy)
@@ -171,6 +171,7 @@
<PHRASE Label="la_config_nopermission_template" Module="Core" Type="1">VGVtcGxhdGUgZm9yICJJbnN1ZmZpY2llbnQgUGVybWlzc2lvbnMiIEVycm9y</PHRASE>
<PHRASE Label="la_config_OutputCompressionLevel" Module="Core" Type="1">R1pJUCBjb21wcmVzc2lvbiBsZXZlbCAwLTk=</PHRASE>
<PHRASE Label="la_config_PathToWebsite" Module="Core" Type="1">UGF0aCB0byBXZWJzaXRl</PHRASE>
+ <PHRASE Label="la_config_PerformExactSearch" Module="Core" Type="1">UGVyZm9ybSBFeGFjdCBTZWFyY2g=</PHRASE>
<PHRASE Label="la_config_PerpageReviews" Module="Core" Type="1">Q29tbWVudHMgcGVyIHBhZ2U=</PHRASE>
<PHRASE Label="la_config_QuickCategoryPermissionRebuild" Module="Core" Type="1">UXVpY2sgU2VjdGlvbiBQZXJtaXNzaW9uIFJlYnVpbGQ=</PHRASE>
<PHRASE Label="la_config_RecycleBinFolder" Module="Core" Type="1">IlJlY3ljbGUgQmluIiBTZWN0aW9uSWQ=</PHRASE>
@@ -631,6 +632,7 @@
<PHRASE Label="la_hint_ImageFiles" Module="Core" Type="1">SW1hZ2UgRmlsZXM=</PHRASE>
<PHRASE Label="la_hint_MemcacheServers" Module="Core" Type="1">TXVsdGlwbGUgTWVtY2FjaGVkIHNlcnZlcnMgY2FuIGJlIGxpc3RlZCBzZXBhcmF0ZWQgYnkgc2VtaS1jb2xvbiAoOykuIEZvciBleGFtcGxlLCAxOTIuMTY4LjEuMToxMTIxOzE5Mi4xNjguMS4yOjExMjE7MTkyLjE2OC4xLjM6MTEyMQ==</PHRASE>
<PHRASE Label="la_hint_PageExpiration" Module="Core" Type="1">SG93IHNvb24gKGluIHNlY29uZHMpIHRoZSBzZWN0aW9uIGNhY2hlIHNob3VsZCBhdXRvLWV4cGlyZSBhZnRlciBpdCdzIGNyZWF0aW9uLiBCeSBkZWZhdWx0IHN5c3RlbSB0ZW5kcyB0byByZWJ1aWxkIHRoZSBjYWNoZSBvbmx5IHdoZW4gaXQncyBwcm9wZXJ0aWVzIG9yIGVsZW1lbnRzIGhhdmUgY2hhbmdlZC4=</PHRASE>
+ <PHRASE Label="la_hint_PerformExactSearch" Module="Core" Type="1">U2VhcmNoIGZvciBhbGwgZW50ZXJlZCBrZXl3b3JkcywgaW5zdGVhZCBvZiBhbnkgb25lIG9mIHRoZW0=</PHRASE>
<PHRASE Label="la_hint_PopPort" Module="Core" Type="1">UE9QMyBTZXJ2ZXIgUG9ydC4gRm9yIGV4LiAiMTEwIiBmb3IgcmVndWxhciBjb25uZWN0aW9uLCAiOTk1IiBmb3Igc2VjdXJlIGNvbm5lY3Rpb24u</PHRASE>
<PHRASE Label="la_hint_PopServer" Module="Core" Type="1">UE9QMyBTZXJ2ZXIgQWRkcmVzcy4gRm9yIGV4LiB1c2UgInNzbDovL3BvcC5nbWFpbC5jb20iIGZvciBHbWFpbCwgInBvcC5tYWlsLnlhaG9vLmNvbSIgZm9yIFlhaG9vLg==</PHRASE>
<PHRASE Label="la_hint_SSLUrl" Module="Core" Type="1">aHR0cHM6Ly93d3cuZG9tYWluLmNvbS9wYXRo</PHRASE>
Index: install/install_data.sql
===================================================================
--- install/install_data.sql (revision 14728)
+++ install/install_data.sql (working copy)
@@ -41,6 +41,7 @@
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'CheckStopWords', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_CheckStopWords', 'checkbox', '', '', 10.07, 0, 0, NULL);
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'UseVisitorTracking', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_UseVisitorTracking', 'checkbox', '', '', 10.08, 0, 0, NULL);
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'cms_DefaultTrackingCode', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_DefaultTrackingCode', 'textarea', NULL, 'COLS=40 ROWS=5', 10.09, 0, 0, NULL);
+INSERT INTO ConfigurationValues VALUES(DEFAULT, 'PerformExactSearch', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_PerformExactSearch', 'checkbox', '', '', '10.10', 0, 0, 'la_hint_PerformExactSearch');
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'CookieSessions', '2', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSession', 'la_prompt_session_management', 'select', NULL, '0=lu_opt_QueryString||1=lu_opt_Cookies||2=lu_opt_AutoDetect', 20.01, 0, 1, NULL);
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'SessionCookieName', 'sid', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSession', 'la_prompt_session_cookie_name', 'text', '', '', 20.02, 0, 1, NULL);
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'SessionCookieDomains', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsSession', 'la_config_SessionCookieDomains', 'textarea', '', 'rows="5" cols="40"', 20.021, 0, 0, NULL);
Index: install/upgrades.sql
===================================================================
--- install/upgrades.sql (revision 14728)
+++ install/upgrades.sql (working copy)
@@ -2235,3 +2235,5 @@
UPDATE ConfigurationValues
SET VariableValue = IF(VariableValue = 1, 0, 1)
WHERE VariableName = 'RegistrationUsernameRequired';
+
+INSERT INTO ConfigurationValues VALUES (DEFAULT, 'PerformExactSearch', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsWebsite', 'la_config_PerformExactSearch', 'checkbox', '', '', '10.10', 0, 0, 'la_hint_PerformExactSearch');
\ No newline at end of file
Index: units/helpers/search_helper.php
===================================================================
--- units/helpers/search_helper.php (revision 14718)
+++ units/helpers/search_helper.php (working copy)
@@ -16,7 +16,21 @@
class kSearchHelper extends kHelper {
+ /**
+ * Perform Exact Search flag
+ *
+ * @var bool
+ * @access protected
+ */
+ protected $_performExactSearch = true;
+ public function __construct()
+ {
+ parent::__construct();
+
+ $this->_performExactSearch = $this->Application->ConfigValue('PerformExactSearch');
+ }
+
/**
* Splits search phrase into keyword using quotes,plus and minus sings and spaces as split criteria
*
@@ -50,6 +64,14 @@
$final[$kw] = $res[1][$index];
}
+ if ( $this->_performExactSearch ) {
+ foreach ($final AS $kw => $plus_minus) {
+ if ( !$plus_minus ) {
+ $final[$kw] = '+';
+ }
+ }
+ }
+
return $final;
}
|