mirror of https://github.com/apache/lucene.git
Remove IndexInfoRequestHandler in favor of the Luke request handlers capabilities
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@536729 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d7568ddbc6
commit
c7823d8601
|
@ -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 -->
|
||||
|
|
|
@ -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 $";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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']"
|
||||
);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue