Logging the click data

James Aylett james-xapian at tartarus.org
Wed Jun 14 20:11:51 BST 2017

On 14 Jun 2017, at 00:17, Vivek Pal <vivekpal.dtu at gmail.com> wrote:

> I've completed the first step of logging the click data i.e. logging
> separate entries for each executed search from the query template.
> More on that progress here [1].

Great! When we come to merge this, we'll probably want to have a "letor-enabled" template (or maybe "clickstream enabled"), so people can choose between that and the simpler default query template.

> Now for the next step, i.e. logging the query IDs and click URL on each
> click event, as planned, I created a new template which has another log
> command [2].

Easier than passing in the entire query string would be to pass in the pre-calculated qid.

> To redirect to the clicklog template, we could add an onClick
> event inside the <a> tag in line 109 in the query template [3] which calls
> an external javascript function something like this one [4] to redirect to
> the clicklog template.

I'm generally opposed to using Javascript when you can do this instead:

 * in the query template, at the place you've indicated, change the href to point back to omega.cgi, specifying the second template and passing through as CGI parameters the qid and docid, and also the URL (to avoid having to look it up from the database)
 * the second query template can then cause the omega CGI to redirect to the final URL; you can look a CGI parameter up using $cgi{PARAMNAME}, and set an HTTP header using $httpheader{}. The only thing you cannot do is to change the HTTP status code, so you'll need a new omegascript command for that. (You could probably have $httpredirect{URL}, avoiding having to have a separate $httpheader{}.)


 James Aylett, occasional troublemaker & project governance

More information about the Xapian-devel mailing list