Details

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

      Description

      LukeRequestHandler (/admin/luke) lists schema flags using two fields named "schema" and "flags".

      For instance on my local machine http://localhost:8983/solr/collection1/admin/luke returns something like this:

      <lst name="id">
        <str name="type">string</str>
        <str name="schema">I-S-----OF-----l</str>
      </lst>
      

      And http://localhost:8983/solr/collection1/admin/luke?show=schema returns something like this:

      <lst name="id">
        <str name="type">string</str>
        <str name="flags">I-S-----OF-----l</str>
      </lst>
      

      However, when processing a LukeRequest in SolrJ, only the "flags" field is parsed into a Set of FieldFlag objects. The "schema" field is left as a String, and as a result is hard to process by client applications who do not know how to parse "I-S----OF----l".

      Here is an example that illustrates the problem:

      public class MyClass {
        public static void main(String[] args) throws Exception {
          SolrClient client = new HttpSolrClient("http://localhost:8983/solr/collection1");
          LukeRequest request = new LukeRequest();
          LukeResponse response = request.process(client);
          for (LukeResponse.FieldInfo field:response.getFieldInfo().values()) {
            System.out.println(field.getSchema());
            // field.getSchema() returns "I-S-----OF------" (i.e. a String) which is not much meaningful for SolrJ applications
            // Ideally field.getSchema() should return something like "[INDEXED, STORED, OMIT_NORMS, OMIT_TF]" (i.e. a EnumSet<FieldFlag>) which is meaningful for SolrJ applications
          }
        }
      }
      

      It is probably fine to parse both fields the same way in SolrJ since LukeRequestHandler populates them the same way.

      1. SOLR-9205.patch
        4 kB
        Alan Woodward
      2. SOLR-9205.patch
        4 kB
        Fengtan
      3. SOLR-9205.patch
        1 kB
        Fengtan

        Activity

        Hide
        Fengtan Fengtan added a comment -

        Suggested patch.

        Show
        Fengtan Fengtan added a comment - Suggested patch.
        Hide
        romseygeek Alan Woodward added a comment -

        Hi Fengtan,

        This looks like a good idea, thanks! Two comments:

        • I think we should add this as a new method, .getSchemaFlags(), and keep (but deprecate) the old method
        • Can you add a unit test for this as well?
        Show
        romseygeek Alan Woodward added a comment - Hi Fengtan, This looks like a good idea, thanks! Two comments: I think we should add this as a new method, .getSchemaFlags(), and keep (but deprecate) the old method Can you add a unit test for this as well?
        Hide
        Fengtan Fengtan added a comment -

        Thanks for your feedback Alan !
        Here is a new tentative patch that deprecates getSchema() and introduces a unit test. It this what you were expecting ?

        Show
        Fengtan Fengtan added a comment - Thanks for your feedback Alan ! Here is a new tentative patch that deprecates getSchema() and introduces a unit test. It this what you were expecting ?
        Hide
        romseygeek Alan Woodward added a comment -

        Slightly amended patch - I decided not to deprecate the old method, as it's still useful, and I folded the test into an existing LukeResponse test. Will commit shortly.

        Show
        romseygeek Alan Woodward added a comment - Slightly amended patch - I decided not to deprecate the old method, as it's still useful, and I folded the test into an existing LukeResponse test. Will commit shortly.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 45e2e25233e8a83aaacfb696c2576cd2bf2eb28f in lucene-solr's branch refs/heads/branch_6x from Alan Woodward
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=45e2e25 ]

        SOLR-9205: Parse schema in LukeResponse

        Show
        jira-bot ASF subversion and git services added a comment - Commit 45e2e25233e8a83aaacfb696c2576cd2bf2eb28f in lucene-solr's branch refs/heads/branch_6x from Alan Woodward [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=45e2e25 ] SOLR-9205 : Parse schema in LukeResponse
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit f13b727213e1e843c1a8d0dc2f3930d80f23b11f in lucene-solr's branch refs/heads/master from Alan Woodward
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=f13b727 ]

        SOLR-9205: Parse schema in LukeResponse

        Show
        jira-bot ASF subversion and git services added a comment - Commit f13b727213e1e843c1a8d0dc2f3930d80f23b11f in lucene-solr's branch refs/heads/master from Alan Woodward [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=f13b727 ] SOLR-9205 : Parse schema in LukeResponse
        Hide
        romseygeek Alan Woodward added a comment -

        Thanks Fengtan!

        Show
        romseygeek Alan Woodward added a comment - Thanks Fengtan!
        Hide
        shalinmangar Shalin Shekhar Mangar added a comment -

        Closing after 6.3.0 release.

        Show
        shalinmangar Shalin Shekhar Mangar added a comment - Closing after 6.3.0 release.

          People

          • Assignee:
            romseygeek Alan Woodward
            Reporter:
            Fengtan Fengtan
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development