You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Peter Keegan (JIRA)" <ji...@apache.org> on 2007/12/11 20:04:43 UTC

[jira] Created: (LUCENE-1088) PriorityQueue 'wouldBeInserted' method

PriorityQueue 'wouldBeInserted' method
--------------------------------------

                 Key: LUCENE-1088
                 URL: https://issues.apache.org/jira/browse/LUCENE-1088
             Project: Lucene - Java
          Issue Type: New Feature
          Components: Other
            Reporter: Peter Keegan


This is a request for a new method in PriorityQueue

public boolean wouldBeInserted(Object element)
// returns true if doc would be inserted, without inserting 

This would allow an application to prevent duplicate entries from being added to the queue.
Here is a reference to the discussion behind  this request:

http://www.nabble.com/FieldSortedHitQueue-enhancement-to9733550.html#a9733550



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1088) PriorityQueue 'wouldBeInserted' method

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless updated LUCENE-1088:
---------------------------------------

    Attachment: LUCENE-1088.patch

Attached patch.  All tests pass. I plan to commit sometime tomorrow...

> PriorityQueue 'wouldBeInserted' method
> --------------------------------------
>
>                 Key: LUCENE-1088
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1088
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Other
>            Reporter: Peter Keegan
>            Assignee: Michael McCandless
>         Attachments: LUCENE-1088.patch
>
>
> This is a request for a new method in PriorityQueue
> public boolean wouldBeInserted(Object element)
> // returns true if doc would be inserted, without inserting 
> This would allow an application to prevent duplicate entries from being added to the queue.
> Here is a reference to the discussion behind  this request:
> http://www.nabble.com/FieldSortedHitQueue-enhancement-to9733550.html#a9733550

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1088) PriorityQueue 'wouldBeInserted' method

Posted by "Nadav Har'El (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12550964 ] 

Nadav Har'El commented on LUCENE-1088:
--------------------------------------

Michael, I agree - the most important fix was to make heap protected (and not private). After that, you're right, insertWithOverflow() and wouldBeInserted() could be implemented in a subclass in or even outside Lucene. Whether or not to include these new methods in the basic PriorityQueue should depend, I think, on how commonly needed these features will be for users, and whether we want to use them inside Lucene (like Shai's patches for TopDocCollector and other classes was doing)..

> PriorityQueue 'wouldBeInserted' method
> --------------------------------------
>
>                 Key: LUCENE-1088
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1088
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Other
>            Reporter: Peter Keegan
>            Assignee: Michael McCandless
>         Attachments: LUCENE-1088.patch
>
>
> This is a request for a new method in PriorityQueue
> public boolean wouldBeInserted(Object element)
> // returns true if doc would be inserted, without inserting 
> This would allow an application to prevent duplicate entries from being added to the queue.
> Here is a reference to the discussion behind  this request:
> http://www.nabble.com/FieldSortedHitQueue-enhancement-to9733550.html#a9733550

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1088) PriorityQueue 'wouldBeInserted' method

Posted by "Shai Erera (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12550951 ] 

Shai Erera commented on LUCENE-1088:
------------------------------------

I think that after LUCENE-1089 will be committed, applications will be able to extend PQ more easily and maybe those two methods really belong to an extension of PQ, since they are not really the basics of every PQ.

> PriorityQueue 'wouldBeInserted' method
> --------------------------------------
>
>                 Key: LUCENE-1088
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1088
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Other
>            Reporter: Peter Keegan
>            Assignee: Michael McCandless
>         Attachments: LUCENE-1088.patch
>
>
> This is a request for a new method in PriorityQueue
> public boolean wouldBeInserted(Object element)
> // returns true if doc would be inserted, without inserting 
> This would allow an application to prevent duplicate entries from being added to the queue.
> Here is a reference to the discussion behind  this request:
> http://www.nabble.com/FieldSortedHitQueue-enhancement-to9733550.html#a9733550

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1088) PriorityQueue 'wouldBeInserted' method

Posted by "Shai Erera (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12550843 ] 

Shai Erera commented on LUCENE-1088:
------------------------------------

If you're adding a wouldBeInserted method, I'd add a insertWithNoCheck that either calls put() (if there is room in the queue) or replaces the top() element, without re-evaluating the element (by calling lessThan). This will save unnecessary calls (the lessThan() method can be expensive). It should be documented in the method though that insertWithNoCheck assumes wouldBeInserted before.


> PriorityQueue 'wouldBeInserted' method
> --------------------------------------
>
>                 Key: LUCENE-1088
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1088
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Other
>            Reporter: Peter Keegan
>            Assignee: Michael McCandless
>         Attachments: LUCENE-1088.patch
>
>
> This is a request for a new method in PriorityQueue
> public boolean wouldBeInserted(Object element)
> // returns true if doc would be inserted, without inserting 
> This would allow an application to prevent duplicate entries from being added to the queue.
> Here is a reference to the discussion behind  this request:
> http://www.nabble.com/FieldSortedHitQueue-enhancement-to9733550.html#a9733550

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Resolved: (LUCENE-1088) PriorityQueue 'wouldBeInserted' method

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless resolved LUCENE-1088.
----------------------------------------

    Resolution: Won't Fix

OK, I'm thinking insertWithOverflow is reasonable to add to the core (under LUCENE-1089), but these two proposed methods in this issue should be done in a subclass once LUCENE-1089 makes that possible.  So I'm resolving this one as "won't fix", and then I'll work on getting LUCENE-1089 committed...

> PriorityQueue 'wouldBeInserted' method
> --------------------------------------
>
>                 Key: LUCENE-1088
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1088
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Other
>            Reporter: Peter Keegan
>            Assignee: Michael McCandless
>         Attachments: LUCENE-1088.patch
>
>
> This is a request for a new method in PriorityQueue
> public boolean wouldBeInserted(Object element)
> // returns true if doc would be inserted, without inserting 
> This would allow an application to prevent duplicate entries from being added to the queue.
> Here is a reference to the discussion behind  this request:
> http://www.nabble.com/FieldSortedHitQueue-enhancement-to9733550.html#a9733550

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Assigned: (LUCENE-1088) PriorityQueue 'wouldBeInserted' method

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless reassigned LUCENE-1088:
------------------------------------------

    Assignee: Michael McCandless

> PriorityQueue 'wouldBeInserted' method
> --------------------------------------
>
>                 Key: LUCENE-1088
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1088
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Other
>            Reporter: Peter Keegan
>            Assignee: Michael McCandless
>
> This is a request for a new method in PriorityQueue
> public boolean wouldBeInserted(Object element)
> // returns true if doc would be inserted, without inserting 
> This would allow an application to prevent duplicate entries from being added to the queue.
> Here is a reference to the discussion behind  this request:
> http://www.nabble.com/FieldSortedHitQueue-enhancement-to9733550.html#a9733550

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1088) PriorityQueue 'wouldBeInserted' method

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12550934 ] 

Michael McCandless commented on LUCENE-1088:
--------------------------------------------

OK, though, now I'm wondering whether one should simply subclass PriorityQueue to achieve this change to insert()'s behavior, instead of adding these two methods.  Is there a reason why this approach can't be used instead?

I realize this would replicate the logic in insert() in a subclass, but I think that's a fairly minor cost vs increasing the complexity of PriorityQueue by adding these two methods?

> PriorityQueue 'wouldBeInserted' method
> --------------------------------------
>
>                 Key: LUCENE-1088
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1088
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Other
>            Reporter: Peter Keegan
>            Assignee: Michael McCandless
>         Attachments: LUCENE-1088.patch
>
>
> This is a request for a new method in PriorityQueue
> public boolean wouldBeInserted(Object element)
> // returns true if doc would be inserted, without inserting 
> This would allow an application to prevent duplicate entries from being added to the queue.
> Here is a reference to the discussion behind  this request:
> http://www.nabble.com/FieldSortedHitQueue-enhancement-to9733550.html#a9733550

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org