Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-9666

SolrJ LukeResponse support dynamic fields

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 6.2.1
    • Fix Version/s: 6.4
    • Component/s: SolrJ
    • Security Level: Public (Default Security Level. Issues are Public)
    • Labels:
      None

      Description

      LukeRequestHandler (/admin/luke), when invoked with the show=schema parameter, returns a list static fields and dynamic fields.

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

      <response>
        ...
        <lst name="schema">
          <lst name="fields">
            <lst name="foo">
              <str name="type">string</str>
              <str name="flags">I-S-----OF-----l</str>
            </lst>
            ...
          </lst>
          <lst name="dynamicFields">
            <lst name="bar_*">
              <str name="type">string</str>
              <str name="flags">I-------OF------</str>
            </lst>
            ...
          </lst>
        </lst>
        ...
      </response>
      

      However, when processing a LukeRequest in SolrJ, only static fields are parsed and made available to the client application through lukeResponse.getFieldInfo(). There does not seem to be a way for the client application to get the dynamic fields.

      Maybe we could parse dynamic fields and make them accessible ? Possibly something like this:

      public class MyClass {
        public static void main(String[] args) throws Exception {
          SolrClient client = new HttpSolrClient("http://localhost:8983/solr/collection1");
          LukeRequest request = new LukeRequest();
          request.setShowSchema(true);
          LukeResponse response = request.process(client);
          Map<String, FieldInfo> staticFields = response.getFieldInfo(); // SolrJ already provides this.
          Map<String, FieldInfo> dynamicFields = response.getDynamicFieldInfo(); // Proposed improvement.
        }
      }
      
      1. SOLR-9666.patch
        4 kB
        Fengtan
      2. SOLR-9666.patch
        3 kB
        Fengtan

        Activity

        Hide
        Fengtan Fengtan added a comment -

        Here is a proposed patch.

        Show
        Fengtan Fengtan added a comment - Here is a proposed patch.
        Hide
        risdenk Kevin Risden added a comment -

        Since it seems like you are just looking for schema information, maybe the schema api would be useful?

        https://cwiki.apache.org/confluence/display/solr/Schema+API#SchemaAPI-RetrieveSchemaInformation

        Show
        risdenk Kevin Risden added a comment - Since it seems like you are just looking for schema information, maybe the schema api would be useful? https://cwiki.apache.org/confluence/display/solr/Schema+API#SchemaAPI-RetrieveSchemaInformation
        Hide
        Fengtan Fengtan added a comment -

        Sounds good, thanks Kevin Risden.
        SchemaRequest is marked as experimental but I guess the existing API will not change much.

        Show
        Fengtan Fengtan added a comment - Sounds good, thanks Kevin Risden . SchemaRequest is marked as experimental but I guess the existing API will not change much.
        Hide
        risdenk Kevin Risden added a comment -

        Fengtan - I think this patch looks good too. Can you add some tests that will use the new functionality?

        Show
        risdenk Kevin Risden added a comment - Fengtan - I think this patch looks good too. Can you add some tests that will use the new functionality?
        Hide
        Fengtan Fengtan added a comment -

        Yes - thanks for the feedback. I have attached a new patch that includes tests.

        Show
        Fengtan Fengtan added a comment - Yes - thanks for the feedback. I have attached a new patch that includes tests.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 782923b894a7eda6cc8940e83d1e8b4863d7d063 in lucene-solr's branch refs/heads/master from Kevin Risden
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=782923b ]

        SOLR-9666: SolrJ LukeResponse support dynamic fields

        Show
        jira-bot ASF subversion and git services added a comment - Commit 782923b894a7eda6cc8940e83d1e8b4863d7d063 in lucene-solr's branch refs/heads/master from Kevin Risden [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=782923b ] SOLR-9666 : SolrJ LukeResponse support dynamic fields
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit ead40a9e00b53620511ed243932ecaf12093aafa in lucene-solr's branch refs/heads/branch_6x from Kevin Risden
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=ead40a9 ]

        SOLR-9666: SolrJ LukeResponse support dynamic fields

        Show
        jira-bot ASF subversion and git services added a comment - Commit ead40a9e00b53620511ed243932ecaf12093aafa in lucene-solr's branch refs/heads/branch_6x from Kevin Risden [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=ead40a9 ] SOLR-9666 : SolrJ LukeResponse support dynamic fields
        Hide
        risdenk Kevin Risden added a comment -

        Thanks Fengtan!

        Show
        risdenk Kevin Risden added a comment - Thanks Fengtan !

          People

          • Assignee:
            risdenk Kevin Risden
            Reporter:
            Fengtan Fengtan
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development