LIS618 last lecture building a search interface Thomas Krichel
structure of talk Build from an example. It is shaky at this time because of issues of UTF-8 encoding.
data is in a relational database mysql> describe ras_biwe_nodes; – | Field | Type | Null | Key | Default | Extra | – – | handle | varchar(10) | NO | PRI | | | – | name | varchar(100) | YES | | NULL | There are other fields in the table but these are the ones that we are interested in.
search box There is no general search option. The search only operates from the page of a given node. The search is to identify a destination node. The node can be found by handle or by name.
code A version of the code is available at 618/code/search.pm.html This a Perl module written to do the search. It’s geeky stuff written by yours truly.
finding by handle If somebody has registered with the RePEc Author Service, her record has a handle. That handle starts with a ‘p’. Then follow two letters that come from the person’s last name, usually the first two. The comes a number. This number increments. Thomas Krichel is pkr1.
search by handle When a user enders something of the form, p2ln where 2l are two lowercase letters and n is a number, we assume the user is givng as a handle to look for. We then try to find in the handle column of a handle that is identitical to the one that the user has entered can be found.
handle search result If the handle search gives us a handle, we have found the target person. We can then proceed to search for the shortest paths and show them to the searcher. Otherwise, we issue a polite error message. This is what function analyse_destination_as_handle does.
search by name This what the function analyse_destination_as_name does. It send a query to the database to find any name that contains the string searches. I.g. ‘ic’ will find krichel. It will also find a lot of other matches.
trim_results We are then trimming the results. First we look if there any words that are made up entirely of the query.
Thank you for your attention!