tanning_bed_solr 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. data/.bnsignore +18 -0
  2. data/.gitignore +9 -0
  3. data/History.txt +4 -0
  4. data/README.txt +45 -0
  5. data/Rakefile +18 -0
  6. data/lib/tanning_bed_solr.rb +65 -0
  7. data/vendor/solr/README.txt +42 -0
  8. data/vendor/solr/etc/jetty.xml +212 -0
  9. data/vendor/solr/etc/webdefault.xml +379 -0
  10. data/vendor/solr/example-DIH/README.txt +43 -0
  11. data/vendor/solr/example-DIH/hsqldb/ex.backup +0 -0
  12. data/vendor/solr/example-DIH/hsqldb/ex.data +0 -0
  13. data/vendor/solr/example-DIH/hsqldb/ex.log +2 -0
  14. data/vendor/solr/example-DIH/hsqldb/ex.properties +17 -0
  15. data/vendor/solr/example-DIH/hsqldb/ex.script +12 -0
  16. data/vendor/solr/example-DIH/solr/db/conf/admin-extra.html +31 -0
  17. data/vendor/solr/example-DIH/solr/db/conf/db-data-config.xml +31 -0
  18. data/vendor/solr/example-DIH/solr/db/conf/elevate.xml +36 -0
  19. data/vendor/solr/example-DIH/solr/db/conf/protwords.txt +21 -0
  20. data/vendor/solr/example-DIH/solr/db/conf/schema.xml +356 -0
  21. data/vendor/solr/example-DIH/solr/db/conf/scripts.conf +24 -0
  22. data/vendor/solr/example-DIH/solr/db/conf/solrconfig.xml +705 -0
  23. data/vendor/solr/example-DIH/solr/db/conf/stopwords.txt +58 -0
  24. data/vendor/solr/example-DIH/solr/db/conf/synonyms.txt +31 -0
  25. data/vendor/solr/example-DIH/solr/db/conf/xslt/example.xsl +132 -0
  26. data/vendor/solr/example-DIH/solr/db/conf/xslt/example_atom.xsl +63 -0
  27. data/vendor/solr/example-DIH/solr/db/conf/xslt/example_rss.xsl +62 -0
  28. data/vendor/solr/example-DIH/solr/db/conf/xslt/luke.xsl +345 -0
  29. data/vendor/solr/example-DIH/solr/db/lib/hsqldb-1.8.0.10.jar +0 -0
  30. data/vendor/solr/example-DIH/solr/mail/conf/data-config.xml +11 -0
  31. data/vendor/solr/example-DIH/solr/mail/conf/protwords.txt +21 -0
  32. data/vendor/solr/example-DIH/solr/mail/conf/schema.xml +370 -0
  33. data/vendor/solr/example-DIH/solr/mail/conf/solrconfig.xml +807 -0
  34. data/vendor/solr/example-DIH/solr/mail/conf/stopwords.txt +58 -0
  35. data/vendor/solr/example-DIH/solr/mail/conf/synonyms.txt +31 -0
  36. data/vendor/solr/example-DIH/solr/rss/conf/admin-extra.html +31 -0
  37. data/vendor/solr/example-DIH/solr/rss/conf/elevate.xml +36 -0
  38. data/vendor/solr/example-DIH/solr/rss/conf/protwords.txt +21 -0
  39. data/vendor/solr/example-DIH/solr/rss/conf/rss-data-config.xml +26 -0
  40. data/vendor/solr/example-DIH/solr/rss/conf/schema.xml +316 -0
  41. data/vendor/solr/example-DIH/solr/rss/conf/scripts.conf +24 -0
  42. data/vendor/solr/example-DIH/solr/rss/conf/solrconfig.xml +704 -0
  43. data/vendor/solr/example-DIH/solr/rss/conf/stopwords.txt +58 -0
  44. data/vendor/solr/example-DIH/solr/rss/conf/synonyms.txt +31 -0
  45. data/vendor/solr/example-DIH/solr/solr.xml +8 -0
  46. data/vendor/solr/exampledocs/books.csv +11 -0
  47. data/vendor/solr/exampledocs/hd.xml +48 -0
  48. data/vendor/solr/exampledocs/ipod_other.xml +52 -0
  49. data/vendor/solr/exampledocs/ipod_video.xml +36 -0
  50. data/vendor/solr/exampledocs/mem.xml +60 -0
  51. data/vendor/solr/exampledocs/monitor.xml +31 -0
  52. data/vendor/solr/exampledocs/monitor2.xml +30 -0
  53. data/vendor/solr/exampledocs/mp500.xml +39 -0
  54. data/vendor/solr/exampledocs/payload.xml +57 -0
  55. data/vendor/solr/exampledocs/post.jar +0 -0
  56. data/vendor/solr/exampledocs/post.sh +28 -0
  57. data/vendor/solr/exampledocs/sd500.xml +34 -0
  58. data/vendor/solr/exampledocs/solr.xml +38 -0
  59. data/vendor/solr/exampledocs/test_utf8.sh +83 -0
  60. data/vendor/solr/exampledocs/utf8-example.xml +42 -0
  61. data/vendor/solr/exampledocs/vidcard.xml +54 -0
  62. data/vendor/solr/lib/jetty-6.1.3.jar +0 -0
  63. data/vendor/solr/lib/jetty-util-6.1.3.jar +0 -0
  64. data/vendor/solr/lib/jsp-2.1/ant-1.6.5.jar +0 -0
  65. data/vendor/solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
  66. data/vendor/solr/lib/jsp-2.1/jsp-2.1.jar +0 -0
  67. data/vendor/solr/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
  68. data/vendor/solr/lib/servlet-api-2.5-6.1.3.jar +0 -0
  69. data/vendor/solr/logs/.keep +0 -0
  70. data/vendor/solr/multicore/README.txt +3 -0
  71. data/vendor/solr/multicore/core0/conf/schema.xml +41 -0
  72. data/vendor/solr/multicore/core0/conf/solrconfig.xml +40 -0
  73. data/vendor/solr/multicore/core1/conf/schema.xml +41 -0
  74. data/vendor/solr/multicore/core1/conf/solrconfig.xml +40 -0
  75. data/vendor/solr/multicore/exampledocs/ipod_other.xml +34 -0
  76. data/vendor/solr/multicore/exampledocs/ipod_video.xml +22 -0
  77. data/vendor/solr/multicore/solr.xml +35 -0
  78. data/vendor/solr/solr/README.txt +54 -0
  79. data/vendor/solr/solr/conf/admin-extra.html +31 -0
  80. data/vendor/solr/solr/conf/elevate.xml +36 -0
  81. data/vendor/solr/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
  82. data/vendor/solr/solr/conf/protwords.txt +21 -0
  83. data/vendor/solr/solr/conf/schema.xml +126 -0
  84. data/vendor/solr/solr/conf/scripts.conf +24 -0
  85. data/vendor/solr/solr/conf/solrconfig.xml +458 -0
  86. data/vendor/solr/solr/conf/spellings.txt +2 -0
  87. data/vendor/solr/solr/conf/stopwords.txt +58 -0
  88. data/vendor/solr/solr/conf/synonyms.txt +31 -0
  89. data/vendor/solr/solr/conf/xslt/example.xsl +132 -0
  90. data/vendor/solr/solr/conf/xslt/example_atom.xsl +67 -0
  91. data/vendor/solr/solr/conf/xslt/example_rss.xsl +66 -0
  92. data/vendor/solr/solr/conf/xslt/luke.xsl +337 -0
  93. data/vendor/solr/start.jar +0 -0
  94. data/vendor/solr/webapps/solr.war +0 -0
  95. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/jsp/org/apache/jsp/admin/index_jsp.class +0 -0
  96. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/jsp/org/apache/jsp/index_jsp.class +0 -0
  97. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/META-INF/LICENSE.txt +1086 -0
  98. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/META-INF/NOTICE.txt +254 -0
  99. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/apache-solr-core-1.4.0.jar +0 -0
  100. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/apache-solr-dataimporthandler-1.4.0.jar +0 -0
  101. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/apache-solr-solrj-1.4.0.jar +0 -0
  102. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/commons-codec-1.3.jar +0 -0
  103. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/commons-csv-1.0-SNAPSHOT-r609327.jar +0 -0
  104. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/commons-fileupload-1.2.1.jar +0 -0
  105. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/commons-httpclient-3.1.jar +0 -0
  106. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/commons-io-1.4.jar +0 -0
  107. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/geronimo-stax-api_1.0_spec-1.0.1.jar +0 -0
  108. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/jcl-over-slf4j-1.5.5.jar +0 -0
  109. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/lucene-analyzers-2.9.1.jar +0 -0
  110. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/lucene-core-2.9.1.jar +0 -0
  111. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/lucene-highlighter-2.9.1.jar +0 -0
  112. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/lucene-memory-2.9.1.jar +0 -0
  113. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/lucene-misc-2.9.1.jar +0 -0
  114. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/lucene-queries-2.9.1.jar +0 -0
  115. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/lucene-snowball-2.9.1.jar +0 -0
  116. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/lucene-spellchecker-2.9.1.jar +0 -0
  117. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/slf4j-api-1.5.5.jar +0 -0
  118. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/slf4j-jdk14-1.5.5.jar +0 -0
  119. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/lib/wstx-asl-3.2.7.jar +0 -0
  120. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/web.xml +148 -0
  121. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/WEB-INF/weblogic.xml +12 -0
  122. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/_info.jsp +118 -0
  123. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/action.jsp +94 -0
  124. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/analysis.jsp +498 -0
  125. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/analysis.xsl +179 -0
  126. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/dataimport.jsp +54 -0
  127. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/debug.jsp +106 -0
  128. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/distributiondump.jsp +160 -0
  129. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/favicon.ico +0 -0
  130. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/form.jsp +137 -0
  131. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/get-file.jsp +72 -0
  132. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/get-properties.jsp +24 -0
  133. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/header.jsp +41 -0
  134. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/index.jsp +156 -0
  135. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/jquery-1.2.3.min.js +32 -0
  136. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/meta.xsl +34 -0
  137. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/ping.jsp +52 -0
  138. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/ping.xsl +71 -0
  139. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/raw-schema.jsp +38 -0
  140. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/registry.jsp +107 -0
  141. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/registry.xsl +321 -0
  142. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/replication/header.jsp +89 -0
  143. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/replication/index.jsp +378 -0
  144. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/schema.jsp +657 -0
  145. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/solr-admin.css +215 -0
  146. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/solr_small.png +0 -0
  147. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/stats.jsp +92 -0
  148. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/stats.xsl +220 -0
  149. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/tabular.xsl +141 -0
  150. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/threaddump.jsp +110 -0
  151. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/admin/threaddump.xsl +103 -0
  152. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/favicon.ico +0 -0
  153. data/vendor/solr/work/Jetty_0_0_0_0_8983_solr.war__solr__k1kf17/webapp/index.jsp +42 -0
  154. data/version.txt +1 -0
  155. metadata +251 -0
@@ -0,0 +1,657 @@
1
+ <%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
2
+ <%--
3
+ Licensed to the Apache Software Foundation (ASF) under one or more
4
+ contributor license agreements. See the NOTICE file distributed with
5
+ this work for additional information regarding copyright ownership.
6
+ The ASF licenses this file to You under the Apache License, Version 2.0
7
+ (the "License"); you may not use this file except in compliance with
8
+ the License. You may obtain a copy of the License at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
17
+ --%>
18
+
19
+ <%-- $Id: index.jsp 608150 2008-01-02 17:15:30Z ryan $ --%>
20
+ <%-- $Source: /cvs/main/searching/SolrServer/resources/admin/index.jsp,v $ --%>
21
+ <%-- $Name: $ --%>
22
+
23
+ <script src="jquery-1.2.3.min.js"></script>
24
+ <script>
25
+
26
+ (function($, libName) {
27
+ var solr = {
28
+
29
+ //The default location of the luke handler relative to this page
30
+ // Can be overridden in the init(url) method
31
+ pathToLukeHandler: 'luke',
32
+
33
+ // Base properties to hold schema information
34
+ schemaInfo: {},
35
+ schemaFields: {},
36
+ schemaDynamicFields: {},
37
+ schemaTypes: {},
38
+ schemaFlags: {},
39
+
40
+ //The basic function to call to make the initail JSON calls
41
+ // takes one option parameter, the path to the luke handler
42
+ // if undefined, it will use the default, 'luke', which means
43
+ // this is being called from the same relative URL path
44
+ init: function(pathToLukeHandler) {
45
+ if (pathToLukeHandler != undefined) {
46
+ solr.pathToLukeHandler = pathToLukeHandler;
47
+ }
48
+ solr.loadSchema(function() {
49
+ solr.loadFromLukeHandler(function () {
50
+ solr.createMenu('menu');
51
+ solr.displaySchemaInfo();
52
+ });
53
+ });
54
+
55
+ },
56
+
57
+ //load the Schema from the LukeRequestHandler
58
+ // this loads every field, and in each field the copy source/dests and flags
59
+ // we also load the list of field types, and the list of flags
60
+ loadSchema: function(func) {
61
+ $.getJSON(solr.pathToLukeHandler +'?show=schema&wt=json', function(data) {
62
+ //populate all non field/type/flag data in the info block
63
+ $.each(data.index, function(i, item) {
64
+ solr.schemaInfo[i] = item;
65
+ });
66
+
67
+ //LukeRequestHandler places these two attributes outside of the "index" node, but
68
+ // we want it here so we can more easily display it in the "HOME" block
69
+ solr.schemaInfo['uniqueKeyField'] = data.schema.uniqueKeyField;
70
+ solr.schemaInfo['defaultSearchField'] = data.schema.defaultSearchField;
71
+ //a one-off hack, because the directory string is so long and unbroken
72
+ // that it can break CSS layouts
73
+ solr.schemaInfo['directory'] = solr.schemaInfo['directory'].substring(0, solr.schemaInfo['directory'].indexOf('@')+1) + ' ' + solr.schemaInfo['directory'].substring(solr.schemaInfo['directory'].indexOf('@') +1);
74
+
75
+ // populate the list of fields
76
+ $.each(data.schema.fields, function(i,item){
77
+ solr.schemaFields[i]=item;
78
+ });
79
+ // populate the list of field types
80
+ $.each(data.schema.types, function(type, ft) {
81
+ solr.schemaTypes[type] = ft;
82
+ });
83
+ //populate the list of dynamic fields
84
+ $.each(data.schema.dynamicFields, function(i, dynField) {
85
+ solr.schemaDynamicFields[i] = dynField;
86
+ });
87
+ //populate the list of flags, so we can convert flags to text in display
88
+ $.each(data.info.key, function(i, flag) {
89
+ solr.schemaFlags[i] = flag;
90
+ });
91
+
92
+ //LukeRequestHandler returns copyFields src/dest as the entire toString of the field
93
+ // we only need the field name, so here we loop through the fields, and replace the full
94
+ // field definitions with the name in the copySources/copyDests properties
95
+ $.each(solr.schemaFields, function(i, field) {
96
+ $.each(['copySources', 'copyDests'], function(i, copyProp) {
97
+ var newFields = new Array();
98
+ $.each(field[copyProp], function(i, fullName) {
99
+ newFields.push(fullName.substring(fullName.lastIndexOf(':')+1, fullName.indexOf('{')));
100
+ });
101
+ field[copyProp] = newFields;
102
+ });
103
+
104
+ });
105
+ //An additional optional callback
106
+ // used in init to trigger the 2nd call to LukeRequestHandler only
107
+ // after the first one is finished
108
+ if ($.isFunction(func)) {
109
+ func(solr);
110
+ }
111
+ });
112
+ },
113
+
114
+ //further populates the loaded schema with information gathered
115
+ // from the no argument LukeRequestHandler
116
+ loadFromLukeHandler: function(func) {
117
+ $.getJSON(solr.pathToLukeHandler+'?wt=json', function(data) {
118
+ $.each(data.fields, function(i, item) {
119
+ var field = solr.schemaFields[i];
120
+
121
+ //If undefined, then we have a dynamicField which does not show up
122
+ // in the LukeRequestHandler show=schema variant
123
+ if (field == undefined) {
124
+ field = item;
125
+ //Attach this field to its dynamicField
126
+ var base = field.dynamicBase;
127
+ var dynField = solr.schemaDynamicFields[base];
128
+
129
+ //Some fields in a multicore setting have no dynamic base, either
130
+ // the name of the core is a field that has no type or flags
131
+ if (dynField != undefined) {
132
+ var synFields = dynField['fields'];
133
+ if (synFields== undefined) {
134
+ synFields= new Array();
135
+ }
136
+ synFields.push(i);
137
+ dynField['fields'] = synFields;
138
+ }
139
+ solr.schemaFields[i] = item;
140
+ }
141
+ //Populate other data in this field that would not have been loaded in
142
+ // the show=schema variant
143
+ $.each(item, function(k, v) {
144
+ if (k == 'topTerms' || k == 'histogram') {
145
+ solr.schemaFields[i][k] = solr.lukeArrayToHash(v);
146
+ } else {
147
+ solr.schemaFields[i][k] = v;
148
+ }
149
+ });
150
+ });
151
+ //another optional callback; used in the init case to lay out the page
152
+ // after the data is loaded
153
+ if ($.isFunction(func)) {
154
+ func();
155
+ }
156
+ });
157
+ },
158
+ //some elements in the JSON response are arrays, where odd/even elements
159
+ // are the name/value, and convert it to a standard map/associative array
160
+ // incoming: ['foo', 'bar', 'bat', 'baz']
161
+ // output: {'foo':'bar', 'bat':baz'}
162
+ lukeArrayToHash: function(termsArr) {
163
+ var hash = new Object();
164
+ var temp;
165
+ //topTerms comes in as an array, with odd indexes the field name
166
+ // and even indexes the number
167
+ $.each(termsArr, function(i, item) {
168
+ if (i%2 ==0) {
169
+ temp = item;
170
+ } else {
171
+ hash[temp] = item;
172
+ }
173
+ });
174
+ return hash;
175
+ },
176
+
177
+ //gets the top Terms via an Ajax call the LukeRequestHandler for that field
178
+ // The callback is used here to redraw the table after the ajax call returns
179
+ getTopTerms: function(fieldName, numTerms, func) {
180
+ if (numTerms == undefined) {
181
+ var numTerms = 10;
182
+ }
183
+ if (isNaN(numTerms) || numTerms <=0 || numTerms.indexOf('.') != -1) {
184
+ return;
185
+ }
186
+ $.getJSON(solr.pathToLukeHandler+'?fl='+fieldName+'&wt=json&numTerms='+numTerms, function(data) {
187
+ solr.schemaFields[fieldName]['topTerms'] = solr.lukeArrayToHash(data.fields[fieldName].topTerms);
188
+ if ($.isFunction(func)) {
189
+ func(solr.schemaFields[fieldName]['topTerms'], fieldName);
190
+ }
191
+ });
192
+ },
193
+
194
+ // Displays the SchemaInfo in the main content panel
195
+ // dispayed on data load, and also when 'Home' is clicked
196
+ displaySchemaInfo: function() {
197
+ $('#mainInfo').html('');
198
+ $('#topTerms').html('');
199
+ $('#histogram').html('');
200
+ $('#mainInfo').append(solr.createSimpleText('Schema Information'));
201
+ //Make sure the uniqueKeyField and defaultSearchFields come first
202
+ $.each({'Unique Key':'uniqueKeyField', 'Default Search Field':'defaultSearchField'}, function(text, prop) {
203
+ if (solr.schemaInfo[prop] != undefined) {
204
+ $('#mainInfo').append(solr.createNameValueText(text, function(p) {
205
+ p.appendChild(solr.createLink(solr.schemaInfo[prop], solr.schemaInfo[prop]));
206
+ return p;
207
+ }));
208
+ }
209
+ });
210
+ $.each(solr.schemaInfo, function(i, item) {
211
+ if (i == 'uniqueKeyField' || i == 'defaultSearchField') {
212
+ //noop; we took care of this above
213
+ } else {
214
+ $('#mainInfo').append(solr.createNameValueText(i, item));
215
+ }
216
+ });
217
+ //Close all menus when we display schema home
218
+ solr.toggleMenus(undefined, ['fields', 'types', 'dynFields']);
219
+ },
220
+
221
+ // display a dynamic field in the main content panel
222
+ displayDynamicField: function(dynamicPattern) {
223
+ var df = solr.schemaDynamicFields[dynamicPattern];
224
+ $('#mainInfo').html('');
225
+ $('#topTerms').html('');
226
+ $('#histogram').html('');
227
+ $('#mainInfo').append(solr.createSimpleText('Dynamic Field: ' + dynamicPattern));
228
+ $('#mainInfo').append(solr.createNameValueText('Fields', function(p) {
229
+ if (df.fields != undefined) {
230
+ $.each(df.fields, function(i, item) {
231
+ p.appendChild(solr.createLink(item, item));
232
+ });
233
+ } else {
234
+ p.appendChild(document.createTextNode(' None currently in index'));
235
+ }
236
+ return p;
237
+ }));
238
+ var ft = solr.schemaTypes[df.type];
239
+ $('#mainInfo').append(solr.createNameValueText('Field Type', function(p) {
240
+ p.appendChild(solr.createLink(df.type, df.type, solr.displayFieldType));
241
+ return p;
242
+ }));
243
+ if (df.flags != undefined) {
244
+ $('#mainInfo').append(solr.createNameValueText('Properties', solr.createTextFromFlags(df.flags, df.type)));
245
+ }
246
+ solr.displayAnalyzer(ft.indexAnalyzer, 'Index Analyzer', true);
247
+ solr.displayAnalyzer(ft.queryAnalyzer, 'Query Analyzer', true);
248
+
249
+ solr.toggleMenus('dynFields', ['fields', 'types'], dynamicPattern);
250
+ },
251
+
252
+ // display a field type in the main area
253
+ displayFieldType: function(typeName) {
254
+ var ft = solr.schemaTypes[typeName];
255
+ $('#mainInfo').html('');
256
+ $('#topTerms').html('');
257
+ $('#histogram').html('');
258
+ $('#mainInfo').append(solr.createSimpleText('Field Type: ' + typeName));
259
+ $('#mainInfo').append(solr.createNameValueText('Fields', function(p) {
260
+ if (ft.fields != undefined) {
261
+ $.each(ft.fields, function(i, item) {
262
+ if (solr.schemaFields[item] != undefined) {
263
+ p.appendChild(solr.createLink(item, item));
264
+ } else {
265
+ p.appendChild(solr.createLink(item, item, solr.displayDynamicField));
266
+ }
267
+ p.appendChild(document.createTextNode(' '));
268
+ });
269
+ } else {
270
+ p.appendChild(document.createTextNode('No fields in index'));
271
+ }
272
+ return p;
273
+ }));
274
+ $('#mainInfo').append(solr.createNameValueText('Tokenized', ft.tokenized));
275
+ $('#mainInfo').append(solr.createNameValueText('Class Name', ft.className));
276
+
277
+ solr.displayAnalyzer(ft.indexAnalyzer, 'Index Analyzer');
278
+ solr.displayAnalyzer(ft.queryAnalyzer, 'Query Analyzer');
279
+ solr.toggleMenus('types', ['fields', 'dynFields'], typeName);
280
+ },
281
+
282
+ //Displays information about an Analyzer in the main content area
283
+ displayAnalyzer: function(analyzer, type, shouldCollapse) {
284
+ var tid = type.replace(' ', '');
285
+ var collapse = shouldCollapse && (analyzer.tokenizer != undefined || analyzer.filters != undefined);
286
+ $('#mainInfo').append(solr.createNameValueText(type, function(p) {
287
+ p.appendChild(document.createTextNode(analyzer.className + ' '));
288
+ if (collapse) {
289
+ p.appendChild(solr.createLink(type, 'Details', function() {
290
+ $('#'+tid).toggle("slow");
291
+ }));
292
+ }
293
+ return p;
294
+ }));
295
+ var adiv = document.createElement('div');
296
+ adiv.id=tid;
297
+ adiv.className='analyzer';
298
+ if (collapse) {
299
+ adiv.style.display='none';
300
+ }
301
+ if (analyzer.tokenizer != undefined) {
302
+ adiv.appendChild(solr.createNameValueText("Tokenizer Class", analyzer.tokenizer.className));
303
+ }
304
+ if (analyzer.filters != undefined) {
305
+ adiv.appendChild(solr.createNameValueText('Filters', ''));
306
+ var f = document.createElement('ol');
307
+ $.each(analyzer.filters, function(i, item) {
308
+ var fil = document.createElement('li');
309
+ var filterText = item.className;
310
+ if (item.args != undefined) {
311
+ filterText += ' args:{'
312
+ $.each(item.args, function(fi, fitem) {
313
+ filterText += fi + ': ' + fitem + ' ';
314
+ });
315
+ filterText +='}';
316
+ fil.innerHTML = filterText;
317
+ f.appendChild(fil);
318
+ }
319
+ });
320
+ adiv.appendChild(f);
321
+ }
322
+ $('#mainInfo').append(adiv);
323
+ },
324
+
325
+ // display information about a Field in the main content area
326
+ // and its TopTerms and Histogram in related divs
327
+ displayField: function(fieldName) {
328
+ var field = solr.schemaFields[fieldName];
329
+ var isDynamic = field.dynamicBase != undefined ? true : false;
330
+ var ft;
331
+ var ftName;
332
+ $('#mainInfo').html('');
333
+ $('#topTerms').html('');
334
+ $('#histogram').html('');
335
+ $('#mainInfo').append(solr.createSimpleText('Field: ' + fieldName));
336
+
337
+ //For regular fields, we take their properties; for dynamicFields,
338
+ // we take them from their dynamicField definitions
339
+ if (isDynamic) {
340
+ ftName = solr.schemaDynamicFields[field.dynamicBase].type
341
+ $('#mainInfo').append(solr.createNameValueText('Dynamically Created From Pattern', function(p) {
342
+ p.appendChild(solr.createLink(field.dynamicBase, field.dynamicBase, solr.displayDynamicField));
343
+ return p;
344
+ }));
345
+ } else {
346
+ ftName = field.type;
347
+ }
348
+ ft = solr.schemaTypes[field.type];
349
+ $('#mainInfo').append(solr.createNameValueText('Field Type', function(p) {
350
+ p.appendChild(solr.createLink(ftName, ftName, solr.displayFieldType));
351
+ return p;
352
+ }));
353
+ if (solr.schemaFlags != '') {
354
+ $.each({'flags':'Properties', 'schema':'Schema', 'index':'Index'}, function(prop, text) {
355
+ if (field[prop] != undefined) {
356
+ $('#mainInfo').append(solr.createNameValueText(text, solr.createTextFromFlags(field[prop], ft)));
357
+ }
358
+ });
359
+ }
360
+ $.each({'copySources':'Copied From', 'copyDests':'Copied Into'}, function(prop, text) {
361
+ if (field[prop] != undefined && field[prop] != '') {
362
+ $('#mainInfo').append(solr.createNameValueText(text, function(p) {
363
+ $.each(field[prop], function(i, item) {
364
+ p.appendChild(solr.createLink(item, item));
365
+ p.appendChild(document.createTextNode(' '));
366
+ });
367
+ return p;
368
+ }));
369
+ }
370
+ });
371
+ if (field.positionIncrementGap != undefined) {
372
+ $('#mainInfo').append(solr.createNameValueText('Position Increment Gap', field.positionIncrementGap));
373
+ }
374
+ solr.displayAnalyzer(ft.indexAnalyzer, 'Index Analyzer', true);
375
+ solr.displayAnalyzer(ft.queryAnalyzer, 'Query Analyzer', true);
376
+ if (field.docs != undefined) {
377
+ $('#mainInfo').append(solr.createNameValueText('Docs', field.docs));
378
+ }
379
+ if (field.distinct != undefined) {
380
+ $('#mainInfo').append(solr.createNameValueText('Distinct', field.distinct));
381
+ }
382
+
383
+ if (field.topTerms != undefined) {
384
+ solr.displayTopTerms(field.topTerms, fieldName);
385
+ }
386
+
387
+ if (field.histogram != undefined) {
388
+ solr.drawHistogram(field.histogram);
389
+ }
390
+ solr.toggleMenus('fields', ['types', 'dynFields'], fieldName);
391
+ },
392
+
393
+ //utility method to create a single sentence list of properties from a flag set
394
+ // or pass it on, if the flags are (unstored field)
395
+ createTextFromFlags: function(fieldFlags, fieldType) {
396
+ var value;
397
+ if (fieldFlags != '(unstored field)') {
398
+ var value = '';
399
+ for (var i=0;i<fieldFlags.length;i++) {
400
+ if (fieldFlags.charAt(i) != '-') {
401
+ value += solr.schemaFlags[fieldFlags.charAt(i)];
402
+ value += ', ';
403
+ }
404
+ }
405
+ value = value.substring(0, value.length-2);
406
+ } else {
407
+ value = fieldFlags;
408
+ }
409
+ return value;
410
+ },
411
+
412
+ //Store the currently highlighted menu item, as otherwise we
413
+ // must traverse all li menu items, which is very slow on schemas with
414
+ // large number of fields
415
+ // for example $('#menu ul li').siblings().removeClass('selected');
416
+ currentlyHighlightedMenuId: undefined,
417
+
418
+ //add a highlight to the currently selected menu item, and remove
419
+ // the highlights from all other menu items
420
+ highlightMenuItem: function(idToSelect) {
421
+ if (solr.currentlyHighlightedMenuId != undefined) {
422
+ $('#'+solr.currentlyHighlightedMenuId).removeClass('selected');
423
+ }
424
+ $('#'+idToSelect).addClass('selected');
425
+ solr.currentlyHighlightedMenuId = idToSelect;
426
+ },
427
+
428
+ //Opens one menu group, close the others, and optionally highlight one
429
+ // item, which should be in the opened menu
430
+ toggleMenus: function(idToShow, idsToHide, idToSelect) {
431
+ if (idToSelect != undefined) {
432
+ solr.highlightMenuItem(idToShow + idToSelect);
433
+ }
434
+ $('#'+idToShow).show("slow");
435
+ $.each(idsToHide, function(i, idToHide) {
436
+ $('#'+idToHide).hide("slow");
437
+ });
438
+ },
439
+
440
+ //A utility method to create a paragraph, which takes two arguments;
441
+ // an opening text, and either text or a callback function to follow
442
+ // any callback function must return the node passed into it
443
+ createNameValueText: function(openingText, func) {
444
+ var p = document.createElement('p');
445
+ p.appendChild(solr.createSimpleText(openingText + ': ', 'b'));
446
+ return solr.applyFuncToNode(p, func);
447
+ },
448
+
449
+ //utility method to create an HTML text element node
450
+ // with the literal text to place, and an optional function to apply
451
+ // any callback function must return the node passed into it
452
+ createSimpleText: function(text, n, func) {
453
+ if (n == undefined) {
454
+ n = 'h2';
455
+ }
456
+ var no= document.createElement(n);
457
+ no.appendChild(document.createTextNode(text));
458
+ return solr.applyFuncToNode(no, func);
459
+ },
460
+
461
+ //Utility method that applies a function or a string to append
462
+ // an additional child to a node
463
+ applyFuncToNode: function(no, func) {
464
+ if ($.isFunction(func)) {
465
+ no = func(no);
466
+ } else {
467
+ // if it is not a function, append it as a string
468
+ if (func != undefined) {
469
+ no.appendChild(document.createTextNode(' ' + func));
470
+ }
471
+ }
472
+ return no;
473
+ },
474
+
475
+ //show a table of top terms for a given field
476
+ displayTopTerms: function(topTerms, fieldName) {
477
+ $('#topTerms').html('');
478
+ var tbl = document.createElement('table');
479
+ tbl.className='topTerms';
480
+ var thead= document.createElement('thead');
481
+ var headerRow = document.createElement('tr');
482
+ $.each(['term', 'frequency'], function() {
483
+ var cell = document.createElement('th');
484
+ cell.innerHTML= this;
485
+ headerRow.appendChild(cell);
486
+ });
487
+ thead.appendChild(headerRow);
488
+ tbl.appendChild(thead);
489
+ var tbody = document.createElement('tbody');
490
+
491
+ var numTerms = 0;
492
+ $.each(topTerms, function(term, count) {
493
+ var c1 = $('<td>').text(term);
494
+ var c2 = $('<td>').text(count);
495
+ var row = $('<tr>').append(c1).append(c2);
496
+ tbody.appendChild(row.get(0));
497
+ numTerms++;
498
+ });
499
+ tbl.appendChild(tbody);
500
+
501
+ //create a header along with an input widget so the user
502
+ // can request a different number of Top Terms
503
+ var h2 = document.createElement('h2');
504
+ h2.appendChild(document.createTextNode('Top '));
505
+ var termsGetter = document.createElement('input');
506
+ termsGetter.type='text';
507
+ termsGetter.size=5;
508
+ termsGetter.value=numTerms;
509
+
510
+ termsGetter.onchange=function() {
511
+ solr.getTopTerms(fieldName, this.value, solr.displayTopTerms);
512
+ }
513
+ h2.appendChild(termsGetter);
514
+ h2.appendChild(document.createTextNode(' Terms'));
515
+ $('#topTerms').append(h2);
516
+
517
+ document.getElementById('topTerms').appendChild(tbl);
518
+ $('#topTerms').append(tbl);
519
+ },
520
+
521
+ //draws a histogram, taking a map of values and an optional total height and width for the table
522
+ drawHistogram: function(histogram, totalHeightArg, totalWidthArg) {
523
+ $('#histogram').html('');
524
+ $('#histogram').append(solr.createSimpleText('Histogram'));
525
+ var max = 0;
526
+ var bars =0;
527
+ //find the # of columns and max value in the histogram
528
+ // so we can create an appropriately scaled chart
529
+ $.each(histogram, function(i, item) {
530
+ if (item > max) max = item;
531
+ bars += 1;
532
+ });
533
+ if (max ==0) {
534
+ $('#histogram').append(solr.createNameValueText('No histogram available'));
535
+ } else {
536
+ var totalHeight = totalHeightArg == undefined ? 208 : totalHeightArg;
537
+ var totalWidth = totalWidthArg == undefined ? 160 : totalWidthArg;
538
+ var tbl = document.createElement('table');
539
+ tbl.style.width=totalWidth+'px';
540
+ tbl.className = 'histogram';
541
+ var h = document.createElement('tbody');
542
+ var r = document.createElement('tr');
543
+ var r2 = document.createElement('tr');
544
+ $.each(histogram, function(i, item) {
545
+ var c = document.createElement('td');
546
+ c.innerHTML=item+'<div style="width:'+totalWidth/bars+'px;height:'+(item*totalHeight/max)+'px;background:blue">&nbsp</div>';
547
+ r.appendChild(c);
548
+ var c2 = document.createElement('td');
549
+ c2.innerHTML='' + i;
550
+ r2.appendChild(c2);
551
+ });
552
+ h.appendChild(r);
553
+ h.appendChild(r2);
554
+ tbl.appendChild(h);
555
+ $('#histogram').append(tbl);
556
+ }
557
+ },
558
+
559
+ //dynamically creates a link to be appended
560
+ createLink: function(idToDisplay, linkText, linkFunction) {
561
+ var link = document.createElement('a');
562
+ if (!$.isFunction(linkFunction)) {
563
+ linkFunction = solr.displayField
564
+ }
565
+ link.onclick=function() {
566
+ linkFunction(idToDisplay);
567
+ return false;
568
+ };
569
+ link.href='#';
570
+ link.innerHTML=linkText;
571
+ return link;
572
+ },
573
+
574
+ //Creates a menu header that can expand or collapse its children
575
+ createMenuHeader: function(text, idToShow, idsToHide) {
576
+ var head = document.createElement('h3');
577
+ var a = document.createElement('a');
578
+ a.onclick=function() {
579
+ solr.toggleMenus(idToShow, idsToHide);
580
+ return false;
581
+ };
582
+ a.href='#';
583
+ a.innerHTML=text;
584
+ head.appendChild(a);
585
+ return head;
586
+ },
587
+
588
+ //Creates an element in a menu (e.g. each field in a list of fields)
589
+ createMenuItem: function(tagName, text, link, type, func) {
590
+ var fieldEle = document.createElement('li');
591
+ fieldEle.id=type+text;
592
+ var funct = func == undefined ? undefined : func;
593
+ fieldEle.appendChild(solr.createLink(text, link, funct));
594
+ return fieldEle;
595
+ },
596
+
597
+ //populates the menu div
598
+ createMenu: function(menuId) {
599
+ var m = $('#'+menuId);
600
+ var home = document.createElement('h2');
601
+ home.appendChild(solr.createLink('Home', 'Home', solr.displaySchemaInfo));
602
+ m.append(home);
603
+ m.append(solr.createMenuHeader('Fields', 'fields', ['types', 'dynFields']));
604
+ var fields= document.createElement('ul');
605
+ fields.style.display='none';
606
+ fields.id = 'fields';
607
+ $.each(solr.schemaFields, function(i, item) {
608
+ fields.appendChild(solr.createMenuItem('li', i, i, fields.id));
609
+ });
610
+ m.append(fields);
611
+ m.append(solr.createMenuHeader('Dynamic Fields', 'dynFields', ['fields', 'types']));
612
+ var dyns = document.createElement('ul');
613
+ dyns.style.display = 'none';
614
+ dyns.id = 'dynFields';
615
+ $.each(solr.schemaDynamicFields, function(i, item) {
616
+ dyns.appendChild(solr.createMenuItem('li', i,i, dyns.id, solr.displayDynamicField));
617
+ });
618
+ m.append(dyns);
619
+ m.append(solr.createMenuHeader('Field Types', 'types', ['fields', 'dynFields']));
620
+ var types = document.createElement('ul');
621
+ types.style.display='none';
622
+ types.id='types';
623
+ $.each(this.schemaTypes, function(i, item) {
624
+ types.appendChild(solr.createMenuItem('li', i, i,types.id, solr.displayFieldType));
625
+ });
626
+ m.append(types);
627
+ }
628
+ };
629
+
630
+ window[libName] = solr;
631
+ })(jQuery, 'solr');
632
+ $(document).ready(function() {
633
+ solr.init();
634
+ });
635
+
636
+ $(window).unload( function() {
637
+ solr = null;
638
+ $('#mainInfo').html('');
639
+ $('#menu').html('');
640
+ $('#topTerms').html('');
641
+ $('#histogram').html('');
642
+ });
643
+
644
+ </script>
645
+ <%-- do a verbatim include so we can use the local vars --%>
646
+ <%@include file="header.jsp" %>
647
+ <div id="schemaTop">
648
+ <h2>Schema Browser | See <a href="file/?file=schema.xml">Raw Schema.xml</a></h2>
649
+ </div>
650
+ <div id="menu"></div>
651
+ <div id="content">
652
+ <div id="mainInfo"><h2>Please wait...loading and parsing Schema Information from LukeRequestHandler</h2><p>If it does not load or your browser is not javascript or ajax-capable, you may wish to examine your schema using the <a href="luke?wt=xslt&tr=luke.xsl">Server side transformed LukeRequestHandler</a> or the raw <a href="file/?file=schema.xml">schema.xml</a> instead.</div>
653
+ <div id="topTerms"></div>
654
+ <div id="histogram"></div>
655
+ </div>
656
+ </body>
657
+ </html>