Item11223: duplicate results after kinoupdate via bug in KinoSearchContrib/Index.pm sub changedTopics

pencil
Priority: Urgent
Current State: New
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: KinoSearchContrib
Branches:
Reported By: Foswiki:Main.ChrisGathercole
Waiting For:
Last Change By: ChrisGathercole
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

 

ItemTemplate edit

Summary duplicate results after kinoupdate via bug in KinoSearchContrib/Index.pm sub changedTopics
ReportedBy Foswiki:Main.ChrisGathercole
Codebase
SVN Range
AppliesTo Extension
Component KinoSearchContrib
Priority Urgent
CurrentState New
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
Topic revision: r1 - 31 Oct 2011, ChrisGathercole
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy