Skip to content

Apache Lucene open-source search software

Remove IndexInfoRequestHandler in favor of the Luke request handlers capabilities

Erik Hatcherc7823d8601a8
diff --git a/example/solr/conf/solrconfig.xml b/example/solr/conf/solrconfig.xml
index 7fb18408a4d..2cf4c181b60 100755
--- a/example/solr/conf/solrconfig.xml
+++ b/example/solr/conf/solrconfig.xml
@@ -260,8 +260,6 @@
</lst>
</requestHandler>
- <requestHandler name="indexinfo" class="solr.IndexInfoRequestHandler"/>
-
<!-- DisMaxRequestHandler allows easy searching across multiple fields
for simple user-entered phrases.
see http://wiki.apache.org/solr/DisMaxRequestHandler
@@ -374,8 +372,8 @@
<!-- Main init params for handler -->
<!-- The directory where your SpellChecker Index should live. -->
- <!-- May by absolute, or relative to the Solr "dataDir" directory. -->
- <!-- If this option is not specified, a ram directory will be used -->
+ <!-- May be absolute, or relative to the Solr "dataDir" directory. -->
+ <!-- If this option is not specified, a RAM directory will be used -->
<str name="spellcheckerIndexDir">spell</str>
<!-- the field in your schema that you want to be able to build -->
diff --git a/src/java/org/apache/solr/handler/IndexInfoRequestHandler.java b/src/java/org/apache/solr/handler/IndexInfoRequestHandler.java
deleted file mode 100644
index cb4a57c27b0..00000000000
--- a/src/java/org/apache/solr/handler/IndexInfoRequestHandler.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.solr.handler;
-
-import org.apache.lucene.index.IndexReader;
-import org.apache.solr.core.SolrCore;
-import org.apache.solr.core.SolrException;
-import org.apache.solr.handler.RequestHandlerBase;
-import org.apache.solr.schema.IndexSchema;
-import org.apache.solr.schema.FieldType;
-import org.apache.solr.schema.SchemaField;
-import org.apache.solr.search.SolrIndexSearcher;
-import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.request.SolrQueryResponse;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * TODO? delete me? This is now a subset of LukeRequestHandler.
- * Since it was not released in 1.1 should it be deleted before 1.2?
- */
-@Deprecated
-public class IndexInfoRequestHandler extends RequestHandlerBase {
-
- public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) {
-
- try {
- SolrIndexSearcher searcher = req.getSearcher();
- IndexReader reader = searcher.getReader();
- Collection<String> fieldNames = reader.getFieldNames(IndexReader.FieldOption.ALL);
- Map<String,Object> fields = new HashMap<String,Object>();
- IndexSchema schema = req.getSchema();
- for (String fieldName : fieldNames) {
- Map<String,String> fieldInfo = new HashMap<String,String>();
-
- FieldType fieldType = schema.getFieldTypeNoEx(fieldName);
- if( fieldType != null ) {
- fieldInfo.put("type", fieldType.getTypeName());
- }
- else {
- // This can happen if you change the schema
- fieldInfo.put("type", null ); // "[unknown]"? nothing?
- }
-
- fields.put(fieldName, fieldInfo);
- }
- rsp.add("fields", fields);
-
- Map<String,Object> indexInfo = new HashMap<String,Object>();
- indexInfo.put("numDocs", reader.numDocs());
- indexInfo.put("maxDoc", reader.maxDoc());
- indexInfo.put("version", Long.toString(reader.getVersion()));
- // indexInfo.put("age", ); // computed from SolrIndexSearcher.openedAt?
-
- rsp.add("index", indexInfo);
-
- } catch (SolrException e) {
- rsp.setException(e);
- return;
- } catch (Exception e) {
- SolrException.log(SolrCore.log, e);
- rsp.setException(e);
- return;
- }
- }
-
- //////////////////////// SolrInfoMBeans methods //////////////////////
-
- @Override
- public String getDescription() {
- return "The structure Solr request handler";
- }
-
- @Override
- public String getVersion() {
- return "$Revision: 501512 $";
- }
-
- @Override
- public String getSourceId() {
- return "$Id: IndexInfoRequestHandler.java 487199 2006-12-14 13:03:40Z bdelacretaz $";
- }
-
- @Override
- public String getSource() {
- return "$URL: https://svn.apache.org/repos/asf/lucene/solr/trunk/src/java/org/apache/solr/request/IndexInfoRequestHandler.java $";
- }
-}
-
-
diff --git a/src/test/org/apache/solr/IndexInfoRequestHandlerTest.java b/src/test/org/apache/solr/IndexInfoRequestHandlerTest.java
deleted file mode 100644
index cc59c1b9fce..00000000000
--- a/src/test/org/apache/solr/IndexInfoRequestHandlerTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.solr;
-
-import org.apache.solr.util.*;
-
-public class IndexInfoRequestHandlerTest extends AbstractSolrTestCase {
-
- public String getSchemaFile() { return "schema.xml"; }
- public String getSolrConfigFile() { return "solrconfig.xml"; }
- public void setUp() throws Exception {
- super.setUp();
- lrf = h.getRequestFactory("indexinfo", 0, 0);
- }
-
- public void testIndexInfo() throws Exception {
-
- assertU(adoc("id", "529",
- "field_t", "what's inside?",
- "subject", "info"
- ));
- assertU(commit());
-
- assertQ("index info",
- req("foo")
- ,"//lst[@name='fields']/lst[@name='field_t']"
- ,"//lst[@name='index']/int[@name='numDocs'][.='1']"
- );
- }
-
-}