Difference between revisions of "Full Text Search Portlet"

From Request Tracker Wiki
Jump to navigation Jump to search
(How to add a portlet to your home page to easily perform full-text searches)
 
m (Formatting)
Line 1: Line 1:
==[[File:FTSearch.png|thumb|350px|The portlet]]
[[File:FTSearch.png|thumb|350px|The portlet]]
'''The full-text search portlet'''==
=='''The full-text search portlet'''==
After the release of RT 4.0 we began investigating the migration from out 3.8.x RT installation.
After the release of RT 4.0 we began investigating the migration from out 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 IntegratingSphinx page on this wiki). We have grown very dependent on this feature.
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.
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.
Line 16: Line 16:


<your_rt_root>\local\html\Elements
<your_rt_root>\local\html\Elements
  <&|/Widgets/TitleBox, title => loc('Fulltext Search'), bodyclass => "" &>
  <&|/Widgets/TitleBox, title => loc('Fulltext Search'), bodyclass => "" &>
     <script type="text/javascript">
     <script type="text/javascript">
Line 21: Line 22:
     {
     {
         // qui aggrego tutti i campi della prima form
         // qui aggrego tutti i campi della prima form
         var textstring = '';
         var textstring = '';''
          
          
         for (i=3;i>0;i--) {
         for (i=3;i>0;i--) {
Line 39: Line 40:
     </script>
     </script>
     <form name="input" action="#" method="get" onsubmit="MangleData(); return false">
     <form name="input" action="#" method="get" onsubmit="MangleData(); return false">
         <table>
         <nowiki><table></nowiki>
             <tr class="input-row">
             <tr class="input-row">
                 <td class="label"><&|/l&>Text</&>:</td>
                 <td class="label"><&|/l&>Text</&>:</td>
Line 65: Line 66:
             </tr>
             </tr>
         </table>
         </table>
         <div class="submit">
         <nowiki><div class="submit"></nowiki>
             <div class="buttons">
             <nowiki><div class="buttons"></nowiki>
                 <input class="button" type="submit" value="Submit" />
                 <input class="button" type="submit" value="Submit" />
             </div>
             </div>
Line 72: Line 73:
     </form>
     </form>
     <form name="input2" action="/Search/Simple.html" method="get">
     <form name="input2" action="/Search/Simple.html" method="get">
         <table>
         <nowiki><table></nowiki>
             <tr class="input-row">
             <tr class="input-row">
                 <td class="value">
                 <td class="value">
Line 81: Line 82:
     </form>
     </form>
  </&>
  </&>
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.
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.



Revision as of 12:27, 26 January 2012

The portlet

The full-text search portlet

After the release of RT 4.0 we began investigating the migration from out 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