Monday, April 10, 2006

Anagrams are easy!

The latest addition to the wirdz dictionary set is a crossword word search.

This is based on the same AJAX framework as the main dictionary engine, giving "instant" response as text is entered. It handles both anagrams and wild card searches. The rule is simple: if the term contains a wild card, it's a wild card search - otherwise look for an anagram. (Anagrams with wild cards? - fuggedaboudit!)

Anagrams are handled by including a field in the database with the letters of the word/term sorted in alphabetical order. This makes look-ups extremely fast.

For wild card searches the word-list table is indexed by term length and contains a number of indexed fields based on the original term to make look ups faster. The result: super fast display updates as new letters or wild cards are typed. AJAX and MySQL is a very powerful combo.

Since we don't have telnet or ssh access to the host server, loading the worldlist table had to be carried out using remote MySQL access. If you haven't come across it before, check out the MySQL LOAD DATA INFILE command. Using this with a local comma separated file loaded nearly 250000 records in short order and much faster than running a local insert script or using remote ODBC or JDBC connections.

0 Comments:

Post a Comment

<< Home