Full Text Search Portlet

From Request Tracker Wiki
Revision as of 04:15, 23 May 2012 by Cris70 (talk | contribs) (corrected a syntax error in javascript code)
Jump to navigation Jump to search
The portlet

The full-text search portlet

After the release of RT 4.0 we began investigating the migration from our 3.8.x RT installation.

Originally we had a mysql-based installation, and we included a full-text search engine based on Sphinx (see my IntegrateSphinx page on this wiki). We have grown very dependent on this feature.

We decided to switch to RT 4 and at the same time switch to Posgresql to take advantage of the built-in full-text search capabilities. Our users were very used to the custom portlet we wrote for Sphinx, so when the first testers began to try the new RT 4 system they were disappointed to have to rely on the confusing "simple search" page, and to have to add "fulltext:" every time.

So I thought "why not write a portlet again", and since I was on the task I decided to add the possibility to search by queue, requestor, owner. This way we will not have to use the "simple search" page again for... simple searches :-)

So here it is, for those who want to have a usable alternative to the "simple search" page and yet don't want to always use the advanced search.

Paste the content of the following box into a file. I called it FTSearch.

You have to put it in:

\local\html\Elements

<&|/Widgets/TitleBox, title => loc('Fulltext Search'), bodyclass => "" &>
    
    
<table>

<&|/l&>Text:

                    

<&|/l&>Queue:

                    <& /Elements/SelectQueue, NamedValues => 1, Name => 'Queue' &>

<&|/l&>Requestor:

                    <& /Elements/EmailInput, Name => 'Requestor', Size => '40' &>

<&|/l&>Owner:

                    <& /Elements/SelectOwner, ValueAttribute => "Name", Name => "Owner" &>
        <div class="submit">
            <div class="buttons">
                
    
    
<table>
                    
    


Once the file is ready, you have to edit your RT_SiteConfig.pm file and modify (or add) the line that sets the HomepageComponents variable. If you don't have it, copy it from RT_Config.pm.

Add FTSearch to the list of components and save the file. Then clean the mason cache and restart your web server. In our case, the commands are:

> rm -rf /opt/rt4/var/mason_data/obj/*
> svcadm restart apache22

Then, in RT, click on the "EDIT" box in the top right corner and add FTSearch to your home page.

That's all! Hope you enjoy it.

Cris