Details

    • Type: Improvement
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1
    • Component/s: core/search
    • Labels:
      None
    • Environment:

      all platforms

    • Lucene Fields:
      Patch Available

      Description

      I am trying to extend the FuzzyQuery to further filter the TermEnum. (I am indexing stem forms and original forms, but I only want to match original forms with a fuzzy term, otherwise I get to much noise). However, FuzzyQuery is a final class and I cannot extend it.

      As discussed in the mailing list (http://www.gossamer-threads.com/lists/lucene/java-dev/38756), we want to make the private variables and inner classes protected.

      I am attaching a patch for FuzzyQuery.java that implements this. I ran all unit tests and they passed without errors.

      Andreas.

      1. LUCENE-657.patch
        1 kB
        Steven Parkes

        Activity

        Hide
        steven_parkes Steven Parkes added a comment -

        Anybody worried about this? Seems like a very nominal change. Any reason we would want to inhibit people from extended a query class like FuzzyQuery?

        Show
        steven_parkes Steven Parkes added a comment - Anybody worried about this? Seems like a very nominal change. Any reason we would want to inhibit people from extended a query class like FuzzyQuery?
        Hide
        yseeley@gmail.com Yonik Seeley added a comment -

        Making the class non-final is fine.

        As far as changing members to protected, I'm not opposed to opening something up a little more so the very expert users don't have to copy the class (although that is often an option). In return, those expert users shouldn't complain if the internals change

        Show
        yseeley@gmail.com Yonik Seeley added a comment - Making the class non-final is fine. As far as changing members to protected, I'm not opposed to opening something up a little more so the very expert users don't have to copy the class (although that is often an option). In return, those expert users shouldn't complain if the internals change
        Hide
        steven_parkes Steven Parkes added a comment -

        Good point on the members.

        There are public getter methods and the member are set from ctor, so the only reason for making them protected is to allow them to be set outside the ctor, right? Is that really necessary, to change them after construction?

        I have a tendency to prefer protected setters over protected fields, but there is precedence for this, e.g, BooleanQuery.minNrShouldMatch, so I don't think that part is exceptional.

        Show
        steven_parkes Steven Parkes added a comment - Good point on the members. There are public getter methods and the member are set from ctor, so the only reason for making them protected is to allow them to be set outside the ctor, right? Is that really necessary, to change them after construction? I have a tendency to prefer protected setters over protected fields, but there is precedence for this, e.g, BooleanQuery.minNrShouldMatch, so I don't think that part is exceptional.
        Hide
        steven_parkes Steven Parkes added a comment -

        This version of the patch omits making the member variables public. FuzzyQuery is no longer final and some of the nested classes are made protected, but the member variables have getters so shouldn't need to be made public.

        Show
        steven_parkes Steven Parkes added a comment - This version of the patch omits making the member variables public. FuzzyQuery is no longer final and some of the nested classes are made protected, but the member variables have getters so shouldn't need to be made public.
        Hide
        otis Otis Gospodnetic added a comment -

        Applied in the trunk, thanks.

        Show
        otis Otis Gospodnetic added a comment - Applied in the trunk, thanks.
        Hide
        mikemccand Michael McCandless added a comment -

        Closing all issues that were resolved for 2.1.

        Show
        mikemccand Michael McCandless added a comment - Closing all issues that were resolved for 2.1.

          People

          • Assignee:
            steven_parkes Steven Parkes
            Reporter:
            neunand Andreas Neumann
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development