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,12 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+ <weblogic-web-app
3
+ xmlns="http://www.bea.com/ns/weblogic/90"
4
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+ xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">
6
+
7
+ <container-descriptor>
8
+ <filter-dispatched-requests-enabled>false</filter-dispatched-requests-enabled>
9
+ </container-descriptor>
10
+
11
+ </weblogic-web-app>
12
+
@@ -0,0 +1,118 @@
1
+ <%--
2
+ Licensed to the Apache Software Foundation (ASF) under one or more
3
+ contributor license agreements. See the NOTICE file distributed with
4
+ this work for additional information regarding copyright ownership.
5
+ The ASF licenses this file to You under the Apache License, Version 2.0
6
+ (the "License"); you may not use this file except in compliance with
7
+ the License. You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ --%>
17
+ <%@ page import="org.apache.solr.core.SolrConfig,
18
+ org.apache.solr.core.SolrCore,
19
+ org.apache.solr.schema.IndexSchema,
20
+ java.io.File"%>
21
+ <%@ page import="java.net.InetAddress"%>
22
+ <%@ page import="java.io.StringWriter"%>
23
+ <%@ page import="org.apache.solr.core.Config"%>
24
+ <%@ page import="org.apache.solr.common.util.XML"%>
25
+ <%@ page import="org.apache.solr.common.SolrException"%>
26
+ <%@ page import="org.apache.lucene.LucenePackage"%>
27
+ <%@ page import="java.net.UnknownHostException" %>
28
+
29
+ <%!
30
+ // only try to figure out the hostname once in a static block so
31
+ // we don't have a potentially slow DNS lookup on every admin request
32
+ static InetAddress addr = null;
33
+ static String hostname = "unknown";
34
+ static {
35
+ try {
36
+ addr = InetAddress.getLocalHost();
37
+ hostname = addr.getCanonicalHostName();
38
+ } catch (UnknownHostException e) {
39
+ //default to unknown
40
+ }
41
+ }
42
+ %>
43
+
44
+ <%
45
+ //
46
+ SolrCore core = (SolrCore) request.getAttribute("org.apache.solr.SolrCore");
47
+ if (core == null) {
48
+ response.sendError( 404, "missing core name in path" );
49
+ return;
50
+ }
51
+
52
+ SolrConfig solrConfig = core.getSolrConfig();
53
+ int port = request.getServerPort();
54
+ IndexSchema schema = core.getSchema();
55
+
56
+ // enabled/disabled is purely from the point of a load-balancer
57
+ // and has no effect on local server function. If there is no healthcheck
58
+ // configured, don't put any status on the admin pages.
59
+ String enabledStatus = null;
60
+ String enabledFile = solrConfig.get("admin/healthcheck/text()",null);
61
+ boolean isEnabled = false;
62
+ if (enabledFile!=null) {
63
+ isEnabled = new File(enabledFile).exists();
64
+ }
65
+
66
+ String collectionName = schema!=null ? schema.getName():"unknown";
67
+
68
+ String defaultSearch = "";
69
+ {
70
+ StringWriter tmp = new StringWriter();
71
+ XML.escapeCharData
72
+ (solrConfig.get("admin/defaultQuery/text()", ""), tmp);
73
+ defaultSearch = tmp.toString();
74
+ }
75
+
76
+ String solrImplVersion = "";
77
+ String solrSpecVersion = "";
78
+ String luceneImplVersion = "";
79
+ String luceneSpecVersion = "";
80
+
81
+ {
82
+ Package p;
83
+ StringWriter tmp;
84
+
85
+ p = SolrCore.class.getPackage();
86
+
87
+ tmp = new StringWriter();
88
+ solrImplVersion = p.getImplementationVersion();
89
+ if (null != solrImplVersion) {
90
+ XML.escapeCharData(solrImplVersion, tmp);
91
+ solrImplVersion = tmp.toString();
92
+ }
93
+ tmp = new StringWriter();
94
+ solrSpecVersion = p.getSpecificationVersion() ;
95
+ if (null != solrSpecVersion) {
96
+ XML.escapeCharData(solrSpecVersion, tmp);
97
+ solrSpecVersion = tmp.toString();
98
+ }
99
+
100
+ p = LucenePackage.class.getPackage();
101
+
102
+ tmp = new StringWriter();
103
+ luceneImplVersion = p.getImplementationVersion();
104
+ if (null != luceneImplVersion) {
105
+ XML.escapeCharData(luceneImplVersion, tmp);
106
+ luceneImplVersion = tmp.toString();
107
+ }
108
+ tmp = new StringWriter();
109
+ luceneSpecVersion = p.getSpecificationVersion() ;
110
+ if (null != luceneSpecVersion) {
111
+ XML.escapeCharData(luceneSpecVersion, tmp);
112
+ luceneSpecVersion = tmp.toString();
113
+ }
114
+ }
115
+
116
+ String cwd=System.getProperty("user.dir");
117
+ String solrHome= solrConfig.getInstanceDir();
118
+ %>
@@ -0,0 +1,94 @@
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
+ <%@ page import="org.apache.solr.common.util.XML"%>
19
+ <%@ page import="org.apache.solr.core.SolrCore,
20
+ org.apache.solr.schema.IndexSchema,
21
+ java.io.File,
22
+ java.net.InetAddress,
23
+ java.net.UnknownHostException"%>
24
+ <%@ page import="java.util.Date"%>
25
+ <%@include file="header.jsp" %>
26
+ <%
27
+
28
+ String action = request.getParameter("action");
29
+ String enableActionStatus = "";
30
+ boolean isValid = false;
31
+
32
+ if (action != null) {
33
+ // Validate fname
34
+ if ("Enable".compareTo(action) == 0) isValid = true;
35
+ if ("Disable".compareTo(action) == 0) isValid = true;
36
+ }
37
+ if (isValid) {
38
+ if ("Enable".compareTo(action) == 0) {
39
+ try {
40
+ File enableFile = new File(enabledFile);
41
+ if (enableFile.createNewFile()) {
42
+ enableActionStatus += "Enable Succeeded (enable file ";
43
+ enableActionStatus += enabledFile;
44
+ enableActionStatus += " created)";
45
+ } else {
46
+ enableActionStatus += "Already Enabled";
47
+ }
48
+ } catch(Exception e) {
49
+ enableActionStatus += "Enable Failed: " + e.toString();
50
+ }
51
+ }
52
+ if ("Disable".compareTo(action) == 0) {
53
+ try {
54
+ File enableFile = new File(enabledFile);
55
+ if (enableFile.delete()) {
56
+ enableActionStatus = "Disable Succeeded (enable file ";
57
+ enableActionStatus += enabledFile;
58
+ enableActionStatus += " removed)";
59
+ } else {
60
+ enableActionStatus = "Already Disabled";
61
+ }
62
+ } catch(Exception e) {
63
+ enableActionStatus += "Disable Failed: " + e.toString();
64
+ }
65
+ }
66
+ } else {
67
+ enableActionStatus = "Illegal Action";
68
+ }
69
+ // :TODO: might want to rework this so any logging change happens *after*
70
+ SolrCore.log.info(enableActionStatus);
71
+ %>
72
+ <br clear="all">
73
+ <table>
74
+ <tr>
75
+ <td>
76
+ <H3>Action:</H3>
77
+ </td>
78
+ <td>
79
+ <% XML.escapeCharData(action, out); %><br>
80
+ </td>
81
+ </tr>
82
+ <tr>
83
+ <td>
84
+ <H4>Result:</H4>
85
+ </td>
86
+ <td>
87
+ <% XML.escapeCharData(enableActionStatus, out); %><br>
88
+ </td>
89
+ </tr>
90
+ </table>
91
+ <br><br>
92
+ <a href=".">Return to Admin Page</a>
93
+ </body>
94
+ </html>
@@ -0,0 +1,498 @@
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
+ <%@ page import="org.apache.lucene.analysis.Analyzer,
19
+ org.apache.lucene.analysis.Token,
20
+ org.apache.lucene.analysis.TokenStream,
21
+ org.apache.lucene.index.Payload,
22
+ org.apache.lucene.analysis.CharReader,
23
+ org.apache.lucene.analysis.CharStream,
24
+ org.apache.solr.analysis.CharFilterFactory,
25
+ org.apache.solr.analysis.TokenFilterFactory,
26
+ org.apache.solr.analysis.TokenizerChain,
27
+ org.apache.solr.analysis.TokenizerFactory,
28
+ org.apache.solr.schema.FieldType,
29
+ org.apache.solr.schema.SchemaField,
30
+ org.apache.solr.common.util.XML,
31
+ javax.servlet.jsp.JspWriter,java.io.IOException
32
+ "%>
33
+ <%@ page import="java.io.Reader"%>
34
+ <%@ page import="java.io.StringReader"%>
35
+ <%@ page import="java.util.*"%>
36
+ <%@ page import="java.math.BigInteger" %>
37
+
38
+ <%-- $Id: analysis.jsp 824045 2009-10-11 10:04:01Z koji $ --%>
39
+ <%-- $Source: /cvs/main/searching/org.apache.solrolarServer/resources/admin/analysis.jsp,v $ --%>
40
+ <%-- $Name: $ --%>
41
+
42
+ <%@include file="header.jsp" %>
43
+
44
+ <%
45
+ // is name a field name or a type name?
46
+ String nt = request.getParameter("nt");
47
+ if (nt==null || nt.length()==0) nt="name"; // assume field name
48
+ nt = nt.toLowerCase().trim();
49
+ String name = request.getParameter("name");
50
+ if (name==null || name.length()==0) name="";
51
+ String val = request.getParameter("val");
52
+ if (val==null || val.length()==0) val="";
53
+ String qval = request.getParameter("qval");
54
+ if (qval==null || qval.length()==0) qval="";
55
+ String verboseS = request.getParameter("verbose");
56
+ boolean verbose = verboseS!=null && verboseS.equalsIgnoreCase("on");
57
+ String qverboseS = request.getParameter("qverbose");
58
+ boolean qverbose = qverboseS!=null && qverboseS.equalsIgnoreCase("on");
59
+ String highlightS = request.getParameter("highlight");
60
+ boolean highlight = highlightS!=null && highlightS.equalsIgnoreCase("on");
61
+ %>
62
+
63
+ <br clear="all">
64
+
65
+ <h2>Field Analysis</h2>
66
+
67
+ <form method="POST" action="analysis.jsp" accept-charset="UTF-8">
68
+ <table>
69
+ <tr>
70
+ <td>
71
+ <strong>Field
72
+ <select name="nt">
73
+ <option <%= nt.equals("name") ? "selected=\"selected\"" : "" %> >name</option>
74
+ <option <%= nt.equals("type") ? "selected=\"selected\"" : "" %>>type</option>
75
+ </select></strong>
76
+ </td>
77
+ <td>
78
+ <input class="std" name="name" type="text" value="<% XML.escapeCharData(name, out); %>">
79
+ </td>
80
+ </tr>
81
+ <tr>
82
+ <td>
83
+ <strong>Field value (Index)</strong>
84
+ <br/>
85
+ verbose output
86
+ <input name="verbose" type="checkbox"
87
+ <%= verbose ? "checked=\"true\"" : "" %> >
88
+ <br/>
89
+ highlight matches
90
+ <input name="highlight" type="checkbox"
91
+ <%= highlight ? "checked=\"true\"" : "" %> >
92
+ </td>
93
+ <td>
94
+ <textarea class="std" rows="8" cols="70" name="val"><% XML.escapeCharData(val,out); %></textarea>
95
+ </td>
96
+ </tr>
97
+ <tr>
98
+ <td>
99
+ <strong>Field value (Query)</strong>
100
+ <br/>
101
+ verbose output
102
+ <input name="qverbose" type="checkbox"
103
+ <%= qverbose ? "checked=\"true\"" : "" %> >
104
+ </td>
105
+ <td>
106
+ <textarea class="std" rows="1" cols="70" name="qval"><% XML.escapeCharData(qval,out); %></textarea>
107
+ </td>
108
+ </tr>
109
+ <tr>
110
+
111
+ <td>
112
+ </td>
113
+
114
+ <td>
115
+ <input class="stdbutton" type="submit" value="analyze">
116
+ </td>
117
+
118
+ </tr>
119
+ </table>
120
+ </form>
121
+
122
+
123
+ <%
124
+ SchemaField field=null;
125
+
126
+ if (name!="") {
127
+ if (nt.equals("name")) {
128
+ try {
129
+ field = schema.getField(name);
130
+ } catch (Exception e) {
131
+ out.print("<strong>Unknown Field: ");
132
+ XML.escapeCharData(name, out);
133
+ out.println("</strong>");
134
+ }
135
+ } else {
136
+ FieldType t = schema.getFieldTypes().get(name);
137
+ if (null == t) {
138
+ out.print("<strong>Unknown Field Type: ");
139
+ XML.escapeCharData(name, out);
140
+ out.println("</strong>");
141
+ } else {
142
+ field = new SchemaField("fakefieldoftype:"+name, t);
143
+ }
144
+ }
145
+ }
146
+
147
+ if (field!=null) {
148
+ HashSet<Tok> matches = null;
149
+ if (qval!="" && highlight) {
150
+ Reader reader = new StringReader(qval);
151
+ Analyzer analyzer = field.getType().getQueryAnalyzer();
152
+ TokenStream tstream = analyzer.reusableTokenStream(field.getName(),reader);
153
+ tstream.reset();
154
+ List<Token> tokens = getTokens(tstream);
155
+ matches = new HashSet<Tok>();
156
+ for (Token t : tokens) { matches.add( new Tok(t,0)); }
157
+ }
158
+
159
+ if (val!="") {
160
+ out.println("<h3>Index Analyzer</h3>");
161
+ doAnalyzer(out, field, val, false, verbose,matches);
162
+ }
163
+ if (qval!="") {
164
+ out.println("<h3>Query Analyzer</h3>");
165
+ doAnalyzer(out, field, qval, true, qverbose,null);
166
+ }
167
+ }
168
+
169
+ %>
170
+
171
+
172
+ </body>
173
+ </html>
174
+
175
+
176
+ <%!
177
+ private static void doAnalyzer(JspWriter out, SchemaField field, String val, boolean queryAnalyser, boolean verbose, Set<Tok> match) throws Exception {
178
+
179
+ FieldType ft = field.getType();
180
+ Analyzer analyzer = queryAnalyser ?
181
+ ft.getQueryAnalyzer() : ft.getAnalyzer();
182
+ if (analyzer instanceof TokenizerChain) {
183
+ TokenizerChain tchain = (TokenizerChain)analyzer;
184
+ CharFilterFactory[] cfiltfacs = tchain.getCharFilterFactories();
185
+ TokenizerFactory tfac = tchain.getTokenizerFactory();
186
+ TokenFilterFactory[] filtfacs = tchain.getTokenFilterFactories();
187
+
188
+ if( cfiltfacs != null ){
189
+ String source = val;
190
+ for(CharFilterFactory cfiltfac : cfiltfacs ){
191
+ CharStream reader = CharReader.get(new StringReader(source));
192
+ reader = cfiltfac.create(reader);
193
+ if(verbose){
194
+ writeHeader(out, cfiltfac.getClass(), cfiltfac.getArgs());
195
+ source = writeCharStream(out, reader);
196
+ }
197
+ }
198
+ }
199
+
200
+ TokenStream tstream = tfac.create(tchain.charStream(new StringReader(val)));
201
+ List<Token> tokens = getTokens(tstream);
202
+ if (verbose) {
203
+ writeHeader(out, tfac.getClass(), tfac.getArgs());
204
+ }
205
+
206
+ writeTokens(out, tokens, ft, verbose, match);
207
+
208
+ for (TokenFilterFactory filtfac : filtfacs) {
209
+ if (verbose) {
210
+ writeHeader(out, filtfac.getClass(), filtfac.getArgs());
211
+ }
212
+
213
+ final Iterator<Token> iter = tokens.iterator();
214
+ tstream = filtfac.create( new TokenStream() {
215
+ public Token next() throws IOException {
216
+ return iter.hasNext() ? iter.next() : null;
217
+ }
218
+ }
219
+ );
220
+ tokens = getTokens(tstream);
221
+
222
+ writeTokens(out, tokens, ft, verbose, match);
223
+ }
224
+
225
+ } else {
226
+ TokenStream tstream = analyzer.reusableTokenStream(field.getName(),new StringReader(val));
227
+ tstream.reset();
228
+ List<Token> tokens = getTokens(tstream);
229
+ if (verbose) {
230
+ writeHeader(out, analyzer.getClass(), new HashMap<String,String>());
231
+ }
232
+ writeTokens(out, tokens, ft, verbose, match);
233
+ }
234
+ }
235
+
236
+
237
+ static List<Token> getTokens(TokenStream tstream) throws IOException {
238
+ List<Token> tokens = new ArrayList<Token>();
239
+ while (true) {
240
+ Token t = tstream.next();
241
+ if (t==null) break;
242
+ tokens.add(t);
243
+ }
244
+ return tokens;
245
+ }
246
+
247
+
248
+ private static class Tok {
249
+ Token token;
250
+ int pos;
251
+ Tok(Token token, int pos) {
252
+ this.token=token;
253
+ this.pos=pos;
254
+ }
255
+
256
+ public boolean equals(Object o) {
257
+ return ((Tok)o).token.termText().equals(token.termText());
258
+ }
259
+ public int hashCode() {
260
+ return token.termText().hashCode();
261
+ }
262
+ public String toString() {
263
+ return token.termText();
264
+ }
265
+ }
266
+
267
+ private static interface ToStr {
268
+ public String toStr(Object o);
269
+ }
270
+
271
+ private static void printRow(JspWriter out, String header, List[] arrLst, ToStr converter, boolean multival, boolean verbose, Set<Tok> match) throws IOException {
272
+ // find the maximum number of terms for any position
273
+ int maxSz=1;
274
+ if (multival) {
275
+ for (List lst : arrLst) {
276
+ maxSz = Math.max(lst.size(), maxSz);
277
+ }
278
+ }
279
+
280
+
281
+ for (int idx=0; idx<maxSz; idx++) {
282
+ out.println("<tr>");
283
+ if (idx==0 && verbose) {
284
+ if (header != null) {
285
+ out.print("<th NOWRAP rowspan=\""+maxSz+"\">");
286
+ XML.escapeCharData(header,out);
287
+ out.println("</th>");
288
+ }
289
+ }
290
+
291
+ for (int posIndex=0; posIndex<arrLst.length; posIndex++) {
292
+ List<Tok> lst = arrLst[posIndex];
293
+ if (lst.size() <= idx) continue;
294
+ if (match!=null && match.contains(lst.get(idx))) {
295
+ out.print("<td class=\"highlight\"");
296
+ } else {
297
+ out.print("<td class=\"debugdata\"");
298
+ }
299
+
300
+ // if the last value in the column, use up
301
+ // the rest of the space via rowspan.
302
+ if (lst.size() == idx+1 && lst.size() < maxSz) {
303
+ out.print("rowspan=\""+(maxSz-lst.size()+1)+'"');
304
+ }
305
+
306
+ out.print('>');
307
+
308
+ XML.escapeCharData(converter.toStr(lst.get(idx)), out);
309
+ out.print("</td>");
310
+ }
311
+
312
+ out.println("</tr>");
313
+ }
314
+
315
+ }
316
+
317
+ static String isPayloadString( Payload p ) {
318
+ String sp = new String( p.getData() );
319
+ for( int i=0; i < sp.length(); i++ ) {
320
+ if( !Character.isDefined( sp.charAt(i) ) || Character.isISOControl( sp.charAt(i) ) )
321
+ return "";
322
+ }
323
+ return "(" + sp + ")";
324
+ }
325
+
326
+ static void writeHeader(JspWriter out, Class clazz, Map<String,String> args) throws IOException {
327
+ out.print("<h4>");
328
+ out.print(clazz.getName());
329
+ XML.escapeCharData(" "+args,out);
330
+ out.println("</h4>");
331
+ }
332
+
333
+
334
+
335
+ // readable, raw, pos, type, start/end
336
+ static void writeTokens(JspWriter out, List<Token> tokens, final FieldType ft, boolean verbose, Set<Tok> match) throws IOException {
337
+
338
+ // Use a map to tell what tokens are in what positions
339
+ // because some tokenizers/filters may do funky stuff with
340
+ // very large increments, or negative increments.
341
+ HashMap<Integer,List<Tok>> map = new HashMap<Integer,List<Tok>>();
342
+ boolean needRaw=false;
343
+ int pos=0;
344
+ for (Token t : tokens) {
345
+ if (!t.termText().equals(ft.indexedToReadable(t.termText()))) {
346
+ needRaw=true;
347
+ }
348
+
349
+ pos += t.getPositionIncrement();
350
+ List lst = map.get(pos);
351
+ if (lst==null) {
352
+ lst = new ArrayList(1);
353
+ map.put(pos,lst);
354
+ }
355
+ Tok tok = new Tok(t,pos);
356
+ lst.add(tok);
357
+ }
358
+
359
+ List<Tok>[] arr = (List<Tok>[])map.values().toArray(new ArrayList[map.size()]);
360
+
361
+ /* Jetty 6.1.3 miscompiles this generics version...
362
+ Arrays.sort(arr, new Comparator<List<Tok>>() {
363
+ public int compare(List<Tok> toks, List<Tok> toks1) {
364
+ return toks.get(0).pos - toks1.get(0).pos;
365
+ }
366
+ }
367
+ */
368
+
369
+ Arrays.sort(arr, new Comparator() {
370
+ public int compare(Object toks, Object toks1) {
371
+ return ((List<Tok>)toks).get(0).pos - ((List<Tok>)toks1).get(0).pos;
372
+ }
373
+ }
374
+
375
+
376
+ );
377
+
378
+ out.println("<table width=\"auto\" class=\"analysis\" border=\"1\">");
379
+
380
+ if (verbose) {
381
+ printRow(out,"term position", arr, new ToStr() {
382
+ public String toStr(Object o) {
383
+ return Integer.toString(((Tok)o).pos);
384
+ }
385
+ }
386
+ ,false
387
+ ,verbose
388
+ ,null);
389
+ }
390
+
391
+
392
+ printRow(out,"term text", arr, new ToStr() {
393
+ public String toStr(Object o) {
394
+ return ft.indexedToReadable( ((Tok)o).token.termText() );
395
+ }
396
+ }
397
+ ,true
398
+ ,verbose
399
+ ,match
400
+ );
401
+
402
+ if (needRaw) {
403
+ printRow(out,"raw text", arr, new ToStr() {
404
+ public String toStr(Object o) {
405
+ // page is UTF-8, so anything goes.
406
+ return ((Tok)o).token.termText();
407
+ }
408
+ }
409
+ ,true
410
+ ,verbose
411
+ ,match
412
+ );
413
+ }
414
+
415
+ if (verbose) {
416
+ printRow(out,"term type", arr, new ToStr() {
417
+ public String toStr(Object o) {
418
+ String tt = ((Tok)o).token.type();
419
+ if (tt == null) {
420
+ return "null";
421
+ } else {
422
+ return tt;
423
+ }
424
+ }
425
+ }
426
+ ,true
427
+ ,verbose,
428
+ null
429
+ );
430
+ }
431
+
432
+ if (verbose) {
433
+ printRow(out,"source start,end", arr, new ToStr() {
434
+ public String toStr(Object o) {
435
+ Token t = ((Tok)o).token;
436
+ return Integer.toString(t.startOffset()) + ',' + t.endOffset() ;
437
+ }
438
+ }
439
+ ,true
440
+ ,verbose
441
+ ,null
442
+ );
443
+ }
444
+
445
+ if (verbose) {
446
+ printRow(out,"payload", arr, new ToStr() {
447
+ public String toStr(Object o) {
448
+ Token t = ((Tok)o).token;
449
+ Payload p = t.getPayload();
450
+ if( null != p ) {
451
+ BigInteger bi = new BigInteger( p.getData() );
452
+ String ret = bi.toString( 16 );
453
+ if (ret.length() % 2 != 0) {
454
+ // Pad with 0
455
+ ret = "0"+ret;
456
+ }
457
+ ret += isPayloadString( p );
458
+ return ret;
459
+ }
460
+ return "";
461
+ }
462
+ }
463
+ ,true
464
+ ,verbose
465
+ ,null
466
+ );
467
+ }
468
+
469
+ out.println("</table>");
470
+ }
471
+
472
+ static String writeCharStream(JspWriter out, CharStream input) throws IOException {
473
+ out.println("<table width=\"auto\" class=\"analysis\" border=\"1\">");
474
+ out.println("<tr>");
475
+
476
+ out.print("<th NOWRAP>");
477
+ XML.escapeCharData("text",out);
478
+ out.println("</th>");
479
+
480
+ final int BUFFER_SIZE = 1024;
481
+ char[] buf = new char[BUFFER_SIZE];
482
+ int len = 0;
483
+ StringBuilder sb = new StringBuilder();
484
+ do {
485
+ len = input.read( buf, 0, BUFFER_SIZE );
486
+ if( len > 0 )
487
+ sb.append(buf, 0, len);
488
+ } while( len == BUFFER_SIZE );
489
+ out.print("<td class=\"debugdata\">");
490
+ XML.escapeCharData(sb.toString(),out);
491
+ out.println("</td>");
492
+
493
+ out.println("</tr>");
494
+ out.println("</table>");
495
+ return sb.toString();
496
+ }
497
+
498
+ %>