<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rt-wiki.bestpractical.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Cris70</id>
	<title>Request Tracker Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://rt-wiki.bestpractical.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Cris70"/>
	<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/wiki/Special:Contributions/Cris70"/>
	<updated>2026-08-22T21:10:31Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=AutoSetOwner&amp;diff=26937</id>
		<title>AutoSetOwner</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=AutoSetOwner&amp;diff=26937"/>
		<updated>2019-10-01T08:43:52Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Added syntax highlighting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[NicolasC]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This custom action sets owner of the ticket to the current user if nobody yet owns the ticket. You can use this scrip action with any condition you want, for eg &amp;lt;code&amp;gt;On Resolve&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;perl&amp;quot; line=&amp;quot;1&amp;quot; &amp;gt;&lt;br /&gt;
 Description: AutoSetOwner&lt;br /&gt;
 Condition: On Resolve&lt;br /&gt;
 Action: User Defined&lt;br /&gt;
 Custom action preparation code:&lt;br /&gt;
   return 1;&lt;br /&gt;
 Custom action cleanup code:&lt;br /&gt;
   # get actor ID&lt;br /&gt;
   my $Actor = $self-&amp;gt;TransactionObj-&amp;gt;Creator;&lt;br /&gt;
   # if actor is RT_SystemUser then get out of here&lt;br /&gt;
   return 1 if $Actor == $RT::SystemUser-&amp;gt;id;&lt;br /&gt;
   # prevents a ticket being assigned to an unprivileged user, comment out if you want this&lt;br /&gt;
   return 1 unless $self-&amp;gt;TransactionObj-&amp;gt;CreatorObj-&amp;gt;Privileged;&lt;br /&gt;
   # get out unless ticket owner is nobody&lt;br /&gt;
   return 1 unless $self-&amp;gt;TicketObj-&amp;gt;Owner == $RT::Nobody-&amp;gt;id;&lt;br /&gt;
   # ok, try to change owner&lt;br /&gt;
   $RT::Logger-&amp;gt;info(&amp;quot;Auto assign ticket #&amp;quot;. $self-&amp;gt;TicketObj-&amp;gt;id .&amp;quot; to user #&amp;quot;. $Actor );&lt;br /&gt;
   my ($status, $msg) = $self-&amp;gt;TicketObj-&amp;gt;SetOwner( $Actor );&lt;br /&gt;
   unless( $status ) {&lt;br /&gt;
     $RT::Logger-&amp;gt;error( &amp;quot;Impossible to assign the ticket to $Actor: $msg&amp;quot; );&lt;br /&gt;
     return undef;&lt;br /&gt;
   }&lt;br /&gt;
   return 1;&lt;br /&gt;
 Template: Global template: Blank&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
N.B. If you do not have [[NotifyActor]] set and have the global default &amp;quot;On Owner Change Notify Owner with template Owner change&amp;quot; scrip, the above will notify the actor of the ticket being assigned to them as the [[SetOwner]] function creates a new transaction. To avoid this, use the following to set the ticket ownership:&lt;br /&gt;
&lt;br /&gt;
 $self-&amp;amp;gt;TicketObj-&amp;amp;gt;_Set(Field =&amp;amp;gt; &#039;Owner&#039;, Value =&amp;amp;gt; $Actor, RecordTransaction =&amp;amp;gt; 0);&lt;br /&gt;
&lt;br /&gt;
This, as detailed on the [[WriteCustomAction]] page will not record the change as a transaction, thus preventing notification.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Changelog:&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;20050525/Rejo&#039;&#039;&#039;  Added &amp;quot;Condition&amp;quot; line&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;20060105/HaimDimer&#039;&#039;&#039; Translated the remaning French into English.&amp;lt;br /&amp;gt;&lt;br /&gt;
Changed the severity of the error message from &amp;quot;warning&amp;quot; to &amp;quot;error&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;20181105/Cris70&#039;&#039;&#039; Fixed formatting of comments in code&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;20191001/Cris70&#039;&#039;&#039; Added syntax highlighting&lt;br /&gt;
&lt;br /&gt;
A variation on this theme is [[AutoSetOwnerIfAdminCc]]&lt;br /&gt;
&lt;br /&gt;
Another variation is [[AutoSetOwnerForQueue]]&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=AutoSetOwner&amp;diff=26628</id>
		<title>AutoSetOwner</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=AutoSetOwner&amp;diff=26628"/>
		<updated>2018-11-05T08:45:09Z</updated>

		<summary type="html">&lt;p&gt;Cris70: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[NicolasC]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This custom action sets owner of the ticket to the current user if nobody yet owns the ticket. You can use this scrip action with any condition you want, for eg &amp;lt;code&amp;gt;On Resolve&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 Description: AutoSetOwner&lt;br /&gt;
 Condition: On Resolve&lt;br /&gt;
 Action: User Defined&lt;br /&gt;
 Custom action preparation code:&lt;br /&gt;
   return 1;&lt;br /&gt;
 Custom action cleanup code:&lt;br /&gt;
   \# get actor ID&lt;br /&gt;
   my $Actor = $self-&amp;amp;gt;TransactionObj-&amp;amp;gt;Creator;&amp;lt;br /&amp;gt;&lt;br /&gt;
   \# if actor is RT_SystemUser then get out of here&lt;br /&gt;
   return 1 if $Actor == $RT::SystemUser-&amp;amp;gt;id;&amp;lt;br /&amp;gt;&lt;br /&gt;
   \# prevents a ticket being assigned to an unprivileged user, comment out if you want this&lt;br /&gt;
   return 1 unless $self-&amp;gt;TransactionObj-&amp;gt;CreatorObj-&amp;gt;Privileged;&amp;lt;br /&amp;gt;&lt;br /&gt;
   \# get out unless ticket owner is nobody&lt;br /&gt;
   return 1 unless $self-&amp;amp;gt;TicketObj-&amp;amp;gt;Owner == $RT::Nobody-&amp;amp;gt;id;&amp;lt;br /&amp;gt;&lt;br /&gt;
   \# ok, try to change owner&lt;br /&gt;
   $RT::Logger-&amp;amp;gt;info(&amp;quot;Auto assign ticket #&amp;quot;. $self-&amp;amp;gt;TicketObj-&amp;amp;gt;id .&amp;quot; to user #&amp;quot;. $Actor );&lt;br /&gt;
   my ($status, $msg) = $self-&amp;amp;gt;TicketObj-&amp;amp;gt;SetOwner( $Actor );&lt;br /&gt;
   unless( $status ) {&lt;br /&gt;
     $RT::Logger-&amp;amp;gt;error( &amp;quot;Impossible to assign the ticket to $Actor: $msg&amp;quot; );&lt;br /&gt;
     return undef;&lt;br /&gt;
   }&lt;br /&gt;
   return 1;&lt;br /&gt;
 Template: Global template: Blank&lt;br /&gt;
&lt;br /&gt;
N.B. If you do not have [[NotifyActor]] set and have the global default &amp;quot;On Owner Change Notify Owner with template Owner change&amp;quot; scrip, the above will notify the actor of the ticket being assigned to them as the [[SetOwner]] function creates a new transaction. To avoid this, use the following to set the ticket ownership:&lt;br /&gt;
&lt;br /&gt;
 $self-&amp;amp;gt;TicketObj-&amp;amp;gt;_Set(Field =&amp;amp;gt; &#039;Owner&#039;, Value =&amp;amp;gt; $Actor, RecordTransaction =&amp;amp;gt; 0);&lt;br /&gt;
&lt;br /&gt;
This, as detailed on the [[WriteCustomAction]] page will not record the change as a transaction, thus preventing notification.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Changelog:&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;20050525/Rejo&#039;&#039;&#039;  Added &amp;quot;Condition&amp;quot; line&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;20060105/HaimDimer&#039;&#039;&#039; Translated the remaning French into English.&amp;lt;br /&amp;gt;&lt;br /&gt;
Changed the severity of the error message from &amp;quot;warning&amp;quot; to &amp;quot;error&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;20181105/Cris70&#039;&#039;&#039; Fixed formatting of comments in code&lt;br /&gt;
&lt;br /&gt;
A variation on this theme is [[AutoSetOwnerIfAdminCc]]&lt;br /&gt;
&lt;br /&gt;
Another variation is [[AutoSetOwnerForQueue]]&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=AutoSetOwner&amp;diff=26627</id>
		<title>AutoSetOwner</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=AutoSetOwner&amp;diff=26627"/>
		<updated>2018-11-05T08:41:48Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Fixed formatting of comments in code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[NicolasC]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overview&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This custom action sets owner of the ticket to the current user if nobody yet owns the ticket. You can use this scrip action with any condition you want, for eg &amp;lt;code&amp;gt;On Resolve&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 Description: AutoSetOwner&lt;br /&gt;
 Condition: On Resolve&lt;br /&gt;
 Action: User Defined&lt;br /&gt;
 Custom action preparation code:&lt;br /&gt;
   return 1;&lt;br /&gt;
 Custom action cleanup code:&lt;br /&gt;
   \# get actor ID&lt;br /&gt;
   my $Actor = $self-&amp;amp;gt;TransactionObj-&amp;amp;gt;Creator;&amp;lt;br /&amp;gt;&lt;br /&gt;
   \# if actor is RT_SystemUser then get out of here&lt;br /&gt;
   return 1 if $Actor == $RT::SystemUser-&amp;amp;gt;id;&amp;lt;br /&amp;gt;&lt;br /&gt;
   \# prevents a ticket being assigned to an unprivileged user, comment out if you want this&lt;br /&gt;
   return 1 unless $self-&amp;gt;TransactionObj-&amp;gt;CreatorObj-&amp;gt;Privileged;&amp;lt;br /&amp;gt;&lt;br /&gt;
   \# get out unless ticket owner is nobody&lt;br /&gt;
   return 1 unless $self-&amp;amp;gt;TicketObj-&amp;amp;gt;Owner == $RT::Nobody-&amp;amp;gt;id;&amp;lt;br /&amp;gt;&lt;br /&gt;
   \# ok, try to change owner&lt;br /&gt;
   $RT::Logger-&amp;amp;gt;info(&amp;quot;Auto assign ticket #&amp;quot;. $self-&amp;amp;gt;TicketObj-&amp;amp;gt;id .&amp;quot; to user #&amp;quot;. $Actor );&lt;br /&gt;
   my ($status, $msg) = $self-&amp;amp;gt;TicketObj-&amp;amp;gt;SetOwner( $Actor );&lt;br /&gt;
   unless( $status ) {&lt;br /&gt;
     $RT::Logger-&amp;amp;gt;error( &amp;quot;Impossible to assign the ticket to $Actor: $msg&amp;quot; );&lt;br /&gt;
     return undef;&lt;br /&gt;
   }&lt;br /&gt;
   return 1;&lt;br /&gt;
 Template: Global template: Blank&lt;br /&gt;
&lt;br /&gt;
N.B. If you do not have [[NotifyActor]] set and have the global default &amp;quot;On Owner Change Notify Owner with template Owner change&amp;quot; scrip, the above will notify the actor of the ticket being assigned to them as the [[SetOwner]] function creates a new transaction. To avoid this, use the following to set the ticket ownership:&lt;br /&gt;
&lt;br /&gt;
 $self-&amp;amp;gt;TicketObj-&amp;amp;gt;_Set(Field =&amp;amp;gt; &#039;Owner&#039;, Value =&amp;amp;gt; $Actor, RecordTransaction =&amp;amp;gt; 0);&lt;br /&gt;
&lt;br /&gt;
This, as detailed on the [[WriteCustomAction]] page will not record the change as a transaction, thus preventing notification.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Changelog:&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 20050525/Rejo  Added &amp;quot;Condition&amp;quot; line&lt;br /&gt;
 &lt;br /&gt;
 20060105/HaimDimer Translated the remaning French into English.&lt;br /&gt;
 Changed the severity of the error message from &amp;quot;warning&amp;quot; to &amp;quot;error&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 20181105/Cris70 Fixed formatting of comments in code&lt;br /&gt;
&lt;br /&gt;
A variation on this theme is [[AutoSetOwnerIfAdminCc]]&lt;br /&gt;
&lt;br /&gt;
Another variation is [[AutoSetOwnerForQueue]]&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=MuteResolve&amp;diff=26279</id>
		<title>MuteResolve</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=MuteResolve&amp;diff=26279"/>
		<updated>2016-07-15T07:44:56Z</updated>

		<summary type="html">&lt;p&gt;Cris70: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
By default RT has a scrip to notify requestors when a ticket is resolved. This is generally a good idea; however, sometimes you may want to avoid notifying requestors. One example is when someone reopens a ticket just because he answered &amp;quot;Thanks&amp;quot; to your resolution notification.&lt;br /&gt;
&lt;br /&gt;
I haven&#039;t found a solution satisfying me, so I developed my own. It involves a transaction custom field, called MuteResolve, that privileged users can set when they resolve a ticket. If set to &amp;quot;Yes&amp;quot;, RT won&#039;t send any email.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that, being a transaction custom field, you&#039;ll see it in any transaction, not only on resolve (e.g. you&#039;ll see it on the ticket &amp;quot;comment&amp;quot; page too), but it only makes sense on resolve.&lt;br /&gt;
&lt;br /&gt;
This is implemented on RT 3.8.4.&lt;br /&gt;
&lt;br /&gt;
2010-08-23 Updated for 3.8.8 (change in validation).&lt;br /&gt;
&lt;br /&gt;
=== How to set up MuteResolve in RT3: ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 1. Custom field creation =====&lt;br /&gt;
&lt;br /&gt;
First create a new custom field: Configuration -&amp;amp;gt; Custom Fields -&amp;amp;gt; Create&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name:&#039;&#039;&#039; MuteResolve&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; &amp;lt;code&amp;gt;If Yes, don&#039;t send email notifications on resolve&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Type:&#039;&#039;&#039; &amp;lt;code&amp;gt;Select one value&amp;lt;/code&amp;gt; (but I prefer Combobox because it looks better)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Applies to:&#039;&#039;&#039; Ticket Transactions&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Validation:&#039;&#039;&#039; (?#YesNo)^(Yes|No|\z)$ (only necessary for Combobox)&lt;br /&gt;
&lt;br /&gt;
When you click on &amp;quot;Save Changes&amp;quot; RT will let you enter Values.&lt;br /&gt;
&lt;br /&gt;
Enter one value: &amp;quot;Yes&amp;quot;. You need only fill the Name field, I have left Sort and Description empty. Then &amp;quot;Save Changes&amp;quot; again.&lt;br /&gt;
&lt;br /&gt;
On the &amp;quot;Applies To&amp;quot; page select the queues where you want to enable the custom field, then on the &amp;quot;Group Rights&amp;quot; give the &amp;quot;ModifyCustomField&amp;quot; right to the &amp;quot;Privileged&amp;quot; system group.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 2. Editing Scrip =====&lt;br /&gt;
&lt;br /&gt;
Go to Configuration -&amp;amp;gt; Global -&amp;amp;gt; Scrips, then click on &amp;quot;On Resolve Notify Requestors&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Change &amp;quot;Condition&amp;quot; from &amp;quot;On Resolve&amp;quot; to &amp;quot;User Defined&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;quot;Stage&amp;quot; from &amp;quot;TransactionCreate&amp;quot; to &amp;quot;TransactionBatch&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In the &amp;quot;Custom condition&amp;quot; box enter this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;perl&amp;quot; line=&amp;quot;1&amp;quot; &amp;gt;&lt;br /&gt;
  # is this a resolve?&lt;br /&gt;
  my $trans = $self-&amp;gt;TransactionObj;&lt;br /&gt;
  my $tipo = $trans-&amp;gt;Type;&lt;br /&gt;
  return 0 unless ($trans-&amp;gt;Type eq &amp;quot;Status&amp;quot; &amp;amp;&amp;amp; $trans-&amp;gt;NewValue eq &amp;quot;resolved&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  # get last &amp;quot;comment&amp;quot; transaction&lt;br /&gt;
  my $Transactions = $self-&amp;gt;TicketObj-&amp;gt;Transactions;&lt;br /&gt;
  &lt;br /&gt;
  $Transactions-&amp;gt;Limit( FIELD =&amp;gt; &#039;Type&#039;, VALUE =&amp;gt; &#039;Comment&#039; );&lt;br /&gt;
  $Transactions-&amp;gt;OrderByCols (&lt;br /&gt;
                { FIELD =&amp;gt; &#039;Created&#039;,  ORDER =&amp;gt; &#039;DESC&#039; },&lt;br /&gt;
                { FIELD =&amp;gt; &#039;id&#039;,     ORDER =&amp;gt; &#039;DESC&#039; },&lt;br /&gt;
                );&lt;br /&gt;
  &lt;br /&gt;
  # get custom fields of the last &amp;quot;comment&amp;quot; transaction, if there is one&lt;br /&gt;
  unless( $Transactions-&amp;gt;First ){ return 1; }&lt;br /&gt;
  my $TransNum = $Transactions-&amp;gt;First-&amp;gt;Id;&lt;br /&gt;
  my $TCustomFields = $Transactions-&amp;gt;First-&amp;gt;CustomFields;&lt;br /&gt;
  &lt;br /&gt;
  while (my $TCustomField = $TCustomFields-&amp;gt;Next()) {&lt;br /&gt;
     my $nam = $TCustomField-&amp;gt;Name;&lt;br /&gt;
     if ($nam = &#039;MuteResolve&#039;) {&lt;br /&gt;
         my $val = $Transactions-&amp;gt;First-&amp;gt;FirstCustomFieldValue($nam);&lt;br /&gt;
         if ($val eq &#039;Yes&#039;) {&lt;br /&gt;
             return 0;&lt;br /&gt;
         }&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  return 1;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
That&#039;s all folks!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; - I think&lt;br /&gt;
&lt;br /&gt;
 if ($nam = &#039;MuteResolve&#039;) {&lt;br /&gt;
&lt;br /&gt;
should be&lt;br /&gt;
&lt;br /&gt;
 if ($nam eq &#039;MuteResolve&#039;) {&lt;br /&gt;
&lt;br /&gt;
(added by [http://wiki.bestpractical.com/view/fish fish], 9 Sep 2010)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&#039;&#039;&#039;Note2&#039;&#039;&#039; - If you check &amp;quot;yes&amp;quot; but add no comment, rt still sends the mail. (Thx to Crist.)&lt;br /&gt;
&lt;br /&gt;
(added by Minifab, 23 Nov 2010)&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=File:FTSearch.png&amp;diff=26273</id>
		<title>File:FTSearch.png</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=File:FTSearch.png&amp;diff=26273"/>
		<updated>2016-07-07T08:10:31Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Cris70 uploaded File:FTSearch.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=File:Rt3p.png&amp;diff=26272</id>
		<title>File:Rt3p.png</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=File:Rt3p.png&amp;diff=26272"/>
		<updated>2016-07-07T08:07:29Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Cris70 uploaded File:Rt3p.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Licensing ==&lt;br /&gt;
{{Self}}&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=OnCreateCheckCF&amp;diff=26271</id>
		<title>OnCreateCheckCF</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=OnCreateCheckCF&amp;diff=26271"/>
		<updated>2016-07-07T07:02:15Z</updated>

		<summary type="html">&lt;p&gt;Cris70: /* 4. Creating the Scrip */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
You may want to create a mandatory custom field, so that people will have to fill the value before being able to submit a new ticket. However, if you define a cf as mandatory, only people creating tickets from the web interface will be forced to fill the value. Those creating a new ticket using the mail gateway won&#039;t notice the presence of the mandatory cf, and the ticket will be created anyway.&lt;br /&gt;
&lt;br /&gt;
My solution consists of three pieces:&lt;br /&gt;
&lt;br /&gt;
* the [[ExtractCustomFieldValues]] extension, needed to be able assign a value to the cf through an email message&lt;br /&gt;
* an OnCreate scrip which checks if the cf is present, and eventually marks the ticket as rejected and notifies the requestor&lt;br /&gt;
* a custom template to use when notifying the requestor about a rejected ticket&lt;br /&gt;
&lt;br /&gt;
This is implemented on RT 3.8.4.&lt;br /&gt;
&lt;br /&gt;
=== How to setup OnCreateCheckCF in RT3 ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 1. Custom field creation =====&lt;br /&gt;
&lt;br /&gt;
First create a new custom field: Configuration -&amp;amp;gt; Custom Fields -&amp;amp;gt; Create&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name:&#039;&#039;&#039; &amp;lt;code&amp;gt;cfTest&amp;lt;/code&amp;gt; &#039;&#039;(you can use the name you want)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; &amp;lt;code&amp;gt;test mandatory custom field&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Type:&#039;&#039;&#039; &amp;lt;code&amp;gt;Fill in one text area&amp;lt;/code&amp;gt; &#039;&#039;(you can use the type you want)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Validation:&#039;&#039;&#039; (?#Mandatory).&lt;br /&gt;
&lt;br /&gt;
Now &amp;quot;Save Changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
On the &amp;quot;Applies To&amp;quot; page select the queues where you want to enable the custom field, then on the &amp;quot;Group Rights&amp;quot; give the &amp;quot;ModifyCustomField&amp;quot; right to the &amp;quot;Everyone&amp;quot; system group (if you want everyone to be able to create tickets on those queues).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that this is just a sample mandatory custom field. The scrip below is generic and will check for the presence of any and all &amp;lt;u&amp;gt;mandatory&amp;lt;/u&amp;gt; ticket custom fields.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 2. Configure the ExtractCustomFieldValues =====&lt;br /&gt;
&lt;br /&gt;
Follow the instructions in the [[ExtractCustomFieldValues]] section&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 3. Creating the template =====&lt;br /&gt;
&lt;br /&gt;
Go to Configuration -&amp;amp;gt; Global -&amp;amp;gt; Templates -&amp;amp;gt; New&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name:&#039;&#039;&#039; &amp;lt;code&amp;gt;Error: no mandatory CF&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; &amp;lt;code&amp;gt;Inform the user that the ticket has been rejected due to a missing mandatory custom field&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content:&#039;&#039;&#039;&lt;br /&gt;
     Subject: Your ticket has been rejected due to a missing mandatory field.&lt;br /&gt;
     You sent a ticket with a missing piece of information. Since the missing information&lt;br /&gt;
     is mandatory, the ticket has been rejected.&lt;br /&gt;
     Please verify the informations you sent and then retry submitting the ticket.&lt;br /&gt;
     If you feel your ticket has been rejected due to an error, please contact the administrator.&lt;br /&gt;
&lt;br /&gt;
Obviously this is only an example, you can write what you want. Just be sure to have the &amp;quot;Subject:&amp;quot; line as the very first line, and to leave a blank line after that.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 4. Creating the Scrip =====&lt;br /&gt;
&lt;br /&gt;
Go to Configuration -&amp;amp;gt; Queues (or Global if you want this for all queues) -&amp;amp;gt; (QueueName) -&amp;amp;gt; Scrips -&amp;amp;gt; New scrip&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; OnCreateCheckCF&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition:&#039;&#039;&#039; User Defined&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Action:&#039;&#039;&#039; Autoreply To Requestors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Template:&#039;&#039;&#039; Global template: Error: no mandatory CF&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage:&#039;&#039;&#039; TransactionBatch&lt;br /&gt;
&lt;br /&gt;
In the &amp;quot;Custom condition&amp;quot; box enter this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;perl&amp;quot; line=&amp;quot;1&amp;quot; &amp;gt;&lt;br /&gt;
my $trans = $self-&amp;gt;TransactionObj;&lt;br /&gt;
return 0 unless $trans-&amp;gt;Type eq &amp;quot;Create&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
my $ticket = $self-&amp;gt;TicketObj;&lt;br /&gt;
&lt;br /&gt;
my $Email_Rq = $ticket-&amp;gt;RequestorAddresses;&lt;br /&gt;
    &lt;br /&gt;
my $CustomFields = $ticket-&amp;gt;QueueObj-&amp;gt;TicketCustomFields();&lt;br /&gt;
while (my $CustomField = $CustomFields-&amp;gt;Next()) {&lt;br /&gt;
  my $nam = $CustomField-&amp;gt;Name;&lt;br /&gt;
  my $typ = $CustomField-&amp;gt;Type;&lt;br /&gt;
  my $vad = $CustomField-&amp;gt;Pattern;&lt;br /&gt;
&lt;br /&gt;
  if ($vad == &#039;(?#Mandatory)&#039;) {&lt;br /&gt;
    my $val = $ticket-&amp;gt;FirstCustomFieldValue($nam);&lt;br /&gt;
    if ($val ne &#039;&#039;) {&lt;br /&gt;
      next;&lt;br /&gt;
    } else {&lt;br /&gt;
      $ticket-&amp;gt;SetStatus(&amp;quot;rejected&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
    &lt;br /&gt;
return 1;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
That&#039;s all folks!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;P.S.&#039;&#039;&#039;: Thanks to the user who spotted a typo in my scrip!&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=MuteResolve&amp;diff=5386</id>
		<title>MuteResolve</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=MuteResolve&amp;diff=5386"/>
		<updated>2016-06-24T18:12:39Z</updated>

		<summary type="html">&lt;p&gt;Cris70: /* 2. Editing Scrip */ enabled syntax highlighting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
By default RT has a scrip to notify requestors when a ticket is resolved. This is generally a good idea; however, sometimes you may want to avoid notifying requestors. One example is when someone reopens a ticket just because he answered &amp;quot;Thanks&amp;quot; to your resolution notification.&lt;br /&gt;
&lt;br /&gt;
I haven&#039;t found a solution satisfying me, so I developed my own. It involves a transaction custom field, called MuteResolve, that privileged users can set when they resolve a ticket. If set to &amp;quot;Yes&amp;quot;, RT won&#039;t send any email.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that, being a transaction custom field, you&#039;ll see it in any transaction, not only on resolve (e.g. you&#039;ll see it on the ticket &amp;quot;comment&amp;quot; page too), but it only makes sense on resolve.&lt;br /&gt;
&lt;br /&gt;
This is implemented on RT 3.8.4.&lt;br /&gt;
&lt;br /&gt;
2010-08-23 Updated for 3.8.8 (change in validation).&lt;br /&gt;
&lt;br /&gt;
=== How to set up MuteResolve in RT3: ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 1. Custom field creation =====&lt;br /&gt;
&lt;br /&gt;
First create a new custom field: Configuration -&amp;amp;gt; Custom Fields -&amp;amp;gt; Create&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name:&#039;&#039;&#039; MuteResolve&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; &amp;lt;code&amp;gt;If Yes, don&#039;t send email notifications on resolve&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Type:&#039;&#039;&#039; &amp;lt;code&amp;gt;Select one value&amp;lt;/code&amp;gt; (but I prefer Combobox because it looks better)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Applies to:&#039;&#039;&#039; Ticket Transactions&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Validation:&#039;&#039;&#039; (?#YesNo)^(Yes|No|\z)$ (only necessary for Combobox)&lt;br /&gt;
&lt;br /&gt;
When you click on &amp;quot;Save Changes&amp;quot; RT will let you enter Values.&lt;br /&gt;
&lt;br /&gt;
Enter one value: &amp;quot;Yes&amp;quot;. You need only fill the Name field, I have left Sort and Description empty. Then &amp;quot;Save Changes&amp;quot; again.&lt;br /&gt;
&lt;br /&gt;
On the &amp;quot;Applies To&amp;quot; page select the queues where you want to enable the custom field, then on the &amp;quot;Group Rights&amp;quot; give the &amp;quot;ModifyCustomField&amp;quot; right to the &amp;quot;Privileged&amp;quot; system group.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 2. Editing Scrip =====&lt;br /&gt;
&lt;br /&gt;
Go to Configuration -&amp;amp;gt; Global -&amp;amp;gt; Scrips, then click on &amp;quot;On Resolve Notify Requestors&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Change &amp;quot;Condition&amp;quot; from &amp;quot;On Resolve&amp;quot; to &amp;quot;User Defined&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;quot;Stage&amp;quot; from &amp;quot;TransactionCreate&amp;quot; to &amp;quot;TransactionBatch&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In the &amp;quot;Custom condition&amp;quot; box enter this code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;perl&amp;quot; line=&amp;quot;1&amp;quot; &amp;gt;&lt;br /&gt;
  # is this a resolve?&lt;br /&gt;
  my $trans = $self-&amp;gt;TransactionObj;&lt;br /&gt;
  my $tipo = $trans-&amp;gt;Type;&lt;br /&gt;
  return 0 unless ($trans-&amp;gt;Type eq &amp;quot;Status&amp;quot; &amp;amp;&amp;amp; $trans-&amp;gt;NewValue eq &amp;quot;resolved&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  # get last &amp;quot;comment&amp;quot; transaction&lt;br /&gt;
  my $Transactions = $self-&amp;gt;TicketObj-&amp;gt;Transactions;&lt;br /&gt;
  &lt;br /&gt;
  $Transactions-&amp;gt;Limit( FIELD =&amp;gt; &#039;Type&#039;, VALUE =&amp;gt; &#039;Comment&#039; );&lt;br /&gt;
  $Transactions-&amp;gt;OrderByCols (&lt;br /&gt;
                { FIELD =&amp;gt; &#039;Created&#039;,  ORDER =&amp;gt; &#039;DESC&#039; },&lt;br /&gt;
                { FIELD =&amp;gt; &#039;id&#039;,     ORDER =&amp;gt; &#039;DESC&#039; },&lt;br /&gt;
                );&lt;br /&gt;
  &lt;br /&gt;
  # get custom fields of the last &amp;quot;comment&amp;quot; transaction, if there is one&lt;br /&gt;
  unless( $Transactions-&amp;gt;First ){ return 1; }&lt;br /&gt;
  my $TransNum = $Transactions-&amp;gt;First-&amp;gt;Id;&lt;br /&gt;
  my $TCustomFields = $Transactions-&amp;gt;First-&amp;gt;CustomFields;&lt;br /&gt;
  &lt;br /&gt;
  while (my $TCustomField = $TCustomFields-&amp;gt;Next()) {&lt;br /&gt;
     my $nam = $TCustomField-&amp;gt;Name;&lt;br /&gt;
     if ($nam = &#039;MuteResolve&#039;) {&lt;br /&gt;
         my $val = $Transactions-&amp;gt;First-&amp;gt;FirstCustomFieldValue($nam);&lt;br /&gt;
         if ($val eq &#039;Yes&#039;) {&lt;br /&gt;
             return 0;&lt;br /&gt;
         }&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  return 1;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
That&#039;s all folks!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; - I think&lt;br /&gt;
&lt;br /&gt;
 if ($nam = &#039;MuteResolve&#039;) {&lt;br /&gt;
&lt;br /&gt;
should be&lt;br /&gt;
&lt;br /&gt;
 if ($nam eq &#039;MuteResolve&#039;) {&lt;br /&gt;
&lt;br /&gt;
(added by [http://wiki.bestpractical.com/view/fish fish], 9 Sep 2010)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note2&#039;&#039;&#039; - If you check &amp;quot;yes&amp;quot; but add no comment, rt still sends the mail. (Thx to Crist.)&lt;br /&gt;
&lt;br /&gt;
(added by Minifab, 23 Nov 2010)&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=IntegrateSphinx&amp;diff=5372</id>
		<title>IntegrateSphinx</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=IntegrateSphinx&amp;diff=5372"/>
		<updated>2016-06-21T08:20:46Z</updated>

		<summary type="html">&lt;p&gt;Cris70: /* The search daemon */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
= Integrating the Sphinx full-text search engine in RT =&lt;br /&gt;
&lt;br /&gt;
[http://sphinxsearch.com/ homepage Sphinx]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== What is Sphinx? ==&lt;br /&gt;
&lt;br /&gt;
Sphinx is a free open-source SQL full-text search engine. As they put it on their site: How do you implement full-text search for that 10+ million row table, keep up with the load, and stay relevant? Sphinx is good at those kinds of riddles.&lt;br /&gt;
&lt;br /&gt;
Basically, Sphinx scans your database and builds his own indexes for blazingly-fast full-text searches.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Why? ==&lt;br /&gt;
&lt;br /&gt;
Well, we needed fast full-text searches, and what RT offers is not enough. It is slow and it causes a high load on the db server.&lt;br /&gt;
&lt;br /&gt;
I saw a reference to Sphinx on the RT users mailing list, and - after exploring a few alternatives and verifying no one had already did it - proceeded to integrate it into our RT installation.&lt;br /&gt;
&lt;br /&gt;
I am going to illustrate here all the steps we put in place to have Sphinx completely integrated in RT. The work required a couple of weeks of my spare time and that of two other colleagues.&lt;br /&gt;
&lt;br /&gt;
Unfortunately I am not able to package this as a proper extension, but I hope this docs will help those who want to do the same. Maybe someone will feel inspired enough to package it for the benefit of the community, or maybe [[User:JesseVincent|Jesse]] will decide to integrate it into RT out of the box. Who knows?&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== First: setting up Sphinx ==&lt;br /&gt;
&lt;br /&gt;
==== Intro ====&lt;br /&gt;
&lt;br /&gt;
First of all, you have to go to the [http://sphinxsearch.com/ Sphinx homepage], download and compile the sources. Or you can choose among the provided binary packages.&lt;br /&gt;
&lt;br /&gt;
We decided to go with version 1.10-beta, the most recent at the time of our installation.&lt;br /&gt;
&lt;br /&gt;
At this point you have to decide if you want to use &#039;&#039;&#039;real-time indexes&#039;&#039;&#039; or the more traditional &#039;&#039;&#039;full+delta&#039;&#039;&#039; approach to indexes.&lt;br /&gt;
&lt;br /&gt;
I will describe here briefly the meaning of these two options; if you want more infos please refer to the Sphinx homepage.&lt;br /&gt;
&lt;br /&gt;
Real-time indexes (on the Sphinx site they call them RT-indexes... quite confusing, uh?) are a clever way to have your indexes always updated, up to the millisecond. They are however still in beta (as of 1.10-beta) and they are more complex to set up and update. We wanted a quick solution, so we chose the traditional way.&lt;br /&gt;
&lt;br /&gt;
The traditional way consists of having two indexes: one &#039;&#039;&#039;big&#039;&#039;&#039; index comprising all tickets up to a certain date (or to a certain ID), and a small &#039;&#039;&#039;delta&#039;&#039;&#039; index for the rest of the tickets. You can use only one big index, but it will take a few minutes to build it so you cannot refresh it too frequently. If you use the full+delta approach you can build the big index e.g. once a day and the delta index once every few minutes.&lt;br /&gt;
&lt;br /&gt;
Presently we have about 15 thousand tickets in our RT db; we build the full index every morning, indexing everything up to the first day of the current month: it takes about 8 minutes. The delta index (from start of month to now) is built every 5 minutes and it takes about a couple seconds.&lt;br /&gt;
&lt;br /&gt;
At this point I should probably say that we are running RT on two solaris servers: one for the presentation and one for the DB. Sphinx runs on the DB side.&lt;br /&gt;
&lt;br /&gt;
==== Sphinx setup ====&lt;br /&gt;
&lt;br /&gt;
First thing to do is to tell Sphinx where your database is, what kind of database engine you use and how to scan your data.&lt;br /&gt;
&lt;br /&gt;
You tell Sphinx all these things in the file sphinx.conf (we have it in /usr/local/etc). Here is our sphinx.conf:&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;pre&amp;gt;&lt;br /&gt;
   #&lt;br /&gt;
   # Sphinx configuration&lt;br /&gt;
   #&lt;br /&gt;
   &lt;br /&gt;
   source rt3&lt;br /&gt;
   {&lt;br /&gt;
   	type			= mysql&lt;br /&gt;
   &lt;br /&gt;
   	sql_host		= localhost&lt;br /&gt;
   	sql_user		= AMENDED&lt;br /&gt;
   	sql_pass		= AMENDED&lt;br /&gt;
   	sql_db			= rt3&lt;br /&gt;
   	sql_port		= 3306	# optional, default is 3306&lt;br /&gt;
   &lt;br /&gt;
   	sql_query		= \&lt;br /&gt;
   		select TK.id as TicketNum, \&lt;br /&gt;
   			TK.Creator as CreatedBy, \&lt;br /&gt;
   			TK.Queue as Queue, \&lt;br /&gt;
   			unix_timestamp(convert_tz(TK.Created,&#039;GMT&#039;,&#039;Europe/Rome&#039;)) as Created, \&lt;br /&gt;
   			TK.Subject as Subject, \&lt;br /&gt;
   			group_concat(cast(A.Content as char)) as Content \&lt;br /&gt;
   		from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
   		where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
   		and A.TransactionId = T.id \&lt;br /&gt;
   		and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
   		and A.ContentType = &#039;text/plain&#039; \&lt;br /&gt;
   		and A.Content is not null \&lt;br /&gt;
   		and TK.Created &amp;amp;lt; concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) \&lt;br /&gt;
   		group by TK.id \&lt;br /&gt;
   		order by TK.id, T.id&lt;br /&gt;
   &lt;br /&gt;
   	sql_attr_uint		= Created&lt;br /&gt;
   	sql_attr_uint		= Queue&lt;br /&gt;
   	sql_attr_uint		= CreatedBy&lt;br /&gt;
   &lt;br /&gt;
   	sql_query_info		= SELECT * FROM Tickets WHERE id=$id&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   source rt3delta : rt3&lt;br /&gt;
   {&lt;br /&gt;
   	sql_query		= \&lt;br /&gt;
   		select TK.id as TicketNum, \&lt;br /&gt;
   			TK.Creator as CreatedBy, \&lt;br /&gt;
   			TK.Queue as Queue, \&lt;br /&gt;
   			unix_timestamp(convert_tz(TK.Created,&#039;GMT&#039;,&#039;Europe/Rome&#039;)) as Created, \&lt;br /&gt;
   			TK.Subject as Subject, \&lt;br /&gt;
   			group_concat(cast(A.Content as char)) as Content \&lt;br /&gt;
   		from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
   		where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
   		and A.TransactionId = T.id \&lt;br /&gt;
   		and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
   		and A.ContentType = &#039;text/plain&#039; \&lt;br /&gt;
   		and A.Content is not null \&lt;br /&gt;
   		and TK.Created between concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) and last_day(now()) \&lt;br /&gt;
   		group by TK.id \&lt;br /&gt;
   		order by TK.id, T.id&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   index fulltext1&lt;br /&gt;
   {&lt;br /&gt;
   	source			= rt3&lt;br /&gt;
   	path			= /var/data/fulltext1&lt;br /&gt;
   	docinfo			= extern&lt;br /&gt;
   	charset_type	= sbcs&lt;br /&gt;
   	min_infix_len 	= 3&lt;br /&gt;
   	enable_star     = 1&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   index fulltextdelta: fulltext1&lt;br /&gt;
   {&lt;br /&gt;
   	source			= rt3delta&lt;br /&gt;
   	path			= /var/data/fulltextdelta&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   indexer&lt;br /&gt;
   {&lt;br /&gt;
   	mem_limit		= 32M&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   searchd&lt;br /&gt;
   {&lt;br /&gt;
   	listen			= 9312&lt;br /&gt;
   	listen			= 9306:mysql41&lt;br /&gt;
   	log				= /var/log/searchd.log&lt;br /&gt;
   	query_log		= /var/log/query.log&lt;br /&gt;
   	read_timeout	= 5&lt;br /&gt;
   	max_children	= 30&lt;br /&gt;
   	pid_file		= /var/log/searchd.pid&lt;br /&gt;
   	max_matches		= 1000&lt;br /&gt;
   	seamless_rotate		= 1&lt;br /&gt;
   	preopen_indexes		= 0&lt;br /&gt;
   	unlink_old		= 1&lt;br /&gt;
   	workers			= threads # for RT to work&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s see what we have in this configuration file.&lt;br /&gt;
&lt;br /&gt;
First we define a &#039;&#039;&#039;data source&#039;&#039;&#039;, that I have named (with lots of fantasy!) &amp;lt;code&amp;gt;rt3&amp;lt;/code&amp;gt;. A data source tells Sphinx where to get data to feed its indexes. We tell Sphinx the type of source (&amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt;), where it is (&amp;lt;code&amp;gt;localhost&amp;lt;/code&amp;gt;), and how to retrieve the data (the &amp;lt;code&amp;gt;sqlquery&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
There is one &#039;&#039;&#039;VERY&#039;&#039;&#039; important thing in this section: every column that is returned by the query is indexed for full text search, unless you declare it as an &amp;lt;u&amp;gt;attribute&amp;lt;/u&amp;gt;. Attributes cannot be searched for text, but they allow you to &#039;&#039;&#039;filter&#039;&#039;&#039; the results.&lt;br /&gt;
&lt;br /&gt;
In our configuration, we return &#039;&#039;&#039;Subject&#039;&#039;&#039; and &#039;&#039;&#039;Content&#039;&#039;&#039; as searchable fields, while the three &amp;lt;code&amp;gt;sql_attr_uint&amp;lt;/code&amp;gt; &amp;lt;u&amp;gt;attributes&amp;lt;/u&amp;gt; can be used to refine the search (i.e. filter).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;NOTE:&amp;lt;/u&amp;gt;&#039;&#039;&#039; We had previously defined the three &amp;lt;u&amp;gt;attributes&amp;lt;/u&amp;gt; according to their content (e.g. the &#039;&#039;&#039;Created&#039;&#039;&#039; attribute was defines as &amp;lt;code&amp;gt;sql_attr_timestamp&amp;lt;/code&amp;gt;), but we have discovered that this configuration would not allow us to use those attributes for filtering. It seems Sphinx can only use &amp;lt;code&amp;gt;sql_attr_uint&amp;lt;/code&amp;gt; for filtering... I don&#039;t know if it&#039;s a temporary limitation, a bug, or working as designed.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;sql_query_info&#039;&#039;&#039; has to return a hit for every $id ($id is an implicit variable, which contains the first column returned by the sql_query. It &#039;&#039;&#039;MUST&#039;&#039;&#039; be an integer.).&lt;br /&gt;
&lt;br /&gt;
We then define another data source (&amp;lt;code&amp;gt;rt3delta&amp;lt;/code&amp;gt;) which we derive from &amp;lt;code&amp;gt;rt3&amp;lt;/code&amp;gt;. Everything defined in the &amp;lt;code&amp;gt;rt3&amp;lt;/code&amp;gt; data source is inherited by &amp;lt;code&amp;gt;rt3delta&amp;lt;/code&amp;gt;, save for what we override (&amp;lt;code&amp;gt;sqlquery&amp;lt;/code&amp;gt; in this case). As you can see, the queries are very similar; only the date range is different.&lt;br /&gt;
&lt;br /&gt;
After data sources we define &#039;&#039;&#039;indexes&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
First index is &amp;lt;code&amp;gt;fulltext1&amp;lt;/code&amp;gt;. Everything should be pretty intuitive, but for the two &amp;lt;code&amp;gt;min_infix_len&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;enable_star&amp;lt;/code&amp;gt; fields. By default Sphinx only indexes full words, but it would be very nice to be able to search for partial words by using wildcard characters. So here it is: &amp;lt;code&amp;gt;min_infix_len&amp;lt;/code&amp;gt; tells Sphinx the minimum length of subwords to index, and &amp;lt;code&amp;gt;enable_star&amp;lt;/code&amp;gt; tells it that we want to be able to use star as wildcard character. This way you can search for the word &#039;&#039;&#039;minimum&#039;&#039;&#039; by using &amp;lt;code&amp;gt;min*&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;*nim*&amp;lt;/code&amp;gt;, but not by using &amp;lt;code&amp;gt;mi*&amp;lt;/code&amp;gt; (because we told Sphinx the minimum length for subwords is 3 chars).&lt;br /&gt;
&lt;br /&gt;
The second index is &amp;lt;code&amp;gt;fulltextdelta&amp;lt;/code&amp;gt;, which is derived from &amp;lt;code&amp;gt;fulltext&amp;lt;/code&amp;gt;. As we saw above, everything is inherited but for things we explicitely override.&lt;br /&gt;
&lt;br /&gt;
At last we give some parameters for the inner working of &amp;lt;code&amp;gt;indexer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;searchd&amp;lt;/code&amp;gt;, which are two of the command line tools of Sphinx. The values shown here are good defaults.&lt;br /&gt;
&lt;br /&gt;
==== Building the indexes ====&lt;br /&gt;
&lt;br /&gt;
Now that we have a working configuration, it&#039;s time to build the indexes.&lt;br /&gt;
&lt;br /&gt;
You can initialize the indexes with the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/usr/local/bin/indexer --all&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
This will build all the indexes, and it will give you an idea of the time and disk space required for each index.&lt;br /&gt;
&lt;br /&gt;
For production use however, you want to put the commands in &amp;lt;code&amp;gt;cron&amp;lt;/code&amp;gt; so that indexes are refreshed regularly and automatically.&lt;br /&gt;
&lt;br /&gt;
We refresh the &amp;lt;code&amp;gt;fulltext1&amp;lt;/code&amp;gt; index once a day at 7 a.m., with this command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/usr/local/bin/indexer --rotate fulltext1&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;code&amp;gt;--rotate&amp;lt;/code&amp;gt; allows the index to be substituted while the search daemon is running.&lt;br /&gt;
&lt;br /&gt;
We refresh the &amp;lt;code&amp;gt;fulltextdelta&amp;lt;/code&amp;gt; index every 5 minutes with this command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/usr/local/bin/indexer --rotate fulltextdelta&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The search daemon ====&lt;br /&gt;
&lt;br /&gt;
Once you have built the indexes you can start searching from the command line with the &amp;lt;code&amp;gt;search&amp;lt;/code&amp;gt; tool. When you are confident your setup is correct, it&#039;s time to start the search daemon.&lt;br /&gt;
&lt;br /&gt;
We do this with the command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/usr/local/bin/searchd --config /usr/local/etc/sphinx.conf&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In our experience &amp;lt;code&amp;gt;searchd&amp;lt;/code&amp;gt; is not very stable (probably due to the beta release): it stops responding after a couple days of uptime, so we restart it daily.&lt;br /&gt;
&lt;br /&gt;
With this last step you have Sphinx all set up and working, so the first part of this tutorial ends here. Please note that Sphinx has a &#039;&#039;&#039;lot&#039;&#039;&#039; of options, that I have not described. I only describe here the options that proved useful for us. If you want to know more about Sphinx please refer to the Sphinx home page.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Second: using the API to query Sphinx ==&lt;br /&gt;
&lt;br /&gt;
So we now have Sphinx up and running and fully populated indexes that return correct results, but now we need to be able to interrogate Sphinx&#039; indexes from RT.&lt;br /&gt;
&lt;br /&gt;
To do this you have to talk to the search daemon, which speaks his own language: the Sphinx API. There are several implementations (PHP, Java, Python and even a third-party Perl API), but since we are mostly familiar with PHP we are going to use it to implement our interface.&lt;br /&gt;
&lt;br /&gt;
Before posting the actual PHP script, there are a few things I have to point out:&lt;br /&gt;
&lt;br /&gt;
* Mason does not support PHP out of the box, so we did a little hack that I&#039;ll explain later&lt;br /&gt;
* The script you&#039;ll see here contains in-line CSS to adapt the results to the default look of RT (web2). If you&#039;re using a different style you may want to change the inline CSS accordingly.&lt;br /&gt;
* The script spits out all the results in one page: there&#039;s still no support for pagination a-la RT.&lt;br /&gt;
* The script spits out &#039;&#039;&#039;ALL&#039;&#039;&#039; the results, including deleted, rejected, merged tickets.&lt;br /&gt;
&lt;br /&gt;
You see, the script is still a little rough, but I hope we&#039;ll be able to refine it with the help of the community.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;sphinx.php follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;amp;lt;html&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;head&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;title&amp;amp;gt;Ricerca Ticket Sphinx&amp;amp;lt;/title&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 		&amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
 			document.domain = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 		&amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 		&amp;amp;lt;style&amp;amp;gt;&lt;br /&gt;
 			body {font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}&lt;br /&gt;
 			table {font-size:inherit;font:100%;}&lt;br /&gt;
 			pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}&lt;br /&gt;
 &lt;br /&gt;
 			a {&lt;br /&gt;
 				color: #000;&lt;br /&gt;
 				text-decoration: none;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			div#body a:visited {&lt;br /&gt;
 				color: #666;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			/* background: #547CCC ; */&lt;br /&gt;
 			body {&lt;br /&gt;
 				padding:0;&lt;br /&gt;
 				margin:0;&lt;br /&gt;
 &lt;br /&gt;
 				background: #FFFFFF ;&lt;br /&gt;
 				font-family: arial, helvetica, sans-serif;&lt;br /&gt;
 &lt;br /&gt;
 				color: #000000;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list, table.queue-summary, table.collection {&lt;br /&gt;
 				margin-top: 0.75em;&lt;br /&gt;
 				font-size: 0.9em;&lt;br /&gt;
 				border: 1px solid #aaa;&lt;br /&gt;
 				border-bottom: 2px solid #999;&lt;br /&gt;
 				border-right: 2px solid #999;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary tr&amp;amp;gt;*:first-child {&lt;br /&gt;
 				padding-left: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary tr&amp;amp;gt;*:last-child {&lt;br /&gt;
 				padding-right: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list a, table.queue-summary a, table.collection a  {&lt;br /&gt;
 				font-weight: bold;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list th.collection-as-table, table.collection th.collection-as-table {&lt;br /&gt;
 				background: #ddd;&lt;br /&gt;
 				font-size: 0.9em;&lt;br /&gt;
 				margin-bottom: 0.5em;&lt;br /&gt;
 				text-align: left;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary th.collection-as-table {&lt;br /&gt;
 				font-size: 0.9em;&lt;br /&gt;
 				margin-bottom: 0.5em;&lt;br /&gt;
 				text-align: right;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary th.collection-as-table:first-child {&lt;br /&gt;
 				text-align: left;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.collection-as-table+tr.collection-as-table th {&lt;br /&gt;
 				border-bottom: 2px solid grey;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary td {&lt;br /&gt;
 				background: #efefef;&lt;br /&gt;
 				border-bottom: 1px solid #ccc;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.evenline td {&lt;br /&gt;
 				background: #eee;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.oddline td {&lt;br /&gt;
 				background: #fff;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.evenline td, tr.oddline td {&lt;br /&gt;
 				padding-top: 0.5em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.evenline+tr.evenline td, tr.oddline+tr.oddline td{&lt;br /&gt;
 				padding-top: 0;&lt;br /&gt;
 				border: none;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list td:first-child, table.ticket-list th:first-child {&lt;br /&gt;
 				padding-left: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list td:last-child, table.ticket-list th:last-child {&lt;br /&gt;
 				padding-right: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			th.collection-as-table , td.collection-as-table {&lt;br /&gt;
 				padding-right: 0.5em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			.pagenum.a:hover, .paging a.nav:hover{&lt;br /&gt;
 				text-decoration: underline;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			.pagenum *, .paging a.nav{&lt;br /&gt;
 				padding: .5em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			.currentpage{&lt;br /&gt;
 				text-decoration: none;&lt;br /&gt;
 				font-weight: bold;&lt;br /&gt;
 				background: #eee;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			div.paging{&lt;br /&gt;
 				text-align: center;&lt;br /&gt;
 				padding-bottom: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			#body&amp;amp;gt;table.ticket-list {&lt;br /&gt;
 				margin-bottom: 2em;&lt;br /&gt;
 			}&lt;br /&gt;
 		&amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;/head&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;body&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;?php&lt;br /&gt;
 		//Costante con il max numero di righe ritornate da Sphinx&lt;br /&gt;
 		define(&#039;SPHINX_MAX_LIMIT&#039;, 1000);&lt;br /&gt;
 &lt;br /&gt;
 		require_once(&amp;quot;Classi/sphinxapi.php&amp;quot;);&lt;br /&gt;
 		require_once(&amp;quot;Classi/Timer.class.php&amp;quot;);&lt;br /&gt;
 		require_once(&amp;quot;Classi/MySql.class.php&amp;quot;);&lt;br /&gt;
 		include_once(&amp;quot;Include/Query.inc.php&amp;quot;);&lt;br /&gt;
 		include_once(&amp;quot;Include/dvopendb.config.inc.php&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 		$MyTimer =  new Timer();&lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Parametri di connessione al Daemon Sphinx&lt;br /&gt;
 		$host = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 		$port = 9312;&lt;br /&gt;
 		$index = &amp;quot;*&amp;quot;; // put your index name here&lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Variabili in GET&lt;br /&gt;
 		$query = $_GET[&#039;Text&#039;];&lt;br /&gt;
 		$RequestorFilter = trim($_GET[&#039;Requestor&#039;]);&lt;br /&gt;
 		$CodaFilter = $_GET[&#039;Queue&#039;];&lt;br /&gt;
 		$DataInizioFilter = trim($_GET[&#039;From&#039;]);&lt;br /&gt;
 		$DataFineFilter = trim($_GET[&#039;To&#039;]);&lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Connessione al Daemon Sphinx&lt;br /&gt;
 		$cl = new SphinxClient();&lt;br /&gt;
 		$cl-&amp;amp;gt;SetServer($host, $port);&lt;br /&gt;
 		$cl-&amp;amp;gt;SetMatchMode(SPH_MATCH_EXTENDED2);&lt;br /&gt;
 		$cl-&amp;amp;gt;SetLimits(0,SPHINX_MAX_LIMIT, $max_matches=0, $cutoff=0 );&lt;br /&gt;
 &lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//MySql Database Query per la retrive dei dati del ticket&lt;br /&gt;
 &lt;br /&gt;
 		$SqlQuery = new MySql($DbHostName,$DbUser,$DbPassword,$DbName);&lt;br /&gt;
 		$SqlQuery-&amp;amp;gt;Connetti();&lt;br /&gt;
 &lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Filtri sulla ricerca Sphinx&lt;br /&gt;
 &lt;br /&gt;
 		//Check della query (parametro di ricerca)&lt;br /&gt;
 		if(strlen($query)==0)&lt;br /&gt;
 		{&lt;br /&gt;
 			echo &amp;quot;E&#039; necessario inserire un parametro di ricerca nella casella \&amp;quot;Text\&amp;quot; per proseguire.&amp;quot;;&lt;br /&gt;
 			exit(1);&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Filtro Requestor&lt;br /&gt;
 		if(strlen($RequestorFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			$TempQuery = sprintf($RequestorLookUpQuery,mysql_real_escape_string($RequestorFilter));&lt;br /&gt;
 			$SqlQuery-&amp;amp;gt;ExecQuery($TempQuery);&lt;br /&gt;
 			$RequestorResult = $SqlQuery-&amp;amp;gt;GetMonoArrayResult();&lt;br /&gt;
 			if(count($RequestorResult)&amp;amp;gt;0)&lt;br /&gt;
 			{&lt;br /&gt;
 				$cl-&amp;amp;gt;SetFilter (&amp;quot;createdby&amp;quot;,array($RequestorResult[&#039;id&#039;]) , $exclude=false );&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;&amp;amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;amp;gt;Warning - L&#039;indirizzo \&amp;quot;&amp;quot;.$RequestorFilter.&amp;quot;\&amp;quot; non e&#039; presente nel Database; La ricerca e&#039; stata effettuata per tutti i richiedenti&amp;amp;lt;/label&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 			}&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Filtro Queue&lt;br /&gt;
 		if(strlen($CodaFilter)&amp;amp;gt;0)&lt;br /&gt;
 			$cl-&amp;amp;gt;SetFilter (&amp;quot;queue&amp;quot;, array($CodaFilter), $exclude=false );&lt;br /&gt;
 &lt;br /&gt;
 		//Filtro Data&lt;br /&gt;
 &lt;br /&gt;
 		//__________________________________________________________________________________________________________________&lt;br /&gt;
 		//Check delle date&lt;br /&gt;
 		if(strlen($DataInizioFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			//Check Datainizio&lt;br /&gt;
 			if(checkdate(substr($DataInizioFilter,5,2),substr($DataInizioFilter,8,2),substr($DataInizioFilter,0,4))==false)&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;Data Inizio &amp;quot;.$DataInizioFilter.&amp;quot; non corretta &amp;quot;;&lt;br /&gt;
 				exit(1);&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 				 $DataInizio = mktime(0, 0, 0, substr($DataInizioFilter,5,2), substr($DataInizioFilter,8,2), substr($DataInizioFilter,0,4));&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if(strlen($DataFineFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{	//Check DataFine&lt;br /&gt;
 &lt;br /&gt;
 			if(checkdate(substr($DataFineFilter,5,2),substr($DataFineFilter,8,2),substr($DataFineFilter,0,4))==false)&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;Data Fine &amp;quot;.$DataFineFilter.&amp;quot; non corretta &amp;quot;;&lt;br /&gt;
 				exit(1);&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 				$DataFine = mktime(0, 0, 0, substr($DataFineFilter,5,2), substr($DataFineFilter,8,2), substr($DataFineFilter,0,4));&lt;br /&gt;
 		}&lt;br /&gt;
 		//__________________________________________________________________________________________________________________&lt;br /&gt;
 &lt;br /&gt;
 		//Filtraggio vero e proprio&lt;br /&gt;
 &lt;br /&gt;
 		//Se sono settate entrambe...&lt;br /&gt;
 		if(strlen($DataInizioFilter)&amp;amp;gt;0 &amp;amp;amp;&amp;amp;amp; strlen($DataFineFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			if($DataInizio &amp;amp;lt; $DataFine)&lt;br /&gt;
 			{&lt;br /&gt;
 				//Se sono settate entrambe le date filtro per entrambe&lt;br /&gt;
 				$cl-&amp;amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, $DataFine, $exclude=false );&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;La data Inizio &amp;quot;.$DataInizioFilter.&amp;quot; e&#039; maggiore della data di fine &amp;quot;.$DataFineFilter;&lt;br /&gt;
 				exit(1);&lt;br /&gt;
 			}&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Se solo DataInizio..&lt;br /&gt;
 		if(strlen($DataInizioFilter)&amp;amp;gt;0 &amp;amp;amp;&amp;amp;amp; strlen($DataFineFilter)==0)&lt;br /&gt;
 		{&lt;br /&gt;
 			$cl-&amp;amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, mktime(), $exclude=false );&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Se solo DataFine..&lt;br /&gt;
 		if(strlen($DataInizioFilter)==0 &amp;amp;amp;&amp;amp;amp; strlen($DataFineFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			//2008-11-14 : Data del primo Ticket di RT&lt;br /&gt;
 			//1988-07-18 : Data di nascita di AMENDED :)&lt;br /&gt;
 			$cl-&amp;amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, mktime(0, 0, 0,07,18,1988), $DataFine, $exclude=false );&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Eseguo la Query su Sphinx&lt;br /&gt;
 &lt;br /&gt;
 		$res = $cl-&amp;amp;gt;Query($query, $index);&lt;br /&gt;
 		if ($res == false)&lt;br /&gt;
 		{&lt;br /&gt;
 			echo &amp;quot;failure: &amp;quot;.$cl-&amp;amp;gt;GetLastError().&amp;quot;\n&amp;quot;;&lt;br /&gt;
 		}&lt;br /&gt;
 		else&lt;br /&gt;
 		{&lt;br /&gt;
 			if(count($res[&amp;quot;matches&amp;quot;])!=0)&lt;br /&gt;
 			{&lt;br /&gt;
 				//Se i risultati totali sono &amp;amp;gt; 1000&lt;br /&gt;
 				if($res[total_found]&amp;amp;gt;SPHINX_MAX_LIMIT)&lt;br /&gt;
 				{&lt;br /&gt;
 					echo &amp;quot;&amp;amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;amp;gt;Warning - Sono stati trovati &amp;quot;.$res[total_found].&amp;quot; risultati, verrano visualizzati solo i primi &amp;quot;.SPHINX_MAX_LIMIT.&amp;quot;&amp;amp;lt;/label&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 				}&lt;br /&gt;
 &lt;br /&gt;
 				//Se ci sono dei risultati creo la tabella e stampo&lt;br /&gt;
 				echo &amp;quot;&amp;amp;lt;table id=&#039;ResultTable&#039; class=&#039;ticket-list&#039; border=&#039;0&#039; cellspacing=&#039;0&#039; cellpadding=&#039;1&#039; width=&#039;100%&#039;&amp;amp;gt;&lt;br /&gt;
 						&amp;amp;lt;thead&amp;amp;gt;&lt;br /&gt;
 						&amp;amp;lt;tr class=&#039;collection-as-table&#039;&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;#&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Oggetto&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Coda&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Status&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Creato&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Richiedente&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Proprietario&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 						&amp;amp;lt;/tr&amp;amp;gt;&lt;br /&gt;
 						&amp;lt;/thead&amp;gt;&amp;lt;tbody&amp;gt;&amp;quot;;&lt;br /&gt;
 				foreach ($res[&amp;quot;matches&amp;quot;] as $key=&amp;amp;gt;$value)&lt;br /&gt;
 				{&lt;br /&gt;
 					$i++;&lt;br /&gt;
 					$TempQuery = sprintf($TicketDetailQuery,mysql_real_escape_string($key));&lt;br /&gt;
 					$SqlQuery-&amp;amp;gt;ExecQuery($TempQuery);&lt;br /&gt;
 					$Risultato = $SqlQuery-&amp;amp;gt;GetMonoArrayResult();&lt;br /&gt;
 					if($i%2==0)&lt;br /&gt;
 					{&lt;br /&gt;
 						echo &amp;quot;	&amp;amp;lt;tr class=&#039;evenline&#039;&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 								&amp;amp;lt;/tr&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 					}&lt;br /&gt;
 					else&lt;br /&gt;
 					{&lt;br /&gt;
 						echo &amp;quot;	&amp;amp;lt;tr class=&#039;oddline&#039;&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 								&amp;amp;lt;/tr&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 					}&lt;br /&gt;
 				}&lt;br /&gt;
 				echo &amp;quot;	&amp;lt;/tbody&amp;gt;&lt;br /&gt;
 					&amp;lt;tfoot&amp;gt;&amp;lt;/tfoot&amp;gt;&lt;br /&gt;
 					&amp;lt;/table&amp;gt;&amp;quot;;&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 			{&lt;br /&gt;
 				//...Altrimenti stampo che non ho trovato nulla&lt;br /&gt;
 				echo &amp;quot;&amp;amp;lt;br/&amp;amp;gt;&amp;amp;lt;label class=\&amp;quot;notfoundlabel\&amp;quot;&amp;amp;gt;Nessun risultato trovato&amp;amp;lt;/label&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			echo &amp;quot;Trovati &amp;quot;.$res[total].&amp;quot; di &amp;quot;.$res[total_found].&amp;quot; in &amp;quot;.$MyTimer-&amp;amp;gt;elapsed().&amp;quot; secondi&amp;quot;;&lt;br /&gt;
 		}&lt;br /&gt;
 		?&amp;amp;gt;&lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;dvopendb.config.inc.php follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;amp;lt;?php&lt;br /&gt;
  $DbHostName = &amp;quot;HOSTNAME_AMENDED:3306/rt3&amp;quot;;&lt;br /&gt;
  $DbUser = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
  $DbPassword = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
  $DbName = &amp;quot;rt3&amp;quot;;&lt;br /&gt;
  $DbQuery = &amp;quot;select EmailAddress, RealName from Users&amp;quot;;&lt;br /&gt;
  ?&amp;amp;gt;&lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;Query.inc.php follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;amp;lt;?php&lt;br /&gt;
  $TicketDetailQuery =&lt;br /&gt;
  &amp;quot;select Tickets.id,Subject,Status,Tickets.Created as Created,U1.Name as Requestor,U2.Name as Owner,Queues.Name as Queue&lt;br /&gt;
  from Tickets left outer join Users U1&lt;br /&gt;
  on U1.id = Tickets.Creator&lt;br /&gt;
  left outer join  Users U2&lt;br /&gt;
  on U2.id = Tickets.Owner&lt;br /&gt;
  left outer join Queues&lt;br /&gt;
  on  Queue = Queues.id&lt;br /&gt;
  where Tickets.id = %s&lt;br /&gt;
  &amp;quot;;&lt;br /&gt;
  &lt;br /&gt;
  $RequestorLookUpQuery =&lt;br /&gt;
  &amp;quot;select id&lt;br /&gt;
  from Users&lt;br /&gt;
  where EmailAddress = &#039;%s&#039;&lt;br /&gt;
  &amp;quot;;&lt;br /&gt;
  ?&amp;amp;gt;&lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This ends the step regarding the use of the Sphinx API to query the &amp;lt;code&amp;gt;searchd&amp;lt;/code&amp;gt; daemon.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Third: integrating it all into RT ==&lt;br /&gt;
&lt;br /&gt;
Now we need a way to call the php script from within RT. Well, technically we don&#039;t &#039;&#039;&#039;need&#039;&#039;&#039; it, but it would be very nice to have.&lt;br /&gt;
&lt;br /&gt;
For this task I found very useful the [[WritingPortlets]] section of this wiki, written by Andy D&#039;Arcy Jewell (thank you!)&lt;br /&gt;
&lt;br /&gt;
So the first thing I did was writing a portlet that one can integrate in the &amp;quot;RT at a glance&amp;quot; page.&lt;br /&gt;
&lt;br /&gt;
I put it in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/Elements. The portlet itself is in a file called SphinxSearch.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;SphinxSearch follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&amp;lt;&amp;amp;|/Widgets/TitleBox, title =&amp;gt; loc(&#039;Fulltext Search (Sphinx)&#039;), bodyclass =&amp;gt; &amp;quot;&amp;quot;,&lt;br /&gt;
     titleright =&amp;gt; loc(&#039;HELP&#039;), titleright_href =&amp;gt; RT-&amp;gt;Config-&amp;gt;Get(&#039;WebPath&#039;).&#039;/Prefs/SphinxHelp.html&#039;&amp;amp;&amp;gt;&lt;br /&gt;
  	&amp;lt;form name=&amp;quot;input&amp;quot; action=&amp;quot;/Tools/sphinx.html&amp;quot; method=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt;
  		&amp;lt;table&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Text&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;input type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;Text&amp;quot; /&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Queue&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;&amp;amp; /Elements/SelectQueue, Name =&amp;gt; &#039;Queue&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Requestor&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;&amp;amp; /Elements/EmailInput, Name =&amp;gt; &#039;Requestor&#039;, Size =&amp;gt; &#039;40&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;From&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;&amp;amp; /Elements/SelectDate, Name =&amp;gt; &amp;quot;From&amp;quot; || &#039;&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;To&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;&amp;amp; /Elements/SelectDate, Name =&amp;gt; &amp;quot;To&amp;quot; || &#039;&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  		&amp;lt;/table&amp;gt;&lt;br /&gt;
  		&amp;lt;div class=&amp;quot;submit&amp;quot;&amp;gt;&lt;br /&gt;
  			&amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;input class=&amp;quot;button&amp;quot; type=&amp;quot;submit&amp;quot; value=&amp;quot;Submit&amp;quot; /&amp;gt;&lt;br /&gt;
  			&amp;lt;/div&amp;gt;&lt;br /&gt;
  		&amp;lt;/div&amp;gt;&lt;br /&gt;
  	&amp;lt;/form&amp;gt;&lt;br /&gt;
  &amp;lt;/&amp;amp;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the result:&lt;br /&gt;
&lt;br /&gt;
[[File:Rt3p.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to keep the look and feel of RT by copying code from the other portlets. I even used RT syntax to allow the localization of string, but not everything gets translated since not all the terms are in RT resource files.&lt;br /&gt;
&lt;br /&gt;
Since Sphinx&#039; extended search syntax can be very elaborated, I put a HELP link in the upper right corner (circled in red in the image above). This points to a page that I extracted from Sphinx&#039; documentation. The page is in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/Prefs. The file is called SphinxHelp.html.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;SphinxHelp.html follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;amp;lt;&amp;amp;amp; /Elements/Header, Title =&amp;amp;gt; &amp;quot;Sphinx - Free open-source SQL full-text search engine&amp;quot; &amp;amp;amp;&amp;amp;gt;&lt;br /&gt;
 &amp;amp;lt;&amp;amp;amp; /Elements/Tabs,&lt;br /&gt;
 	Title =&amp;amp;gt; &amp;quot;Help for Sphinx search syntax&amp;quot;,&lt;br /&gt;
 	current_tab    =&amp;amp;gt; &#039;index.html&#039;,&lt;br /&gt;
 	current_toptab =&amp;amp;gt; &#039;index.html&#039;,&lt;br /&gt;
 	tabs           =&amp;amp;gt; $tabs,&lt;br /&gt;
 	actions        =&amp;amp;gt; $actions,&lt;br /&gt;
 &amp;amp;amp;&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;div align=&amp;quot;left&amp;quot; class=&amp;quot;refresh&amp;quot;&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
 			&amp;amp;lt;h2 style=&amp;quot;clear: both&amp;quot;&amp;amp;gt;&amp;amp;lt;a name=&amp;quot;extended-syntax&amp;quot;&amp;amp;gt;&amp;amp;lt;/a&amp;amp;gt;Extended query syntax&amp;amp;lt;/h2&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	The following special operators and modifiers can be used when using the extended matching mode:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
 			&amp;amp;lt;ul type=&amp;quot;disc&amp;quot;&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;operator OR: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;hello | world&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;operator NOT:&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 hello -world&lt;br /&gt;
 hello !world&amp;amp;lt;/pre&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;field search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@title hello @body world&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;field position limit modifier (introduced in version 0.9.9-rc1): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@body[50] hello&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;multiple-field search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@(title,body) hello world&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;all-field search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@* hello&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;phrase search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&amp;quot;hello world&amp;quot;&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;proximity search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&amp;quot;hello world&amp;quot;~10&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;quorum matching operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&amp;quot;the world is a wonderful place&amp;quot;/3&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;strict order operator (aka operator &amp;quot;before&amp;quot;): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;aaa &amp;amp;amp;lt;&amp;amp;amp;lt; bbb &amp;amp;amp;lt;&amp;amp;amp;lt; ccc&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;exact form modifier (introduced in version 0.9.9-rc1): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;raining =cats and =dogs&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;field-start and field-end modifier (introduced in version 0.9.9-rc2): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;^hello world$&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 			&amp;amp;lt;/ul&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	Here&#039;s an example query that uses some of these operators:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;div class=&amp;quot;example&amp;quot;&amp;amp;gt;&amp;amp;lt;a name=&amp;quot;ex-extended-query&amp;quot;&amp;amp;gt;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;p class=&amp;quot;title&amp;quot;&amp;amp;gt;&amp;amp;lt;b&amp;amp;gt;Example:&amp;amp;amp;nbsp;Extended matching mode: query example&amp;amp;lt;/b&amp;amp;gt;&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;div class=&amp;quot;example-contents&amp;quot;&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	&amp;quot;hello world&amp;quot; @title &amp;quot;example program&amp;quot;~5 @body python -(php|perl) @* code&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&amp;amp;lt;br class=&amp;quot;example-break&amp;quot;&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	The full meaning of this search is:&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;div class=&amp;quot;itemizedlist&amp;quot;&amp;amp;gt;&amp;amp;lt;ul type=&amp;quot;disc&amp;quot;&amp;amp;gt;&amp;amp;lt;li&amp;amp;gt;Find the words &#039;hello&#039; and &#039;world&#039; adjacently in any field in a document;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;li&amp;amp;gt;Additionally, the same document must also contain the words &#039;example&#039; and &#039;program&#039;&lt;br /&gt;
 		in the title field, with up to, but not including, 10 words between the words in question;&lt;br /&gt;
 		(E.g. &amp;quot;example PHP program&amp;quot; would be matched however &amp;quot;example script to introduce outside data&lt;br /&gt;
 		into the correct context for your program&amp;quot; would not because two terms have 10 or more words between them)&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;li&amp;amp;gt;Additionally, the same document must contain the word &#039;python&#039; in the body field, but not contain either &#039;php&#039; or &#039;perl&#039;;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;li&amp;amp;gt;Additionally, the same document must contain the word &#039;code&#039; in any field.&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/ul&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	There always is implicit AND operator, so &amp;quot;hello world&amp;quot; means that&lt;br /&gt;
 	both &amp;quot;hello&amp;quot; and &amp;quot;world&amp;quot; must be present in matching document.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	OR operator precedence is higher than AND, so &amp;quot;looking for cat | dog | mouse&amp;quot;&lt;br /&gt;
 	means &amp;quot;looking for ( cat | dog | mouse )&amp;quot; and &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;not&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;quot;(looking for cat) | dog | mouse&amp;quot;.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Field limit operator limits subsequent searching to a given field.&lt;br /&gt;
 	Normally, query will fail with an error message if given field name does not exist&lt;br /&gt;
 	in the searched index. However, that can be suppressed by specifying &amp;quot;@@relaxed&amp;quot;&lt;br /&gt;
 	option at the very beginning of the query:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	@@relaxed @nosuchfield my query&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	This can be helpful when searching through heterogeneous indexes with&lt;br /&gt;
 	different schemas.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Field position limit, introduced in version 0.9.9-rc1, additionaly restricts the searching&lt;br /&gt;
 	to first N position within given field (or fields). For example, &amp;quot;@body[50] hello&amp;quot; will&lt;br /&gt;
 	&amp;amp;lt;span class=&amp;quot;bold&amp;quot;&amp;amp;gt;&amp;amp;lt;strong&amp;amp;gt;not&amp;amp;lt;/strong&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt; match the documents where the keyword &#039;hello&#039; occurs at position 51 and below&lt;br /&gt;
 	in the body.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Proximity distance is specified in words, adjusted for word count, and&lt;br /&gt;
 	applies to all words within quotes. For instance, &amp;quot;cat dog mouse&amp;quot;~5 query&lt;br /&gt;
 	means that there must be less than 8-word span which contains all 3 words,&lt;br /&gt;
 	ie. &amp;quot;CAT aaa bbb ccc DOG eee fff MOUSE&amp;quot; document will &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;not&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;&lt;br /&gt;
 	match this query, because this span is exactly 8 words long.&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Quorum matching operator introduces a kind of fuzzy matching.&lt;br /&gt;
 	It will only match those documents that pass a given threshold of given words.&lt;br /&gt;
 	The example above (&amp;quot;the world is a wonderful place&amp;quot;/3) will match all documents&lt;br /&gt;
 	that have at least 3 of the 6 specified words.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Strict order operator (aka operator &amp;quot;before&amp;quot;), introduced in version 0.9.9-rc2,&lt;br /&gt;
 	will match the document only if its argument keywords occur in the document&lt;br /&gt;
 	exactly in the query order. For instance, &amp;quot;black &amp;amp;amp;lt;&amp;amp;amp;lt; cat&amp;quot; query (without&lt;br /&gt;
 	quotes) will match the document &amp;quot;black and white cat&amp;quot; but &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;not&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;&lt;br /&gt;
 	the &amp;quot;that cat was black&amp;quot; document. Order operator has the lowest priority.&lt;br /&gt;
 	It can be applied both to just keywords and more complex expressions,&lt;br /&gt;
 	ie. this is a valid query:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	(bag of words) &amp;amp;amp;lt;&amp;amp;amp;lt; &amp;quot;exact phrase&amp;quot; &amp;amp;amp;lt;&amp;amp;amp;lt; red|green|blue&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	Exact form keyword modifier, introduced in version 0.9.9-rc1, will match the document only if the keyword occurred&lt;br /&gt;
 	in exactly the specified form. The default behaviour is to match the document&lt;br /&gt;
 	if the stemmed keyword matches. For instance, &amp;quot;runs&amp;quot; query will match both&lt;br /&gt;
 	the document that contains &amp;quot;runs&amp;quot; &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;and&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt; the document that&lt;br /&gt;
 	contains &amp;quot;running&amp;quot;, because both forms stem to just &amp;quot;run&amp;quot; - while &amp;quot;=runs&amp;quot;&lt;br /&gt;
 	query will only match the first document. Exact form operator requires&lt;br /&gt;
 	&amp;amp;lt;a href=&amp;quot;#conf-index-exact-words&amp;quot; title=&amp;quot;11.2.39.&amp;amp;amp;nbsp;index_exact_words&amp;quot;&amp;amp;gt;index_exact_words&amp;amp;lt;/a&amp;amp;gt; option to be enabled.&lt;br /&gt;
 	This is a modifier that affects the keyword and thus can be used within&lt;br /&gt;
 	operators such as phrase, proximity, and quorum operators.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Field-start and field-end keyword modifiers, introduced in version 0.9.9-rc2,&lt;br /&gt;
 	will make the keyword match only if it occurred at the very start or the very end&lt;br /&gt;
 	of a fulltext field, respectively. For instance, the query &amp;quot;^hello world$&amp;quot;&lt;br /&gt;
 	(with quotes and thus combining phrase operator and start/end modifiers)&lt;br /&gt;
 	will only match documents that contain at least one field that has exactly&lt;br /&gt;
 	these two keywords.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Starting with 0.9.9-rc1, arbitrarily nested brackets and negations are allowed.&lt;br /&gt;
 	However, the query must be possible to compute without involving an implicit&lt;br /&gt;
 	list of all documents:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	// correct query&lt;br /&gt;
 	aaa -(bbb -(ccc ddd))&lt;br /&gt;
 &lt;br /&gt;
 	// queries that are non-computable&lt;br /&gt;
 	-aaa&lt;br /&gt;
 	aaa | -bbb&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;div align=&amp;quot;right&amp;quot; class=&amp;quot;search-result-actions&amp;quot;&amp;amp;gt;&lt;br /&gt;
 &amp;amp;amp;nbsp;&lt;br /&gt;
 &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;%init&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 my @results;&lt;br /&gt;
 my $skip_create = 1;&lt;br /&gt;
 my $actions;&lt;br /&gt;
 my $tabs = $m-&amp;amp;gt;comp(&amp;quot;/Elements/DashboardTabs&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;/%init&amp;amp;gt;&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last part is about passing the form&#039;s (portlet) parameters to the PHP script.&lt;br /&gt;
&lt;br /&gt;
As I told you before, the problem here is that Mason does not support PHP out of the box. I found a few hacks around the web to make Mason support PHP, but they were either not applicable to our environment or too difficult to apply.&lt;br /&gt;
&lt;br /&gt;
So we implemented another hack: since we already have another virtual domain where PHP works, we created an html page that embeds (within an iframe) the results from the PHP page that resides in the other virtual domain.&lt;br /&gt;
&lt;br /&gt;
That&#039;s why you see this little piece of code&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
     document.domain = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in the PHP script above: you have to declare that both the HTML page and the PHP script belong to the same domain (although on different subdomains), otherwise you get a security error in the browser.&lt;br /&gt;
&lt;br /&gt;
The html page is located in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/Tools and the file is called sphinx.html.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;sphinx.html follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&amp;lt;&amp;amp; /Elements/Header, Title =&amp;gt; &amp;quot;Search results&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
  &amp;lt;&amp;amp; /Elements/Tabs,&lt;br /&gt;
  	Title =&amp;gt; &amp;quot;Search results&amp;quot;,&lt;br /&gt;
  	current_tab    =&amp;gt; &#039;index.html&#039;,&lt;br /&gt;
  	current_toptab =&amp;gt; &#039;index.html&#039;,&lt;br /&gt;
  	tabs           =&amp;gt; $tabs,&lt;br /&gt;
  	actions        =&amp;gt; $actions,&lt;br /&gt;
  &amp;amp;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;div align=&amp;quot;left&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;table width=95% border=0&amp;gt;&lt;br /&gt;
  	&amp;lt;tr&amp;gt;&lt;br /&gt;
  		&amp;lt;td&amp;gt;&lt;br /&gt;
  			&amp;lt;iframe id=&amp;quot;sphinxresults&amp;quot; src=&amp;quot;http://PHP_VIRTDOMAIN_AMENDED/sphinx.php?&amp;lt;% &amp;quot;Text=&amp;quot; . $Text . &amp;quot;&amp;amp;Queue=&amp;quot; . $Queue . &amp;quot;&amp;amp;Requestor=&amp;quot; . $Requestor . &amp;quot;&amp;amp;From=&amp;quot; . $From . &amp;quot;&amp;amp;To=&amp;quot; . $To %&amp;gt;&amp;quot; width=&amp;quot;95%&amp;quot; height=&amp;quot;200&amp;quot; frameborder=&amp;quot;0&amp;quot; onload=&amp;quot;resizeIframeToFitContent(this)&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;br /&gt;
  		&amp;lt;/td&amp;gt;&lt;br /&gt;
  	&amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;/table&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;div align=&amp;quot;right&amp;quot; class=&amp;quot;search-result-actions&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;amp;nbsp;&lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;%init&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  my @results;&lt;br /&gt;
  my $skip_create = 1;&lt;br /&gt;
  my $actions;&lt;br /&gt;
  my $tabs = $m-&amp;gt;comp(&amp;quot;/Elements/DashboardTabs&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/%init&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;%args&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  $Text&lt;br /&gt;
  $Queue =&amp;gt; &#039;&#039;&lt;br /&gt;
  $Requestor =&amp;gt; &#039;&#039;&lt;br /&gt;
  $From =&amp;gt; &#039;&#039;&lt;br /&gt;
  $To =&amp;gt; &#039;&#039;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/%args&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is one last piece of code that we need to put in place: it allows us to insert a little piece of custom CSS and custom Javascript in all RT page headers.&lt;br /&gt;
&lt;br /&gt;
You have to create a file called InHeader in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/NoAuth/css/web2 (web2 is the name of the default RT CSS, if you use another CSS you have to change this path). The contents of this file are shown below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;InHeader follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;amp;lt;style&amp;amp;gt;&lt;br /&gt;
 	pre.programlisting&lt;br /&gt;
 	{&lt;br /&gt;
 		background-color:	#f0f0f0;&lt;br /&gt;
 		padding:			0.5em;&lt;br /&gt;
 		margin-left:		2em;&lt;br /&gt;
 		margin-right:		2em;&lt;br /&gt;
 	}&lt;br /&gt;
 &amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
 function resizeIframeToFitContent(iframe) {&lt;br /&gt;
 	// This function resizes an IFrame object&lt;br /&gt;
 	// to fit its content.&lt;br /&gt;
 	// The IFrame tag must have a unique ID attribute.&lt;br /&gt;
 	iframe.height = document.getElementById(iframe.id).contentWindow.document.body.scrollHeight + 50;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	document.domain = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, to add our portlet to the installable portlets in RT, you have to modify your [[RT SiteConfig|RT_SiteConfig]].pm file and add the portlet name to the $HomePageComponents variable. If you don&#039;t see the $HomePageComponents variable in your [[RT SiteConfig|RT_SiteConfig]].pm file, copy it from the [[RT Config|RT_Config]].pm file.&lt;br /&gt;
&lt;br /&gt;
Mine looks like this:&lt;br /&gt;
&lt;br /&gt;
Set($HomepageComponents, [qw(QuickCreate Quicksearch MyAdminQueues MySupportQueues MyReminders RefreshHomepage Dashboards SphinxSearch)]);&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Whew, it was long, but not difficult I hope.&lt;br /&gt;
&lt;br /&gt;
Following the instruction in this article you get an installable portlet that will allow you to easily (and &#039;&#039;&#039;quickly&#039;&#039;&#039;!) search the RT ticket database.&lt;br /&gt;
&lt;br /&gt;
Sphinx&#039; syntax allows very powerful searches and its performance is unbeatable. We find it so convenient that we&#039;ve found us often using it in place of every other search.&lt;br /&gt;
&lt;br /&gt;
We had to implement a few hacks to embed the PHP code, but that&#039;s just because we were more familiar with PHP. If you are a Perl hacker you can use the Sphinx&#039; Perl API to integrate Sphinx even better. Let&#039;s see what the community can come up with!&lt;br /&gt;
&lt;br /&gt;
I hope this was useful. If you need help, I can be reached through RT mailing lists.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------&lt;br /&gt;
&lt;br /&gt;
-----------------&lt;br /&gt;
&lt;br /&gt;
Thanks to Cris for this documentation! Here are a few things we changed for our organisation : &lt;br /&gt;
&lt;br /&gt;
With the missing files included in sphinx.php, I had to change a few things so here is my spinx.php file : &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
        &amp;lt;head&amp;gt;&lt;br /&gt;
                &amp;lt;title&amp;gt;Recherche Ticket Sphinx&amp;lt;/title&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;script src=&amp;quot;Classi/sorttable.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
                &amp;lt;style&amp;gt;&lt;br /&gt;
                        body {font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}&lt;br /&gt;
                        table {font-size:inherit;font:100%;}&lt;br /&gt;
                        pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}&lt;br /&gt;
&lt;br /&gt;
                        a {&lt;br /&gt;
                                color: #000;&lt;br /&gt;
                                text-decoration: none;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        div#body a:visited {&lt;br /&gt;
                                color: #666;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        /* background: #547CCC ; */&lt;br /&gt;
                        body {&lt;br /&gt;
                                padding:0;&lt;br /&gt;
                                margin:0;&lt;br /&gt;
&lt;br /&gt;
                                background: #FFFFFF ;&lt;br /&gt;
                                font-family: arial, helvetica, sans-serif;&lt;br /&gt;
&lt;br /&gt;
                                color: #000000;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list, table.queue-summary, table.collection {&lt;br /&gt;
                                margin-top: 0.75em;&lt;br /&gt;
                                font-size: 0.9em;&lt;br /&gt;
                                border: 1px solid #aaa;&lt;br /&gt;
                                border-bottom: 2px solid #999;&lt;br /&gt;
                                border-right: 2px solid #999;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary tr&amp;gt;*:first-child {&lt;br /&gt;
                                padding-left: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary tr&amp;gt;*:last-child {&lt;br /&gt;
                                padding-right: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list a, table.queue-summary a, table.collection a  {&lt;br /&gt;
                                font-weight: bold;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list th.collection-as-table, table.collection th.collection-as-table {&lt;br /&gt;
                                background: #ddd;&lt;br /&gt;
                                font-size: 0.9em;&lt;br /&gt;
                                margin-bottom: 0.5em;&lt;br /&gt;
                                text-align: left;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary th.collection-as-table {&lt;br /&gt;
                                font-size: 0.9em;&lt;br /&gt;
                                margin-bottom: 0.5em;&lt;br /&gt;
                                text-align: right;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary th.collection-as-table:first-child {&lt;br /&gt;
                                text-align: left;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.collection-as-table+tr.collection-as-table th {&lt;br /&gt;
                                border-bottom: 2px solid grey;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary td {&lt;br /&gt;
                                background: #efefef;&lt;br /&gt;
                                border-bottom: 1px solid #ccc;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.evenline td {&lt;br /&gt;
                                background: #eee;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.oddline td {&lt;br /&gt;
                                background: #fff;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.evenline td, tr.oddline td {&lt;br /&gt;
                                padding-top: 0.5em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.evenline+tr.evenline td, tr.oddline+tr.oddline td{&lt;br /&gt;
                                padding-top: 0;&lt;br /&gt;
                                border: none;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list td:first-child, table.ticket-list th:first-child {&lt;br /&gt;
                                padding-left: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list td:last-child, table.ticket-list th:last-child {&lt;br /&gt;
                                padding-right: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        th.collection-as-table , td.collection-as-table {&lt;br /&gt;
                                padding-right: 0.5em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        .pagenum.a:hover, .paging a.nav:hover{&lt;br /&gt;
                                text-decoration: underline;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        .pagenum *, .paging a.nav{&lt;br /&gt;
                                padding: .5em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        .currentpage{&lt;br /&gt;
                                text-decoration: none;&lt;br /&gt;
                                font-weight: bold;&lt;br /&gt;
                                background: #eee;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        div.paging{&lt;br /&gt;
                                text-align: center;&lt;br /&gt;
                                padding-bottom: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        #body&amp;gt;table.ticket-list {&lt;br /&gt;
                                margin-bottom: 2em;&lt;br /&gt;
                        }&lt;br /&gt;
                &amp;lt;/style&amp;gt;&lt;br /&gt;
                &amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;body&amp;gt;&lt;br /&gt;
                &amp;lt;?php&lt;br /&gt;
                //Costante con il max numero di righe ritornate da Sphinx&lt;br /&gt;
                define(&#039;SPHINX_MAX_LIMIT&#039;, 1000);&lt;br /&gt;
&lt;br /&gt;
                require_once(&amp;quot;Classi/sphinxapi.php&amp;quot;);&lt;br /&gt;
                //require_once(&amp;quot;Classi/Timer.class.php&amp;quot;);&lt;br /&gt;
                require_once(&amp;quot;Classi/MySql.class.php&amp;quot;);&lt;br /&gt;
                require_once(&amp;quot;Classi/ErrorManager.class.php&amp;quot;);&lt;br /&gt;
                include_once(&amp;quot;Include/Query.inc.php&amp;quot;);&lt;br /&gt;
                include_once(&amp;quot;Include/dvopendb.config.inc.php&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        //      $MyTimer =  new Timer();&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Parametri di connessione al Daemon Sphinx&lt;br /&gt;
                $host = &amp;quot;localhost&amp;quot;;&lt;br /&gt;
                $port = 9312;&lt;br /&gt;
                $index = &amp;quot;*&amp;quot;; // put your index name here&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Variabili in GET&lt;br /&gt;
                $query = $_GET[&#039;Text&#039;];&lt;br /&gt;
                $RequestorFilter = trim($_GET[&#039;Requestor&#039;]);&lt;br /&gt;
                $CodaFilter = $_GET[&#039;Queue&#039;];&lt;br /&gt;
                $DataInizioFilter = trim($_GET[&#039;From&#039;]);&lt;br /&gt;
                $DataFineFilter = trim($_GET[&#039;To&#039;]);&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Connessione al Daemon Sphinx&lt;br /&gt;
                $cl = new SphinxClient();&lt;br /&gt;
                $cl-&amp;gt;SetServer($host, $port);&lt;br /&gt;
                $cl-&amp;gt;SetMatchMode(SPH_MATCH_EXTENDED2);&lt;br /&gt;
                $cl-&amp;gt;SetLimits(0,SPHINX_MAX_LIMIT, $max_matches=0, $cutoff=0 );&lt;br /&gt;
&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //MySql Database Query per la retrive dei dati del ticket&lt;br /&gt;
&lt;br /&gt;
                $SqlQuery = new MySql();&lt;br /&gt;
                $SqlQuery-&amp;gt;connect($DbHostName,$DbName,$DbUser,$DbPassword);&lt;br /&gt;
&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Filtri sulla ricerca Sphinx&lt;br /&gt;
&lt;br /&gt;
                //Check della query (parametro di ricerca)&lt;br /&gt;
                if(strlen($query)==0)&lt;br /&gt;
                {&lt;br /&gt;
                        echo &amp;quot;Un paramètre doit être inscrit dans la zone  \&amp;quot;Texte\&amp;quot; pour continuer.&amp;quot;;&lt;br /&gt;
                        exit(1);&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Filtro Requestor&lt;br /&gt;
                if(strlen($RequestorFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        $TempQuery = sprintf($RequestorLookUpQuery,mysql_real_escape_string($RequestorFilter));&lt;br /&gt;
//                      $result22 = $SqlQuery-&amp;gt;query($TempQuery);&lt;br /&gt;
//                      $RequestorResult = $SqlQuery-&amp;gt;fetchAll($result22);&lt;br /&gt;
                                        $result22 = $SqlQuery-&amp;gt;query($TempQuery);&lt;br /&gt;
                                        $RequestorResult = mysql_fetch_array($result22);&lt;br /&gt;
                        if(count($RequestorResult)&amp;gt;0)&lt;br /&gt;
                        {&lt;br /&gt;
                                $cl-&amp;gt;SetFilter (&amp;quot;createdby&amp;quot;,array($RequestorResult[&#039;id&#039;]) , $exclude=false );&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;&amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;gt;Attention - L&#039;adresse \&amp;quot;&amp;quot;.$RequestorFilter.&amp;quot;\&amp;quot; n&#039;est pas dans la base de donnée et la recherche a été effectuée &amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Filtro Queue&lt;br /&gt;
                if(strlen($CodaFilter)&amp;gt;0)&lt;br /&gt;
                        $cl-&amp;gt;SetFilter (&amp;quot;queue&amp;quot;, array($CodaFilter), $exclude=false );&lt;br /&gt;
&lt;br /&gt;
                //Filtro Data&lt;br /&gt;
&lt;br /&gt;
                //__________________________________________________________________________________________________________________&lt;br /&gt;
                //Check delle date&lt;br /&gt;
                if(strlen($DataInizioFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        //Check Datainizio&lt;br /&gt;
                        if(checkdate(substr($DataInizioFilter,5,2),substr($DataInizioFilter,8,2),substr($DataInizioFilter,0,4))==false)&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;Date de début &amp;quot;.$DataInizioFilter.&amp;quot; incorrecte &amp;quot;;&lt;br /&gt;
                                exit(1);&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                                 $DataInizio = mktime(0, 0, 0, substr($DataInizioFilter,5,2), substr($DataInizioFilter,8,2), substr($DataInizioFilter,0,4));&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                if(strlen($DataFineFilter)&amp;gt;0)&lt;br /&gt;
                {       //Check DataFine&lt;br /&gt;
&lt;br /&gt;
                        if(checkdate(substr($DataFineFilter,5,2),substr($DataFineFilter,8,2),substr($DataFineFilter,0,4))==false)&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;Date de fin &amp;quot;.$DataFineFilter.&amp;quot; incorrecte &amp;quot;;&lt;br /&gt;
                                exit(1);&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                                $DataFine = mktime(0, 0, 0, substr($DataFineFilter,5,2), substr($DataFineFilter,8,2), substr($DataFineFilter,0,4));&lt;br /&gt;
                }&lt;br /&gt;
                //__________________________________________________________________________________________________________________&lt;br /&gt;
&lt;br /&gt;
                //Filtraggio vero e proprio&lt;br /&gt;
&lt;br /&gt;
                //Se sono settate entrambe...&lt;br /&gt;
                if(strlen($DataInizioFilter)&amp;gt;0 &amp;amp;&amp;amp; strlen($DataFineFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        if($DataInizio &amp;lt; $DataFine)&lt;br /&gt;
                        {&lt;br /&gt;
                                //Se sono settate entrambe le date filtro per entrambe&lt;br /&gt;
                                $cl-&amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, $DataFine, $exclude=false );&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;La date de début &amp;quot;.$DataInizioFilter.&amp;quot; est supérieure à la date de fin &amp;quot;.$DataFineFilter;&lt;br /&gt;
                                exit(1);&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Se solo DataInizio..&lt;br /&gt;
                if(strlen($DataInizioFilter)&amp;gt;0 &amp;amp;&amp;amp; strlen($DataFineFilter)==0)&lt;br /&gt;
                {&lt;br /&gt;
                        $cl-&amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, mktime(), $exclude=false );&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Se solo DataFine..&lt;br /&gt;
                if(strlen($DataInizioFilter)==0 &amp;amp;&amp;amp; strlen($DataFineFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        //2008-11-14 : Data del primo Ticket di RT&lt;br /&gt;
                        //1988-07-18 : Data di nascita di AMENDED :)&lt;br /&gt;
                        $cl-&amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, mktime(0, 0, 0,07,18,1988), $DataFine, $exclude=false );&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Eseguo la Query su Sphinx&lt;br /&gt;
&lt;br /&gt;
                $res = $cl-&amp;gt;Query($query, $index);&lt;br /&gt;
                if ($res == false)&lt;br /&gt;
                {&lt;br /&gt;
                        echo &amp;quot;failure: &amp;quot;.$cl-&amp;gt;GetLastError().&amp;quot;\n&amp;quot;;&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                        if(count($res[&#039;matches&#039;])!=0)&lt;br /&gt;
                        {&lt;br /&gt;
                                //Se i risultati totali sono &amp;gt; 1000&lt;br /&gt;
                                if($res[&#039;total_found&#039;]&amp;gt;SPHINX_MAX_LIMIT)&lt;br /&gt;
                                {&lt;br /&gt;
                                        echo &amp;quot;&amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;gt; Attention, &amp;quot;.$res[total_found].&amp;quot; résultats ont été trouvés, mais vous ne verrez que les premiers &amp;quot;.SPHINX_MAX_LIMIT.&amp;quot; résultats.&amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
                                }&lt;br /&gt;
&lt;br /&gt;
                                //Se ci sono dei risultati creo la tabella e stampo&lt;br /&gt;
                                //echo &amp;quot;&amp;lt;table id=&#039;ResultTable&#039; class=&#039;ticket-list&#039; border=&#039;0&#039; cellspacing=&#039;0&#039; cellpadding=&#039;1&#039; width=&#039;100%&#039;&amp;gt;&lt;br /&gt;
                                echo &amp;quot;&amp;lt;table id=&#039;ResultTable&#039; class=&#039;sortable&#039; border=&#039;0&#039; cellspacing=&#039;0&#039; cellpadding=&#039;1&#039; width=&#039;100%&#039;&amp;gt;&lt;br /&gt;
                                                &amp;lt;thead&amp;gt;&lt;br /&gt;
                                                &amp;lt;tr class=&#039;collection-as-table&#039;&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;#&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Sujet&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;École&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Status&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Date_de_création&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Demandeur&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Propriétaire&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                                                &amp;lt;/thead&amp;gt;&amp;lt;tbody&amp;gt;&amp;quot;;&lt;br /&gt;
                                foreach ($res[&amp;quot;matches&amp;quot;] as $key=&amp;gt;$value)&lt;br /&gt;
                                {&lt;br /&gt;
                                        $i++;&lt;br /&gt;
                                        $TempQuery = sprintf($TicketDetailQuery,mysql_real_escape_string($key));&lt;br /&gt;
                                        $result34 = $SqlQuery-&amp;gt;query($TempQuery);&lt;br /&gt;
                                        $Risultato = mysql_fetch_array($result34);&lt;br /&gt;
                                        //$Risultato = $SqlQuery-&amp;gt;queryFetchAll($TempQuery);&lt;br /&gt;
                                        //$Risultato = $SqlQuery-&amp;gt;fetchAll($result23);&lt;br /&gt;
                                        if($i%2==0)&lt;br /&gt;
                                        {&lt;br /&gt;
                                                                                        echo &amp;quot;  &amp;lt;tr class=&#039;evenline&#039;&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                &amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
                                        }&lt;br /&gt;
                                        else&lt;br /&gt;
                                        {&lt;br /&gt;
                                                echo &amp;quot;  &amp;lt;tr class=&#039;oddline&#039;&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                &amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
                                        }&lt;br /&gt;
                                }&lt;br /&gt;
                                echo &amp;quot;  &amp;lt;/tbody&amp;gt;&lt;br /&gt;
                                        &amp;lt;tfoot&amp;gt;&amp;lt;/tfoot&amp;gt;&lt;br /&gt;
                                        &amp;lt;/table&amp;gt;&amp;quot;;&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                        {&lt;br /&gt;
                                //...Altrimenti stampo che non ho trovato nulla&lt;br /&gt;
                                echo &amp;quot;&amp;lt;br/&amp;gt;&amp;lt;label class=\&amp;quot;notfoundlabel\&amp;quot;&amp;gt;Aucun résultat trouvé&amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        echo &amp;quot;Résultats &amp;quot;.$res[&#039;total&#039;].&amp;quot; de &amp;quot;.$res[&#039;total_found&#039;]; // in &amp;quot;.$MyTimer-&amp;gt;elapsed().&amp;quot; secondi&amp;quot;;&lt;br /&gt;
                }&lt;br /&gt;
                ?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is my Classi/MySql.class.php file&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
class MySQLException extends Exception { }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class MySQL {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private $host = null,&lt;br /&gt;
                        $baseName = null,&lt;br /&gt;
                        $user = null,&lt;br /&gt;
                        $id = null;&lt;br /&gt;
&lt;br /&gt;
        private $errorManager = null;&lt;br /&gt;
&lt;br /&gt;
        private $queries = array();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function __construct() {&lt;br /&gt;
&lt;br /&gt;
                $this-&amp;gt;errorManager = ErrorManager::getInstance();&lt;br /&gt;
&lt;br /&gt;
        } // public function __construct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getHost() { return $this-&amp;gt;host; }&lt;br /&gt;
        public function getBaseName() { return $this-&amp;gt;baseName; }&lt;br /&gt;
        public function getUser() { return $this-&amp;gt;user; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function connect($host, $base, $user, $password, $enconding = &amp;quot;utf8&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                if (!($this-&amp;gt;id = mysql_connect($host, $user, $password))) {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;host = null;&lt;br /&gt;
                        $this-&amp;gt;base = null;&lt;br /&gt;
                        $this-&amp;gt;user = null;&lt;br /&gt;
                        $this-&amp;gt;id = null;&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;database connection failed!&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                        $this-&amp;gt;host = $host;&lt;br /&gt;
                        $this-&amp;gt;user = $user;&lt;br /&gt;
                        if (mysql_select_db($base, $this-&amp;gt;id)) {&lt;br /&gt;
                                $this-&amp;gt;baseName = $base;&lt;br /&gt;
                        }&lt;br /&gt;
                        mysql_query(&amp;quot;set names $enconding&amp;quot;, $this-&amp;gt;id);&lt;br /&gt;
                        //mysql_set_charset($enconding, $this-&amp;gt;id);&lt;br /&gt;
                        return true;&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function connect($host, $base, $user, $password)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getLastId() {&lt;br /&gt;
&lt;br /&gt;
                if (is_resource($this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                        $lastId = mysql_insert_id($this-&amp;gt;id);&lt;br /&gt;
                        return $lastId;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;database is not connected, can&#039;t get last id&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function getLastId()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function fetchAll($result) {&lt;br /&gt;
&lt;br /&gt;
                if (mysql_num_rows($result)) {&lt;br /&gt;
&lt;br /&gt;
                        $rows = array();&lt;br /&gt;
&lt;br /&gt;
                        while ($row = mysql_fetch_assoc($result)) {&lt;br /&gt;
                                $rows[] = $row;&lt;br /&gt;
                        }&lt;br /&gt;
                        return $rows;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;invalid mysql query result supplied to fetchAll()&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function fetchAll($result)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function query($string) {&lt;br /&gt;
&lt;br /&gt;
                if (is_resource($this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                        if ($result = mysql_query($string, $this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                                $this-&amp;gt;queries[] = $string;&lt;br /&gt;
                                return $result;&lt;br /&gt;
&lt;br /&gt;
                        }&lt;br /&gt;
                        else {&lt;br /&gt;
                                $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;error in query: &#039;$string&#039;:&amp;quot;.mysql_error($this-&amp;gt;id)));&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;database is not connected, can&#039;t make query&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function query($string)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function queryFetchAll($query) {&lt;br /&gt;
&lt;br /&gt;
                $result = $this-&amp;gt;query($query);&lt;br /&gt;
                $entries = $this-&amp;gt;fetchAll($result);&lt;br /&gt;
&lt;br /&gt;
                return $entries;&lt;br /&gt;
&lt;br /&gt;
        } // public function queryFetchAll($query)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getQueries() {&lt;br /&gt;
&lt;br /&gt;
                return $this-&amp;gt;queries;&lt;br /&gt;
&lt;br /&gt;
        } // public function getQueries()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function __destruct() {&lt;br /&gt;
&lt;br /&gt;
                if (is_resource($this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                        mysql_close($this-&amp;gt;id);&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function __destruct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} // class Mysql&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I added ErrorManager.class.php also : &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class ErrorManager {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private static $instance = null;&lt;br /&gt;
&lt;br /&gt;
        private $errors = array();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private function __construct() { }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public static function getInstance() {&lt;br /&gt;
&lt;br /&gt;
                if (self::$instance == null) {&lt;br /&gt;
&lt;br /&gt;
                        self::$instance = new ErrorManager();&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                return self::$instance;&lt;br /&gt;
&lt;br /&gt;
        } // public function getInstance()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getErrors() {&lt;br /&gt;
&lt;br /&gt;
                return $this-&amp;gt;errors;&lt;br /&gt;
&lt;br /&gt;
        } // public function getErrors()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function reportError(&amp;amp;$sourceObject, $msg = &amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                $class = get_class($sourceObject);&lt;br /&gt;
                $this-&amp;gt;errors[] = array(&amp;quot;source&amp;quot; =&amp;gt; $sourceObject, &amp;quot;message&amp;quot; =&amp;gt; &amp;quot;$class: \&amp;quot;$msg\&amp;quot;&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        } // public function reportError($sourceObject, $msg = &amp;quot;&amp;quot;)&lt;br /&gt;
        public function reportFatalError(&amp;amp;$sourceObject, $exception = null) {&lt;br /&gt;
&lt;br /&gt;
                if (!($exception instanceof Exception)) {&lt;br /&gt;
&lt;br /&gt;
                        $exception = new Exception();&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                $msg = $exception-&amp;gt;getMessage();&lt;br /&gt;
                $class = get_class($sourceObject);&lt;br /&gt;
                $this-&amp;gt;reportError($sourceObject, &amp;quot;fatal error: $msg&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
                throw $exception;&lt;br /&gt;
&lt;br /&gt;
        } // public function reportFatalError($sourceObject, $exception)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} // class ErrorManager&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the Classi I added http://www.kryogenix.org/code/browser/sorttable/sorttable.js for the table to sort.&lt;br /&gt;
&lt;br /&gt;
When you download the last beta version of sphinx, you get a api so I copied it to the Classi also : &lt;br /&gt;
sphinxbeta/sphinx-2.0.1-beta/api/sphinxapi.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The most important thing is to change the limit in the php for the group_concat to make sure you will get all your tickets : &lt;br /&gt;
mysql -p &lt;br /&gt;
SET GLOBAL group_concat_max_len = 8192000;&lt;br /&gt;
&lt;br /&gt;
My sphinx.conf is the following :&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
source rt3&lt;br /&gt;
{&lt;br /&gt;
        type                    = mysql&lt;br /&gt;
&lt;br /&gt;
        sql_host                = localhost&lt;br /&gt;
        sql_user                = &lt;br /&gt;
        sql_pass                = &lt;br /&gt;
        sql_db                  = rt3&lt;br /&gt;
        sql_port                = 3306  # optional, default is 3306&lt;br /&gt;
        sql_query               = \&lt;br /&gt;
                select TK.id as TicketNum, \&lt;br /&gt;
                        TK.Creator as CreatedBy, \&lt;br /&gt;
                        TK.Queue as Queue, \&lt;br /&gt;
                        unix_timestamp(TK.Created) as Created, \&lt;br /&gt;
                        TK.Subject as Subject, \&lt;br /&gt;
                        group_concat(A.Content) as Content \&lt;br /&gt;
                from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
                where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
                and A.TransactionId = T.id \&lt;br /&gt;
                and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
                and (A.ContentType = &#039;text/plain&#039; or A.ContentType = &#039;text/html&#039;) \&lt;br /&gt;
                and A.Content is not null \&lt;br /&gt;
                and TK.Created &amp;lt; concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) \&lt;br /&gt;
                group by TK.id \&lt;br /&gt;
                order by TK.id, T.id&lt;br /&gt;
&lt;br /&gt;
        sql_attr_uint           = Created&lt;br /&gt;
        sql_attr_uint           = Queue&lt;br /&gt;
        sql_attr_uint           = CreatedBy&lt;br /&gt;
        sql_query_info          = SELECT * FROM Tickets WHERE id=$id&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
source rt3delta : rt3&lt;br /&gt;
 {&lt;br /&gt;
        sql_query               = \&lt;br /&gt;
                select TK.id as TicketNum, \&lt;br /&gt;
                        TK.Creator as CreatedBy, \&lt;br /&gt;
                        TK.Queue as Queue, \&lt;br /&gt;
                        unix_timestamp(TK.Created) as Created, \&lt;br /&gt;
                        TK.Subject as Subject, \&lt;br /&gt;
                        group_concat(A.Content) as Content \&lt;br /&gt;
                from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
                where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
                and A.TransactionId = T.id \&lt;br /&gt;
                and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
                and A.Content is not null \&lt;br /&gt;
                and TK.Created between concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) and last_day(now()) \&lt;br /&gt;
                group by TK.id \&lt;br /&gt;
                order by TK.id, T.id&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
index fulltext1&lt;br /&gt;
 {&lt;br /&gt;
        source                  = rt3&lt;br /&gt;
        path                    = /var/data/fulltext1&lt;br /&gt;
        docinfo                 = extern&lt;br /&gt;
        charset_type    = utf-8&lt;br /&gt;
        html_strip = 1&lt;br /&gt;
        min_word_len = 1&lt;br /&gt;
        enable_star     = 1&lt;br /&gt;
        min_infix_len   = 3&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 index fulltextdelta: fulltext1&lt;br /&gt;
 {&lt;br /&gt;
        source                  = rt3delta&lt;br /&gt;
        charset_type            = utf-8&lt;br /&gt;
        path                    = /var/data/fulltextdelta&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 indexer&lt;br /&gt;
 {&lt;br /&gt;
        mem_limit               = 128M&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
searchd&lt;br /&gt;
{&lt;br /&gt;
        listen                  = 9312&lt;br /&gt;
        listen                  = 9306:mysql41&lt;br /&gt;
        log                     = /var/log/sphinx/searchd.log&lt;br /&gt;
        query_log               = /var/log/sphinx/query.log&lt;br /&gt;
        read_timeout            = 5&lt;br /&gt;
        max_children            = 30&lt;br /&gt;
        pid_file                = /var/run/sphinx/searchd.pid&lt;br /&gt;
        max_matches             = 1000&lt;br /&gt;
        seamless_rotate         = 1&lt;br /&gt;
        preopen_indexes         = 1&lt;br /&gt;
        unlink_old              = 1&lt;br /&gt;
        workers                 = threads # for RT to work&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=IntegrateSphinx&amp;diff=5371</id>
		<title>IntegrateSphinx</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=IntegrateSphinx&amp;diff=5371"/>
		<updated>2016-06-21T08:20:17Z</updated>

		<summary type="html">&lt;p&gt;Cris70: /* Building the indexes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
= Integrating the Sphinx full-text search engine in RT =&lt;br /&gt;
&lt;br /&gt;
[http://sphinxsearch.com/ homepage Sphinx]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== What is Sphinx? ==&lt;br /&gt;
&lt;br /&gt;
Sphinx is a free open-source SQL full-text search engine. As they put it on their site: How do you implement full-text search for that 10+ million row table, keep up with the load, and stay relevant? Sphinx is good at those kinds of riddles.&lt;br /&gt;
&lt;br /&gt;
Basically, Sphinx scans your database and builds his own indexes for blazingly-fast full-text searches.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Why? ==&lt;br /&gt;
&lt;br /&gt;
Well, we needed fast full-text searches, and what RT offers is not enough. It is slow and it causes a high load on the db server.&lt;br /&gt;
&lt;br /&gt;
I saw a reference to Sphinx on the RT users mailing list, and - after exploring a few alternatives and verifying no one had already did it - proceeded to integrate it into our RT installation.&lt;br /&gt;
&lt;br /&gt;
I am going to illustrate here all the steps we put in place to have Sphinx completely integrated in RT. The work required a couple of weeks of my spare time and that of two other colleagues.&lt;br /&gt;
&lt;br /&gt;
Unfortunately I am not able to package this as a proper extension, but I hope this docs will help those who want to do the same. Maybe someone will feel inspired enough to package it for the benefit of the community, or maybe [[User:JesseVincent|Jesse]] will decide to integrate it into RT out of the box. Who knows?&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== First: setting up Sphinx ==&lt;br /&gt;
&lt;br /&gt;
==== Intro ====&lt;br /&gt;
&lt;br /&gt;
First of all, you have to go to the [http://sphinxsearch.com/ Sphinx homepage], download and compile the sources. Or you can choose among the provided binary packages.&lt;br /&gt;
&lt;br /&gt;
We decided to go with version 1.10-beta, the most recent at the time of our installation.&lt;br /&gt;
&lt;br /&gt;
At this point you have to decide if you want to use &#039;&#039;&#039;real-time indexes&#039;&#039;&#039; or the more traditional &#039;&#039;&#039;full+delta&#039;&#039;&#039; approach to indexes.&lt;br /&gt;
&lt;br /&gt;
I will describe here briefly the meaning of these two options; if you want more infos please refer to the Sphinx homepage.&lt;br /&gt;
&lt;br /&gt;
Real-time indexes (on the Sphinx site they call them RT-indexes... quite confusing, uh?) are a clever way to have your indexes always updated, up to the millisecond. They are however still in beta (as of 1.10-beta) and they are more complex to set up and update. We wanted a quick solution, so we chose the traditional way.&lt;br /&gt;
&lt;br /&gt;
The traditional way consists of having two indexes: one &#039;&#039;&#039;big&#039;&#039;&#039; index comprising all tickets up to a certain date (or to a certain ID), and a small &#039;&#039;&#039;delta&#039;&#039;&#039; index for the rest of the tickets. You can use only one big index, but it will take a few minutes to build it so you cannot refresh it too frequently. If you use the full+delta approach you can build the big index e.g. once a day and the delta index once every few minutes.&lt;br /&gt;
&lt;br /&gt;
Presently we have about 15 thousand tickets in our RT db; we build the full index every morning, indexing everything up to the first day of the current month: it takes about 8 minutes. The delta index (from start of month to now) is built every 5 minutes and it takes about a couple seconds.&lt;br /&gt;
&lt;br /&gt;
At this point I should probably say that we are running RT on two solaris servers: one for the presentation and one for the DB. Sphinx runs on the DB side.&lt;br /&gt;
&lt;br /&gt;
==== Sphinx setup ====&lt;br /&gt;
&lt;br /&gt;
First thing to do is to tell Sphinx where your database is, what kind of database engine you use and how to scan your data.&lt;br /&gt;
&lt;br /&gt;
You tell Sphinx all these things in the file sphinx.conf (we have it in /usr/local/etc). Here is our sphinx.conf:&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;pre&amp;gt;&lt;br /&gt;
   #&lt;br /&gt;
   # Sphinx configuration&lt;br /&gt;
   #&lt;br /&gt;
   &lt;br /&gt;
   source rt3&lt;br /&gt;
   {&lt;br /&gt;
   	type			= mysql&lt;br /&gt;
   &lt;br /&gt;
   	sql_host		= localhost&lt;br /&gt;
   	sql_user		= AMENDED&lt;br /&gt;
   	sql_pass		= AMENDED&lt;br /&gt;
   	sql_db			= rt3&lt;br /&gt;
   	sql_port		= 3306	# optional, default is 3306&lt;br /&gt;
   &lt;br /&gt;
   	sql_query		= \&lt;br /&gt;
   		select TK.id as TicketNum, \&lt;br /&gt;
   			TK.Creator as CreatedBy, \&lt;br /&gt;
   			TK.Queue as Queue, \&lt;br /&gt;
   			unix_timestamp(convert_tz(TK.Created,&#039;GMT&#039;,&#039;Europe/Rome&#039;)) as Created, \&lt;br /&gt;
   			TK.Subject as Subject, \&lt;br /&gt;
   			group_concat(cast(A.Content as char)) as Content \&lt;br /&gt;
   		from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
   		where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
   		and A.TransactionId = T.id \&lt;br /&gt;
   		and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
   		and A.ContentType = &#039;text/plain&#039; \&lt;br /&gt;
   		and A.Content is not null \&lt;br /&gt;
   		and TK.Created &amp;amp;lt; concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) \&lt;br /&gt;
   		group by TK.id \&lt;br /&gt;
   		order by TK.id, T.id&lt;br /&gt;
   &lt;br /&gt;
   	sql_attr_uint		= Created&lt;br /&gt;
   	sql_attr_uint		= Queue&lt;br /&gt;
   	sql_attr_uint		= CreatedBy&lt;br /&gt;
   &lt;br /&gt;
   	sql_query_info		= SELECT * FROM Tickets WHERE id=$id&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   source rt3delta : rt3&lt;br /&gt;
   {&lt;br /&gt;
   	sql_query		= \&lt;br /&gt;
   		select TK.id as TicketNum, \&lt;br /&gt;
   			TK.Creator as CreatedBy, \&lt;br /&gt;
   			TK.Queue as Queue, \&lt;br /&gt;
   			unix_timestamp(convert_tz(TK.Created,&#039;GMT&#039;,&#039;Europe/Rome&#039;)) as Created, \&lt;br /&gt;
   			TK.Subject as Subject, \&lt;br /&gt;
   			group_concat(cast(A.Content as char)) as Content \&lt;br /&gt;
   		from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
   		where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
   		and A.TransactionId = T.id \&lt;br /&gt;
   		and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
   		and A.ContentType = &#039;text/plain&#039; \&lt;br /&gt;
   		and A.Content is not null \&lt;br /&gt;
   		and TK.Created between concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) and last_day(now()) \&lt;br /&gt;
   		group by TK.id \&lt;br /&gt;
   		order by TK.id, T.id&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   index fulltext1&lt;br /&gt;
   {&lt;br /&gt;
   	source			= rt3&lt;br /&gt;
   	path			= /var/data/fulltext1&lt;br /&gt;
   	docinfo			= extern&lt;br /&gt;
   	charset_type	= sbcs&lt;br /&gt;
   	min_infix_len 	= 3&lt;br /&gt;
   	enable_star     = 1&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   index fulltextdelta: fulltext1&lt;br /&gt;
   {&lt;br /&gt;
   	source			= rt3delta&lt;br /&gt;
   	path			= /var/data/fulltextdelta&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   indexer&lt;br /&gt;
   {&lt;br /&gt;
   	mem_limit		= 32M&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   searchd&lt;br /&gt;
   {&lt;br /&gt;
   	listen			= 9312&lt;br /&gt;
   	listen			= 9306:mysql41&lt;br /&gt;
   	log				= /var/log/searchd.log&lt;br /&gt;
   	query_log		= /var/log/query.log&lt;br /&gt;
   	read_timeout	= 5&lt;br /&gt;
   	max_children	= 30&lt;br /&gt;
   	pid_file		= /var/log/searchd.pid&lt;br /&gt;
   	max_matches		= 1000&lt;br /&gt;
   	seamless_rotate		= 1&lt;br /&gt;
   	preopen_indexes		= 0&lt;br /&gt;
   	unlink_old		= 1&lt;br /&gt;
   	workers			= threads # for RT to work&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s see what we have in this configuration file.&lt;br /&gt;
&lt;br /&gt;
First we define a &#039;&#039;&#039;data source&#039;&#039;&#039;, that I have named (with lots of fantasy!) &amp;lt;code&amp;gt;rt3&amp;lt;/code&amp;gt;. A data source tells Sphinx where to get data to feed its indexes. We tell Sphinx the type of source (&amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt;), where it is (&amp;lt;code&amp;gt;localhost&amp;lt;/code&amp;gt;), and how to retrieve the data (the &amp;lt;code&amp;gt;sqlquery&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
There is one &#039;&#039;&#039;VERY&#039;&#039;&#039; important thing in this section: every column that is returned by the query is indexed for full text search, unless you declare it as an &amp;lt;u&amp;gt;attribute&amp;lt;/u&amp;gt;. Attributes cannot be searched for text, but they allow you to &#039;&#039;&#039;filter&#039;&#039;&#039; the results.&lt;br /&gt;
&lt;br /&gt;
In our configuration, we return &#039;&#039;&#039;Subject&#039;&#039;&#039; and &#039;&#039;&#039;Content&#039;&#039;&#039; as searchable fields, while the three &amp;lt;code&amp;gt;sql_attr_uint&amp;lt;/code&amp;gt; &amp;lt;u&amp;gt;attributes&amp;lt;/u&amp;gt; can be used to refine the search (i.e. filter).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;NOTE:&amp;lt;/u&amp;gt;&#039;&#039;&#039; We had previously defined the three &amp;lt;u&amp;gt;attributes&amp;lt;/u&amp;gt; according to their content (e.g. the &#039;&#039;&#039;Created&#039;&#039;&#039; attribute was defines as &amp;lt;code&amp;gt;sql_attr_timestamp&amp;lt;/code&amp;gt;), but we have discovered that this configuration would not allow us to use those attributes for filtering. It seems Sphinx can only use &amp;lt;code&amp;gt;sql_attr_uint&amp;lt;/code&amp;gt; for filtering... I don&#039;t know if it&#039;s a temporary limitation, a bug, or working as designed.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;sql_query_info&#039;&#039;&#039; has to return a hit for every $id ($id is an implicit variable, which contains the first column returned by the sql_query. It &#039;&#039;&#039;MUST&#039;&#039;&#039; be an integer.).&lt;br /&gt;
&lt;br /&gt;
We then define another data source (&amp;lt;code&amp;gt;rt3delta&amp;lt;/code&amp;gt;) which we derive from &amp;lt;code&amp;gt;rt3&amp;lt;/code&amp;gt;. Everything defined in the &amp;lt;code&amp;gt;rt3&amp;lt;/code&amp;gt; data source is inherited by &amp;lt;code&amp;gt;rt3delta&amp;lt;/code&amp;gt;, save for what we override (&amp;lt;code&amp;gt;sqlquery&amp;lt;/code&amp;gt; in this case). As you can see, the queries are very similar; only the date range is different.&lt;br /&gt;
&lt;br /&gt;
After data sources we define &#039;&#039;&#039;indexes&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
First index is &amp;lt;code&amp;gt;fulltext1&amp;lt;/code&amp;gt;. Everything should be pretty intuitive, but for the two &amp;lt;code&amp;gt;min_infix_len&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;enable_star&amp;lt;/code&amp;gt; fields. By default Sphinx only indexes full words, but it would be very nice to be able to search for partial words by using wildcard characters. So here it is: &amp;lt;code&amp;gt;min_infix_len&amp;lt;/code&amp;gt; tells Sphinx the minimum length of subwords to index, and &amp;lt;code&amp;gt;enable_star&amp;lt;/code&amp;gt; tells it that we want to be able to use star as wildcard character. This way you can search for the word &#039;&#039;&#039;minimum&#039;&#039;&#039; by using &amp;lt;code&amp;gt;min*&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;*nim*&amp;lt;/code&amp;gt;, but not by using &amp;lt;code&amp;gt;mi*&amp;lt;/code&amp;gt; (because we told Sphinx the minimum length for subwords is 3 chars).&lt;br /&gt;
&lt;br /&gt;
The second index is &amp;lt;code&amp;gt;fulltextdelta&amp;lt;/code&amp;gt;, which is derived from &amp;lt;code&amp;gt;fulltext&amp;lt;/code&amp;gt;. As we saw above, everything is inherited but for things we explicitely override.&lt;br /&gt;
&lt;br /&gt;
At last we give some parameters for the inner working of &amp;lt;code&amp;gt;indexer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;searchd&amp;lt;/code&amp;gt;, which are two of the command line tools of Sphinx. The values shown here are good defaults.&lt;br /&gt;
&lt;br /&gt;
==== Building the indexes ====&lt;br /&gt;
&lt;br /&gt;
Now that we have a working configuration, it&#039;s time to build the indexes.&lt;br /&gt;
&lt;br /&gt;
You can initialize the indexes with the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/usr/local/bin/indexer --all&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
This will build all the indexes, and it will give you an idea of the time and disk space required for each index.&lt;br /&gt;
&lt;br /&gt;
For production use however, you want to put the commands in &amp;lt;code&amp;gt;cron&amp;lt;/code&amp;gt; so that indexes are refreshed regularly and automatically.&lt;br /&gt;
&lt;br /&gt;
We refresh the &amp;lt;code&amp;gt;fulltext1&amp;lt;/code&amp;gt; index once a day at 7 a.m., with this command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/usr/local/bin/indexer --rotate fulltext1&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;code&amp;gt;--rotate&amp;lt;/code&amp;gt; allows the index to be substituted while the search daemon is running.&lt;br /&gt;
&lt;br /&gt;
We refresh the &amp;lt;code&amp;gt;fulltextdelta&amp;lt;/code&amp;gt; index every 5 minutes with this command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/usr/local/bin/indexer --rotate fulltextdelta&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The search daemon ====&lt;br /&gt;
&lt;br /&gt;
Once you have built the indexes you can start searching from the command line with the &amp;lt;code&amp;gt;search&amp;lt;/code&amp;gt; tool. When you are confident your setup is correct, it&#039;s time to start the search daemon.&lt;br /&gt;
&lt;br /&gt;
We do this with the command&lt;br /&gt;
&lt;br /&gt;
           /usr/local/bin/searchd --config /usr/local/etc/sphinx.conf&lt;br /&gt;
&lt;br /&gt;
In our experience &amp;lt;code&amp;gt;searchd&amp;lt;/code&amp;gt; is not very stable (probably due to the beta release): it stops responding after a couple days of uptime, so we restart it daily.&lt;br /&gt;
&lt;br /&gt;
With this last step you have Sphinx all set up and working, so the first part of this tutorial ends here. Please note that Sphinx has a &#039;&#039;&#039;lot&#039;&#039;&#039; of options, that I have not described. I only describe here the options that proved useful for us. If you want to know more about Sphinx please refer to the Sphinx home page.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Second: using the API to query Sphinx ==&lt;br /&gt;
&lt;br /&gt;
So we now have Sphinx up and running and fully populated indexes that return correct results, but now we need to be able to interrogate Sphinx&#039; indexes from RT.&lt;br /&gt;
&lt;br /&gt;
To do this you have to talk to the search daemon, which speaks his own language: the Sphinx API. There are several implementations (PHP, Java, Python and even a third-party Perl API), but since we are mostly familiar with PHP we are going to use it to implement our interface.&lt;br /&gt;
&lt;br /&gt;
Before posting the actual PHP script, there are a few things I have to point out:&lt;br /&gt;
&lt;br /&gt;
* Mason does not support PHP out of the box, so we did a little hack that I&#039;ll explain later&lt;br /&gt;
* The script you&#039;ll see here contains in-line CSS to adapt the results to the default look of RT (web2). If you&#039;re using a different style you may want to change the inline CSS accordingly.&lt;br /&gt;
* The script spits out all the results in one page: there&#039;s still no support for pagination a-la RT.&lt;br /&gt;
* The script spits out &#039;&#039;&#039;ALL&#039;&#039;&#039; the results, including deleted, rejected, merged tickets.&lt;br /&gt;
&lt;br /&gt;
You see, the script is still a little rough, but I hope we&#039;ll be able to refine it with the help of the community.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;sphinx.php follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;amp;lt;html&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;head&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;title&amp;amp;gt;Ricerca Ticket Sphinx&amp;amp;lt;/title&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 		&amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
 			document.domain = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 		&amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 		&amp;amp;lt;style&amp;amp;gt;&lt;br /&gt;
 			body {font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}&lt;br /&gt;
 			table {font-size:inherit;font:100%;}&lt;br /&gt;
 			pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}&lt;br /&gt;
 &lt;br /&gt;
 			a {&lt;br /&gt;
 				color: #000;&lt;br /&gt;
 				text-decoration: none;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			div#body a:visited {&lt;br /&gt;
 				color: #666;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			/* background: #547CCC ; */&lt;br /&gt;
 			body {&lt;br /&gt;
 				padding:0;&lt;br /&gt;
 				margin:0;&lt;br /&gt;
 &lt;br /&gt;
 				background: #FFFFFF ;&lt;br /&gt;
 				font-family: arial, helvetica, sans-serif;&lt;br /&gt;
 &lt;br /&gt;
 				color: #000000;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list, table.queue-summary, table.collection {&lt;br /&gt;
 				margin-top: 0.75em;&lt;br /&gt;
 				font-size: 0.9em;&lt;br /&gt;
 				border: 1px solid #aaa;&lt;br /&gt;
 				border-bottom: 2px solid #999;&lt;br /&gt;
 				border-right: 2px solid #999;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary tr&amp;amp;gt;*:first-child {&lt;br /&gt;
 				padding-left: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary tr&amp;amp;gt;*:last-child {&lt;br /&gt;
 				padding-right: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list a, table.queue-summary a, table.collection a  {&lt;br /&gt;
 				font-weight: bold;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list th.collection-as-table, table.collection th.collection-as-table {&lt;br /&gt;
 				background: #ddd;&lt;br /&gt;
 				font-size: 0.9em;&lt;br /&gt;
 				margin-bottom: 0.5em;&lt;br /&gt;
 				text-align: left;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary th.collection-as-table {&lt;br /&gt;
 				font-size: 0.9em;&lt;br /&gt;
 				margin-bottom: 0.5em;&lt;br /&gt;
 				text-align: right;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary th.collection-as-table:first-child {&lt;br /&gt;
 				text-align: left;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.collection-as-table+tr.collection-as-table th {&lt;br /&gt;
 				border-bottom: 2px solid grey;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary td {&lt;br /&gt;
 				background: #efefef;&lt;br /&gt;
 				border-bottom: 1px solid #ccc;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.evenline td {&lt;br /&gt;
 				background: #eee;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.oddline td {&lt;br /&gt;
 				background: #fff;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.evenline td, tr.oddline td {&lt;br /&gt;
 				padding-top: 0.5em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.evenline+tr.evenline td, tr.oddline+tr.oddline td{&lt;br /&gt;
 				padding-top: 0;&lt;br /&gt;
 				border: none;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list td:first-child, table.ticket-list th:first-child {&lt;br /&gt;
 				padding-left: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list td:last-child, table.ticket-list th:last-child {&lt;br /&gt;
 				padding-right: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			th.collection-as-table , td.collection-as-table {&lt;br /&gt;
 				padding-right: 0.5em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			.pagenum.a:hover, .paging a.nav:hover{&lt;br /&gt;
 				text-decoration: underline;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			.pagenum *, .paging a.nav{&lt;br /&gt;
 				padding: .5em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			.currentpage{&lt;br /&gt;
 				text-decoration: none;&lt;br /&gt;
 				font-weight: bold;&lt;br /&gt;
 				background: #eee;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			div.paging{&lt;br /&gt;
 				text-align: center;&lt;br /&gt;
 				padding-bottom: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			#body&amp;amp;gt;table.ticket-list {&lt;br /&gt;
 				margin-bottom: 2em;&lt;br /&gt;
 			}&lt;br /&gt;
 		&amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;/head&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;body&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;?php&lt;br /&gt;
 		//Costante con il max numero di righe ritornate da Sphinx&lt;br /&gt;
 		define(&#039;SPHINX_MAX_LIMIT&#039;, 1000);&lt;br /&gt;
 &lt;br /&gt;
 		require_once(&amp;quot;Classi/sphinxapi.php&amp;quot;);&lt;br /&gt;
 		require_once(&amp;quot;Classi/Timer.class.php&amp;quot;);&lt;br /&gt;
 		require_once(&amp;quot;Classi/MySql.class.php&amp;quot;);&lt;br /&gt;
 		include_once(&amp;quot;Include/Query.inc.php&amp;quot;);&lt;br /&gt;
 		include_once(&amp;quot;Include/dvopendb.config.inc.php&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 		$MyTimer =  new Timer();&lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Parametri di connessione al Daemon Sphinx&lt;br /&gt;
 		$host = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 		$port = 9312;&lt;br /&gt;
 		$index = &amp;quot;*&amp;quot;; // put your index name here&lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Variabili in GET&lt;br /&gt;
 		$query = $_GET[&#039;Text&#039;];&lt;br /&gt;
 		$RequestorFilter = trim($_GET[&#039;Requestor&#039;]);&lt;br /&gt;
 		$CodaFilter = $_GET[&#039;Queue&#039;];&lt;br /&gt;
 		$DataInizioFilter = trim($_GET[&#039;From&#039;]);&lt;br /&gt;
 		$DataFineFilter = trim($_GET[&#039;To&#039;]);&lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Connessione al Daemon Sphinx&lt;br /&gt;
 		$cl = new SphinxClient();&lt;br /&gt;
 		$cl-&amp;amp;gt;SetServer($host, $port);&lt;br /&gt;
 		$cl-&amp;amp;gt;SetMatchMode(SPH_MATCH_EXTENDED2);&lt;br /&gt;
 		$cl-&amp;amp;gt;SetLimits(0,SPHINX_MAX_LIMIT, $max_matches=0, $cutoff=0 );&lt;br /&gt;
 &lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//MySql Database Query per la retrive dei dati del ticket&lt;br /&gt;
 &lt;br /&gt;
 		$SqlQuery = new MySql($DbHostName,$DbUser,$DbPassword,$DbName);&lt;br /&gt;
 		$SqlQuery-&amp;amp;gt;Connetti();&lt;br /&gt;
 &lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Filtri sulla ricerca Sphinx&lt;br /&gt;
 &lt;br /&gt;
 		//Check della query (parametro di ricerca)&lt;br /&gt;
 		if(strlen($query)==0)&lt;br /&gt;
 		{&lt;br /&gt;
 			echo &amp;quot;E&#039; necessario inserire un parametro di ricerca nella casella \&amp;quot;Text\&amp;quot; per proseguire.&amp;quot;;&lt;br /&gt;
 			exit(1);&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Filtro Requestor&lt;br /&gt;
 		if(strlen($RequestorFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			$TempQuery = sprintf($RequestorLookUpQuery,mysql_real_escape_string($RequestorFilter));&lt;br /&gt;
 			$SqlQuery-&amp;amp;gt;ExecQuery($TempQuery);&lt;br /&gt;
 			$RequestorResult = $SqlQuery-&amp;amp;gt;GetMonoArrayResult();&lt;br /&gt;
 			if(count($RequestorResult)&amp;amp;gt;0)&lt;br /&gt;
 			{&lt;br /&gt;
 				$cl-&amp;amp;gt;SetFilter (&amp;quot;createdby&amp;quot;,array($RequestorResult[&#039;id&#039;]) , $exclude=false );&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;&amp;amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;amp;gt;Warning - L&#039;indirizzo \&amp;quot;&amp;quot;.$RequestorFilter.&amp;quot;\&amp;quot; non e&#039; presente nel Database; La ricerca e&#039; stata effettuata per tutti i richiedenti&amp;amp;lt;/label&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 			}&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Filtro Queue&lt;br /&gt;
 		if(strlen($CodaFilter)&amp;amp;gt;0)&lt;br /&gt;
 			$cl-&amp;amp;gt;SetFilter (&amp;quot;queue&amp;quot;, array($CodaFilter), $exclude=false );&lt;br /&gt;
 &lt;br /&gt;
 		//Filtro Data&lt;br /&gt;
 &lt;br /&gt;
 		//__________________________________________________________________________________________________________________&lt;br /&gt;
 		//Check delle date&lt;br /&gt;
 		if(strlen($DataInizioFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			//Check Datainizio&lt;br /&gt;
 			if(checkdate(substr($DataInizioFilter,5,2),substr($DataInizioFilter,8,2),substr($DataInizioFilter,0,4))==false)&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;Data Inizio &amp;quot;.$DataInizioFilter.&amp;quot; non corretta &amp;quot;;&lt;br /&gt;
 				exit(1);&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 				 $DataInizio = mktime(0, 0, 0, substr($DataInizioFilter,5,2), substr($DataInizioFilter,8,2), substr($DataInizioFilter,0,4));&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if(strlen($DataFineFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{	//Check DataFine&lt;br /&gt;
 &lt;br /&gt;
 			if(checkdate(substr($DataFineFilter,5,2),substr($DataFineFilter,8,2),substr($DataFineFilter,0,4))==false)&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;Data Fine &amp;quot;.$DataFineFilter.&amp;quot; non corretta &amp;quot;;&lt;br /&gt;
 				exit(1);&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 				$DataFine = mktime(0, 0, 0, substr($DataFineFilter,5,2), substr($DataFineFilter,8,2), substr($DataFineFilter,0,4));&lt;br /&gt;
 		}&lt;br /&gt;
 		//__________________________________________________________________________________________________________________&lt;br /&gt;
 &lt;br /&gt;
 		//Filtraggio vero e proprio&lt;br /&gt;
 &lt;br /&gt;
 		//Se sono settate entrambe...&lt;br /&gt;
 		if(strlen($DataInizioFilter)&amp;amp;gt;0 &amp;amp;amp;&amp;amp;amp; strlen($DataFineFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			if($DataInizio &amp;amp;lt; $DataFine)&lt;br /&gt;
 			{&lt;br /&gt;
 				//Se sono settate entrambe le date filtro per entrambe&lt;br /&gt;
 				$cl-&amp;amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, $DataFine, $exclude=false );&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;La data Inizio &amp;quot;.$DataInizioFilter.&amp;quot; e&#039; maggiore della data di fine &amp;quot;.$DataFineFilter;&lt;br /&gt;
 				exit(1);&lt;br /&gt;
 			}&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Se solo DataInizio..&lt;br /&gt;
 		if(strlen($DataInizioFilter)&amp;amp;gt;0 &amp;amp;amp;&amp;amp;amp; strlen($DataFineFilter)==0)&lt;br /&gt;
 		{&lt;br /&gt;
 			$cl-&amp;amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, mktime(), $exclude=false );&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Se solo DataFine..&lt;br /&gt;
 		if(strlen($DataInizioFilter)==0 &amp;amp;amp;&amp;amp;amp; strlen($DataFineFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			//2008-11-14 : Data del primo Ticket di RT&lt;br /&gt;
 			//1988-07-18 : Data di nascita di AMENDED :)&lt;br /&gt;
 			$cl-&amp;amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, mktime(0, 0, 0,07,18,1988), $DataFine, $exclude=false );&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Eseguo la Query su Sphinx&lt;br /&gt;
 &lt;br /&gt;
 		$res = $cl-&amp;amp;gt;Query($query, $index);&lt;br /&gt;
 		if ($res == false)&lt;br /&gt;
 		{&lt;br /&gt;
 			echo &amp;quot;failure: &amp;quot;.$cl-&amp;amp;gt;GetLastError().&amp;quot;\n&amp;quot;;&lt;br /&gt;
 		}&lt;br /&gt;
 		else&lt;br /&gt;
 		{&lt;br /&gt;
 			if(count($res[&amp;quot;matches&amp;quot;])!=0)&lt;br /&gt;
 			{&lt;br /&gt;
 				//Se i risultati totali sono &amp;amp;gt; 1000&lt;br /&gt;
 				if($res[total_found]&amp;amp;gt;SPHINX_MAX_LIMIT)&lt;br /&gt;
 				{&lt;br /&gt;
 					echo &amp;quot;&amp;amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;amp;gt;Warning - Sono stati trovati &amp;quot;.$res[total_found].&amp;quot; risultati, verrano visualizzati solo i primi &amp;quot;.SPHINX_MAX_LIMIT.&amp;quot;&amp;amp;lt;/label&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 				}&lt;br /&gt;
 &lt;br /&gt;
 				//Se ci sono dei risultati creo la tabella e stampo&lt;br /&gt;
 				echo &amp;quot;&amp;amp;lt;table id=&#039;ResultTable&#039; class=&#039;ticket-list&#039; border=&#039;0&#039; cellspacing=&#039;0&#039; cellpadding=&#039;1&#039; width=&#039;100%&#039;&amp;amp;gt;&lt;br /&gt;
 						&amp;amp;lt;thead&amp;amp;gt;&lt;br /&gt;
 						&amp;amp;lt;tr class=&#039;collection-as-table&#039;&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;#&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Oggetto&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Coda&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Status&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Creato&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Richiedente&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Proprietario&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 						&amp;amp;lt;/tr&amp;amp;gt;&lt;br /&gt;
 						&amp;lt;/thead&amp;gt;&amp;lt;tbody&amp;gt;&amp;quot;;&lt;br /&gt;
 				foreach ($res[&amp;quot;matches&amp;quot;] as $key=&amp;amp;gt;$value)&lt;br /&gt;
 				{&lt;br /&gt;
 					$i++;&lt;br /&gt;
 					$TempQuery = sprintf($TicketDetailQuery,mysql_real_escape_string($key));&lt;br /&gt;
 					$SqlQuery-&amp;amp;gt;ExecQuery($TempQuery);&lt;br /&gt;
 					$Risultato = $SqlQuery-&amp;amp;gt;GetMonoArrayResult();&lt;br /&gt;
 					if($i%2==0)&lt;br /&gt;
 					{&lt;br /&gt;
 						echo &amp;quot;	&amp;amp;lt;tr class=&#039;evenline&#039;&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 								&amp;amp;lt;/tr&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 					}&lt;br /&gt;
 					else&lt;br /&gt;
 					{&lt;br /&gt;
 						echo &amp;quot;	&amp;amp;lt;tr class=&#039;oddline&#039;&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 								&amp;amp;lt;/tr&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 					}&lt;br /&gt;
 				}&lt;br /&gt;
 				echo &amp;quot;	&amp;lt;/tbody&amp;gt;&lt;br /&gt;
 					&amp;lt;tfoot&amp;gt;&amp;lt;/tfoot&amp;gt;&lt;br /&gt;
 					&amp;lt;/table&amp;gt;&amp;quot;;&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 			{&lt;br /&gt;
 				//...Altrimenti stampo che non ho trovato nulla&lt;br /&gt;
 				echo &amp;quot;&amp;amp;lt;br/&amp;amp;gt;&amp;amp;lt;label class=\&amp;quot;notfoundlabel\&amp;quot;&amp;amp;gt;Nessun risultato trovato&amp;amp;lt;/label&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			echo &amp;quot;Trovati &amp;quot;.$res[total].&amp;quot; di &amp;quot;.$res[total_found].&amp;quot; in &amp;quot;.$MyTimer-&amp;amp;gt;elapsed().&amp;quot; secondi&amp;quot;;&lt;br /&gt;
 		}&lt;br /&gt;
 		?&amp;amp;gt;&lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;dvopendb.config.inc.php follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;amp;lt;?php&lt;br /&gt;
  $DbHostName = &amp;quot;HOSTNAME_AMENDED:3306/rt3&amp;quot;;&lt;br /&gt;
  $DbUser = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
  $DbPassword = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
  $DbName = &amp;quot;rt3&amp;quot;;&lt;br /&gt;
  $DbQuery = &amp;quot;select EmailAddress, RealName from Users&amp;quot;;&lt;br /&gt;
  ?&amp;amp;gt;&lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;Query.inc.php follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;amp;lt;?php&lt;br /&gt;
  $TicketDetailQuery =&lt;br /&gt;
  &amp;quot;select Tickets.id,Subject,Status,Tickets.Created as Created,U1.Name as Requestor,U2.Name as Owner,Queues.Name as Queue&lt;br /&gt;
  from Tickets left outer join Users U1&lt;br /&gt;
  on U1.id = Tickets.Creator&lt;br /&gt;
  left outer join  Users U2&lt;br /&gt;
  on U2.id = Tickets.Owner&lt;br /&gt;
  left outer join Queues&lt;br /&gt;
  on  Queue = Queues.id&lt;br /&gt;
  where Tickets.id = %s&lt;br /&gt;
  &amp;quot;;&lt;br /&gt;
  &lt;br /&gt;
  $RequestorLookUpQuery =&lt;br /&gt;
  &amp;quot;select id&lt;br /&gt;
  from Users&lt;br /&gt;
  where EmailAddress = &#039;%s&#039;&lt;br /&gt;
  &amp;quot;;&lt;br /&gt;
  ?&amp;amp;gt;&lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This ends the step regarding the use of the Sphinx API to query the &amp;lt;code&amp;gt;searchd&amp;lt;/code&amp;gt; daemon.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Third: integrating it all into RT ==&lt;br /&gt;
&lt;br /&gt;
Now we need a way to call the php script from within RT. Well, technically we don&#039;t &#039;&#039;&#039;need&#039;&#039;&#039; it, but it would be very nice to have.&lt;br /&gt;
&lt;br /&gt;
For this task I found very useful the [[WritingPortlets]] section of this wiki, written by Andy D&#039;Arcy Jewell (thank you!)&lt;br /&gt;
&lt;br /&gt;
So the first thing I did was writing a portlet that one can integrate in the &amp;quot;RT at a glance&amp;quot; page.&lt;br /&gt;
&lt;br /&gt;
I put it in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/Elements. The portlet itself is in a file called SphinxSearch.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;SphinxSearch follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&amp;lt;&amp;amp;|/Widgets/TitleBox, title =&amp;gt; loc(&#039;Fulltext Search (Sphinx)&#039;), bodyclass =&amp;gt; &amp;quot;&amp;quot;,&lt;br /&gt;
     titleright =&amp;gt; loc(&#039;HELP&#039;), titleright_href =&amp;gt; RT-&amp;gt;Config-&amp;gt;Get(&#039;WebPath&#039;).&#039;/Prefs/SphinxHelp.html&#039;&amp;amp;&amp;gt;&lt;br /&gt;
  	&amp;lt;form name=&amp;quot;input&amp;quot; action=&amp;quot;/Tools/sphinx.html&amp;quot; method=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt;
  		&amp;lt;table&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Text&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;input type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;Text&amp;quot; /&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Queue&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;&amp;amp; /Elements/SelectQueue, Name =&amp;gt; &#039;Queue&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Requestor&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;&amp;amp; /Elements/EmailInput, Name =&amp;gt; &#039;Requestor&#039;, Size =&amp;gt; &#039;40&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;From&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;&amp;amp; /Elements/SelectDate, Name =&amp;gt; &amp;quot;From&amp;quot; || &#039;&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;To&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;&amp;amp; /Elements/SelectDate, Name =&amp;gt; &amp;quot;To&amp;quot; || &#039;&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  		&amp;lt;/table&amp;gt;&lt;br /&gt;
  		&amp;lt;div class=&amp;quot;submit&amp;quot;&amp;gt;&lt;br /&gt;
  			&amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;input class=&amp;quot;button&amp;quot; type=&amp;quot;submit&amp;quot; value=&amp;quot;Submit&amp;quot; /&amp;gt;&lt;br /&gt;
  			&amp;lt;/div&amp;gt;&lt;br /&gt;
  		&amp;lt;/div&amp;gt;&lt;br /&gt;
  	&amp;lt;/form&amp;gt;&lt;br /&gt;
  &amp;lt;/&amp;amp;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the result:&lt;br /&gt;
&lt;br /&gt;
[[File:Rt3p.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to keep the look and feel of RT by copying code from the other portlets. I even used RT syntax to allow the localization of string, but not everything gets translated since not all the terms are in RT resource files.&lt;br /&gt;
&lt;br /&gt;
Since Sphinx&#039; extended search syntax can be very elaborated, I put a HELP link in the upper right corner (circled in red in the image above). This points to a page that I extracted from Sphinx&#039; documentation. The page is in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/Prefs. The file is called SphinxHelp.html.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;SphinxHelp.html follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;amp;lt;&amp;amp;amp; /Elements/Header, Title =&amp;amp;gt; &amp;quot;Sphinx - Free open-source SQL full-text search engine&amp;quot; &amp;amp;amp;&amp;amp;gt;&lt;br /&gt;
 &amp;amp;lt;&amp;amp;amp; /Elements/Tabs,&lt;br /&gt;
 	Title =&amp;amp;gt; &amp;quot;Help for Sphinx search syntax&amp;quot;,&lt;br /&gt;
 	current_tab    =&amp;amp;gt; &#039;index.html&#039;,&lt;br /&gt;
 	current_toptab =&amp;amp;gt; &#039;index.html&#039;,&lt;br /&gt;
 	tabs           =&amp;amp;gt; $tabs,&lt;br /&gt;
 	actions        =&amp;amp;gt; $actions,&lt;br /&gt;
 &amp;amp;amp;&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;div align=&amp;quot;left&amp;quot; class=&amp;quot;refresh&amp;quot;&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
 			&amp;amp;lt;h2 style=&amp;quot;clear: both&amp;quot;&amp;amp;gt;&amp;amp;lt;a name=&amp;quot;extended-syntax&amp;quot;&amp;amp;gt;&amp;amp;lt;/a&amp;amp;gt;Extended query syntax&amp;amp;lt;/h2&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	The following special operators and modifiers can be used when using the extended matching mode:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
 			&amp;amp;lt;ul type=&amp;quot;disc&amp;quot;&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;operator OR: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;hello | world&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;operator NOT:&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 hello -world&lt;br /&gt;
 hello !world&amp;amp;lt;/pre&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;field search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@title hello @body world&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;field position limit modifier (introduced in version 0.9.9-rc1): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@body[50] hello&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;multiple-field search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@(title,body) hello world&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;all-field search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@* hello&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;phrase search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&amp;quot;hello world&amp;quot;&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;proximity search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&amp;quot;hello world&amp;quot;~10&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;quorum matching operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&amp;quot;the world is a wonderful place&amp;quot;/3&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;strict order operator (aka operator &amp;quot;before&amp;quot;): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;aaa &amp;amp;amp;lt;&amp;amp;amp;lt; bbb &amp;amp;amp;lt;&amp;amp;amp;lt; ccc&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;exact form modifier (introduced in version 0.9.9-rc1): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;raining =cats and =dogs&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;field-start and field-end modifier (introduced in version 0.9.9-rc2): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;^hello world$&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 			&amp;amp;lt;/ul&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	Here&#039;s an example query that uses some of these operators:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;div class=&amp;quot;example&amp;quot;&amp;amp;gt;&amp;amp;lt;a name=&amp;quot;ex-extended-query&amp;quot;&amp;amp;gt;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;p class=&amp;quot;title&amp;quot;&amp;amp;gt;&amp;amp;lt;b&amp;amp;gt;Example:&amp;amp;amp;nbsp;Extended matching mode: query example&amp;amp;lt;/b&amp;amp;gt;&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;div class=&amp;quot;example-contents&amp;quot;&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	&amp;quot;hello world&amp;quot; @title &amp;quot;example program&amp;quot;~5 @body python -(php|perl) @* code&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&amp;amp;lt;br class=&amp;quot;example-break&amp;quot;&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	The full meaning of this search is:&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;div class=&amp;quot;itemizedlist&amp;quot;&amp;amp;gt;&amp;amp;lt;ul type=&amp;quot;disc&amp;quot;&amp;amp;gt;&amp;amp;lt;li&amp;amp;gt;Find the words &#039;hello&#039; and &#039;world&#039; adjacently in any field in a document;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;li&amp;amp;gt;Additionally, the same document must also contain the words &#039;example&#039; and &#039;program&#039;&lt;br /&gt;
 		in the title field, with up to, but not including, 10 words between the words in question;&lt;br /&gt;
 		(E.g. &amp;quot;example PHP program&amp;quot; would be matched however &amp;quot;example script to introduce outside data&lt;br /&gt;
 		into the correct context for your program&amp;quot; would not because two terms have 10 or more words between them)&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;li&amp;amp;gt;Additionally, the same document must contain the word &#039;python&#039; in the body field, but not contain either &#039;php&#039; or &#039;perl&#039;;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;li&amp;amp;gt;Additionally, the same document must contain the word &#039;code&#039; in any field.&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/ul&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	There always is implicit AND operator, so &amp;quot;hello world&amp;quot; means that&lt;br /&gt;
 	both &amp;quot;hello&amp;quot; and &amp;quot;world&amp;quot; must be present in matching document.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	OR operator precedence is higher than AND, so &amp;quot;looking for cat | dog | mouse&amp;quot;&lt;br /&gt;
 	means &amp;quot;looking for ( cat | dog | mouse )&amp;quot; and &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;not&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;quot;(looking for cat) | dog | mouse&amp;quot;.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Field limit operator limits subsequent searching to a given field.&lt;br /&gt;
 	Normally, query will fail with an error message if given field name does not exist&lt;br /&gt;
 	in the searched index. However, that can be suppressed by specifying &amp;quot;@@relaxed&amp;quot;&lt;br /&gt;
 	option at the very beginning of the query:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	@@relaxed @nosuchfield my query&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	This can be helpful when searching through heterogeneous indexes with&lt;br /&gt;
 	different schemas.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Field position limit, introduced in version 0.9.9-rc1, additionaly restricts the searching&lt;br /&gt;
 	to first N position within given field (or fields). For example, &amp;quot;@body[50] hello&amp;quot; will&lt;br /&gt;
 	&amp;amp;lt;span class=&amp;quot;bold&amp;quot;&amp;amp;gt;&amp;amp;lt;strong&amp;amp;gt;not&amp;amp;lt;/strong&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt; match the documents where the keyword &#039;hello&#039; occurs at position 51 and below&lt;br /&gt;
 	in the body.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Proximity distance is specified in words, adjusted for word count, and&lt;br /&gt;
 	applies to all words within quotes. For instance, &amp;quot;cat dog mouse&amp;quot;~5 query&lt;br /&gt;
 	means that there must be less than 8-word span which contains all 3 words,&lt;br /&gt;
 	ie. &amp;quot;CAT aaa bbb ccc DOG eee fff MOUSE&amp;quot; document will &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;not&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;&lt;br /&gt;
 	match this query, because this span is exactly 8 words long.&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Quorum matching operator introduces a kind of fuzzy matching.&lt;br /&gt;
 	It will only match those documents that pass a given threshold of given words.&lt;br /&gt;
 	The example above (&amp;quot;the world is a wonderful place&amp;quot;/3) will match all documents&lt;br /&gt;
 	that have at least 3 of the 6 specified words.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Strict order operator (aka operator &amp;quot;before&amp;quot;), introduced in version 0.9.9-rc2,&lt;br /&gt;
 	will match the document only if its argument keywords occur in the document&lt;br /&gt;
 	exactly in the query order. For instance, &amp;quot;black &amp;amp;amp;lt;&amp;amp;amp;lt; cat&amp;quot; query (without&lt;br /&gt;
 	quotes) will match the document &amp;quot;black and white cat&amp;quot; but &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;not&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;&lt;br /&gt;
 	the &amp;quot;that cat was black&amp;quot; document. Order operator has the lowest priority.&lt;br /&gt;
 	It can be applied both to just keywords and more complex expressions,&lt;br /&gt;
 	ie. this is a valid query:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	(bag of words) &amp;amp;amp;lt;&amp;amp;amp;lt; &amp;quot;exact phrase&amp;quot; &amp;amp;amp;lt;&amp;amp;amp;lt; red|green|blue&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	Exact form keyword modifier, introduced in version 0.9.9-rc1, will match the document only if the keyword occurred&lt;br /&gt;
 	in exactly the specified form. The default behaviour is to match the document&lt;br /&gt;
 	if the stemmed keyword matches. For instance, &amp;quot;runs&amp;quot; query will match both&lt;br /&gt;
 	the document that contains &amp;quot;runs&amp;quot; &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;and&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt; the document that&lt;br /&gt;
 	contains &amp;quot;running&amp;quot;, because both forms stem to just &amp;quot;run&amp;quot; - while &amp;quot;=runs&amp;quot;&lt;br /&gt;
 	query will only match the first document. Exact form operator requires&lt;br /&gt;
 	&amp;amp;lt;a href=&amp;quot;#conf-index-exact-words&amp;quot; title=&amp;quot;11.2.39.&amp;amp;amp;nbsp;index_exact_words&amp;quot;&amp;amp;gt;index_exact_words&amp;amp;lt;/a&amp;amp;gt; option to be enabled.&lt;br /&gt;
 	This is a modifier that affects the keyword and thus can be used within&lt;br /&gt;
 	operators such as phrase, proximity, and quorum operators.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Field-start and field-end keyword modifiers, introduced in version 0.9.9-rc2,&lt;br /&gt;
 	will make the keyword match only if it occurred at the very start or the very end&lt;br /&gt;
 	of a fulltext field, respectively. For instance, the query &amp;quot;^hello world$&amp;quot;&lt;br /&gt;
 	(with quotes and thus combining phrase operator and start/end modifiers)&lt;br /&gt;
 	will only match documents that contain at least one field that has exactly&lt;br /&gt;
 	these two keywords.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Starting with 0.9.9-rc1, arbitrarily nested brackets and negations are allowed.&lt;br /&gt;
 	However, the query must be possible to compute without involving an implicit&lt;br /&gt;
 	list of all documents:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	// correct query&lt;br /&gt;
 	aaa -(bbb -(ccc ddd))&lt;br /&gt;
 &lt;br /&gt;
 	// queries that are non-computable&lt;br /&gt;
 	-aaa&lt;br /&gt;
 	aaa | -bbb&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;div align=&amp;quot;right&amp;quot; class=&amp;quot;search-result-actions&amp;quot;&amp;amp;gt;&lt;br /&gt;
 &amp;amp;amp;nbsp;&lt;br /&gt;
 &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;%init&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 my @results;&lt;br /&gt;
 my $skip_create = 1;&lt;br /&gt;
 my $actions;&lt;br /&gt;
 my $tabs = $m-&amp;amp;gt;comp(&amp;quot;/Elements/DashboardTabs&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;/%init&amp;amp;gt;&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last part is about passing the form&#039;s (portlet) parameters to the PHP script.&lt;br /&gt;
&lt;br /&gt;
As I told you before, the problem here is that Mason does not support PHP out of the box. I found a few hacks around the web to make Mason support PHP, but they were either not applicable to our environment or too difficult to apply.&lt;br /&gt;
&lt;br /&gt;
So we implemented another hack: since we already have another virtual domain where PHP works, we created an html page that embeds (within an iframe) the results from the PHP page that resides in the other virtual domain.&lt;br /&gt;
&lt;br /&gt;
That&#039;s why you see this little piece of code&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
     document.domain = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in the PHP script above: you have to declare that both the HTML page and the PHP script belong to the same domain (although on different subdomains), otherwise you get a security error in the browser.&lt;br /&gt;
&lt;br /&gt;
The html page is located in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/Tools and the file is called sphinx.html.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;sphinx.html follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&amp;lt;&amp;amp; /Elements/Header, Title =&amp;gt; &amp;quot;Search results&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
  &amp;lt;&amp;amp; /Elements/Tabs,&lt;br /&gt;
  	Title =&amp;gt; &amp;quot;Search results&amp;quot;,&lt;br /&gt;
  	current_tab    =&amp;gt; &#039;index.html&#039;,&lt;br /&gt;
  	current_toptab =&amp;gt; &#039;index.html&#039;,&lt;br /&gt;
  	tabs           =&amp;gt; $tabs,&lt;br /&gt;
  	actions        =&amp;gt; $actions,&lt;br /&gt;
  &amp;amp;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;div align=&amp;quot;left&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;table width=95% border=0&amp;gt;&lt;br /&gt;
  	&amp;lt;tr&amp;gt;&lt;br /&gt;
  		&amp;lt;td&amp;gt;&lt;br /&gt;
  			&amp;lt;iframe id=&amp;quot;sphinxresults&amp;quot; src=&amp;quot;http://PHP_VIRTDOMAIN_AMENDED/sphinx.php?&amp;lt;% &amp;quot;Text=&amp;quot; . $Text . &amp;quot;&amp;amp;Queue=&amp;quot; . $Queue . &amp;quot;&amp;amp;Requestor=&amp;quot; . $Requestor . &amp;quot;&amp;amp;From=&amp;quot; . $From . &amp;quot;&amp;amp;To=&amp;quot; . $To %&amp;gt;&amp;quot; width=&amp;quot;95%&amp;quot; height=&amp;quot;200&amp;quot; frameborder=&amp;quot;0&amp;quot; onload=&amp;quot;resizeIframeToFitContent(this)&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;br /&gt;
  		&amp;lt;/td&amp;gt;&lt;br /&gt;
  	&amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;/table&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;div align=&amp;quot;right&amp;quot; class=&amp;quot;search-result-actions&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;amp;nbsp;&lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;%init&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  my @results;&lt;br /&gt;
  my $skip_create = 1;&lt;br /&gt;
  my $actions;&lt;br /&gt;
  my $tabs = $m-&amp;gt;comp(&amp;quot;/Elements/DashboardTabs&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/%init&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;%args&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  $Text&lt;br /&gt;
  $Queue =&amp;gt; &#039;&#039;&lt;br /&gt;
  $Requestor =&amp;gt; &#039;&#039;&lt;br /&gt;
  $From =&amp;gt; &#039;&#039;&lt;br /&gt;
  $To =&amp;gt; &#039;&#039;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/%args&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is one last piece of code that we need to put in place: it allows us to insert a little piece of custom CSS and custom Javascript in all RT page headers.&lt;br /&gt;
&lt;br /&gt;
You have to create a file called InHeader in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/NoAuth/css/web2 (web2 is the name of the default RT CSS, if you use another CSS you have to change this path). The contents of this file are shown below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;InHeader follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;amp;lt;style&amp;amp;gt;&lt;br /&gt;
 	pre.programlisting&lt;br /&gt;
 	{&lt;br /&gt;
 		background-color:	#f0f0f0;&lt;br /&gt;
 		padding:			0.5em;&lt;br /&gt;
 		margin-left:		2em;&lt;br /&gt;
 		margin-right:		2em;&lt;br /&gt;
 	}&lt;br /&gt;
 &amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
 function resizeIframeToFitContent(iframe) {&lt;br /&gt;
 	// This function resizes an IFrame object&lt;br /&gt;
 	// to fit its content.&lt;br /&gt;
 	// The IFrame tag must have a unique ID attribute.&lt;br /&gt;
 	iframe.height = document.getElementById(iframe.id).contentWindow.document.body.scrollHeight + 50;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	document.domain = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, to add our portlet to the installable portlets in RT, you have to modify your [[RT SiteConfig|RT_SiteConfig]].pm file and add the portlet name to the $HomePageComponents variable. If you don&#039;t see the $HomePageComponents variable in your [[RT SiteConfig|RT_SiteConfig]].pm file, copy it from the [[RT Config|RT_Config]].pm file.&lt;br /&gt;
&lt;br /&gt;
Mine looks like this:&lt;br /&gt;
&lt;br /&gt;
Set($HomepageComponents, [qw(QuickCreate Quicksearch MyAdminQueues MySupportQueues MyReminders RefreshHomepage Dashboards SphinxSearch)]);&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Whew, it was long, but not difficult I hope.&lt;br /&gt;
&lt;br /&gt;
Following the instruction in this article you get an installable portlet that will allow you to easily (and &#039;&#039;&#039;quickly&#039;&#039;&#039;!) search the RT ticket database.&lt;br /&gt;
&lt;br /&gt;
Sphinx&#039; syntax allows very powerful searches and its performance is unbeatable. We find it so convenient that we&#039;ve found us often using it in place of every other search.&lt;br /&gt;
&lt;br /&gt;
We had to implement a few hacks to embed the PHP code, but that&#039;s just because we were more familiar with PHP. If you are a Perl hacker you can use the Sphinx&#039; Perl API to integrate Sphinx even better. Let&#039;s see what the community can come up with!&lt;br /&gt;
&lt;br /&gt;
I hope this was useful. If you need help, I can be reached through RT mailing lists.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------&lt;br /&gt;
&lt;br /&gt;
-----------------&lt;br /&gt;
&lt;br /&gt;
Thanks to Cris for this documentation! Here are a few things we changed for our organisation : &lt;br /&gt;
&lt;br /&gt;
With the missing files included in sphinx.php, I had to change a few things so here is my spinx.php file : &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
        &amp;lt;head&amp;gt;&lt;br /&gt;
                &amp;lt;title&amp;gt;Recherche Ticket Sphinx&amp;lt;/title&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;script src=&amp;quot;Classi/sorttable.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
                &amp;lt;style&amp;gt;&lt;br /&gt;
                        body {font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}&lt;br /&gt;
                        table {font-size:inherit;font:100%;}&lt;br /&gt;
                        pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}&lt;br /&gt;
&lt;br /&gt;
                        a {&lt;br /&gt;
                                color: #000;&lt;br /&gt;
                                text-decoration: none;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        div#body a:visited {&lt;br /&gt;
                                color: #666;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        /* background: #547CCC ; */&lt;br /&gt;
                        body {&lt;br /&gt;
                                padding:0;&lt;br /&gt;
                                margin:0;&lt;br /&gt;
&lt;br /&gt;
                                background: #FFFFFF ;&lt;br /&gt;
                                font-family: arial, helvetica, sans-serif;&lt;br /&gt;
&lt;br /&gt;
                                color: #000000;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list, table.queue-summary, table.collection {&lt;br /&gt;
                                margin-top: 0.75em;&lt;br /&gt;
                                font-size: 0.9em;&lt;br /&gt;
                                border: 1px solid #aaa;&lt;br /&gt;
                                border-bottom: 2px solid #999;&lt;br /&gt;
                                border-right: 2px solid #999;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary tr&amp;gt;*:first-child {&lt;br /&gt;
                                padding-left: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary tr&amp;gt;*:last-child {&lt;br /&gt;
                                padding-right: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list a, table.queue-summary a, table.collection a  {&lt;br /&gt;
                                font-weight: bold;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list th.collection-as-table, table.collection th.collection-as-table {&lt;br /&gt;
                                background: #ddd;&lt;br /&gt;
                                font-size: 0.9em;&lt;br /&gt;
                                margin-bottom: 0.5em;&lt;br /&gt;
                                text-align: left;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary th.collection-as-table {&lt;br /&gt;
                                font-size: 0.9em;&lt;br /&gt;
                                margin-bottom: 0.5em;&lt;br /&gt;
                                text-align: right;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary th.collection-as-table:first-child {&lt;br /&gt;
                                text-align: left;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.collection-as-table+tr.collection-as-table th {&lt;br /&gt;
                                border-bottom: 2px solid grey;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary td {&lt;br /&gt;
                                background: #efefef;&lt;br /&gt;
                                border-bottom: 1px solid #ccc;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.evenline td {&lt;br /&gt;
                                background: #eee;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.oddline td {&lt;br /&gt;
                                background: #fff;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.evenline td, tr.oddline td {&lt;br /&gt;
                                padding-top: 0.5em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.evenline+tr.evenline td, tr.oddline+tr.oddline td{&lt;br /&gt;
                                padding-top: 0;&lt;br /&gt;
                                border: none;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list td:first-child, table.ticket-list th:first-child {&lt;br /&gt;
                                padding-left: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list td:last-child, table.ticket-list th:last-child {&lt;br /&gt;
                                padding-right: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        th.collection-as-table , td.collection-as-table {&lt;br /&gt;
                                padding-right: 0.5em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        .pagenum.a:hover, .paging a.nav:hover{&lt;br /&gt;
                                text-decoration: underline;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        .pagenum *, .paging a.nav{&lt;br /&gt;
                                padding: .5em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        .currentpage{&lt;br /&gt;
                                text-decoration: none;&lt;br /&gt;
                                font-weight: bold;&lt;br /&gt;
                                background: #eee;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        div.paging{&lt;br /&gt;
                                text-align: center;&lt;br /&gt;
                                padding-bottom: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        #body&amp;gt;table.ticket-list {&lt;br /&gt;
                                margin-bottom: 2em;&lt;br /&gt;
                        }&lt;br /&gt;
                &amp;lt;/style&amp;gt;&lt;br /&gt;
                &amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;body&amp;gt;&lt;br /&gt;
                &amp;lt;?php&lt;br /&gt;
                //Costante con il max numero di righe ritornate da Sphinx&lt;br /&gt;
                define(&#039;SPHINX_MAX_LIMIT&#039;, 1000);&lt;br /&gt;
&lt;br /&gt;
                require_once(&amp;quot;Classi/sphinxapi.php&amp;quot;);&lt;br /&gt;
                //require_once(&amp;quot;Classi/Timer.class.php&amp;quot;);&lt;br /&gt;
                require_once(&amp;quot;Classi/MySql.class.php&amp;quot;);&lt;br /&gt;
                require_once(&amp;quot;Classi/ErrorManager.class.php&amp;quot;);&lt;br /&gt;
                include_once(&amp;quot;Include/Query.inc.php&amp;quot;);&lt;br /&gt;
                include_once(&amp;quot;Include/dvopendb.config.inc.php&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        //      $MyTimer =  new Timer();&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Parametri di connessione al Daemon Sphinx&lt;br /&gt;
                $host = &amp;quot;localhost&amp;quot;;&lt;br /&gt;
                $port = 9312;&lt;br /&gt;
                $index = &amp;quot;*&amp;quot;; // put your index name here&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Variabili in GET&lt;br /&gt;
                $query = $_GET[&#039;Text&#039;];&lt;br /&gt;
                $RequestorFilter = trim($_GET[&#039;Requestor&#039;]);&lt;br /&gt;
                $CodaFilter = $_GET[&#039;Queue&#039;];&lt;br /&gt;
                $DataInizioFilter = trim($_GET[&#039;From&#039;]);&lt;br /&gt;
                $DataFineFilter = trim($_GET[&#039;To&#039;]);&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Connessione al Daemon Sphinx&lt;br /&gt;
                $cl = new SphinxClient();&lt;br /&gt;
                $cl-&amp;gt;SetServer($host, $port);&lt;br /&gt;
                $cl-&amp;gt;SetMatchMode(SPH_MATCH_EXTENDED2);&lt;br /&gt;
                $cl-&amp;gt;SetLimits(0,SPHINX_MAX_LIMIT, $max_matches=0, $cutoff=0 );&lt;br /&gt;
&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //MySql Database Query per la retrive dei dati del ticket&lt;br /&gt;
&lt;br /&gt;
                $SqlQuery = new MySql();&lt;br /&gt;
                $SqlQuery-&amp;gt;connect($DbHostName,$DbName,$DbUser,$DbPassword);&lt;br /&gt;
&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Filtri sulla ricerca Sphinx&lt;br /&gt;
&lt;br /&gt;
                //Check della query (parametro di ricerca)&lt;br /&gt;
                if(strlen($query)==0)&lt;br /&gt;
                {&lt;br /&gt;
                        echo &amp;quot;Un paramètre doit être inscrit dans la zone  \&amp;quot;Texte\&amp;quot; pour continuer.&amp;quot;;&lt;br /&gt;
                        exit(1);&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Filtro Requestor&lt;br /&gt;
                if(strlen($RequestorFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        $TempQuery = sprintf($RequestorLookUpQuery,mysql_real_escape_string($RequestorFilter));&lt;br /&gt;
//                      $result22 = $SqlQuery-&amp;gt;query($TempQuery);&lt;br /&gt;
//                      $RequestorResult = $SqlQuery-&amp;gt;fetchAll($result22);&lt;br /&gt;
                                        $result22 = $SqlQuery-&amp;gt;query($TempQuery);&lt;br /&gt;
                                        $RequestorResult = mysql_fetch_array($result22);&lt;br /&gt;
                        if(count($RequestorResult)&amp;gt;0)&lt;br /&gt;
                        {&lt;br /&gt;
                                $cl-&amp;gt;SetFilter (&amp;quot;createdby&amp;quot;,array($RequestorResult[&#039;id&#039;]) , $exclude=false );&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;&amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;gt;Attention - L&#039;adresse \&amp;quot;&amp;quot;.$RequestorFilter.&amp;quot;\&amp;quot; n&#039;est pas dans la base de donnée et la recherche a été effectuée &amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Filtro Queue&lt;br /&gt;
                if(strlen($CodaFilter)&amp;gt;0)&lt;br /&gt;
                        $cl-&amp;gt;SetFilter (&amp;quot;queue&amp;quot;, array($CodaFilter), $exclude=false );&lt;br /&gt;
&lt;br /&gt;
                //Filtro Data&lt;br /&gt;
&lt;br /&gt;
                //__________________________________________________________________________________________________________________&lt;br /&gt;
                //Check delle date&lt;br /&gt;
                if(strlen($DataInizioFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        //Check Datainizio&lt;br /&gt;
                        if(checkdate(substr($DataInizioFilter,5,2),substr($DataInizioFilter,8,2),substr($DataInizioFilter,0,4))==false)&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;Date de début &amp;quot;.$DataInizioFilter.&amp;quot; incorrecte &amp;quot;;&lt;br /&gt;
                                exit(1);&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                                 $DataInizio = mktime(0, 0, 0, substr($DataInizioFilter,5,2), substr($DataInizioFilter,8,2), substr($DataInizioFilter,0,4));&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                if(strlen($DataFineFilter)&amp;gt;0)&lt;br /&gt;
                {       //Check DataFine&lt;br /&gt;
&lt;br /&gt;
                        if(checkdate(substr($DataFineFilter,5,2),substr($DataFineFilter,8,2),substr($DataFineFilter,0,4))==false)&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;Date de fin &amp;quot;.$DataFineFilter.&amp;quot; incorrecte &amp;quot;;&lt;br /&gt;
                                exit(1);&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                                $DataFine = mktime(0, 0, 0, substr($DataFineFilter,5,2), substr($DataFineFilter,8,2), substr($DataFineFilter,0,4));&lt;br /&gt;
                }&lt;br /&gt;
                //__________________________________________________________________________________________________________________&lt;br /&gt;
&lt;br /&gt;
                //Filtraggio vero e proprio&lt;br /&gt;
&lt;br /&gt;
                //Se sono settate entrambe...&lt;br /&gt;
                if(strlen($DataInizioFilter)&amp;gt;0 &amp;amp;&amp;amp; strlen($DataFineFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        if($DataInizio &amp;lt; $DataFine)&lt;br /&gt;
                        {&lt;br /&gt;
                                //Se sono settate entrambe le date filtro per entrambe&lt;br /&gt;
                                $cl-&amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, $DataFine, $exclude=false );&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;La date de début &amp;quot;.$DataInizioFilter.&amp;quot; est supérieure à la date de fin &amp;quot;.$DataFineFilter;&lt;br /&gt;
                                exit(1);&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Se solo DataInizio..&lt;br /&gt;
                if(strlen($DataInizioFilter)&amp;gt;0 &amp;amp;&amp;amp; strlen($DataFineFilter)==0)&lt;br /&gt;
                {&lt;br /&gt;
                        $cl-&amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, mktime(), $exclude=false );&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Se solo DataFine..&lt;br /&gt;
                if(strlen($DataInizioFilter)==0 &amp;amp;&amp;amp; strlen($DataFineFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        //2008-11-14 : Data del primo Ticket di RT&lt;br /&gt;
                        //1988-07-18 : Data di nascita di AMENDED :)&lt;br /&gt;
                        $cl-&amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, mktime(0, 0, 0,07,18,1988), $DataFine, $exclude=false );&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Eseguo la Query su Sphinx&lt;br /&gt;
&lt;br /&gt;
                $res = $cl-&amp;gt;Query($query, $index);&lt;br /&gt;
                if ($res == false)&lt;br /&gt;
                {&lt;br /&gt;
                        echo &amp;quot;failure: &amp;quot;.$cl-&amp;gt;GetLastError().&amp;quot;\n&amp;quot;;&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                        if(count($res[&#039;matches&#039;])!=0)&lt;br /&gt;
                        {&lt;br /&gt;
                                //Se i risultati totali sono &amp;gt; 1000&lt;br /&gt;
                                if($res[&#039;total_found&#039;]&amp;gt;SPHINX_MAX_LIMIT)&lt;br /&gt;
                                {&lt;br /&gt;
                                        echo &amp;quot;&amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;gt; Attention, &amp;quot;.$res[total_found].&amp;quot; résultats ont été trouvés, mais vous ne verrez que les premiers &amp;quot;.SPHINX_MAX_LIMIT.&amp;quot; résultats.&amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
                                }&lt;br /&gt;
&lt;br /&gt;
                                //Se ci sono dei risultati creo la tabella e stampo&lt;br /&gt;
                                //echo &amp;quot;&amp;lt;table id=&#039;ResultTable&#039; class=&#039;ticket-list&#039; border=&#039;0&#039; cellspacing=&#039;0&#039; cellpadding=&#039;1&#039; width=&#039;100%&#039;&amp;gt;&lt;br /&gt;
                                echo &amp;quot;&amp;lt;table id=&#039;ResultTable&#039; class=&#039;sortable&#039; border=&#039;0&#039; cellspacing=&#039;0&#039; cellpadding=&#039;1&#039; width=&#039;100%&#039;&amp;gt;&lt;br /&gt;
                                                &amp;lt;thead&amp;gt;&lt;br /&gt;
                                                &amp;lt;tr class=&#039;collection-as-table&#039;&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;#&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Sujet&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;École&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Status&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Date_de_création&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Demandeur&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Propriétaire&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                                                &amp;lt;/thead&amp;gt;&amp;lt;tbody&amp;gt;&amp;quot;;&lt;br /&gt;
                                foreach ($res[&amp;quot;matches&amp;quot;] as $key=&amp;gt;$value)&lt;br /&gt;
                                {&lt;br /&gt;
                                        $i++;&lt;br /&gt;
                                        $TempQuery = sprintf($TicketDetailQuery,mysql_real_escape_string($key));&lt;br /&gt;
                                        $result34 = $SqlQuery-&amp;gt;query($TempQuery);&lt;br /&gt;
                                        $Risultato = mysql_fetch_array($result34);&lt;br /&gt;
                                        //$Risultato = $SqlQuery-&amp;gt;queryFetchAll($TempQuery);&lt;br /&gt;
                                        //$Risultato = $SqlQuery-&amp;gt;fetchAll($result23);&lt;br /&gt;
                                        if($i%2==0)&lt;br /&gt;
                                        {&lt;br /&gt;
                                                                                        echo &amp;quot;  &amp;lt;tr class=&#039;evenline&#039;&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                &amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
                                        }&lt;br /&gt;
                                        else&lt;br /&gt;
                                        {&lt;br /&gt;
                                                echo &amp;quot;  &amp;lt;tr class=&#039;oddline&#039;&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                &amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
                                        }&lt;br /&gt;
                                }&lt;br /&gt;
                                echo &amp;quot;  &amp;lt;/tbody&amp;gt;&lt;br /&gt;
                                        &amp;lt;tfoot&amp;gt;&amp;lt;/tfoot&amp;gt;&lt;br /&gt;
                                        &amp;lt;/table&amp;gt;&amp;quot;;&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                        {&lt;br /&gt;
                                //...Altrimenti stampo che non ho trovato nulla&lt;br /&gt;
                                echo &amp;quot;&amp;lt;br/&amp;gt;&amp;lt;label class=\&amp;quot;notfoundlabel\&amp;quot;&amp;gt;Aucun résultat trouvé&amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        echo &amp;quot;Résultats &amp;quot;.$res[&#039;total&#039;].&amp;quot; de &amp;quot;.$res[&#039;total_found&#039;]; // in &amp;quot;.$MyTimer-&amp;gt;elapsed().&amp;quot; secondi&amp;quot;;&lt;br /&gt;
                }&lt;br /&gt;
                ?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is my Classi/MySql.class.php file&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
class MySQLException extends Exception { }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class MySQL {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private $host = null,&lt;br /&gt;
                        $baseName = null,&lt;br /&gt;
                        $user = null,&lt;br /&gt;
                        $id = null;&lt;br /&gt;
&lt;br /&gt;
        private $errorManager = null;&lt;br /&gt;
&lt;br /&gt;
        private $queries = array();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function __construct() {&lt;br /&gt;
&lt;br /&gt;
                $this-&amp;gt;errorManager = ErrorManager::getInstance();&lt;br /&gt;
&lt;br /&gt;
        } // public function __construct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getHost() { return $this-&amp;gt;host; }&lt;br /&gt;
        public function getBaseName() { return $this-&amp;gt;baseName; }&lt;br /&gt;
        public function getUser() { return $this-&amp;gt;user; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function connect($host, $base, $user, $password, $enconding = &amp;quot;utf8&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                if (!($this-&amp;gt;id = mysql_connect($host, $user, $password))) {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;host = null;&lt;br /&gt;
                        $this-&amp;gt;base = null;&lt;br /&gt;
                        $this-&amp;gt;user = null;&lt;br /&gt;
                        $this-&amp;gt;id = null;&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;database connection failed!&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                        $this-&amp;gt;host = $host;&lt;br /&gt;
                        $this-&amp;gt;user = $user;&lt;br /&gt;
                        if (mysql_select_db($base, $this-&amp;gt;id)) {&lt;br /&gt;
                                $this-&amp;gt;baseName = $base;&lt;br /&gt;
                        }&lt;br /&gt;
                        mysql_query(&amp;quot;set names $enconding&amp;quot;, $this-&amp;gt;id);&lt;br /&gt;
                        //mysql_set_charset($enconding, $this-&amp;gt;id);&lt;br /&gt;
                        return true;&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function connect($host, $base, $user, $password)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getLastId() {&lt;br /&gt;
&lt;br /&gt;
                if (is_resource($this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                        $lastId = mysql_insert_id($this-&amp;gt;id);&lt;br /&gt;
                        return $lastId;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;database is not connected, can&#039;t get last id&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function getLastId()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function fetchAll($result) {&lt;br /&gt;
&lt;br /&gt;
                if (mysql_num_rows($result)) {&lt;br /&gt;
&lt;br /&gt;
                        $rows = array();&lt;br /&gt;
&lt;br /&gt;
                        while ($row = mysql_fetch_assoc($result)) {&lt;br /&gt;
                                $rows[] = $row;&lt;br /&gt;
                        }&lt;br /&gt;
                        return $rows;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;invalid mysql query result supplied to fetchAll()&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function fetchAll($result)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function query($string) {&lt;br /&gt;
&lt;br /&gt;
                if (is_resource($this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                        if ($result = mysql_query($string, $this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                                $this-&amp;gt;queries[] = $string;&lt;br /&gt;
                                return $result;&lt;br /&gt;
&lt;br /&gt;
                        }&lt;br /&gt;
                        else {&lt;br /&gt;
                                $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;error in query: &#039;$string&#039;:&amp;quot;.mysql_error($this-&amp;gt;id)));&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;database is not connected, can&#039;t make query&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function query($string)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function queryFetchAll($query) {&lt;br /&gt;
&lt;br /&gt;
                $result = $this-&amp;gt;query($query);&lt;br /&gt;
                $entries = $this-&amp;gt;fetchAll($result);&lt;br /&gt;
&lt;br /&gt;
                return $entries;&lt;br /&gt;
&lt;br /&gt;
        } // public function queryFetchAll($query)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getQueries() {&lt;br /&gt;
&lt;br /&gt;
                return $this-&amp;gt;queries;&lt;br /&gt;
&lt;br /&gt;
        } // public function getQueries()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function __destruct() {&lt;br /&gt;
&lt;br /&gt;
                if (is_resource($this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                        mysql_close($this-&amp;gt;id);&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function __destruct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} // class Mysql&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I added ErrorManager.class.php also : &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class ErrorManager {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private static $instance = null;&lt;br /&gt;
&lt;br /&gt;
        private $errors = array();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private function __construct() { }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public static function getInstance() {&lt;br /&gt;
&lt;br /&gt;
                if (self::$instance == null) {&lt;br /&gt;
&lt;br /&gt;
                        self::$instance = new ErrorManager();&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                return self::$instance;&lt;br /&gt;
&lt;br /&gt;
        } // public function getInstance()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getErrors() {&lt;br /&gt;
&lt;br /&gt;
                return $this-&amp;gt;errors;&lt;br /&gt;
&lt;br /&gt;
        } // public function getErrors()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function reportError(&amp;amp;$sourceObject, $msg = &amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                $class = get_class($sourceObject);&lt;br /&gt;
                $this-&amp;gt;errors[] = array(&amp;quot;source&amp;quot; =&amp;gt; $sourceObject, &amp;quot;message&amp;quot; =&amp;gt; &amp;quot;$class: \&amp;quot;$msg\&amp;quot;&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        } // public function reportError($sourceObject, $msg = &amp;quot;&amp;quot;)&lt;br /&gt;
        public function reportFatalError(&amp;amp;$sourceObject, $exception = null) {&lt;br /&gt;
&lt;br /&gt;
                if (!($exception instanceof Exception)) {&lt;br /&gt;
&lt;br /&gt;
                        $exception = new Exception();&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                $msg = $exception-&amp;gt;getMessage();&lt;br /&gt;
                $class = get_class($sourceObject);&lt;br /&gt;
                $this-&amp;gt;reportError($sourceObject, &amp;quot;fatal error: $msg&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
                throw $exception;&lt;br /&gt;
&lt;br /&gt;
        } // public function reportFatalError($sourceObject, $exception)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} // class ErrorManager&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the Classi I added http://www.kryogenix.org/code/browser/sorttable/sorttable.js for the table to sort.&lt;br /&gt;
&lt;br /&gt;
When you download the last beta version of sphinx, you get a api so I copied it to the Classi also : &lt;br /&gt;
sphinxbeta/sphinx-2.0.1-beta/api/sphinxapi.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The most important thing is to change the limit in the php for the group_concat to make sure you will get all your tickets : &lt;br /&gt;
mysql -p &lt;br /&gt;
SET GLOBAL group_concat_max_len = 8192000;&lt;br /&gt;
&lt;br /&gt;
My sphinx.conf is the following :&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
source rt3&lt;br /&gt;
{&lt;br /&gt;
        type                    = mysql&lt;br /&gt;
&lt;br /&gt;
        sql_host                = localhost&lt;br /&gt;
        sql_user                = &lt;br /&gt;
        sql_pass                = &lt;br /&gt;
        sql_db                  = rt3&lt;br /&gt;
        sql_port                = 3306  # optional, default is 3306&lt;br /&gt;
        sql_query               = \&lt;br /&gt;
                select TK.id as TicketNum, \&lt;br /&gt;
                        TK.Creator as CreatedBy, \&lt;br /&gt;
                        TK.Queue as Queue, \&lt;br /&gt;
                        unix_timestamp(TK.Created) as Created, \&lt;br /&gt;
                        TK.Subject as Subject, \&lt;br /&gt;
                        group_concat(A.Content) as Content \&lt;br /&gt;
                from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
                where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
                and A.TransactionId = T.id \&lt;br /&gt;
                and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
                and (A.ContentType = &#039;text/plain&#039; or A.ContentType = &#039;text/html&#039;) \&lt;br /&gt;
                and A.Content is not null \&lt;br /&gt;
                and TK.Created &amp;lt; concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) \&lt;br /&gt;
                group by TK.id \&lt;br /&gt;
                order by TK.id, T.id&lt;br /&gt;
&lt;br /&gt;
        sql_attr_uint           = Created&lt;br /&gt;
        sql_attr_uint           = Queue&lt;br /&gt;
        sql_attr_uint           = CreatedBy&lt;br /&gt;
        sql_query_info          = SELECT * FROM Tickets WHERE id=$id&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
source rt3delta : rt3&lt;br /&gt;
 {&lt;br /&gt;
        sql_query               = \&lt;br /&gt;
                select TK.id as TicketNum, \&lt;br /&gt;
                        TK.Creator as CreatedBy, \&lt;br /&gt;
                        TK.Queue as Queue, \&lt;br /&gt;
                        unix_timestamp(TK.Created) as Created, \&lt;br /&gt;
                        TK.Subject as Subject, \&lt;br /&gt;
                        group_concat(A.Content) as Content \&lt;br /&gt;
                from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
                where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
                and A.TransactionId = T.id \&lt;br /&gt;
                and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
                and A.Content is not null \&lt;br /&gt;
                and TK.Created between concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) and last_day(now()) \&lt;br /&gt;
                group by TK.id \&lt;br /&gt;
                order by TK.id, T.id&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
index fulltext1&lt;br /&gt;
 {&lt;br /&gt;
        source                  = rt3&lt;br /&gt;
        path                    = /var/data/fulltext1&lt;br /&gt;
        docinfo                 = extern&lt;br /&gt;
        charset_type    = utf-8&lt;br /&gt;
        html_strip = 1&lt;br /&gt;
        min_word_len = 1&lt;br /&gt;
        enable_star     = 1&lt;br /&gt;
        min_infix_len   = 3&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 index fulltextdelta: fulltext1&lt;br /&gt;
 {&lt;br /&gt;
        source                  = rt3delta&lt;br /&gt;
        charset_type            = utf-8&lt;br /&gt;
        path                    = /var/data/fulltextdelta&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 indexer&lt;br /&gt;
 {&lt;br /&gt;
        mem_limit               = 128M&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
searchd&lt;br /&gt;
{&lt;br /&gt;
        listen                  = 9312&lt;br /&gt;
        listen                  = 9306:mysql41&lt;br /&gt;
        log                     = /var/log/sphinx/searchd.log&lt;br /&gt;
        query_log               = /var/log/sphinx/query.log&lt;br /&gt;
        read_timeout            = 5&lt;br /&gt;
        max_children            = 30&lt;br /&gt;
        pid_file                = /var/run/sphinx/searchd.pid&lt;br /&gt;
        max_matches             = 1000&lt;br /&gt;
        seamless_rotate         = 1&lt;br /&gt;
        preopen_indexes         = 1&lt;br /&gt;
        unlink_old              = 1&lt;br /&gt;
        workers                 = threads # for RT to work&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Conditional_Reopen_Reject&amp;diff=5370</id>
		<title>Conditional Reopen Reject</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Conditional_Reopen_Reject&amp;diff=5370"/>
		<updated>2016-06-20T07:51:27Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Corrected formatting for the new wiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Conditional Reopen Reject lets you decide that, after a set amount of time since resolution, users won&#039;t be able to reopen a ticket.&lt;br /&gt;
&lt;br /&gt;
It works with a scrip and a template, as explained below.&lt;br /&gt;
&lt;br /&gt;
==Setting up the scrip==&lt;br /&gt;
&lt;br /&gt;
We have had this customization installed for so long that I do not remember the default configuration of RT. I believe a script called &amp;quot;On Correspond Open Tickets&amp;quot; already exists in a default installation.&lt;br /&gt;
&lt;br /&gt;
You have to change it (or create it if it doesn&#039;t exist) the following way.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that this is configured so that tickets become non-reopenable after a week since resolution. If you want a different timeframe, just change the &#039;&#039;$Days&#039;&#039; variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; On Correspond Open Tickets&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition:&#039;&#039;&#039; User defined&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Action:&#039;&#039;&#039; Autoreply to requestors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Template:&#039;&#039;&#039; Conditional Reopen Reject&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Applies to:&#039;&#039;&#039; Global&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Custom condition:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 my $Days = 60*60*24*7; # 7 days&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 my $TransactionObj = $self-&amp;gt;TransactionObj;&lt;br /&gt;
 &lt;br /&gt;
 my $TicketObj = $self-&amp;gt;TicketObj;&lt;br /&gt;
 &lt;br /&gt;
 my $QueueObj = $TicketObj-&amp;gt;QueueObj;&lt;br /&gt;
 &lt;br /&gt;
 my $QueueName = $QueueObj-&amp;gt;Name;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 return 0 unless $TransactionObj-&amp;gt;Type eq &#039;Correspond&#039;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 # begin debug section #############&lt;br /&gt;
 &lt;br /&gt;
 my $dr = $TicketObj-&amp;gt;ResolvedObj-&amp;gt;Unix;&lt;br /&gt;
 &lt;br /&gt;
 my $tt = time() - $TicketObj-&amp;gt;ResolvedObj-&amp;gt;Unix;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 $RT::Logger-&amp;gt;info( &amp;quot;&amp;gt;  -- Scrip 1 --\n&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 $RT::Logger-&amp;gt;info( &amp;quot;&amp;gt;  DataRisoluzione: $dr \n&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 $RT::Logger-&amp;gt;info( &amp;quot;&amp;gt;  TempoTrascorso: $tt \n&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 # InBound should be true only if the email comes from the original requestor&lt;br /&gt;
 &lt;br /&gt;
 if ( $TransactionObj-&amp;gt;IsInbound ) {$RT::Logger-&amp;gt;info(&amp;quot;&amp;gt;  Inbound\n&amp;quot;);}&lt;br /&gt;
 &lt;br /&gt;
 if ( $QueueObj-&amp;gt;IsInactiveStatus( $TicketObj-&amp;gt;Status ) ) {$RT::Logger-&amp;gt;info(&amp;quot;&amp;gt;  Inactive\n&amp;quot;);}&lt;br /&gt;
 &lt;br /&gt;
 # end debug section #############&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 if ( $TransactionObj-&amp;gt;IsInbound &amp;amp;&amp;amp;&lt;br /&gt;
 &lt;br /&gt;
      $QueueObj-&amp;gt;IsInactiveStatus( $TicketObj-&amp;gt;Status ) &amp;amp;&amp;amp;&lt;br /&gt;
 &lt;br /&gt;
      time() - $TicketObj-&amp;gt;ResolvedObj-&amp;gt;Unix &amp;gt; $Days ) {&lt;br /&gt;
 &lt;br /&gt;
   return 1; # send mail template&lt;br /&gt;
 &lt;br /&gt;
 } else {&lt;br /&gt;
 &lt;br /&gt;
   $TicketObj-&amp;gt;SetStatus( &#039;open&#039; );&lt;br /&gt;
 &lt;br /&gt;
   return 0; # don&#039;t send mail template&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Custom action preparation code:&#039;&#039;&#039; empty&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Custom action commit code:&#039;&#039;&#039; empty&lt;br /&gt;
&lt;br /&gt;
==Setting up the template==&lt;br /&gt;
&lt;br /&gt;
This is how the template should be configured:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name:&#039;&#039;&#039; Conditional Reopen Reject&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; Reject reopen if ticket has been closed for more than X days&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Type:&#039;&#039;&#039; Perl&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 Subject: WARNING - TICKET REJECTED: {$Ticket-&amp;gt;Subject}&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Ticket #{$Ticket-&amp;gt;id()} has been closed for more than 7 days: it is not possible to reopen it.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Please submit a new ticket instead.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Thank you&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 RT for {$Ticket-&amp;gt;QueueObj-&amp;gt;SubjectTag || $rtname}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OK, that&#039;s all.&lt;br /&gt;
&lt;br /&gt;
I hope you enjoy it!&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=5369</id>
		<title>Full Text Search Portlet</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=5369"/>
		<updated>2016-06-20T07:49:28Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Corrected formatting for the new wiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
[[File:FTSearch.png|thumb|350px|The portlet]]&lt;br /&gt;
==&#039;&#039;&#039;The full-text search portlet&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
After the release of RT 4.0 we began investigating the migration from our 3.8.x RT installation.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;simple search&amp;quot; page, and to have to add &amp;quot;fulltext:&amp;quot; every time.&lt;br /&gt;
&lt;br /&gt;
So I thought &amp;quot;why not write a portlet again&amp;quot;, 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 &amp;quot;simple search&amp;quot; page again for... simple searches :-)&lt;br /&gt;
&lt;br /&gt;
So here it is, for those who want to have a usable alternative to the &amp;quot;simple search&amp;quot; page and yet don&#039;t want to always use the advanced search.&lt;br /&gt;
&lt;br /&gt;
Paste the content of the following box into a file. I called it FTSearch.&lt;br /&gt;
&lt;br /&gt;
You have to put it in:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;your_rt_root&amp;gt;&#039;&#039;\local\html\Elements&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;&amp;amp;|/Widgets/TitleBox, title =&amp;gt; loc(&#039;Fulltext Search&#039;), bodyclass =&amp;gt; &amp;quot;&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
     &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
     function MangleData()&lt;br /&gt;
     {&lt;br /&gt;
         // qui aggrego tutti i campi della prima form&lt;br /&gt;
         var textstring = &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;;&lt;br /&gt;
         var fields=[&amp;quot;fulltext:&amp;quot;, &amp;quot;queue:&amp;quot;, &amp;quot;requestor:&amp;quot;, &amp;quot;owner:&amp;quot;];&lt;br /&gt;
 &lt;br /&gt;
         for (i=3;i&amp;gt;=0;i--) {&lt;br /&gt;
             var box = document.forms[&#039;fulltext-search&#039;].elements[i];&lt;br /&gt;
             if (box.value) {&lt;br /&gt;
                 textstring += fields[i] + box.value + &#039; &#039;;&lt;br /&gt;
             }&lt;br /&gt;
         }&lt;br /&gt;
 &lt;br /&gt;
         // popolo la seconda form con la stringa ricavata dalla prima&lt;br /&gt;
         document.forms[&#039;simple-search&#039;].elements[0].value = textstring;&lt;br /&gt;
 &lt;br /&gt;
         // sottometto la seconda form invece della prima&lt;br /&gt;
         document.forms[&#039;simple-search&#039;].submit();&lt;br /&gt;
     }&lt;br /&gt;
     &amp;lt;/script&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;fulltext-search&amp;quot; action=&amp;quot;#&amp;quot; method=&amp;quot;get&amp;quot; onsubmit=&amp;quot;MangleData(); return false&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Text&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;Text&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Queue&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectQueue, NamedValues =&amp;gt; 1, Name =&amp;gt; &#039;Queue&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Requestor&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/EmailInput, Name =&amp;gt; &#039;Requestor&#039;, Size =&amp;gt; &#039;40&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Owner&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectOwner, ValueAttribute =&amp;gt; &amp;quot;Name&amp;quot;, Name =&amp;gt; &amp;quot;Owner&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;submit&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
                 &amp;lt;input class=&amp;quot;button&amp;quot; type=&amp;quot;submit&amp;quot; value=&amp;quot;Submit&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/div&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;input2&amp;quot; action=&amp;quot;/Search/Simple.html&amp;quot; method=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input style=&amp;quot;display:none&amp;quot; type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;q&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
 &amp;lt;/&amp;amp;&amp;gt;&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
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&#039;t have it, copy it from RT_Config.pm.&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;gt; rm -rf /opt/rt4/var/mason_data/obj/*&lt;br /&gt;
&amp;gt; svcadm restart apache22&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then, in RT, click on the &amp;quot;EDIT&amp;quot; box in the top right corner and add FTSearch to your home page.&lt;br /&gt;
&lt;br /&gt;
That&#039;s all! Hope you enjoy it.&lt;br /&gt;
&lt;br /&gt;
[[User:Cris70|Cris]]&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=5368</id>
		<title>Full Text Search Portlet</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=5368"/>
		<updated>2016-06-20T07:45:50Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Corrected formatting for the new wiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
[[File:FTSearch.png|thumb|350px|The portlet]]&lt;br /&gt;
==&#039;&#039;&#039;The full-text search portlet&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
After the release of RT 4.0 we began investigating the migration from our 3.8.x RT installation.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;simple search&amp;quot; page, and to have to add &amp;quot;fulltext:&amp;quot; every time.&lt;br /&gt;
&lt;br /&gt;
So I thought &amp;quot;why not write a portlet again&amp;quot;, 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 &amp;quot;simple search&amp;quot; page again for... simple searches :-)&lt;br /&gt;
&lt;br /&gt;
So here it is, for those who want to have a usable alternative to the &amp;quot;simple search&amp;quot; page and yet don&#039;t want to always use the advanced search.&lt;br /&gt;
&lt;br /&gt;
Paste the content of the following box into a file. I called it FTSearch.&lt;br /&gt;
&lt;br /&gt;
You have to put it in:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;your_rt_root&amp;gt;&#039;&#039;\local\html\Elements&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;lt;&amp;amp;|/Widgets/TitleBox, title =&amp;gt; loc(&#039;Fulltext Search&#039;), bodyclass =&amp;gt; &amp;quot;&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
     &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
     function MangleData()&lt;br /&gt;
     {&lt;br /&gt;
         // qui aggrego tutti i campi della prima form&lt;br /&gt;
         var textstring = &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;;&lt;br /&gt;
         var fields=[&amp;quot;fulltext:&amp;quot;, &amp;quot;queue:&amp;quot;, &amp;quot;requestor:&amp;quot;, &amp;quot;owner:&amp;quot;];&lt;br /&gt;
 &lt;br /&gt;
         for (i=3;i&amp;gt;=0;i--) {&lt;br /&gt;
             var box = document.forms[&#039;fulltext-search&#039;].elements[i];&lt;br /&gt;
             if (box.value) {&lt;br /&gt;
                 textstring += fields[i] + box.value + &#039; &#039;;&lt;br /&gt;
             }&lt;br /&gt;
         }&lt;br /&gt;
 &lt;br /&gt;
         // popolo la seconda form con la stringa ricavata dalla prima&lt;br /&gt;
         document.forms[&#039;simple-search&#039;].elements[0].value = textstring;&lt;br /&gt;
 &lt;br /&gt;
         // sottometto la seconda form invece della prima&lt;br /&gt;
         document.forms[&#039;simple-search&#039;].submit();&lt;br /&gt;
     }&lt;br /&gt;
     &amp;lt;/script&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;fulltext-search&amp;quot; action=&amp;quot;#&amp;quot; method=&amp;quot;get&amp;quot; onsubmit=&amp;quot;MangleData(); return false&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Text&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;Text&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Queue&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectQueue, NamedValues =&amp;gt; 1, Name =&amp;gt; &#039;Queue&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Requestor&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/EmailInput, Name =&amp;gt; &#039;Requestor&#039;, Size =&amp;gt; &#039;40&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Owner&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectOwner, ValueAttribute =&amp;gt; &amp;quot;Name&amp;quot;, Name =&amp;gt; &amp;quot;Owner&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;submit&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
                 &amp;lt;input class=&amp;quot;button&amp;quot; type=&amp;quot;submit&amp;quot; value=&amp;quot;Submit&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/div&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;input2&amp;quot; action=&amp;quot;/Search/Simple.html&amp;quot; method=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input style=&amp;quot;display:none&amp;quot; type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;q&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
 &amp;lt;/&amp;amp;&amp;gt;&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
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&#039;t have it, copy it from RT_Config.pm.&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
      &amp;gt; rm -rf /opt/rt4/var/mason_data/obj/*&lt;br /&gt;
      &amp;gt; svcadm restart apache22&lt;br /&gt;
Then, in RT, click on the &amp;quot;EDIT&amp;quot; box in the top right corner and add FTSearch to your home page.&lt;br /&gt;
&lt;br /&gt;
That&#039;s all! Hope you enjoy it.&lt;br /&gt;
&lt;br /&gt;
[[User:Cris70|Cris]]&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=IntegrateSphinx&amp;diff=5367</id>
		<title>IntegrateSphinx</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=IntegrateSphinx&amp;diff=5367"/>
		<updated>2016-06-20T07:41:28Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Corrected formatting for the new wiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
= Integrating the Sphinx full-text search engine in RT =&lt;br /&gt;
&lt;br /&gt;
[http://sphinxsearch.com/ homepage Sphinx]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== What is Sphinx? ==&lt;br /&gt;
&lt;br /&gt;
Sphinx is a free open-source SQL full-text search engine. As they put it on their site: How do you implement full-text search for that 10+ million row table, keep up with the load, and stay relevant? Sphinx is good at those kinds of riddles.&lt;br /&gt;
&lt;br /&gt;
Basically, Sphinx scans your database and builds his own indexes for blazingly-fast full-text searches.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Why? ==&lt;br /&gt;
&lt;br /&gt;
Well, we needed fast full-text searches, and what RT offers is not enough. It is slow and it causes a high load on the db server.&lt;br /&gt;
&lt;br /&gt;
I saw a reference to Sphinx on the RT users mailing list, and - after exploring a few alternatives and verifying no one had already did it - proceeded to integrate it into our RT installation.&lt;br /&gt;
&lt;br /&gt;
I am going to illustrate here all the steps we put in place to have Sphinx completely integrated in RT. The work required a couple of weeks of my spare time and that of two other colleagues.&lt;br /&gt;
&lt;br /&gt;
Unfortunately I am not able to package this as a proper extension, but I hope this docs will help those who want to do the same. Maybe someone will feel inspired enough to package it for the benefit of the community, or maybe [[User:JesseVincent|Jesse]] will decide to integrate it into RT out of the box. Who knows?&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== First: setting up Sphinx ==&lt;br /&gt;
&lt;br /&gt;
==== Intro ====&lt;br /&gt;
&lt;br /&gt;
First of all, you have to go to the [http://sphinxsearch.com/ Sphinx homepage], download and compile the sources. Or you can choose among the provided binary packages.&lt;br /&gt;
&lt;br /&gt;
We decided to go with version 1.10-beta, the most recent at the time of our installation.&lt;br /&gt;
&lt;br /&gt;
At this point you have to decide if you want to use &#039;&#039;&#039;real-time indexes&#039;&#039;&#039; or the more traditional &#039;&#039;&#039;full+delta&#039;&#039;&#039; approach to indexes.&lt;br /&gt;
&lt;br /&gt;
I will describe here briefly the meaning of these two options; if you want more infos please refer to the Sphinx homepage.&lt;br /&gt;
&lt;br /&gt;
Real-time indexes (on the Sphinx site they call them RT-indexes... quite confusing, uh?) are a clever way to have your indexes always updated, up to the millisecond. They are however still in beta (as of 1.10-beta) and they are more complex to set up and update. We wanted a quick solution, so we chose the traditional way.&lt;br /&gt;
&lt;br /&gt;
The traditional way consists of having two indexes: one &#039;&#039;&#039;big&#039;&#039;&#039; index comprising all tickets up to a certain date (or to a certain ID), and a small &#039;&#039;&#039;delta&#039;&#039;&#039; index for the rest of the tickets. You can use only one big index, but it will take a few minutes to build it so you cannot refresh it too frequently. If you use the full+delta approach you can build the big index e.g. once a day and the delta index once every few minutes.&lt;br /&gt;
&lt;br /&gt;
Presently we have about 15 thousand tickets in our RT db; we build the full index every morning, indexing everything up to the first day of the current month: it takes about 8 minutes. The delta index (from start of month to now) is built every 5 minutes and it takes about a couple seconds.&lt;br /&gt;
&lt;br /&gt;
At this point I should probably say that we are running RT on two solaris servers: one for the presentation and one for the DB. Sphinx runs on the DB side.&lt;br /&gt;
&lt;br /&gt;
==== Sphinx setup ====&lt;br /&gt;
&lt;br /&gt;
First thing to do is to tell Sphinx where your database is, what kind of database engine you use and how to scan your data.&lt;br /&gt;
&lt;br /&gt;
You tell Sphinx all these things in the file sphinx.conf (we have it in /usr/local/etc). Here is our sphinx.conf:&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;pre&amp;gt;&lt;br /&gt;
   #&lt;br /&gt;
   # Sphinx configuration&lt;br /&gt;
   #&lt;br /&gt;
   &lt;br /&gt;
   source rt3&lt;br /&gt;
   {&lt;br /&gt;
   	type			= mysql&lt;br /&gt;
   &lt;br /&gt;
   	sql_host		= localhost&lt;br /&gt;
   	sql_user		= AMENDED&lt;br /&gt;
   	sql_pass		= AMENDED&lt;br /&gt;
   	sql_db			= rt3&lt;br /&gt;
   	sql_port		= 3306	# optional, default is 3306&lt;br /&gt;
   &lt;br /&gt;
   	sql_query		= \&lt;br /&gt;
   		select TK.id as TicketNum, \&lt;br /&gt;
   			TK.Creator as CreatedBy, \&lt;br /&gt;
   			TK.Queue as Queue, \&lt;br /&gt;
   			unix_timestamp(convert_tz(TK.Created,&#039;GMT&#039;,&#039;Europe/Rome&#039;)) as Created, \&lt;br /&gt;
   			TK.Subject as Subject, \&lt;br /&gt;
   			group_concat(cast(A.Content as char)) as Content \&lt;br /&gt;
   		from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
   		where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
   		and A.TransactionId = T.id \&lt;br /&gt;
   		and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
   		and A.ContentType = &#039;text/plain&#039; \&lt;br /&gt;
   		and A.Content is not null \&lt;br /&gt;
   		and TK.Created &amp;amp;lt; concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) \&lt;br /&gt;
   		group by TK.id \&lt;br /&gt;
   		order by TK.id, T.id&lt;br /&gt;
   &lt;br /&gt;
   	sql_attr_uint		= Created&lt;br /&gt;
   	sql_attr_uint		= Queue&lt;br /&gt;
   	sql_attr_uint		= CreatedBy&lt;br /&gt;
   &lt;br /&gt;
   	sql_query_info		= SELECT * FROM Tickets WHERE id=$id&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   source rt3delta : rt3&lt;br /&gt;
   {&lt;br /&gt;
   	sql_query		= \&lt;br /&gt;
   		select TK.id as TicketNum, \&lt;br /&gt;
   			TK.Creator as CreatedBy, \&lt;br /&gt;
   			TK.Queue as Queue, \&lt;br /&gt;
   			unix_timestamp(convert_tz(TK.Created,&#039;GMT&#039;,&#039;Europe/Rome&#039;)) as Created, \&lt;br /&gt;
   			TK.Subject as Subject, \&lt;br /&gt;
   			group_concat(cast(A.Content as char)) as Content \&lt;br /&gt;
   		from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
   		where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
   		and A.TransactionId = T.id \&lt;br /&gt;
   		and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
   		and A.ContentType = &#039;text/plain&#039; \&lt;br /&gt;
   		and A.Content is not null \&lt;br /&gt;
   		and TK.Created between concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) and last_day(now()) \&lt;br /&gt;
   		group by TK.id \&lt;br /&gt;
   		order by TK.id, T.id&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   index fulltext1&lt;br /&gt;
   {&lt;br /&gt;
   	source			= rt3&lt;br /&gt;
   	path			= /var/data/fulltext1&lt;br /&gt;
   	docinfo			= extern&lt;br /&gt;
   	charset_type	= sbcs&lt;br /&gt;
   	min_infix_len 	= 3&lt;br /&gt;
   	enable_star     = 1&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   index fulltextdelta: fulltext1&lt;br /&gt;
   {&lt;br /&gt;
   	source			= rt3delta&lt;br /&gt;
   	path			= /var/data/fulltextdelta&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   indexer&lt;br /&gt;
   {&lt;br /&gt;
   	mem_limit		= 32M&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   searchd&lt;br /&gt;
   {&lt;br /&gt;
   	listen			= 9312&lt;br /&gt;
   	listen			= 9306:mysql41&lt;br /&gt;
   	log				= /var/log/searchd.log&lt;br /&gt;
   	query_log		= /var/log/query.log&lt;br /&gt;
   	read_timeout	= 5&lt;br /&gt;
   	max_children	= 30&lt;br /&gt;
   	pid_file		= /var/log/searchd.pid&lt;br /&gt;
   	max_matches		= 1000&lt;br /&gt;
   	seamless_rotate		= 1&lt;br /&gt;
   	preopen_indexes		= 0&lt;br /&gt;
   	unlink_old		= 1&lt;br /&gt;
   	workers			= threads # for RT to work&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s see what we have in this configuration file.&lt;br /&gt;
&lt;br /&gt;
First we define a &#039;&#039;&#039;data source&#039;&#039;&#039;, that I have named (with lots of fantasy!) &amp;lt;code&amp;gt;rt3&amp;lt;/code&amp;gt;. A data source tells Sphinx where to get data to feed its indexes. We tell Sphinx the type of source (&amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt;), where it is (&amp;lt;code&amp;gt;localhost&amp;lt;/code&amp;gt;), and how to retrieve the data (the &amp;lt;code&amp;gt;sqlquery&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
There is one &#039;&#039;&#039;VERY&#039;&#039;&#039; important thing in this section: every column that is returned by the query is indexed for full text search, unless you declare it as an &amp;lt;u&amp;gt;attribute&amp;lt;/u&amp;gt;. Attributes cannot be searched for text, but they allow you to &#039;&#039;&#039;filter&#039;&#039;&#039; the results.&lt;br /&gt;
&lt;br /&gt;
In our configuration, we return &#039;&#039;&#039;Subject&#039;&#039;&#039; and &#039;&#039;&#039;Content&#039;&#039;&#039; as searchable fields, while the three &amp;lt;code&amp;gt;sql_attr_uint&amp;lt;/code&amp;gt; &amp;lt;u&amp;gt;attributes&amp;lt;/u&amp;gt; can be used to refine the search (i.e. filter).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;NOTE:&amp;lt;/u&amp;gt;&#039;&#039;&#039; We had previously defined the three &amp;lt;u&amp;gt;attributes&amp;lt;/u&amp;gt; according to their content (e.g. the &#039;&#039;&#039;Created&#039;&#039;&#039; attribute was defines as &amp;lt;code&amp;gt;sql_attr_timestamp&amp;lt;/code&amp;gt;), but we have discovered that this configuration would not allow us to use those attributes for filtering. It seems Sphinx can only use &amp;lt;code&amp;gt;sql_attr_uint&amp;lt;/code&amp;gt; for filtering... I don&#039;t know if it&#039;s a temporary limitation, a bug, or working as designed.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;sql_query_info&#039;&#039;&#039; has to return a hit for every $id ($id is an implicit variable, which contains the first column returned by the sql_query. It &#039;&#039;&#039;MUST&#039;&#039;&#039; be an integer.).&lt;br /&gt;
&lt;br /&gt;
We then define another data source (&amp;lt;code&amp;gt;rt3delta&amp;lt;/code&amp;gt;) which we derive from &amp;lt;code&amp;gt;rt3&amp;lt;/code&amp;gt;. Everything defined in the &amp;lt;code&amp;gt;rt3&amp;lt;/code&amp;gt; data source is inherited by &amp;lt;code&amp;gt;rt3delta&amp;lt;/code&amp;gt;, save for what we override (&amp;lt;code&amp;gt;sqlquery&amp;lt;/code&amp;gt; in this case). As you can see, the queries are very similar; only the date range is different.&lt;br /&gt;
&lt;br /&gt;
After data sources we define &#039;&#039;&#039;indexes&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
First index is &amp;lt;code&amp;gt;fulltext1&amp;lt;/code&amp;gt;. Everything should be pretty intuitive, but for the two &amp;lt;code&amp;gt;min_infix_len&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;enable_star&amp;lt;/code&amp;gt; fields. By default Sphinx only indexes full words, but it would be very nice to be able to search for partial words by using wildcard characters. So here it is: &amp;lt;code&amp;gt;min_infix_len&amp;lt;/code&amp;gt; tells Sphinx the minimum length of subwords to index, and &amp;lt;code&amp;gt;enable_star&amp;lt;/code&amp;gt; tells it that we want to be able to use star as wildcard character. This way you can search for the word &#039;&#039;&#039;minimum&#039;&#039;&#039; by using &amp;lt;code&amp;gt;min*&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;*nim*&amp;lt;/code&amp;gt;, but not by using &amp;lt;code&amp;gt;mi*&amp;lt;/code&amp;gt; (because we told Sphinx the minimum length for subwords is 3 chars).&lt;br /&gt;
&lt;br /&gt;
The second index is &amp;lt;code&amp;gt;fulltextdelta&amp;lt;/code&amp;gt;, which is derived from &amp;lt;code&amp;gt;fulltext&amp;lt;/code&amp;gt;. As we saw above, everything is inherited but for things we explicitely override.&lt;br /&gt;
&lt;br /&gt;
At last we give some parameters for the inner working of &amp;lt;code&amp;gt;indexer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;searchd&amp;lt;/code&amp;gt;, which are two of the command line tools of Sphinx. The values shown here are good defaults.&lt;br /&gt;
&lt;br /&gt;
==== Building the indexes ====&lt;br /&gt;
&lt;br /&gt;
Now that we have a working configuration, it&#039;s time to build the indexes.&lt;br /&gt;
&lt;br /&gt;
You can initialize the indexes with the command:&lt;br /&gt;
&lt;br /&gt;
           /usr/local/bin/indexer --all&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
This will build all the indexes, and it will give you an idea of the time and disk space required for each index.&lt;br /&gt;
&lt;br /&gt;
For production use however, you want to put the commands in &amp;lt;code&amp;gt;cron&amp;lt;/code&amp;gt; so that indexes are refreshed regularly and automatically.&lt;br /&gt;
&lt;br /&gt;
We refresh the &amp;lt;code&amp;gt;fulltext1&amp;lt;/code&amp;gt; index once a day at 7 a.m., with this command:&lt;br /&gt;
&lt;br /&gt;
           /usr/local/bin/indexer --rotate fulltext1&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;code&amp;gt;--rotate&amp;lt;/code&amp;gt; allows the index to be substituted while the search daemon is running.&lt;br /&gt;
&lt;br /&gt;
We refresh the &amp;lt;code&amp;gt;fulltextdelta&amp;lt;/code&amp;gt; index every 5 minutes with this command:&lt;br /&gt;
&lt;br /&gt;
           /usr/local/bin/indexer --rotate fulltextdelta&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
==== The search daemon ====&lt;br /&gt;
&lt;br /&gt;
Once you have built the indexes you can start searching from the command line with the &amp;lt;code&amp;gt;search&amp;lt;/code&amp;gt; tool. When you are confident your setup is correct, it&#039;s time to start the search daemon.&lt;br /&gt;
&lt;br /&gt;
We do this with the command&lt;br /&gt;
&lt;br /&gt;
           /usr/local/bin/searchd --config /usr/local/etc/sphinx.conf&lt;br /&gt;
&lt;br /&gt;
In our experience &amp;lt;code&amp;gt;searchd&amp;lt;/code&amp;gt; is not very stable (probably due to the beta release): it stops responding after a couple days of uptime, so we restart it daily.&lt;br /&gt;
&lt;br /&gt;
With this last step you have Sphinx all set up and working, so the first part of this tutorial ends here. Please note that Sphinx has a &#039;&#039;&#039;lot&#039;&#039;&#039; of options, that I have not described. I only describe here the options that proved useful for us. If you want to know more about Sphinx please refer to the Sphinx home page.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Second: using the API to query Sphinx ==&lt;br /&gt;
&lt;br /&gt;
So we now have Sphinx up and running and fully populated indexes that return correct results, but now we need to be able to interrogate Sphinx&#039; indexes from RT.&lt;br /&gt;
&lt;br /&gt;
To do this you have to talk to the search daemon, which speaks his own language: the Sphinx API. There are several implementations (PHP, Java, Python and even a third-party Perl API), but since we are mostly familiar with PHP we are going to use it to implement our interface.&lt;br /&gt;
&lt;br /&gt;
Before posting the actual PHP script, there are a few things I have to point out:&lt;br /&gt;
&lt;br /&gt;
* Mason does not support PHP out of the box, so we did a little hack that I&#039;ll explain later&lt;br /&gt;
* The script you&#039;ll see here contains in-line CSS to adapt the results to the default look of RT (web2). If you&#039;re using a different style you may want to change the inline CSS accordingly.&lt;br /&gt;
* The script spits out all the results in one page: there&#039;s still no support for pagination a-la RT.&lt;br /&gt;
* The script spits out &#039;&#039;&#039;ALL&#039;&#039;&#039; the results, including deleted, rejected, merged tickets.&lt;br /&gt;
&lt;br /&gt;
You see, the script is still a little rough, but I hope we&#039;ll be able to refine it with the help of the community.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;sphinx.php follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;amp;lt;html&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;head&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;title&amp;amp;gt;Ricerca Ticket Sphinx&amp;amp;lt;/title&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 		&amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
 			document.domain = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 		&amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 		&amp;amp;lt;style&amp;amp;gt;&lt;br /&gt;
 			body {font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}&lt;br /&gt;
 			table {font-size:inherit;font:100%;}&lt;br /&gt;
 			pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}&lt;br /&gt;
 &lt;br /&gt;
 			a {&lt;br /&gt;
 				color: #000;&lt;br /&gt;
 				text-decoration: none;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			div#body a:visited {&lt;br /&gt;
 				color: #666;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			/* background: #547CCC ; */&lt;br /&gt;
 			body {&lt;br /&gt;
 				padding:0;&lt;br /&gt;
 				margin:0;&lt;br /&gt;
 &lt;br /&gt;
 				background: #FFFFFF ;&lt;br /&gt;
 				font-family: arial, helvetica, sans-serif;&lt;br /&gt;
 &lt;br /&gt;
 				color: #000000;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list, table.queue-summary, table.collection {&lt;br /&gt;
 				margin-top: 0.75em;&lt;br /&gt;
 				font-size: 0.9em;&lt;br /&gt;
 				border: 1px solid #aaa;&lt;br /&gt;
 				border-bottom: 2px solid #999;&lt;br /&gt;
 				border-right: 2px solid #999;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary tr&amp;amp;gt;*:first-child {&lt;br /&gt;
 				padding-left: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary tr&amp;amp;gt;*:last-child {&lt;br /&gt;
 				padding-right: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list a, table.queue-summary a, table.collection a  {&lt;br /&gt;
 				font-weight: bold;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list th.collection-as-table, table.collection th.collection-as-table {&lt;br /&gt;
 				background: #ddd;&lt;br /&gt;
 				font-size: 0.9em;&lt;br /&gt;
 				margin-bottom: 0.5em;&lt;br /&gt;
 				text-align: left;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary th.collection-as-table {&lt;br /&gt;
 				font-size: 0.9em;&lt;br /&gt;
 				margin-bottom: 0.5em;&lt;br /&gt;
 				text-align: right;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary th.collection-as-table:first-child {&lt;br /&gt;
 				text-align: left;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.collection-as-table+tr.collection-as-table th {&lt;br /&gt;
 				border-bottom: 2px solid grey;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary td {&lt;br /&gt;
 				background: #efefef;&lt;br /&gt;
 				border-bottom: 1px solid #ccc;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.evenline td {&lt;br /&gt;
 				background: #eee;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.oddline td {&lt;br /&gt;
 				background: #fff;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.evenline td, tr.oddline td {&lt;br /&gt;
 				padding-top: 0.5em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.evenline+tr.evenline td, tr.oddline+tr.oddline td{&lt;br /&gt;
 				padding-top: 0;&lt;br /&gt;
 				border: none;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list td:first-child, table.ticket-list th:first-child {&lt;br /&gt;
 				padding-left: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list td:last-child, table.ticket-list th:last-child {&lt;br /&gt;
 				padding-right: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			th.collection-as-table , td.collection-as-table {&lt;br /&gt;
 				padding-right: 0.5em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			.pagenum.a:hover, .paging a.nav:hover{&lt;br /&gt;
 				text-decoration: underline;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			.pagenum *, .paging a.nav{&lt;br /&gt;
 				padding: .5em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			.currentpage{&lt;br /&gt;
 				text-decoration: none;&lt;br /&gt;
 				font-weight: bold;&lt;br /&gt;
 				background: #eee;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			div.paging{&lt;br /&gt;
 				text-align: center;&lt;br /&gt;
 				padding-bottom: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			#body&amp;amp;gt;table.ticket-list {&lt;br /&gt;
 				margin-bottom: 2em;&lt;br /&gt;
 			}&lt;br /&gt;
 		&amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;/head&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;body&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;?php&lt;br /&gt;
 		//Costante con il max numero di righe ritornate da Sphinx&lt;br /&gt;
 		define(&#039;SPHINX_MAX_LIMIT&#039;, 1000);&lt;br /&gt;
 &lt;br /&gt;
 		require_once(&amp;quot;Classi/sphinxapi.php&amp;quot;);&lt;br /&gt;
 		require_once(&amp;quot;Classi/Timer.class.php&amp;quot;);&lt;br /&gt;
 		require_once(&amp;quot;Classi/MySql.class.php&amp;quot;);&lt;br /&gt;
 		include_once(&amp;quot;Include/Query.inc.php&amp;quot;);&lt;br /&gt;
 		include_once(&amp;quot;Include/dvopendb.config.inc.php&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 		$MyTimer =  new Timer();&lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Parametri di connessione al Daemon Sphinx&lt;br /&gt;
 		$host = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 		$port = 9312;&lt;br /&gt;
 		$index = &amp;quot;*&amp;quot;; // put your index name here&lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Variabili in GET&lt;br /&gt;
 		$query = $_GET[&#039;Text&#039;];&lt;br /&gt;
 		$RequestorFilter = trim($_GET[&#039;Requestor&#039;]);&lt;br /&gt;
 		$CodaFilter = $_GET[&#039;Queue&#039;];&lt;br /&gt;
 		$DataInizioFilter = trim($_GET[&#039;From&#039;]);&lt;br /&gt;
 		$DataFineFilter = trim($_GET[&#039;To&#039;]);&lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Connessione al Daemon Sphinx&lt;br /&gt;
 		$cl = new SphinxClient();&lt;br /&gt;
 		$cl-&amp;amp;gt;SetServer($host, $port);&lt;br /&gt;
 		$cl-&amp;amp;gt;SetMatchMode(SPH_MATCH_EXTENDED2);&lt;br /&gt;
 		$cl-&amp;amp;gt;SetLimits(0,SPHINX_MAX_LIMIT, $max_matches=0, $cutoff=0 );&lt;br /&gt;
 &lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//MySql Database Query per la retrive dei dati del ticket&lt;br /&gt;
 &lt;br /&gt;
 		$SqlQuery = new MySql($DbHostName,$DbUser,$DbPassword,$DbName);&lt;br /&gt;
 		$SqlQuery-&amp;amp;gt;Connetti();&lt;br /&gt;
 &lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Filtri sulla ricerca Sphinx&lt;br /&gt;
 &lt;br /&gt;
 		//Check della query (parametro di ricerca)&lt;br /&gt;
 		if(strlen($query)==0)&lt;br /&gt;
 		{&lt;br /&gt;
 			echo &amp;quot;E&#039; necessario inserire un parametro di ricerca nella casella \&amp;quot;Text\&amp;quot; per proseguire.&amp;quot;;&lt;br /&gt;
 			exit(1);&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Filtro Requestor&lt;br /&gt;
 		if(strlen($RequestorFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			$TempQuery = sprintf($RequestorLookUpQuery,mysql_real_escape_string($RequestorFilter));&lt;br /&gt;
 			$SqlQuery-&amp;amp;gt;ExecQuery($TempQuery);&lt;br /&gt;
 			$RequestorResult = $SqlQuery-&amp;amp;gt;GetMonoArrayResult();&lt;br /&gt;
 			if(count($RequestorResult)&amp;amp;gt;0)&lt;br /&gt;
 			{&lt;br /&gt;
 				$cl-&amp;amp;gt;SetFilter (&amp;quot;createdby&amp;quot;,array($RequestorResult[&#039;id&#039;]) , $exclude=false );&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;&amp;amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;amp;gt;Warning - L&#039;indirizzo \&amp;quot;&amp;quot;.$RequestorFilter.&amp;quot;\&amp;quot; non e&#039; presente nel Database; La ricerca e&#039; stata effettuata per tutti i richiedenti&amp;amp;lt;/label&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 			}&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Filtro Queue&lt;br /&gt;
 		if(strlen($CodaFilter)&amp;amp;gt;0)&lt;br /&gt;
 			$cl-&amp;amp;gt;SetFilter (&amp;quot;queue&amp;quot;, array($CodaFilter), $exclude=false );&lt;br /&gt;
 &lt;br /&gt;
 		//Filtro Data&lt;br /&gt;
 &lt;br /&gt;
 		//__________________________________________________________________________________________________________________&lt;br /&gt;
 		//Check delle date&lt;br /&gt;
 		if(strlen($DataInizioFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			//Check Datainizio&lt;br /&gt;
 			if(checkdate(substr($DataInizioFilter,5,2),substr($DataInizioFilter,8,2),substr($DataInizioFilter,0,4))==false)&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;Data Inizio &amp;quot;.$DataInizioFilter.&amp;quot; non corretta &amp;quot;;&lt;br /&gt;
 				exit(1);&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 				 $DataInizio = mktime(0, 0, 0, substr($DataInizioFilter,5,2), substr($DataInizioFilter,8,2), substr($DataInizioFilter,0,4));&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if(strlen($DataFineFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{	//Check DataFine&lt;br /&gt;
 &lt;br /&gt;
 			if(checkdate(substr($DataFineFilter,5,2),substr($DataFineFilter,8,2),substr($DataFineFilter,0,4))==false)&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;Data Fine &amp;quot;.$DataFineFilter.&amp;quot; non corretta &amp;quot;;&lt;br /&gt;
 				exit(1);&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 				$DataFine = mktime(0, 0, 0, substr($DataFineFilter,5,2), substr($DataFineFilter,8,2), substr($DataFineFilter,0,4));&lt;br /&gt;
 		}&lt;br /&gt;
 		//__________________________________________________________________________________________________________________&lt;br /&gt;
 &lt;br /&gt;
 		//Filtraggio vero e proprio&lt;br /&gt;
 &lt;br /&gt;
 		//Se sono settate entrambe...&lt;br /&gt;
 		if(strlen($DataInizioFilter)&amp;amp;gt;0 &amp;amp;amp;&amp;amp;amp; strlen($DataFineFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			if($DataInizio &amp;amp;lt; $DataFine)&lt;br /&gt;
 			{&lt;br /&gt;
 				//Se sono settate entrambe le date filtro per entrambe&lt;br /&gt;
 				$cl-&amp;amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, $DataFine, $exclude=false );&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;La data Inizio &amp;quot;.$DataInizioFilter.&amp;quot; e&#039; maggiore della data di fine &amp;quot;.$DataFineFilter;&lt;br /&gt;
 				exit(1);&lt;br /&gt;
 			}&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Se solo DataInizio..&lt;br /&gt;
 		if(strlen($DataInizioFilter)&amp;amp;gt;0 &amp;amp;amp;&amp;amp;amp; strlen($DataFineFilter)==0)&lt;br /&gt;
 		{&lt;br /&gt;
 			$cl-&amp;amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, mktime(), $exclude=false );&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Se solo DataFine..&lt;br /&gt;
 		if(strlen($DataInizioFilter)==0 &amp;amp;amp;&amp;amp;amp; strlen($DataFineFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			//2008-11-14 : Data del primo Ticket di RT&lt;br /&gt;
 			//1988-07-18 : Data di nascita di AMENDED :)&lt;br /&gt;
 			$cl-&amp;amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, mktime(0, 0, 0,07,18,1988), $DataFine, $exclude=false );&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Eseguo la Query su Sphinx&lt;br /&gt;
 &lt;br /&gt;
 		$res = $cl-&amp;amp;gt;Query($query, $index);&lt;br /&gt;
 		if ($res == false)&lt;br /&gt;
 		{&lt;br /&gt;
 			echo &amp;quot;failure: &amp;quot;.$cl-&amp;amp;gt;GetLastError().&amp;quot;\n&amp;quot;;&lt;br /&gt;
 		}&lt;br /&gt;
 		else&lt;br /&gt;
 		{&lt;br /&gt;
 			if(count($res[&amp;quot;matches&amp;quot;])!=0)&lt;br /&gt;
 			{&lt;br /&gt;
 				//Se i risultati totali sono &amp;amp;gt; 1000&lt;br /&gt;
 				if($res[total_found]&amp;amp;gt;SPHINX_MAX_LIMIT)&lt;br /&gt;
 				{&lt;br /&gt;
 					echo &amp;quot;&amp;amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;amp;gt;Warning - Sono stati trovati &amp;quot;.$res[total_found].&amp;quot; risultati, verrano visualizzati solo i primi &amp;quot;.SPHINX_MAX_LIMIT.&amp;quot;&amp;amp;lt;/label&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 				}&lt;br /&gt;
 &lt;br /&gt;
 				//Se ci sono dei risultati creo la tabella e stampo&lt;br /&gt;
 				echo &amp;quot;&amp;amp;lt;table id=&#039;ResultTable&#039; class=&#039;ticket-list&#039; border=&#039;0&#039; cellspacing=&#039;0&#039; cellpadding=&#039;1&#039; width=&#039;100%&#039;&amp;amp;gt;&lt;br /&gt;
 						&amp;amp;lt;thead&amp;amp;gt;&lt;br /&gt;
 						&amp;amp;lt;tr class=&#039;collection-as-table&#039;&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;#&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Oggetto&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Coda&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Status&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Creato&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Richiedente&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Proprietario&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 						&amp;amp;lt;/tr&amp;amp;gt;&lt;br /&gt;
 						&amp;lt;/thead&amp;gt;&amp;lt;tbody&amp;gt;&amp;quot;;&lt;br /&gt;
 				foreach ($res[&amp;quot;matches&amp;quot;] as $key=&amp;amp;gt;$value)&lt;br /&gt;
 				{&lt;br /&gt;
 					$i++;&lt;br /&gt;
 					$TempQuery = sprintf($TicketDetailQuery,mysql_real_escape_string($key));&lt;br /&gt;
 					$SqlQuery-&amp;amp;gt;ExecQuery($TempQuery);&lt;br /&gt;
 					$Risultato = $SqlQuery-&amp;amp;gt;GetMonoArrayResult();&lt;br /&gt;
 					if($i%2==0)&lt;br /&gt;
 					{&lt;br /&gt;
 						echo &amp;quot;	&amp;amp;lt;tr class=&#039;evenline&#039;&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 								&amp;amp;lt;/tr&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 					}&lt;br /&gt;
 					else&lt;br /&gt;
 					{&lt;br /&gt;
 						echo &amp;quot;	&amp;amp;lt;tr class=&#039;oddline&#039;&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 								&amp;amp;lt;/tr&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 					}&lt;br /&gt;
 				}&lt;br /&gt;
 				echo &amp;quot;	&amp;lt;/tbody&amp;gt;&lt;br /&gt;
 					&amp;lt;tfoot&amp;gt;&amp;lt;/tfoot&amp;gt;&lt;br /&gt;
 					&amp;lt;/table&amp;gt;&amp;quot;;&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 			{&lt;br /&gt;
 				//...Altrimenti stampo che non ho trovato nulla&lt;br /&gt;
 				echo &amp;quot;&amp;amp;lt;br/&amp;amp;gt;&amp;amp;lt;label class=\&amp;quot;notfoundlabel\&amp;quot;&amp;amp;gt;Nessun risultato trovato&amp;amp;lt;/label&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			echo &amp;quot;Trovati &amp;quot;.$res[total].&amp;quot; di &amp;quot;.$res[total_found].&amp;quot; in &amp;quot;.$MyTimer-&amp;amp;gt;elapsed().&amp;quot; secondi&amp;quot;;&lt;br /&gt;
 		}&lt;br /&gt;
 		?&amp;amp;gt;&lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;dvopendb.config.inc.php follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;amp;lt;?php&lt;br /&gt;
  $DbHostName = &amp;quot;HOSTNAME_AMENDED:3306/rt3&amp;quot;;&lt;br /&gt;
  $DbUser = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
  $DbPassword = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
  $DbName = &amp;quot;rt3&amp;quot;;&lt;br /&gt;
  $DbQuery = &amp;quot;select EmailAddress, RealName from Users&amp;quot;;&lt;br /&gt;
  ?&amp;amp;gt;&lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;Query.inc.php follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;amp;lt;?php&lt;br /&gt;
  $TicketDetailQuery =&lt;br /&gt;
  &amp;quot;select Tickets.id,Subject,Status,Tickets.Created as Created,U1.Name as Requestor,U2.Name as Owner,Queues.Name as Queue&lt;br /&gt;
  from Tickets left outer join Users U1&lt;br /&gt;
  on U1.id = Tickets.Creator&lt;br /&gt;
  left outer join  Users U2&lt;br /&gt;
  on U2.id = Tickets.Owner&lt;br /&gt;
  left outer join Queues&lt;br /&gt;
  on  Queue = Queues.id&lt;br /&gt;
  where Tickets.id = %s&lt;br /&gt;
  &amp;quot;;&lt;br /&gt;
  &lt;br /&gt;
  $RequestorLookUpQuery =&lt;br /&gt;
  &amp;quot;select id&lt;br /&gt;
  from Users&lt;br /&gt;
  where EmailAddress = &#039;%s&#039;&lt;br /&gt;
  &amp;quot;;&lt;br /&gt;
  ?&amp;amp;gt;&lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This ends the step regarding the use of the Sphinx API to query the &amp;lt;code&amp;gt;searchd&amp;lt;/code&amp;gt; daemon.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Third: integrating it all into RT ==&lt;br /&gt;
&lt;br /&gt;
Now we need a way to call the php script from within RT. Well, technically we don&#039;t &#039;&#039;&#039;need&#039;&#039;&#039; it, but it would be very nice to have.&lt;br /&gt;
&lt;br /&gt;
For this task I found very useful the [[WritingPortlets]] section of this wiki, written by Andy D&#039;Arcy Jewell (thank you!)&lt;br /&gt;
&lt;br /&gt;
So the first thing I did was writing a portlet that one can integrate in the &amp;quot;RT at a glance&amp;quot; page.&lt;br /&gt;
&lt;br /&gt;
I put it in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/Elements. The portlet itself is in a file called SphinxSearch.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;SphinxSearch follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&amp;lt;&amp;amp;|/Widgets/TitleBox, title =&amp;gt; loc(&#039;Fulltext Search (Sphinx)&#039;), bodyclass =&amp;gt; &amp;quot;&amp;quot;,&lt;br /&gt;
     titleright =&amp;gt; loc(&#039;HELP&#039;), titleright_href =&amp;gt; RT-&amp;gt;Config-&amp;gt;Get(&#039;WebPath&#039;).&#039;/Prefs/SphinxHelp.html&#039;&amp;amp;&amp;gt;&lt;br /&gt;
  	&amp;lt;form name=&amp;quot;input&amp;quot; action=&amp;quot;/Tools/sphinx.html&amp;quot; method=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt;
  		&amp;lt;table&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Text&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;input type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;Text&amp;quot; /&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Queue&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;&amp;amp; /Elements/SelectQueue, Name =&amp;gt; &#039;Queue&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Requestor&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;&amp;amp; /Elements/EmailInput, Name =&amp;gt; &#039;Requestor&#039;, Size =&amp;gt; &#039;40&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;From&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;&amp;amp; /Elements/SelectDate, Name =&amp;gt; &amp;quot;From&amp;quot; || &#039;&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;To&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;&amp;amp; /Elements/SelectDate, Name =&amp;gt; &amp;quot;To&amp;quot; || &#039;&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  		&amp;lt;/table&amp;gt;&lt;br /&gt;
  		&amp;lt;div class=&amp;quot;submit&amp;quot;&amp;gt;&lt;br /&gt;
  			&amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;input class=&amp;quot;button&amp;quot; type=&amp;quot;submit&amp;quot; value=&amp;quot;Submit&amp;quot; /&amp;gt;&lt;br /&gt;
  			&amp;lt;/div&amp;gt;&lt;br /&gt;
  		&amp;lt;/div&amp;gt;&lt;br /&gt;
  	&amp;lt;/form&amp;gt;&lt;br /&gt;
  &amp;lt;/&amp;amp;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the result:&lt;br /&gt;
&lt;br /&gt;
[[File:Rt3p.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to keep the look and feel of RT by copying code from the other portlets. I even used RT syntax to allow the localization of string, but not everything gets translated since not all the terms are in RT resource files.&lt;br /&gt;
&lt;br /&gt;
Since Sphinx&#039; extended search syntax can be very elaborated, I put a HELP link in the upper right corner (circled in red in the image above). This points to a page that I extracted from Sphinx&#039; documentation. The page is in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/Prefs. The file is called SphinxHelp.html.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;SphinxHelp.html follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;amp;lt;&amp;amp;amp; /Elements/Header, Title =&amp;amp;gt; &amp;quot;Sphinx - Free open-source SQL full-text search engine&amp;quot; &amp;amp;amp;&amp;amp;gt;&lt;br /&gt;
 &amp;amp;lt;&amp;amp;amp; /Elements/Tabs,&lt;br /&gt;
 	Title =&amp;amp;gt; &amp;quot;Help for Sphinx search syntax&amp;quot;,&lt;br /&gt;
 	current_tab    =&amp;amp;gt; &#039;index.html&#039;,&lt;br /&gt;
 	current_toptab =&amp;amp;gt; &#039;index.html&#039;,&lt;br /&gt;
 	tabs           =&amp;amp;gt; $tabs,&lt;br /&gt;
 	actions        =&amp;amp;gt; $actions,&lt;br /&gt;
 &amp;amp;amp;&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;div align=&amp;quot;left&amp;quot; class=&amp;quot;refresh&amp;quot;&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
 			&amp;amp;lt;h2 style=&amp;quot;clear: both&amp;quot;&amp;amp;gt;&amp;amp;lt;a name=&amp;quot;extended-syntax&amp;quot;&amp;amp;gt;&amp;amp;lt;/a&amp;amp;gt;Extended query syntax&amp;amp;lt;/h2&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	The following special operators and modifiers can be used when using the extended matching mode:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
 			&amp;amp;lt;ul type=&amp;quot;disc&amp;quot;&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;operator OR: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;hello | world&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;operator NOT:&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 hello -world&lt;br /&gt;
 hello !world&amp;amp;lt;/pre&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;field search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@title hello @body world&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;field position limit modifier (introduced in version 0.9.9-rc1): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@body[50] hello&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;multiple-field search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@(title,body) hello world&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;all-field search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@* hello&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;phrase search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&amp;quot;hello world&amp;quot;&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;proximity search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&amp;quot;hello world&amp;quot;~10&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;quorum matching operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&amp;quot;the world is a wonderful place&amp;quot;/3&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;strict order operator (aka operator &amp;quot;before&amp;quot;): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;aaa &amp;amp;amp;lt;&amp;amp;amp;lt; bbb &amp;amp;amp;lt;&amp;amp;amp;lt; ccc&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;exact form modifier (introduced in version 0.9.9-rc1): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;raining =cats and =dogs&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;field-start and field-end modifier (introduced in version 0.9.9-rc2): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;^hello world$&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 			&amp;amp;lt;/ul&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	Here&#039;s an example query that uses some of these operators:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;div class=&amp;quot;example&amp;quot;&amp;amp;gt;&amp;amp;lt;a name=&amp;quot;ex-extended-query&amp;quot;&amp;amp;gt;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;p class=&amp;quot;title&amp;quot;&amp;amp;gt;&amp;amp;lt;b&amp;amp;gt;Example:&amp;amp;amp;nbsp;Extended matching mode: query example&amp;amp;lt;/b&amp;amp;gt;&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;div class=&amp;quot;example-contents&amp;quot;&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	&amp;quot;hello world&amp;quot; @title &amp;quot;example program&amp;quot;~5 @body python -(php|perl) @* code&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&amp;amp;lt;br class=&amp;quot;example-break&amp;quot;&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	The full meaning of this search is:&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;div class=&amp;quot;itemizedlist&amp;quot;&amp;amp;gt;&amp;amp;lt;ul type=&amp;quot;disc&amp;quot;&amp;amp;gt;&amp;amp;lt;li&amp;amp;gt;Find the words &#039;hello&#039; and &#039;world&#039; adjacently in any field in a document;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;li&amp;amp;gt;Additionally, the same document must also contain the words &#039;example&#039; and &#039;program&#039;&lt;br /&gt;
 		in the title field, with up to, but not including, 10 words between the words in question;&lt;br /&gt;
 		(E.g. &amp;quot;example PHP program&amp;quot; would be matched however &amp;quot;example script to introduce outside data&lt;br /&gt;
 		into the correct context for your program&amp;quot; would not because two terms have 10 or more words between them)&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;li&amp;amp;gt;Additionally, the same document must contain the word &#039;python&#039; in the body field, but not contain either &#039;php&#039; or &#039;perl&#039;;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;li&amp;amp;gt;Additionally, the same document must contain the word &#039;code&#039; in any field.&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/ul&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	There always is implicit AND operator, so &amp;quot;hello world&amp;quot; means that&lt;br /&gt;
 	both &amp;quot;hello&amp;quot; and &amp;quot;world&amp;quot; must be present in matching document.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	OR operator precedence is higher than AND, so &amp;quot;looking for cat | dog | mouse&amp;quot;&lt;br /&gt;
 	means &amp;quot;looking for ( cat | dog | mouse )&amp;quot; and &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;not&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;quot;(looking for cat) | dog | mouse&amp;quot;.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Field limit operator limits subsequent searching to a given field.&lt;br /&gt;
 	Normally, query will fail with an error message if given field name does not exist&lt;br /&gt;
 	in the searched index. However, that can be suppressed by specifying &amp;quot;@@relaxed&amp;quot;&lt;br /&gt;
 	option at the very beginning of the query:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	@@relaxed @nosuchfield my query&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	This can be helpful when searching through heterogeneous indexes with&lt;br /&gt;
 	different schemas.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Field position limit, introduced in version 0.9.9-rc1, additionaly restricts the searching&lt;br /&gt;
 	to first N position within given field (or fields). For example, &amp;quot;@body[50] hello&amp;quot; will&lt;br /&gt;
 	&amp;amp;lt;span class=&amp;quot;bold&amp;quot;&amp;amp;gt;&amp;amp;lt;strong&amp;amp;gt;not&amp;amp;lt;/strong&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt; match the documents where the keyword &#039;hello&#039; occurs at position 51 and below&lt;br /&gt;
 	in the body.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Proximity distance is specified in words, adjusted for word count, and&lt;br /&gt;
 	applies to all words within quotes. For instance, &amp;quot;cat dog mouse&amp;quot;~5 query&lt;br /&gt;
 	means that there must be less than 8-word span which contains all 3 words,&lt;br /&gt;
 	ie. &amp;quot;CAT aaa bbb ccc DOG eee fff MOUSE&amp;quot; document will &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;not&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;&lt;br /&gt;
 	match this query, because this span is exactly 8 words long.&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Quorum matching operator introduces a kind of fuzzy matching.&lt;br /&gt;
 	It will only match those documents that pass a given threshold of given words.&lt;br /&gt;
 	The example above (&amp;quot;the world is a wonderful place&amp;quot;/3) will match all documents&lt;br /&gt;
 	that have at least 3 of the 6 specified words.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Strict order operator (aka operator &amp;quot;before&amp;quot;), introduced in version 0.9.9-rc2,&lt;br /&gt;
 	will match the document only if its argument keywords occur in the document&lt;br /&gt;
 	exactly in the query order. For instance, &amp;quot;black &amp;amp;amp;lt;&amp;amp;amp;lt; cat&amp;quot; query (without&lt;br /&gt;
 	quotes) will match the document &amp;quot;black and white cat&amp;quot; but &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;not&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;&lt;br /&gt;
 	the &amp;quot;that cat was black&amp;quot; document. Order operator has the lowest priority.&lt;br /&gt;
 	It can be applied both to just keywords and more complex expressions,&lt;br /&gt;
 	ie. this is a valid query:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	(bag of words) &amp;amp;amp;lt;&amp;amp;amp;lt; &amp;quot;exact phrase&amp;quot; &amp;amp;amp;lt;&amp;amp;amp;lt; red|green|blue&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	Exact form keyword modifier, introduced in version 0.9.9-rc1, will match the document only if the keyword occurred&lt;br /&gt;
 	in exactly the specified form. The default behaviour is to match the document&lt;br /&gt;
 	if the stemmed keyword matches. For instance, &amp;quot;runs&amp;quot; query will match both&lt;br /&gt;
 	the document that contains &amp;quot;runs&amp;quot; &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;and&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt; the document that&lt;br /&gt;
 	contains &amp;quot;running&amp;quot;, because both forms stem to just &amp;quot;run&amp;quot; - while &amp;quot;=runs&amp;quot;&lt;br /&gt;
 	query will only match the first document. Exact form operator requires&lt;br /&gt;
 	&amp;amp;lt;a href=&amp;quot;#conf-index-exact-words&amp;quot; title=&amp;quot;11.2.39.&amp;amp;amp;nbsp;index_exact_words&amp;quot;&amp;amp;gt;index_exact_words&amp;amp;lt;/a&amp;amp;gt; option to be enabled.&lt;br /&gt;
 	This is a modifier that affects the keyword and thus can be used within&lt;br /&gt;
 	operators such as phrase, proximity, and quorum operators.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Field-start and field-end keyword modifiers, introduced in version 0.9.9-rc2,&lt;br /&gt;
 	will make the keyword match only if it occurred at the very start or the very end&lt;br /&gt;
 	of a fulltext field, respectively. For instance, the query &amp;quot;^hello world$&amp;quot;&lt;br /&gt;
 	(with quotes and thus combining phrase operator and start/end modifiers)&lt;br /&gt;
 	will only match documents that contain at least one field that has exactly&lt;br /&gt;
 	these two keywords.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Starting with 0.9.9-rc1, arbitrarily nested brackets and negations are allowed.&lt;br /&gt;
 	However, the query must be possible to compute without involving an implicit&lt;br /&gt;
 	list of all documents:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	// correct query&lt;br /&gt;
 	aaa -(bbb -(ccc ddd))&lt;br /&gt;
 &lt;br /&gt;
 	// queries that are non-computable&lt;br /&gt;
 	-aaa&lt;br /&gt;
 	aaa | -bbb&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;div align=&amp;quot;right&amp;quot; class=&amp;quot;search-result-actions&amp;quot;&amp;amp;gt;&lt;br /&gt;
 &amp;amp;amp;nbsp;&lt;br /&gt;
 &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;%init&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 my @results;&lt;br /&gt;
 my $skip_create = 1;&lt;br /&gt;
 my $actions;&lt;br /&gt;
 my $tabs = $m-&amp;amp;gt;comp(&amp;quot;/Elements/DashboardTabs&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;/%init&amp;amp;gt;&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last part is about passing the form&#039;s (portlet) parameters to the PHP script.&lt;br /&gt;
&lt;br /&gt;
As I told you before, the problem here is that Mason does not support PHP out of the box. I found a few hacks around the web to make Mason support PHP, but they were either not applicable to our environment or too difficult to apply.&lt;br /&gt;
&lt;br /&gt;
So we implemented another hack: since we already have another virtual domain where PHP works, we created an html page that embeds (within an iframe) the results from the PHP page that resides in the other virtual domain.&lt;br /&gt;
&lt;br /&gt;
That&#039;s why you see this little piece of code&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
     document.domain = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in the PHP script above: you have to declare that both the HTML page and the PHP script belong to the same domain (although on different subdomains), otherwise you get a security error in the browser.&lt;br /&gt;
&lt;br /&gt;
The html page is located in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/Tools and the file is called sphinx.html.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;sphinx.html follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&amp;lt;&amp;amp; /Elements/Header, Title =&amp;gt; &amp;quot;Search results&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
  &amp;lt;&amp;amp; /Elements/Tabs,&lt;br /&gt;
  	Title =&amp;gt; &amp;quot;Search results&amp;quot;,&lt;br /&gt;
  	current_tab    =&amp;gt; &#039;index.html&#039;,&lt;br /&gt;
  	current_toptab =&amp;gt; &#039;index.html&#039;,&lt;br /&gt;
  	tabs           =&amp;gt; $tabs,&lt;br /&gt;
  	actions        =&amp;gt; $actions,&lt;br /&gt;
  &amp;amp;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;div align=&amp;quot;left&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;table width=95% border=0&amp;gt;&lt;br /&gt;
  	&amp;lt;tr&amp;gt;&lt;br /&gt;
  		&amp;lt;td&amp;gt;&lt;br /&gt;
  			&amp;lt;iframe id=&amp;quot;sphinxresults&amp;quot; src=&amp;quot;http://PHP_VIRTDOMAIN_AMENDED/sphinx.php?&amp;lt;% &amp;quot;Text=&amp;quot; . $Text . &amp;quot;&amp;amp;Queue=&amp;quot; . $Queue . &amp;quot;&amp;amp;Requestor=&amp;quot; . $Requestor . &amp;quot;&amp;amp;From=&amp;quot; . $From . &amp;quot;&amp;amp;To=&amp;quot; . $To %&amp;gt;&amp;quot; width=&amp;quot;95%&amp;quot; height=&amp;quot;200&amp;quot; frameborder=&amp;quot;0&amp;quot; onload=&amp;quot;resizeIframeToFitContent(this)&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;br /&gt;
  		&amp;lt;/td&amp;gt;&lt;br /&gt;
  	&amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;/table&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;div align=&amp;quot;right&amp;quot; class=&amp;quot;search-result-actions&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;amp;nbsp;&lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;%init&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  my @results;&lt;br /&gt;
  my $skip_create = 1;&lt;br /&gt;
  my $actions;&lt;br /&gt;
  my $tabs = $m-&amp;gt;comp(&amp;quot;/Elements/DashboardTabs&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/%init&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;%args&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  $Text&lt;br /&gt;
  $Queue =&amp;gt; &#039;&#039;&lt;br /&gt;
  $Requestor =&amp;gt; &#039;&#039;&lt;br /&gt;
  $From =&amp;gt; &#039;&#039;&lt;br /&gt;
  $To =&amp;gt; &#039;&#039;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/%args&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is one last piece of code that we need to put in place: it allows us to insert a little piece of custom CSS and custom Javascript in all RT page headers.&lt;br /&gt;
&lt;br /&gt;
You have to create a file called InHeader in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/NoAuth/css/web2 (web2 is the name of the default RT CSS, if you use another CSS you have to change this path). The contents of this file are shown below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;InHeader follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
 &amp;amp;lt;style&amp;amp;gt;&lt;br /&gt;
 	pre.programlisting&lt;br /&gt;
 	{&lt;br /&gt;
 		background-color:	#f0f0f0;&lt;br /&gt;
 		padding:			0.5em;&lt;br /&gt;
 		margin-left:		2em;&lt;br /&gt;
 		margin-right:		2em;&lt;br /&gt;
 	}&lt;br /&gt;
 &amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
 function resizeIframeToFitContent(iframe) {&lt;br /&gt;
 	// This function resizes an IFrame object&lt;br /&gt;
 	// to fit its content.&lt;br /&gt;
 	// The IFrame tag must have a unique ID attribute.&lt;br /&gt;
 	iframe.height = document.getElementById(iframe.id).contentWindow.document.body.scrollHeight + 50;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	document.domain = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, to add our portlet to the installable portlets in RT, you have to modify your [[RT SiteConfig|RT_SiteConfig]].pm file and add the portlet name to the $HomePageComponents variable. If you don&#039;t see the $HomePageComponents variable in your [[RT SiteConfig|RT_SiteConfig]].pm file, copy it from the [[RT Config|RT_Config]].pm file.&lt;br /&gt;
&lt;br /&gt;
Mine looks like this:&lt;br /&gt;
&lt;br /&gt;
Set($HomepageComponents, [qw(QuickCreate Quicksearch MyAdminQueues MySupportQueues MyReminders RefreshHomepage Dashboards SphinxSearch)]);&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Whew, it was long, but not difficult I hope.&lt;br /&gt;
&lt;br /&gt;
Following the instruction in this article you get an installable portlet that will allow you to easily (and &#039;&#039;&#039;quickly&#039;&#039;&#039;!) search the RT ticket database.&lt;br /&gt;
&lt;br /&gt;
Sphinx&#039; syntax allows very powerful searches and its performance is unbeatable. We find it so convenient that we&#039;ve found us often using it in place of every other search.&lt;br /&gt;
&lt;br /&gt;
We had to implement a few hacks to embed the PHP code, but that&#039;s just because we were more familiar with PHP. If you are a Perl hacker you can use the Sphinx&#039; Perl API to integrate Sphinx even better. Let&#039;s see what the community can come up with!&lt;br /&gt;
&lt;br /&gt;
I hope this was useful. If you need help, I can be reached through RT mailing lists.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-----------------&lt;br /&gt;
&lt;br /&gt;
-----------------&lt;br /&gt;
&lt;br /&gt;
Thanks to Cris for this documentation! Here are a few things we changed for our organisation : &lt;br /&gt;
&lt;br /&gt;
With the missing files included in sphinx.php, I had to change a few things so here is my spinx.php file : &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
        &amp;lt;head&amp;gt;&lt;br /&gt;
                &amp;lt;title&amp;gt;Recherche Ticket Sphinx&amp;lt;/title&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;script src=&amp;quot;Classi/sorttable.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
                &amp;lt;style&amp;gt;&lt;br /&gt;
                        body {font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}&lt;br /&gt;
                        table {font-size:inherit;font:100%;}&lt;br /&gt;
                        pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}&lt;br /&gt;
&lt;br /&gt;
                        a {&lt;br /&gt;
                                color: #000;&lt;br /&gt;
                                text-decoration: none;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        div#body a:visited {&lt;br /&gt;
                                color: #666;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        /* background: #547CCC ; */&lt;br /&gt;
                        body {&lt;br /&gt;
                                padding:0;&lt;br /&gt;
                                margin:0;&lt;br /&gt;
&lt;br /&gt;
                                background: #FFFFFF ;&lt;br /&gt;
                                font-family: arial, helvetica, sans-serif;&lt;br /&gt;
&lt;br /&gt;
                                color: #000000;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list, table.queue-summary, table.collection {&lt;br /&gt;
                                margin-top: 0.75em;&lt;br /&gt;
                                font-size: 0.9em;&lt;br /&gt;
                                border: 1px solid #aaa;&lt;br /&gt;
                                border-bottom: 2px solid #999;&lt;br /&gt;
                                border-right: 2px solid #999;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary tr&amp;gt;*:first-child {&lt;br /&gt;
                                padding-left: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary tr&amp;gt;*:last-child {&lt;br /&gt;
                                padding-right: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list a, table.queue-summary a, table.collection a  {&lt;br /&gt;
                                font-weight: bold;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list th.collection-as-table, table.collection th.collection-as-table {&lt;br /&gt;
                                background: #ddd;&lt;br /&gt;
                                font-size: 0.9em;&lt;br /&gt;
                                margin-bottom: 0.5em;&lt;br /&gt;
                                text-align: left;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary th.collection-as-table {&lt;br /&gt;
                                font-size: 0.9em;&lt;br /&gt;
                                margin-bottom: 0.5em;&lt;br /&gt;
                                text-align: right;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary th.collection-as-table:first-child {&lt;br /&gt;
                                text-align: left;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.collection-as-table+tr.collection-as-table th {&lt;br /&gt;
                                border-bottom: 2px solid grey;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary td {&lt;br /&gt;
                                background: #efefef;&lt;br /&gt;
                                border-bottom: 1px solid #ccc;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.evenline td {&lt;br /&gt;
                                background: #eee;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.oddline td {&lt;br /&gt;
                                background: #fff;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.evenline td, tr.oddline td {&lt;br /&gt;
                                padding-top: 0.5em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.evenline+tr.evenline td, tr.oddline+tr.oddline td{&lt;br /&gt;
                                padding-top: 0;&lt;br /&gt;
                                border: none;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list td:first-child, table.ticket-list th:first-child {&lt;br /&gt;
                                padding-left: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list td:last-child, table.ticket-list th:last-child {&lt;br /&gt;
                                padding-right: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        th.collection-as-table , td.collection-as-table {&lt;br /&gt;
                                padding-right: 0.5em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        .pagenum.a:hover, .paging a.nav:hover{&lt;br /&gt;
                                text-decoration: underline;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        .pagenum *, .paging a.nav{&lt;br /&gt;
                                padding: .5em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        .currentpage{&lt;br /&gt;
                                text-decoration: none;&lt;br /&gt;
                                font-weight: bold;&lt;br /&gt;
                                background: #eee;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        div.paging{&lt;br /&gt;
                                text-align: center;&lt;br /&gt;
                                padding-bottom: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        #body&amp;gt;table.ticket-list {&lt;br /&gt;
                                margin-bottom: 2em;&lt;br /&gt;
                        }&lt;br /&gt;
                &amp;lt;/style&amp;gt;&lt;br /&gt;
                &amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;body&amp;gt;&lt;br /&gt;
                &amp;lt;?php&lt;br /&gt;
                //Costante con il max numero di righe ritornate da Sphinx&lt;br /&gt;
                define(&#039;SPHINX_MAX_LIMIT&#039;, 1000);&lt;br /&gt;
&lt;br /&gt;
                require_once(&amp;quot;Classi/sphinxapi.php&amp;quot;);&lt;br /&gt;
                //require_once(&amp;quot;Classi/Timer.class.php&amp;quot;);&lt;br /&gt;
                require_once(&amp;quot;Classi/MySql.class.php&amp;quot;);&lt;br /&gt;
                require_once(&amp;quot;Classi/ErrorManager.class.php&amp;quot;);&lt;br /&gt;
                include_once(&amp;quot;Include/Query.inc.php&amp;quot;);&lt;br /&gt;
                include_once(&amp;quot;Include/dvopendb.config.inc.php&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        //      $MyTimer =  new Timer();&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Parametri di connessione al Daemon Sphinx&lt;br /&gt;
                $host = &amp;quot;localhost&amp;quot;;&lt;br /&gt;
                $port = 9312;&lt;br /&gt;
                $index = &amp;quot;*&amp;quot;; // put your index name here&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Variabili in GET&lt;br /&gt;
                $query = $_GET[&#039;Text&#039;];&lt;br /&gt;
                $RequestorFilter = trim($_GET[&#039;Requestor&#039;]);&lt;br /&gt;
                $CodaFilter = $_GET[&#039;Queue&#039;];&lt;br /&gt;
                $DataInizioFilter = trim($_GET[&#039;From&#039;]);&lt;br /&gt;
                $DataFineFilter = trim($_GET[&#039;To&#039;]);&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Connessione al Daemon Sphinx&lt;br /&gt;
                $cl = new SphinxClient();&lt;br /&gt;
                $cl-&amp;gt;SetServer($host, $port);&lt;br /&gt;
                $cl-&amp;gt;SetMatchMode(SPH_MATCH_EXTENDED2);&lt;br /&gt;
                $cl-&amp;gt;SetLimits(0,SPHINX_MAX_LIMIT, $max_matches=0, $cutoff=0 );&lt;br /&gt;
&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //MySql Database Query per la retrive dei dati del ticket&lt;br /&gt;
&lt;br /&gt;
                $SqlQuery = new MySql();&lt;br /&gt;
                $SqlQuery-&amp;gt;connect($DbHostName,$DbName,$DbUser,$DbPassword);&lt;br /&gt;
&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Filtri sulla ricerca Sphinx&lt;br /&gt;
&lt;br /&gt;
                //Check della query (parametro di ricerca)&lt;br /&gt;
                if(strlen($query)==0)&lt;br /&gt;
                {&lt;br /&gt;
                        echo &amp;quot;Un paramètre doit être inscrit dans la zone  \&amp;quot;Texte\&amp;quot; pour continuer.&amp;quot;;&lt;br /&gt;
                        exit(1);&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Filtro Requestor&lt;br /&gt;
                if(strlen($RequestorFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        $TempQuery = sprintf($RequestorLookUpQuery,mysql_real_escape_string($RequestorFilter));&lt;br /&gt;
//                      $result22 = $SqlQuery-&amp;gt;query($TempQuery);&lt;br /&gt;
//                      $RequestorResult = $SqlQuery-&amp;gt;fetchAll($result22);&lt;br /&gt;
                                        $result22 = $SqlQuery-&amp;gt;query($TempQuery);&lt;br /&gt;
                                        $RequestorResult = mysql_fetch_array($result22);&lt;br /&gt;
                        if(count($RequestorResult)&amp;gt;0)&lt;br /&gt;
                        {&lt;br /&gt;
                                $cl-&amp;gt;SetFilter (&amp;quot;createdby&amp;quot;,array($RequestorResult[&#039;id&#039;]) , $exclude=false );&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;&amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;gt;Attention - L&#039;adresse \&amp;quot;&amp;quot;.$RequestorFilter.&amp;quot;\&amp;quot; n&#039;est pas dans la base de donnée et la recherche a été effectuée &amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Filtro Queue&lt;br /&gt;
                if(strlen($CodaFilter)&amp;gt;0)&lt;br /&gt;
                        $cl-&amp;gt;SetFilter (&amp;quot;queue&amp;quot;, array($CodaFilter), $exclude=false );&lt;br /&gt;
&lt;br /&gt;
                //Filtro Data&lt;br /&gt;
&lt;br /&gt;
                //__________________________________________________________________________________________________________________&lt;br /&gt;
                //Check delle date&lt;br /&gt;
                if(strlen($DataInizioFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        //Check Datainizio&lt;br /&gt;
                        if(checkdate(substr($DataInizioFilter,5,2),substr($DataInizioFilter,8,2),substr($DataInizioFilter,0,4))==false)&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;Date de début &amp;quot;.$DataInizioFilter.&amp;quot; incorrecte &amp;quot;;&lt;br /&gt;
                                exit(1);&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                                 $DataInizio = mktime(0, 0, 0, substr($DataInizioFilter,5,2), substr($DataInizioFilter,8,2), substr($DataInizioFilter,0,4));&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                if(strlen($DataFineFilter)&amp;gt;0)&lt;br /&gt;
                {       //Check DataFine&lt;br /&gt;
&lt;br /&gt;
                        if(checkdate(substr($DataFineFilter,5,2),substr($DataFineFilter,8,2),substr($DataFineFilter,0,4))==false)&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;Date de fin &amp;quot;.$DataFineFilter.&amp;quot; incorrecte &amp;quot;;&lt;br /&gt;
                                exit(1);&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                                $DataFine = mktime(0, 0, 0, substr($DataFineFilter,5,2), substr($DataFineFilter,8,2), substr($DataFineFilter,0,4));&lt;br /&gt;
                }&lt;br /&gt;
                //__________________________________________________________________________________________________________________&lt;br /&gt;
&lt;br /&gt;
                //Filtraggio vero e proprio&lt;br /&gt;
&lt;br /&gt;
                //Se sono settate entrambe...&lt;br /&gt;
                if(strlen($DataInizioFilter)&amp;gt;0 &amp;amp;&amp;amp; strlen($DataFineFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        if($DataInizio &amp;lt; $DataFine)&lt;br /&gt;
                        {&lt;br /&gt;
                                //Se sono settate entrambe le date filtro per entrambe&lt;br /&gt;
                                $cl-&amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, $DataFine, $exclude=false );&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;La date de début &amp;quot;.$DataInizioFilter.&amp;quot; est supérieure à la date de fin &amp;quot;.$DataFineFilter;&lt;br /&gt;
                                exit(1);&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Se solo DataInizio..&lt;br /&gt;
                if(strlen($DataInizioFilter)&amp;gt;0 &amp;amp;&amp;amp; strlen($DataFineFilter)==0)&lt;br /&gt;
                {&lt;br /&gt;
                        $cl-&amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, mktime(), $exclude=false );&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Se solo DataFine..&lt;br /&gt;
                if(strlen($DataInizioFilter)==0 &amp;amp;&amp;amp; strlen($DataFineFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        //2008-11-14 : Data del primo Ticket di RT&lt;br /&gt;
                        //1988-07-18 : Data di nascita di AMENDED :)&lt;br /&gt;
                        $cl-&amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, mktime(0, 0, 0,07,18,1988), $DataFine, $exclude=false );&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Eseguo la Query su Sphinx&lt;br /&gt;
&lt;br /&gt;
                $res = $cl-&amp;gt;Query($query, $index);&lt;br /&gt;
                if ($res == false)&lt;br /&gt;
                {&lt;br /&gt;
                        echo &amp;quot;failure: &amp;quot;.$cl-&amp;gt;GetLastError().&amp;quot;\n&amp;quot;;&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                        if(count($res[&#039;matches&#039;])!=0)&lt;br /&gt;
                        {&lt;br /&gt;
                                //Se i risultati totali sono &amp;gt; 1000&lt;br /&gt;
                                if($res[&#039;total_found&#039;]&amp;gt;SPHINX_MAX_LIMIT)&lt;br /&gt;
                                {&lt;br /&gt;
                                        echo &amp;quot;&amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;gt; Attention, &amp;quot;.$res[total_found].&amp;quot; résultats ont été trouvés, mais vous ne verrez que les premiers &amp;quot;.SPHINX_MAX_LIMIT.&amp;quot; résultats.&amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
                                }&lt;br /&gt;
&lt;br /&gt;
                                //Se ci sono dei risultati creo la tabella e stampo&lt;br /&gt;
                                //echo &amp;quot;&amp;lt;table id=&#039;ResultTable&#039; class=&#039;ticket-list&#039; border=&#039;0&#039; cellspacing=&#039;0&#039; cellpadding=&#039;1&#039; width=&#039;100%&#039;&amp;gt;&lt;br /&gt;
                                echo &amp;quot;&amp;lt;table id=&#039;ResultTable&#039; class=&#039;sortable&#039; border=&#039;0&#039; cellspacing=&#039;0&#039; cellpadding=&#039;1&#039; width=&#039;100%&#039;&amp;gt;&lt;br /&gt;
                                                &amp;lt;thead&amp;gt;&lt;br /&gt;
                                                &amp;lt;tr class=&#039;collection-as-table&#039;&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;#&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Sujet&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;École&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Status&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Date_de_création&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Demandeur&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Propriétaire&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                                                &amp;lt;/thead&amp;gt;&amp;lt;tbody&amp;gt;&amp;quot;;&lt;br /&gt;
                                foreach ($res[&amp;quot;matches&amp;quot;] as $key=&amp;gt;$value)&lt;br /&gt;
                                {&lt;br /&gt;
                                        $i++;&lt;br /&gt;
                                        $TempQuery = sprintf($TicketDetailQuery,mysql_real_escape_string($key));&lt;br /&gt;
                                        $result34 = $SqlQuery-&amp;gt;query($TempQuery);&lt;br /&gt;
                                        $Risultato = mysql_fetch_array($result34);&lt;br /&gt;
                                        //$Risultato = $SqlQuery-&amp;gt;queryFetchAll($TempQuery);&lt;br /&gt;
                                        //$Risultato = $SqlQuery-&amp;gt;fetchAll($result23);&lt;br /&gt;
                                        if($i%2==0)&lt;br /&gt;
                                        {&lt;br /&gt;
                                                                                        echo &amp;quot;  &amp;lt;tr class=&#039;evenline&#039;&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                &amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
                                        }&lt;br /&gt;
                                        else&lt;br /&gt;
                                        {&lt;br /&gt;
                                                echo &amp;quot;  &amp;lt;tr class=&#039;oddline&#039;&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                &amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
                                        }&lt;br /&gt;
                                }&lt;br /&gt;
                                echo &amp;quot;  &amp;lt;/tbody&amp;gt;&lt;br /&gt;
                                        &amp;lt;tfoot&amp;gt;&amp;lt;/tfoot&amp;gt;&lt;br /&gt;
                                        &amp;lt;/table&amp;gt;&amp;quot;;&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                        {&lt;br /&gt;
                                //...Altrimenti stampo che non ho trovato nulla&lt;br /&gt;
                                echo &amp;quot;&amp;lt;br/&amp;gt;&amp;lt;label class=\&amp;quot;notfoundlabel\&amp;quot;&amp;gt;Aucun résultat trouvé&amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        echo &amp;quot;Résultats &amp;quot;.$res[&#039;total&#039;].&amp;quot; de &amp;quot;.$res[&#039;total_found&#039;]; // in &amp;quot;.$MyTimer-&amp;gt;elapsed().&amp;quot; secondi&amp;quot;;&lt;br /&gt;
                }&lt;br /&gt;
                ?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is my Classi/MySql.class.php file&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
class MySQLException extends Exception { }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class MySQL {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private $host = null,&lt;br /&gt;
                        $baseName = null,&lt;br /&gt;
                        $user = null,&lt;br /&gt;
                        $id = null;&lt;br /&gt;
&lt;br /&gt;
        private $errorManager = null;&lt;br /&gt;
&lt;br /&gt;
        private $queries = array();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function __construct() {&lt;br /&gt;
&lt;br /&gt;
                $this-&amp;gt;errorManager = ErrorManager::getInstance();&lt;br /&gt;
&lt;br /&gt;
        } // public function __construct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getHost() { return $this-&amp;gt;host; }&lt;br /&gt;
        public function getBaseName() { return $this-&amp;gt;baseName; }&lt;br /&gt;
        public function getUser() { return $this-&amp;gt;user; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function connect($host, $base, $user, $password, $enconding = &amp;quot;utf8&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                if (!($this-&amp;gt;id = mysql_connect($host, $user, $password))) {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;host = null;&lt;br /&gt;
                        $this-&amp;gt;base = null;&lt;br /&gt;
                        $this-&amp;gt;user = null;&lt;br /&gt;
                        $this-&amp;gt;id = null;&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;database connection failed!&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                        $this-&amp;gt;host = $host;&lt;br /&gt;
                        $this-&amp;gt;user = $user;&lt;br /&gt;
                        if (mysql_select_db($base, $this-&amp;gt;id)) {&lt;br /&gt;
                                $this-&amp;gt;baseName = $base;&lt;br /&gt;
                        }&lt;br /&gt;
                        mysql_query(&amp;quot;set names $enconding&amp;quot;, $this-&amp;gt;id);&lt;br /&gt;
                        //mysql_set_charset($enconding, $this-&amp;gt;id);&lt;br /&gt;
                        return true;&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function connect($host, $base, $user, $password)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getLastId() {&lt;br /&gt;
&lt;br /&gt;
                if (is_resource($this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                        $lastId = mysql_insert_id($this-&amp;gt;id);&lt;br /&gt;
                        return $lastId;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;database is not connected, can&#039;t get last id&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function getLastId()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function fetchAll($result) {&lt;br /&gt;
&lt;br /&gt;
                if (mysql_num_rows($result)) {&lt;br /&gt;
&lt;br /&gt;
                        $rows = array();&lt;br /&gt;
&lt;br /&gt;
                        while ($row = mysql_fetch_assoc($result)) {&lt;br /&gt;
                                $rows[] = $row;&lt;br /&gt;
                        }&lt;br /&gt;
                        return $rows;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;invalid mysql query result supplied to fetchAll()&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function fetchAll($result)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function query($string) {&lt;br /&gt;
&lt;br /&gt;
                if (is_resource($this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                        if ($result = mysql_query($string, $this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                                $this-&amp;gt;queries[] = $string;&lt;br /&gt;
                                return $result;&lt;br /&gt;
&lt;br /&gt;
                        }&lt;br /&gt;
                        else {&lt;br /&gt;
                                $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;error in query: &#039;$string&#039;:&amp;quot;.mysql_error($this-&amp;gt;id)));&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;database is not connected, can&#039;t make query&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function query($string)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function queryFetchAll($query) {&lt;br /&gt;
&lt;br /&gt;
                $result = $this-&amp;gt;query($query);&lt;br /&gt;
                $entries = $this-&amp;gt;fetchAll($result);&lt;br /&gt;
&lt;br /&gt;
                return $entries;&lt;br /&gt;
&lt;br /&gt;
        } // public function queryFetchAll($query)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getQueries() {&lt;br /&gt;
&lt;br /&gt;
                return $this-&amp;gt;queries;&lt;br /&gt;
&lt;br /&gt;
        } // public function getQueries()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function __destruct() {&lt;br /&gt;
&lt;br /&gt;
                if (is_resource($this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                        mysql_close($this-&amp;gt;id);&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function __destruct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} // class Mysql&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I added ErrorManager.class.php also : &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class ErrorManager {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private static $instance = null;&lt;br /&gt;
&lt;br /&gt;
        private $errors = array();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private function __construct() { }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public static function getInstance() {&lt;br /&gt;
&lt;br /&gt;
                if (self::$instance == null) {&lt;br /&gt;
&lt;br /&gt;
                        self::$instance = new ErrorManager();&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                return self::$instance;&lt;br /&gt;
&lt;br /&gt;
        } // public function getInstance()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getErrors() {&lt;br /&gt;
&lt;br /&gt;
                return $this-&amp;gt;errors;&lt;br /&gt;
&lt;br /&gt;
        } // public function getErrors()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function reportError(&amp;amp;$sourceObject, $msg = &amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                $class = get_class($sourceObject);&lt;br /&gt;
                $this-&amp;gt;errors[] = array(&amp;quot;source&amp;quot; =&amp;gt; $sourceObject, &amp;quot;message&amp;quot; =&amp;gt; &amp;quot;$class: \&amp;quot;$msg\&amp;quot;&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        } // public function reportError($sourceObject, $msg = &amp;quot;&amp;quot;)&lt;br /&gt;
        public function reportFatalError(&amp;amp;$sourceObject, $exception = null) {&lt;br /&gt;
&lt;br /&gt;
                if (!($exception instanceof Exception)) {&lt;br /&gt;
&lt;br /&gt;
                        $exception = new Exception();&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                $msg = $exception-&amp;gt;getMessage();&lt;br /&gt;
                $class = get_class($sourceObject);&lt;br /&gt;
                $this-&amp;gt;reportError($sourceObject, &amp;quot;fatal error: $msg&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
                throw $exception;&lt;br /&gt;
&lt;br /&gt;
        } // public function reportFatalError($sourceObject, $exception)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} // class ErrorManager&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the Classi I added http://www.kryogenix.org/code/browser/sorttable/sorttable.js for the table to sort.&lt;br /&gt;
&lt;br /&gt;
When you download the last beta version of sphinx, you get a api so I copied it to the Classi also : &lt;br /&gt;
sphinxbeta/sphinx-2.0.1-beta/api/sphinxapi.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The most important thing is to change the limit in the php for the group_concat to make sure you will get all your tickets : &lt;br /&gt;
mysql -p &lt;br /&gt;
SET GLOBAL group_concat_max_len = 8192000;&lt;br /&gt;
&lt;br /&gt;
My sphinx.conf is the following :&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
source rt3&lt;br /&gt;
{&lt;br /&gt;
        type                    = mysql&lt;br /&gt;
&lt;br /&gt;
        sql_host                = localhost&lt;br /&gt;
        sql_user                = &lt;br /&gt;
        sql_pass                = &lt;br /&gt;
        sql_db                  = rt3&lt;br /&gt;
        sql_port                = 3306  # optional, default is 3306&lt;br /&gt;
        sql_query               = \&lt;br /&gt;
                select TK.id as TicketNum, \&lt;br /&gt;
                        TK.Creator as CreatedBy, \&lt;br /&gt;
                        TK.Queue as Queue, \&lt;br /&gt;
                        unix_timestamp(TK.Created) as Created, \&lt;br /&gt;
                        TK.Subject as Subject, \&lt;br /&gt;
                        group_concat(A.Content) as Content \&lt;br /&gt;
                from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
                where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
                and A.TransactionId = T.id \&lt;br /&gt;
                and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
                and (A.ContentType = &#039;text/plain&#039; or A.ContentType = &#039;text/html&#039;) \&lt;br /&gt;
                and A.Content is not null \&lt;br /&gt;
                and TK.Created &amp;lt; concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) \&lt;br /&gt;
                group by TK.id \&lt;br /&gt;
                order by TK.id, T.id&lt;br /&gt;
&lt;br /&gt;
        sql_attr_uint           = Created&lt;br /&gt;
        sql_attr_uint           = Queue&lt;br /&gt;
        sql_attr_uint           = CreatedBy&lt;br /&gt;
        sql_query_info          = SELECT * FROM Tickets WHERE id=$id&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
source rt3delta : rt3&lt;br /&gt;
 {&lt;br /&gt;
        sql_query               = \&lt;br /&gt;
                select TK.id as TicketNum, \&lt;br /&gt;
                        TK.Creator as CreatedBy, \&lt;br /&gt;
                        TK.Queue as Queue, \&lt;br /&gt;
                        unix_timestamp(TK.Created) as Created, \&lt;br /&gt;
                        TK.Subject as Subject, \&lt;br /&gt;
                        group_concat(A.Content) as Content \&lt;br /&gt;
                from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
                where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
                and A.TransactionId = T.id \&lt;br /&gt;
                and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
                and A.Content is not null \&lt;br /&gt;
                and TK.Created between concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) and last_day(now()) \&lt;br /&gt;
                group by TK.id \&lt;br /&gt;
                order by TK.id, T.id&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
index fulltext1&lt;br /&gt;
 {&lt;br /&gt;
        source                  = rt3&lt;br /&gt;
        path                    = /var/data/fulltext1&lt;br /&gt;
        docinfo                 = extern&lt;br /&gt;
        charset_type    = utf-8&lt;br /&gt;
        html_strip = 1&lt;br /&gt;
        min_word_len = 1&lt;br /&gt;
        enable_star     = 1&lt;br /&gt;
        min_infix_len   = 3&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 index fulltextdelta: fulltext1&lt;br /&gt;
 {&lt;br /&gt;
        source                  = rt3delta&lt;br /&gt;
        charset_type            = utf-8&lt;br /&gt;
        path                    = /var/data/fulltextdelta&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 indexer&lt;br /&gt;
 {&lt;br /&gt;
        mem_limit               = 128M&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
searchd&lt;br /&gt;
{&lt;br /&gt;
        listen                  = 9312&lt;br /&gt;
        listen                  = 9306:mysql41&lt;br /&gt;
        log                     = /var/log/sphinx/searchd.log&lt;br /&gt;
        query_log               = /var/log/sphinx/query.log&lt;br /&gt;
        read_timeout            = 5&lt;br /&gt;
        max_children            = 30&lt;br /&gt;
        pid_file                = /var/run/sphinx/searchd.pid&lt;br /&gt;
        max_matches             = 1000&lt;br /&gt;
        seamless_rotate         = 1&lt;br /&gt;
        preopen_indexes         = 1&lt;br /&gt;
        unlink_old              = 1&lt;br /&gt;
        workers                 = threads # for RT to work&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=MuteResolve&amp;diff=5366</id>
		<title>MuteResolve</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=MuteResolve&amp;diff=5366"/>
		<updated>2016-06-20T07:12:28Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Corrected formatting for the new wiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
By default RT has a scrip to notify requestors when a ticket is resolved. This is generally a good idea; however, sometimes you may want to avoid notifying requestors. One example is when someone reopens a ticket just because he answered &amp;quot;Thanks&amp;quot; to your resolution notification.&lt;br /&gt;
&lt;br /&gt;
I haven&#039;t found a solution satisfying me, so I developed my own. It involves a transaction custom field, called MuteResolve, that privileged users can set when they resolve a ticket. If set to &amp;quot;Yes&amp;quot;, RT won&#039;t send any email.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that, being a transaction custom field, you&#039;ll see it in any transaction, not only on resolve (e.g. you&#039;ll see it on the ticket &amp;quot;comment&amp;quot; page too), but it only makes sense on resolve.&lt;br /&gt;
&lt;br /&gt;
This is implemented on RT 3.8.4.&lt;br /&gt;
&lt;br /&gt;
2010-08-23 Updated for 3.8.8 (change in validation).&lt;br /&gt;
&lt;br /&gt;
=== How to set up MuteResolve in RT3: ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 1. Custom field creation =====&lt;br /&gt;
&lt;br /&gt;
First create a new custom field: Configuration -&amp;amp;gt; Custom Fields -&amp;amp;gt; Create&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name:&#039;&#039;&#039; MuteResolve&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; &amp;lt;code&amp;gt;If Yes, don&#039;t send email notifications on resolve&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Type:&#039;&#039;&#039; &amp;lt;code&amp;gt;Select one value&amp;lt;/code&amp;gt; (but I prefer Combobox because it looks better)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Applies to:&#039;&#039;&#039; Ticket Transactions&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Validation:&#039;&#039;&#039; (?#YesNo)^(Yes|No|\z)$ (only necessary for Combobox)&lt;br /&gt;
&lt;br /&gt;
When you click on &amp;quot;Save Changes&amp;quot; RT will let you enter Values.&lt;br /&gt;
&lt;br /&gt;
Enter one value: &amp;quot;Yes&amp;quot;. You need only fill the Name field, I have left Sort and Description empty. Then &amp;quot;Save Changes&amp;quot; again.&lt;br /&gt;
&lt;br /&gt;
On the &amp;quot;Applies To&amp;quot; page select the queues where you want to enable the custom field, then on the &amp;quot;Group Rights&amp;quot; give the &amp;quot;ModifyCustomField&amp;quot; right to the &amp;quot;Privileged&amp;quot; system group.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 2. Editing Scrip =====&lt;br /&gt;
&lt;br /&gt;
Go to Configuration -&amp;amp;gt; Global -&amp;amp;gt; Scrips, then click on &amp;quot;On Resolve Notify Requestors&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Change &amp;quot;Condition&amp;quot; from &amp;quot;On Resolve&amp;quot; to &amp;quot;User Defined&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;quot;Stage&amp;quot; from &amp;quot;TransactionCreate&amp;quot; to &amp;quot;TransactionBatch&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In the &amp;quot;Custom condition&amp;quot; box enter this code:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
  # is this a resolve?&lt;br /&gt;
  my $trans = $self-&amp;gt;TransactionObj;&lt;br /&gt;
  my $tipo = $trans-&amp;gt;Type;&lt;br /&gt;
  return 0 unless ($trans-&amp;gt;Type eq &amp;quot;Status&amp;quot; &amp;amp;&amp;amp; $trans-&amp;gt;NewValue eq &amp;quot;resolved&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  # get last &amp;quot;comment&amp;quot; transaction&lt;br /&gt;
  my $Transactions = $self-&amp;gt;TicketObj-&amp;gt;Transactions;&lt;br /&gt;
  &lt;br /&gt;
  $Transactions-&amp;gt;Limit( FIELD =&amp;gt; &#039;Type&#039;, VALUE =&amp;gt; &#039;Comment&#039; );&lt;br /&gt;
  $Transactions-&amp;gt;OrderByCols (&lt;br /&gt;
                { FIELD =&amp;gt; &#039;Created&#039;,  ORDER =&amp;gt; &#039;DESC&#039; },&lt;br /&gt;
                { FIELD =&amp;gt; &#039;id&#039;,     ORDER =&amp;gt; &#039;DESC&#039; },&lt;br /&gt;
                );&lt;br /&gt;
  &lt;br /&gt;
  # get custom fields of the last &amp;quot;comment&amp;quot; transaction, if there is one&lt;br /&gt;
  unless( $Transactions-&amp;gt;First ){ return 1; }&lt;br /&gt;
  my $TransNum = $Transactions-&amp;gt;First-&amp;gt;Id;&lt;br /&gt;
  my $TCustomFields = $Transactions-&amp;gt;First-&amp;gt;CustomFields;&lt;br /&gt;
  &lt;br /&gt;
  while (my $TCustomField = $TCustomFields-&amp;gt;Next()) {&lt;br /&gt;
     my $nam = $TCustomField-&amp;gt;Name;&lt;br /&gt;
     if ($nam = &#039;MuteResolve&#039;) {&lt;br /&gt;
         my $val = $Transactions-&amp;gt;First-&amp;gt;FirstCustomFieldValue($nam);&lt;br /&gt;
         if ($val eq &#039;Yes&#039;) {&lt;br /&gt;
             return 0;&lt;br /&gt;
         }&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  return 1;&lt;br /&gt;
 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
That&#039;s all folks!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; - I think&lt;br /&gt;
&lt;br /&gt;
 if ($nam = &#039;MuteResolve&#039;) {&lt;br /&gt;
&lt;br /&gt;
should be&lt;br /&gt;
&lt;br /&gt;
 if ($nam eq &#039;MuteResolve&#039;) {&lt;br /&gt;
&lt;br /&gt;
(added by [http://wiki.bestpractical.com/view/fish fish], 9 Sep 2010)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note2&#039;&#039;&#039; - If you check &amp;quot;yes&amp;quot; but add no comment, rt still sends the mail. (Thx to Crist.)&lt;br /&gt;
&lt;br /&gt;
(added by Minifab, 23 Nov 2010)&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=OnCreateCheckCF&amp;diff=5365</id>
		<title>OnCreateCheckCF</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=OnCreateCheckCF&amp;diff=5365"/>
		<updated>2016-06-20T07:08:42Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Corrected formatting for the new wiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
You may want to create a mandatory custom field, so that people will have to fill the value before being able to submit a new ticket. However, if you define a cf as mandatory, only people creating tickets from the web interface will be forced to fill the value. Those creating a new ticket using the mail gateway won&#039;t notice the presence of the mandatory cf, and the ticket will be created anyway.&lt;br /&gt;
&lt;br /&gt;
My solution consists of three pieces:&lt;br /&gt;
&lt;br /&gt;
* the [[ExtractCustomFieldValues]] extension, needed to be able assign a value to the cf through an email message&lt;br /&gt;
* an OnCreate scrip which checks if the cf is present, and eventually marks the ticket as rejected and notifies the requestor&lt;br /&gt;
* a custom template to use when notifying the requestor about a rejected ticket&lt;br /&gt;
&lt;br /&gt;
This is implemented on RT 3.8.4.&lt;br /&gt;
&lt;br /&gt;
=== How to setup OnCreateCheckCF in RT3 ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 1. Custom field creation =====&lt;br /&gt;
&lt;br /&gt;
First create a new custom field: Configuration -&amp;amp;gt; Custom Fields -&amp;amp;gt; Create&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name:&#039;&#039;&#039; &amp;lt;code&amp;gt;cfTest&amp;lt;/code&amp;gt; &#039;&#039;(you can use the name you want)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; &amp;lt;code&amp;gt;test mandatory custom field&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Type:&#039;&#039;&#039; &amp;lt;code&amp;gt;Fill in one text area&amp;lt;/code&amp;gt; &#039;&#039;(you can use the type you want)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Validation:&#039;&#039;&#039; (?#Mandatory).&lt;br /&gt;
&lt;br /&gt;
Now &amp;quot;Save Changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
On the &amp;quot;Applies To&amp;quot; page select the queues where you want to enable the custom field, then on the &amp;quot;Group Rights&amp;quot; give the &amp;quot;ModifyCustomField&amp;quot; right to the &amp;quot;Everyone&amp;quot; system group (if you want everyone to be able to create tickets on those queues).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that this is just a sample mandatory custom field. The scrip below is generic and will check for the presence of any and all &amp;lt;u&amp;gt;mandatory&amp;lt;/u&amp;gt; ticket custom fields.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 2. Configure the ExtractCustomFieldValues =====&lt;br /&gt;
&lt;br /&gt;
Follow the instructions in the [[ExtractCustomFieldValues]] section&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 3. Creating the template =====&lt;br /&gt;
&lt;br /&gt;
Go to Configuration -&amp;amp;gt; Global -&amp;amp;gt; Templates -&amp;amp;gt; New&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name:&#039;&#039;&#039; &amp;lt;code&amp;gt;Error: no mandatory CF&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; &amp;lt;code&amp;gt;Inform the user that the ticket has been rejected due to a missing mandatory custom field&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content:&#039;&#039;&#039;&lt;br /&gt;
     Subject: Your ticket has been rejected due to a missing mandatory field.&lt;br /&gt;
     You sent a ticket with a missing piece of information. Since the missing information&lt;br /&gt;
     is mandatory, the ticket has been rejected.&lt;br /&gt;
     Please verify the informations you sent and then retry submitting the ticket.&lt;br /&gt;
     If you feel your ticket has been rejected due to an error, please contact the administrator.&lt;br /&gt;
&lt;br /&gt;
Obviously this is only an example, you can write what you want. Just be sure to have the &amp;quot;Subject:&amp;quot; line as the very first line, and to leave a blank line after that.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 4. Creating the Scrip =====&lt;br /&gt;
&lt;br /&gt;
Go to Configuration -&amp;amp;gt; Queues (or Global if you want this for all queues) -&amp;amp;gt; (QueueName) -&amp;amp;gt; Scrips -&amp;amp;gt; New scrip&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; OnCreateCheckCF&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition:&#039;&#039;&#039; User Defined&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Action:&#039;&#039;&#039; Autoreply To Requestors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Template:&#039;&#039;&#039; Global template: Error: no mandatory CF&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage:&#039;&#039;&#039; TransactionBatch&lt;br /&gt;
&lt;br /&gt;
In the &amp;quot;Custom condition&amp;quot; box enter this code:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
    my $trans = $self-&amp;amp;gt;TransactionObj;&lt;br /&gt;
    return 0 unless $trans-&amp;amp;gt;Type eq &amp;quot;Create&amp;quot;;&lt;br /&gt;
    &lt;br /&gt;
    my $ticket = $self-&amp;amp;gt;TicketObj;&lt;br /&gt;
    &lt;br /&gt;
    my $Email_Rq = $ticket-&amp;amp;gt;RequestorAddresses;&lt;br /&gt;
    &lt;br /&gt;
    my $CustomFields = $ticket-&amp;amp;gt;QueueObj-&amp;amp;gt;TicketCustomFields();&lt;br /&gt;
    while (my $CustomField = $CustomFields-&amp;amp;gt;Next()) {&lt;br /&gt;
       my $nam = $CustomField-&amp;amp;gt;Name;&lt;br /&gt;
       my $typ = $CustomField-&amp;amp;gt;Type;&lt;br /&gt;
       my $vad = $CustomField-&amp;amp;gt;Pattern;&lt;br /&gt;
    &lt;br /&gt;
       if ($vad == &#039;(?#Mandatory)&#039;) {&lt;br /&gt;
           my $val = $ticket-&amp;amp;gt;FirstCustomFieldValue($nam);&lt;br /&gt;
           if ($val ne &#039;&#039;) {&lt;br /&gt;
               next;&lt;br /&gt;
           } else {&lt;br /&gt;
               $ticket-&amp;amp;gt;SetStatus(&amp;quot;rejected&amp;quot;);&lt;br /&gt;
           }&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    return 1;&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
That&#039;s all folks!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;P.S.&#039;&#039;&#039;: Thanks to the user who spotted a typo in my scrip!&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=FlexibleSignature&amp;diff=5364</id>
		<title>FlexibleSignature</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=FlexibleSignature&amp;diff=5364"/>
		<updated>2016-06-20T06:57:48Z</updated>

		<summary type="html">&lt;p&gt;Cris70: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
==Changing the way the signature works in RT==&lt;br /&gt;
I was having some issues with the way RT works regarding user signatures.&lt;br /&gt;
&lt;br /&gt;
First of all, RT will always put a &amp;quot;--&amp;quot; before your signature, so you are limited in the way your signature looks.&lt;br /&gt;
&lt;br /&gt;
Second, RT will always put your signature at the top of an empty message, so I always have to put the cursor at the top, hit &amp;quot;Enter&amp;quot; to make space for my text, then put again the cursor at the top and start writing.&lt;br /&gt;
&lt;br /&gt;
This is all quite tedious.&lt;br /&gt;
&lt;br /&gt;
So I wrote a small patch to change the behaviour.&lt;br /&gt;
&lt;br /&gt;
Here are the instructions for &#039;&#039;&#039;RT 4.2.12&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*copy &#039;&#039;&#039;&#039;&#039;/opt/rt4/share/html/Elements/MessageBo&#039;&#039;x&#039;&#039;&#039; to &#039;&#039;&#039;&#039;&#039;/opt/rt4/local/html/Elements/MessageBox&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
*modify &#039;&#039;&#039;&#039;&#039;/opt/rt4/local/html/Elements/MessageBox&#039;&#039;&#039;&#039;&#039; so that line 68 changes from:&lt;br /&gt;
     $signature = &amp;quot;-- \n&amp;quot;. $text;&lt;br /&gt;
to:&lt;br /&gt;
     if ($text =~ m/^--$/m) {&lt;br /&gt;
         $signature = &amp;quot;\n&amp;quot;. $text;&lt;br /&gt;
     } else {&lt;br /&gt;
         $signature = &amp;quot;\n-- \n&amp;quot;. $text;&lt;br /&gt;
     }&lt;br /&gt;
*clear your mason cache&lt;br /&gt;
*restart your web server&lt;br /&gt;
Now, if you do not have &amp;quot;--&amp;quot; on a line by its own in your signature, RT will put it at the top of your signature BUT it will also leave a blank line before your signature.&lt;br /&gt;
&lt;br /&gt;
If you already have a &amp;quot;--&amp;quot; on a line by its own in your signature, RT will leave it alone and will NOT put another one on top of your signature. Also RT will leave a blank line before your signature.&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Conditional_Reopen_Reject&amp;diff=5363</id>
		<title>Conditional Reopen Reject</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Conditional_Reopen_Reject&amp;diff=5363"/>
		<updated>2016-06-20T06:57:24Z</updated>

		<summary type="html">&lt;p&gt;Cris70: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Conditional Reopen Reject lets you decide that, after a set amount of time since resolution, users won&#039;t be able to reopen a ticket.&lt;br /&gt;
&lt;br /&gt;
It works with a scrip and a template, as explained below.&lt;br /&gt;
&lt;br /&gt;
==Setting up the scrip==&lt;br /&gt;
&lt;br /&gt;
We have had this customization installed for so long that I do not remember the default configuration of RT. I believe a script called &amp;quot;On Correspond Open Tickets&amp;quot; already exists in a default installation.&lt;br /&gt;
&lt;br /&gt;
You have to change it (or create it if it doesn&#039;t exist) the following way.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that this is configured so that tickets become non-reopenable after a week since resolution. If you want a different timeframe, just change the &#039;&#039;$Days&#039;&#039; variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; On Correspond Open Tickets&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition:&#039;&#039;&#039; User defined&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Action:&#039;&#039;&#039; Autoreply to requestors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Template:&#039;&#039;&#039; Conditional Reopen Reject&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Applies to:&#039;&#039;&#039; Global&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Custom condition:&#039;&#039;&#039;&lt;br /&gt;
 my $Days = 60*60*24*7; # 7 days&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 my $TransactionObj = $self-&amp;gt;TransactionObj;&lt;br /&gt;
 &lt;br /&gt;
 my $TicketObj = $self-&amp;gt;TicketObj;&lt;br /&gt;
 &lt;br /&gt;
 my $QueueObj = $TicketObj-&amp;gt;QueueObj;&lt;br /&gt;
 &lt;br /&gt;
 my $QueueName = $QueueObj-&amp;gt;Name;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 return 0 unless $TransactionObj-&amp;gt;Type eq &#039;Correspond&#039;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 # begin debug section #############&lt;br /&gt;
 &lt;br /&gt;
 my $dr = $TicketObj-&amp;gt;ResolvedObj-&amp;gt;Unix;&lt;br /&gt;
 &lt;br /&gt;
 my $tt = time() - $TicketObj-&amp;gt;ResolvedObj-&amp;gt;Unix;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 $RT::Logger-&amp;gt;info( &amp;quot;&amp;gt;  -- Scrip 1 --\n&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 $RT::Logger-&amp;gt;info( &amp;quot;&amp;gt;  DataRisoluzione: $dr \n&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 $RT::Logger-&amp;gt;info( &amp;quot;&amp;gt;  TempoTrascorso: $tt \n&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 # InBound should be true only if the email comes from the original requestor&lt;br /&gt;
 &lt;br /&gt;
 if ( $TransactionObj-&amp;gt;IsInbound ) {$RT::Logger-&amp;gt;info(&amp;quot;&amp;gt;  Inbound\n&amp;quot;);}&lt;br /&gt;
 &lt;br /&gt;
 if ( $QueueObj-&amp;gt;IsInactiveStatus( $TicketObj-&amp;gt;Status ) ) {$RT::Logger-&amp;gt;info(&amp;quot;&amp;gt;  Inactive\n&amp;quot;);}&lt;br /&gt;
 &lt;br /&gt;
 # end debug section #############&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 if ( $TransactionObj-&amp;gt;IsInbound &amp;amp;&amp;amp;&lt;br /&gt;
 &lt;br /&gt;
      $QueueObj-&amp;gt;IsInactiveStatus( $TicketObj-&amp;gt;Status ) &amp;amp;&amp;amp;&lt;br /&gt;
 &lt;br /&gt;
      time() - $TicketObj-&amp;gt;ResolvedObj-&amp;gt;Unix &amp;gt; $Days ) {&lt;br /&gt;
 &lt;br /&gt;
   return 1; # send mail template&lt;br /&gt;
 &lt;br /&gt;
 } else {&lt;br /&gt;
 &lt;br /&gt;
   $TicketObj-&amp;gt;SetStatus( &#039;open&#039; );&lt;br /&gt;
 &lt;br /&gt;
   return 0; # don&#039;t send mail template&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&#039;&#039;&#039;Custom action preparation code:&#039;&#039;&#039; empty&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Custom action commit code:&#039;&#039;&#039; empty&lt;br /&gt;
&lt;br /&gt;
==Setting up the template==&lt;br /&gt;
&lt;br /&gt;
This is how the template should be configured:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name:&#039;&#039;&#039; Conditional Reopen Reject&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; Reject reopen if ticket has been closed for more than X days&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Type:&#039;&#039;&#039; Perl&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content:&#039;&#039;&#039;&lt;br /&gt;
 Subject: WARNING - TICKET REJECTED: {$Ticket-&amp;gt;Subject}&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Ticket #{$Ticket-&amp;gt;id()} has been closed for more than 7 days: it is not possible to reopen it.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Please submit a new ticket instead.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Thank you&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 RT for {$Ticket-&amp;gt;QueueObj-&amp;gt;SubjectTag || $rtname}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OK, that&#039;s all.&lt;br /&gt;
&lt;br /&gt;
I hope you enjoy it!&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=5362</id>
		<title>Full Text Search Portlet</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=5362"/>
		<updated>2016-06-20T06:56:04Z</updated>

		<summary type="html">&lt;p&gt;Cris70: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
[[File:FTSearch.png|thumb|350px|The portlet]]&lt;br /&gt;
==&#039;&#039;&#039;The full-text search portlet&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
After the release of RT 4.0 we began investigating the migration from our 3.8.x RT installation.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;simple search&amp;quot; page, and to have to add &amp;quot;fulltext:&amp;quot; every time.&lt;br /&gt;
&lt;br /&gt;
So I thought &amp;quot;why not write a portlet again&amp;quot;, 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 &amp;quot;simple search&amp;quot; page again for... simple searches :-)&lt;br /&gt;
&lt;br /&gt;
So here it is, for those who want to have a usable alternative to the &amp;quot;simple search&amp;quot; page and yet don&#039;t want to always use the advanced search.&lt;br /&gt;
&lt;br /&gt;
Paste the content of the following box into a file. I called it FTSearch.&lt;br /&gt;
&lt;br /&gt;
You have to put it in:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;your_rt_root&amp;gt;&#039;&#039;\local\html\Elements&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;&amp;amp;|/Widgets/TitleBox, title =&amp;gt; loc(&#039;Fulltext Search&#039;), bodyclass =&amp;gt; &amp;quot;&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
     &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
     function MangleData()&lt;br /&gt;
     {&lt;br /&gt;
         // qui aggrego tutti i campi della prima form&lt;br /&gt;
         var textstring = &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;;&lt;br /&gt;
         var fields=[&amp;quot;fulltext:&amp;quot;, &amp;quot;queue:&amp;quot;, &amp;quot;requestor:&amp;quot;, &amp;quot;owner:&amp;quot;];&lt;br /&gt;
 &lt;br /&gt;
         for (i=3;i&amp;gt;=0;i--) {&lt;br /&gt;
             var box = document.forms[&#039;fulltext-search&#039;].elements[i];&lt;br /&gt;
             if (box.value) {&lt;br /&gt;
                 textstring += fields[i] + box.value + &#039; &#039;;&lt;br /&gt;
             }&lt;br /&gt;
         }&lt;br /&gt;
 &lt;br /&gt;
         // popolo la seconda form con la stringa ricavata dalla prima&lt;br /&gt;
         document.forms[&#039;simple-search&#039;].elements[0].value = textstring;&lt;br /&gt;
 &lt;br /&gt;
         // sottometto la seconda form invece della prima&lt;br /&gt;
         document.forms[&#039;simple-search&#039;].submit();&lt;br /&gt;
     }&lt;br /&gt;
     &amp;lt;/script&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;fulltext-search&amp;quot; action=&amp;quot;#&amp;quot; method=&amp;quot;get&amp;quot; onsubmit=&amp;quot;MangleData(); return false&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Text&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;Text&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Queue&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectQueue, NamedValues =&amp;gt; 1, Name =&amp;gt; &#039;Queue&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Requestor&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/EmailInput, Name =&amp;gt; &#039;Requestor&#039;, Size =&amp;gt; &#039;40&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Owner&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectOwner, ValueAttribute =&amp;gt; &amp;quot;Name&amp;quot;, Name =&amp;gt; &amp;quot;Owner&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;submit&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
                 &amp;lt;input class=&amp;quot;button&amp;quot; type=&amp;quot;submit&amp;quot; value=&amp;quot;Submit&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/div&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;input2&amp;quot; action=&amp;quot;/Search/Simple.html&amp;quot; method=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input style=&amp;quot;display:none&amp;quot; type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;q&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
 &amp;lt;/&amp;amp;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
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&#039;t have it, copy it from RT_Config.pm.&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
 &amp;gt; rm -rf /opt/rt4/var/mason_data/obj/*&lt;br /&gt;
 &amp;gt; svcadm restart apache22&lt;br /&gt;
Then, in RT, click on the &amp;quot;EDIT&amp;quot; box in the top right corner and add FTSearch to your home page.&lt;br /&gt;
&lt;br /&gt;
That&#039;s all! Hope you enjoy it.&lt;br /&gt;
&lt;br /&gt;
[[Cris]]&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=IntegrateSphinx&amp;diff=5361</id>
		<title>IntegrateSphinx</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=IntegrateSphinx&amp;diff=5361"/>
		<updated>2016-06-20T06:54:35Z</updated>

		<summary type="html">&lt;p&gt;Cris70: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
= Integrating the Sphinx full-text search engine in RT =&lt;br /&gt;
&lt;br /&gt;
[http://sphinxsearch.com/ homepage Sphinx]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== What is Sphinx? ==&lt;br /&gt;
&lt;br /&gt;
Sphinx is a free open-source SQL full-text search engine. As they put it on their site: How do you implement full-text search for that 10+ million row table, keep up with the load, and stay relevant? Sphinx is good at those kinds of riddles.&lt;br /&gt;
&lt;br /&gt;
Basically, Sphinx scans your database and builds his own indexes for blazingly-fast full-text searches.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Why? ==&lt;br /&gt;
&lt;br /&gt;
Well, we needed fast full-text searches, and what RT offers is not enough. It is slow and it causes a high load on the db server.&lt;br /&gt;
&lt;br /&gt;
I saw a reference to Sphinx on the RT users mailing list, and - after exploring a few alternatives and verifying no one had already did it - proceeded to integrate it into our RT installation.&lt;br /&gt;
&lt;br /&gt;
I am going to illustrate here all the steps we put in place to have Sphinx completely integrated in RT. The work required a couple of weeks of my spare time and that of two other colleagues.&lt;br /&gt;
&lt;br /&gt;
Unfortunately I am not able to package this as a proper extension, but I hope this docs will help those who want to do the same. Maybe someone will feel inspired enough to package it for the benefit of the community, or maybe [http://wiki.bestpractical.com/view/JesseVincent Jesse] will decide to integrate it into RT out of the box. Who knows?&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== First: setting up Sphinx ==&lt;br /&gt;
&lt;br /&gt;
==== Intro ====&lt;br /&gt;
&lt;br /&gt;
First of all, you have to go to the [http://sphinxsearch.com/ Sphinx homepage], download and compile the sources. Or you can choose among the provided binary packages.&lt;br /&gt;
&lt;br /&gt;
We decided to go with version 1.10-beta, the most recent at the time of our installation.&lt;br /&gt;
&lt;br /&gt;
At this point you have to decide if you want to use &#039;&#039;&#039;real-time indexes&#039;&#039;&#039; or the more traditional &#039;&#039;&#039;full+delta&#039;&#039;&#039; approach to indexes.&lt;br /&gt;
&lt;br /&gt;
I will describe here briefly the meaning of these two options; if you want more infos please refer to the Sphinx homepage.&lt;br /&gt;
&lt;br /&gt;
Real-time indexes (on the Sphinx site they call them RT-indexes... quite confusing, uh?) are a clever way to have your indexes always updated, up to the millisecond. They are however still in beta (as of 1.10-beta) and they are more complex to set up and update. We wanted a quick solution, so we chose the traditional way.&lt;br /&gt;
&lt;br /&gt;
The traditional way consists of having two indexes: one &#039;&#039;&#039;big&#039;&#039;&#039; index comprising all tickets up to a certain date (or to a certain ID), and a small &#039;&#039;&#039;delta&#039;&#039;&#039; index for the rest of the tickets. You can use only one big index, but it will take a few minutes to build it so you cannot refresh it too frequently. If you use the full+delta approach you can build the big index e.g. once a day and the delta index once every few minutes.&lt;br /&gt;
&lt;br /&gt;
Presently we have about 15 thousand tickets in our RT db; we build the full index every morning, indexing everything up to the first day of the current month: it takes about 8 minutes. The delta index (from start of month to now) is built every 5 minutes and it takes about a couple seconds.&lt;br /&gt;
&lt;br /&gt;
At this point I should probably say that we are running RT on two solaris servers: one for the presentation and one for the DB. Sphinx runs on the DB side.&lt;br /&gt;
&lt;br /&gt;
==== Sphinx setup ====&lt;br /&gt;
&lt;br /&gt;
First thing to do is to tell Sphinx where your database is, what kind of database engine you use and how to scan your data.&lt;br /&gt;
&lt;br /&gt;
You tell Sphinx all these things in the file sphinx.conf (we have it in /usr/local/etc). Here is our sphinx.conf:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;#&lt;br /&gt;
   # Sphinx configuration&lt;br /&gt;
   #&lt;br /&gt;
   &lt;br /&gt;
   source rt3&lt;br /&gt;
   {&lt;br /&gt;
   	type			= mysql&lt;br /&gt;
   &lt;br /&gt;
   	sql_host		= localhost&lt;br /&gt;
   	sql_user		= AMENDED&lt;br /&gt;
   	sql_pass		= AMENDED&lt;br /&gt;
   	sql_db			= rt3&lt;br /&gt;
   	sql_port		= 3306	# optional, default is 3306&lt;br /&gt;
   &lt;br /&gt;
   	sql_query		= \&lt;br /&gt;
   		select TK.id as TicketNum, \&lt;br /&gt;
   			TK.Creator as CreatedBy, \&lt;br /&gt;
   			TK.Queue as Queue, \&lt;br /&gt;
   			unix_timestamp(convert_tz(TK.Created,&#039;GMT&#039;,&#039;Europe/Rome&#039;)) as Created, \&lt;br /&gt;
   			TK.Subject as Subject, \&lt;br /&gt;
   			group_concat(cast(A.Content as char)) as Content \&lt;br /&gt;
   		from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
   		where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
   		and A.TransactionId = T.id \&lt;br /&gt;
   		and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
   		and A.ContentType = &#039;text/plain&#039; \&lt;br /&gt;
   		and A.Content is not null \&lt;br /&gt;
   		and TK.Created &amp;amp;lt; concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) \&lt;br /&gt;
   		group by TK.id \&lt;br /&gt;
   		order by TK.id, T.id&lt;br /&gt;
   &lt;br /&gt;
   	sql_attr_uint		= Created&lt;br /&gt;
   	sql_attr_uint		= Queue&lt;br /&gt;
   	sql_attr_uint		= CreatedBy&lt;br /&gt;
   &lt;br /&gt;
   	sql_query_info		= SELECT * FROM Tickets WHERE id=$id&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   source rt3delta : rt3&lt;br /&gt;
   {&lt;br /&gt;
   	sql_query		= \&lt;br /&gt;
   		select TK.id as TicketNum, \&lt;br /&gt;
   			TK.Creator as CreatedBy, \&lt;br /&gt;
   			TK.Queue as Queue, \&lt;br /&gt;
   			unix_timestamp(convert_tz(TK.Created,&#039;GMT&#039;,&#039;Europe/Rome&#039;)) as Created, \&lt;br /&gt;
   			TK.Subject as Subject, \&lt;br /&gt;
   			group_concat(cast(A.Content as char)) as Content \&lt;br /&gt;
   		from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
   		where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
   		and A.TransactionId = T.id \&lt;br /&gt;
   		and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
   		and A.ContentType = &#039;text/plain&#039; \&lt;br /&gt;
   		and A.Content is not null \&lt;br /&gt;
   		and TK.Created between concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) and last_day(now()) \&lt;br /&gt;
   		group by TK.id \&lt;br /&gt;
   		order by TK.id, T.id&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   index fulltext1&lt;br /&gt;
   {&lt;br /&gt;
   	source			= rt3&lt;br /&gt;
   	path			= /var/data/fulltext1&lt;br /&gt;
   	docinfo			= extern&lt;br /&gt;
   	charset_type	= sbcs&lt;br /&gt;
   	min_infix_len 	= 3&lt;br /&gt;
   	enable_star     = 1&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   index fulltextdelta: fulltext1&lt;br /&gt;
   {&lt;br /&gt;
   	source			= rt3delta&lt;br /&gt;
   	path			= /var/data/fulltextdelta&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   indexer&lt;br /&gt;
   {&lt;br /&gt;
   	mem_limit		= 32M&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   searchd&lt;br /&gt;
   {&lt;br /&gt;
   	listen			= 9312&lt;br /&gt;
   	listen			= 9306:mysql41&lt;br /&gt;
   	log				= /var/log/searchd.log&lt;br /&gt;
   	query_log		= /var/log/query.log&lt;br /&gt;
   	read_timeout	= 5&lt;br /&gt;
   	max_children	= 30&lt;br /&gt;
   	pid_file		= /var/log/searchd.pid&lt;br /&gt;
   	max_matches		= 1000&lt;br /&gt;
   	seamless_rotate		= 1&lt;br /&gt;
   	preopen_indexes		= 0&lt;br /&gt;
   	unlink_old		= 1&lt;br /&gt;
   	workers			= threads # for RT to work&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s see what we have in this configuration file.&lt;br /&gt;
&lt;br /&gt;
First we define a &#039;&#039;&#039;data source&#039;&#039;&#039;, that I have named (with lots of fantasy!) &amp;lt;code&amp;gt;rt3&amp;lt;/code&amp;gt;. A data source tells Sphinx where to get data to feed its indexes. We tell Sphinx the type of source (&amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt;), where it is (&amp;lt;code&amp;gt;localhost&amp;lt;/code&amp;gt;), and how to retrieve the data (the &amp;lt;code&amp;gt;sqlquery&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
There is one &#039;&#039;&#039;VERY&#039;&#039;&#039; important thing in this section: every column that is returned by the query is indexed for full text search, unless you declare it as an &amp;lt;u&amp;gt;attribute&amp;lt;/u&amp;gt;. Attributes cannot be searched for text, but they allow you to &#039;&#039;&#039;filter&#039;&#039;&#039; the results.&lt;br /&gt;
&lt;br /&gt;
In our configuration, we return &#039;&#039;&#039;Subject&#039;&#039;&#039; and &#039;&#039;&#039;Content&#039;&#039;&#039; as searchable fields, while the three &amp;lt;code&amp;gt;sql_attr_uint&amp;lt;/code&amp;gt; &amp;lt;u&amp;gt;attributes&amp;lt;/u&amp;gt; can be used to refine the search (i.e. filter).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;NOTE:&amp;lt;/u&amp;gt;&#039;&#039;&#039; We had previously defined the three &amp;lt;u&amp;gt;attributes&amp;lt;/u&amp;gt; according to their content (e.g. the &#039;&#039;&#039;Created&#039;&#039;&#039; attribute was defines as &amp;lt;code&amp;gt;sql_attr_timestamp&amp;lt;/code&amp;gt;), but we have discovered that this configuration would not allow us to use those attributes for filtering. It seems Sphinx can only use &amp;lt;code&amp;gt;sql_attr_uint&amp;lt;/code&amp;gt; for filtering... I don&#039;t know if it&#039;s a temporary limitation, a bug, or working as designed.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;sql_query_info&#039;&#039;&#039; has to return a hit for every $id ($id is an implicit variable, which contains the first column returned by the sql_query. It &#039;&#039;&#039;MUST&#039;&#039;&#039; be an integer.).&lt;br /&gt;
&lt;br /&gt;
We then define another data source (&amp;lt;code&amp;gt;rt3delta&amp;lt;/code&amp;gt;) which we derive from &amp;lt;code&amp;gt;rt3&amp;lt;/code&amp;gt;. Everything defined in the &amp;lt;code&amp;gt;rt3&amp;lt;/code&amp;gt; data source is inherited by &amp;lt;code&amp;gt;rt3delta&amp;lt;/code&amp;gt;, save for what we override (&amp;lt;code&amp;gt;sqlquery&amp;lt;/code&amp;gt; in this case). As you can see, the queries are very similar; only the date range is different.&lt;br /&gt;
&lt;br /&gt;
After data sources we define &#039;&#039;&#039;indexes&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
First index is &amp;lt;code&amp;gt;fulltext1&amp;lt;/code&amp;gt;. Everything should be pretty intuitive, but for the two &amp;lt;code&amp;gt;min_infix_len&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;enable_star&amp;lt;/code&amp;gt; fields. By default Sphinx only indexes full words, but it would be very nice to be able to search for partial words by using wildcard characters. So here it is: &amp;lt;code&amp;gt;min_infix_len&amp;lt;/code&amp;gt; tells Sphinx the minimum length of subwords to index, and &amp;lt;code&amp;gt;enable_star&amp;lt;/code&amp;gt; tells it that we want to be able to use star as wildcard character. This way you can search for the word &#039;&#039;&#039;minimum&#039;&#039;&#039; by using &amp;lt;code&amp;gt;min*&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;*nim*&amp;lt;/code&amp;gt;, but not by using &amp;lt;code&amp;gt;mi*&amp;lt;/code&amp;gt; (because we told Sphinx the minimum length for subwords is 3 chars).&lt;br /&gt;
&lt;br /&gt;
The second index is &amp;lt;code&amp;gt;fulltextdelta&amp;lt;/code&amp;gt;, which is derived from &amp;lt;code&amp;gt;fulltext&amp;lt;/code&amp;gt;. As we saw above, everything is inherited but for things we explicitely override.&lt;br /&gt;
&lt;br /&gt;
At last we give some parameters for the inner working of &amp;lt;code&amp;gt;indexer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;searchd&amp;lt;/code&amp;gt;, which are two of the command line tools of Sphinx. The values shown here are good defaults.&lt;br /&gt;
&lt;br /&gt;
==== Building the indexes ====&lt;br /&gt;
&lt;br /&gt;
Now that we have a working configuration, it&#039;s time to build the indexes.&lt;br /&gt;
&lt;br /&gt;
You can initialize the indexes with the command:&lt;br /&gt;
&lt;br /&gt;
 /usr/local/bin/indexer --all&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
This will build all the indexes, and it will give you an idea of the time and disk space required for each index.&lt;br /&gt;
&lt;br /&gt;
For production use however, you want to put the commands in &amp;lt;code&amp;gt;cron&amp;lt;/code&amp;gt; so that indexes are refreshed regularly and automatically.&lt;br /&gt;
&lt;br /&gt;
We refresh the &amp;lt;code&amp;gt;fulltext1&amp;lt;/code&amp;gt; index once a day at 7 a.m., with this command:&lt;br /&gt;
&lt;br /&gt;
 /usr/local/bin/indexer --rotate fulltext1&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;code&amp;gt;--rotate&amp;lt;/code&amp;gt; allows the index to be substituted while the search daemon is running.&lt;br /&gt;
&lt;br /&gt;
We refresh the &amp;lt;code&amp;gt;fulltextdelta&amp;lt;/code&amp;gt; index every 5 minutes with this command:&lt;br /&gt;
&lt;br /&gt;
 /usr/local/bin/indexer --rotate fulltextdelta&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
==== The search daemon ====&lt;br /&gt;
&lt;br /&gt;
Once you have built the indexes you can start searching from the command line with the &amp;lt;code&amp;gt;search&amp;lt;/code&amp;gt; tool. When you are confident your setup is correct, it&#039;s time to start the search daemon.&lt;br /&gt;
&lt;br /&gt;
We do this with the command&lt;br /&gt;
&lt;br /&gt;
 /usr/local/bin/searchd --config /usr/local/etc/sphinx.conf&lt;br /&gt;
&lt;br /&gt;
In our experience &amp;lt;code&amp;gt;searchd&amp;lt;/code&amp;gt; is not very stable (probably due to the beta release): it stops responding after a couple days of uptime, so we restart it daily.&lt;br /&gt;
&lt;br /&gt;
With this last step you have Sphinx all set up and working, so the first part of this tutorial ends here. Please note that Sphinx has a &#039;&#039;&#039;lot&#039;&#039;&#039; of options, that I have not described. I only describe here the options that proved useful for us. If you want to know more about Sphinx please refer to the Sphinx home page.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Second: using the API to query Sphinx ==&lt;br /&gt;
&lt;br /&gt;
So we now have Sphinx up and running and fully populated indexes that return correct results, but now we need to be able to interrogate Sphinx&#039; indexes from RT.&lt;br /&gt;
&lt;br /&gt;
To do this you have to talk to the search daemon, which speaks his own language: the Sphinx API. There are several implementations (PHP, Java, Python and even a third-party Perl API), but since we are mostly familiar with PHP we are going to use it to implement our interface.&lt;br /&gt;
&lt;br /&gt;
Before posting the actual PHP script, there are a few things I have to point out:&lt;br /&gt;
&lt;br /&gt;
* Mason does not support PHP out of the box, so we did a little hack that I&#039;ll explain later&lt;br /&gt;
* The script you&#039;ll see here contains in-line CSS to adapt the results to the default look of RT (web2). If you&#039;re using a different style you may want to change the inline CSS accordingly.&lt;br /&gt;
* The script spits out all the results in one page: there&#039;s still no support for pagination a-la RT.&lt;br /&gt;
* The script spits out &#039;&#039;&#039;ALL&#039;&#039;&#039; the results, including deleted, rejected, merged tickets.&lt;br /&gt;
&lt;br /&gt;
You see, the script is still a little rough, but I hope we&#039;ll be able to refine it with the help of the community.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;sphinx.php follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;html&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;head&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;title&amp;amp;gt;Ricerca Ticket Sphinx&amp;amp;lt;/title&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 		&amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
 			document.domain = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 		&amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 		&amp;amp;lt;style&amp;amp;gt;&lt;br /&gt;
 			body {font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}&lt;br /&gt;
 			table {font-size:inherit;font:100%;}&lt;br /&gt;
 			pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}&lt;br /&gt;
 &lt;br /&gt;
 			a {&lt;br /&gt;
 				color: #000;&lt;br /&gt;
 				text-decoration: none;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			div#body a:visited {&lt;br /&gt;
 				color: #666;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			/* background: #547CCC ; */&lt;br /&gt;
 			body {&lt;br /&gt;
 				padding:0;&lt;br /&gt;
 				margin:0;&lt;br /&gt;
 &lt;br /&gt;
 				background: #FFFFFF ;&lt;br /&gt;
 				font-family: arial, helvetica, sans-serif;&lt;br /&gt;
 &lt;br /&gt;
 				color: #000000;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list, table.queue-summary, table.collection {&lt;br /&gt;
 				margin-top: 0.75em;&lt;br /&gt;
 				font-size: 0.9em;&lt;br /&gt;
 				border: 1px solid #aaa;&lt;br /&gt;
 				border-bottom: 2px solid #999;&lt;br /&gt;
 				border-right: 2px solid #999;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary tr&amp;amp;gt;*:first-child {&lt;br /&gt;
 				padding-left: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary tr&amp;amp;gt;*:last-child {&lt;br /&gt;
 				padding-right: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list a, table.queue-summary a, table.collection a  {&lt;br /&gt;
 				font-weight: bold;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list th.collection-as-table, table.collection th.collection-as-table {&lt;br /&gt;
 				background: #ddd;&lt;br /&gt;
 				font-size: 0.9em;&lt;br /&gt;
 				margin-bottom: 0.5em;&lt;br /&gt;
 				text-align: left;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary th.collection-as-table {&lt;br /&gt;
 				font-size: 0.9em;&lt;br /&gt;
 				margin-bottom: 0.5em;&lt;br /&gt;
 				text-align: right;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary th.collection-as-table:first-child {&lt;br /&gt;
 				text-align: left;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.collection-as-table+tr.collection-as-table th {&lt;br /&gt;
 				border-bottom: 2px solid grey;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary td {&lt;br /&gt;
 				background: #efefef;&lt;br /&gt;
 				border-bottom: 1px solid #ccc;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.evenline td {&lt;br /&gt;
 				background: #eee;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.oddline td {&lt;br /&gt;
 				background: #fff;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.evenline td, tr.oddline td {&lt;br /&gt;
 				padding-top: 0.5em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.evenline+tr.evenline td, tr.oddline+tr.oddline td{&lt;br /&gt;
 				padding-top: 0;&lt;br /&gt;
 				border: none;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list td:first-child, table.ticket-list th:first-child {&lt;br /&gt;
 				padding-left: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list td:last-child, table.ticket-list th:last-child {&lt;br /&gt;
 				padding-right: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			th.collection-as-table , td.collection-as-table {&lt;br /&gt;
 				padding-right: 0.5em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			.pagenum.a:hover, .paging a.nav:hover{&lt;br /&gt;
 				text-decoration: underline;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			.pagenum *, .paging a.nav{&lt;br /&gt;
 				padding: .5em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			.currentpage{&lt;br /&gt;
 				text-decoration: none;&lt;br /&gt;
 				font-weight: bold;&lt;br /&gt;
 				background: #eee;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			div.paging{&lt;br /&gt;
 				text-align: center;&lt;br /&gt;
 				padding-bottom: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			#body&amp;amp;gt;table.ticket-list {&lt;br /&gt;
 				margin-bottom: 2em;&lt;br /&gt;
 			}&lt;br /&gt;
 		&amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;/head&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;body&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;?php&lt;br /&gt;
 		//Costante con il max numero di righe ritornate da Sphinx&lt;br /&gt;
 		define(&#039;SPHINX_MAX_LIMIT&#039;, 1000);&lt;br /&gt;
 &lt;br /&gt;
 		require_once(&amp;quot;Classi/sphinxapi.php&amp;quot;);&lt;br /&gt;
 		require_once(&amp;quot;Classi/Timer.class.php&amp;quot;);&lt;br /&gt;
 		require_once(&amp;quot;Classi/MySql.class.php&amp;quot;);&lt;br /&gt;
 		include_once(&amp;quot;Include/Query.inc.php&amp;quot;);&lt;br /&gt;
 		include_once(&amp;quot;Include/dvopendb.config.inc.php&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 		$MyTimer =  new Timer();&lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Parametri di connessione al Daemon Sphinx&lt;br /&gt;
 		$host = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 		$port = 9312;&lt;br /&gt;
 		$index = &amp;quot;*&amp;quot;; // put your index name here&lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Variabili in GET&lt;br /&gt;
 		$query = $_GET[&#039;Text&#039;];&lt;br /&gt;
 		$RequestorFilter = trim($_GET[&#039;Requestor&#039;]);&lt;br /&gt;
 		$CodaFilter = $_GET[&#039;Queue&#039;];&lt;br /&gt;
 		$DataInizioFilter = trim($_GET[&#039;From&#039;]);&lt;br /&gt;
 		$DataFineFilter = trim($_GET[&#039;To&#039;]);&lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Connessione al Daemon Sphinx&lt;br /&gt;
 		$cl = new SphinxClient();&lt;br /&gt;
 		$cl-&amp;amp;gt;SetServer($host, $port);&lt;br /&gt;
 		$cl-&amp;amp;gt;SetMatchMode(SPH_MATCH_EXTENDED2);&lt;br /&gt;
 		$cl-&amp;amp;gt;SetLimits(0,SPHINX_MAX_LIMIT, $max_matches=0, $cutoff=0 );&lt;br /&gt;
 &lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//MySql Database Query per la retrive dei dati del ticket&lt;br /&gt;
 &lt;br /&gt;
 		$SqlQuery = new MySql($DbHostName,$DbUser,$DbPassword,$DbName);&lt;br /&gt;
 		$SqlQuery-&amp;amp;gt;Connetti();&lt;br /&gt;
 &lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Filtri sulla ricerca Sphinx&lt;br /&gt;
 &lt;br /&gt;
 		//Check della query (parametro di ricerca)&lt;br /&gt;
 		if(strlen($query)==0)&lt;br /&gt;
 		{&lt;br /&gt;
 			echo &amp;quot;E&#039; necessario inserire un parametro di ricerca nella casella \&amp;quot;Text\&amp;quot; per proseguire.&amp;quot;;&lt;br /&gt;
 			exit(1);&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Filtro Requestor&lt;br /&gt;
 		if(strlen($RequestorFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			$TempQuery = sprintf($RequestorLookUpQuery,mysql_real_escape_string($RequestorFilter));&lt;br /&gt;
 			$SqlQuery-&amp;amp;gt;ExecQuery($TempQuery);&lt;br /&gt;
 			$RequestorResult = $SqlQuery-&amp;amp;gt;GetMonoArrayResult();&lt;br /&gt;
 			if(count($RequestorResult)&amp;amp;gt;0)&lt;br /&gt;
 			{&lt;br /&gt;
 				$cl-&amp;amp;gt;SetFilter (&amp;quot;createdby&amp;quot;,array($RequestorResult[&#039;id&#039;]) , $exclude=false );&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;&amp;amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;amp;gt;Warning - L&#039;indirizzo \&amp;quot;&amp;quot;.$RequestorFilter.&amp;quot;\&amp;quot; non e&#039; presente nel Database; La ricerca e&#039; stata effettuata per tutti i richiedenti&amp;amp;lt;/label&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 			}&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Filtro Queue&lt;br /&gt;
 		if(strlen($CodaFilter)&amp;amp;gt;0)&lt;br /&gt;
 			$cl-&amp;amp;gt;SetFilter (&amp;quot;queue&amp;quot;, array($CodaFilter), $exclude=false );&lt;br /&gt;
 &lt;br /&gt;
 		//Filtro Data&lt;br /&gt;
 &lt;br /&gt;
 		//__________________________________________________________________________________________________________________&lt;br /&gt;
 		//Check delle date&lt;br /&gt;
 		if(strlen($DataInizioFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			//Check Datainizio&lt;br /&gt;
 			if(checkdate(substr($DataInizioFilter,5,2),substr($DataInizioFilter,8,2),substr($DataInizioFilter,0,4))==false)&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;Data Inizio &amp;quot;.$DataInizioFilter.&amp;quot; non corretta &amp;quot;;&lt;br /&gt;
 				exit(1);&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 				 $DataInizio = mktime(0, 0, 0, substr($DataInizioFilter,5,2), substr($DataInizioFilter,8,2), substr($DataInizioFilter,0,4));&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if(strlen($DataFineFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{	//Check DataFine&lt;br /&gt;
 &lt;br /&gt;
 			if(checkdate(substr($DataFineFilter,5,2),substr($DataFineFilter,8,2),substr($DataFineFilter,0,4))==false)&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;Data Fine &amp;quot;.$DataFineFilter.&amp;quot; non corretta &amp;quot;;&lt;br /&gt;
 				exit(1);&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 				$DataFine = mktime(0, 0, 0, substr($DataFineFilter,5,2), substr($DataFineFilter,8,2), substr($DataFineFilter,0,4));&lt;br /&gt;
 		}&lt;br /&gt;
 		//__________________________________________________________________________________________________________________&lt;br /&gt;
 &lt;br /&gt;
 		//Filtraggio vero e proprio&lt;br /&gt;
 &lt;br /&gt;
 		//Se sono settate entrambe...&lt;br /&gt;
 		if(strlen($DataInizioFilter)&amp;amp;gt;0 &amp;amp;amp;&amp;amp;amp; strlen($DataFineFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			if($DataInizio &amp;amp;lt; $DataFine)&lt;br /&gt;
 			{&lt;br /&gt;
 				//Se sono settate entrambe le date filtro per entrambe&lt;br /&gt;
 				$cl-&amp;amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, $DataFine, $exclude=false );&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;La data Inizio &amp;quot;.$DataInizioFilter.&amp;quot; e&#039; maggiore della data di fine &amp;quot;.$DataFineFilter;&lt;br /&gt;
 				exit(1);&lt;br /&gt;
 			}&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Se solo DataInizio..&lt;br /&gt;
 		if(strlen($DataInizioFilter)&amp;amp;gt;0 &amp;amp;amp;&amp;amp;amp; strlen($DataFineFilter)==0)&lt;br /&gt;
 		{&lt;br /&gt;
 			$cl-&amp;amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, mktime(), $exclude=false );&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Se solo DataFine..&lt;br /&gt;
 		if(strlen($DataInizioFilter)==0 &amp;amp;amp;&amp;amp;amp; strlen($DataFineFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			//2008-11-14 : Data del primo Ticket di RT&lt;br /&gt;
 			//1988-07-18 : Data di nascita di AMENDED :)&lt;br /&gt;
 			$cl-&amp;amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, mktime(0, 0, 0,07,18,1988), $DataFine, $exclude=false );&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Eseguo la Query su Sphinx&lt;br /&gt;
 &lt;br /&gt;
 		$res = $cl-&amp;amp;gt;Query($query, $index);&lt;br /&gt;
 		if ($res == false)&lt;br /&gt;
 		{&lt;br /&gt;
 			echo &amp;quot;failure: &amp;quot;.$cl-&amp;amp;gt;GetLastError().&amp;quot;\n&amp;quot;;&lt;br /&gt;
 		}&lt;br /&gt;
 		else&lt;br /&gt;
 		{&lt;br /&gt;
 			if(count($res[&amp;quot;matches&amp;quot;])!=0)&lt;br /&gt;
 			{&lt;br /&gt;
 				//Se i risultati totali sono &amp;amp;gt; 1000&lt;br /&gt;
 				if($res[total_found]&amp;amp;gt;SPHINX_MAX_LIMIT)&lt;br /&gt;
 				{&lt;br /&gt;
 					echo &amp;quot;&amp;amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;amp;gt;Warning - Sono stati trovati &amp;quot;.$res[total_found].&amp;quot; risultati, verrano visualizzati solo i primi &amp;quot;.SPHINX_MAX_LIMIT.&amp;quot;&amp;amp;lt;/label&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 				}&lt;br /&gt;
 &lt;br /&gt;
 				//Se ci sono dei risultati creo la tabella e stampo&lt;br /&gt;
 				echo &amp;quot;&amp;amp;lt;table id=&#039;ResultTable&#039; class=&#039;ticket-list&#039; border=&#039;0&#039; cellspacing=&#039;0&#039; cellpadding=&#039;1&#039; width=&#039;100%&#039;&amp;amp;gt;&lt;br /&gt;
 						&amp;amp;lt;thead&amp;amp;gt;&lt;br /&gt;
 						&amp;amp;lt;tr class=&#039;collection-as-table&#039;&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;#&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Oggetto&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Coda&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Status&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Creato&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Richiedente&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Proprietario&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 						&amp;amp;lt;/tr&amp;amp;gt;&lt;br /&gt;
 						&amp;lt;/thead&amp;gt;&amp;lt;tbody&amp;gt;&amp;quot;;&lt;br /&gt;
 				foreach ($res[&amp;quot;matches&amp;quot;] as $key=&amp;amp;gt;$value)&lt;br /&gt;
 				{&lt;br /&gt;
 					$i++;&lt;br /&gt;
 					$TempQuery = sprintf($TicketDetailQuery,mysql_real_escape_string($key));&lt;br /&gt;
 					$SqlQuery-&amp;amp;gt;ExecQuery($TempQuery);&lt;br /&gt;
 					$Risultato = $SqlQuery-&amp;amp;gt;GetMonoArrayResult();&lt;br /&gt;
 					if($i%2==0)&lt;br /&gt;
 					{&lt;br /&gt;
 						echo &amp;quot;	&amp;amp;lt;tr class=&#039;evenline&#039;&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 								&amp;amp;lt;/tr&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 					}&lt;br /&gt;
 					else&lt;br /&gt;
 					{&lt;br /&gt;
 						echo &amp;quot;	&amp;amp;lt;tr class=&#039;oddline&#039;&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 								&amp;amp;lt;/tr&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 					}&lt;br /&gt;
 				}&lt;br /&gt;
 				echo &amp;quot;	&amp;lt;/tbody&amp;gt;&lt;br /&gt;
 					&amp;lt;tfoot&amp;gt;&amp;lt;/tfoot&amp;gt;&lt;br /&gt;
 					&amp;lt;/table&amp;gt;&amp;quot;;&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 			{&lt;br /&gt;
 				//...Altrimenti stampo che non ho trovato nulla&lt;br /&gt;
 				echo &amp;quot;&amp;amp;lt;br/&amp;amp;gt;&amp;amp;lt;label class=\&amp;quot;notfoundlabel\&amp;quot;&amp;amp;gt;Nessun risultato trovato&amp;amp;lt;/label&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			echo &amp;quot;Trovati &amp;quot;.$res[total].&amp;quot; di &amp;quot;.$res[total_found].&amp;quot; in &amp;quot;.$MyTimer-&amp;amp;gt;elapsed().&amp;quot; secondi&amp;quot;;&lt;br /&gt;
 		}&lt;br /&gt;
 		?&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;dvopendb.config.inc.php follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;?php&lt;br /&gt;
 $DbHostName = &amp;quot;HOSTNAME_AMENDED:3306/rt3&amp;quot;;&lt;br /&gt;
 $DbUser = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 $DbPassword = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 $DbName = &amp;quot;rt3&amp;quot;;&lt;br /&gt;
 $DbQuery = &amp;quot;select EmailAddress, RealName from Users&amp;quot;;&lt;br /&gt;
 ?&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;Query.inc.php follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;?php&lt;br /&gt;
 $TicketDetailQuery =&lt;br /&gt;
 &amp;quot;select Tickets.id,Subject,Status,Tickets.Created as Created,U1.Name as Requestor,U2.Name as Owner,Queues.Name as Queue&lt;br /&gt;
 from Tickets left outer join Users U1&lt;br /&gt;
 on U1.id = Tickets.Creator&lt;br /&gt;
 left outer join  Users U2&lt;br /&gt;
 on U2.id = Tickets.Owner&lt;br /&gt;
 left outer join Queues&lt;br /&gt;
 on  Queue = Queues.id&lt;br /&gt;
 where Tickets.id = %s&lt;br /&gt;
 &amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 $RequestorLookUpQuery =&lt;br /&gt;
 &amp;quot;select id&lt;br /&gt;
 from Users&lt;br /&gt;
 where EmailAddress = &#039;%s&#039;&lt;br /&gt;
 &amp;quot;;&lt;br /&gt;
 ?&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
This ends the step regarding the use of the Sphinx API to query the &amp;lt;code&amp;gt;searchd&amp;lt;/code&amp;gt; daemon.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Third: integrating it all into RT ==&lt;br /&gt;
&lt;br /&gt;
Now we need a way to call the php script from within RT. Well, technically we don&#039;t &#039;&#039;&#039;need&#039;&#039;&#039; it, but it would be very nice to have.&lt;br /&gt;
&lt;br /&gt;
For this task I found very useful the [[WritingPortlets]] section of this wiki, written by Andy D&#039;Arcy Jewell (thank you!)&lt;br /&gt;
&lt;br /&gt;
So the first thing I did was writing a portlet that one can integrate in the &amp;quot;RT at a glance&amp;quot; page.&lt;br /&gt;
&lt;br /&gt;
I put it in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/Elements. The portlet itself is in a file called SphinxSearch.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;SphinxSearch follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;&amp;amp;|/Widgets/TitleBox, title =&amp;gt; loc(&#039;Fulltext Search (Sphinx)&#039;), bodyclass =&amp;gt; &amp;quot;&amp;quot;,&lt;br /&gt;
     titleright =&amp;gt; loc(&#039;HELP&#039;), titleright_href =&amp;gt; RT-&amp;gt;Config-&amp;gt;Get(&#039;WebPath&#039;).&#039;/Prefs/SphinxHelp.html&#039;&amp;amp;&amp;gt;&lt;br /&gt;
  	&amp;lt;form name=&amp;quot;input&amp;quot; action=&amp;quot;/Tools/sphinx.html&amp;quot; method=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt;
  		&amp;lt;table&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Text&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;input type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;Text&amp;quot; /&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Queue&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;&amp;amp; /Elements/SelectQueue, Name =&amp;gt; &#039;Queue&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Requestor&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;&amp;amp; /Elements/EmailInput, Name =&amp;gt; &#039;Requestor&#039;, Size =&amp;gt; &#039;40&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;From&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;&amp;amp; /Elements/SelectDate, Name =&amp;gt; &amp;quot;From&amp;quot; || &#039;&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;To&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;&amp;amp; /Elements/SelectDate, Name =&amp;gt; &amp;quot;To&amp;quot; || &#039;&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  		&amp;lt;/table&amp;gt;&lt;br /&gt;
  		&amp;lt;div class=&amp;quot;submit&amp;quot;&amp;gt;&lt;br /&gt;
  			&amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;input class=&amp;quot;button&amp;quot; type=&amp;quot;submit&amp;quot; value=&amp;quot;Submit&amp;quot; /&amp;gt;&lt;br /&gt;
  			&amp;lt;/div&amp;gt;&lt;br /&gt;
  		&amp;lt;/div&amp;gt;&lt;br /&gt;
  	&amp;lt;/form&amp;gt;&lt;br /&gt;
  &amp;lt;/&amp;amp;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the result:&lt;br /&gt;
&lt;br /&gt;
[[File:Rt3p.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to keep the look and feel of RT by copying code from the other portlets. I even used RT syntax to allow the localization of string, but not everything gets translated since not all the terms are in RT resource files.&lt;br /&gt;
&lt;br /&gt;
Since Sphinx&#039; extended search syntax can be very elaborated, I put a HELP link in the upper right corner (circled in red in the image above). This points to a page that I extracted from Sphinx&#039; documentation. The page is in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/Prefs. The file is called SphinxHelp.html.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;SphinxHelp.html follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;&amp;amp;amp; /Elements/Header, Title =&amp;amp;gt; &amp;quot;Sphinx - Free open-source SQL full-text search engine&amp;quot; &amp;amp;amp;&amp;amp;gt;&lt;br /&gt;
 &amp;amp;lt;&amp;amp;amp; /Elements/Tabs,&lt;br /&gt;
 	Title =&amp;amp;gt; &amp;quot;Help for Sphinx search syntax&amp;quot;,&lt;br /&gt;
 	current_tab    =&amp;amp;gt; &#039;index.html&#039;,&lt;br /&gt;
 	current_toptab =&amp;amp;gt; &#039;index.html&#039;,&lt;br /&gt;
 	tabs           =&amp;amp;gt; $tabs,&lt;br /&gt;
 	actions        =&amp;amp;gt; $actions,&lt;br /&gt;
 &amp;amp;amp;&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;div align=&amp;quot;left&amp;quot; class=&amp;quot;refresh&amp;quot;&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
 			&amp;amp;lt;h2 style=&amp;quot;clear: both&amp;quot;&amp;amp;gt;&amp;amp;lt;a name=&amp;quot;extended-syntax&amp;quot;&amp;amp;gt;&amp;amp;lt;/a&amp;amp;gt;Extended query syntax&amp;amp;lt;/h2&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	The following special operators and modifiers can be used when using the extended matching mode:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
 			&amp;amp;lt;ul type=&amp;quot;disc&amp;quot;&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;operator OR: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;hello | world&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;operator NOT:&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 hello -world&lt;br /&gt;
 hello !world&amp;amp;lt;/pre&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;field search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@title hello @body world&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;field position limit modifier (introduced in version 0.9.9-rc1): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@body[50] hello&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;multiple-field search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@(title,body) hello world&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;all-field search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@* hello&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;phrase search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&amp;quot;hello world&amp;quot;&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;proximity search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&amp;quot;hello world&amp;quot;~10&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;quorum matching operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&amp;quot;the world is a wonderful place&amp;quot;/3&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;strict order operator (aka operator &amp;quot;before&amp;quot;): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;aaa &amp;amp;amp;lt;&amp;amp;amp;lt; bbb &amp;amp;amp;lt;&amp;amp;amp;lt; ccc&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;exact form modifier (introduced in version 0.9.9-rc1): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;raining =cats and =dogs&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;field-start and field-end modifier (introduced in version 0.9.9-rc2): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;^hello world$&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 			&amp;amp;lt;/ul&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	Here&#039;s an example query that uses some of these operators:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;div class=&amp;quot;example&amp;quot;&amp;amp;gt;&amp;amp;lt;a name=&amp;quot;ex-extended-query&amp;quot;&amp;amp;gt;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;p class=&amp;quot;title&amp;quot;&amp;amp;gt;&amp;amp;lt;b&amp;amp;gt;Example:&amp;amp;amp;nbsp;Extended matching mode: query example&amp;amp;lt;/b&amp;amp;gt;&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;div class=&amp;quot;example-contents&amp;quot;&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	&amp;quot;hello world&amp;quot; @title &amp;quot;example program&amp;quot;~5 @body python -(php|perl) @* code&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&amp;amp;lt;br class=&amp;quot;example-break&amp;quot;&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	The full meaning of this search is:&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;div class=&amp;quot;itemizedlist&amp;quot;&amp;amp;gt;&amp;amp;lt;ul type=&amp;quot;disc&amp;quot;&amp;amp;gt;&amp;amp;lt;li&amp;amp;gt;Find the words &#039;hello&#039; and &#039;world&#039; adjacently in any field in a document;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;li&amp;amp;gt;Additionally, the same document must also contain the words &#039;example&#039; and &#039;program&#039;&lt;br /&gt;
 		in the title field, with up to, but not including, 10 words between the words in question;&lt;br /&gt;
 		(E.g. &amp;quot;example PHP program&amp;quot; would be matched however &amp;quot;example script to introduce outside data&lt;br /&gt;
 		into the correct context for your program&amp;quot; would not because two terms have 10 or more words between them)&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;li&amp;amp;gt;Additionally, the same document must contain the word &#039;python&#039; in the body field, but not contain either &#039;php&#039; or &#039;perl&#039;;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;li&amp;amp;gt;Additionally, the same document must contain the word &#039;code&#039; in any field.&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/ul&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	There always is implicit AND operator, so &amp;quot;hello world&amp;quot; means that&lt;br /&gt;
 	both &amp;quot;hello&amp;quot; and &amp;quot;world&amp;quot; must be present in matching document.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	OR operator precedence is higher than AND, so &amp;quot;looking for cat | dog | mouse&amp;quot;&lt;br /&gt;
 	means &amp;quot;looking for ( cat | dog | mouse )&amp;quot; and &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;not&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;quot;(looking for cat) | dog | mouse&amp;quot;.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Field limit operator limits subsequent searching to a given field.&lt;br /&gt;
 	Normally, query will fail with an error message if given field name does not exist&lt;br /&gt;
 	in the searched index. However, that can be suppressed by specifying &amp;quot;@@relaxed&amp;quot;&lt;br /&gt;
 	option at the very beginning of the query:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	@@relaxed @nosuchfield my query&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	This can be helpful when searching through heterogeneous indexes with&lt;br /&gt;
 	different schemas.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Field position limit, introduced in version 0.9.9-rc1, additionaly restricts the searching&lt;br /&gt;
 	to first N position within given field (or fields). For example, &amp;quot;@body[50] hello&amp;quot; will&lt;br /&gt;
 	&amp;amp;lt;span class=&amp;quot;bold&amp;quot;&amp;amp;gt;&amp;amp;lt;strong&amp;amp;gt;not&amp;amp;lt;/strong&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt; match the documents where the keyword &#039;hello&#039; occurs at position 51 and below&lt;br /&gt;
 	in the body.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Proximity distance is specified in words, adjusted for word count, and&lt;br /&gt;
 	applies to all words within quotes. For instance, &amp;quot;cat dog mouse&amp;quot;~5 query&lt;br /&gt;
 	means that there must be less than 8-word span which contains all 3 words,&lt;br /&gt;
 	ie. &amp;quot;CAT aaa bbb ccc DOG eee fff MOUSE&amp;quot; document will &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;not&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;&lt;br /&gt;
 	match this query, because this span is exactly 8 words long.&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Quorum matching operator introduces a kind of fuzzy matching.&lt;br /&gt;
 	It will only match those documents that pass a given threshold of given words.&lt;br /&gt;
 	The example above (&amp;quot;the world is a wonderful place&amp;quot;/3) will match all documents&lt;br /&gt;
 	that have at least 3 of the 6 specified words.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Strict order operator (aka operator &amp;quot;before&amp;quot;), introduced in version 0.9.9-rc2,&lt;br /&gt;
 	will match the document only if its argument keywords occur in the document&lt;br /&gt;
 	exactly in the query order. For instance, &amp;quot;black &amp;amp;amp;lt;&amp;amp;amp;lt; cat&amp;quot; query (without&lt;br /&gt;
 	quotes) will match the document &amp;quot;black and white cat&amp;quot; but &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;not&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;&lt;br /&gt;
 	the &amp;quot;that cat was black&amp;quot; document. Order operator has the lowest priority.&lt;br /&gt;
 	It can be applied both to just keywords and more complex expressions,&lt;br /&gt;
 	ie. this is a valid query:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	(bag of words) &amp;amp;amp;lt;&amp;amp;amp;lt; &amp;quot;exact phrase&amp;quot; &amp;amp;amp;lt;&amp;amp;amp;lt; red|green|blue&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	Exact form keyword modifier, introduced in version 0.9.9-rc1, will match the document only if the keyword occurred&lt;br /&gt;
 	in exactly the specified form. The default behaviour is to match the document&lt;br /&gt;
 	if the stemmed keyword matches. For instance, &amp;quot;runs&amp;quot; query will match both&lt;br /&gt;
 	the document that contains &amp;quot;runs&amp;quot; &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;and&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt; the document that&lt;br /&gt;
 	contains &amp;quot;running&amp;quot;, because both forms stem to just &amp;quot;run&amp;quot; - while &amp;quot;=runs&amp;quot;&lt;br /&gt;
 	query will only match the first document. Exact form operator requires&lt;br /&gt;
 	&amp;amp;lt;a href=&amp;quot;#conf-index-exact-words&amp;quot; title=&amp;quot;11.2.39.&amp;amp;amp;nbsp;index_exact_words&amp;quot;&amp;amp;gt;index_exact_words&amp;amp;lt;/a&amp;amp;gt; option to be enabled.&lt;br /&gt;
 	This is a modifier that affects the keyword and thus can be used within&lt;br /&gt;
 	operators such as phrase, proximity, and quorum operators.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Field-start and field-end keyword modifiers, introduced in version 0.9.9-rc2,&lt;br /&gt;
 	will make the keyword match only if it occurred at the very start or the very end&lt;br /&gt;
 	of a fulltext field, respectively. For instance, the query &amp;quot;^hello world$&amp;quot;&lt;br /&gt;
 	(with quotes and thus combining phrase operator and start/end modifiers)&lt;br /&gt;
 	will only match documents that contain at least one field that has exactly&lt;br /&gt;
 	these two keywords.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Starting with 0.9.9-rc1, arbitrarily nested brackets and negations are allowed.&lt;br /&gt;
 	However, the query must be possible to compute without involving an implicit&lt;br /&gt;
 	list of all documents:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	// correct query&lt;br /&gt;
 	aaa -(bbb -(ccc ddd))&lt;br /&gt;
 &lt;br /&gt;
 	// queries that are non-computable&lt;br /&gt;
 	-aaa&lt;br /&gt;
 	aaa | -bbb&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;div align=&amp;quot;right&amp;quot; class=&amp;quot;search-result-actions&amp;quot;&amp;amp;gt;&lt;br /&gt;
 &amp;amp;amp;nbsp;&lt;br /&gt;
 &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;%init&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 my @results;&lt;br /&gt;
 my $skip_create = 1;&lt;br /&gt;
 my $actions;&lt;br /&gt;
 my $tabs = $m-&amp;amp;gt;comp(&amp;quot;/Elements/DashboardTabs&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;/%init&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last part is about passing the form&#039;s (portlet) parameters to the PHP script.&lt;br /&gt;
&lt;br /&gt;
As I told you before, the problem here is that Mason does not support PHP out of the box. I found a few hacks around the web to make Mason support PHP, but they were either not applicable to our environment or too difficult to apply.&lt;br /&gt;
&lt;br /&gt;
So we implemented another hack: since we already have another virtual domain where PHP works, we created an html page that embeds (within an iframe) the results from the PHP page that resides in the other virtual domain.&lt;br /&gt;
&lt;br /&gt;
That&#039;s why you see this little piece of code&lt;br /&gt;
&lt;br /&gt;
         		&amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
         			document.domain = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
         		&amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
in the PHP script above: you have to declare that both the HTML page and the PHP script belong to the same domain (although on different subdomains), otherwise you get a security error in the browser.&lt;br /&gt;
&lt;br /&gt;
The html page is located in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/Tools and the file is called sphinx.html.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;sphinx.html follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;&amp;amp; /Elements/Header, Title =&amp;gt; &amp;quot;Search results&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
  &amp;lt;&amp;amp; /Elements/Tabs,&lt;br /&gt;
  	Title =&amp;gt; &amp;quot;Search results&amp;quot;,&lt;br /&gt;
  	current_tab    =&amp;gt; &#039;index.html&#039;,&lt;br /&gt;
  	current_toptab =&amp;gt; &#039;index.html&#039;,&lt;br /&gt;
  	tabs           =&amp;gt; $tabs,&lt;br /&gt;
  	actions        =&amp;gt; $actions,&lt;br /&gt;
  &amp;amp;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;div align=&amp;quot;left&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;table width=95% border=0&amp;gt;&lt;br /&gt;
  	&amp;lt;tr&amp;gt;&lt;br /&gt;
  		&amp;lt;td&amp;gt;&lt;br /&gt;
  			&amp;lt;iframe id=&amp;quot;sphinxresults&amp;quot; src=&amp;quot;http://PHP_VIRTDOMAIN_AMENDED/sphinx.php?&amp;lt;% &amp;quot;Text=&amp;quot; . $Text . &amp;quot;&amp;amp;Queue=&amp;quot; . $Queue . &amp;quot;&amp;amp;Requestor=&amp;quot; . $Requestor . &amp;quot;&amp;amp;From=&amp;quot; . $From . &amp;quot;&amp;amp;To=&amp;quot; . $To %&amp;gt;&amp;quot; width=&amp;quot;95%&amp;quot; height=&amp;quot;200&amp;quot; frameborder=&amp;quot;0&amp;quot; onload=&amp;quot;resizeIframeToFitContent(this)&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;br /&gt;
  		&amp;lt;/td&amp;gt;&lt;br /&gt;
  	&amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;/table&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;div align=&amp;quot;right&amp;quot; class=&amp;quot;search-result-actions&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;amp;nbsp;&lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;%init&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  my @results;&lt;br /&gt;
  my $skip_create = 1;&lt;br /&gt;
  my $actions;&lt;br /&gt;
  my $tabs = $m-&amp;gt;comp(&amp;quot;/Elements/DashboardTabs&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/%init&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;%args&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  $Text&lt;br /&gt;
  $Queue =&amp;gt; &#039;&#039;&lt;br /&gt;
  $Requestor =&amp;gt; &#039;&#039;&lt;br /&gt;
  $From =&amp;gt; &#039;&#039;&lt;br /&gt;
  $To =&amp;gt; &#039;&#039;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/%args&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is one last piece of code that we need to put in place: it allows us to insert a little piece of custom CSS and custom Javascript in all RT page headers.&lt;br /&gt;
&lt;br /&gt;
You have to create a file called InHeader in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/NoAuth/css/web2 (web2 is the name of the default RT CSS, if you use another CSS you have to change this path). The contents of this file are shown below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;InHeader follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;style&amp;amp;gt;&lt;br /&gt;
 	pre.programlisting&lt;br /&gt;
 	{&lt;br /&gt;
 		background-color:	#f0f0f0;&lt;br /&gt;
 		padding:			0.5em;&lt;br /&gt;
 		margin-left:		2em;&lt;br /&gt;
 		margin-right:		2em;&lt;br /&gt;
 	}&lt;br /&gt;
 &amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
 function resizeIframeToFitContent(iframe) {&lt;br /&gt;
 	// This function resizes an IFrame object&lt;br /&gt;
 	// to fit its content.&lt;br /&gt;
 	// The IFrame tag must have a unique ID attribute.&lt;br /&gt;
 	iframe.height = document.getElementById(iframe.id).contentWindow.document.body.scrollHeight + 50;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	document.domain = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, to add our portlet to the installable portlets in RT, you have to modify your [[RT SiteConfig|RT_SiteConfig]].pm file and add the portlet name to the $HomePageComponents variable. If you don&#039;t see the $HomePageComponents variable in your [[RT SiteConfig|RT_SiteConfig]].pm file, copy it from the [[RT Config|RT_Config]].pm file.&lt;br /&gt;
&lt;br /&gt;
Mine looks like this:&lt;br /&gt;
&lt;br /&gt;
Set($HomepageComponents, [qw(QuickCreate Quicksearch MyAdminQueues MySupportQueues MyReminders RefreshHomepage Dashboards SphinxSearch)]);&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Whew, it was long, but not difficult I hope.&lt;br /&gt;
&lt;br /&gt;
Following the instruction in this article you get an installable portlet that will allow you to easily (and &#039;&#039;&#039;quickly&#039;&#039;&#039;!) search the RT ticket database.&lt;br /&gt;
&lt;br /&gt;
Sphinx&#039; syntax allows very powerful searches and its performance is unbeatable. We find it so convenient that we&#039;ve found us often using it in place of every other search.&lt;br /&gt;
&lt;br /&gt;
We had to implement a few hacks to embed the PHP code, but that&#039;s just because we were more familiar with PHP. If you are a Perl hacker you can use the Sphinx&#039; Perl API to integrate Sphinx even better. Let&#039;s see what the community can come up with!&lt;br /&gt;
&lt;br /&gt;
I hope this was useful. If you need help, I can be reached through RT mailing lists.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.bestpractical.com/view/Cris Cris]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thanks to Cris for this documentation! Here are a few things we changed for our organisation : &lt;br /&gt;
&lt;br /&gt;
With the missing files included in sphinx.php, I had to change a few things so here is my spinx.php file : &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
        &amp;lt;head&amp;gt;&lt;br /&gt;
                &amp;lt;title&amp;gt;Recherche Ticket Sphinx&amp;lt;/title&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script src=&amp;quot;Classi/sorttable.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
                &amp;lt;style&amp;gt;&lt;br /&gt;
                        body {font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}&lt;br /&gt;
                        table {font-size:inherit;font:100%;}&lt;br /&gt;
                        pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}&lt;br /&gt;
&lt;br /&gt;
                        a {&lt;br /&gt;
                                color: #000;&lt;br /&gt;
                                text-decoration: none;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        div#body a:visited {&lt;br /&gt;
                                color: #666;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        /* background: #547CCC ; */&lt;br /&gt;
                        body {&lt;br /&gt;
                                padding:0;&lt;br /&gt;
                                margin:0;&lt;br /&gt;
&lt;br /&gt;
                                background: #FFFFFF ;&lt;br /&gt;
                                font-family: arial, helvetica, sans-serif;&lt;br /&gt;
&lt;br /&gt;
                                color: #000000;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list, table.queue-summary, table.collection {&lt;br /&gt;
                                margin-top: 0.75em;&lt;br /&gt;
                                font-size: 0.9em;&lt;br /&gt;
                                border: 1px solid #aaa;&lt;br /&gt;
                                border-bottom: 2px solid #999;&lt;br /&gt;
                                border-right: 2px solid #999;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary tr&amp;gt;*:first-child {&lt;br /&gt;
                                padding-left: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary tr&amp;gt;*:last-child {&lt;br /&gt;
                                padding-right: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list a, table.queue-summary a, table.collection a  {&lt;br /&gt;
                                font-weight: bold;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list th.collection-as-table, table.collection th.collection-as-table {&lt;br /&gt;
                                background: #ddd;&lt;br /&gt;
                                font-size: 0.9em;&lt;br /&gt;
                                margin-bottom: 0.5em;&lt;br /&gt;
                                text-align: left;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary th.collection-as-table {&lt;br /&gt;
                                font-size: 0.9em;&lt;br /&gt;
                                margin-bottom: 0.5em;&lt;br /&gt;
                                text-align: right;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary th.collection-as-table:first-child {&lt;br /&gt;
                                text-align: left;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.collection-as-table+tr.collection-as-table th {&lt;br /&gt;
                                border-bottom: 2px solid grey;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary td {&lt;br /&gt;
                                background: #efefef;&lt;br /&gt;
                                border-bottom: 1px solid #ccc;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.evenline td {&lt;br /&gt;
                                background: #eee;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.oddline td {&lt;br /&gt;
                                background: #fff;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.evenline td, tr.oddline td {&lt;br /&gt;
                                padding-top: 0.5em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.evenline+tr.evenline td, tr.oddline+tr.oddline td{&lt;br /&gt;
                                padding-top: 0;&lt;br /&gt;
                                border: none;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list td:first-child, table.ticket-list th:first-child {&lt;br /&gt;
                                padding-left: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list td:last-child, table.ticket-list th:last-child {&lt;br /&gt;
                                padding-right: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        th.collection-as-table , td.collection-as-table {&lt;br /&gt;
                                padding-right: 0.5em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        .pagenum.a:hover, .paging a.nav:hover{&lt;br /&gt;
                                text-decoration: underline;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        .pagenum *, .paging a.nav{&lt;br /&gt;
                                padding: .5em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        .currentpage{&lt;br /&gt;
                                text-decoration: none;&lt;br /&gt;
                                font-weight: bold;&lt;br /&gt;
                                background: #eee;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        div.paging{&lt;br /&gt;
                                text-align: center;&lt;br /&gt;
                                padding-bottom: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        #body&amp;gt;table.ticket-list {&lt;br /&gt;
                                margin-bottom: 2em;&lt;br /&gt;
                        }&lt;br /&gt;
                &amp;lt;/style&amp;gt;&lt;br /&gt;
                &amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;body&amp;gt;&lt;br /&gt;
                &amp;lt;?php&lt;br /&gt;
                //Costante con il max numero di righe ritornate da Sphinx&lt;br /&gt;
                define(&#039;SPHINX_MAX_LIMIT&#039;, 1000);&lt;br /&gt;
&lt;br /&gt;
                require_once(&amp;quot;Classi/sphinxapi.php&amp;quot;);&lt;br /&gt;
                //require_once(&amp;quot;Classi/Timer.class.php&amp;quot;);&lt;br /&gt;
                require_once(&amp;quot;Classi/MySql.class.php&amp;quot;);&lt;br /&gt;
                require_once(&amp;quot;Classi/ErrorManager.class.php&amp;quot;);&lt;br /&gt;
                include_once(&amp;quot;Include/Query.inc.php&amp;quot;);&lt;br /&gt;
                include_once(&amp;quot;Include/dvopendb.config.inc.php&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        //      $MyTimer =  new Timer();&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Parametri di connessione al Daemon Sphinx&lt;br /&gt;
                $host = &amp;quot;localhost&amp;quot;;&lt;br /&gt;
                $port = 9312;&lt;br /&gt;
                $index = &amp;quot;*&amp;quot;; // put your index name here&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Variabili in GET&lt;br /&gt;
                $query = $_GET[&#039;Text&#039;];&lt;br /&gt;
                $RequestorFilter = trim($_GET[&#039;Requestor&#039;]);&lt;br /&gt;
                $CodaFilter = $_GET[&#039;Queue&#039;];&lt;br /&gt;
                $DataInizioFilter = trim($_GET[&#039;From&#039;]);&lt;br /&gt;
                $DataFineFilter = trim($_GET[&#039;To&#039;]);&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Connessione al Daemon Sphinx&lt;br /&gt;
                $cl = new SphinxClient();&lt;br /&gt;
                $cl-&amp;gt;SetServer($host, $port);&lt;br /&gt;
                $cl-&amp;gt;SetMatchMode(SPH_MATCH_EXTENDED2);&lt;br /&gt;
                $cl-&amp;gt;SetLimits(0,SPHINX_MAX_LIMIT, $max_matches=0, $cutoff=0 );&lt;br /&gt;
&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //MySql Database Query per la retrive dei dati del ticket&lt;br /&gt;
&lt;br /&gt;
                $SqlQuery = new MySql();&lt;br /&gt;
                $SqlQuery-&amp;gt;connect($DbHostName,$DbName,$DbUser,$DbPassword);&lt;br /&gt;
&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Filtri sulla ricerca Sphinx&lt;br /&gt;
&lt;br /&gt;
                //Check della query (parametro di ricerca)&lt;br /&gt;
                if(strlen($query)==0)&lt;br /&gt;
                {&lt;br /&gt;
                        echo &amp;quot;Un paramètre doit être inscrit dans la zone  \&amp;quot;Texte\&amp;quot; pour continuer.&amp;quot;;&lt;br /&gt;
                        exit(1);&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Filtro Requestor&lt;br /&gt;
                if(strlen($RequestorFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        $TempQuery = sprintf($RequestorLookUpQuery,mysql_real_escape_string($RequestorFilter));&lt;br /&gt;
//                      $result22 = $SqlQuery-&amp;gt;query($TempQuery);&lt;br /&gt;
//                      $RequestorResult = $SqlQuery-&amp;gt;fetchAll($result22);&lt;br /&gt;
                                        $result22 = $SqlQuery-&amp;gt;query($TempQuery);&lt;br /&gt;
                                        $RequestorResult = mysql_fetch_array($result22);&lt;br /&gt;
                        if(count($RequestorResult)&amp;gt;0)&lt;br /&gt;
                        {&lt;br /&gt;
                                $cl-&amp;gt;SetFilter (&amp;quot;createdby&amp;quot;,array($RequestorResult[&#039;id&#039;]) , $exclude=false );&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;&amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;gt;Attention - L&#039;adresse \&amp;quot;&amp;quot;.$RequestorFilter.&amp;quot;\&amp;quot; n&#039;est pas dans la base de donnée et la recherche a été effectuée &amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Filtro Queue&lt;br /&gt;
                if(strlen($CodaFilter)&amp;gt;0)&lt;br /&gt;
                        $cl-&amp;gt;SetFilter (&amp;quot;queue&amp;quot;, array($CodaFilter), $exclude=false );&lt;br /&gt;
&lt;br /&gt;
                //Filtro Data&lt;br /&gt;
&lt;br /&gt;
                //__________________________________________________________________________________________________________________&lt;br /&gt;
                //Check delle date&lt;br /&gt;
                if(strlen($DataInizioFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        //Check Datainizio&lt;br /&gt;
                        if(checkdate(substr($DataInizioFilter,5,2),substr($DataInizioFilter,8,2),substr($DataInizioFilter,0,4))==false)&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;Date de début &amp;quot;.$DataInizioFilter.&amp;quot; incorrecte &amp;quot;;&lt;br /&gt;
                                exit(1);&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                                 $DataInizio = mktime(0, 0, 0, substr($DataInizioFilter,5,2), substr($DataInizioFilter,8,2), substr($DataInizioFilter,0,4));&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                if(strlen($DataFineFilter)&amp;gt;0)&lt;br /&gt;
                {       //Check DataFine&lt;br /&gt;
&lt;br /&gt;
                        if(checkdate(substr($DataFineFilter,5,2),substr($DataFineFilter,8,2),substr($DataFineFilter,0,4))==false)&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;Date de fin &amp;quot;.$DataFineFilter.&amp;quot; incorrecte &amp;quot;;&lt;br /&gt;
                                exit(1);&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                                $DataFine = mktime(0, 0, 0, substr($DataFineFilter,5,2), substr($DataFineFilter,8,2), substr($DataFineFilter,0,4));&lt;br /&gt;
                }&lt;br /&gt;
                //__________________________________________________________________________________________________________________&lt;br /&gt;
&lt;br /&gt;
                //Filtraggio vero e proprio&lt;br /&gt;
&lt;br /&gt;
                //Se sono settate entrambe...&lt;br /&gt;
                if(strlen($DataInizioFilter)&amp;gt;0 &amp;amp;&amp;amp; strlen($DataFineFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        if($DataInizio &amp;lt; $DataFine)&lt;br /&gt;
                        {&lt;br /&gt;
                                //Se sono settate entrambe le date filtro per entrambe&lt;br /&gt;
                                $cl-&amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, $DataFine, $exclude=false );&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;La date de début &amp;quot;.$DataInizioFilter.&amp;quot; est supérieure à la date de fin &amp;quot;.$DataFineFilter;&lt;br /&gt;
                                exit(1);&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Se solo DataInizio..&lt;br /&gt;
                if(strlen($DataInizioFilter)&amp;gt;0 &amp;amp;&amp;amp; strlen($DataFineFilter)==0)&lt;br /&gt;
                {&lt;br /&gt;
                        $cl-&amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, mktime(), $exclude=false );&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Se solo DataFine..&lt;br /&gt;
                if(strlen($DataInizioFilter)==0 &amp;amp;&amp;amp; strlen($DataFineFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        //2008-11-14 : Data del primo Ticket di RT&lt;br /&gt;
                        //1988-07-18 : Data di nascita di AMENDED :)&lt;br /&gt;
                        $cl-&amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, mktime(0, 0, 0,07,18,1988), $DataFine, $exclude=false );&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Eseguo la Query su Sphinx&lt;br /&gt;
&lt;br /&gt;
                $res = $cl-&amp;gt;Query($query, $index);&lt;br /&gt;
                if ($res == false)&lt;br /&gt;
                {&lt;br /&gt;
                        echo &amp;quot;failure: &amp;quot;.$cl-&amp;gt;GetLastError().&amp;quot;\n&amp;quot;;&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                        if(count($res[&#039;matches&#039;])!=0)&lt;br /&gt;
                        {&lt;br /&gt;
                                //Se i risultati totali sono &amp;gt; 1000&lt;br /&gt;
                                if($res[&#039;total_found&#039;]&amp;gt;SPHINX_MAX_LIMIT)&lt;br /&gt;
                                {&lt;br /&gt;
                                        echo &amp;quot;&amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;gt; Attention, &amp;quot;.$res[total_found].&amp;quot; résultats ont été trouvés, mais vous ne verrez que les premiers &amp;quot;.SPHINX_MAX_LIMIT.&amp;quot; résultats.&amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
                                }&lt;br /&gt;
&lt;br /&gt;
                                //Se ci sono dei risultati creo la tabella e stampo&lt;br /&gt;
                                //echo &amp;quot;&amp;lt;table id=&#039;ResultTable&#039; class=&#039;ticket-list&#039; border=&#039;0&#039; cellspacing=&#039;0&#039; cellpadding=&#039;1&#039; width=&#039;100%&#039;&amp;gt;&lt;br /&gt;
                                echo &amp;quot;&amp;lt;table id=&#039;ResultTable&#039; class=&#039;sortable&#039; border=&#039;0&#039; cellspacing=&#039;0&#039; cellpadding=&#039;1&#039; width=&#039;100%&#039;&amp;gt;&lt;br /&gt;
                                                &amp;lt;thead&amp;gt;&lt;br /&gt;
                                                &amp;lt;tr class=&#039;collection-as-table&#039;&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;#&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Sujet&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;École&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Status&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Date_de_création&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Demandeur&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Propriétaire&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                                                &amp;lt;/thead&amp;gt;&amp;lt;tbody&amp;gt;&amp;quot;;&lt;br /&gt;
                                foreach ($res[&amp;quot;matches&amp;quot;] as $key=&amp;gt;$value)&lt;br /&gt;
                                {&lt;br /&gt;
                                        $i++;&lt;br /&gt;
                                        $TempQuery = sprintf($TicketDetailQuery,mysql_real_escape_string($key));&lt;br /&gt;
                                        $result34 = $SqlQuery-&amp;gt;query($TempQuery);&lt;br /&gt;
                                        $Risultato = mysql_fetch_array($result34);&lt;br /&gt;
                                        //$Risultato = $SqlQuery-&amp;gt;queryFetchAll($TempQuery);&lt;br /&gt;
                                        //$Risultato = $SqlQuery-&amp;gt;fetchAll($result23);&lt;br /&gt;
                                        if($i%2==0)&lt;br /&gt;
                                        {&lt;br /&gt;
                                                                                        echo &amp;quot;  &amp;lt;tr class=&#039;evenline&#039;&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                &amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
                                        }&lt;br /&gt;
                                        else&lt;br /&gt;
                                        {&lt;br /&gt;
                                                echo &amp;quot;  &amp;lt;tr class=&#039;oddline&#039;&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                &amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
                                        }&lt;br /&gt;
                                }&lt;br /&gt;
                                echo &amp;quot;  &amp;lt;/tbody&amp;gt;&lt;br /&gt;
                                        &amp;lt;tfoot&amp;gt;&amp;lt;/tfoot&amp;gt;&lt;br /&gt;
                                        &amp;lt;/table&amp;gt;&amp;quot;;&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                        {&lt;br /&gt;
                                //...Altrimenti stampo che non ho trovato nulla&lt;br /&gt;
                                echo &amp;quot;&amp;lt;br/&amp;gt;&amp;lt;label class=\&amp;quot;notfoundlabel\&amp;quot;&amp;gt;Aucun résultat trouvé&amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        echo &amp;quot;Résultats &amp;quot;.$res[&#039;total&#039;].&amp;quot; de &amp;quot;.$res[&#039;total_found&#039;]; // in &amp;quot;.$MyTimer-&amp;gt;elapsed().&amp;quot; secondi&amp;quot;;&lt;br /&gt;
                }&lt;br /&gt;
                ?&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is my Classi/MySql.class.php file&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
class MySQLException extends Exception { }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class MySQL {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private $host = null,&lt;br /&gt;
                        $baseName = null,&lt;br /&gt;
                        $user = null,&lt;br /&gt;
                        $id = null;&lt;br /&gt;
&lt;br /&gt;
        private $errorManager = null;&lt;br /&gt;
&lt;br /&gt;
        private $queries = array();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function __construct() {&lt;br /&gt;
&lt;br /&gt;
                $this-&amp;gt;errorManager = ErrorManager::getInstance();&lt;br /&gt;
&lt;br /&gt;
        } // public function __construct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getHost() { return $this-&amp;gt;host; }&lt;br /&gt;
        public function getBaseName() { return $this-&amp;gt;baseName; }&lt;br /&gt;
        public function getUser() { return $this-&amp;gt;user; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function connect($host, $base, $user, $password, $enconding = &amp;quot;utf8&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                if (!($this-&amp;gt;id = mysql_connect($host, $user, $password))) {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;host = null;&lt;br /&gt;
                        $this-&amp;gt;base = null;&lt;br /&gt;
                        $this-&amp;gt;user = null;&lt;br /&gt;
                        $this-&amp;gt;id = null;&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;database connection failed!&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                        $this-&amp;gt;host = $host;&lt;br /&gt;
                        $this-&amp;gt;user = $user;&lt;br /&gt;
                        if (mysql_select_db($base, $this-&amp;gt;id)) {&lt;br /&gt;
                                $this-&amp;gt;baseName = $base;&lt;br /&gt;
                        }&lt;br /&gt;
                        mysql_query(&amp;quot;set names $enconding&amp;quot;, $this-&amp;gt;id);&lt;br /&gt;
                        //mysql_set_charset($enconding, $this-&amp;gt;id);&lt;br /&gt;
                        return true;&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function connect($host, $base, $user, $password)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getLastId() {&lt;br /&gt;
&lt;br /&gt;
                if (is_resource($this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                        $lastId = mysql_insert_id($this-&amp;gt;id);&lt;br /&gt;
                        return $lastId;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;database is not connected, can&#039;t get last id&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function getLastId()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function fetchAll($result) {&lt;br /&gt;
&lt;br /&gt;
                if (mysql_num_rows($result)) {&lt;br /&gt;
&lt;br /&gt;
                        $rows = array();&lt;br /&gt;
&lt;br /&gt;
                        while ($row = mysql_fetch_assoc($result)) {&lt;br /&gt;
                                $rows[] = $row;&lt;br /&gt;
                        }&lt;br /&gt;
                        return $rows;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;invalid mysql query result supplied to fetchAll()&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function fetchAll($result)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function query($string) {&lt;br /&gt;
&lt;br /&gt;
                if (is_resource($this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                        if ($result = mysql_query($string, $this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                                $this-&amp;gt;queries[] = $string;&lt;br /&gt;
                                return $result;&lt;br /&gt;
&lt;br /&gt;
                        }&lt;br /&gt;
                        else {&lt;br /&gt;
                                $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;error in query: &#039;$string&#039;:&amp;quot;.mysql_error($this-&amp;gt;id)));&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;database is not connected, can&#039;t make query&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function query($string)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function queryFetchAll($query) {&lt;br /&gt;
&lt;br /&gt;
                $result = $this-&amp;gt;query($query);&lt;br /&gt;
                $entries = $this-&amp;gt;fetchAll($result);&lt;br /&gt;
&lt;br /&gt;
                return $entries;&lt;br /&gt;
&lt;br /&gt;
        } // public function queryFetchAll($query)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getQueries() {&lt;br /&gt;
&lt;br /&gt;
                return $this-&amp;gt;queries;&lt;br /&gt;
&lt;br /&gt;
        } // public function getQueries()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function __destruct() {&lt;br /&gt;
&lt;br /&gt;
                if (is_resource($this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                        mysql_close($this-&amp;gt;id);&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function __destruct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} // class Mysql&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I added ErrorManager.class.php also : &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class ErrorManager {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private static $instance = null;&lt;br /&gt;
&lt;br /&gt;
        private $errors = array();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private function __construct() { }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public static function getInstance() {&lt;br /&gt;
&lt;br /&gt;
                if (self::$instance == null) {&lt;br /&gt;
&lt;br /&gt;
                        self::$instance = new ErrorManager();&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                return self::$instance;&lt;br /&gt;
&lt;br /&gt;
        } // public function getInstance()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getErrors() {&lt;br /&gt;
&lt;br /&gt;
                return $this-&amp;gt;errors;&lt;br /&gt;
&lt;br /&gt;
        } // public function getErrors()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function reportError(&amp;amp;$sourceObject, $msg = &amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                $class = get_class($sourceObject);&lt;br /&gt;
                $this-&amp;gt;errors[] = array(&amp;quot;source&amp;quot; =&amp;gt; $sourceObject, &amp;quot;message&amp;quot; =&amp;gt; &amp;quot;$class: \&amp;quot;$msg\&amp;quot;&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        } // public function reportError($sourceObject, $msg = &amp;quot;&amp;quot;)&lt;br /&gt;
        public function reportFatalError(&amp;amp;$sourceObject, $exception = null) {&lt;br /&gt;
&lt;br /&gt;
                if (!($exception instanceof Exception)) {&lt;br /&gt;
&lt;br /&gt;
                        $exception = new Exception();&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                $msg = $exception-&amp;gt;getMessage();&lt;br /&gt;
                $class = get_class($sourceObject);&lt;br /&gt;
                $this-&amp;gt;reportError($sourceObject, &amp;quot;fatal error: $msg&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
                throw $exception;&lt;br /&gt;
&lt;br /&gt;
        } // public function reportFatalError($sourceObject, $exception)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} // class ErrorManager&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the Classi I added http://www.kryogenix.org/code/browser/sorttable/sorttable.js for the table to sort.&lt;br /&gt;
&lt;br /&gt;
When you download the last beta version of sphinx, you get a api so I copied it to the Classi also : &lt;br /&gt;
sphinxbeta/sphinx-2.0.1-beta/api/sphinxapi.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The most important thing is to change the limit in the php for the group_concat to make sure you will get all your tickets : &lt;br /&gt;
mysql -p &lt;br /&gt;
SET GLOBAL group_concat_max_len = 8192000;&lt;br /&gt;
&lt;br /&gt;
My sphinx.conf is the following :&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
source rt3&lt;br /&gt;
{&lt;br /&gt;
        type                    = mysql&lt;br /&gt;
&lt;br /&gt;
        sql_host                = localhost&lt;br /&gt;
        sql_user                = &lt;br /&gt;
        sql_pass                = &lt;br /&gt;
        sql_db                  = rt3&lt;br /&gt;
        sql_port                = 3306  # optional, default is 3306&lt;br /&gt;
        sql_query               = \&lt;br /&gt;
                select TK.id as TicketNum, \&lt;br /&gt;
                        TK.Creator as CreatedBy, \&lt;br /&gt;
                        TK.Queue as Queue, \&lt;br /&gt;
                        unix_timestamp(TK.Created) as Created, \&lt;br /&gt;
                        TK.Subject as Subject, \&lt;br /&gt;
                        group_concat(A.Content) as Content \&lt;br /&gt;
                from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
                where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
                and A.TransactionId = T.id \&lt;br /&gt;
                and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
                and (A.ContentType = &#039;text/plain&#039; or A.ContentType = &#039;text/html&#039;) \&lt;br /&gt;
                and A.Content is not null \&lt;br /&gt;
                and TK.Created &amp;lt; concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) \&lt;br /&gt;
                group by TK.id \&lt;br /&gt;
                order by TK.id, T.id&lt;br /&gt;
&lt;br /&gt;
        sql_attr_uint           = Created&lt;br /&gt;
        sql_attr_uint           = Queue&lt;br /&gt;
        sql_attr_uint           = CreatedBy&lt;br /&gt;
        sql_query_info          = SELECT * FROM Tickets WHERE id=$id&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
source rt3delta : rt3&lt;br /&gt;
 {&lt;br /&gt;
        sql_query               = \&lt;br /&gt;
                select TK.id as TicketNum, \&lt;br /&gt;
                        TK.Creator as CreatedBy, \&lt;br /&gt;
                        TK.Queue as Queue, \&lt;br /&gt;
                        unix_timestamp(TK.Created) as Created, \&lt;br /&gt;
                        TK.Subject as Subject, \&lt;br /&gt;
                        group_concat(A.Content) as Content \&lt;br /&gt;
                from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
                where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
                and A.TransactionId = T.id \&lt;br /&gt;
                and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
                and A.Content is not null \&lt;br /&gt;
                and TK.Created between concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) and last_day(now()) \&lt;br /&gt;
                group by TK.id \&lt;br /&gt;
                order by TK.id, T.id&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
index fulltext1&lt;br /&gt;
 {&lt;br /&gt;
        source                  = rt3&lt;br /&gt;
        path                    = /var/data/fulltext1&lt;br /&gt;
        docinfo                 = extern&lt;br /&gt;
        charset_type    = utf-8&lt;br /&gt;
        html_strip = 1&lt;br /&gt;
        min_word_len = 1&lt;br /&gt;
        enable_star     = 1&lt;br /&gt;
        min_infix_len   = 3&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 index fulltextdelta: fulltext1&lt;br /&gt;
 {&lt;br /&gt;
        source                  = rt3delta&lt;br /&gt;
        charset_type            = utf-8&lt;br /&gt;
        path                    = /var/data/fulltextdelta&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 indexer&lt;br /&gt;
 {&lt;br /&gt;
        mem_limit               = 128M&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
searchd&lt;br /&gt;
{&lt;br /&gt;
        listen                  = 9312&lt;br /&gt;
        listen                  = 9306:mysql41&lt;br /&gt;
        log                     = /var/log/sphinx/searchd.log&lt;br /&gt;
        query_log               = /var/log/sphinx/query.log&lt;br /&gt;
        read_timeout            = 5&lt;br /&gt;
        max_children            = 30&lt;br /&gt;
        pid_file                = /var/run/sphinx/searchd.pid&lt;br /&gt;
        max_matches             = 1000&lt;br /&gt;
        seamless_rotate         = 1&lt;br /&gt;
        preopen_indexes         = 1&lt;br /&gt;
        unlink_old              = 1&lt;br /&gt;
        workers                 = threads # for RT to work&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=MuteResolve&amp;diff=5360</id>
		<title>MuteResolve</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=MuteResolve&amp;diff=5360"/>
		<updated>2016-06-20T06:53:59Z</updated>

		<summary type="html">&lt;p&gt;Cris70: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
By default RT has a scrip to notify requestors when a ticket is resolved. This is generally a good idea; however, sometimes you may want to avoid notifying requestors. One example is when someone reopens a ticket just because he answered &amp;quot;Thanks&amp;quot; to your resolution notification.&lt;br /&gt;
&lt;br /&gt;
I haven&#039;t found a solution satisfying me, so I developed my own. It involves a transaction custom field, called MuteResolve, that privileged users can set when they resolve a ticket. If set to &amp;quot;Yes&amp;quot;, RT won&#039;t send any email.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that, being a transaction custom field, you&#039;ll see it in any transaction, not only on resolve (e.g. you&#039;ll see it on the ticket &amp;quot;comment&amp;quot; page too), but it only makes sense on resolve.&lt;br /&gt;
&lt;br /&gt;
This is implemented on RT 3.8.4.&lt;br /&gt;
&lt;br /&gt;
2010-08-23 Updated for 3.8.8 (change in validation).&lt;br /&gt;
&lt;br /&gt;
=== How to set up MuteResolve in RT3: ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 1. Custom field creation =====&lt;br /&gt;
&lt;br /&gt;
First create a new custom field: Configuration -&amp;amp;gt; Custom Fields -&amp;amp;gt; Create&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name:&#039;&#039;&#039; MuteResolve&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; &amp;lt;code&amp;gt;If Yes, don&#039;t send email notifications on resolve&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Type:&#039;&#039;&#039; &amp;lt;code&amp;gt;Select one value&amp;lt;/code&amp;gt; (but I prefer Combobox because it looks better)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Applies to:&#039;&#039;&#039; Ticket Transactions&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Validation:&#039;&#039;&#039; (?#YesNo)^(Yes|No|\z)$ (only necessary for Combobox)&lt;br /&gt;
&lt;br /&gt;
When you click on &amp;quot;Save Changes&amp;quot; RT will let you enter Values.&lt;br /&gt;
&lt;br /&gt;
Enter one value: &amp;quot;Yes&amp;quot;. You need only fill the Name field, I have left Sort and Description empty. Then &amp;quot;Save Changes&amp;quot; again.&lt;br /&gt;
&lt;br /&gt;
On the &amp;quot;Applies To&amp;quot; page select the queues where you want to enable the custom field, then on the &amp;quot;Group Rights&amp;quot; give the &amp;quot;ModifyCustomField&amp;quot; right to the &amp;quot;Privileged&amp;quot; system group.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 2. Editing Scrip =====&lt;br /&gt;
&lt;br /&gt;
Go to Configuration -&amp;amp;gt; Global -&amp;amp;gt; Scrips, then click on &amp;quot;On Resolve Notify Requestors&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Change &amp;quot;Condition&amp;quot; from &amp;quot;On Resolve&amp;quot; to &amp;quot;User Defined&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;quot;Stage&amp;quot; from &amp;quot;TransactionCreate&amp;quot; to &amp;quot;TransactionBatch&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In the &amp;quot;Custom condition&amp;quot; box enter this code:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;# is this a resolve?&lt;br /&gt;
  my $trans = $self-&amp;gt;TransactionObj;&lt;br /&gt;
  my $tipo = $trans-&amp;gt;Type;&lt;br /&gt;
  return 0 unless ($trans-&amp;gt;Type eq &amp;quot;Status&amp;quot; &amp;amp;&amp;amp; $trans-&amp;gt;NewValue eq &amp;quot;resolved&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  # get last &amp;quot;comment&amp;quot; transaction&lt;br /&gt;
  my $Transactions = $self-&amp;gt;TicketObj-&amp;gt;Transactions;&lt;br /&gt;
  &lt;br /&gt;
  $Transactions-&amp;gt;Limit( FIELD =&amp;gt; &#039;Type&#039;, VALUE =&amp;gt; &#039;Comment&#039; );&lt;br /&gt;
  $Transactions-&amp;gt;OrderByCols (&lt;br /&gt;
                { FIELD =&amp;gt; &#039;Created&#039;,  ORDER =&amp;gt; &#039;DESC&#039; },&lt;br /&gt;
                { FIELD =&amp;gt; &#039;id&#039;,     ORDER =&amp;gt; &#039;DESC&#039; },&lt;br /&gt;
                );&lt;br /&gt;
  &lt;br /&gt;
  # get custom fields of the last &amp;quot;comment&amp;quot; transaction, if there is one&lt;br /&gt;
  unless( $Transactions-&amp;gt;First ){ return 1; }&lt;br /&gt;
  my $TransNum = $Transactions-&amp;gt;First-&amp;gt;Id;&lt;br /&gt;
  my $TCustomFields = $Transactions-&amp;gt;First-&amp;gt;CustomFields;&lt;br /&gt;
  &lt;br /&gt;
  while (my $TCustomField = $TCustomFields-&amp;gt;Next()) {&lt;br /&gt;
     my $nam = $TCustomField-&amp;gt;Name;&lt;br /&gt;
     if ($nam = &#039;MuteResolve&#039;) {&lt;br /&gt;
         my $val = $Transactions-&amp;gt;First-&amp;gt;FirstCustomFieldValue($nam);&lt;br /&gt;
         if ($val eq &#039;Yes&#039;) {&lt;br /&gt;
             return 0;&lt;br /&gt;
         }&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  return 1;&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
That&#039;s all folks!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; - I think&lt;br /&gt;
&lt;br /&gt;
 if ($nam = &#039;MuteResolve&#039;) {&lt;br /&gt;
&lt;br /&gt;
should be&lt;br /&gt;
&lt;br /&gt;
 if ($nam eq &#039;MuteResolve&#039;) {&lt;br /&gt;
&lt;br /&gt;
(added by [http://wiki.bestpractical.com/view/fish fish], 9 Sep 2010)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note2&#039;&#039;&#039; - If you check &amp;quot;yes&amp;quot; but add no comment, rt still sends the mail. (Thx to Crist.)&lt;br /&gt;
&lt;br /&gt;
(added by Minifab, 23 Nov 2010)&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=OnCreateCheckCF&amp;diff=5359</id>
		<title>OnCreateCheckCF</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=OnCreateCheckCF&amp;diff=5359"/>
		<updated>2016-06-20T06:53:28Z</updated>

		<summary type="html">&lt;p&gt;Cris70: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[User:Cris70|Cris]]&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
You may want to create a mandatory custom field, so that people will have to fill the value before being able to submit a new ticket. However, if you define a cf as mandatory, only people creating tickets from the web interface will be forced to fill the value. Those creating a new ticket using the mail gateway won&#039;t notice the presence of the mandatory cf, and the ticket will be created anyway.&lt;br /&gt;
&lt;br /&gt;
My solution consists of three pieces:&lt;br /&gt;
&lt;br /&gt;
* the [[ExtractCustomFieldValues]] extension, needed to be able assign a value to the cf through an email message&lt;br /&gt;
* an OnCreate scrip which checks if the cf is present, and eventually marks the ticket as rejected and notifies the requestor&lt;br /&gt;
* a custom template to use when notifying the requestor about a rejected ticket&lt;br /&gt;
&lt;br /&gt;
This is implemented on RT 3.8.4.&lt;br /&gt;
&lt;br /&gt;
=== How to setup OnCreateCheckCF in RT3 ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 1. Custom field creation =====&lt;br /&gt;
&lt;br /&gt;
First create a new custom field: Configuration -&amp;amp;gt; Custom Fields -&amp;amp;gt; Create&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name:&#039;&#039;&#039; &amp;lt;code&amp;gt;cfTest&amp;lt;/code&amp;gt; &#039;&#039;(you can use the name you want)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; &amp;lt;code&amp;gt;test mandatory custom field&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Type:&#039;&#039;&#039; &amp;lt;code&amp;gt;Fill in one text area&amp;lt;/code&amp;gt; &#039;&#039;(you can use the type you want)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Validation:&#039;&#039;&#039; (?#Mandatory).&lt;br /&gt;
&lt;br /&gt;
Now &amp;quot;Save Changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
On the &amp;quot;Applies To&amp;quot; page select the queues where you want to enable the custom field, then on the &amp;quot;Group Rights&amp;quot; give the &amp;quot;ModifyCustomField&amp;quot; right to the &amp;quot;Everyone&amp;quot; system group (if you want everyone to be able to create tickets on those queues).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that this is just a sample mandatory custom field. The scrip below is generic and will check for the presence of any and all &amp;lt;u&amp;gt;mandatory&amp;lt;/u&amp;gt; ticket custom fields.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 2. Configure the ExtractCustomFieldValues =====&lt;br /&gt;
&lt;br /&gt;
Follow the instructions in the [[ExtractCustomFieldValues]] section&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 3. Creating the template =====&lt;br /&gt;
&lt;br /&gt;
Go to Configuration -&amp;amp;gt; Global -&amp;amp;gt; Templates -&amp;amp;gt; New&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name:&#039;&#039;&#039; &amp;lt;code&amp;gt;Error: no mandatory CF&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; &amp;lt;code&amp;gt;Inform the user that the ticket has been rejected due to a missing mandatory custom field&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 Subject: Your ticket has been rejected due to a missing mandatory field&lt;br /&gt;
 &lt;br /&gt;
 You sent a ticket with a missing piece of information. Since the missing information&lt;br /&gt;
 is mandatory, the ticket has been rejected.&lt;br /&gt;
 &lt;br /&gt;
 Please verify the informations you sent and then retry submitting the ticket.&lt;br /&gt;
 If you feel your ticket has been rejected due to an error, please contact the administrator.&lt;br /&gt;
&lt;br /&gt;
Obviously this is only an example, you can write what you want. Just be sure to have the &amp;quot;Subject:&amp;quot; line as the very first line, and to leave a blank line after that.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 4. Creating the Scrip =====&lt;br /&gt;
&lt;br /&gt;
Go to Configuration -&amp;amp;gt; Queues (or Global if you want this for all queues) -&amp;amp;gt; (QueueName) -&amp;amp;gt; Scrips -&amp;amp;gt; New scrip&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; OnCreateCheckCF&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition:&#039;&#039;&#039; User Defined&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Action:&#039;&#039;&#039; Autoreply To Requestors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Template:&#039;&#039;&#039; Global template: Error: no mandatory CF&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage:&#039;&#039;&#039; TransactionBatch&lt;br /&gt;
&lt;br /&gt;
In the &amp;quot;Custom condition&amp;quot; box enter this code:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
    my $trans = $self-&amp;amp;gt;TransactionObj;&lt;br /&gt;
    return 0 unless $trans-&amp;amp;gt;Type eq &amp;quot;Create&amp;quot;;&lt;br /&gt;
    &lt;br /&gt;
    my $ticket = $self-&amp;amp;gt;TicketObj;&lt;br /&gt;
    &lt;br /&gt;
    my $Email_Rq = $ticket-&amp;amp;gt;RequestorAddresses;&lt;br /&gt;
    &lt;br /&gt;
    my $CustomFields = $ticket-&amp;amp;gt;QueueObj-&amp;amp;gt;TicketCustomFields();&lt;br /&gt;
    while (my $CustomField = $CustomFields-&amp;amp;gt;Next()) {&lt;br /&gt;
       my $nam = $CustomField-&amp;amp;gt;Name;&lt;br /&gt;
       my $typ = $CustomField-&amp;amp;gt;Type;&lt;br /&gt;
       my $vad = $CustomField-&amp;amp;gt;Pattern;&lt;br /&gt;
    &lt;br /&gt;
       if ($vad == &#039;(?#Mandatory)&#039;) {&lt;br /&gt;
           my $val = $ticket-&amp;amp;gt;FirstCustomFieldValue($nam);&lt;br /&gt;
           if ($val ne &#039;&#039;) {&lt;br /&gt;
               next;&lt;br /&gt;
           } else {&lt;br /&gt;
               $ticket-&amp;amp;gt;SetStatus(&amp;quot;rejected&amp;quot;);&lt;br /&gt;
           }&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    return 1;&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
That&#039;s all folks!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;P.S.&#039;&#039;&#039;: Thanks to the user who spotted a typo in my scrip!&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=OnCreateCheckCF&amp;diff=5358</id>
		<title>OnCreateCheckCF</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=OnCreateCheckCF&amp;diff=5358"/>
		<updated>2016-06-20T06:52:38Z</updated>

		<summary type="html">&lt;p&gt;Cris70: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [[User:Cris70]]&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
You may want to create a mandatory custom field, so that people will have to fill the value before being able to submit a new ticket. However, if you define a cf as mandatory, only people creating tickets from the web interface will be forced to fill the value. Those creating a new ticket using the mail gateway won&#039;t notice the presence of the mandatory cf, and the ticket will be created anyway.&lt;br /&gt;
&lt;br /&gt;
My solution consists of three pieces:&lt;br /&gt;
&lt;br /&gt;
* the [[ExtractCustomFieldValues]] extension, needed to be able assign a value to the cf through an email message&lt;br /&gt;
* an OnCreate scrip which checks if the cf is present, and eventually marks the ticket as rejected and notifies the requestor&lt;br /&gt;
* a custom template to use when notifying the requestor about a rejected ticket&lt;br /&gt;
&lt;br /&gt;
This is implemented on RT 3.8.4.&lt;br /&gt;
&lt;br /&gt;
=== How to setup OnCreateCheckCF in RT3 ===&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 1. Custom field creation =====&lt;br /&gt;
&lt;br /&gt;
First create a new custom field: Configuration -&amp;amp;gt; Custom Fields -&amp;amp;gt; Create&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name:&#039;&#039;&#039; &amp;lt;code&amp;gt;cfTest&amp;lt;/code&amp;gt; &#039;&#039;(you can use the name you want)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; &amp;lt;code&amp;gt;test mandatory custom field&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Type:&#039;&#039;&#039; &amp;lt;code&amp;gt;Fill in one text area&amp;lt;/code&amp;gt; &#039;&#039;(you can use the type you want)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Validation:&#039;&#039;&#039; (?#Mandatory).&lt;br /&gt;
&lt;br /&gt;
Now &amp;quot;Save Changes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
On the &amp;quot;Applies To&amp;quot; page select the queues where you want to enable the custom field, then on the &amp;quot;Group Rights&amp;quot; give the &amp;quot;ModifyCustomField&amp;quot; right to the &amp;quot;Everyone&amp;quot; system group (if you want everyone to be able to create tickets on those queues).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039; that this is just a sample mandatory custom field. The scrip below is generic and will check for the presence of any and all &amp;lt;u&amp;gt;mandatory&amp;lt;/u&amp;gt; ticket custom fields.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 2. Configure the ExtractCustomFieldValues =====&lt;br /&gt;
&lt;br /&gt;
Follow the instructions in the [[ExtractCustomFieldValues]] section&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 3. Creating the template =====&lt;br /&gt;
&lt;br /&gt;
Go to Configuration -&amp;amp;gt; Global -&amp;amp;gt; Templates -&amp;amp;gt; New&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name:&#039;&#039;&#039; &amp;lt;code&amp;gt;Error: no mandatory CF&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; &amp;lt;code&amp;gt;Inform the user that the ticket has been rejected due to a missing mandatory custom field&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 Subject: Your ticket has been rejected due to a missing mandatory field&lt;br /&gt;
 &lt;br /&gt;
 You sent a ticket with a missing piece of information. Since the missing information&lt;br /&gt;
 is mandatory, the ticket has been rejected.&lt;br /&gt;
 &lt;br /&gt;
 Please verify the informations you sent and then retry submitting the ticket.&lt;br /&gt;
 If you feel your ticket has been rejected due to an error, please contact the administrator.&lt;br /&gt;
&lt;br /&gt;
Obviously this is only an example, you can write what you want. Just be sure to have the &amp;quot;Subject:&amp;quot; line as the very first line, and to leave a blank line after that.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===== 4. Creating the Scrip =====&lt;br /&gt;
&lt;br /&gt;
Go to Configuration -&amp;amp;gt; Queues (or Global if you want this for all queues) -&amp;amp;gt; (QueueName) -&amp;amp;gt; Scrips -&amp;amp;gt; New scrip&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; OnCreateCheckCF&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition:&#039;&#039;&#039; User Defined&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Action:&#039;&#039;&#039; Autoreply To Requestors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Template:&#039;&#039;&#039; Global template: Error: no mandatory CF&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage:&#039;&#039;&#039; TransactionBatch&lt;br /&gt;
&lt;br /&gt;
In the &amp;quot;Custom condition&amp;quot; box enter this code:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;pre&amp;gt;&lt;br /&gt;
    my $trans = $self-&amp;amp;gt;TransactionObj;&lt;br /&gt;
    return 0 unless $trans-&amp;amp;gt;Type eq &amp;quot;Create&amp;quot;;&lt;br /&gt;
    &lt;br /&gt;
    my $ticket = $self-&amp;amp;gt;TicketObj;&lt;br /&gt;
    &lt;br /&gt;
    my $Email_Rq = $ticket-&amp;amp;gt;RequestorAddresses;&lt;br /&gt;
    &lt;br /&gt;
    my $CustomFields = $ticket-&amp;amp;gt;QueueObj-&amp;amp;gt;TicketCustomFields();&lt;br /&gt;
    while (my $CustomField = $CustomFields-&amp;amp;gt;Next()) {&lt;br /&gt;
       my $nam = $CustomField-&amp;amp;gt;Name;&lt;br /&gt;
       my $typ = $CustomField-&amp;amp;gt;Type;&lt;br /&gt;
       my $vad = $CustomField-&amp;amp;gt;Pattern;&lt;br /&gt;
    &lt;br /&gt;
       if ($vad == &#039;(?#Mandatory)&#039;) {&lt;br /&gt;
           my $val = $ticket-&amp;amp;gt;FirstCustomFieldValue($nam);&lt;br /&gt;
           if ($val ne &#039;&#039;) {&lt;br /&gt;
               next;&lt;br /&gt;
           } else {&lt;br /&gt;
               $ticket-&amp;amp;gt;SetStatus(&amp;quot;rejected&amp;quot;);&lt;br /&gt;
           }&lt;br /&gt;
       }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    return 1;&lt;br /&gt;
    &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
That&#039;s all folks!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;P.S.&#039;&#039;&#039;: Thanks to the user who spotted a typo in my scrip!&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=User:Cris70&amp;diff=5357</id>
		<title>User:Cris70</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=User:Cris70&amp;diff=5357"/>
		<updated>2016-06-20T06:51:49Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Added one contribution&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cristiano Guadagnino=&lt;br /&gt;
DBA and RT User/Admin/Hacker for Bankadati S. I. - Gruppo Credito Valtellinese&lt;br /&gt;
&lt;br /&gt;
Started with RT 3.8.2 on Solaris 10. Reads the mailing lists looking for useful bits of information. Gives back to the community whenever possible. Stole the personal page layout from [http://wiki.bestpractical.com/view/BillGerrard Bill Gerrard] ;-)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Contributions:&#039;&#039;&#039;&lt;br /&gt;
*  [[OnCreateCheckCF]]&lt;br /&gt;
*  [[MuteResolve]]&lt;br /&gt;
*  [[IntegrateSphinx]]&lt;br /&gt;
*  [[Full Text Search Portlet]]&lt;br /&gt;
*  [[Conditional Reopen Reject]]&lt;br /&gt;
*  [[FlexibleSignature]]&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=User:Cris70&amp;diff=5356</id>
		<title>User:Cris70</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=User:Cris70&amp;diff=5356"/>
		<updated>2016-06-20T06:49:00Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Added contributions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cristiano Guadagnino=&lt;br /&gt;
DBA and RT User/Admin/Hacker for Bankadati S. I. - Gruppo Credito Valtellinese&lt;br /&gt;
&lt;br /&gt;
Started with RT 3.8.2 on Solaris 10. Reads the mailing lists looking for useful bits of information. Gives back to the community whenever possible. Stole the personal page layout from [http://wiki.bestpractical.com/view/BillGerrard Bill Gerrard] ;-)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Contributions:&#039;&#039;&#039;&lt;br /&gt;
*  [[OnCreateCheckCF]]&lt;br /&gt;
*  [[MuteResolve]]&lt;br /&gt;
*  [[IntegrateSphinx]]&lt;br /&gt;
*  [[Full Text Search Portlet]]&lt;br /&gt;
*  [[Conditional Reopen Reject]]&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=FlexibleSignature&amp;diff=1347</id>
		<title>FlexibleSignature</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=FlexibleSignature&amp;diff=1347"/>
		<updated>2015-10-21T10:49:54Z</updated>

		<summary type="html">&lt;p&gt;Cris70: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
==Changing the way the signature works in RT==&lt;br /&gt;
I was having some issues with the way RT works regarding user signatures.&lt;br /&gt;
&lt;br /&gt;
First of all, RT will always put a &amp;quot;--&amp;quot; before your signature, so you are limited in the way your signature looks.&lt;br /&gt;
&lt;br /&gt;
Second, RT will always put your signature at the top of an empty message, so I always have to put the cursor at the top, hit &amp;quot;Enter&amp;quot; to make space for my text, then put again the cursor at the top and start writing.&lt;br /&gt;
&lt;br /&gt;
This is all quite tedious.&lt;br /&gt;
&lt;br /&gt;
So I wrote a small patch to change the behaviour.&lt;br /&gt;
&lt;br /&gt;
Here are the instructions for &#039;&#039;&#039;RT 4.2.12&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
*copy &#039;&#039;&#039;&#039;&#039;/opt/rt4/share/html/Elements/MessageBo&#039;&#039;x&#039;&#039;&#039; to &#039;&#039;&#039;&#039;&#039;/opt/rt4/local/html/Elements/MessageBox&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
*modify &#039;&#039;&#039;&#039;&#039;/opt/rt4/local/html/Elements/MessageBox&#039;&#039;&#039;&#039;&#039; so that line 68 changes from:&lt;br /&gt;
     $signature = &amp;quot;-- \n&amp;quot;. $text;&lt;br /&gt;
to:&lt;br /&gt;
     if ($text =~ m/^--$/m) {&lt;br /&gt;
         $signature = &amp;quot;\n&amp;quot;. $text;&lt;br /&gt;
     } else {&lt;br /&gt;
         $signature = &amp;quot;\n-- \n&amp;quot;. $text;&lt;br /&gt;
     }&lt;br /&gt;
*clear your mason cache&lt;br /&gt;
*restart your web server&lt;br /&gt;
Now, if you do not have &amp;quot;--&amp;quot; on a line by its own in your signature, RT will put it at the top of your signature BUT it will also leave a blank line before your signature.&lt;br /&gt;
&lt;br /&gt;
If you already have a &amp;quot;--&amp;quot; on a line by its own in your signature, RT will leave it alone and will NOT put another one on top of your signature. Also RT will leave a blank line before your signature.&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=FlexibleSignature&amp;diff=1346</id>
		<title>FlexibleSignature</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=FlexibleSignature&amp;diff=1346"/>
		<updated>2015-10-21T10:46:59Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Created page with &amp;quot; ==Changing the way the signature works in RT== I was having some issues with the way RT works regarding user signatures.  First of all, RT will always put a &amp;quot;--&amp;quot; before your ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
==Changing the way the signature works in RT==&lt;br /&gt;
I was having some issues with the way RT works regarding user signatures.&lt;br /&gt;
&lt;br /&gt;
First of all, RT will always put a &amp;quot;--&amp;quot; before your signature, so you are limited in the way your signature looks.&lt;br /&gt;
&lt;br /&gt;
Second, RT will always put your signature at the top of an empty message, so I always have to put the cursor at the top, hit &amp;quot;Enter&amp;quot; to make space for my text, then put again the cursor at the top and start writing.&lt;br /&gt;
&lt;br /&gt;
This is all quite tedious.&lt;br /&gt;
&lt;br /&gt;
So I wrote a small patch to change the behaviour.&lt;br /&gt;
&lt;br /&gt;
Here are the instructions for RT 4.2.12:&lt;br /&gt;
&lt;br /&gt;
*copy &#039;&#039;&#039;&#039;&#039;/opt/rt4/share/html/Elements/MessageBo&#039;&#039;x&#039;&#039;&#039; to &#039;&#039;&#039;&#039;&#039;/opt/rt4/local/html/Elements/MessageBox&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
*modify &#039;&#039;&#039;&#039;&#039;/opt/rt4/local/html/Elements/MessageBox&#039;&#039;&#039;&#039;&#039; so that line 68 changes from:&lt;br /&gt;
     $signature = &amp;quot;-- \n&amp;quot;. $text;&lt;br /&gt;
to:&lt;br /&gt;
     if ($text =~ m/^--$/m) {&lt;br /&gt;
         $signature = &amp;quot;\n&amp;quot;. $text;&lt;br /&gt;
     } else {&lt;br /&gt;
         $signature = &amp;quot;\n-- \n&amp;quot;. $text;&lt;br /&gt;
     }&lt;br /&gt;
*clear your mason cache&lt;br /&gt;
*restart your web server&lt;br /&gt;
Now, if you do not have &amp;quot;--&amp;quot; on a line by its own in your signature, RT will put it at the top of your signature BUT it will also leave a blank line before your signature.&lt;br /&gt;
&lt;br /&gt;
If you already have a &amp;quot;--&amp;quot; on a line by its own in your signature, RT will leave it alone and will NOT put another one on top of your signature. Also RT will leave a blank line before your signature.&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Talk:ShowStatusInColor/@comment-Cris70-20150824110430/@comment-Cris70-20150902145423&amp;diff=4856</id>
		<title>Talk:ShowStatusInColor/@comment-Cris70-20150824110430/@comment-Cris70-20150902145423</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Talk:ShowStatusInColor/@comment-Cris70-20150824110430/@comment-Cris70-20150902145423&amp;diff=4856"/>
		<updated>2015-09-02T14:55:02Z</updated>

		<summary type="html">&lt;p&gt;Cris70: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mmm, I am having this error on the test system, but not on the production system.&lt;br /&gt;
&lt;br /&gt;
Both are at the same level (RT 4.2.12), so there must be something wrong on the test system. Time to rebuild it.&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Talk:ShowStatusInColor/@comment-Cris70-20150824110430/@comment-Cris70-20150902145423&amp;diff=4855</id>
		<title>Talk:ShowStatusInColor/@comment-Cris70-20150824110430/@comment-Cris70-20150902145423</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Talk:ShowStatusInColor/@comment-Cris70-20150824110430/@comment-Cris70-20150902145423&amp;diff=4855"/>
		<updated>2015-09-02T14:54:43Z</updated>

		<summary type="html">&lt;p&gt;Cris70: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mmm, I am having this error on the test system, but I haven&#039;t it on the production system.&lt;br /&gt;
&lt;br /&gt;
Both are at the same level (RT 4.2.12), so there must be something wrong on the test system. Time to rebuild it.&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Talk:ShowStatusInColor/@comment-Cris70-20150824110430/@comment-Cris70-20150902145423&amp;diff=4854</id>
		<title>Talk:ShowStatusInColor/@comment-Cris70-20150824110430/@comment-Cris70-20150902145423</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Talk:ShowStatusInColor/@comment-Cris70-20150824110430/@comment-Cris70-20150902145423&amp;diff=4854"/>
		<updated>2015-09-02T14:54:23Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Created page with &amp;quot;Mmm, I am having this error on the test system, but I haven&amp;#039;t it on the productiion system.  Both are at the same level (RT 4.2.12), so there must be something wrong on the te...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mmm, I am having this error on the test system, but I haven&#039;t it on the productiion system.&lt;br /&gt;
&lt;br /&gt;
Both are at the same level (RT 4.2.12), so there must be something wrong on the test system. Time to rebuild it.&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Talk:ShowStatusInColor/@comment-Cris70-20150824110430&amp;diff=4852</id>
		<title>Talk:ShowStatusInColor/@comment-Cris70-20150824110430</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Talk:ShowStatusInColor/@comment-Cris70-20150824110430&amp;diff=4852"/>
		<updated>2015-08-24T11:04:30Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Created page with &amp;quot;I have lots of warnings like this (on RT 4.2.12):  Use of uninitialized value $LastUpdater in regexp compilation at /opt/rt4/local/html/Callbacks/creval/Elements/RT__Ticket/Co...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I have lots of warnings like this (on RT 4.2.12):&lt;br /&gt;
&lt;br /&gt;
Use of uninitialized value $LastUpdater in regexp compilation at /opt/rt4/local/html/Callbacks/creval/Elements/RT__Ticket/ColumnMap/Once&lt;br /&gt;
&lt;br /&gt;
It seems the instruction that sets $LastUpdater is not valid anymore. Does anybody know how to fix it?&lt;br /&gt;
&lt;br /&gt;
T.I.A.&lt;br /&gt;
&lt;br /&gt;
Cris&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Talk:Unmerge/@comment-Cris70-20150309091433&amp;diff=4945</id>
		<title>Talk:Unmerge/@comment-Cris70-20150309091433</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Talk:Unmerge/@comment-Cris70-20150309091433&amp;diff=4945"/>
		<updated>2015-03-09T09:14:33Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Created page with &amp;quot;With recent RT version you have also to add this:  update Tickets set IsMerged = 0 where id = &amp;lt;id_of_the_unmerged_ticket&amp;gt;;&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;With recent RT version you have also to add this:&lt;br /&gt;
&lt;br /&gt;
update Tickets set IsMerged = 0 where id = &amp;lt;id_of_the_unmerged_ticket&amp;gt;;&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Talk:Rich_Text_Custom_Fields/@comment-Cris70-20141224115549&amp;diff=4787</id>
		<title>Talk:Rich Text Custom Fields/@comment-Cris70-20141224115549</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Talk:Rich_Text_Custom_Fields/@comment-Cris70-20141224115549&amp;diff=4787"/>
		<updated>2014-12-24T11:55:49Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Created page with &amp;quot;I have various config.js files in my RT installation (RT 4.2.9):  &amp;#039;&amp;#039;/opt/rt4/share/static/RichText/config.js&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;/opt/rt4/share/html/NoAuth/RichText/ckeditor/config.js&amp;#039;&amp;#039; ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I have various config.js files in my RT installation (RT 4.2.9):&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;/opt/rt4/share/static/RichText/config.js&#039;&#039;&amp;lt;br /&amp;gt;&#039;&#039;/opt/rt4/share/html/NoAuth/RichText/ckeditor/config.js&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I also created an additional config.js as said in this article:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;/opt/rt4/local/static/RichText/config.js&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I changed ALL the config.js files so that the toolbar starts in the expanded state:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;config.toolbarStartupExpanded = true;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
however, the toolbar stays collapsed, even after restarting httpd.&lt;br /&gt;
&lt;br /&gt;
Any suggestion?&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Cris&amp;diff=667</id>
		<title>Cris</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Cris&amp;diff=667"/>
		<updated>2014-05-02T15:06:13Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Corrected page pointer&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Cristiano Guadagnino =&lt;br /&gt;
&lt;br /&gt;
DBA and RT User/Admin/Hacker for Bankadati S. I. - Gruppo Credito Valtellinese&lt;br /&gt;
&lt;br /&gt;
Started with RT 3.8.2 on Solaris 10. Reads the mailing lists looking for useful bits of information. Gives back to the community whenever possible. Stole the personal page layout from [http://wiki.bestpractical.com/view/BillGerrard Bill Gerrard] ;-)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;Contributions:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[OnCreateCheckCF]]&lt;br /&gt;
* [[MuteResolve]]&lt;br /&gt;
* [[IntegrateSphinx]]&lt;br /&gt;
* [[Full_Text_Search_Portlet|Full Text Search Portlet]]&lt;br /&gt;
* [[Conditional_Reopen_Reject|Conditional Reopen Reject]]&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Conditional_Reopen_Reject&amp;diff=558</id>
		<title>Conditional Reopen Reject</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Conditional_Reopen_Reject&amp;diff=558"/>
		<updated>2014-05-02T15:05:30Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Added author reference&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [http://wiki.bestpractical.com/view/Cris Cris]&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Conditional Reopen Reject lets you decide that, after a set amount of time since resolution, users won&#039;t be able to reopen a ticket.&lt;br /&gt;
&lt;br /&gt;
It works with a scrip and a template, as explained below.&lt;br /&gt;
&lt;br /&gt;
==Setting up the scrip==&lt;br /&gt;
&lt;br /&gt;
We have had this customization installed for so long that I do not remember the default configuration of RT. I believe a script called &amp;quot;On Correspond Open Tickets&amp;quot; already exists in a default installation.&lt;br /&gt;
&lt;br /&gt;
You have to change it (or create it if it doesn&#039;t exist) the following way.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that this is configured so that tickets become non-reopenable after a week since resolution. If you want a different timeframe, just change the &#039;&#039;$Days&#039;&#039; variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; On Correspond Open Tickets&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition:&#039;&#039;&#039; User defined&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Action:&#039;&#039;&#039; Autoreply to requestors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Template:&#039;&#039;&#039; Conditional Reopen Reject&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Applies to:&#039;&#039;&#039; Global&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Custom condition:&#039;&#039;&#039;&lt;br /&gt;
 my $Days = 60*60*24*7; # 7 days&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 my $TransactionObj = $self-&amp;gt;TransactionObj;&lt;br /&gt;
 &lt;br /&gt;
 my $TicketObj = $self-&amp;gt;TicketObj;&lt;br /&gt;
 &lt;br /&gt;
 my $QueueObj = $TicketObj-&amp;gt;QueueObj;&lt;br /&gt;
 &lt;br /&gt;
 my $QueueName = $QueueObj-&amp;gt;Name;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 return 0 unless $TransactionObj-&amp;gt;Type eq &#039;Correspond&#039;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 # begin debug section #############&lt;br /&gt;
 &lt;br /&gt;
 my $dr = $TicketObj-&amp;gt;ResolvedObj-&amp;gt;Unix;&lt;br /&gt;
 &lt;br /&gt;
 my $tt = time() - $TicketObj-&amp;gt;ResolvedObj-&amp;gt;Unix;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 $RT::Logger-&amp;gt;info( &amp;quot;&amp;gt;  -- Scrip 1 --\n&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 $RT::Logger-&amp;gt;info( &amp;quot;&amp;gt;  DataRisoluzione: $dr \n&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 $RT::Logger-&amp;gt;info( &amp;quot;&amp;gt;  TempoTrascorso: $tt \n&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 # InBound should be true only if the email comes from the original requestor&lt;br /&gt;
 &lt;br /&gt;
 if ( $TransactionObj-&amp;gt;IsInbound ) {$RT::Logger-&amp;gt;info(&amp;quot;&amp;gt;  Inbound\n&amp;quot;);}&lt;br /&gt;
 &lt;br /&gt;
 if ( $QueueObj-&amp;gt;IsInactiveStatus( $TicketObj-&amp;gt;Status ) ) {$RT::Logger-&amp;gt;info(&amp;quot;&amp;gt;  Inactive\n&amp;quot;);}&lt;br /&gt;
 &lt;br /&gt;
 # end debug section #############&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 if ( $TransactionObj-&amp;gt;IsInbound &amp;amp;&amp;amp;&lt;br /&gt;
 &lt;br /&gt;
      $QueueObj-&amp;gt;IsInactiveStatus( $TicketObj-&amp;gt;Status ) &amp;amp;&amp;amp;&lt;br /&gt;
 &lt;br /&gt;
      time() - $TicketObj-&amp;gt;ResolvedObj-&amp;gt;Unix &amp;gt; $Days ) {&lt;br /&gt;
 &lt;br /&gt;
   return 1; # send mail template&lt;br /&gt;
 &lt;br /&gt;
 } else {&lt;br /&gt;
 &lt;br /&gt;
   $TicketObj-&amp;gt;SetStatus( &#039;open&#039; );&lt;br /&gt;
 &lt;br /&gt;
   return 0; # don&#039;t send mail template&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&#039;&#039;&#039;Custom action preparation code:&#039;&#039;&#039; empty&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Custom action commit code:&#039;&#039;&#039; empty&lt;br /&gt;
&lt;br /&gt;
==Setting up the template==&lt;br /&gt;
&lt;br /&gt;
This is how the template should be configured:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name:&#039;&#039;&#039; Conditional Reopen Reject&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; Reject reopen if ticket has been closed for more than X days&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Type:&#039;&#039;&#039; Perl&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content:&#039;&#039;&#039;&lt;br /&gt;
 Subject: WARNING - TICKET REJECTED: {$Ticket-&amp;gt;Subject}&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Ticket #{$Ticket-&amp;gt;id()} has been closed for more than 7 days: it is not possible to reopen it.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Please submit a new ticket instead.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Thank you&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 RT for {$Ticket-&amp;gt;QueueObj-&amp;gt;SubjectTag || $rtname}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OK, that&#039;s all.&lt;br /&gt;
&lt;br /&gt;
I hope you enjoy it!&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Conditional_Reopen_Reject&amp;diff=557</id>
		<title>Conditional Reopen Reject</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Conditional_Reopen_Reject&amp;diff=557"/>
		<updated>2014-05-02T15:03:03Z</updated>

		<summary type="html">&lt;p&gt;Cris70: New article&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
 &lt;br /&gt;
Conditional Reopen Reject lets you decide that, after a set amount of time since resolution, users won&#039;t be able to reopen a ticket.&lt;br /&gt;
&lt;br /&gt;
It works with a scrip and a template, as explained below.&lt;br /&gt;
&lt;br /&gt;
==Setting up the scrip==&lt;br /&gt;
&lt;br /&gt;
We have had this customization installed for so long that I do not remember the default configuration of RT. I believe a script called &amp;quot;On Correspond Open Tickets&amp;quot; already exists in a default installation.&lt;br /&gt;
&lt;br /&gt;
You have to change it (or create it if it doesn&#039;t exist) the following way.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that this is configured so that tickets become non-reopenable after a week since resolution. If you want a different timeframe, just change the &#039;&#039;$Days&#039;&#039; variable.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; On Correspond Open Tickets&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition:&#039;&#039;&#039; User defined&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Action:&#039;&#039;&#039; Autoreply to requestors&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Template:&#039;&#039;&#039; Conditional Reopen Reject&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Applies to:&#039;&#039;&#039; Global&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Custom condition:&#039;&#039;&#039;&lt;br /&gt;
 my $Days = 60*60*24*7; # 7 days&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 my $TransactionObj = $self-&amp;gt;TransactionObj;&lt;br /&gt;
 &lt;br /&gt;
 my $TicketObj = $self-&amp;gt;TicketObj;&lt;br /&gt;
 &lt;br /&gt;
 my $QueueObj = $TicketObj-&amp;gt;QueueObj;&lt;br /&gt;
 &lt;br /&gt;
 my $QueueName = $QueueObj-&amp;gt;Name;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 return 0 unless $TransactionObj-&amp;gt;Type eq &#039;Correspond&#039;;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 # begin debug section #############&lt;br /&gt;
 &lt;br /&gt;
 my $dr = $TicketObj-&amp;gt;ResolvedObj-&amp;gt;Unix;&lt;br /&gt;
 &lt;br /&gt;
 my $tt = time() - $TicketObj-&amp;gt;ResolvedObj-&amp;gt;Unix;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 $RT::Logger-&amp;gt;info( &amp;quot;&amp;gt;  -- Scrip 1 --\n&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 $RT::Logger-&amp;gt;info( &amp;quot;&amp;gt;  DataRisoluzione: $dr \n&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 $RT::Logger-&amp;gt;info( &amp;quot;&amp;gt;  TempoTrascorso: $tt \n&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 # InBound should be true only if the email comes from the original requestor&lt;br /&gt;
 &lt;br /&gt;
 if ( $TransactionObj-&amp;gt;IsInbound ) {$RT::Logger-&amp;gt;info(&amp;quot;&amp;gt;  Inbound\n&amp;quot;);}&lt;br /&gt;
 &lt;br /&gt;
 if ( $QueueObj-&amp;gt;IsInactiveStatus( $TicketObj-&amp;gt;Status ) ) {$RT::Logger-&amp;gt;info(&amp;quot;&amp;gt;  Inactive\n&amp;quot;);}&lt;br /&gt;
 &lt;br /&gt;
 # end debug section #############&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 if ( $TransactionObj-&amp;gt;IsInbound &amp;amp;&amp;amp;&lt;br /&gt;
 &lt;br /&gt;
      $QueueObj-&amp;gt;IsInactiveStatus( $TicketObj-&amp;gt;Status ) &amp;amp;&amp;amp;&lt;br /&gt;
 &lt;br /&gt;
      time() - $TicketObj-&amp;gt;ResolvedObj-&amp;gt;Unix &amp;gt; $Days ) {&lt;br /&gt;
 &lt;br /&gt;
   return 1; # send mail template&lt;br /&gt;
 &lt;br /&gt;
 } else {&lt;br /&gt;
 &lt;br /&gt;
   $TicketObj-&amp;gt;SetStatus( &#039;open&#039; );&lt;br /&gt;
 &lt;br /&gt;
   return 0; # don&#039;t send mail template&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&#039;&#039;&#039;Custom action preparation code:&#039;&#039;&#039; empty&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Custom action commit code:&#039;&#039;&#039; empty&lt;br /&gt;
&lt;br /&gt;
==Setting up the template==&lt;br /&gt;
&lt;br /&gt;
This is how the template should be configured:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Name:&#039;&#039;&#039; Conditional Reopen Reject&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description:&#039;&#039;&#039; Reject reopen if ticket has been closed for more than X days&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Type:&#039;&#039;&#039; Perl&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content:&#039;&#039;&#039;&lt;br /&gt;
 Subject: WARNING - TICKET REJECTED: {$Ticket-&amp;gt;Subject}&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Ticket #{$Ticket-&amp;gt;id()} has been closed for more than 7 days: it is not possible to reopen it.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Please submit a new ticket instead.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 Thank you&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 RT for {$Ticket-&amp;gt;QueueObj-&amp;gt;SubjectTag || $rtname}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OK, that&#039;s all.&lt;br /&gt;
&lt;br /&gt;
I hope you enjoy it!&lt;br /&gt;
 &lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Cris&amp;diff=666</id>
		<title>Cris</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Cris&amp;diff=666"/>
		<updated>2014-05-02T14:37:38Z</updated>

		<summary type="html">&lt;p&gt;Cris70: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Cristiano Guadagnino =&lt;br /&gt;
&lt;br /&gt;
DBA and RT User/Admin/Hacker for Bankadati S. I. - Gruppo Credito Valtellinese&lt;br /&gt;
&lt;br /&gt;
Started with RT 3.8.2 on Solaris 10. Reads the mailing lists looking for useful bits of information. Gives back to the community whenever possible. Stole the personal page layout from [http://wiki.bestpractical.com/view/BillGerrard Bill Gerrard] ;-)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;Contributions:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[OnCreateCheckCF]]&lt;br /&gt;
* [[MuteResolve]]&lt;br /&gt;
* [[IntegrateSphinx]]&lt;br /&gt;
* [[Full_Text_Search_Portlet|Full Text Search Portlet]]&lt;br /&gt;
* [[ConditionalReopenReject|Conditional Reopen Reject]]&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Cris&amp;diff=665</id>
		<title>Cris</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Cris&amp;diff=665"/>
		<updated>2014-05-02T14:36:32Z</updated>

		<summary type="html">&lt;p&gt;Cris70: new article&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Cristiano Guadagnino =&lt;br /&gt;
&lt;br /&gt;
DBA and RT User/Admin/Hacker for Bankadati S. I. - Gruppo Credito Valtellinese&lt;br /&gt;
&lt;br /&gt;
Started with RT 3.8.2 on Solaris 10. Reads the mailing lists looking for useful bits of information. Gives back to the community whenever possible. Stole the personal page layout from [http://wiki.bestpractical.com/view/BillGerrard Bill Gerrard] ;-)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;Contributions:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[OnCreateCheckCF]]&lt;br /&gt;
* [[MuteResolve]]&lt;br /&gt;
* [[IntegrateSphinx]]&lt;br /&gt;
* [[Full_Text_Search_Portlet|Full Text Search Portlet]]&lt;br /&gt;
* Conditional Reopen Reject&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Talk:Full_Text_Search_Portlet/@comment-82.71.241.138-20140326103851/@comment-Cris70-20140326110342&amp;diff=4512</id>
		<title>Talk:Full Text Search Portlet/@comment-82.71.241.138-20140326103851/@comment-Cris70-20140326110342</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Talk:Full_Text_Search_Portlet/@comment-82.71.241.138-20140326103851/@comment-Cris70-20140326110342&amp;diff=4512"/>
		<updated>2014-03-26T11:03:42Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Created page with &amp;quot;We always want to look for inactive tickets too, so we have this in our RT_Siteconfig:  &amp;#039;&amp;#039;&amp;#039;Set($OnlySearchActiveTicketsInSimpleSearch, 0);&amp;#039;&amp;#039;&amp;#039;  Hope this helps.  Bye  Cris&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We always want to look for inactive tickets too, so we have this in our RT_Siteconfig:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Set($OnlySearchActiveTicketsInSimpleSearch, 0);&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Hope this helps.&lt;br /&gt;
&lt;br /&gt;
Bye&lt;br /&gt;
&lt;br /&gt;
Cris&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Talk:Full_Text_Search_Portlet/@comment-66.207.114.146-20131112210410/@comment-Cris70-20131112221430&amp;diff=4508</id>
		<title>Talk:Full Text Search Portlet/@comment-66.207.114.146-20131112210410/@comment-Cris70-20131112221430</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Talk:Full_Text_Search_Portlet/@comment-66.207.114.146-20131112210410/@comment-Cris70-20131112221430&amp;diff=4508"/>
		<updated>2013-11-12T22:14:30Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Created page with &amp;quot;Thank you for spotting it!  It is fixed now.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Thank you for spotting it!&lt;br /&gt;
&lt;br /&gt;
It is fixed now.&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=1393</id>
		<title>Full Text Search Portlet</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=1393"/>
		<updated>2013-11-12T22:13:15Z</updated>

		<summary type="html">&lt;p&gt;Cris70: /* The full-text search portlet */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:FTSearch.png|thumb|350px|The portlet]]&lt;br /&gt;
==&#039;&#039;&#039;The full-text search portlet&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
After the release of RT 4.0 we began investigating the migration from our 3.8.x RT installation.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;simple search&amp;quot; page, and to have to add &amp;quot;fulltext:&amp;quot; every time.&lt;br /&gt;
&lt;br /&gt;
So I thought &amp;quot;why not write a portlet again&amp;quot;, 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 &amp;quot;simple search&amp;quot; page again for... simple searches :-)&lt;br /&gt;
&lt;br /&gt;
So here it is, for those who want to have a usable alternative to the &amp;quot;simple search&amp;quot; page and yet don&#039;t want to always use the advanced search.&lt;br /&gt;
&lt;br /&gt;
Paste the content of the following box into a file. I called it FTSearch.&lt;br /&gt;
&lt;br /&gt;
You have to put it in:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;your_rt_root&amp;gt;&#039;&#039;\local\html\Elements&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;&amp;amp;|/Widgets/TitleBox, title =&amp;gt; loc(&#039;Fulltext Search&#039;), bodyclass =&amp;gt; &amp;quot;&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
     &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
     function MangleData()&lt;br /&gt;
     {&lt;br /&gt;
         // qui aggrego tutti i campi della prima form&lt;br /&gt;
         var textstring = &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;;&lt;br /&gt;
         var fields=[&amp;quot;fulltext:&amp;quot;, &amp;quot;queue:&amp;quot;, &amp;quot;requestor:&amp;quot;, &amp;quot;owner:&amp;quot;];&lt;br /&gt;
 &lt;br /&gt;
         for (i=3;i&amp;gt;=0;i--) {&lt;br /&gt;
             var box = document.forms[&#039;fulltext-search&#039;].elements[i];&lt;br /&gt;
             if (box.value) {&lt;br /&gt;
                 textstring += fields[i] + box.value + &#039; &#039;;&lt;br /&gt;
             }&lt;br /&gt;
         }&lt;br /&gt;
 &lt;br /&gt;
         // popolo la seconda form con la stringa ricavata dalla prima&lt;br /&gt;
         document.forms[&#039;simple-search&#039;].elements[0].value = textstring;&lt;br /&gt;
 &lt;br /&gt;
         // sottometto la seconda form invece della prima&lt;br /&gt;
         document.forms[&#039;simple-search&#039;].submit();&lt;br /&gt;
     }&lt;br /&gt;
     &amp;lt;/script&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;fulltext-search&amp;quot; action=&amp;quot;#&amp;quot; method=&amp;quot;get&amp;quot; onsubmit=&amp;quot;MangleData(); return false&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Text&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;Text&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Queue&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectQueue, NamedValues =&amp;gt; 1, Name =&amp;gt; &#039;Queue&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Requestor&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/EmailInput, Name =&amp;gt; &#039;Requestor&#039;, Size =&amp;gt; &#039;40&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Owner&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectOwner, ValueAttribute =&amp;gt; &amp;quot;Name&amp;quot;, Name =&amp;gt; &amp;quot;Owner&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;submit&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
                 &amp;lt;input class=&amp;quot;button&amp;quot; type=&amp;quot;submit&amp;quot; value=&amp;quot;Submit&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/div&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;input2&amp;quot; action=&amp;quot;/Search/Simple.html&amp;quot; method=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input style=&amp;quot;display:none&amp;quot; type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;q&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
 &amp;lt;/&amp;amp;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
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&#039;t have it, copy it from RT_Config.pm.&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
 &amp;gt; rm -rf /opt/rt4/var/mason_data/obj/*&lt;br /&gt;
 &amp;gt; svcadm restart apache22&lt;br /&gt;
Then, in RT, click on the &amp;quot;EDIT&amp;quot; box in the top right corner and add FTSearch to your home page.&lt;br /&gt;
&lt;br /&gt;
That&#039;s all! Hope you enjoy it.&lt;br /&gt;
&lt;br /&gt;
[[Cris]]&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Talk:Full_Text_Search_Portlet/@comment-190.124.34.37-20130516001938/@comment-Cris70-20130516083645&amp;diff=4502</id>
		<title>Talk:Full Text Search Portlet/@comment-190.124.34.37-20130516001938/@comment-Cris70-20130516083645</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Talk:Full_Text_Search_Portlet/@comment-190.124.34.37-20130516001938/@comment-Cris70-20130516083645&amp;diff=4502"/>
		<updated>2013-05-16T08:36:46Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Created page with &amp;quot;Hi! I am using it here with RT 4.0.10 and it works perfectly.  Did you enable fulltext search? If you&amp;#039;re using mysql you have to follow the instructions to add the SphinxSE en...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hi! I am using it here with RT 4.0.10 and it works perfectly.&lt;br /&gt;
&lt;br /&gt;
Did you enable fulltext search? If you&#039;re using mysql you have to follow the instructions to add the SphinxSE engine to mysql and then enable it.&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=1392</id>
		<title>Full Text Search Portlet</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=1392"/>
		<updated>2013-05-14T11:01:54Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Updated portlet code for compatibility with RT 4.0.10+&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:FTSearch.png|thumb|350px|The portlet]]&lt;br /&gt;
==&#039;&#039;&#039;The full-text search portlet&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
After the release of RT 4.0 we began investigating the migration from our 3.8.x RT installation.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;simple search&amp;quot; page, and to have to add &amp;quot;fulltext:&amp;quot; every time.&lt;br /&gt;
&lt;br /&gt;
So I thought &amp;quot;why not write a portlet again&amp;quot;, 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 &amp;quot;simple search&amp;quot; page again for... simple searches :-)&lt;br /&gt;
&lt;br /&gt;
So here it is, for those who want to have a usable alternative to the &amp;quot;simple search&amp;quot; page and yet don&#039;t want to always use the advanced search.&lt;br /&gt;
&lt;br /&gt;
Paste the content of the following box into a file. I called it FTSearch.&lt;br /&gt;
&lt;br /&gt;
You have to put it in:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;your_rt_root&amp;gt;&#039;&#039;\local\html\Elements&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;&amp;amp;|/Widgets/TitleBox, title =&amp;gt; loc(&#039;Fulltext Search&#039;), bodyclass =&amp;gt; &amp;quot;&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
     &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
     function MangleData()&lt;br /&gt;
     {&lt;br /&gt;
         // qui aggrego tutti i campi della prima form&lt;br /&gt;
         var textstring = &#039;&#039;;&lt;br /&gt;
         var fields=[&amp;quot;fulltext:&amp;quot;, &amp;quot;queue:&amp;quot;, &amp;quot;requestor:&amp;quot;, &amp;quot;owner:&amp;quot;];&lt;br /&gt;
 &lt;br /&gt;
         for (i=3;i&amp;gt;=0;i--) {&lt;br /&gt;
             var box = document.forms[&#039;fulltext-search&#039;].elements[i];&lt;br /&gt;
             if (box.value) {&lt;br /&gt;
                 textstring += fields[i] + box.value + &#039; &#039;;&lt;br /&gt;
             }&lt;br /&gt;
         }&lt;br /&gt;
 &lt;br /&gt;
         // popolo la seconda form con la stringa ricavata dalla prima&lt;br /&gt;
         document.forms[&#039;simple-search&#039;].elements[0].value = textstring;&lt;br /&gt;
 &lt;br /&gt;
         // sottometto la seconda form invece della prima&lt;br /&gt;
         document.forms[&#039;simple-search&#039;].submit();&lt;br /&gt;
     }&lt;br /&gt;
     &amp;lt;/script&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;fulltext-search&amp;quot; action=&amp;quot;#&amp;quot; method=&amp;quot;get&amp;quot; onsubmit=&amp;quot;MangleData(); return false&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Text&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;Text&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Queue&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectQueue, NamedValues =&amp;gt; 1, Name =&amp;gt; &#039;Queue&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Requestor&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/EmailInput, Name =&amp;gt; &#039;Requestor&#039;, Size =&amp;gt; &#039;40&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Owner&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectOwner, ValueAttribute =&amp;gt; &amp;quot;Name&amp;quot;, Name =&amp;gt; &amp;quot;Owner&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;submit&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
                 &amp;lt;input class=&amp;quot;button&amp;quot; type=&amp;quot;submit&amp;quot; value=&amp;quot;Submit&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/div&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;input2&amp;quot; action=&amp;quot;/Search/Simple.html&amp;quot; method=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input style=&amp;quot;display:none&amp;quot; type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;q&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
 &amp;lt;/&amp;amp;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
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&#039;t have it, copy it from RT_Config.pm.&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
 &amp;gt; rm -rf /opt/rt4/var/mason_data/obj/*&lt;br /&gt;
 &amp;gt; svcadm restart apache22&lt;br /&gt;
Then, in RT, click on the &amp;quot;EDIT&amp;quot; box in the top right corner and add FTSearch to your home page.&lt;br /&gt;
&lt;br /&gt;
That&#039;s all! Hope you enjoy it.&lt;br /&gt;
&lt;br /&gt;
[[Cris]]&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=IntegrateSphinx&amp;diff=1722</id>
		<title>IntegrateSphinx</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=IntegrateSphinx&amp;diff=1722"/>
		<updated>2013-02-05T08:56:58Z</updated>

		<summary type="html">&lt;p&gt;Cris70: /* Intro */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Contributed by [http://wiki.bestpractical.com/view/Cris Cris]&lt;br /&gt;
&lt;br /&gt;
= Integrating the Sphinx full-text search engine in RT =&lt;br /&gt;
&lt;br /&gt;
[http://sphinxsearch.com/ homepage Sphinx]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== What is Sphinx? ==&lt;br /&gt;
&lt;br /&gt;
Sphinx is a free open-source SQL full-text search engine. As they put it on their site: How do you implement full-text search for that 10+ million row table, keep up with the load, and stay relevant? Sphinx is good at those kinds of riddles.&lt;br /&gt;
&lt;br /&gt;
Basically, Sphinx scans your database and builds his own indexes for blazingly-fast full-text searches.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Why? ==&lt;br /&gt;
&lt;br /&gt;
Well, we needed fast full-text searches, and what RT offers is not enough. It is slow and it causes a high load on the db server.&lt;br /&gt;
&lt;br /&gt;
I saw a reference to Sphinx on the RT users mailing list, and - after exploring a few alternatives and verifying no one had already did it - proceeded to integrate it into our RT installation.&lt;br /&gt;
&lt;br /&gt;
I am going to illustrate here all the steps we put in place to have Sphinx completely integrated in RT. The work required a couple of weeks of my spare time and that of two other colleagues.&lt;br /&gt;
&lt;br /&gt;
Unfortunately I am not able to package this as a proper extension, but I hope this docs will help those who want to do the same. Maybe someone will feel inspired enough to package it for the benefit of the community, or maybe [http://wiki.bestpractical.com/view/JesseVincent Jesse] will decide to integrate it into RT out of the box. Who knows?&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== First: setting up Sphinx ==&lt;br /&gt;
&lt;br /&gt;
==== Intro ====&lt;br /&gt;
&lt;br /&gt;
First of all, you have to go to the [http://sphinxsearch.com/ Sphinx homepage], download and compile the sources. Or you can choose among the provided binary packages.&lt;br /&gt;
&lt;br /&gt;
We decided to go with version 1.10-beta, the most recent at the time of our installation.&lt;br /&gt;
&lt;br /&gt;
At this point you have to decide if you want to use &#039;&#039;&#039;real-time indexes&#039;&#039;&#039; or the more traditional &#039;&#039;&#039;full+delta&#039;&#039;&#039; approach to indexes.&lt;br /&gt;
&lt;br /&gt;
I will describe here briefly the meaning of these two options; if you want more infos please refer to the Sphinx homepage.&lt;br /&gt;
&lt;br /&gt;
Real-time indexes (on the Sphinx site they call them RT-indexes... quite confusing, uh?) are a clever way to have your indexes always updated, up to the millisecond. They are however still in beta (as of 1.10-beta) and they are more complex to set up and update. We wanted a quick solution, so we chose the traditional way.&lt;br /&gt;
&lt;br /&gt;
The traditional way consists of having two indexes: one &#039;&#039;&#039;big&#039;&#039;&#039; index comprising all tickets up to a certain date (or to a certain ID), and a small &#039;&#039;&#039;delta&#039;&#039;&#039; index for the rest of the tickets. You can use only one big index, but it will take a few minutes to build it so you cannot refresh it too frequently. If you use the full+delta approach you can build the big index e.g. once a day and the delta index once every few minutes.&lt;br /&gt;
&lt;br /&gt;
Presently we have about 15 thousand tickets in our RT db; we build the full index every morning, indexing everything up to the first day of the current month: it takes about 8 minutes. The delta index (from start of month to now) is built every 5 minutes and it takes about a couple seconds.&lt;br /&gt;
&lt;br /&gt;
At this point I should probably say that we are running RT on two solaris servers: one for the presentation and one for the DB. Sphinx runs on the DB side.&lt;br /&gt;
&lt;br /&gt;
==== Sphinx setup ====&lt;br /&gt;
&lt;br /&gt;
First thing to do is to tell Sphinx where your database is, what kind of database engine you use and how to scan your data.&lt;br /&gt;
&lt;br /&gt;
You tell Sphinx all these things in the file sphinx.conf (we have it in /usr/local/etc). Here is our sphinx.conf:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;#&lt;br /&gt;
   # Sphinx configuration&lt;br /&gt;
   #&lt;br /&gt;
   &lt;br /&gt;
   source rt3&lt;br /&gt;
   {&lt;br /&gt;
   	type			= mysql&lt;br /&gt;
   &lt;br /&gt;
   	sql_host		= localhost&lt;br /&gt;
   	sql_user		= AMENDED&lt;br /&gt;
   	sql_pass		= AMENDED&lt;br /&gt;
   	sql_db			= rt3&lt;br /&gt;
   	sql_port		= 3306	# optional, default is 3306&lt;br /&gt;
   &lt;br /&gt;
   	sql_query		= \&lt;br /&gt;
   		select TK.id as TicketNum, \&lt;br /&gt;
   			TK.Creator as CreatedBy, \&lt;br /&gt;
   			TK.Queue as Queue, \&lt;br /&gt;
   			unix_timestamp(convert_tz(TK.Created,&#039;GMT&#039;,&#039;Europe/Rome&#039;)) as Created, \&lt;br /&gt;
   			TK.Subject as Subject, \&lt;br /&gt;
   			group_concat(cast(A.Content as char)) as Content \&lt;br /&gt;
   		from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
   		where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
   		and A.TransactionId = T.id \&lt;br /&gt;
   		and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
   		and A.ContentType = &#039;text/plain&#039; \&lt;br /&gt;
   		and A.Content is not null \&lt;br /&gt;
   		and TK.Created &amp;amp;lt; concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) \&lt;br /&gt;
   		group by TK.id \&lt;br /&gt;
   		order by TK.id, T.id&lt;br /&gt;
   &lt;br /&gt;
   	sql_attr_uint		= Created&lt;br /&gt;
   	sql_attr_uint		= Queue&lt;br /&gt;
   	sql_attr_uint		= CreatedBy&lt;br /&gt;
   &lt;br /&gt;
   	sql_query_info		= SELECT * FROM Tickets WHERE id=$id&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   source rt3delta : rt3&lt;br /&gt;
   {&lt;br /&gt;
   	sql_query		= \&lt;br /&gt;
   		select TK.id as TicketNum, \&lt;br /&gt;
   			TK.Creator as CreatedBy, \&lt;br /&gt;
   			TK.Queue as Queue, \&lt;br /&gt;
   			unix_timestamp(convert_tz(TK.Created,&#039;GMT&#039;,&#039;Europe/Rome&#039;)) as Created, \&lt;br /&gt;
   			TK.Subject as Subject, \&lt;br /&gt;
   			group_concat(cast(A.Content as char)) as Content \&lt;br /&gt;
   		from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
   		where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
   		and A.TransactionId = T.id \&lt;br /&gt;
   		and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
   		and A.ContentType = &#039;text/plain&#039; \&lt;br /&gt;
   		and A.Content is not null \&lt;br /&gt;
   		and TK.Created between concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) and last_day(now()) \&lt;br /&gt;
   		group by TK.id \&lt;br /&gt;
   		order by TK.id, T.id&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   index fulltext1&lt;br /&gt;
   {&lt;br /&gt;
   	source			= rt3&lt;br /&gt;
   	path			= /var/data/fulltext1&lt;br /&gt;
   	docinfo			= extern&lt;br /&gt;
   	charset_type	= sbcs&lt;br /&gt;
   	min_infix_len 	= 3&lt;br /&gt;
   	enable_star     = 1&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   index fulltextdelta: fulltext1&lt;br /&gt;
   {&lt;br /&gt;
   	source			= rt3delta&lt;br /&gt;
   	path			= /var/data/fulltextdelta&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   indexer&lt;br /&gt;
   {&lt;br /&gt;
   	mem_limit		= 32M&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   searchd&lt;br /&gt;
   {&lt;br /&gt;
   	listen			= 9312&lt;br /&gt;
   	listen			= 9306:mysql41&lt;br /&gt;
   	log				= /var/log/searchd.log&lt;br /&gt;
   	query_log		= /var/log/query.log&lt;br /&gt;
   	read_timeout	= 5&lt;br /&gt;
   	max_children	= 30&lt;br /&gt;
   	pid_file		= /var/log/searchd.pid&lt;br /&gt;
   	max_matches		= 1000&lt;br /&gt;
   	seamless_rotate		= 1&lt;br /&gt;
   	preopen_indexes		= 0&lt;br /&gt;
   	unlink_old		= 1&lt;br /&gt;
   	workers			= threads # for RT to work&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   &lt;br /&gt;
   &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s see what we have in this configuration file.&lt;br /&gt;
&lt;br /&gt;
First we define a &#039;&#039;&#039;data source&#039;&#039;&#039;, that I have named (with lots of fantasy!) &amp;lt;code&amp;gt;rt3&amp;lt;/code&amp;gt;. A data source tells Sphinx where to get data to feed its indexes. We tell Sphinx the type of source (&amp;lt;code&amp;gt;mysql&amp;lt;/code&amp;gt;), where it is (&amp;lt;code&amp;gt;localhost&amp;lt;/code&amp;gt;), and how to retrieve the data (the &amp;lt;code&amp;gt;sqlquery&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
There is one &#039;&#039;&#039;VERY&#039;&#039;&#039; important thing in this section: every column that is returned by the query is indexed for full text search, unless you declare it as an &amp;lt;u&amp;gt;attribute&amp;lt;/u&amp;gt;. Attributes cannot be searched for text, but they allow you to &#039;&#039;&#039;filter&#039;&#039;&#039; the results.&lt;br /&gt;
&lt;br /&gt;
In our configuration, we return &#039;&#039;&#039;Subject&#039;&#039;&#039; and &#039;&#039;&#039;Content&#039;&#039;&#039; as searchable fields, while the three &amp;lt;code&amp;gt;sql_attr_uint&amp;lt;/code&amp;gt; &amp;lt;u&amp;gt;attributes&amp;lt;/u&amp;gt; can be used to refine the search (i.e. filter).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;NOTE:&amp;lt;/u&amp;gt;&#039;&#039;&#039; We had previously defined the three &amp;lt;u&amp;gt;attributes&amp;lt;/u&amp;gt; according to their content (e.g. the &#039;&#039;&#039;Created&#039;&#039;&#039; attribute was defines as &amp;lt;code&amp;gt;sql_attr_timestamp&amp;lt;/code&amp;gt;), but we have discovered that this configuration would not allow us to use those attributes for filtering. It seems Sphinx can only use &amp;lt;code&amp;gt;sql_attr_uint&amp;lt;/code&amp;gt; for filtering... I don&#039;t know if it&#039;s a temporary limitation, a bug, or working as designed.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;sql_query_info&#039;&#039;&#039; has to return a hit for every $id ($id is an implicit variable, which contains the first column returned by the sql_query. It &#039;&#039;&#039;MUST&#039;&#039;&#039; be an integer.).&lt;br /&gt;
&lt;br /&gt;
We then define another data source (&amp;lt;code&amp;gt;rt3delta&amp;lt;/code&amp;gt;) which we derive from &amp;lt;code&amp;gt;rt3&amp;lt;/code&amp;gt;. Everything defined in the &amp;lt;code&amp;gt;rt3&amp;lt;/code&amp;gt; data source is inherited by &amp;lt;code&amp;gt;rt3delta&amp;lt;/code&amp;gt;, save for what we override (&amp;lt;code&amp;gt;sqlquery&amp;lt;/code&amp;gt; in this case). As you can see, the queries are very similar; only the date range is different.&lt;br /&gt;
&lt;br /&gt;
After data sources we define &#039;&#039;&#039;indexes&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
First index is &amp;lt;code&amp;gt;fulltext1&amp;lt;/code&amp;gt;. Everything should be pretty intuitive, but for the two &amp;lt;code&amp;gt;min_infix_len&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;enable_star&amp;lt;/code&amp;gt; fields. By default Sphinx only indexes full words, but it would be very nice to be able to search for partial words by using wildcard characters. So here it is: &amp;lt;code&amp;gt;min_infix_len&amp;lt;/code&amp;gt; tells Sphinx the minimum length of subwords to index, and &amp;lt;code&amp;gt;enable_star&amp;lt;/code&amp;gt; tells it that we want to be able to use star as wildcard character. This way you can search for the word &#039;&#039;&#039;minimum&#039;&#039;&#039; by using &amp;lt;code&amp;gt;min*&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;*nim*&amp;lt;/code&amp;gt;, but not by using &amp;lt;code&amp;gt;mi*&amp;lt;/code&amp;gt; (because we told Sphinx the minimum length for subwords is 3 chars).&lt;br /&gt;
&lt;br /&gt;
The second index is &amp;lt;code&amp;gt;fulltextdelta&amp;lt;/code&amp;gt;, which is derived from &amp;lt;code&amp;gt;fulltext&amp;lt;/code&amp;gt;. As we saw above, everything is inherited but for things we explicitely override.&lt;br /&gt;
&lt;br /&gt;
At last we give some parameters for the inner working of &amp;lt;code&amp;gt;indexer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;searchd&amp;lt;/code&amp;gt;, which are two of the command line tools of Sphinx. The values shown here are good defaults.&lt;br /&gt;
&lt;br /&gt;
==== Building the indexes ====&lt;br /&gt;
&lt;br /&gt;
Now that we have a working configuration, it&#039;s time to build the indexes.&lt;br /&gt;
&lt;br /&gt;
You can initialize the indexes with the command:&lt;br /&gt;
&lt;br /&gt;
 /usr/local/bin/indexer --all&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
This will build all the indexes, and it will give you an idea of the time and disk space required for each index.&lt;br /&gt;
&lt;br /&gt;
For production use however, you want to put the commands in &amp;lt;code&amp;gt;cron&amp;lt;/code&amp;gt; so that indexes are refreshed regularly and automatically.&lt;br /&gt;
&lt;br /&gt;
We refresh the &amp;lt;code&amp;gt;fulltext1&amp;lt;/code&amp;gt; index once a day at 7 a.m., with this command:&lt;br /&gt;
&lt;br /&gt;
 /usr/local/bin/indexer --rotate fulltext1&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;code&amp;gt;--rotate&amp;lt;/code&amp;gt; allows the index to be substituted while the search daemon is running.&lt;br /&gt;
&lt;br /&gt;
We refresh the &amp;lt;code&amp;gt;fulltextdelta&amp;lt;/code&amp;gt; index every 5 minutes with this command:&lt;br /&gt;
&lt;br /&gt;
 /usr/local/bin/indexer --rotate fulltextdelta&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
==== The search daemon ====&lt;br /&gt;
&lt;br /&gt;
Once you have built the indexes you can start searching from the command line with the &amp;lt;code&amp;gt;search&amp;lt;/code&amp;gt; tool. When you are confident your setup is correct, it&#039;s time to start the search daemon.&lt;br /&gt;
&lt;br /&gt;
We do this with the command&lt;br /&gt;
&lt;br /&gt;
 /usr/local/bin/searchd --config /usr/local/etc/sphinx.conf&lt;br /&gt;
&lt;br /&gt;
In our experience &amp;lt;code&amp;gt;searchd&amp;lt;/code&amp;gt; is not very stable (probably due to the beta release): it stops responding after a couple days of uptime, so we restart it daily.&lt;br /&gt;
&lt;br /&gt;
With this last step you have Sphinx all set up and working, so the first part of this tutorial ends here. Please note that Sphinx has a &#039;&#039;&#039;lot&#039;&#039;&#039; of options, that I have not described. I only describe here the options that proved useful for us. If you want to know more about Sphinx please refer to the Sphinx home page.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Second: using the API to query Sphinx ==&lt;br /&gt;
&lt;br /&gt;
So we now have Sphinx up and running and fully populated indexes that return correct results, but now we need to be able to interrogate Sphinx&#039; indexes from RT.&lt;br /&gt;
&lt;br /&gt;
To do this you have to talk to the search daemon, which speaks his own language: the Sphinx API. There are several implementations (PHP, Java, Python and even a third-party Perl API), but since we are mostly familiar with PHP we are going to use it to implement our interface.&lt;br /&gt;
&lt;br /&gt;
Before posting the actual PHP script, there are a few things I have to point out:&lt;br /&gt;
&lt;br /&gt;
* Mason does not support PHP out of the box, so we did a little hack that I&#039;ll explain later&lt;br /&gt;
* The script you&#039;ll see here contains in-line CSS to adapt the results to the default look of RT (web2). If you&#039;re using a different style you may want to change the inline CSS accordingly.&lt;br /&gt;
* The script spits out all the results in one page: there&#039;s still no support for pagination a-la RT.&lt;br /&gt;
* The script spits out &#039;&#039;&#039;ALL&#039;&#039;&#039; the results, including deleted, rejected, merged tickets.&lt;br /&gt;
&lt;br /&gt;
You see, the script is still a little rough, but I hope we&#039;ll be able to refine it with the help of the community.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;sphinx.php follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;html&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;head&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;title&amp;amp;gt;Ricerca Ticket Sphinx&amp;amp;lt;/title&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 		&amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
 			document.domain = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 		&amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 		&amp;amp;lt;style&amp;amp;gt;&lt;br /&gt;
 			body {font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}&lt;br /&gt;
 			table {font-size:inherit;font:100%;}&lt;br /&gt;
 			pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}&lt;br /&gt;
 &lt;br /&gt;
 			a {&lt;br /&gt;
 				color: #000;&lt;br /&gt;
 				text-decoration: none;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			div#body a:visited {&lt;br /&gt;
 				color: #666;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			/* background: #547CCC ; */&lt;br /&gt;
 			body {&lt;br /&gt;
 				padding:0;&lt;br /&gt;
 				margin:0;&lt;br /&gt;
 &lt;br /&gt;
 				background: #FFFFFF ;&lt;br /&gt;
 				font-family: arial, helvetica, sans-serif;&lt;br /&gt;
 &lt;br /&gt;
 				color: #000000;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list, table.queue-summary, table.collection {&lt;br /&gt;
 				margin-top: 0.75em;&lt;br /&gt;
 				font-size: 0.9em;&lt;br /&gt;
 				border: 1px solid #aaa;&lt;br /&gt;
 				border-bottom: 2px solid #999;&lt;br /&gt;
 				border-right: 2px solid #999;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary tr&amp;amp;gt;*:first-child {&lt;br /&gt;
 				padding-left: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary tr&amp;amp;gt;*:last-child {&lt;br /&gt;
 				padding-right: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list a, table.queue-summary a, table.collection a  {&lt;br /&gt;
 				font-weight: bold;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list th.collection-as-table, table.collection th.collection-as-table {&lt;br /&gt;
 				background: #ddd;&lt;br /&gt;
 				font-size: 0.9em;&lt;br /&gt;
 				margin-bottom: 0.5em;&lt;br /&gt;
 				text-align: left;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary th.collection-as-table {&lt;br /&gt;
 				font-size: 0.9em;&lt;br /&gt;
 				margin-bottom: 0.5em;&lt;br /&gt;
 				text-align: right;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary th.collection-as-table:first-child {&lt;br /&gt;
 				text-align: left;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.collection-as-table+tr.collection-as-table th {&lt;br /&gt;
 				border-bottom: 2px solid grey;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.queue-summary td {&lt;br /&gt;
 				background: #efefef;&lt;br /&gt;
 				border-bottom: 1px solid #ccc;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.evenline td {&lt;br /&gt;
 				background: #eee;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.oddline td {&lt;br /&gt;
 				background: #fff;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.evenline td, tr.oddline td {&lt;br /&gt;
 				padding-top: 0.5em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			tr.evenline+tr.evenline td, tr.oddline+tr.oddline td{&lt;br /&gt;
 				padding-top: 0;&lt;br /&gt;
 				border: none;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list td:first-child, table.ticket-list th:first-child {&lt;br /&gt;
 				padding-left: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			table.ticket-list td:last-child, table.ticket-list th:last-child {&lt;br /&gt;
 				padding-right: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			th.collection-as-table , td.collection-as-table {&lt;br /&gt;
 				padding-right: 0.5em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			.pagenum.a:hover, .paging a.nav:hover{&lt;br /&gt;
 				text-decoration: underline;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			.pagenum *, .paging a.nav{&lt;br /&gt;
 				padding: .5em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			.currentpage{&lt;br /&gt;
 				text-decoration: none;&lt;br /&gt;
 				font-weight: bold;&lt;br /&gt;
 				background: #eee;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			div.paging{&lt;br /&gt;
 				text-align: center;&lt;br /&gt;
 				padding-bottom: 1em;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			#body&amp;amp;gt;table.ticket-list {&lt;br /&gt;
 				margin-bottom: 2em;&lt;br /&gt;
 			}&lt;br /&gt;
 		&amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;/head&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;body&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;?php&lt;br /&gt;
 		//Costante con il max numero di righe ritornate da Sphinx&lt;br /&gt;
 		define(&#039;SPHINX_MAX_LIMIT&#039;, 1000);&lt;br /&gt;
 &lt;br /&gt;
 		require_once(&amp;quot;Classi/sphinxapi.php&amp;quot;);&lt;br /&gt;
 		require_once(&amp;quot;Classi/Timer.class.php&amp;quot;);&lt;br /&gt;
 		require_once(&amp;quot;Classi/MySql.class.php&amp;quot;);&lt;br /&gt;
 		include_once(&amp;quot;Include/Query.inc.php&amp;quot;);&lt;br /&gt;
 		include_once(&amp;quot;Include/dvopendb.config.inc.php&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 		$MyTimer =  new Timer();&lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Parametri di connessione al Daemon Sphinx&lt;br /&gt;
 		$host = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 		$port = 9312;&lt;br /&gt;
 		$index = &amp;quot;*&amp;quot;; // put your index name here&lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Variabili in GET&lt;br /&gt;
 		$query = $_GET[&#039;Text&#039;];&lt;br /&gt;
 		$RequestorFilter = trim($_GET[&#039;Requestor&#039;]);&lt;br /&gt;
 		$CodaFilter = $_GET[&#039;Queue&#039;];&lt;br /&gt;
 		$DataInizioFilter = trim($_GET[&#039;From&#039;]);&lt;br /&gt;
 		$DataFineFilter = trim($_GET[&#039;To&#039;]);&lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Connessione al Daemon Sphinx&lt;br /&gt;
 		$cl = new SphinxClient();&lt;br /&gt;
 		$cl-&amp;amp;gt;SetServer($host, $port);&lt;br /&gt;
 		$cl-&amp;amp;gt;SetMatchMode(SPH_MATCH_EXTENDED2);&lt;br /&gt;
 		$cl-&amp;amp;gt;SetLimits(0,SPHINX_MAX_LIMIT, $max_matches=0, $cutoff=0 );&lt;br /&gt;
 &lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//MySql Database Query per la retrive dei dati del ticket&lt;br /&gt;
 &lt;br /&gt;
 		$SqlQuery = new MySql($DbHostName,$DbUser,$DbPassword,$DbName);&lt;br /&gt;
 		$SqlQuery-&amp;amp;gt;Connetti();&lt;br /&gt;
 &lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Filtri sulla ricerca Sphinx&lt;br /&gt;
 &lt;br /&gt;
 		//Check della query (parametro di ricerca)&lt;br /&gt;
 		if(strlen($query)==0)&lt;br /&gt;
 		{&lt;br /&gt;
 			echo &amp;quot;E&#039; necessario inserire un parametro di ricerca nella casella \&amp;quot;Text\&amp;quot; per proseguire.&amp;quot;;&lt;br /&gt;
 			exit(1);&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Filtro Requestor&lt;br /&gt;
 		if(strlen($RequestorFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			$TempQuery = sprintf($RequestorLookUpQuery,mysql_real_escape_string($RequestorFilter));&lt;br /&gt;
 			$SqlQuery-&amp;amp;gt;ExecQuery($TempQuery);&lt;br /&gt;
 			$RequestorResult = $SqlQuery-&amp;amp;gt;GetMonoArrayResult();&lt;br /&gt;
 			if(count($RequestorResult)&amp;amp;gt;0)&lt;br /&gt;
 			{&lt;br /&gt;
 				$cl-&amp;amp;gt;SetFilter (&amp;quot;createdby&amp;quot;,array($RequestorResult[&#039;id&#039;]) , $exclude=false );&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;&amp;amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;amp;gt;Warning - L&#039;indirizzo \&amp;quot;&amp;quot;.$RequestorFilter.&amp;quot;\&amp;quot; non e&#039; presente nel Database; La ricerca e&#039; stata effettuata per tutti i richiedenti&amp;amp;lt;/label&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 			}&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Filtro Queue&lt;br /&gt;
 		if(strlen($CodaFilter)&amp;amp;gt;0)&lt;br /&gt;
 			$cl-&amp;amp;gt;SetFilter (&amp;quot;queue&amp;quot;, array($CodaFilter), $exclude=false );&lt;br /&gt;
 &lt;br /&gt;
 		//Filtro Data&lt;br /&gt;
 &lt;br /&gt;
 		//__________________________________________________________________________________________________________________&lt;br /&gt;
 		//Check delle date&lt;br /&gt;
 		if(strlen($DataInizioFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			//Check Datainizio&lt;br /&gt;
 			if(checkdate(substr($DataInizioFilter,5,2),substr($DataInizioFilter,8,2),substr($DataInizioFilter,0,4))==false)&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;Data Inizio &amp;quot;.$DataInizioFilter.&amp;quot; non corretta &amp;quot;;&lt;br /&gt;
 				exit(1);&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 				 $DataInizio = mktime(0, 0, 0, substr($DataInizioFilter,5,2), substr($DataInizioFilter,8,2), substr($DataInizioFilter,0,4));&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if(strlen($DataFineFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{	//Check DataFine&lt;br /&gt;
 &lt;br /&gt;
 			if(checkdate(substr($DataFineFilter,5,2),substr($DataFineFilter,8,2),substr($DataFineFilter,0,4))==false)&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;Data Fine &amp;quot;.$DataFineFilter.&amp;quot; non corretta &amp;quot;;&lt;br /&gt;
 				exit(1);&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 				$DataFine = mktime(0, 0, 0, substr($DataFineFilter,5,2), substr($DataFineFilter,8,2), substr($DataFineFilter,0,4));&lt;br /&gt;
 		}&lt;br /&gt;
 		//__________________________________________________________________________________________________________________&lt;br /&gt;
 &lt;br /&gt;
 		//Filtraggio vero e proprio&lt;br /&gt;
 &lt;br /&gt;
 		//Se sono settate entrambe...&lt;br /&gt;
 		if(strlen($DataInizioFilter)&amp;amp;gt;0 &amp;amp;amp;&amp;amp;amp; strlen($DataFineFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			if($DataInizio &amp;amp;lt; $DataFine)&lt;br /&gt;
 			{&lt;br /&gt;
 				//Se sono settate entrambe le date filtro per entrambe&lt;br /&gt;
 				$cl-&amp;amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, $DataFine, $exclude=false );&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 			{&lt;br /&gt;
 				echo &amp;quot;La data Inizio &amp;quot;.$DataInizioFilter.&amp;quot; e&#039; maggiore della data di fine &amp;quot;.$DataFineFilter;&lt;br /&gt;
 				exit(1);&lt;br /&gt;
 			}&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Se solo DataInizio..&lt;br /&gt;
 		if(strlen($DataInizioFilter)&amp;amp;gt;0 &amp;amp;amp;&amp;amp;amp; strlen($DataFineFilter)==0)&lt;br /&gt;
 		{&lt;br /&gt;
 			$cl-&amp;amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, mktime(), $exclude=false );&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		//Se solo DataFine..&lt;br /&gt;
 		if(strlen($DataInizioFilter)==0 &amp;amp;amp;&amp;amp;amp; strlen($DataFineFilter)&amp;amp;gt;0)&lt;br /&gt;
 		{&lt;br /&gt;
 			//2008-11-14 : Data del primo Ticket di RT&lt;br /&gt;
 			//1988-07-18 : Data di nascita di AMENDED :)&lt;br /&gt;
 			$cl-&amp;amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, mktime(0, 0, 0,07,18,1988), $DataFine, $exclude=false );&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 		//-----------------------------------------------------------------------------------------------&lt;br /&gt;
 		//Eseguo la Query su Sphinx&lt;br /&gt;
 &lt;br /&gt;
 		$res = $cl-&amp;amp;gt;Query($query, $index);&lt;br /&gt;
 		if ($res == false)&lt;br /&gt;
 		{&lt;br /&gt;
 			echo &amp;quot;failure: &amp;quot;.$cl-&amp;amp;gt;GetLastError().&amp;quot;\n&amp;quot;;&lt;br /&gt;
 		}&lt;br /&gt;
 		else&lt;br /&gt;
 		{&lt;br /&gt;
 			if(count($res[&amp;quot;matches&amp;quot;])!=0)&lt;br /&gt;
 			{&lt;br /&gt;
 				//Se i risultati totali sono &amp;amp;gt; 1000&lt;br /&gt;
 				if($res[total_found]&amp;amp;gt;SPHINX_MAX_LIMIT)&lt;br /&gt;
 				{&lt;br /&gt;
 					echo &amp;quot;&amp;amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;amp;gt;Warning - Sono stati trovati &amp;quot;.$res[total_found].&amp;quot; risultati, verrano visualizzati solo i primi &amp;quot;.SPHINX_MAX_LIMIT.&amp;quot;&amp;amp;lt;/label&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 				}&lt;br /&gt;
 &lt;br /&gt;
 				//Se ci sono dei risultati creo la tabella e stampo&lt;br /&gt;
 				echo &amp;quot;&amp;amp;lt;table id=&#039;ResultTable&#039; class=&#039;ticket-list&#039; border=&#039;0&#039; cellspacing=&#039;0&#039; cellpadding=&#039;1&#039; width=&#039;100%&#039;&amp;amp;gt;&lt;br /&gt;
 						&amp;amp;lt;thead&amp;amp;gt;&lt;br /&gt;
 						&amp;amp;lt;tr class=&#039;collection-as-table&#039;&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;#&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Oggetto&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Coda&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Status&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Creato&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Richiedente&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 							&amp;amp;lt;th class=&#039;collection-as-table&#039;&amp;amp;gt;Proprietario&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 						&amp;amp;lt;/tr&amp;amp;gt;&lt;br /&gt;
 						&amp;lt;/thead&amp;gt;&amp;lt;tbody&amp;gt;&amp;quot;;&lt;br /&gt;
 				foreach ($res[&amp;quot;matches&amp;quot;] as $key=&amp;amp;gt;$value)&lt;br /&gt;
 				{&lt;br /&gt;
 					$i++;&lt;br /&gt;
 					$TempQuery = sprintf($TicketDetailQuery,mysql_real_escape_string($key));&lt;br /&gt;
 					$SqlQuery-&amp;amp;gt;ExecQuery($TempQuery);&lt;br /&gt;
 					$Risultato = $SqlQuery-&amp;amp;gt;GetMonoArrayResult();&lt;br /&gt;
 					if($i%2==0)&lt;br /&gt;
 					{&lt;br /&gt;
 						echo &amp;quot;	&amp;amp;lt;tr class=&#039;evenline&#039;&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 								&amp;amp;lt;/tr&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 					}&lt;br /&gt;
 					else&lt;br /&gt;
 					{&lt;br /&gt;
 						echo &amp;quot;	&amp;amp;lt;tr class=&#039;oddline&#039;&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;amp;gt;&amp;amp;lt;a href=&#039;http://rtdba.AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 									&amp;amp;lt;td class=&#039;collection-as-table&#039;&amp;amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;amp;lt;/td&amp;amp;gt;&lt;br /&gt;
 								&amp;amp;lt;/tr&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 					}&lt;br /&gt;
 				}&lt;br /&gt;
 				echo &amp;quot;	&amp;lt;/tbody&amp;gt;&lt;br /&gt;
 					&amp;lt;tfoot&amp;gt;&amp;lt;/tfoot&amp;gt;&lt;br /&gt;
 					&amp;lt;/table&amp;gt;&amp;quot;;&lt;br /&gt;
 			}&lt;br /&gt;
 			else&lt;br /&gt;
 			{&lt;br /&gt;
 				//...Altrimenti stampo che non ho trovato nulla&lt;br /&gt;
 				echo &amp;quot;&amp;amp;lt;br/&amp;amp;gt;&amp;amp;lt;label class=\&amp;quot;notfoundlabel\&amp;quot;&amp;amp;gt;Nessun risultato trovato&amp;amp;lt;/label&amp;amp;gt;&amp;amp;lt;br/&amp;amp;gt;&amp;quot;;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			echo &amp;quot;Trovati &amp;quot;.$res[total].&amp;quot; di &amp;quot;.$res[total_found].&amp;quot; in &amp;quot;.$MyTimer-&amp;amp;gt;elapsed().&amp;quot; secondi&amp;quot;;&lt;br /&gt;
 		}&lt;br /&gt;
 		?&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;dvopendb.config.inc.php follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;?php&lt;br /&gt;
 $DbHostName = &amp;quot;HOSTNAME_AMENDED:3306/rt3&amp;quot;;&lt;br /&gt;
 $DbUser = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 $DbPassword = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 $DbName = &amp;quot;rt3&amp;quot;;&lt;br /&gt;
 $DbQuery = &amp;quot;select EmailAddress, RealName from Users&amp;quot;;&lt;br /&gt;
 ?&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;Query.inc.php follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;?php&lt;br /&gt;
 $TicketDetailQuery =&lt;br /&gt;
 &amp;quot;select Tickets.id,Subject,Status,Tickets.Created as Created,U1.Name as Requestor,U2.Name as Owner,Queues.Name as Queue&lt;br /&gt;
 from Tickets left outer join Users U1&lt;br /&gt;
 on U1.id = Tickets.Creator&lt;br /&gt;
 left outer join  Users U2&lt;br /&gt;
 on U2.id = Tickets.Owner&lt;br /&gt;
 left outer join Queues&lt;br /&gt;
 on  Queue = Queues.id&lt;br /&gt;
 where Tickets.id = %s&lt;br /&gt;
 &amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 $RequestorLookUpQuery =&lt;br /&gt;
 &amp;quot;select id&lt;br /&gt;
 from Users&lt;br /&gt;
 where EmailAddress = &#039;%s&#039;&lt;br /&gt;
 &amp;quot;;&lt;br /&gt;
 ?&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
This ends the step regarding the use of the Sphinx API to query the &amp;lt;code&amp;gt;searchd&amp;lt;/code&amp;gt; daemon.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Third: integrating it all into RT ==&lt;br /&gt;
&lt;br /&gt;
Now we need a way to call the php script from within RT. Well, technically we don&#039;t &#039;&#039;&#039;need&#039;&#039;&#039; it, but it would be very nice to have.&lt;br /&gt;
&lt;br /&gt;
For this task I found very useful the [[WritingPortlets]] section of this wiki, written by Andy D&#039;Arcy Jewell (thank you!)&lt;br /&gt;
&lt;br /&gt;
So the first thing I did was writing a portlet that one can integrate in the &amp;quot;RT at a glance&amp;quot; page.&lt;br /&gt;
&lt;br /&gt;
I put it in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/Elements. The portlet itself is in a file called SphinxSearch.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;SphinxSearch follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;&amp;amp;|/Widgets/TitleBox, title =&amp;gt; loc(&#039;Fulltext Search (Sphinx)&#039;), bodyclass =&amp;gt; &amp;quot;&amp;quot;,&lt;br /&gt;
     titleright =&amp;gt; loc(&#039;HELP&#039;), titleright_href =&amp;gt; RT-&amp;gt;Config-&amp;gt;Get(&#039;WebPath&#039;).&#039;/Prefs/SphinxHelp.html&#039;&amp;amp;&amp;gt;&lt;br /&gt;
  	&amp;lt;form name=&amp;quot;input&amp;quot; action=&amp;quot;/Tools/sphinx.html&amp;quot; method=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt;
  		&amp;lt;table&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Text&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;input type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;Text&amp;quot; /&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Queue&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;&amp;amp; /Elements/SelectQueue, Name =&amp;gt; &#039;Queue&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Requestor&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;&amp;amp; /Elements/EmailInput, Name =&amp;gt; &#039;Requestor&#039;, Size =&amp;gt; &#039;40&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;From&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;&amp;amp; /Elements/SelectDate, Name =&amp;gt; &amp;quot;From&amp;quot; || &#039;&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  			&amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;To&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
  				&amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
  					&amp;lt;&amp;amp; /Elements/SelectDate, Name =&amp;gt; &amp;quot;To&amp;quot; || &#039;&#039; &amp;amp;&amp;gt;&lt;br /&gt;
  				&amp;lt;/td&amp;gt;&lt;br /&gt;
  			&amp;lt;/tr&amp;gt;&lt;br /&gt;
  		&amp;lt;/table&amp;gt;&lt;br /&gt;
  		&amp;lt;div class=&amp;quot;submit&amp;quot;&amp;gt;&lt;br /&gt;
  			&amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&lt;br /&gt;
  				&amp;lt;input class=&amp;quot;button&amp;quot; type=&amp;quot;submit&amp;quot; value=&amp;quot;Submit&amp;quot; /&amp;gt;&lt;br /&gt;
  			&amp;lt;/div&amp;gt;&lt;br /&gt;
  		&amp;lt;/div&amp;gt;&lt;br /&gt;
  	&amp;lt;/form&amp;gt;&lt;br /&gt;
  &amp;lt;/&amp;amp;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the result:&lt;br /&gt;
&lt;br /&gt;
[[File:Rt3p.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I tried to keep the look and feel of RT by copying code from the other portlets. I even used RT syntax to allow the localization of string, but not everything gets translated since not all the terms are in RT resource files.&lt;br /&gt;
&lt;br /&gt;
Since Sphinx&#039; extended search syntax can be very elaborated, I put a HELP link in the upper right corner (circled in red in the image above). This points to a page that I extracted from Sphinx&#039; documentation. The page is in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/Prefs. The file is called SphinxHelp.html.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;SphinxHelp.html follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;&amp;amp;amp; /Elements/Header, Title =&amp;amp;gt; &amp;quot;Sphinx - Free open-source SQL full-text search engine&amp;quot; &amp;amp;amp;&amp;amp;gt;&lt;br /&gt;
 &amp;amp;lt;&amp;amp;amp; /Elements/Tabs,&lt;br /&gt;
 	Title =&amp;amp;gt; &amp;quot;Help for Sphinx search syntax&amp;quot;,&lt;br /&gt;
 	current_tab    =&amp;amp;gt; &#039;index.html&#039;,&lt;br /&gt;
 	current_toptab =&amp;amp;gt; &#039;index.html&#039;,&lt;br /&gt;
 	tabs           =&amp;amp;gt; $tabs,&lt;br /&gt;
 	actions        =&amp;amp;gt; $actions,&lt;br /&gt;
 &amp;amp;amp;&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;div align=&amp;quot;left&amp;quot; class=&amp;quot;refresh&amp;quot;&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
 			&amp;amp;lt;h2 style=&amp;quot;clear: both&amp;quot;&amp;amp;gt;&amp;amp;lt;a name=&amp;quot;extended-syntax&amp;quot;&amp;amp;gt;&amp;amp;lt;/a&amp;amp;gt;Extended query syntax&amp;amp;lt;/h2&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	The following special operators and modifiers can be used when using the extended matching mode:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
 			&amp;amp;lt;ul type=&amp;quot;disc&amp;quot;&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;operator OR: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;hello | world&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;operator NOT:&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 hello -world&lt;br /&gt;
 hello !world&amp;amp;lt;/pre&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;field search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@title hello @body world&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;field position limit modifier (introduced in version 0.9.9-rc1): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@body[50] hello&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;multiple-field search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@(title,body) hello world&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;all-field search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;@* hello&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;phrase search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&amp;quot;hello world&amp;quot;&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;proximity search operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&amp;quot;hello world&amp;quot;~10&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;quorum matching operator: &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&amp;quot;the world is a wonderful place&amp;quot;/3&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;strict order operator (aka operator &amp;quot;before&amp;quot;): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;aaa &amp;amp;amp;lt;&amp;amp;amp;lt; bbb &amp;amp;amp;lt;&amp;amp;amp;lt; ccc&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;exact form modifier (introduced in version 0.9.9-rc1): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;raining =cats and =dogs&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 				&amp;amp;lt;li&amp;amp;gt;field-start and field-end modifier (introduced in version 0.9.9-rc2): &amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;^hello world$&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 			&amp;amp;lt;/ul&amp;amp;gt;&lt;br /&gt;
 		&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	Here&#039;s an example query that uses some of these operators:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;div class=&amp;quot;example&amp;quot;&amp;amp;gt;&amp;amp;lt;a name=&amp;quot;ex-extended-query&amp;quot;&amp;amp;gt;&amp;amp;lt;/a&amp;amp;gt;&amp;amp;lt;p class=&amp;quot;title&amp;quot;&amp;amp;gt;&amp;amp;lt;b&amp;amp;gt;Example:&amp;amp;amp;nbsp;Extended matching mode: query example&amp;amp;lt;/b&amp;amp;gt;&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;div class=&amp;quot;example-contents&amp;quot;&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	&amp;quot;hello world&amp;quot; @title &amp;quot;example program&amp;quot;~5 @body python -(php|perl) @* code&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&amp;amp;lt;br class=&amp;quot;example-break&amp;quot;&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	The full meaning of this search is:&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;div class=&amp;quot;itemizedlist&amp;quot;&amp;amp;gt;&amp;amp;lt;ul type=&amp;quot;disc&amp;quot;&amp;amp;gt;&amp;amp;lt;li&amp;amp;gt;Find the words &#039;hello&#039; and &#039;world&#039; adjacently in any field in a document;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;li&amp;amp;gt;Additionally, the same document must also contain the words &#039;example&#039; and &#039;program&#039;&lt;br /&gt;
 		in the title field, with up to, but not including, 10 words between the words in question;&lt;br /&gt;
 		(E.g. &amp;quot;example PHP program&amp;quot; would be matched however &amp;quot;example script to introduce outside data&lt;br /&gt;
 		into the correct context for your program&amp;quot; would not because two terms have 10 or more words between them)&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;li&amp;amp;gt;Additionally, the same document must contain the word &#039;python&#039; in the body field, but not contain either &#039;php&#039; or &#039;perl&#039;;&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;li&amp;amp;gt;Additionally, the same document must contain the word &#039;code&#039; in any field.&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/ul&amp;amp;gt;&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	There always is implicit AND operator, so &amp;quot;hello world&amp;quot; means that&lt;br /&gt;
 	both &amp;quot;hello&amp;quot; and &amp;quot;world&amp;quot; must be present in matching document.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	OR operator precedence is higher than AND, so &amp;quot;looking for cat | dog | mouse&amp;quot;&lt;br /&gt;
 	means &amp;quot;looking for ( cat | dog | mouse )&amp;quot; and &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;not&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;quot;(looking for cat) | dog | mouse&amp;quot;.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Field limit operator limits subsequent searching to a given field.&lt;br /&gt;
 	Normally, query will fail with an error message if given field name does not exist&lt;br /&gt;
 	in the searched index. However, that can be suppressed by specifying &amp;quot;@@relaxed&amp;quot;&lt;br /&gt;
 	option at the very beginning of the query:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	@@relaxed @nosuchfield my query&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	This can be helpful when searching through heterogeneous indexes with&lt;br /&gt;
 	different schemas.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Field position limit, introduced in version 0.9.9-rc1, additionaly restricts the searching&lt;br /&gt;
 	to first N position within given field (or fields). For example, &amp;quot;@body[50] hello&amp;quot; will&lt;br /&gt;
 	&amp;amp;lt;span class=&amp;quot;bold&amp;quot;&amp;amp;gt;&amp;amp;lt;strong&amp;amp;gt;not&amp;amp;lt;/strong&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt; match the documents where the keyword &#039;hello&#039; occurs at position 51 and below&lt;br /&gt;
 	in the body.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Proximity distance is specified in words, adjusted for word count, and&lt;br /&gt;
 	applies to all words within quotes. For instance, &amp;quot;cat dog mouse&amp;quot;~5 query&lt;br /&gt;
 	means that there must be less than 8-word span which contains all 3 words,&lt;br /&gt;
 	ie. &amp;quot;CAT aaa bbb ccc DOG eee fff MOUSE&amp;quot; document will &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;not&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;&lt;br /&gt;
 	match this query, because this span is exactly 8 words long.&lt;br /&gt;
 &lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Quorum matching operator introduces a kind of fuzzy matching.&lt;br /&gt;
 	It will only match those documents that pass a given threshold of given words.&lt;br /&gt;
 	The example above (&amp;quot;the world is a wonderful place&amp;quot;/3) will match all documents&lt;br /&gt;
 	that have at least 3 of the 6 specified words.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Strict order operator (aka operator &amp;quot;before&amp;quot;), introduced in version 0.9.9-rc2,&lt;br /&gt;
 	will match the document only if its argument keywords occur in the document&lt;br /&gt;
 	exactly in the query order. For instance, &amp;quot;black &amp;amp;amp;lt;&amp;amp;amp;lt; cat&amp;quot; query (without&lt;br /&gt;
 	quotes) will match the document &amp;quot;black and white cat&amp;quot; but &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;not&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt;&lt;br /&gt;
 	the &amp;quot;that cat was black&amp;quot; document. Order operator has the lowest priority.&lt;br /&gt;
 	It can be applied both to just keywords and more complex expressions,&lt;br /&gt;
 	ie. this is a valid query:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	(bag of words) &amp;amp;amp;lt;&amp;amp;amp;lt; &amp;quot;exact phrase&amp;quot; &amp;amp;amp;lt;&amp;amp;amp;lt; red|green|blue&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 	Exact form keyword modifier, introduced in version 0.9.9-rc1, will match the document only if the keyword occurred&lt;br /&gt;
 	in exactly the specified form. The default behaviour is to match the document&lt;br /&gt;
 	if the stemmed keyword matches. For instance, &amp;quot;runs&amp;quot; query will match both&lt;br /&gt;
 	the document that contains &amp;quot;runs&amp;quot; &amp;amp;lt;span class=&amp;quot;emphasis&amp;quot;&amp;amp;gt;&amp;amp;lt;em&amp;amp;gt;and&amp;amp;lt;/em&amp;amp;gt;&amp;amp;lt;/span&amp;amp;gt; the document that&lt;br /&gt;
 	contains &amp;quot;running&amp;quot;, because both forms stem to just &amp;quot;run&amp;quot; - while &amp;quot;=runs&amp;quot;&lt;br /&gt;
 	query will only match the first document. Exact form operator requires&lt;br /&gt;
 	&amp;amp;lt;a href=&amp;quot;#conf-index-exact-words&amp;quot; title=&amp;quot;11.2.39.&amp;amp;amp;nbsp;index_exact_words&amp;quot;&amp;amp;gt;index_exact_words&amp;amp;lt;/a&amp;amp;gt; option to be enabled.&lt;br /&gt;
 	This is a modifier that affects the keyword and thus can be used within&lt;br /&gt;
 	operators such as phrase, proximity, and quorum operators.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Field-start and field-end keyword modifiers, introduced in version 0.9.9-rc2,&lt;br /&gt;
 	will make the keyword match only if it occurred at the very start or the very end&lt;br /&gt;
 	of a fulltext field, respectively. For instance, the query &amp;quot;^hello world$&amp;quot;&lt;br /&gt;
 	(with quotes and thus combining phrase operator and start/end modifiers)&lt;br /&gt;
 	will only match documents that contain at least one field that has exactly&lt;br /&gt;
 	these two keywords.&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	Starting with 0.9.9-rc1, arbitrarily nested brackets and negations are allowed.&lt;br /&gt;
 	However, the query must be possible to compute without involving an implicit&lt;br /&gt;
 	list of all documents:&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&amp;amp;lt;pre class=&amp;quot;programlisting&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	// correct query&lt;br /&gt;
 	aaa -(bbb -(ccc ddd))&lt;br /&gt;
 &lt;br /&gt;
 	// queries that are non-computable&lt;br /&gt;
 	-aaa&lt;br /&gt;
 	aaa | -bbb&lt;br /&gt;
 	&amp;amp;lt;/pre&amp;amp;gt;&amp;amp;lt;p&amp;amp;gt;&lt;br /&gt;
 	&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;div align=&amp;quot;right&amp;quot; class=&amp;quot;search-result-actions&amp;quot;&amp;amp;gt;&lt;br /&gt;
 &amp;amp;amp;nbsp;&lt;br /&gt;
 &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;%init&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 my @results;&lt;br /&gt;
 my $skip_create = 1;&lt;br /&gt;
 my $actions;&lt;br /&gt;
 my $tabs = $m-&amp;amp;gt;comp(&amp;quot;/Elements/DashboardTabs&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;/%init&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last part is about passing the form&#039;s (portlet) parameters to the PHP script.&lt;br /&gt;
&lt;br /&gt;
As I told you before, the problem here is that Mason does not support PHP out of the box. I found a few hacks around the web to make Mason support PHP, but they were either not applicable to our environment or too difficult to apply.&lt;br /&gt;
&lt;br /&gt;
So we implemented another hack: since we already have another virtual domain where PHP works, we created an html page that embeds (within an iframe) the results from the PHP page that resides in the other virtual domain.&lt;br /&gt;
&lt;br /&gt;
That&#039;s why you see this little piece of code&lt;br /&gt;
&lt;br /&gt;
         		&amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
         			document.domain = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
         		&amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
in the PHP script above: you have to declare that both the HTML page and the PHP script belong to the same domain (although on different subdomains), otherwise you get a security error in the browser.&lt;br /&gt;
&lt;br /&gt;
The html page is located in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/Tools and the file is called sphinx.html.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;sphinx.html follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;&amp;amp; /Elements/Header, Title =&amp;gt; &amp;quot;Search results&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
  &amp;lt;&amp;amp; /Elements/Tabs,&lt;br /&gt;
  	Title =&amp;gt; &amp;quot;Search results&amp;quot;,&lt;br /&gt;
  	current_tab    =&amp;gt; &#039;index.html&#039;,&lt;br /&gt;
  	current_toptab =&amp;gt; &#039;index.html&#039;,&lt;br /&gt;
  	tabs           =&amp;gt; $tabs,&lt;br /&gt;
  	actions        =&amp;gt; $actions,&lt;br /&gt;
  &amp;amp;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;div align=&amp;quot;left&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;table width=95% border=0&amp;gt;&lt;br /&gt;
  	&amp;lt;tr&amp;gt;&lt;br /&gt;
  		&amp;lt;td&amp;gt;&lt;br /&gt;
  			&amp;lt;iframe id=&amp;quot;sphinxresults&amp;quot; src=&amp;quot;http://PHP_VIRTDOMAIN_AMENDED/sphinx.php?&amp;lt;% &amp;quot;Text=&amp;quot; . $Text . &amp;quot;&amp;amp;Queue=&amp;quot; . $Queue . &amp;quot;&amp;amp;Requestor=&amp;quot; . $Requestor . &amp;quot;&amp;amp;From=&amp;quot; . $From . &amp;quot;&amp;amp;To=&amp;quot; . $To %&amp;gt;&amp;quot; width=&amp;quot;95%&amp;quot; height=&amp;quot;200&amp;quot; frameborder=&amp;quot;0&amp;quot; onload=&amp;quot;resizeIframeToFitContent(this)&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;br /&gt;
  		&amp;lt;/td&amp;gt;&lt;br /&gt;
  	&amp;lt;/tr&amp;gt;&lt;br /&gt;
  &amp;lt;/table&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;div align=&amp;quot;right&amp;quot; class=&amp;quot;search-result-actions&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;amp;nbsp;&lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;%init&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  my @results;&lt;br /&gt;
  my $skip_create = 1;&lt;br /&gt;
  my $actions;&lt;br /&gt;
  my $tabs = $m-&amp;gt;comp(&amp;quot;/Elements/DashboardTabs&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/%init&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;%args&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  $Text&lt;br /&gt;
  $Queue =&amp;gt; &#039;&#039;&lt;br /&gt;
  $Requestor =&amp;gt; &#039;&#039;&lt;br /&gt;
  $From =&amp;gt; &#039;&#039;&lt;br /&gt;
  $To =&amp;gt; &#039;&#039;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/%args&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is one last piece of code that we need to put in place: it allows us to insert a little piece of custom CSS and custom Javascript in all RT page headers.&lt;br /&gt;
&lt;br /&gt;
You have to create a file called InHeader in &amp;amp;lt;rt-base-dir&amp;amp;gt;/local/html/NoAuth/css/web2 (web2 is the name of the default RT CSS, if you use another CSS you have to change this path). The contents of this file are shown below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;InHeader follows:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;style&amp;amp;gt;&lt;br /&gt;
 	pre.programlisting&lt;br /&gt;
 	{&lt;br /&gt;
 		background-color:	#f0f0f0;&lt;br /&gt;
 		padding:			0.5em;&lt;br /&gt;
 		margin-left:		2em;&lt;br /&gt;
 		margin-right:		2em;&lt;br /&gt;
 	}&lt;br /&gt;
 &amp;amp;lt;/style&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
 function resizeIframeToFitContent(iframe) {&lt;br /&gt;
 	// This function resizes an IFrame object&lt;br /&gt;
 	// to fit its content.&lt;br /&gt;
 	// The IFrame tag must have a unique ID attribute.&lt;br /&gt;
 	iframe.height = document.getElementById(iframe.id).contentWindow.document.body.scrollHeight + 50;&lt;br /&gt;
 }&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;amp;lt;script language=&amp;quot;JavaScript&amp;quot;&amp;amp;gt;&lt;br /&gt;
 	document.domain = &amp;quot;AMENDED&amp;quot;;&lt;br /&gt;
 &amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, to add our portlet to the installable portlets in RT, you have to modify your [[RT SiteConfig|RT_SiteConfig]].pm file and add the portlet name to the $HomePageComponents variable. If you don&#039;t see the $HomePageComponents variable in your [[RT SiteConfig|RT_SiteConfig]].pm file, copy it from the [[RT Config|RT_Config]].pm file.&lt;br /&gt;
&lt;br /&gt;
Mine looks like this:&lt;br /&gt;
&lt;br /&gt;
Set($HomepageComponents, [qw(QuickCreate Quicksearch MyAdminQueues MySupportQueues MyReminders RefreshHomepage Dashboards SphinxSearch)]);&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
Whew, it was long, but not difficult I hope.&lt;br /&gt;
&lt;br /&gt;
Following the instruction in this article you get an installable portlet that will allow you to easily (and &#039;&#039;&#039;quickly&#039;&#039;&#039;!) search the RT ticket database.&lt;br /&gt;
&lt;br /&gt;
Sphinx&#039; syntax allows very powerful searches and its performance is unbeatable. We find it so convenient that we&#039;ve found us often using it in place of every other search.&lt;br /&gt;
&lt;br /&gt;
We had to implement a few hacks to embed the PHP code, but that&#039;s just because we were more familiar with PHP. If you are a Perl hacker you can use the Sphinx&#039; Perl API to integrate Sphinx even better. Let&#039;s see what the community can come up with!&lt;br /&gt;
&lt;br /&gt;
I hope this was useful. If you need help, I can be reached through RT mailing lists.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://wiki.bestpractical.com/view/Cris Cris]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thanks to Cris for this documentation! Here are a few things we changed for our organisation : &lt;br /&gt;
&lt;br /&gt;
With the missing files included in sphinx.php, I had to change a few things so here is my spinx.php file : &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
        &amp;lt;head&amp;gt;&lt;br /&gt;
                &amp;lt;title&amp;gt;Recherche Ticket Sphinx&amp;lt;/title&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script src=&amp;quot;Classi/sorttable.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
                &amp;lt;style&amp;gt;&lt;br /&gt;
                        body {font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}&lt;br /&gt;
                        table {font-size:inherit;font:100%;}&lt;br /&gt;
                        pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}&lt;br /&gt;
&lt;br /&gt;
                        a {&lt;br /&gt;
                                color: #000;&lt;br /&gt;
                                text-decoration: none;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        div#body a:visited {&lt;br /&gt;
                                color: #666;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        /* background: #547CCC ; */&lt;br /&gt;
                        body {&lt;br /&gt;
                                padding:0;&lt;br /&gt;
                                margin:0;&lt;br /&gt;
&lt;br /&gt;
                                background: #FFFFFF ;&lt;br /&gt;
                                font-family: arial, helvetica, sans-serif;&lt;br /&gt;
&lt;br /&gt;
                                color: #000000;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list, table.queue-summary, table.collection {&lt;br /&gt;
                                margin-top: 0.75em;&lt;br /&gt;
                                font-size: 0.9em;&lt;br /&gt;
                                border: 1px solid #aaa;&lt;br /&gt;
                                border-bottom: 2px solid #999;&lt;br /&gt;
                                border-right: 2px solid #999;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary tr&amp;gt;*:first-child {&lt;br /&gt;
                                padding-left: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary tr&amp;gt;*:last-child {&lt;br /&gt;
                                padding-right: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list a, table.queue-summary a, table.collection a  {&lt;br /&gt;
                                font-weight: bold;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list th.collection-as-table, table.collection th.collection-as-table {&lt;br /&gt;
                                background: #ddd;&lt;br /&gt;
                                font-size: 0.9em;&lt;br /&gt;
                                margin-bottom: 0.5em;&lt;br /&gt;
                                text-align: left;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary th.collection-as-table {&lt;br /&gt;
                                font-size: 0.9em;&lt;br /&gt;
                                margin-bottom: 0.5em;&lt;br /&gt;
                                text-align: right;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary th.collection-as-table:first-child {&lt;br /&gt;
                                text-align: left;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.collection-as-table+tr.collection-as-table th {&lt;br /&gt;
                                border-bottom: 2px solid grey;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.queue-summary td {&lt;br /&gt;
                                background: #efefef;&lt;br /&gt;
                                border-bottom: 1px solid #ccc;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.evenline td {&lt;br /&gt;
                                background: #eee;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.oddline td {&lt;br /&gt;
                                background: #fff;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.evenline td, tr.oddline td {&lt;br /&gt;
                                padding-top: 0.5em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        tr.evenline+tr.evenline td, tr.oddline+tr.oddline td{&lt;br /&gt;
                                padding-top: 0;&lt;br /&gt;
                                border: none;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list td:first-child, table.ticket-list th:first-child {&lt;br /&gt;
                                padding-left: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        table.ticket-list td:last-child, table.ticket-list th:last-child {&lt;br /&gt;
                                padding-right: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        th.collection-as-table , td.collection-as-table {&lt;br /&gt;
                                padding-right: 0.5em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        .pagenum.a:hover, .paging a.nav:hover{&lt;br /&gt;
                                text-decoration: underline;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        .pagenum *, .paging a.nav{&lt;br /&gt;
                                padding: .5em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        .currentpage{&lt;br /&gt;
                                text-decoration: none;&lt;br /&gt;
                                font-weight: bold;&lt;br /&gt;
                                background: #eee;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        div.paging{&lt;br /&gt;
                                text-align: center;&lt;br /&gt;
                                padding-bottom: 1em;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        #body&amp;gt;table.ticket-list {&lt;br /&gt;
                                margin-bottom: 2em;&lt;br /&gt;
                        }&lt;br /&gt;
                &amp;lt;/style&amp;gt;&lt;br /&gt;
                &amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;body&amp;gt;&lt;br /&gt;
                &amp;lt;?php&lt;br /&gt;
                //Costante con il max numero di righe ritornate da Sphinx&lt;br /&gt;
                define(&#039;SPHINX_MAX_LIMIT&#039;, 1000);&lt;br /&gt;
&lt;br /&gt;
                require_once(&amp;quot;Classi/sphinxapi.php&amp;quot;);&lt;br /&gt;
                //require_once(&amp;quot;Classi/Timer.class.php&amp;quot;);&lt;br /&gt;
                require_once(&amp;quot;Classi/MySql.class.php&amp;quot;);&lt;br /&gt;
                require_once(&amp;quot;Classi/ErrorManager.class.php&amp;quot;);&lt;br /&gt;
                include_once(&amp;quot;Include/Query.inc.php&amp;quot;);&lt;br /&gt;
                include_once(&amp;quot;Include/dvopendb.config.inc.php&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        //      $MyTimer =  new Timer();&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Parametri di connessione al Daemon Sphinx&lt;br /&gt;
                $host = &amp;quot;localhost&amp;quot;;&lt;br /&gt;
                $port = 9312;&lt;br /&gt;
                $index = &amp;quot;*&amp;quot;; // put your index name here&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Variabili in GET&lt;br /&gt;
                $query = $_GET[&#039;Text&#039;];&lt;br /&gt;
                $RequestorFilter = trim($_GET[&#039;Requestor&#039;]);&lt;br /&gt;
                $CodaFilter = $_GET[&#039;Queue&#039;];&lt;br /&gt;
                $DataInizioFilter = trim($_GET[&#039;From&#039;]);&lt;br /&gt;
                $DataFineFilter = trim($_GET[&#039;To&#039;]);&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Connessione al Daemon Sphinx&lt;br /&gt;
                $cl = new SphinxClient();&lt;br /&gt;
                $cl-&amp;gt;SetServer($host, $port);&lt;br /&gt;
                $cl-&amp;gt;SetMatchMode(SPH_MATCH_EXTENDED2);&lt;br /&gt;
                $cl-&amp;gt;SetLimits(0,SPHINX_MAX_LIMIT, $max_matches=0, $cutoff=0 );&lt;br /&gt;
&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //MySql Database Query per la retrive dei dati del ticket&lt;br /&gt;
&lt;br /&gt;
                $SqlQuery = new MySql();&lt;br /&gt;
                $SqlQuery-&amp;gt;connect($DbHostName,$DbName,$DbUser,$DbPassword);&lt;br /&gt;
&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Filtri sulla ricerca Sphinx&lt;br /&gt;
&lt;br /&gt;
                //Check della query (parametro di ricerca)&lt;br /&gt;
                if(strlen($query)==0)&lt;br /&gt;
                {&lt;br /&gt;
                        echo &amp;quot;Un paramètre doit être inscrit dans la zone  \&amp;quot;Texte\&amp;quot; pour continuer.&amp;quot;;&lt;br /&gt;
                        exit(1);&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Filtro Requestor&lt;br /&gt;
                if(strlen($RequestorFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        $TempQuery = sprintf($RequestorLookUpQuery,mysql_real_escape_string($RequestorFilter));&lt;br /&gt;
//                      $result22 = $SqlQuery-&amp;gt;query($TempQuery);&lt;br /&gt;
//                      $RequestorResult = $SqlQuery-&amp;gt;fetchAll($result22);&lt;br /&gt;
                                        $result22 = $SqlQuery-&amp;gt;query($TempQuery);&lt;br /&gt;
                                        $RequestorResult = mysql_fetch_array($result22);&lt;br /&gt;
                        if(count($RequestorResult)&amp;gt;0)&lt;br /&gt;
                        {&lt;br /&gt;
                                $cl-&amp;gt;SetFilter (&amp;quot;createdby&amp;quot;,array($RequestorResult[&#039;id&#039;]) , $exclude=false );&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;&amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;gt;Attention - L&#039;adresse \&amp;quot;&amp;quot;.$RequestorFilter.&amp;quot;\&amp;quot; n&#039;est pas dans la base de donnée et la recherche a été effectuée &amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Filtro Queue&lt;br /&gt;
                if(strlen($CodaFilter)&amp;gt;0)&lt;br /&gt;
                        $cl-&amp;gt;SetFilter (&amp;quot;queue&amp;quot;, array($CodaFilter), $exclude=false );&lt;br /&gt;
&lt;br /&gt;
                //Filtro Data&lt;br /&gt;
&lt;br /&gt;
                //__________________________________________________________________________________________________________________&lt;br /&gt;
                //Check delle date&lt;br /&gt;
                if(strlen($DataInizioFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        //Check Datainizio&lt;br /&gt;
                        if(checkdate(substr($DataInizioFilter,5,2),substr($DataInizioFilter,8,2),substr($DataInizioFilter,0,4))==false)&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;Date de début &amp;quot;.$DataInizioFilter.&amp;quot; incorrecte &amp;quot;;&lt;br /&gt;
                                exit(1);&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                                 $DataInizio = mktime(0, 0, 0, substr($DataInizioFilter,5,2), substr($DataInizioFilter,8,2), substr($DataInizioFilter,0,4));&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                if(strlen($DataFineFilter)&amp;gt;0)&lt;br /&gt;
                {       //Check DataFine&lt;br /&gt;
&lt;br /&gt;
                        if(checkdate(substr($DataFineFilter,5,2),substr($DataFineFilter,8,2),substr($DataFineFilter,0,4))==false)&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;Date de fin &amp;quot;.$DataFineFilter.&amp;quot; incorrecte &amp;quot;;&lt;br /&gt;
                                exit(1);&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                                $DataFine = mktime(0, 0, 0, substr($DataFineFilter,5,2), substr($DataFineFilter,8,2), substr($DataFineFilter,0,4));&lt;br /&gt;
                }&lt;br /&gt;
                //__________________________________________________________________________________________________________________&lt;br /&gt;
&lt;br /&gt;
                //Filtraggio vero e proprio&lt;br /&gt;
&lt;br /&gt;
                //Se sono settate entrambe...&lt;br /&gt;
                if(strlen($DataInizioFilter)&amp;gt;0 &amp;amp;&amp;amp; strlen($DataFineFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        if($DataInizio &amp;lt; $DataFine)&lt;br /&gt;
                        {&lt;br /&gt;
                                //Se sono settate entrambe le date filtro per entrambe&lt;br /&gt;
                                $cl-&amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, $DataFine, $exclude=false );&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                        {&lt;br /&gt;
                                echo &amp;quot;La date de début &amp;quot;.$DataInizioFilter.&amp;quot; est supérieure à la date de fin &amp;quot;.$DataFineFilter;&lt;br /&gt;
                                exit(1);&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Se solo DataInizio..&lt;br /&gt;
                if(strlen($DataInizioFilter)&amp;gt;0 &amp;amp;&amp;amp; strlen($DataFineFilter)==0)&lt;br /&gt;
                {&lt;br /&gt;
                        $cl-&amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, $DataInizio, mktime(), $exclude=false );&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                //Se solo DataFine..&lt;br /&gt;
                if(strlen($DataInizioFilter)==0 &amp;amp;&amp;amp; strlen($DataFineFilter)&amp;gt;0)&lt;br /&gt;
                {&lt;br /&gt;
                        //2008-11-14 : Data del primo Ticket di RT&lt;br /&gt;
                        //1988-07-18 : Data di nascita di AMENDED :)&lt;br /&gt;
                        $cl-&amp;gt;SetFilterRange(&amp;quot;created&amp;quot;, mktime(0, 0, 0,07,18,1988), $DataFine, $exclude=false );&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                //-----------------------------------------------------------------------------------------------&lt;br /&gt;
                //Eseguo la Query su Sphinx&lt;br /&gt;
&lt;br /&gt;
                $res = $cl-&amp;gt;Query($query, $index);&lt;br /&gt;
                if ($res == false)&lt;br /&gt;
                {&lt;br /&gt;
                        echo &amp;quot;failure: &amp;quot;.$cl-&amp;gt;GetLastError().&amp;quot;\n&amp;quot;;&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                        if(count($res[&#039;matches&#039;])!=0)&lt;br /&gt;
                        {&lt;br /&gt;
                                //Se i risultati totali sono &amp;gt; 1000&lt;br /&gt;
                                if($res[&#039;total_found&#039;]&amp;gt;SPHINX_MAX_LIMIT)&lt;br /&gt;
                                {&lt;br /&gt;
                                        echo &amp;quot;&amp;lt;label class=\&amp;quot;warninglabel\&amp;quot;&amp;gt; Attention, &amp;quot;.$res[total_found].&amp;quot; résultats ont été trouvés, mais vous ne verrez que les premiers &amp;quot;.SPHINX_MAX_LIMIT.&amp;quot; résultats.&amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
                                }&lt;br /&gt;
&lt;br /&gt;
                                //Se ci sono dei risultati creo la tabella e stampo&lt;br /&gt;
                                //echo &amp;quot;&amp;lt;table id=&#039;ResultTable&#039; class=&#039;ticket-list&#039; border=&#039;0&#039; cellspacing=&#039;0&#039; cellpadding=&#039;1&#039; width=&#039;100%&#039;&amp;gt;&lt;br /&gt;
                                echo &amp;quot;&amp;lt;table id=&#039;ResultTable&#039; class=&#039;sortable&#039; border=&#039;0&#039; cellspacing=&#039;0&#039; cellpadding=&#039;1&#039; width=&#039;100%&#039;&amp;gt;&lt;br /&gt;
                                                &amp;lt;thead&amp;gt;&lt;br /&gt;
                                                &amp;lt;tr class=&#039;collection-as-table&#039;&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;#&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Sujet&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;École&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Status&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Date_de_création&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Demandeur&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                        &amp;lt;th class=&#039;collection-as-table&#039;&amp;gt;Propriétaire&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                                                &amp;lt;/thead&amp;gt;&amp;lt;tbody&amp;gt;&amp;quot;;&lt;br /&gt;
                                foreach ($res[&amp;quot;matches&amp;quot;] as $key=&amp;gt;$value)&lt;br /&gt;
                                {&lt;br /&gt;
                                        $i++;&lt;br /&gt;
                                        $TempQuery = sprintf($TicketDetailQuery,mysql_real_escape_string($key));&lt;br /&gt;
                                        $result34 = $SqlQuery-&amp;gt;query($TempQuery);&lt;br /&gt;
                                        $Risultato = mysql_fetch_array($result34);&lt;br /&gt;
                                        //$Risultato = $SqlQuery-&amp;gt;queryFetchAll($TempQuery);&lt;br /&gt;
                                        //$Risultato = $SqlQuery-&amp;gt;fetchAll($result23);&lt;br /&gt;
                                        if($i%2==0)&lt;br /&gt;
                                        {&lt;br /&gt;
                                                                                        echo &amp;quot;  &amp;lt;tr class=&#039;evenline&#039;&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                &amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
                                        }&lt;br /&gt;
                                        else&lt;br /&gt;
                                        {&lt;br /&gt;
                                                echo &amp;quot;  &amp;lt;tr class=&#039;oddline&#039;&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039; width=&#039;400&#039;&amp;gt;&amp;lt;a href=&#039;http://AMENDED/Ticket/Display.html?id=&amp;quot;.$Risultato[&#039;id&#039;].&amp;quot;&#039; target=&#039;_top&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Subject&#039;].&amp;quot;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Queue&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Status&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Created&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Requestor&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                        &amp;lt;td class=&#039;collection-as-table&#039;&amp;gt;&amp;quot;.$Risultato[&#039;Owner&#039;].&amp;quot;&amp;lt;/td&amp;gt;&lt;br /&gt;
                                                                &amp;lt;/tr&amp;gt;&amp;quot;;&lt;br /&gt;
                                        }&lt;br /&gt;
                                }&lt;br /&gt;
                                echo &amp;quot;  &amp;lt;/tbody&amp;gt;&lt;br /&gt;
                                        &amp;lt;tfoot&amp;gt;&amp;lt;/tfoot&amp;gt;&lt;br /&gt;
                                        &amp;lt;/table&amp;gt;&amp;quot;;&lt;br /&gt;
                        }&lt;br /&gt;
                        else&lt;br /&gt;
                        {&lt;br /&gt;
                                //...Altrimenti stampo che non ho trovato nulla&lt;br /&gt;
                                echo &amp;quot;&amp;lt;br/&amp;gt;&amp;lt;label class=\&amp;quot;notfoundlabel\&amp;quot;&amp;gt;Aucun résultat trouvé&amp;lt;/label&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;;&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                        echo &amp;quot;Résultats &amp;quot;.$res[&#039;total&#039;].&amp;quot; de &amp;quot;.$res[&#039;total_found&#039;]; // in &amp;quot;.$MyTimer-&amp;gt;elapsed().&amp;quot; secondi&amp;quot;;&lt;br /&gt;
                }&lt;br /&gt;
                ?&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here is my Classi/MySql.class.php file&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
class MySQLException extends Exception { }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class MySQL {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private $host = null,&lt;br /&gt;
                        $baseName = null,&lt;br /&gt;
                        $user = null,&lt;br /&gt;
                        $id = null;&lt;br /&gt;
&lt;br /&gt;
        private $errorManager = null;&lt;br /&gt;
&lt;br /&gt;
        private $queries = array();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function __construct() {&lt;br /&gt;
&lt;br /&gt;
                $this-&amp;gt;errorManager = ErrorManager::getInstance();&lt;br /&gt;
&lt;br /&gt;
        } // public function __construct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getHost() { return $this-&amp;gt;host; }&lt;br /&gt;
        public function getBaseName() { return $this-&amp;gt;baseName; }&lt;br /&gt;
        public function getUser() { return $this-&amp;gt;user; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function connect($host, $base, $user, $password, $enconding = &amp;quot;utf8&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                if (!($this-&amp;gt;id = mysql_connect($host, $user, $password))) {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;host = null;&lt;br /&gt;
                        $this-&amp;gt;base = null;&lt;br /&gt;
                        $this-&amp;gt;user = null;&lt;br /&gt;
                        $this-&amp;gt;id = null;&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;database connection failed!&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
                        $this-&amp;gt;host = $host;&lt;br /&gt;
                        $this-&amp;gt;user = $user;&lt;br /&gt;
                        if (mysql_select_db($base, $this-&amp;gt;id)) {&lt;br /&gt;
                                $this-&amp;gt;baseName = $base;&lt;br /&gt;
                        }&lt;br /&gt;
                        mysql_query(&amp;quot;set names $enconding&amp;quot;, $this-&amp;gt;id);&lt;br /&gt;
                        //mysql_set_charset($enconding, $this-&amp;gt;id);&lt;br /&gt;
                        return true;&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function connect($host, $base, $user, $password)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getLastId() {&lt;br /&gt;
&lt;br /&gt;
                if (is_resource($this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                        $lastId = mysql_insert_id($this-&amp;gt;id);&lt;br /&gt;
                        return $lastId;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;database is not connected, can&#039;t get last id&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function getLastId()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function fetchAll($result) {&lt;br /&gt;
&lt;br /&gt;
                if (mysql_num_rows($result)) {&lt;br /&gt;
&lt;br /&gt;
                        $rows = array();&lt;br /&gt;
&lt;br /&gt;
                        while ($row = mysql_fetch_assoc($result)) {&lt;br /&gt;
                                $rows[] = $row;&lt;br /&gt;
                        }&lt;br /&gt;
                        return $rows;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;invalid mysql query result supplied to fetchAll()&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function fetchAll($result)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function query($string) {&lt;br /&gt;
&lt;br /&gt;
                if (is_resource($this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                        if ($result = mysql_query($string, $this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                                $this-&amp;gt;queries[] = $string;&lt;br /&gt;
                                return $result;&lt;br /&gt;
&lt;br /&gt;
                        }&lt;br /&gt;
                        else {&lt;br /&gt;
                                $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;error in query: &#039;$string&#039;:&amp;quot;.mysql_error($this-&amp;gt;id)));&lt;br /&gt;
                        }&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else {&lt;br /&gt;
&lt;br /&gt;
                        $this-&amp;gt;errorManager-&amp;gt;reportFatalError($this, new MySQLException(&amp;quot;database is not connected, can&#039;t make query&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function query($string)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function queryFetchAll($query) {&lt;br /&gt;
&lt;br /&gt;
                $result = $this-&amp;gt;query($query);&lt;br /&gt;
                $entries = $this-&amp;gt;fetchAll($result);&lt;br /&gt;
&lt;br /&gt;
                return $entries;&lt;br /&gt;
&lt;br /&gt;
        } // public function queryFetchAll($query)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getQueries() {&lt;br /&gt;
&lt;br /&gt;
                return $this-&amp;gt;queries;&lt;br /&gt;
&lt;br /&gt;
        } // public function getQueries()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function __destruct() {&lt;br /&gt;
&lt;br /&gt;
                if (is_resource($this-&amp;gt;id)) {&lt;br /&gt;
&lt;br /&gt;
                        mysql_close($this-&amp;gt;id);&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
        } // public function __destruct()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} // class Mysql&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I added ErrorManager.class.php also : &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
class ErrorManager {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private static $instance = null;&lt;br /&gt;
&lt;br /&gt;
        private $errors = array();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private function __construct() { }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public static function getInstance() {&lt;br /&gt;
&lt;br /&gt;
                if (self::$instance == null) {&lt;br /&gt;
&lt;br /&gt;
                        self::$instance = new ErrorManager();&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                return self::$instance;&lt;br /&gt;
&lt;br /&gt;
        } // public function getInstance()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function getErrors() {&lt;br /&gt;
&lt;br /&gt;
                return $this-&amp;gt;errors;&lt;br /&gt;
&lt;br /&gt;
        } // public function getErrors()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public function reportError(&amp;amp;$sourceObject, $msg = &amp;quot;&amp;quot;) {&lt;br /&gt;
&lt;br /&gt;
                $class = get_class($sourceObject);&lt;br /&gt;
                $this-&amp;gt;errors[] = array(&amp;quot;source&amp;quot; =&amp;gt; $sourceObject, &amp;quot;message&amp;quot; =&amp;gt; &amp;quot;$class: \&amp;quot;$msg\&amp;quot;&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
        } // public function reportError($sourceObject, $msg = &amp;quot;&amp;quot;)&lt;br /&gt;
        public function reportFatalError(&amp;amp;$sourceObject, $exception = null) {&lt;br /&gt;
&lt;br /&gt;
                if (!($exception instanceof Exception)) {&lt;br /&gt;
&lt;br /&gt;
                        $exception = new Exception();&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                $msg = $exception-&amp;gt;getMessage();&lt;br /&gt;
                $class = get_class($sourceObject);&lt;br /&gt;
                $this-&amp;gt;reportError($sourceObject, &amp;quot;fatal error: $msg&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
                throw $exception;&lt;br /&gt;
&lt;br /&gt;
        } // public function reportFatalError($sourceObject, $exception)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} // class ErrorManager&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the Classi I added http://www.kryogenix.org/code/browser/sorttable/sorttable.js for the table to sort.&lt;br /&gt;
&lt;br /&gt;
When you download the last beta version of sphinx, you get a api so I copied it to the Classi also : &lt;br /&gt;
sphinxbeta/sphinx-2.0.1-beta/api/sphinxapi.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The most important thing is to change the limit in the php for the group_concat to make sure you will get all your tickets : &lt;br /&gt;
mysql -p &lt;br /&gt;
SET GLOBAL group_concat_max_len = 8192000;&lt;br /&gt;
&lt;br /&gt;
My sphinx.conf is the following :&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
source rt3&lt;br /&gt;
{&lt;br /&gt;
        type                    = mysql&lt;br /&gt;
&lt;br /&gt;
        sql_host                = localhost&lt;br /&gt;
        sql_user                = &lt;br /&gt;
        sql_pass                = &lt;br /&gt;
        sql_db                  = rt3&lt;br /&gt;
        sql_port                = 3306  # optional, default is 3306&lt;br /&gt;
        sql_query               = \&lt;br /&gt;
                select TK.id as TicketNum, \&lt;br /&gt;
                        TK.Creator as CreatedBy, \&lt;br /&gt;
                        TK.Queue as Queue, \&lt;br /&gt;
                        unix_timestamp(TK.Created) as Created, \&lt;br /&gt;
                        TK.Subject as Subject, \&lt;br /&gt;
                        group_concat(A.Content) as Content \&lt;br /&gt;
                from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
                where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
                and A.TransactionId = T.id \&lt;br /&gt;
                and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
                and (A.ContentType = &#039;text/plain&#039; or A.ContentType = &#039;text/html&#039;) \&lt;br /&gt;
                and A.Content is not null \&lt;br /&gt;
                and TK.Created &amp;lt; concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) \&lt;br /&gt;
                group by TK.id \&lt;br /&gt;
                order by TK.id, T.id&lt;br /&gt;
&lt;br /&gt;
        sql_attr_uint           = Created&lt;br /&gt;
        sql_attr_uint           = Queue&lt;br /&gt;
        sql_attr_uint           = CreatedBy&lt;br /&gt;
        sql_query_info          = SELECT * FROM Tickets WHERE id=$id&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
source rt3delta : rt3&lt;br /&gt;
 {&lt;br /&gt;
        sql_query               = \&lt;br /&gt;
                select TK.id as TicketNum, \&lt;br /&gt;
                        TK.Creator as CreatedBy, \&lt;br /&gt;
                        TK.Queue as Queue, \&lt;br /&gt;
                        unix_timestamp(TK.Created) as Created, \&lt;br /&gt;
                        TK.Subject as Subject, \&lt;br /&gt;
                        group_concat(A.Content) as Content \&lt;br /&gt;
                from Tickets TK, Transactions T, Attachments A \&lt;br /&gt;
                where ((T.ObjectId = TK.id) or (T.ObjectId is null)) \&lt;br /&gt;
                and A.TransactionId = T.id \&lt;br /&gt;
                and T.ObjectType = &#039;RT::Ticket&#039; \&lt;br /&gt;
                and A.Content is not null \&lt;br /&gt;
                and TK.Created between concat(year(now()),&#039;-&#039;,month(now()),&#039;-01&#039;) and last_day(now()) \&lt;br /&gt;
                group by TK.id \&lt;br /&gt;
                order by TK.id, T.id&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
index fulltext1&lt;br /&gt;
 {&lt;br /&gt;
        source                  = rt3&lt;br /&gt;
        path                    = /var/data/fulltext1&lt;br /&gt;
        docinfo                 = extern&lt;br /&gt;
        charset_type    = utf-8&lt;br /&gt;
        html_strip = 1&lt;br /&gt;
        min_word_len = 1&lt;br /&gt;
        enable_star     = 1&lt;br /&gt;
        min_infix_len   = 3&lt;br /&gt;
&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 index fulltextdelta: fulltext1&lt;br /&gt;
 {&lt;br /&gt;
        source                  = rt3delta&lt;br /&gt;
        charset_type            = utf-8&lt;br /&gt;
        path                    = /var/data/fulltextdelta&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 indexer&lt;br /&gt;
 {&lt;br /&gt;
        mem_limit               = 128M&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
searchd&lt;br /&gt;
{&lt;br /&gt;
        listen                  = 9312&lt;br /&gt;
        listen                  = 9306:mysql41&lt;br /&gt;
        log                     = /var/log/sphinx/searchd.log&lt;br /&gt;
        query_log               = /var/log/sphinx/query.log&lt;br /&gt;
        read_timeout            = 5&lt;br /&gt;
        max_children            = 30&lt;br /&gt;
        pid_file                = /var/run/sphinx/searchd.pid&lt;br /&gt;
        max_matches             = 1000&lt;br /&gt;
        seamless_rotate         = 1&lt;br /&gt;
        preopen_indexes         = 1&lt;br /&gt;
        unlink_old              = 1&lt;br /&gt;
        workers                 = threads # for RT to work&lt;br /&gt;
}&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=1391</id>
		<title>Full Text Search Portlet</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=1391"/>
		<updated>2012-05-23T09:26:33Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Added warning for users of RT releases more recent than 4.0.2&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:FTSearch.png|thumb|350px|The portlet]]&lt;br /&gt;
==&#039;&#039;&#039;The full-text search portlet&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[[NOTE]]: we have this working on RT 4.0.2. It seems more recent RT releases changed the &amp;quot;Simple Search&amp;quot; page quite heavily and thus the portlet is not working correctly. I&#039;ll post a new portlet when I have the code corrected.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
After the release of RT 4.0 we began investigating the migration from our 3.8.x RT installation.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;simple search&amp;quot; page, and to have to add &amp;quot;fulltext:&amp;quot; every time.&lt;br /&gt;
&lt;br /&gt;
So I thought &amp;quot;why not write a portlet again&amp;quot;, 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 &amp;quot;simple search&amp;quot; page again for... simple searches :-)&lt;br /&gt;
&lt;br /&gt;
So here it is, for those who want to have a usable alternative to the &amp;quot;simple search&amp;quot; page and yet don&#039;t want to always use the advanced search.&lt;br /&gt;
&lt;br /&gt;
Paste the content of the following box into a file. I called it FTSearch.&lt;br /&gt;
&lt;br /&gt;
You have to put it in:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;your_rt_root&amp;gt;&#039;&#039;\local\html\Elements&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;&amp;amp;|/Widgets/TitleBox, title =&amp;gt; loc(&#039;Fulltext Search&#039;), bodyclass =&amp;gt; &amp;quot;&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
     &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
     function MangleData()&lt;br /&gt;
     {&lt;br /&gt;
         // qui aggrego tutti i campi della prima form&lt;br /&gt;
         var textstring = &#039;&#039;&#039;&#039;&#039;&#039;&#039;;&lt;br /&gt;
        &lt;br /&gt;
         for (i=3;i&amp;gt;0;i--) {&lt;br /&gt;
             var box = document.forms[&#039;fulltext-search&#039;].elements[i];&lt;br /&gt;
             if (box.value) {&lt;br /&gt;
                 textstring += box.value + &#039; &#039;;&lt;br /&gt;
             }&lt;br /&gt;
         }&lt;br /&gt;
        textstring += &#039;fulltext:&#039; + document.forms[&#039;fulltext-search&#039;].elements[0].value &lt;br /&gt;
 &lt;br /&gt;
         // popolo la seconda form con la stringa ricavata dalla prima&lt;br /&gt;
         document.forms[&#039;simple-search&#039;].elements[0].value = textstring;&lt;br /&gt;
 &lt;br /&gt;
         // sottometto la seconda form invece della prima&lt;br /&gt;
         document.forms[&#039;simple-search&#039;].submit();&lt;br /&gt;
     }&lt;br /&gt;
     &amp;lt;/script&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;fulltext-search&amp;quot; action=&amp;quot;#&amp;quot; method=&amp;quot;get&amp;quot; onsubmit=&amp;quot;MangleData(); return false&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Text&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;Text&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Queue&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectQueue, NamedValues =&amp;gt; 1, Name =&amp;gt; &#039;Queue&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Requestor&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/EmailInput, Name =&amp;gt; &#039;Requestor&#039;, Size =&amp;gt; &#039;40&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Owner&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectOwner, ValueAttribute =&amp;gt; &amp;quot;Name&amp;quot;, Name =&amp;gt; &amp;quot;Owner&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;submit&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
                 &amp;lt;input class=&amp;quot;button&amp;quot; type=&amp;quot;submit&amp;quot; value=&amp;quot;Submit&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/div&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;input2&amp;quot; action=&amp;quot;/Search/Simple.html&amp;quot; method=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input style=&amp;quot;display:none&amp;quot; type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;q&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
 &amp;lt;/&amp;amp;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
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&#039;t have it, copy it from RT_Config.pm.&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
 &amp;gt; rm -rf /opt/rt4/var/mason_data/obj/*&lt;br /&gt;
 &amp;gt; svcadm restart apache22&lt;br /&gt;
Then, in RT, click on the &amp;quot;EDIT&amp;quot; box in the top right corner and add FTSearch to your home page.&lt;br /&gt;
&lt;br /&gt;
That&#039;s all! Hope you enjoy it.&lt;br /&gt;
&lt;br /&gt;
[[Cris]]&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=1390</id>
		<title>Full Text Search Portlet</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=1390"/>
		<updated>2012-05-23T08:15:21Z</updated>

		<summary type="html">&lt;p&gt;Cris70: corrected a syntax error in javascript code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:FTSearch.png|thumb|350px|The portlet]]&lt;br /&gt;
==&#039;&#039;&#039;The full-text search portlet&#039;&#039;&#039;==&lt;br /&gt;
After the release of RT 4.0 we began investigating the migration from our 3.8.x RT installation.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;simple search&amp;quot; page, and to have to add &amp;quot;fulltext:&amp;quot; every time.&lt;br /&gt;
&lt;br /&gt;
So I thought &amp;quot;why not write a portlet again&amp;quot;, 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 &amp;quot;simple search&amp;quot; page again for... simple searches :-)&lt;br /&gt;
&lt;br /&gt;
So here it is, for those who want to have a usable alternative to the &amp;quot;simple search&amp;quot; page and yet don&#039;t want to always use the advanced search.&lt;br /&gt;
&lt;br /&gt;
Paste the content of the following box into a file. I called it FTSearch.&lt;br /&gt;
&lt;br /&gt;
You have to put it in:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;your_rt_root&amp;gt;&#039;&#039;\local\html\Elements&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;&amp;amp;|/Widgets/TitleBox, title =&amp;gt; loc(&#039;Fulltext Search&#039;), bodyclass =&amp;gt; &amp;quot;&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
     &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
     function MangleData()&lt;br /&gt;
     {&lt;br /&gt;
         // qui aggrego tutti i campi della prima form&lt;br /&gt;
         var textstring = &#039;&#039;&#039;&#039;&#039;&#039;&#039;;&lt;br /&gt;
        &lt;br /&gt;
         for (i=3;i&amp;gt;0;i--) {&lt;br /&gt;
             var box = document.forms[&#039;fulltext-search&#039;].elements[i];&lt;br /&gt;
             if (box.value) {&lt;br /&gt;
                 textstring += box.value + &#039; &#039;;&lt;br /&gt;
             }&lt;br /&gt;
         }&lt;br /&gt;
        textstring += &#039;fulltext:&#039; + document.forms[&#039;fulltext-search&#039;].elements[0].value &lt;br /&gt;
 &lt;br /&gt;
         // popolo la seconda form con la stringa ricavata dalla prima&lt;br /&gt;
         document.forms[&#039;simple-search&#039;].elements[0].value = textstring;&lt;br /&gt;
 &lt;br /&gt;
         // sottometto la seconda form invece della prima&lt;br /&gt;
         document.forms[&#039;simple-search&#039;].submit();&lt;br /&gt;
     }&lt;br /&gt;
     &amp;lt;/script&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;fulltext-search&amp;quot; action=&amp;quot;#&amp;quot; method=&amp;quot;get&amp;quot; onsubmit=&amp;quot;MangleData(); return false&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Text&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;Text&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Queue&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectQueue, NamedValues =&amp;gt; 1, Name =&amp;gt; &#039;Queue&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Requestor&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/EmailInput, Name =&amp;gt; &#039;Requestor&#039;, Size =&amp;gt; &#039;40&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Owner&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectOwner, ValueAttribute =&amp;gt; &amp;quot;Name&amp;quot;, Name =&amp;gt; &amp;quot;Owner&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;submit&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
                 &amp;lt;input class=&amp;quot;button&amp;quot; type=&amp;quot;submit&amp;quot; value=&amp;quot;Submit&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/div&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;input2&amp;quot; action=&amp;quot;/Search/Simple.html&amp;quot; method=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input style=&amp;quot;display:none&amp;quot; type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;q&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
 &amp;lt;/&amp;amp;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
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&#039;t have it, copy it from RT_Config.pm.&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
 &amp;gt; rm -rf /opt/rt4/var/mason_data/obj/*&lt;br /&gt;
 &amp;gt; svcadm restart apache22&lt;br /&gt;
Then, in RT, click on the &amp;quot;EDIT&amp;quot; box in the top right corner and add FTSearch to your home page.&lt;br /&gt;
&lt;br /&gt;
That&#039;s all! Hope you enjoy it.&lt;br /&gt;
&lt;br /&gt;
[[Cris]]&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=1388</id>
		<title>Full Text Search Portlet</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=1388"/>
		<updated>2012-01-26T16:52:26Z</updated>

		<summary type="html">&lt;p&gt;Cris70: minor error&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:FTSearch.png|thumb|350px|The portlet]]&lt;br /&gt;
==&#039;&#039;&#039;The full-text search portlet&#039;&#039;&#039;==&lt;br /&gt;
After the release of RT 4.0 we began investigating the migration from our 3.8.x RT installation.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;simple search&amp;quot; page, and to have to add &amp;quot;fulltext:&amp;quot; every time.&lt;br /&gt;
&lt;br /&gt;
So I thought &amp;quot;why not write a portlet again&amp;quot;, 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 &amp;quot;simple search&amp;quot; page again for... simple searches :-)&lt;br /&gt;
&lt;br /&gt;
So here it is, for those who want to have a usable alternative to the &amp;quot;simple search&amp;quot; page and yet don&#039;t want to always use the advanced search.&lt;br /&gt;
&lt;br /&gt;
Paste the content of the following box into a file. I called it FTSearch.&lt;br /&gt;
&lt;br /&gt;
You have to put it in:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;your_rt_root&amp;gt;&#039;&#039;\local\html\Elements&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;&amp;amp;|/Widgets/TitleBox, title =&amp;gt; loc(&#039;Fulltext Search&#039;), bodyclass =&amp;gt; &amp;quot;&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
     &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
     function MangleData()&lt;br /&gt;
     {&lt;br /&gt;
         // qui aggrego tutti i campi della prima form&lt;br /&gt;
         var textstring = &#039;&#039;;&#039;&#039;&lt;br /&gt;
         &lt;br /&gt;
         for (i=3;i&amp;gt;0;i--) {&lt;br /&gt;
             var box = document.forms[&#039;input&#039;].elements[i];&lt;br /&gt;
             if (box.value) {&lt;br /&gt;
                 textstring += box.value + &#039; &#039;;&lt;br /&gt;
             }&lt;br /&gt;
         }&lt;br /&gt;
         textstring += &#039;fulltext:&amp;quot;&#039; + document.forms[&#039;input&#039;].elements[0].value + &#039;&amp;quot;&#039;&lt;br /&gt;
 &lt;br /&gt;
         // popolo la seconda form con la stringa ricavata dalla prima&lt;br /&gt;
         document.forms[&#039;input2&#039;].elements[0].value = textstring;&lt;br /&gt;
         &lt;br /&gt;
         // sottometto la seconda form invece della prima&lt;br /&gt;
         document.forms[&#039;input2&#039;].submit();&lt;br /&gt;
     }&lt;br /&gt;
     &amp;lt;/script&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;input&amp;quot; action=&amp;quot;#&amp;quot; method=&amp;quot;get&amp;quot; onsubmit=&amp;quot;MangleData(); return false&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Text&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;Text&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Queue&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectQueue, NamedValues =&amp;gt; 1, Name =&amp;gt; &#039;Queue&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Requestor&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/EmailInput, Name =&amp;gt; &#039;Requestor&#039;, Size =&amp;gt; &#039;40&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Owner&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectOwner, ValueAttribute =&amp;gt; &amp;quot;Name&amp;quot;, Name =&amp;gt; &amp;quot;Owner&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;submit&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
                 &amp;lt;input class=&amp;quot;button&amp;quot; type=&amp;quot;submit&amp;quot; value=&amp;quot;Submit&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/div&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;input2&amp;quot; action=&amp;quot;/Search/Simple.html&amp;quot; method=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input style=&amp;quot;display:none&amp;quot; type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;q&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
 &amp;lt;/&amp;amp;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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&#039;t have it, copy it from RT_Config.pm.&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
 &amp;gt; rm -rf /opt/rt4/var/mason_data/obj/*&lt;br /&gt;
 &amp;gt; svcadm restart apache22&lt;br /&gt;
Then, in RT, click on the &amp;quot;EDIT&amp;quot; box in the top right corner and add FTSearch to your home page.&lt;br /&gt;
&lt;br /&gt;
That&#039;s all! Hope you enjoy it.&lt;br /&gt;
&lt;br /&gt;
[[Cris]]&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Cris&amp;diff=664</id>
		<title>Cris</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Cris&amp;diff=664"/>
		<updated>2012-01-26T16:34:19Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Added another contribution&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Cristiano Guadagnino =&lt;br /&gt;
&lt;br /&gt;
DBA and RT User/Admin/Hacker for Bankadati S. I. - Gruppo Credito Valtellinese&lt;br /&gt;
&lt;br /&gt;
Started with RT 3.8.2 on Solaris 10. Reads the mailing lists looking for useful bits of information. Gives back to the community whenever possible. Stole the personal page layout from [http://wiki.bestpractical.com/view/BillGerrard Bill Gerrard] ;-)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;u&amp;gt;Contributions:&amp;lt;/u&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[OnCreateCheckCF]]&lt;br /&gt;
* [[MuteResolve]]&lt;br /&gt;
* [[IntegrateSphinx]]&lt;br /&gt;
* [[Full_Text_Search_Portlet|Full Text Search Portlet]]&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=1387</id>
		<title>Full Text Search Portlet</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=1387"/>
		<updated>2012-01-26T16:32:34Z</updated>

		<summary type="html">&lt;p&gt;Cris70: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:FTSearch.png|thumb|350px|The portlet]]&lt;br /&gt;
==&#039;&#039;&#039;The full-text search portlet&#039;&#039;&#039;==&lt;br /&gt;
After the release of RT 4.0 we began investigating the migration from out 3.8.x RT installation.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;simple search&amp;quot; page, and to have to add &amp;quot;fulltext:&amp;quot; every time.&lt;br /&gt;
&lt;br /&gt;
So I thought &amp;quot;why not write a portlet again&amp;quot;, 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 &amp;quot;simple search&amp;quot; page again for... simple searches :-)&lt;br /&gt;
&lt;br /&gt;
So here it is, for those who want to have a usable alternative to the &amp;quot;simple search&amp;quot; page and yet don&#039;t want to always use the advanced search.&lt;br /&gt;
&lt;br /&gt;
Paste the content of the following box into a file. I called it FTSearch.&lt;br /&gt;
&lt;br /&gt;
You have to put it in:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;your_rt_root&amp;gt;&#039;&#039;\local\html\Elements&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;&amp;amp;|/Widgets/TitleBox, title =&amp;gt; loc(&#039;Fulltext Search&#039;), bodyclass =&amp;gt; &amp;quot;&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
     &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
     function MangleData()&lt;br /&gt;
     {&lt;br /&gt;
         // qui aggrego tutti i campi della prima form&lt;br /&gt;
         var textstring = &#039;&#039;;&#039;&#039;&lt;br /&gt;
         &lt;br /&gt;
         for (i=3;i&amp;gt;0;i--) {&lt;br /&gt;
             var box = document.forms[&#039;input&#039;].elements[i];&lt;br /&gt;
             if (box.value) {&lt;br /&gt;
                 textstring += box.value + &#039; &#039;;&lt;br /&gt;
             }&lt;br /&gt;
         }&lt;br /&gt;
         textstring += &#039;fulltext:&amp;quot;&#039; + document.forms[&#039;input&#039;].elements[0].value + &#039;&amp;quot;&#039;&lt;br /&gt;
 &lt;br /&gt;
         // popolo la seconda form con la stringa ricavata dalla prima&lt;br /&gt;
         document.forms[&#039;input2&#039;].elements[0].value = textstring;&lt;br /&gt;
         &lt;br /&gt;
         // sottometto la seconda form invece della prima&lt;br /&gt;
         document.forms[&#039;input2&#039;].submit();&lt;br /&gt;
     }&lt;br /&gt;
     &amp;lt;/script&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;input&amp;quot; action=&amp;quot;#&amp;quot; method=&amp;quot;get&amp;quot; onsubmit=&amp;quot;MangleData(); return false&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Text&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;Text&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Queue&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectQueue, NamedValues =&amp;gt; 1, Name =&amp;gt; &#039;Queue&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Requestor&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/EmailInput, Name =&amp;gt; &#039;Requestor&#039;, Size =&amp;gt; &#039;40&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Owner&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectOwner, ValueAttribute =&amp;gt; &amp;quot;Name&amp;quot;, Name =&amp;gt; &amp;quot;Owner&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;submit&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
                 &amp;lt;input class=&amp;quot;button&amp;quot; type=&amp;quot;submit&amp;quot; value=&amp;quot;Submit&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/div&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;input2&amp;quot; action=&amp;quot;/Search/Simple.html&amp;quot; method=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input style=&amp;quot;display:none&amp;quot; type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;q&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
 &amp;lt;/&amp;amp;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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&#039;t have it, copy it from RT_Config.pm.&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
 &amp;gt; rm -rf /opt/rt4/var/mason_data/obj/*&lt;br /&gt;
 &amp;gt; svcadm restart apache22&lt;br /&gt;
Then, in RT, click on the &amp;quot;EDIT&amp;quot; box in the top right corner and add FTSearch to your home page.&lt;br /&gt;
&lt;br /&gt;
That&#039;s all! Hope you enjoy it.&lt;br /&gt;
&lt;br /&gt;
[[Cris]]&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=1386</id>
		<title>Full Text Search Portlet</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Full_Text_Search_Portlet&amp;diff=1386"/>
		<updated>2012-01-26T16:27:12Z</updated>

		<summary type="html">&lt;p&gt;Cris70: Formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:FTSearch.png|thumb|350px|The portlet]]&lt;br /&gt;
==&#039;&#039;&#039;The full-text search portlet&#039;&#039;&#039;==&lt;br /&gt;
After the release of RT 4.0 we began investigating the migration from out 3.8.x RT installation.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;simple search&amp;quot; page, and to have to add &amp;quot;fulltext:&amp;quot; every time.&lt;br /&gt;
&lt;br /&gt;
So I thought &amp;quot;why not write a portlet again&amp;quot;, 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 &amp;quot;simple search&amp;quot; page again for... simple searches :-)&lt;br /&gt;
&lt;br /&gt;
So here it is, for those who want to have a usable alternative to the &amp;quot;simple search&amp;quot; page and yet don&#039;t want to always use the advanced search.&lt;br /&gt;
&lt;br /&gt;
Paste the content of the following box into a file. I called it FTSearch.&lt;br /&gt;
&lt;br /&gt;
You have to put it in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;your_rt_root&amp;gt;\local\html\Elements&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;&amp;amp;|/Widgets/TitleBox, title =&amp;gt; loc(&#039;Fulltext Search&#039;), bodyclass =&amp;gt; &amp;quot;&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
     &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
     function MangleData()&lt;br /&gt;
     {&lt;br /&gt;
         // qui aggrego tutti i campi della prima form&lt;br /&gt;
         var textstring = &#039;&#039;;&#039;&#039;&lt;br /&gt;
         &lt;br /&gt;
         for (i=3;i&amp;gt;0;i--) {&lt;br /&gt;
             var box = document.forms[&#039;input&#039;].elements[i];&lt;br /&gt;
             if (box.value) {&lt;br /&gt;
                 textstring += box.value + &#039; &#039;;&lt;br /&gt;
             }&lt;br /&gt;
         }&lt;br /&gt;
         textstring += &#039;fulltext:&amp;quot;&#039; + document.forms[&#039;input&#039;].elements[0].value + &#039;&amp;quot;&#039;&lt;br /&gt;
 &lt;br /&gt;
         // popolo la seconda form con la stringa ricavata dalla prima&lt;br /&gt;
         document.forms[&#039;input2&#039;].elements[0].value = textstring;&lt;br /&gt;
         &lt;br /&gt;
         // sottometto la seconda form invece della prima&lt;br /&gt;
         document.forms[&#039;input2&#039;].submit();&lt;br /&gt;
     }&lt;br /&gt;
     &amp;lt;/script&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;input&amp;quot; action=&amp;quot;#&amp;quot; method=&amp;quot;get&amp;quot; onsubmit=&amp;quot;MangleData(); return false&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Text&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;Text&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Queue&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectQueue, NamedValues =&amp;gt; 1, Name =&amp;gt; &#039;Queue&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Requestor&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/EmailInput, Name =&amp;gt; &#039;Requestor&#039;, Size =&amp;gt; &#039;40&#039; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;&amp;amp;|/l&amp;amp;&amp;gt;Owner&amp;lt;/&amp;amp;&amp;gt;:&amp;lt;/td&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;&amp;amp; /Elements/SelectOwner, ValueAttribute =&amp;gt; &amp;quot;Name&amp;quot;, Name =&amp;gt; &amp;quot;Owner&amp;quot; &amp;amp;&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;submit&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;&amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
                 &amp;lt;input class=&amp;quot;button&amp;quot; type=&amp;quot;submit&amp;quot; value=&amp;quot;Submit&amp;quot; /&amp;gt;&lt;br /&gt;
             &amp;lt;/div&amp;gt;&lt;br /&gt;
         &amp;lt;/div&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
     &amp;lt;form name=&amp;quot;input2&amp;quot; action=&amp;quot;/Search/Simple.html&amp;quot; method=&amp;quot;get&amp;quot;&amp;gt;&lt;br /&gt;
         &amp;lt;nowiki&amp;gt;&amp;lt;table&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;tr class=&amp;quot;input-row&amp;quot;&amp;gt;&lt;br /&gt;
                 &amp;lt;td class=&amp;quot;value&amp;quot;&amp;gt;&lt;br /&gt;
                     &amp;lt;input style=&amp;quot;display:none&amp;quot; type=&amp;quot;text&amp;quot; size=&amp;quot;40&amp;quot; name=&amp;quot;q&amp;quot; /&amp;gt;&lt;br /&gt;
                 &amp;lt;/td&amp;gt;&lt;br /&gt;
             &amp;lt;/tr&amp;gt;&lt;br /&gt;
         &amp;lt;/table&amp;gt;&lt;br /&gt;
     &amp;lt;/form&amp;gt;&lt;br /&gt;
 &amp;lt;/&amp;amp;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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&#039;t have it, copy it from RT_Config.pm.&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
 &amp;gt; rm -rf /opt/rt4/var/mason_data/obj/*&lt;br /&gt;
 &amp;gt; svcadm restart apache22&lt;br /&gt;
Then, in RT, click on the &amp;quot;EDIT&amp;quot; box in the top right corner and add FTSearch to your home page.&lt;br /&gt;
&lt;br /&gt;
That&#039;s all! Hope you enjoy it.&lt;br /&gt;
&lt;br /&gt;
Cris&lt;/div&gt;</summary>
		<author><name>Cris70</name></author>
	</entry>
</feed>