Commit Graph

132 Commits (afeff189b8a60bc775a4557e5bda003d8b54dc76)

Author SHA1 Message Date
Steven Wittens aa2de74fa2 - #27624, #27614, #27627: dead code 2005-07-29 08:18:20 +00:00
Steven Wittens 31ebc32982 - #27626: Correct function name 2005-07-29 06:43:32 +00:00
Steven Wittens 88ccaf02c4 - #27531: Leftover string_length(). 2005-07-27 01:27:09 +00:00
Steven Wittens 11a4aba9a6 - #26688: Add mbstring support to Drupal and clear up string handling fuzzies. 2005-07-25 20:40:35 +00:00
Dries Buytaert 58aee8cdad - Patch #25603 by Stefan: made the sizes of forms consistent.
TODO: document the defaults in the PHPdoc comments.
2005-06-27 18:33:33 +00:00
Dries Buytaert 3a02ee64b2 - Patch #22786 by mathias: now that db_affected_rows() returns the number of rows matched instead of only changed we can get rid of the hacks that worked around this. 2005-05-14 17:26:02 +00:00
Dries Buytaert a76a1e1f3f - Patch 20910 by chx: centralize print theme page. 2005-04-24 16:34:36 +00:00
Steven Wittens 00b04ba41c - Fix search index not wiping on admin settings change. 2005-04-23 07:34:22 +00:00
Steven Wittens 23bccfd1c8 - #4166: Respect 'access userlist' permission for profile data. 2005-04-11 22:48:27 +00:00
Dries Buytaert 7bdcba1720 - Patch #19739 by Uwe: corrected many typo's in the documentation and code comments 2005-03-31 21:18:08 +00:00
Steven Wittens be14203534 - #18817: Clean up plain-text checking (see drupal-devel!) 2005-03-31 09:25:33 +00:00
Steven Wittens a9091183e1 - Part of #17747 was not committed (pgsql fixes). 2005-03-29 03:28:02 +00:00
Steven Wittens 0805a476b3 - Use format_plural() for search status (items left to index) 2005-03-18 20:31:00 +00:00
Steven Wittens ab7815c8cd - #19063: Use module_implements instead of hand-rolled routine. 2005-03-18 06:50:41 +00:00
Steven Wittens 9d8badb8de - #18434: (search) Try wildcards automatically if there were no results.
- Fix missing format_plural()
2005-03-08 18:08:17 +00:00
Steven Wittens ff386b90bb #17747: PGSQL improvements 2005-02-28 18:00:59 +00:00
Steven Wittens 5f5f0b27ac - Oops: don't show refused words message if there are none. 2005-02-27 23:31:47 +00:00
Steven Wittens 4f196311c1 - Fix submissions from search boxes in themes 2005-02-27 18:39:18 +00:00
Steven Wittens 69262e5a73 - Search: fix search block stretching sidebar 2005-02-27 02:46:37 +00:00
Steven Wittens cd552adee0 More search usability improvements!
- Clean URLs: search/type/keywords e.g. "search/node/drupal release". The search
  form is POST submitted, but drupal_gotos to a GET page. This makes it easy to
  copy/paste search URLs, and makes the pager a lot cleaner.

- Remember the search keywords when switching between the search tabs. This is
  done through the same GET URLs rather than the session, so it does not mess up
  between multiple browser tabs.

- Report which keywords were ignored because they were too short.

- #820: Provide search block

- Treat multiple wildcards in a row as one
2005-02-27 02:15:57 +00:00
Dries Buytaert f276f7f95b - Stripped white-space. 2005-01-15 09:03:39 +00:00
Steven Wittens bf3c137097 Fixing search tabs going back to "content" when searching on other tabs. 2005-01-14 03:24:20 +00:00
Steven Wittens 5314b9a14c - Some search doxygen tweaks 2005-01-13 17:34:01 +00:00
Steven Wittens bf09864c5d - Readding cron note. 2005-01-11 09:46:51 +00:00
Steven Wittens 92bc08b5b9 - Make the search settings page more user-friendly. 2005-01-11 09:41:49 +00:00
Steven Wittens 410f301006 Tweak api.module output 2005-01-11 07:04:37 +00:00
Steven Wittens fc4e2487b8 Various additions, improvements and fixes to the search documentation. 2005-01-11 06:49:11 +00:00
Steven Wittens 0b8ff5d19f - Oopsie 2005-01-11 05:01:15 +00:00
Steven Wittens 857082ce7e - Ensure word length <= 50 bytes 2005-01-11 04:50:00 +00:00
Steven Wittens 854fa41fb3 - Fixing duplicate rows error during indexing
- Fixing broken "pagerank" detection
2005-01-11 03:37:13 +00:00
Steven Wittens 59a2c464c7 - Fix search excerpt highlighter marking substrings of words too + small improvements 2005-01-10 23:37:26 +00:00
Dries Buytaert 37d9be8f33 - Updated watchod call. 2005-01-09 10:07:17 +00:00
Dries Buytaert ceb20b45e5 - Small change 2004-12-31 09:31:54 +00:00
Dries Buytaert 1dbe0dc2ee - Patch #14917 by UnConeD/Steven:
1) The different types of search, which used to be radio button options in the search form, are now subtabs of "search" (default "search/node"). This seems better from a UI point of view, but also has another advantage: modules which implement a custom search form (flexinode, project) can add it as a subtab of search. This means that all search forms will be located in the same place, and also without needing an extra api call to search.module.

2) The current code was a bit hackish, as the indexing of comments along with nodes was hardcoded in node.module. Instead, I created a nodeapi operation "update index" which allows modules to add more data for a node that is being indexed. Comments are now indexed using this mechanism and from comment.module, which is a lot cleaner.

3) The search results format was also hardcoded to include "N comments". I replaced this with a nodeapi operation "search result" and moved the comment code to comment.module where it belongs. This op is quite useful, as for example I also modified upload.module to add "N attachments" to a search result if any are present.
2004-12-31 09:30:12 +00:00
Dries Buytaert 2b17b3a966 - Patch #13907 by Neil: less ways to set the page title.
* Less logic in theme code.
   * Encourages use of the menu system.
   * Easier to find where a title or breadcrumb comes from in other people's code because there are less places to look. Look in menu and then grep for the appropriate set function. Looking for calls to theme_page() is hard because there are too many of them.
   * Very slightly more efficient.
2004-12-15 21:19:42 +00:00
Dries Buytaert 6e3eb60aab - Removed some cruft: left-over xxx_help_page() functions. 2004-12-11 14:13:24 +00:00
Steven Wittens 925bd41585 Search: wrong parameter order on search_wipe(). 2004-12-02 06:45:18 +00:00
Dries Buytaert 29337ad8bb - Patch #13581 by Steven: Db_query() allows a variable amount of parameters so you can pass the query arguments in. There is however an alternative syntax: instead of passing the query arguments as function arguments, you can also pass a single array with the query arguments in it. For example the following two statements are equivalent:
db_query($query, $a, $b, $c);
db_query($query, array($a, $b, $c));

This usage is particularly interesting when the query is constructed dynamically, and the amount of arguments to pass varies. In that case we use the second method to avoid using call_user_func_array(). This behaviour is not documented explicitly, but it is used in several places.

However, db_query_range() and pager_query() do not support this syntax properly, which means there are several pieces of code which still revert to the ugly call_user_func_array() call.

This patch updates db_query_range() and pager_query() so they support the array-passing method. I also added documentation about this method to each of the db functions.

I also cleaned up the code for db_query (it was weird and hard to understand) and moved db_query() and db_queryd() from database.xxxxx.inc to database.inc: it was the same between both mysql and pgsql, as it doesn't do anything database specific. It just prefixes the tables and inserts the arguments. The actual db query is performed in _db_query(), which is still in database.xxxxx.inc.

Finally, I updated several places with the new syntax, and the code is a lot cleaner. For example:
- array_unshift($params, "SELECT u.* FROM {users} u WHERE $query u.status < 3");
- $params[] = 0;
- $params[] = 1;
- $result = call_user_func_array('db_query_range', $params);
+ $result = db_query_range("SELECT u.* FROM {users} u WHERE $query u.status < 3", $params, 0, 1);

and

- return call_user_func_array('db_query_range', array_merge(array($query), $args, array((int)$pager_from_array[$element], (int)$limit)));
+ return db_query_range($query, $args, (int)$pager_from_array[$element], (int)$limit);

I've tested it on mysql. I didn't alter the actual db behaviour, so pgsql should be okay too.

This patch is important because many people avoid the call_user_func_array() method and put data directly into the db query.  This is very, very bad because the database prefix will be applied to it, and strip out braces. It's also generally bad form as you have to call check_query() yourself.  With the new, documented syntax, there is no more excuse to put data directly in the query.
2004-11-29 13:13:29 +00:00
Dries Buytaert 4726c93156 - Patch #13443 by Moshe: got rid of the semi-implemented 'page link' feature. All themes currently support primary and secondary links so page links are now deprecated. Check your contributed modules and update them accordingly. 2004-11-24 22:56:21 +00:00
Steven Wittens dc32e54f31 Search.module:
- Caching index statistics
- Minor code cleanup
2004-11-18 21:28:34 +00:00
Dries Buytaert b6eee48c88 - Patch #12232 by Steven: more search improvements:
+ When a comment is posted, a node needs to be re-indexed. Luckily, we can use node_comment_statistics for this easily.
   + When a node is deleted, it should be deleted from the search index as well.
   + The search wipe didn't properly remove links to nodes from the index.
   + Section url was faulty in _help.
   + Minor code rearrangement.
2004-11-04 06:47:03 +00:00
Steven Wittens d13943e245 Fixing bad UTF-8. 2004-11-04 03:33:26 +00:00
Dries Buytaert bd6ae69345 - Patch by Steven:
+ Display 'friendly' name rather than module name in search watchdog
     messages.
   + Remove left-over from search_total table.
   + Add index wipe button to the admin
   + Moved the admin to admin/settings/search
   + Prevented menu bug when node modules update the breadcrumb in view
     (thanks JonBob).
   + Changed search_total table's word key to PRIMARY.
2004-11-03 16:46:58 +00:00
Dries Buytaert 8daed9cbf3 - Patch #12232 by Steven/UnConed: search module improvements.
1) Clean up the text analyser: make it handle UTF-8 and all sorts of characters. The word splitter now does intelligent splitting into words and supports all Unicode characters. It has smart handling of acronyms, URLs, dates, ...

2) It now indexes the filtered output, which means it can take advantage of HTML tags. Meaningful tags (headers, strong, em, ...) are analysed and used to boost certain words scores. This has the side-effect of allowing the indexing of PHP nodes.

3) Link analyser for node links. The HTML analyser also checks for links. If they point to a node on the current site (handles path aliases) then the link's words are counted as part of the target node. This helps bring out commonly linked FAQs and answers to the top of the results.

4) Index comments along with the node. This means that the search can make a difference between a single node/comment about 'X' and a whole thread about 'X'. It also makes the search results much shorter and more relevant (before this patch, comments were even shown first).

5) We now keep track of total counts as well as a per item count for a word. This allows us to divide the word score by the total before adding up the scores for different words, and automatically makes noisewords have less influence than rare words. This dramatically improves the relevancy of multiword searches. This also makes the disadvantage of now using OR searching instead of AND searching less problematic.

6) Includes support for text preprocessors through a hook. This is required to index Chinese and Japanese, because these languages do not use spaces between words. An external utility can be used to split these into words through a simple wrapper module. Other uses could be spell checking (although it would have no UI).

7) Indexing is now regulated: only a certain amount of items will be indexed per cron run. This prevents PHP from running out of memory or timing out. This also makes the reindexing required for this patch automatic. I also added an index coverage estimate to the search admin screen.

8) Code cleanup! Moved all the search stuff from common.inc into search.module, rewired some hooks and simplified the functions used. The search form and results now also use valid XHTML and form_ functions. The search admin was moved from search/configure to admin/search for consistency.

9) Improved search output: we also show much more info per item: date, author, node type, amount of comments and a cool dynamic excerpt à la Google. The search form is now much more simpler and the help is only displayed as tips when no search results are found.

10) By moving all search logic to SQL, I was able to add a pager to the search results. This improves usability and performance dramatically.
2004-10-31 03:03:27 +00:00
Steven Wittens a35ff36673 search: Removing iso-8859-1 characters from update_index() and adding the same stripping to do_search().
This fixes the embarrasing bug of not being able to search for "4.5.0" because it is indexed as "450".
2004-10-15 22:01:41 +00:00
Dries Buytaert 4a6e2258ba - Patch #10982 by TDobes: usability improvement: changed the link in search.module watchdog entries from "view results" to "results". This better matches watchdog entries from other modules. 2004-09-21 18:35:30 +00:00
Dries Buytaert 5c7983c4de - Patch #8179 by JonBob: reintroduced menu caching. 2004-09-16 07:17:56 +00:00
Dries Buytaert b84b6e42cf - Patch #10663 by JonBob: documentation improvements: fixed some typos and improved consistency to the use of Doxygen/api.module commands in the comments. 2004-09-09 05:51:08 +00:00
Dries Buytaert 94e30bf776 - Patch by JonBob: for consistency and readability, add brief descriptions of each source file inside the @file comment block at the head of the file. This helps with Doxygen indexing, and also allows neophytes to see what a file does immediately on opening the source, regardless of the organization of the hooks. 2004-08-21 06:42:38 +00:00
Dries Buytaert 83a739bd89 - Code improvements by Stefan: made all status messages consistent (and easier to translate). 2004-08-18 19:57:27 +00:00