You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Michael McCandless (JIRA)" <ji...@apache.org> on 2011/01/07 20:13:45 UTC

[jira] Created: (LUCENE-2854) Deprecate SimilarityDelegator and Similarity.lengthNorm

Deprecate SimilarityDelegator and Similarity.lengthNorm
-------------------------------------------------------

                 Key: LUCENE-2854
                 URL: https://issues.apache.org/jira/browse/LUCENE-2854
             Project: Lucene - Java
          Issue Type: Improvement
            Reporter: Michael McCandless
             Fix For: 3.1, 4.0


SimilarityDelegator is a back compat trap (see LUCENE-2828).

Apps should just [statically] subclass Sim or DefaultSim; if they really need "runtime subclassing" then they can make their own app-level delegator.

Also, Sim.computeNorm subsumes lengthNorm, so we should deprecate lengthNorm in favor of computeNorm.

-- 
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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] Commented: (LUCENE-2854) Deprecate SimilarityDelegator and Similarity.lengthNorm

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

Michael McCandless commented on LUCENE-2854:
--------------------------------------------

The above patch applies to 3.x

For trunk I plan to remove SimliarityDelegator from core, and move it (deprecated) into contrib/queries/... (private to FuzzyLikeThisQ).  At some point [later] we can fix FuzzyLikeThisQ to not use it...

> Deprecate SimilarityDelegator and Similarity.lengthNorm
> -------------------------------------------------------
>
>                 Key: LUCENE-2854
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2854
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Michael McCandless
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2854.patch
>
>
> SimilarityDelegator is a back compat trap (see LUCENE-2828).
> Apps should just [statically] subclass Sim or DefaultSim; if they really need "runtime subclassing" then they can make their own app-level delegator.
> Also, Sim.computeNorm subsumes lengthNorm, so we should deprecate lengthNorm in favor of computeNorm.

-- 
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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] Commented: (LUCENE-2854) Deprecate SimilarityDelegator and Similarity.lengthNorm

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12979141#action_12979141 ] 

Robert Muir commented on LUCENE-2854:
-------------------------------------

Is it possible to remove this method Query.getSimilarity also? I don't understand why we need this method!

{noformat}
  /** Expert: Returns the Similarity implementation to be used for this query.
   * Subclasses may override this method to specify their own Similarity
   * implementation, perhaps one that delegates through that of the Searcher.
   * By default the Searcher's Similarity implementation is returned.*/
{noformat}

> Deprecate SimilarityDelegator and Similarity.lengthNorm
> -------------------------------------------------------
>
>                 Key: LUCENE-2854
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2854
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Michael McCandless
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2854.patch, LUCENE-2854_fuzzylikethis.patch
>
>
> SimilarityDelegator is a back compat trap (see LUCENE-2828).
> Apps should just [statically] subclass Sim or DefaultSim; if they really need "runtime subclassing" then they can make their own app-level delegator.
> Also, Sim.computeNorm subsumes lengthNorm, so we should deprecate lengthNorm in favor of computeNorm.

-- 
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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] Commented: (LUCENE-2854) Deprecate SimilarityDelegator and Similarity.lengthNorm

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

Michael McCandless commented on LUCENE-2854:
--------------------------------------------

bq. Is it possible to remove this method Query.getSimilarity also? I don't understand why we need this method!

I would love to!  But I think that's for another day...

I looked into this and got stuck with BoostingQuery, which rewrites to an anon subclass of BQ overriding its getSimilarity in turn override its coord method.  Rather twisted... if we can do this differently I think we could remove Query.getSimilarity.

> Deprecate SimilarityDelegator and Similarity.lengthNorm
> -------------------------------------------------------
>
>                 Key: LUCENE-2854
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2854
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Michael McCandless
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2854.patch, LUCENE-2854_fuzzylikethis.patch
>
>
> SimilarityDelegator is a back compat trap (see LUCENE-2828).
> Apps should just [statically] subclass Sim or DefaultSim; if they really need "runtime subclassing" then they can make their own app-level delegator.
> Also, Sim.computeNorm subsumes lengthNorm, so we should deprecate lengthNorm in favor of computeNorm.

-- 
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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] Updated: (LUCENE-2854) Deprecate SimilarityDelegator and Similarity.lengthNorm

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

Robert Muir updated LUCENE-2854:
--------------------------------

    Attachment: LUCENE-2854_fuzzylikethis.patch

here is the patch for fuzzylikethis for trunk... so you can remove the delegator completely in trunk.


> Deprecate SimilarityDelegator and Similarity.lengthNorm
> -------------------------------------------------------
>
>                 Key: LUCENE-2854
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2854
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Michael McCandless
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2854.patch, LUCENE-2854_fuzzylikethis.patch
>
>
> SimilarityDelegator is a back compat trap (see LUCENE-2828).
> Apps should just [statically] subclass Sim or DefaultSim; if they really need "runtime subclassing" then they can make their own app-level delegator.
> Also, Sim.computeNorm subsumes lengthNorm, so we should deprecate lengthNorm in favor of computeNorm.

-- 
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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] Updated: (LUCENE-2854) Deprecate SimilarityDelegator and Similarity.lengthNorm

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

Michael McCandless updated LUCENE-2854:
---------------------------------------

    Attachment: LUCENE-2854.patch

I think we should simply make a hard break on the Sim.lengthNorm ->
computeNorm cutover.  Subclassing sim is an expert thing, and, I'd
rather apps see a compilation error on upgrade so that they realize
their lengthNorm wasn't being called this whole time because of
LUCENE-2828 (and that they must now cutover to computeNorm).

So I made lengthNorm final (and throws UOE), computeNorm abstract.  I
deprecated SimilarityDelegator, and fixed BQ to not use it anymore.
The only other use is FuzzyLikeThisQuery, but fixing that is a little
too involved for today.


> Deprecate SimilarityDelegator and Similarity.lengthNorm
> -------------------------------------------------------
>
>                 Key: LUCENE-2854
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2854
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Michael McCandless
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2854.patch
>
>
> SimilarityDelegator is a back compat trap (see LUCENE-2828).
> Apps should just [statically] subclass Sim or DefaultSim; if they really need "runtime subclassing" then they can make their own app-level delegator.
> Also, Sim.computeNorm subsumes lengthNorm, so we should deprecate lengthNorm in favor of computeNorm.

-- 
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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] Resolved: (LUCENE-2854) Deprecate SimilarityDelegator and Similarity.lengthNorm

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

Michael McCandless resolved LUCENE-2854.
----------------------------------------

    Resolution: Fixed

> Deprecate SimilarityDelegator and Similarity.lengthNorm
> -------------------------------------------------------
>
>                 Key: LUCENE-2854
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2854
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Michael McCandless
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2854.patch, LUCENE-2854_fuzzylikethis.patch
>
>
> SimilarityDelegator is a back compat trap (see LUCENE-2828).
> Apps should just [statically] subclass Sim or DefaultSim; if they really need "runtime subclassing" then they can make their own app-level delegator.
> Also, Sim.computeNorm subsumes lengthNorm, so we should deprecate lengthNorm in favor of computeNorm.

-- 
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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org