Item11223: duplicate results after kinoupdate via bug in KinoSearchContrib/Index.pm sub changedTopics
Priority: Urgent
Current State: New
Released In: n/a
Target Release: n/a
Have installed v 1.31 of KinoSearchContrib.
After
- a full kinoindex,
- attaching a text or doc file to a topic page,
- making other edits to that topic page or attaching more files to the topic page,
- invoking kinoupdate,
A kino search for a keyword that only exists in the new attachment produces duplicate results for that attachment. As far as I can tell, there is one duplicate result for each separate change that has been made to that topic page in addition to the attachment change.
Looking at the code, I believe the bug lies in
KinoSearchContrib/Index.pm sub changedTopics. The while loop in changedTopics iterates over every change made since the last full kinoindex. If there are multiple changes on the same page, the logic using the 'exclude' hash fails to spot the repetition and allows the same topicName to be repeatedly added to the list topicsToUpdate. The list topicsToUpdate is then used elsewhere to re-index that topic page and all its attachments multiple times.
The following local edit to
KinoSearchContrib/Index.pm sub changedTopics seems to fix it:
next
if ( ( !defined($topicName) )
|| ( (%exclude) && ($exclude{$topicName}) )
);
# if ( ( !%exclude ) || ( !$exclude{$topicName} ) ) {
#
# if ( !defined($topicName) ) {
# next;
# }
# }
--
ChrisGathercole - 31 Oct 2011