Solr
  1. Solr
  2. SOLR-27

PATCH: Configurable language for SnowballPorterFilterFactory

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1.0
    • Component/s: search
    • Labels:
      None

      Description

      With this patch, the language used by SnowballPorterFilterFactory is configurable, for example:

      <filter class="solr.SnowballPorterFilterFactory" language="French"/>

      Invalid languages will cause a ClassNotFoundException when the filter is created (so at search time possibly, not at initialization time).

      1. SnowballPorterFilterFactory.patch
        2 kB
        Bertrand Delacretaz
      2. SnowballPorterFilterFactory.java
        2 kB
        Bertrand Delacretaz

        Activity

        Hide
        Bertrand Delacretaz added a comment -

        Seems like the previous patch is invalid, dunno why, weird characters in the source file? or I'm doing something wrong.

        Here's the new version just in case.

        Show
        Bertrand Delacretaz added a comment - Seems like the previous patch is invalid, dunno why, weird characters in the source file? or I'm doing something wrong. Here's the new version just in case.
        Bertrand Delacretaz made changes -
        Field Original Value New Value
        Attachment SnowballPorterFilterFactory.java [ 12336875 ]
        Hide
        Yonik Seeley added a comment -

        In the case that the filter is used in a schema more than once, it looks like the default language will be whatever was specified last time (or "English" if first). Was that the intent?

        Show
        Yonik Seeley added a comment - In the case that the filter is used in a schema more than once, it looks like the default language will be whatever was specified last time (or "English" if first). Was that the intent?
        Bertrand Delacretaz created issue -
        Hide
        Bertrand Delacretaz added a comment -

        The single souce file to patch

        Show
        Bertrand Delacretaz added a comment - The single souce file to patch
        Bertrand Delacretaz made changes -
        Attachment SnowballPorterFilterFactory.patch [ 12336853 ]
        Hide
        Bertrand Delacretaz added a comment -

        >...it looks like the default language will be whatever was specified last time...

        I don't think so - I haven't checked the lifecycle of these factories precisely, but I've used the same configuration pattern as in StopFilterFactory, for example.

        If I use the following configurations in my schema.xml, each in its own <fieldtype>:

        <filter class="solr.SnowballPorterFilterFactory" language="French" />
        ...
        <filter class="solr.SnowballPorterFilterFactory" />

        The log says

        INFO: SnowballPorterFilterFactory: language=French
        ...
        INFO: SnowballPorterFilterFactory: language=English

        Which is what I expect.

        Let me know if I missed something!

        Show
        Bertrand Delacretaz added a comment - >...it looks like the default language will be whatever was specified last time... I don't think so - I haven't checked the lifecycle of these factories precisely, but I've used the same configuration pattern as in StopFilterFactory, for example. If I use the following configurations in my schema.xml, each in its own <fieldtype>: <filter class="solr.SnowballPorterFilterFactory" language="French" /> ... <filter class="solr.SnowballPorterFilterFactory" /> The log says INFO: SnowballPorterFilterFactory: language=French ... INFO: SnowballPorterFilterFactory: language=English Which is what I expect. Let me know if I missed something!
        Hide
        Yonik Seeley added a comment -

        Oops, you're right. A new factory is created for each use in the schema.

        Show
        Yonik Seeley added a comment - Oops, you're right. A new factory is created for each use in the schema.
        Hide
        Yonik Seeley added a comment -

        Committed. Thanks Bertrand!

        Show
        Yonik Seeley added a comment - Committed. Thanks Bertrand!
        Yonik Seeley made changes -
        Resolution Fixed [ 1 ]
        Assignee Yonik Seeley [ yseeley@gmail.com ]
        Status Open [ 1 ] Resolved [ 5 ]
        Hide
        Hoss Man added a comment -

        This bug was modified as part of a bulk update using the criteria...

        • Marked ("Resolved" or "Closed") and "Fixed"
        • Had no "Fix Version" versions
        • Was listed in the CHANGES.txt for 1.1

        The Fix Version for all 38 issues found was set to 1.1, email notification
        was suppressed to prevent excessive email.

        For a list of all the issues modified, search jira comments for this
        (hopefully) unique string: 20080415hossman3

        Show
        Hoss Man added a comment - This bug was modified as part of a bulk update using the criteria... Marked ("Resolved" or "Closed") and "Fixed" Had no "Fix Version" versions Was listed in the CHANGES.txt for 1.1 The Fix Version for all 38 issues found was set to 1.1, email notification was suppressed to prevent excessive email. For a list of all the issues modified, search jira comments for this (hopefully) unique string: 20080415hossman3
        Hoss Man made changes -
        Fix Version/s 1.1.0 [ 12312234 ]
        Uwe Schindler made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Yonik Seeley
            Reporter:
            Bertrand Delacretaz
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development