Hello there,

The problem we have is that some top results are missing. My debugging led me 
to the following piece of code in the PriorityQueue.cs file(line 69). I simply 
cannot believe this might be wrong, so I'd like somebody to verify it.

                public virtual bool Insert(System.Object element)
                {
                        if (size < maxSize)
                        {
                                Put(element);
                                return true;
                        }
                        else if (size > 0 && !LessThan(element, Top()))
                        {
                                heap[1] = element;
                                AdjustTop();
                                return true;
                        }
                        else
                                return false;
                }

Let's assume that maxSize is 100, when size is larger or equal to 100, the 
element is compared with the top element which is heap[1], if it is not less 
than the top, then the top is being replaced by the element instead of being 
bumped down. It seems to me that this is not the right logic here.

If maxSize is 100, the actual heap size is 101 and the document collector will 
collect top docs starting from index 1, so index 0 is never used. I suspect 
that the original design of the queue is to insert the new element in the index 
0 and then sort it down.

Please let me know what do you think.

Hongwei

Reply via email to