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

Parse schema in LukeResponse

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 6.3
    • SolrJ
    • 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.

      Attachments

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

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment