Funnelback logo

Documentation

Query transformations

Introduction

The Funnelback search engine has a query transform capability allowing users to modify queries prior to processing.

When using the Classic user interface, incoming search queries will be arbitrarily pre-processed by Perl code that is customisable by users. The broad aim of this capability is to enable the search engine to respond more precisely to users needs instead of just returning a ranked document list with query biased snippets.

The same effect can be achieved with the Modern interface using user interface hook scripts.

How to use query transformation

Each collection will have an optional file called query_transform.cfg which can be edited using the normal file-manager. Any Perl code can be used in this file to allow users to manipulate search queries immediately before they are processed. The following reserved variables may be used as required.

Reserved variables:

@query = ('word1', 'word2', '+compulsoryword', '"a phrase"', 't:title', '[this orthat]');    

Any changes to this variable will affect the query processing.

  • $halt : Set this to "true" to halt query processing and display the initial search form.
  • $transform_output : Any text set here will appear where the <s:CustomText></s:CustomText> tag appears in the search form.

To view text from the $transform_output variable set during query transformation, insert the following tag in the search form where required.

 <s:CustomText></s:CustomText>

Notes

Any syntax errors in this file will result in this file not having any effect at all. It is recommended to only change one line at a time and test the change.

The syntax can be checked by running the following on the command line:

 perl -c C:\Funnelback\search\conf\<collection>\query_transform.cfg

To assist with debugging, it sometimes helps to see the query before and after it has been transformed. This can be done using the following code (text appears at top of search form):

 print "BEFORE: @query";
 ... processing ...
 print "AFTER: @query";

See Also

top ⇑