Solr
  1. Solr
  2. SOLR-75

XSLT-based "Schema Browser" in admin view

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: web gui
    • Labels:
      None
    • Environment:

      any

      Description

      The files in this upcoming patch create a simple "schema browser" for the admin tool. It serves schema.xml along with a stylesheet that in compliant browsers creates a page with a tree widget to show the fieldtypes and fields, as well as their uses and cross references. This is similar to the schemaxsl.zip originally attached to SOLR-58, but a few features have been added, and the look and feel has been changed to fit in better with the rest of the admin tool.

      Note that it does not work against the live IndexSchema – it merely transforms schema.xml. There is probably not a significant difference now, but it is worth raising the issue in case there are future administration capabilities in mind (i.e. on http://wiki.apache.org/solr/MakeSolrMoreSelfService ) that might require a schema browser to be talking to the live values.

      1. closed.gif
        0.1 kB
        Greg Ludington
      2. open.gif
        0.1 kB
        Greg Ludington
      3. solr75v1.diff
        37 kB
        Greg Ludington
      4. schemav2sample.zip
        25 kB
        Greg Ludington

        Issue Links

          Activity

          Hide
          Lance Norskog added a comment -

          Please close this.

          Show
          Lance Norskog added a comment - Please close this.
          Hide
          Greg Ludington added a comment -

          An updated sample, including feedback about fieldtype->field inheritance. It presumes that:

          a) a field can inherit any attribute from a field type
          b) a field cannot override analyzers (or any other child node), only attributes.

          Show
          Greg Ludington added a comment - An updated sample, including feedback about fieldtype->field inheritance. It presumes that: a) a field can inherit any attribute from a field type b) a field cannot override analyzers (or any other child node), only attributes.
          Hide
          Bertrand Delacretaz added a comment -

          The tango icons (http://tango.freedesktop.org) could be used I think.

          As mentioned at the bottom of http://tango.freedesktop.org/Tango_Desktop_Project, they are licensed under the Creative Commons Attribution Share-Alike license, which I think is acceptable for us to redistribute (although there is no black/white policy on this yet at the ASF, see [1] and [2]).

          [1] http://mail-archives.apache.org/mod_mbox/www-legal-discuss/200610.mbox/%3Cc5e632550610270807qad46ffaodc4d65703676608f@mail.gmail.com%3E
          [2] http://www.apache.org/legal/3party.html

          Show
          Bertrand Delacretaz added a comment - The tango icons ( http://tango.freedesktop.org ) could be used I think. As mentioned at the bottom of http://tango.freedesktop.org/Tango_Desktop_Project , they are licensed under the Creative Commons Attribution Share-Alike license, which I think is acceptable for us to redistribute (although there is no black/white policy on this yet at the ASF, see [1] and [2] ). [1] http://mail-archives.apache.org/mod_mbox/www-legal-discuss/200610.mbox/%3Cc5e632550610270807qad46ffaodc4d65703676608f@mail.gmail.com%3E [2] http://www.apache.org/legal/3party.html
          Hide
          Greg Ludington added a comment -

          (Sent in email earlier, but adding it to the JIRA issue proper)

          I do not know if you have seen the update, as opposed to the one
          originally attached to an earlier JIRA issue, but this one should
          include every attribute in a field or fieldtype – the "attributes"
          table should contain every attribute of the node. Also, I included
          (via cut-and-paste) the basic analysis form, so that it shows for each
          field (and submits to analysis.jsp) as well. If these do not fit what
          you need, and do not have time to take a further look, I would be
          happy to take suggestions for tweaks.

          I thought about doing the transformation server-side as well, but I
          stuck client-side because other admin pages rely on client-side
          transformation. I can rework it as a server-side transformation, if
          that is preferable. The only downsides to server-side approach would
          be the extra (likely insignificant) burden on the server, and the size
          of the page – the transformed HTML will be an order of magnitude
          larger than the XML.

          As for the licensing, I did modify the code from an article, but it is
          still largely intact. I could easily write javascript that is
          entirely free of the original article code, and/or contact the
          original author for explicit permission. As for the icons – I am not
          much of a graphic artist. I could also rewrite the tree to use
          characters instead, unless somebody can locate license free icons, or
          perhaps the people redoing SOLR-76 could also create new icons of that
          size? (The XSL in this issue shares the base admin.css, so we may
          have to rework the XSL to take SOLR-76 into account.) If it is
          permissible, I think it would be better to use the original code and
          credit the author, both to give the original author deserved credit
          for his idea and to minimize duplication of work on our parts

          Show
          Greg Ludington added a comment - (Sent in email earlier, but adding it to the JIRA issue proper) I do not know if you have seen the update, as opposed to the one originally attached to an earlier JIRA issue, but this one should include every attribute in a field or fieldtype – the "attributes" table should contain every attribute of the node. Also, I included (via cut-and-paste) the basic analysis form, so that it shows for each field (and submits to analysis.jsp) as well. If these do not fit what you need, and do not have time to take a further look, I would be happy to take suggestions for tweaks. I thought about doing the transformation server-side as well, but I stuck client-side because other admin pages rely on client-side transformation. I can rework it as a server-side transformation, if that is preferable. The only downsides to server-side approach would be the extra (likely insignificant) burden on the server, and the size of the page – the transformed HTML will be an order of magnitude larger than the XML. As for the licensing, I did modify the code from an article, but it is still largely intact. I could easily write javascript that is entirely free of the original article code, and/or contact the original author for explicit permission. As for the icons – I am not much of a graphic artist. I could also rewrite the tree to use characters instead, unless somebody can locate license free icons, or perhaps the people redoing SOLR-76 could also create new icons of that size? (The XSL in this issue shares the base admin.css, so we may have to rework the XSL to take SOLR-76 into account.) If it is permissible, I think it would be better to use the original code and credit the author, both to give the original author deserved credit for his idea and to minimize duplication of work on our parts
          Hide
          Hoss Man added a comment -

          I really haven't had the time to play with this that i hoped i would (i was really hoping to try and tweak it to add some logic to pull all of the fieldtype attributes into the field, and add some links from this tool out to the analysis page as well) but I just wanted to go on record that i think it's really cool.

          Greg: if you are interested, one way to avoid the issues with get-files and the stylesheet hearder would be to write a new JSP and/or servlet just for powering the schema explorer that applies the transformation on the server side – it should be fairly easy with the XSL Transform utility methods Bertrand added to support the XSLTResponseWriter. ... then we don't have to require the files have the correct stylesheet declaration, or inject the one we want, or rely on the browser to apply it properly.

          As for the license issues ... i don't think we can use those images or any javascript you cut/paste from the article ... but i could be wrong. if there are similar methods you can find that have an Apache compatible license, we should definitely be able to use those.

          Show
          Hoss Man added a comment - I really haven't had the time to play with this that i hoped i would (i was really hoping to try and tweak it to add some logic to pull all of the fieldtype attributes into the field, and add some links from this tool out to the analysis page as well) but I just wanted to go on record that i think it's really cool. Greg: if you are interested, one way to avoid the issues with get-files and the stylesheet hearder would be to write a new JSP and/or servlet just for powering the schema explorer that applies the transformation on the server side – it should be fairly easy with the XSL Transform utility methods Bertrand added to support the XSLTResponseWriter. ... then we don't have to require the files have the correct stylesheet declaration, or inject the one we want, or rely on the browser to apply it properly. As for the license issues ... i don't think we can use those images or any javascript you cut/paste from the article ... but i could be wrong. if there are similar methods you can find that have an Apache compatible license, we should definitely be able to use those.
          Hide
          Greg Ludington added a comment -

          XSLT and jsp changes to allow schema.xml to be explored via a DHTML tree widget, with some cross referencing of fields and fieldtypes according to their usages.

          • Changes get-file.jsp so that it serves a content type of text/xml for files ending in .xml
          • Dynamically inserts an xsl declaration in the requested xml (e.g. schema.xml) if an xsl request parameter is present. (It unfortunately stuffs more code in get-file.jsp, but the alternative would be to force users to modify their schema.xml to add this declaration, which would be worse for several reasons.)
          • Added a schema.xsl to perform the actual transformation, as well as icons to represent the open and closed states of the folder.

          I have not checked the "grant license" option primarily because of those icons. As credited in the XSL, I took the icons as well as adapted the tree javascript from this old DevX article:

          http://www.devx.com/getHelpOn/Article/11874

          There is no license at all on the article or on the code from that article, but I do not know ASF's policy on the use of such assets, as I cannot claim to have created them. If these are unsuitable, I have written many versions of these sorts of scripts, and I could rewrite that party easily enough, but I am not a graphic artist.

          Once those issues are cleared, or suitable replacements are found, I would be happy to resubmit and grant license to the patch. In the meantime, I have submitted the code so people can take a look at it, and, if you find it useful, hopefully to test the XSLT and CSS on more browsers that I have at hand.

          Show
          Greg Ludington added a comment - XSLT and jsp changes to allow schema.xml to be explored via a DHTML tree widget, with some cross referencing of fields and fieldtypes according to their usages. Changes get-file.jsp so that it serves a content type of text/xml for files ending in .xml Dynamically inserts an xsl declaration in the requested xml (e.g. schema.xml) if an xsl request parameter is present. (It unfortunately stuffs more code in get-file.jsp, but the alternative would be to force users to modify their schema.xml to add this declaration, which would be worse for several reasons.) Added a schema.xsl to perform the actual transformation, as well as icons to represent the open and closed states of the folder. I have not checked the "grant license" option primarily because of those icons. As credited in the XSL, I took the icons as well as adapted the tree javascript from this old DevX article: http://www.devx.com/getHelpOn/Article/11874 There is no license at all on the article or on the code from that article, but I do not know ASF's policy on the use of such assets, as I cannot claim to have created them. If these are unsuitable, I have written many versions of these sorts of scripts, and I could rewrite that party easily enough, but I am not a graphic artist. Once those issues are cleared, or suitable replacements are found, I would be happy to resubmit and grant license to the patch. In the meantime, I have submitted the code so people can take a look at it, and, if you find it useful, hopefully to test the XSLT and CSS on more browsers that I have at hand.

            People

            • Assignee:
              Unassigned
              Reporter:
              Greg Ludington
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development