Stable versions of UAUTO and ULINK - weekly report 4 / 5

Events happening in the community are now at Drupal community events on www.drupal.org.
garthee's picture

You can download stable versions through cvs (project:ulink) or from http://www.theebgar.phpnet.us/drupal

Ksearch is stable now!

Having checked for bugs and features I would like to announce ksearch is in its stable form. As I have explained the uses and the implementation of ksearch in my previous posts I would like dedicate this post for How to Dos

How to Dos (ksearch – uauto.module)

User types the following

[l| will trigger the uauto and it will start to LISTEN to the input
[l|us having typed two letters, thus provided enough characters to uauto,
uauto will start ajax search for US. Since the type
of the input (node/ user / file ) cannot be determined it checks
url_alias first, followed by node
table (by default) particularly title field.

[l|user/ga Triggers the ajax search after a delay (waiting for
the user to type characters quickly if he wants) and searches for
url_alias followed by user table
as it can find the type.

User realizes he actually wanted the link to “useable menus” node title, therefore he backspaces upto “us” and types

[l|usea Triggers the ajax search and searches for url_alias
followed by node table as it cannot
find the type, finds the text is in the title of node/4
and returns node/4

Similarly user can use the following to find the actual links

  • Path alias or part of it.
  • User name or part of it (eg: user/ga) => user/garthee)
  • Node id or part of it (eg: node/1 => node/1, node/10, node/141)
  • Node title or part of it(eg: My li => node/5 (with title My life story)
  • File name or part of it (eg: files/dru =>files/drupal.png)
  • File path or part of it(eg: files/myphotos/s => files/myphotos/sunset.jpg)

New Addition

  • user can select the title of the node, name of the user or filename of the file for the text part automatically

Ie instead of
[l|my fi => [l|node/4 (because title is My files) followed by completing
[l|node/4|my files] user can optionally adding the title to the text part.

  • user can submit the attributes with macros, ie instead of typing lengthy attributes like title, class repeatedly they can add them to a macro and call them by typing
    [l-macroname|node/ …

Configurationally available options

Timeout how many seconds to wait before triggering the ajax search. This allows
the user to input enough character for the search before it gets triggered.
Limit search results to:
Number of results to be displayed to the user.

Dependencies

  • The module depends on ulink to render the [l|href|text|attr] to the actual implementation.
  • To be able to use Ajax search, user must have permissions for uauto access
  • Browser must support javascript, jQuery and CSS2. It has been tested successfully in apache server with IE6, FIREFOX 2, SAFARI 3.0 and Opera 9.

Future additions

  • improving the macro support by allowing the user to select the macro from the dropdown instead of typing them as available now
  • improving the macro support by providing a GUI, so that user can create new macros easily, where as now he has to enter them in an array.

Isearch is stable now!

Isearch has had numerous problems in development starting from the temporary tables issue addressed in [1] and handling extensive search time requirements. Hence I would like to first explain the development problems pertained to, followed by the How to Dos from user point of view.

Temporary Table issues

Drupal uses temporary tables for searches, ie when search is called including node_search which uses do_search, it creates the temporary tables and stores the results in that. Temporary tables are dropped only when connection is closed – here when drupal completes the page rendering.

However, in my module I search for all the possible words in the text at the same time. Hence it gives the same results as the results of the first search to all following. After searching for awhile and discussing with mentor, I found a way to overcome this, by explicitly dropping the temporary tables after using the results. In that way I am able to do number of node_searches within a single session.

<?php
      db_query_temporary
("DROP table IF EXISTS temp_search_sids"); 
     
db_query_temporary("DROP table IF EXISTS temp_search_results");
?>

Search time consumption

Search time was incredibly long. In testing, a search for a page with 100 words with 15+ possibly available keywords took more than 60 seconds that ajax refresh ran out of time and 25 words took around 30 seconds. And it was difficult to extract the keywords as type and context of the page may vary tremendously. Hence, I was forced search for new alternative.

I came up with a solution similar to the Ksearch – here when a word or phrase is double clicked or selected, a search is done and results are provided.

How to Dos (ksearch – uauto.module)

Highlight and select the keyword or phrase to add links. Search will be done, and results are provided in a popup menu.

User has the following options.
He can choose to apply the link to all similar words / phrases.
He can choose to cache the results which will result in faster response for future searches of the same word
He can choose the macro to be used. This macro will be used for all following Isearches if till user selects another.
He can also clear search to invoke a fresh search or save the memory.

configurationally available options

Allow root user to be referred whether root user account can be specified in the
links
Extensive node search: disable time consuming through node searches.
Limit search results to: Number of results to be displayed to the user.
Show this in the results the parameters used to denote the results such as a
snippet of the content matched, node title, etc.
Macros: here by entering the macros in an array format user
Avoid typing lengthy attributes again and again.

Dependencies

  • The module depends on ulink to render the [l|href|text|attr] to the actual implementation.
  • To be able to use Ajax search, user must have permissions for uauto access
  • Browser must support javascript, jQuery and CSS2. It has been tested successfully in apache server with IE6, FIREFOX 2, SAFARI 3.0 and Opera 9.
  • IE6 gives some problems in placing the windows near to the cursor position so that he need not scroll to the window. However a suitable static value is used currently.

New Addition

  • Full support for macro type implementation.

SoC 2007

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week