Index: branches/RC/core/install/install_schema.sql =================================================================== diff -u -N -r11121 -r11290 --- branches/RC/core/install/install_schema.sql (.../install_schema.sql) (revision 11121) +++ branches/RC/core/install/install_schema.sql (.../install_schema.sql) (revision 11290) @@ -961,4 +961,11 @@ KEY Enabled (Enabled), KEY ItemType (ItemType), KEY ResourceId (ResourceId) -); \ No newline at end of file +); + +CREATE TABLE StopWords ( + StopWordId int(11) NOT NULL auto_increment, + StopWord varchar(255) NOT NULL default '', + PRIMARY KEY (StopWordId), + KEY StopWord (StopWord) +); Index: branches/RC/core/install/remove_schema.sql =================================================================== diff -u -N -r11121 -r11290 --- branches/RC/core/install/remove_schema.sql (.../remove_schema.sql) (revision 11121) +++ branches/RC/core/install/remove_schema.sql (.../remove_schema.sql) (revision 11290) @@ -62,4 +62,5 @@ DROP TABLE StylesheetSelectors; DROP TABLE Visits; DROP TABLE ImportCache; -DROP TABLE RelatedSearches; \ No newline at end of file +DROP TABLE RelatedSearches; +DROP TABLE StopWords; \ No newline at end of file Index: branches/RC/core/units/general/helpers/rating_helper.php =================================================================== diff -u -N -r11092 -r11290 --- branches/RC/core/units/general/helpers/rating_helper.php (.../rating_helper.php) (revision 11092) +++ branches/RC/core/units/general/helpers/rating_helper.php (.../rating_helper.php) (revision 11290) @@ -8,7 +8,7 @@ * @var int */ var $ratingUnitWidth = 25; - var $ratingSmallUnitWidth = 10; + var $ratingSmallUnitWidth = 20; /** * Maximal star count Index: branches/RC/core/install/upgrades.sql =================================================================== diff -u -N -r11231 -r11290 --- branches/RC/core/install/upgrades.sql (.../upgrades.sql) (revision 11231) +++ branches/RC/core/install/upgrades.sql (.../upgrades.sql) (revision 11290) @@ -948,4 +948,18 @@ UPDATE Modules SET Path = 'core/', Version='4.3.9' WHERE Name = 'In-Portal'; UPDATE Skins SET Logo = 'just_logo.gif' WHERE Logo = 'just_logo_1.gif'; -UPDATE ConfigurationAdmin SET prompt = 'la_config_PathToWebsite' WHERE VariableName = 'Site_Path'; \ No newline at end of file +UPDATE ConfigurationAdmin SET prompt = 'la_config_PathToWebsite' WHERE VariableName = 'Site_Path'; + +# ===== v 5.0.0 ===== + +CREATE TABLE StopWords ( + StopWordId int(11) NOT NULL auto_increment, + StopWord varchar(255) NOT NULL default '', + PRIMARY KEY (StopWordId), + KEY StopWord (StopWord) +); + +INSERT INTO StopWords VALUES (90, '~'),(152, 'on'),(157, 'see'),(156, 'put'),(128, 'and'),(154, 'or'),(155, 'other'),(153, 'one'),(126, 'as'),(127, 'at'),(125, 'are'),(91, '!'),(92, '@'),(93, '#'),(94, '$'),(95, '%'),(96, '^'),(97, '&'),(98, '*'),(99, '('),(100, ')'),(101, '-'),(102, '_'),(103, '='),(104, '+'),(105, '['),(106, '{'),(107, ']'),(108, '}'),(109, '\\'),(110, '|'),(111, ';'),(112, ':'),(113, ''''),(114, '"'),(115, '<'),(116, '.'),(117, '>'),(118, '/'),(119, '?'),(120, 'ah'),(121, 'all'),(122, 'also'),(123, 'am'),(124, 'an'),(151, 'of'),(150, 'note'),(149, 'not'),(148, 'no'),(147, 'may'),(146, 'its'),(145, 'it'),(144, 'is'),(143, 'into'),(142, 'in'),(141, 'had'),(140, 'has'),(139, 'have'),(138, 'from'),(137, 'form'),(136, 'for'),(135, 'end'),(134, 'each'),(133, 'can'),(132, 'by'),(130, 'be'),(131, 'but'),(129, 'any'),(158, 'that'),(159, 'the'),(160, 'their'),(161, 'there'),(162, 'these'),(163, 'they'),(164, 'this'),(165, 'through'),(166, 'thus'),(167, 'to'),(168, 'two'),(169, 'too'),(170, 'up'),(171, 'where'),(172, 'which'),(173, 'with'),(174, 'were'),(175, 'was'),(176, 'you'),(177, 'yet'); + +INSERT INTO ConfigurationAdmin VALUES ('CheckStopWords', 'la_Text_Website', 'la_config_CheckStopWords', 'checkbox', '', '', 10.29, 0, 0); +INSERT INTO ConfigurationValues VALUES (DEFAULT, 'CheckStopWords', '0', 'In-Portal', 'in-portal:configure_general'); \ No newline at end of file Index: branches/RC/core/units/stop_words/stop_words_config.php =================================================================== diff -u -N --- branches/RC/core/units/stop_words/stop_words_config.php (revision 0) +++ branches/RC/core/units/stop_words/stop_words_config.php (revision 11290) @@ -0,0 +1,73 @@ + 'stop-word', + 'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'), + 'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'), + 'EventHandlerClass' => Array ('class' => 'kDBEventHandler', 'file' => '', 'build_event' => 'OnBuild'), + 'TagProcessorClass' => Array ('class' => 'kDBTagProcessor', 'file' => '', 'build_event' => 'OnBuild'), + + 'AutoLoad' => true, + + 'QueryString' => Array ( + 1 => 'id', + 2 => 'Page', + 3 => 'event', + 4 => 'mode', + ), + + 'IDField' => 'StopWordId', + + 'TableName' => TABLE_PREFIX.'StopWords', + + 'TitleField' => 'StopWord', + + 'TitlePresets' => Array ( + 'default' => Array ( + 'new_status_labels' => Array ('stop-word' => '!la_title_AddingStopWord!'), + 'edit_status_labels' => Array ('stop-word' => '!la_title_EditingStopWord!'), + ), + + 'stop_word_list' => Array ('prefixes' => Array ('stop-word_List'), 'format' => "!la_title_StopWords! (#stop-word_recordcount#)"), + 'stop_word_edit' => Array ('prefixes' => Array ('stop-word'), 'format' => "#stop-word_status# '#stop-word_titlefield#'"), + ), + + 'PermSection' => Array('main' => 'in-portal:stop_words'), + + 'Sections' => Array ( + 'in-portal:stop_words' => Array ( + 'parent' => 'in-portal:system', + 'icon' => 'custom', + 'label' => 'la_title_StopWords', + 'url' => Array('t' => 'stop_words/stop_word_list', 'pass' => 'm'), + 'permissions' => Array('view', 'add', 'edit', 'delete'), + 'priority' => 3.3, + 'type' => stTREE, + ), + ), + + 'ListSQLs' => Array ( + '' => ' SELECT %1$s.* %2$s FROM %1$s', + ), + + 'ListSortings' => Array ( + '' => Array ( + 'Sorting' => Array ('StopWord' => 'asc'), + ) + ), + + 'Fields' => Array ( + 'StopWordId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), + 'StopWord' => Array ('type' => 'string', 'unique' => Array (), 'max_len' => 255, 'required' => 1, 'not_null' => 1, 'default' => ''), + ), + + 'Grids' => Array ( + 'Default' => Array ( + 'Icons' => Array ('default' => 'icon16_custom.gif'), + 'Fields' => Array ( + 'StopWordId' => Array ('title' => 'la_col_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', ), + 'StopWord' => Array ('title' => 'la_col_StopWord', 'filter_block' => 'grid_like_filter',), + ), + ), + ), + ); \ No newline at end of file Index: branches/RC/core/units/general/helpers/search_helper.php =================================================================== diff -u -N -r11259 -r11290 --- branches/RC/core/units/general/helpers/search_helper.php (.../search_helper.php) (revision 11259) +++ branches/RC/core/units/general/helpers/search_helper.php (.../search_helper.php) (revision 11290) @@ -11,6 +11,14 @@ */ function splitKeyword($keyword) { + if ($this->Application->ConfigValue('CheckStopWords')) { + $keyword_after_remove = $this->_removeStopWords($keyword); + if ($keyword_after_remove) { + // allow to search through stop word grid + $keyword = $keyword_after_remove; + } + } + $quotes_re = '/([+\-]?)"(.*?)"/'; $no_quotes_re = '/([+\-]?)([^ ]+)/'; @@ -115,6 +123,32 @@ } /** + * Removes stop words from keyword + * + * @param string $keyword + * @return string + */ + function _removeStopWords($keyword) + { + static $stop_words = Array (); + + if (!$stop_words) { + $sql = 'SELECT StopWord + FROM ' . $this->Application->getUnitOption('stop-word', 'TableName') . ' + ORDER BY LENGTH(StopWord) DESC, StopWord ASC'; + $stop_words = $this->Conn->GetCol($sql); + + foreach ($stop_words as $index => $stop_word) { + $stop_words[$index] = '/(^| )' . preg_quote($stop_word, '/') . '( |$)/'; + } + } + + $keyword = preg_replace($stop_words, ' ', $keyword); + + return trim( preg_replace('/[ ]+/', ' ', $keyword) ); + } + + /** * Enter description here... * * @param kEvent $event Index: branches/RC/core/install/install_data.sql =================================================================== diff -u -N -r11208 -r11290 --- branches/RC/core/install/install_data.sql (.../install_data.sql) (revision 11208) +++ branches/RC/core/install/install_data.sql (.../install_data.sql) (revision 11290) @@ -1091,5 +1091,10 @@ INSERT INTO Counters VALUES (DEFAULT, 'guests_online', 'SELECT COUNT(*) FROM <%PREFIX%>UserSession WHERE PortalUserId <= 0', NULL , NULL , '3600', '0', '|UserSession|'); INSERT INTO Counters VALUES (DEFAULT, 'users_online', 'SELECT COUNT(*) FROM <%PREFIX%>UserSession', NULL , NULL , '3600', '0', '|UserSession|'); +INSERT INTO StopWords VALUES (90, '~'),(152, 'on'),(157, 'see'),(156, 'put'),(128, 'and'),(154, 'or'),(155, 'other'),(153, 'one'),(126, 'as'),(127, 'at'),(125, 'are'),(91, '!'),(92, '@'),(93, '#'),(94, '$'),(95, '%'),(96, '^'),(97, '&'),(98, '*'),(99, '('),(100, ')'),(101, '-'),(102, '_'),(103, '='),(104, '+'),(105, '['),(106, '{'),(107, ']'),(108, '}'),(109, '\\'),(110, '|'),(111, ';'),(112, ':'),(113, ''''),(114, '"'),(115, '<'),(116, '.'),(117, '>'),(118, '/'),(119, '?'),(120, 'ah'),(121, 'all'),(122, 'also'),(123, 'am'),(124, 'an'),(151, 'of'),(150, 'note'),(149, 'not'),(148, 'no'),(147, 'may'),(146, 'its'),(145, 'it'),(144, 'is'),(143, 'into'),(142, 'in'),(141, 'had'),(140, 'has'),(139, 'have'),(138, 'from'),(137, 'form'),(136, 'for'),(135, 'end'),(134, 'each'),(133, 'can'),(132, 'by'),(130, 'be'),(131, 'but'),(129, 'any'),(158, 'that'),(159, 'the'),(160, 'their'),(161, 'there'),(162, 'these'),(163, 'they'),(164, 'this'),(165, 'through'),(166, 'thus'),(167, 'to'),(168, 'two'),(169, 'too'),(170, 'up'),(171, 'where'),(172, 'which'),(173, 'with'),(174, 'were'),(175, 'was'),(176, 'you'),(177, 'yet'); + +INSERT INTO ConfigurationAdmin VALUES ('CheckStopWords', 'la_Text_Website', 'la_config_CheckStopWords', 'checkbox', '', '', 10.29, 0, 0); +INSERT INTO ConfigurationValues VALUES (DEFAULT, 'CheckStopWords', '0', 'In-Portal', 'in-portal:configure_general'); + INSERT INTO Modules VALUES ('Core', 'core/', 'adm', DEFAULT, 1, 1, '', 0, '0'); -INSERT INTO Modules VALUES ('In-Portal', 'core/', 'm', '4.3.9', 1, 0, '', 0, '0'); \ No newline at end of file +INSERT INTO Modules VALUES ('In-Portal', 'core/', 'm', '5.0.0', 1, 0, '', 0, '0'); \ No newline at end of file Index: branches/RC/core/admin_templates/stop_words/stop_word_edit.tpl =================================================================== diff -u -N --- branches/RC/core/admin_templates/stop_words/stop_word_edit.tpl (revision 0) +++ branches/RC/core/admin_templates/stop_words/stop_word_edit.tpl (revision 11290) @@ -0,0 +1,71 @@ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + + +
+
+ + Index: branches/RC/core/admin_templates/stop_words/stop_word_list.tpl =================================================================== diff -u -N --- branches/RC/core/admin_templates/stop_words/stop_word_list.tpl (revision 0) +++ branches/RC/core/admin_templates/stop_words/stop_word_list.tpl (revision 11290) @@ -0,0 +1,48 @@ + + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file