[imp] Error viewing a message in search results

Michael M Slusarz slusarz@bigworm.colorado.edu
Wed, 14 Aug 2002 13:20:25 -0600


Quoting Igor Stroh <stroh@scan-plus.de>:

| After Search::runSearch() is
| completed, $imp['msgl'] contains duplicate indices, I don't know if it's
| intended, if so then _setarrayIndex may (and will) return a wrong
| array_index for the message, 'cos its retrieved using array_search()...
| In my case $imp['msgl'] looked something like '15:1:5:3:3:3:2:7:1'

You didn't analyze the $imp variable at the correct location.  After 
searching is completed and the mailbox is rebuilt with the new search 
information, the $imp['msgl'] varaible will look like this:

5|INBOX.Testing1:6|INBOX.Testing1:5|INBOX.Testing2:6|INBOX.Testing2

So duplicate message indexes are OK here since they are paired with the 
correct mailbox.

The problem comes later in IMP_Message when the indexes are stored in an 
array separate from mailbox information.  You are correct to notice that we 
do a simple array_search() call to match up the index to the array position 
of the $_sorted variable.  This is bad for search results and needs to be 
fixed.  I am currently in the process of moving all mailbox handling stuff 
over to IMP_Mailbox, so I will finish that first and then correct the 
problem after that.

michael

______________________________________________
Michael Slusarz [slusarz@bigworm.colorado.edu]
The University of Colorado at Boulder