You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by da...@apache.org on 2018/10/23 00:05:42 UTC

[21/52] [abbrv] [partial] lucene-solr:jira/gradle: Add gradle support for Solr

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/handler/ClassifyStream.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/ClassifyStream.java b/solr/core/src/java/org/apache/solr/handler/ClassifyStream.java
deleted file mode 100644
index c79c409..0000000
--- a/solr/core/src/java/org/apache/solr/handler/ClassifyStream.java
+++ /dev/null
@@ -1,229 +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 java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.Locale;
-
-import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
-import org.apache.solr.client.solrj.io.Tuple;
-import org.apache.solr.client.solrj.io.comp.StreamComparator;
-import org.apache.solr.client.solrj.io.stream.StreamContext;
-import org.apache.solr.client.solrj.io.stream.TupleStream;
-import org.apache.solr.client.solrj.io.stream.expr.Explanation;
-import org.apache.solr.client.solrj.io.stream.expr.Expressible;
-import org.apache.solr.client.solrj.io.stream.expr.StreamExplanation;
-import org.apache.solr.client.solrj.io.stream.expr.StreamExpression;
-import org.apache.solr.client.solrj.io.stream.expr.StreamExpressionNamedParameter;
-import org.apache.solr.client.solrj.io.stream.expr.StreamExpressionParameter;
-import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.core.SolrCore;
-import org.apache.lucene.analysis.*;
-
-/**
- *  The classify expression retrieves a model trained by the train expression and uses it to classify documents from a stream
- *  Syntax:
- *  classif(model(...), anyStream(...), field="body")
- * @since 6.3.0
- **/
-
-public class ClassifyStream extends TupleStream implements Expressible {
-  private TupleStream docStream;
-  private TupleStream modelStream;
-
-  private String field;
-  private String analyzerField;
-  private Tuple  modelTuple;
-
-  Analyzer analyzer;
-  private Map<CharSequence, Integer> termToIndex;
-  private List<Double> idfs;
-  private List<Double> modelWeights;
-
-  public ClassifyStream(StreamExpression expression, StreamFactory factory) throws IOException {
-    List<StreamExpression> streamExpressions = factory.getExpressionOperandsRepresentingTypes(expression, Expressible.class, TupleStream.class);
-    if (streamExpressions.size() != 2) {
-      throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - expecting two stream but found %d",expression, streamExpressions.size()));
-    }
-
-    modelStream = factory.constructStream(streamExpressions.get(0));
-    docStream = factory.constructStream(streamExpressions.get(1));
-
-    StreamExpressionNamedParameter fieldParameter = factory.getNamedOperand(expression, "field");
-    if (fieldParameter == null) {
-      throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - field parameter must be specified",expression, streamExpressions.size()));
-    }
-    analyzerField = field = fieldParameter.getParameter().toString();
-
-    StreamExpressionNamedParameter analyzerFieldParameter = factory.getNamedOperand(expression, "analyzerField");
-    if (analyzerFieldParameter != null) {
-      analyzerField = analyzerFieldParameter.getParameter().toString();
-    }
-  }
-
-  @Override
-  public void setStreamContext(StreamContext context) {
-    Object solrCoreObj = context.get("solr-core");
-    if (solrCoreObj == null || !(solrCoreObj instanceof SolrCore) ) {
-      throw new SolrException(SolrException.ErrorCode.INVALID_STATE, "StreamContext must have SolrCore in solr-core key");
-    }
-    analyzer = ((SolrCore) solrCoreObj).getLatestSchema().getFieldType(analyzerField).getIndexAnalyzer();
-
-    this.docStream.setStreamContext(context);
-    this.modelStream.setStreamContext(context);
-  }
-
-  @Override
-  public List<TupleStream> children() {
-    List<TupleStream> l = new ArrayList<>();
-    l.add(docStream);
-    l.add(modelStream);
-    return l;
-  }
-
-  @Override
-  public void open() throws IOException {
-    this.docStream.open();
-    this.modelStream.open();
-  }
-
-  @Override
-  public void close() throws IOException {
-    this.docStream.close();
-    this.modelStream.close();
-  }
-
-  @Override
-  public Tuple read() throws IOException {
-    if (modelTuple == null) {
-
-      modelTuple = modelStream.read();
-      if (modelTuple == null || modelTuple.EOF) {
-        throw new IOException("Model tuple not found for classify stream!");
-      }
-
-      termToIndex = new HashMap<>();
-
-      List<String> terms = modelTuple.getStrings("terms_ss");
-
-      for (int i = 0; i < terms.size(); i++) {
-        termToIndex.put(terms.get(i), i);
-      }
-
-      idfs = modelTuple.getDoubles("idfs_ds");
-      modelWeights = modelTuple.getDoubles("weights_ds");
-    }
-
-    Tuple docTuple = docStream.read();
-    if (docTuple.EOF) return docTuple;
-
-    String text = docTuple.getString(field);
-
-    double tfs[] = new double[termToIndex.size()];
-
-    TokenStream tokenStream = analyzer.tokenStream(analyzerField, text);
-    CharTermAttribute termAtt = tokenStream.getAttribute(CharTermAttribute.class);
-    tokenStream.reset();
-
-    int termCount = 0;
-    while (tokenStream.incrementToken()) {
-      termCount++;
-      if (termToIndex.containsKey(termAtt.toString())) {
-        tfs[termToIndex.get(termAtt.toString())]++;
-      }
-    }
-
-    tokenStream.end();
-    tokenStream.close();
-
-    List<Double> tfidfs = new ArrayList<>(termToIndex.size());
-    tfidfs.add(1.0);
-    for (int i = 0; i < tfs.length; i++) {
-      if (tfs[i] != 0) {
-        tfs[i] = 1 + Math.log(tfs[i]);
-      }
-      tfidfs.add(this.idfs.get(i) * tfs[i]);
-    }
-
-    double total = 0.0;
-    for (int i = 0; i < tfidfs.size(); i++) {
-      total += tfidfs.get(i) * modelWeights.get(i);
-    }
-
-    double score = total * ((float) (1.0 / Math.sqrt(termCount)));
-    double positiveProb = sigmoid(total);
-
-    docTuple.put("probability_d", positiveProb);
-    docTuple.put("score_d",  score);
-
-    return docTuple;
-  }
-
-  private double sigmoid(double in) {
-    double d = 1.0 / (1+Math.exp(-in));
-    return d;
-  }
-
-  @Override
-  public StreamComparator getStreamSort() {
-    return null;
-  }
-
-  @Override
-  public StreamExpressionParameter toExpression(StreamFactory factory) throws IOException {
-    return toExpression(factory, true);
-  }
-
-  private StreamExpression toExpression(StreamFactory factory, boolean includeStreams) throws IOException {
-    // function name
-    StreamExpression expression = new StreamExpression(factory.getFunctionName(this.getClass()));
-
-    if (includeStreams) {
-      if (docStream instanceof Expressible && modelStream instanceof Expressible) {
-        expression.addParameter(((Expressible)modelStream).toExpression(factory));
-        expression.addParameter(((Expressible)docStream).toExpression(factory));
-      } else {
-        throw new IOException("This ClassifyStream contains a non-expressible TupleStream - it cannot be converted to an expression");
-      }
-    }
-
-    expression.addParameter(new StreamExpressionNamedParameter("field", field));
-    expression.addParameter(new StreamExpressionNamedParameter("analyzerField", analyzerField));
-
-    return expression;
-  }
-
-  @Override
-  public Explanation toExplanation(StreamFactory factory) throws IOException {
-    StreamExplanation explanation = new StreamExplanation(getStreamNodeId().toString());
-
-    explanation.setFunctionName(factory.getFunctionName(this.getClass()));
-    explanation.setImplementingClass(this.getClass().getName());
-    explanation.setExpressionType(Explanation.ExpressionType.STREAM_DECORATOR);
-    explanation.setExpression(toExpression(factory, false).toString());
-
-    explanation.addChild(docStream.toExplanation(factory));
-    explanation.addChild(modelStream.toExplanation(factory));
-
-    return explanation;
-  }
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java b/solr/core/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java
deleted file mode 100644
index 1859f04..0000000
--- a/solr/core/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java
+++ /dev/null
@@ -1,86 +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.solr.common.SolrException;
-import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.common.util.ContentStream;
-import org.apache.solr.common.util.NamedList;
-import org.apache.solr.handler.loader.ContentStreamLoader;
-import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.response.SolrQueryResponse;
-import org.apache.solr.update.processor.UpdateRequestProcessor;
-import org.apache.solr.update.processor.UpdateRequestProcessorChain;
-
-/**
- * Shares common code between various handlers that manipulate 
- * {@link org.apache.solr.common.util.ContentStream} objects.
- */
-public abstract class ContentStreamHandlerBase extends RequestHandlerBase {
-
-  @Override
-  public void init(NamedList args) {
-    super.init(args);
-
-    // Caching off by default
-    httpCaching = false;
-    if (args != null) {
-      Object caching = args.get("httpCaching");
-      if(caching!=null) {
-        httpCaching = Boolean.parseBoolean(caching.toString());
-      }
-    }
-  }
-  
-  @Override
-  public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
-    SolrParams params = req.getParams();
-    UpdateRequestProcessorChain processorChain =
-        req.getCore().getUpdateProcessorChain(params);
-
-    UpdateRequestProcessor processor = processorChain.createProcessor(req, rsp);
-
-    try {
-      ContentStreamLoader documentLoader = newLoader(req, processor);
-
-
-      Iterable<ContentStream> streams = req.getContentStreams();
-      if (streams == null) {
-        if (!RequestHandlerUtils.handleCommit(req, processor, params, false) && !RequestHandlerUtils.handleRollback(req, processor, params, false)) {
-          throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "missing content stream");
-        }
-      } else {
-
-        for (ContentStream stream : streams) {
-          documentLoader.load(req, rsp, stream, processor);
-        }
-
-        // Perhaps commit from the parameters
-        RequestHandlerUtils.handleCommit(req, processor, params, false);
-        RequestHandlerUtils.handleRollback(req, processor, params, false);
-      }
-    } finally {
-      // finish the request
-      try {
-        processor.finish();
-      } finally {
-        processor.close();
-      }
-    }
-  }
-
-  protected abstract ContentStreamLoader newLoader(SolrQueryRequest req, UpdateRequestProcessor processor);
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/handler/ContentStreamLoader.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/ContentStreamLoader.java b/solr/core/src/java/org/apache/solr/handler/ContentStreamLoader.java
deleted file mode 100644
index 8632eae..0000000
--- a/solr/core/src/java/org/apache/solr/handler/ContentStreamLoader.java
+++ /dev/null
@@ -1,49 +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.solr.common.util.ContentStream;
-import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.response.SolrQueryResponse;
-
-
-/**
- * Load a {@link org.apache.solr.common.util.ContentStream} into Solr
- *
- **/
-public abstract class ContentStreamLoader {
-
-  protected String errHeader;
-
-  public String getErrHeader() {
-    return errHeader;
-  }
-
-  public void setErrHeader(String errHeader) {
-    this.errHeader = errHeader;
-  }
-
-  /**
-   * Loaders are responsible for closing the stream
-   *
-   * @param req The input {@link org.apache.solr.request.SolrQueryRequest}
-   * @param rsp The response, in case the Loader wishes to add anything
-   * @param stream The {@link org.apache.solr.common.util.ContentStream} to add
-   */
-  public abstract void load(SolrQueryRequest req, SolrQueryResponse rsp, ContentStream stream) throws Exception;
-
-
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java
deleted file mode 100644
index 7f67981..0000000
--- a/solr/core/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java
+++ /dev/null
@@ -1,346 +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 javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.invoke.MethodHandles;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.util.BytesRef;
-import org.apache.solr.client.solrj.request.DocumentAnalysisRequest;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.common.SolrInputDocument;
-import org.apache.solr.common.params.AnalysisParams;
-import org.apache.solr.common.params.CommonParams;
-import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.common.util.ContentStream;
-import org.apache.solr.common.util.ContentStreamBase;
-import org.apache.solr.common.util.NamedList;
-import org.apache.solr.common.util.SimpleOrderedMap;
-import org.apache.solr.common.util.XMLErrorLogger;
-import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.schema.FieldType;
-import org.apache.solr.schema.IndexSchema;
-import org.apache.solr.schema.SchemaField;
-import org.apache.solr.common.EmptyEntityResolver;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.apache.solr.common.params.CommonParams.NAME;
-
-/**
- * An analysis handler that provides a breakdown of the analysis process of provided documents. This handler expects a
- * (single) content stream of the following format:
- * <br>
- * <pre><code>
- *  &lt;docs&gt;
- *      &lt;doc&gt;
- *          &lt;field name="id"&gt;1&lt;/field&gt;
- *          &lt;field name="name"&gt;The Name&lt;/field&gt;
- *          &lt;field name="text"&gt;The Text Value&lt;/field&gt;
- *      &lt;doc&gt;
- *      &lt;doc&gt;...&lt;/doc&gt;
- *      &lt;doc&gt;...&lt;/doc&gt;
- *      ...
- *  &lt;/docs&gt;
- * </code></pre>
- * <br>
- * <em><b>Note: Each document must contain a field which serves as the unique key. This key is used in the returned
- * response to associate an analysis breakdown to the analyzed document.</b></em>
- * <p>
- * Like the {@link org.apache.solr.handler.FieldAnalysisRequestHandler}, this handler also supports query analysis by
- * sending either an "analysis.query" or "q" request parameter that holds the query text to be analyzed. It also
- * supports the "analysis.showmatch" parameter which when set to {@code true}, all field tokens that match the query
- * tokens will be marked as a "match".
- *
- *
- * @since solr 1.4
- */
-public class DocumentAnalysisRequestHandler extends AnalysisRequestHandlerBase {
-
-  private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-  private static final XMLErrorLogger xmllog = new XMLErrorLogger(log);
-
-  private XMLInputFactory inputFactory;
-
-  @Override
-  public void init(NamedList args) {
-    super.init(args);
-
-    inputFactory = XMLInputFactory.newInstance();
-    EmptyEntityResolver.configureXMLInputFactory(inputFactory);
-    inputFactory.setXMLReporter(xmllog);
-    try {
-      // The java 1.6 bundled stax parser (sjsxp) does not currently have a thread-safe
-      // XMLInputFactory, as that implementation tries to cache and reuse the
-      // XMLStreamReader.  Setting the parser-specific "reuse-instance" property to false
-      // prevents this.
-      // All other known open-source stax parsers (and the bea ref impl)
-      // have thread-safe factories.
-      inputFactory.setProperty("reuse-instance", Boolean.FALSE);
-    } catch (IllegalArgumentException ex) {
-      // Other implementations will likely throw this exception since "reuse-instance"
-      // is implementation specific.
-      log.debug("Unable to set the 'reuse-instance' property for the input factory: " + inputFactory);
-    }
-  }
-
-  @Override
-  protected NamedList doAnalysis(SolrQueryRequest req) throws Exception {
-    DocumentAnalysisRequest analysisRequest = resolveAnalysisRequest(req);
-    return handleAnalysisRequest(analysisRequest, req.getSchema());
-  }
-
-  @Override
-  public String getDescription() {
-    return "Provides a breakdown of the analysis process of provided documents";
-  }
-
-
-  //================================================ Helper Methods ==================================================
-
-  /**
-   * Resolves the {@link DocumentAnalysisRequest} from the given solr request.
-   *
-   * @param req The solr request.
-   *
-   * @return The resolved document analysis request.
-   *
-   * @throws IOException        Thrown when reading/parsing the content stream of the request fails.
-   * @throws XMLStreamException Thrown when reading/parsing the content stream of the request fails.
-   */
-  DocumentAnalysisRequest resolveAnalysisRequest(SolrQueryRequest req) throws IOException, XMLStreamException {
-
-    DocumentAnalysisRequest request = new DocumentAnalysisRequest();
-
-    SolrParams params = req.getParams();
-
-    String query = params.get(AnalysisParams.QUERY, params.get(CommonParams.Q, null));
-    request.setQuery(query);
-
-    boolean showMatch = params.getBool(AnalysisParams.SHOW_MATCH, false);
-    request.setShowMatch(showMatch);
-
-    ContentStream stream = extractSingleContentStream(req);
-    InputStream is = null;
-    XMLStreamReader parser = null;
-    
-    try {
-      is = stream.getStream();
-      final String charset = ContentStreamBase.getCharsetFromContentType(stream.getContentType());
-      parser = (charset == null) ?
-        inputFactory.createXMLStreamReader(is) : inputFactory.createXMLStreamReader(is, charset);
-
-      while (true) {
-        int event = parser.next();
-        switch (event) {
-          case XMLStreamConstants.END_DOCUMENT: {
-            parser.close();
-            return request;
-          }
-          case XMLStreamConstants.START_ELEMENT: {
-            String currTag = parser.getLocalName();
-            if ("doc".equals(currTag)) {
-              log.trace("Reading doc...");
-              SolrInputDocument document = readDocument(parser, req.getSchema());
-              request.addDocument(document);
-            }
-            break;
-          }
-        }
-      }
-
-    } finally {
-      if (parser != null) parser.close();
-      IOUtils.closeQuietly(is);
-    }
-  }
-
-  /**
-   * Handles the resolved {@link DocumentAnalysisRequest} and returns the analysis response as a named list.
-   *
-   * @param request The {@link DocumentAnalysisRequest} to be handled.
-   * @param schema  The index schema.
-   *
-   * @return The analysis response as a named list.
-   */
-  NamedList<Object> handleAnalysisRequest(DocumentAnalysisRequest request, IndexSchema schema) {
-
-    SchemaField uniqueKeyField = schema.getUniqueKeyField();
-    NamedList<Object> result = new SimpleOrderedMap<>();
-
-    for (SolrInputDocument document : request.getDocuments()) {
-
-      NamedList<NamedList> theTokens = new SimpleOrderedMap<>();
-      result.add(document.getFieldValue(uniqueKeyField.getName()).toString(), theTokens);
-      for (String name : document.getFieldNames()) {
-
-        // there's no point of providing analysis to unindexed fields.
-        SchemaField field = schema.getField(name);
-        if (!field.indexed()) {
-          continue;
-        }
-
-        NamedList<Object> fieldTokens = new SimpleOrderedMap<>();
-        theTokens.add(name, fieldTokens);
-
-        FieldType fieldType = schema.getFieldType(name);
-
-        final String queryValue = request.getQuery();
-        Set<BytesRef> termsToMatch;
-        try {
-          termsToMatch = (queryValue != null && request.isShowMatch())
-            ? getQueryTokenSet(queryValue, fieldType.getQueryAnalyzer())
-            : EMPTY_BYTES_SET;
-        } catch (Exception e) {
-          // ignore analysis exceptions since we are applying arbitrary text to all fields
-          termsToMatch = EMPTY_BYTES_SET;
-        }
-
-        if (request.getQuery() != null) {
-          try {
-            AnalysisContext analysisContext = new AnalysisContext(fieldType, fieldType.getQueryAnalyzer(), EMPTY_BYTES_SET);
-            fieldTokens.add("query", analyzeValue(request.getQuery(), analysisContext));
-          } catch (Exception e) {
-            // ignore analysis exceptions since we are applying arbitrary text to all fields
-          }
-        }
-
-        Analyzer analyzer = fieldType.getIndexAnalyzer();
-        AnalysisContext analysisContext = new AnalysisContext(fieldType, analyzer, termsToMatch);
-        Collection<Object> fieldValues = document.getFieldValues(name);
-        NamedList<NamedList<? extends Object>> indexTokens 
-          = new SimpleOrderedMap<>();
-        for (Object fieldValue : fieldValues) {
-          indexTokens.add(String.valueOf(fieldValue), 
-                          analyzeValue(fieldValue.toString(), analysisContext));
-        }
-        fieldTokens.add("index", indexTokens);
-      }
-    }
-
-    return result;
-  }
-
-  /**
-   * Reads the document from the given xml stream reader. The following document format is expected:
-   * <p/>
-   * <pre><code>
-   * &lt;doc&gt;
-   *    &lt;field name="id"&gt;1&lt;/field&gt;
-   *    &lt;field name="name"&gt;The Name&lt;/field&gt;
-   *    &lt;field name="text"&gt;The Text Value&lt;/field&gt;
-   * &lt;/doc&gt;
-   * </code></pre>
-   * <p/>
-   * <p/>
-   * <em>NOTE: each read document is expected to have at least one field which serves as the unique key.</em>
-   *
-   * @param reader The {@link XMLStreamReader} from which the document will be read.
-   * @param schema The index schema. The schema is used to validate that the read document has a unique key field.
-   *
-   * @return The read document.
-   *
-   * @throws XMLStreamException When reading of the document fails.
-   */
-  SolrInputDocument readDocument(XMLStreamReader reader, IndexSchema schema) throws XMLStreamException {
-    SolrInputDocument doc = new SolrInputDocument();
-
-    String uniqueKeyField = schema.getUniqueKeyField().getName();
-
-    StringBuilder text = new StringBuilder();
-    String fieldName = null;
-    boolean hasId = false;
-
-    while (true) {
-      int event = reader.next();
-      switch (event) {
-        // Add everything to the text
-        case XMLStreamConstants.SPACE:
-        case XMLStreamConstants.CDATA:
-        case XMLStreamConstants.CHARACTERS:
-          text.append(reader.getText());
-          break;
-
-        case XMLStreamConstants.END_ELEMENT:
-          if ("doc".equals(reader.getLocalName())) {
-            if (!hasId) {
-              throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
-                      "All documents must contain a unique key value: '" + doc.toString() + "'");
-            }
-            return doc;
-          } else if ("field".equals(reader.getLocalName())) {
-            doc.addField(fieldName, text.toString());
-            if (uniqueKeyField.equals(fieldName)) {
-              hasId = true;
-            }
-          }
-          break;
-
-        case XMLStreamConstants.START_ELEMENT:
-          text.setLength(0);
-          String localName = reader.getLocalName();
-          if (!"field".equals(localName)) {
-            log.warn("unexpected XML tag doc/" + localName);
-            throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "unexpected XML tag doc/" + localName);
-          }
-
-          for (int i = 0; i < reader.getAttributeCount(); i++) {
-            String attrName = reader.getAttributeLocalName(i);
-            if (NAME.equals(attrName)) {
-              fieldName = reader.getAttributeValue(i);
-            }
-          }
-          break;
-      }
-    }
-  }
-
-  /**
-   * Extracts the only content stream from the request. {@link org.apache.solr.common.SolrException.ErrorCode#BAD_REQUEST}
-   * error is thrown if the request doesn't hold any content stream or holds more than one.
-   *
-   * @param req The solr request.
-   *
-   * @return The single content stream which holds the documents to be analyzed.
-   */
-  private ContentStream extractSingleContentStream(SolrQueryRequest req) {
-    Iterable<ContentStream> streams = req.getContentStreams();
-    String exceptionMsg = "DocumentAnalysisRequestHandler expects a single content stream with documents to analyze";
-    if (streams == null) {
-      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, exceptionMsg);
-    }
-    Iterator<ContentStream> iter = streams.iterator();
-    if (!iter.hasNext()) {
-      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, exceptionMsg);
-    }
-    ContentStream stream = iter.next();
-    if (iter.hasNext()) {
-      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, exceptionMsg);
-    }
-    return stream;
-  }
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/handler/DumpRequestHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/DumpRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/DumpRequestHandler.java
deleted file mode 100644
index d7d5b71..0000000
--- a/solr/core/src/java/org/apache/solr/handler/DumpRequestHandler.java
+++ /dev/null
@@ -1,126 +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 java.io.IOException;
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.solr.common.util.ContentStream;
-import org.apache.solr.common.util.NamedList;
-import org.apache.solr.common.util.SimpleOrderedMap;
-import org.apache.solr.core.PluginInfo;
-import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.request.SolrRequestHandler;
-import org.apache.solr.response.SolrQueryResponse;
-
-import static org.apache.solr.common.params.CommonParams.NAME;
-
-public class DumpRequestHandler extends RequestHandlerBase
-{
-  @Override
-  public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws IOException 
-  {
-    // Show params
-    rsp.add( "params", req.getParams().toNamedList() );
-    String[] parts = req.getParams().getParams("urlTemplateValues");
-    if (parts != null && parts.length > 0) {
-      Map map = new LinkedHashMap<>();
-      rsp.getValues().add("urlTemplateValues", map);
-      for (String part : parts) {
-        map.put(part, req.getPathTemplateValues().get(part));
-      }
-    }
-
-    String[] returnParams = req.getParams().getParams("param");
-    if(returnParams !=null) {
-      NamedList params = (NamedList) rsp.getValues().get("params");
-      for (String returnParam : returnParams) {
-        String[] vals = req.getParams().getParams(returnParam);
-        if(vals != null){
-          if (vals.length == 1) {
-            params.add(returnParam, vals[0]);
-          } else {
-            params.add(returnParam, vals);
-          }
-
-        }
-
-      }
-    }
-
-    if(req.getParams().getBool("getdefaults", false)){
-      NamedList def = (NamedList) initArgs.get(PluginInfo.DEFAULTS);
-      rsp.add("getdefaults", def);
-    }
-
-
-    if(req.getParams().getBool("initArgs", false)) {
-      rsp.add("initArgs", initArgs);
-    }
-        
-    // Write the streams...
-    if( req.getContentStreams() != null ) {
-      ArrayList<NamedList<Object>> streams = new ArrayList<>();
-      // Cycle through each stream
-      for( ContentStream content : req.getContentStreams() ) {
-        NamedList<Object> stream = new SimpleOrderedMap<>();
-        stream.add(NAME, content.getName());
-        stream.add( "sourceInfo", content.getSourceInfo() );
-        stream.add( "size", content.getSize() );
-        stream.add( "contentType", content.getContentType() );
-        Reader reader = content.getReader();
-        try {
-          stream.add( "stream", IOUtils.toString(reader) );
-        } finally {
-          reader.close();
-        }
-        streams.add( stream );
-      }
-      rsp.add( "streams", streams );
-    }
-
-    rsp.add("context", req.getContext());
-  }
-
-  //////////////////////// SolrInfoMBeans methods //////////////////////
-
-  @Override
-  public String getDescription() {
-    return "Dump handler (debug)";
-  }
-
-  @Override
-  public SolrRequestHandler getSubHandler(String subPath) {
-    if(subpaths !=null && subpaths.contains(subPath)) return this;
-    return null;
-  }
-  private List<String> subpaths;
-
-  @Override
-  public void init(NamedList args) {
-    super.init(args);
-    if(args !=null) {
-      NamedList nl = (NamedList) args.get(PluginInfo.DEFAULTS);
-      if(nl!=null) subpaths = nl.getAll("subpath");
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/handler/ExportHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/ExportHandler.java b/solr/core/src/java/org/apache/solr/handler/ExportHandler.java
deleted file mode 100644
index ea9239d..0000000
--- a/solr/core/src/java/org/apache/solr/handler/ExportHandler.java
+++ /dev/null
@@ -1,49 +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 java.util.HashMap;
-import java.util.Map;
-
-import org.apache.solr.common.params.CommonParams;
-import org.apache.solr.common.params.MapSolrParams;
-import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.handler.component.SearchHandler;
-import org.apache.solr.handler.export.ExportWriter;
-import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.response.SolrQueryResponse;
-
-import static org.apache.solr.common.params.CommonParams.JSON;
-
-public class ExportHandler extends SearchHandler {
-  @Override
-  public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
-    try {
-      super.handleRequestBody(req, rsp);
-    } catch (Exception e) {
-      rsp.setException(e);
-    }
-    String wt = req.getParams().get(CommonParams.WT, JSON);
-    if("xsort".equals(wt)) wt = JSON;
-    Map<String, String> map = new HashMap<>(1);
-    map.put(CommonParams.WT, ReplicationHandler.FILE_STREAM);
-    req.setParams(SolrParams.wrapDefaults(new MapSolrParams(map),req.getParams()));
-    rsp.add(ReplicationHandler.FILE_STREAM, new ExportWriter(req, rsp, wt));
-  }
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/handler/FieldAnalysisRequestHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/FieldAnalysisRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/FieldAnalysisRequestHandler.java
deleted file mode 100644
index a7e1ab9..0000000
--- a/solr/core/src/java/org/apache/solr/handler/FieldAnalysisRequestHandler.java
+++ /dev/null
@@ -1,233 +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.util.BytesRef;
-import org.apache.solr.client.solrj.request.FieldAnalysisRequest;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.common.params.AnalysisParams;
-import org.apache.solr.common.params.CommonParams;
-import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.common.util.NamedList;
-import org.apache.solr.common.util.SimpleOrderedMap;
-import org.apache.solr.common.util.ContentStream;
-import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.schema.FieldType;
-import org.apache.solr.schema.IndexSchema;
-import org.apache.commons.io.IOUtils;
-
-import java.io.Reader;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Set;
-
-/**
- * Provides the ability to specify multiple field types and field names in the same request. Expected parameters:
- * <table border="1" summary="table of parameters">
- * <tr>
- * <th align="left">Name</th>
- * <th align="left">Type</th>
- * <th align="left">required</th>
- * <th align="left">Description</th>
- * <th align="left">Multi-valued</th>
- * </tr>
- * <tr>
- * <td>analysis.fieldname</td>
- * <td>string</td>
- * <td>no</td>
- * <td>When present, the text will be analyzed based on the type of this field name.</td>
- * <td>Yes, this parameter may hold a comma-separated list of values and the analysis will be performed for each of the specified fields</td>
- * </tr>
- * <tr>
- * <td>analysis.fieldtype</td>
- * <td>string</td>
- * <td>no</td>
- * <td>When present, the text will be analyzed based on the specified type</td>
- * <td>Yes, this parameter may hold a comma-separated list of values and the analysis will be performed for each of the specified field types</td>
- * </tr>
- * <tr>
- * <td>analysis.fieldvalue</td>
- * <td>string</td>
- * <td>no</td>
- * <td>The text that will be analyzed. The analysis will mimic the index-time analysis.</td>
- * <td>No</td>
- * </tr>
- * <tr>
- * <td>{@code analysis.query} OR {@code q}</td>
- * <td>string</td>
- * <td>no</td>
- * <td>When present, the text that will be analyzed. The analysis will mimic the query-time analysis. Note that the
- * {@code analysis.query} parameter as precedes the {@code q} parameters.</td>
- * <td>No</td>
- * </tr>
- * <tr>
- * <td>analysis.showmatch</td>
- * <td>boolean</td>
- * <td>no</td>
- * <td>When set to {@code true} and when query analysis is performed, the produced tokens of the field value
- * analysis will be marked as "matched" for every token that is produces by the query analysis</td>
- * <td>No</td>
- * </tr>
- * </table>
- * <p>Note that if neither analysis.fieldname and analysis.fieldtype is specified, then the default search field's
- * analyzer is used.</p>
- * <p>Note that if one of analysis.value or analysis.query or q must be specified</p>
- *
- * @since solr 1.4 
- */
-public class FieldAnalysisRequestHandler extends AnalysisRequestHandlerBase {
-
-  @Override
-  protected NamedList doAnalysis(SolrQueryRequest req) throws Exception {
-    FieldAnalysisRequest analysisRequest = resolveAnalysisRequest(req);
-    IndexSchema indexSchema = req.getSchema();
-    return handleAnalysisRequest(analysisRequest, indexSchema);
-  }
-
-  @Override
-  public String getDescription() {
-    return "Provide a breakdown of the analysis process of field/query text";
-  }
-
-  // ================================================= Helper methods ================================================
-
-  /**
-   * Resolves the AnalysisRequest based on the parameters in the given SolrParams.
-   *
-   * @param req the request
-   *
-   * @return AnalysisRequest containing all the information about what needs to be analyzed, and using what
-   *         fields/types
-   */
-  FieldAnalysisRequest resolveAnalysisRequest(SolrQueryRequest req) throws SolrException {
-    SolrParams solrParams = req.getParams();
-    FieldAnalysisRequest analysisRequest = new FieldAnalysisRequest();
-
-    boolean useDefaultSearchField = true;
-    if (solrParams.get(AnalysisParams.FIELD_TYPE) != null) {
-      analysisRequest.setFieldTypes(Arrays.asList(solrParams.get(AnalysisParams.FIELD_TYPE).split(",")));
-      useDefaultSearchField = false;
-    }
-    if (solrParams.get(AnalysisParams.FIELD_NAME) != null) {
-      analysisRequest.setFieldNames(Arrays.asList(solrParams.get(AnalysisParams.FIELD_NAME).split(",")));
-      useDefaultSearchField = false;
-    }
-    if (useDefaultSearchField) {
-      if (solrParams.get(CommonParams.DF) != null) {
-        analysisRequest.addFieldName(solrParams.get(CommonParams.DF));
-      } else {
-        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
-            "Field analysis request must contain one of analysis.fieldtype, analysis.fieldname or df.");
-      }
-    }
-    analysisRequest.setQuery(solrParams.get(AnalysisParams.QUERY, solrParams.get(CommonParams.Q)));
-
-    String value = solrParams.get(AnalysisParams.FIELD_VALUE);
-    if (analysisRequest.getQuery() == null && value == null)  {
-      throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
-          "One of analysis.fieldvalue, q, or analysis.query parameters must be specified");
-    }
-
-    Iterable<ContentStream> streams = req.getContentStreams();
-    if (streams != null) {
-      // NOTE: Only the first content stream is currently processed
-      for (ContentStream stream : streams) {
-        Reader reader = null;
-        try {
-          reader = stream.getReader();
-          value = IOUtils.toString(reader);
-        } catch (IOException e) {
-          // do nothing, leave value set to the request parameter
-        }
-        finally {
-          IOUtils.closeQuietly(reader);
-        }
-        break;
-      }
-    }
-
-    analysisRequest.setFieldValue(value);
-    analysisRequest.setShowMatch(solrParams.getBool(AnalysisParams.SHOW_MATCH, false));
-    return analysisRequest;
-  }
-
-  /**
-   * Handles the resolved analysis request and returns the analysis breakdown response as a named list.
-   *
-   * @param request The request to handle.
-   * @param schema  The index schema.
-   *
-   * @return The analysis breakdown as a named list.
-   */
-  protected NamedList<NamedList> handleAnalysisRequest(FieldAnalysisRequest request, IndexSchema schema) {
-    NamedList<NamedList> analysisResults = new SimpleOrderedMap<>();
-
-    NamedList<NamedList> fieldTypeAnalysisResults = new SimpleOrderedMap<>();
-    if (request.getFieldTypes() != null)  {
-      for (String fieldTypeName : request.getFieldTypes()) {
-        FieldType fieldType = schema.getFieldTypes().get(fieldTypeName);
-        fieldTypeAnalysisResults.add(fieldTypeName, analyzeValues(request, fieldType, null));
-      }
-    }
-
-    NamedList<NamedList> fieldNameAnalysisResults = new SimpleOrderedMap<>();
-    if (request.getFieldNames() != null)  {
-      for (String fieldName : request.getFieldNames()) {
-        FieldType fieldType = schema.getFieldType(fieldName);
-        fieldNameAnalysisResults.add(fieldName, analyzeValues(request, fieldType, fieldName));
-      }
-    }
-
-    analysisResults.add("field_types", fieldTypeAnalysisResults);
-    analysisResults.add("field_names", fieldNameAnalysisResults);
-
-    return analysisResults;
-  }
-
-  /**
-   * Analyzes the index value (if it exists) and the query value (if it exists) in the given AnalysisRequest, using
-   * the Analyzers of the given field type.
-   *
-   * @param analysisRequest AnalysisRequest from where the index and query values will be taken
-   * @param fieldType       Type of field whose analyzers will be used
-   * @param fieldName       Name of the field to be analyzed.  Can be {@code null}
-   *
-   * @return NamedList containing the tokens produced by the analyzers of the given field, separated into an index and
-   *         a query group
-   */ // package access for testing
-  NamedList<NamedList> analyzeValues(FieldAnalysisRequest analysisRequest, FieldType fieldType, String fieldName) {
-
-    final String queryValue = analysisRequest.getQuery();
-    final Set<BytesRef> termsToMatch = (queryValue != null && analysisRequest.isShowMatch())
-      ? getQueryTokenSet(queryValue, fieldType.getQueryAnalyzer())
-      : EMPTY_BYTES_SET;
-
-    NamedList<NamedList> analyzeResults = new SimpleOrderedMap<>();
-    if (analysisRequest.getFieldValue() != null) {
-      AnalysisContext context = new AnalysisContext(fieldName, fieldType, fieldType.getIndexAnalyzer(), termsToMatch);
-      NamedList analyzedTokens = analyzeValue(analysisRequest.getFieldValue(), context);
-      analyzeResults.add("index", analyzedTokens);
-    }
-    if (analysisRequest.getQuery() != null) {
-      AnalysisContext context = new AnalysisContext(fieldName, fieldType, fieldType.getQueryAnalyzer());
-      NamedList analyzedTokens = analyzeValue(analysisRequest.getQuery(), context);
-      analyzeResults.add("query", analyzedTokens);
-    }
-
-    return analyzeResults;
-  }
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/handler/GraphHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/GraphHandler.java b/solr/core/src/java/org/apache/solr/handler/GraphHandler.java
deleted file mode 100644
index ed5ae0a..0000000
--- a/solr/core/src/java/org/apache/solr/handler/GraphHandler.java
+++ /dev/null
@@ -1,233 +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 java.io.IOException;
-import java.lang.invoke.MethodHandles;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.solr.client.solrj.io.Tuple;
-import org.apache.solr.client.solrj.io.comp.StreamComparator;
-import org.apache.solr.client.solrj.io.graph.Traversal;
-import org.apache.solr.client.solrj.io.stream.*;
-import org.apache.solr.client.solrj.io.stream.expr.DefaultStreamFactory;
-import org.apache.solr.client.solrj.io.stream.expr.Explanation;
-import org.apache.solr.client.solrj.io.stream.expr.Expressible;
-import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.common.params.CommonParams;
-import org.apache.solr.common.params.ModifiableSolrParams;
-import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.common.util.NamedList;
-import org.apache.solr.core.CoreContainer;
-import org.apache.solr.core.SolrCore;
-import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.response.SolrQueryResponse;
-import org.apache.solr.security.AuthorizationContext;
-import org.apache.solr.security.PermissionNameProvider;
-import org.apache.solr.util.plugin.SolrCoreAware;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * @since 6.1.0
- */
-public class GraphHandler extends RequestHandlerBase implements SolrCoreAware, PermissionNameProvider {
-
-  private StreamFactory streamFactory = new DefaultStreamFactory();
-  private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-  private String coreName;
-
-  @Override
-  public PermissionNameProvider.Name getPermissionName(AuthorizationContext request) {
-    return PermissionNameProvider.Name.READ_PERM;
-  }
-
-  public void inform(SolrCore core) {
-
-    /* The stream factory will always contain the zkUrl for the given collection
-     * Adds default streams with their corresponding function names. These
-     * defaults can be overridden or added to in the solrConfig in the stream
-     * RequestHandler def. Example config override
-     *  <lst name="streamFunctions">
-     *    <str name="group">org.apache.solr.client.solrj.io.stream.ReducerStream</str>
-     *    <str name="count">org.apache.solr.client.solrj.io.stream.RecordCountStream</str>
-     *  </lst>
-     * */
-
-    String defaultCollection;
-    String defaultZkhost;
-    CoreContainer coreContainer = core.getCoreContainer();
-    this.coreName = core.getName();
-
-    if(coreContainer.isZooKeeperAware()) {
-      defaultCollection = core.getCoreDescriptor().getCollectionName();
-      defaultZkhost = core.getCoreContainer().getZkController().getZkServerAddress();
-      streamFactory.withCollectionZkHost(defaultCollection, defaultZkhost);
-      streamFactory.withDefaultZkHost(defaultZkhost);
-    }
-
-    // This pulls all the overrides and additions from the config
-    Object functionMappingsObj = initArgs.get("streamFunctions");
-    if(null != functionMappingsObj){
-      NamedList<?> functionMappings = (NamedList<?>)functionMappingsObj;
-      for(Entry<String,?> functionMapping : functionMappings){
-        Class<? extends Expressible> clazz = core.getResourceLoader().findClass((String)functionMapping.getValue(),
-            Expressible.class);
-        streamFactory.withFunctionName(functionMapping.getKey(), clazz);
-      }
-    }
-  }
-
-  public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
-    SolrParams params = req.getParams();
-    params = adjustParams(params);
-    req.setParams(params);
-
-
-    TupleStream tupleStream = null;
-
-    try {
-      tupleStream = this.streamFactory.constructStream(params.get("expr"));
-    } catch (Exception e) {
-      //Catch exceptions that occur while the stream is being created. This will include streaming expression parse rules.
-      SolrException.log(log, e);
-      Map requestContext = req.getContext();
-      requestContext.put("stream", new DummyErrorStream(e));
-      return;
-    }
-
-    StreamContext context = new StreamContext();
-    context.setSolrClientCache(StreamHandler.clientCache);
-    context.put("core", this.coreName);
-    Traversal traversal = new Traversal();
-    context.put("traversal", traversal);
-    tupleStream.setStreamContext(context);
-    Map requestContext = req.getContext();
-    requestContext.put("stream", new TimerStream(new ExceptionStream(tupleStream)));
-    requestContext.put("traversal", traversal);
-  }
-
-  public String getDescription() {
-    return "StreamHandler";
-  }
-
-  public String getSource() {
-    return null;
-  }
-
-
-  public static class DummyErrorStream extends TupleStream {
-    private Exception e;
-
-    public DummyErrorStream(Exception e) {
-      this.e = e;
-    }
-    public StreamComparator getStreamSort() {
-      return null;
-    }
-
-    public void close() {
-    }
-
-    public void open() {
-    }
-
-    public Exception getException() {
-      return this.e;
-    }
-
-    public void setStreamContext(StreamContext context) {
-    }
-
-    public List<TupleStream> children() {
-      return null;
-    }
-
-    @Override
-    public Explanation toExplanation(StreamFactory factory) throws IOException {
-      return null;
-    }
-
-    public Tuple read() {
-      String msg = e.getMessage();
-      Map m = new HashMap();
-      m.put("EOF", true);
-      m.put("EXCEPTION", msg);
-      return new Tuple(m);
-    }
-  }
-
-
-  private SolrParams adjustParams(SolrParams params) {
-    ModifiableSolrParams adjustedParams = new ModifiableSolrParams();
-    adjustedParams.add(params);
-    adjustedParams.add(CommonParams.OMIT_HEADER, "true");
-    return adjustedParams;
-  }
-
-  public static class TimerStream extends TupleStream {
-
-    private long begin;
-    private TupleStream tupleStream;
-
-    public TimerStream(TupleStream tupleStream) {
-      this.tupleStream = tupleStream;
-    }
-
-    public StreamComparator getStreamSort() {
-      return this.tupleStream.getStreamSort();
-    }
-
-    public void close() throws IOException {
-      this.tupleStream.close();
-    }
-
-    public void open() throws IOException {
-      this.begin = System.nanoTime();
-      this.tupleStream.open();
-    }
-
-    public void setStreamContext(StreamContext context) {
-      this.tupleStream.setStreamContext(context);
-    }
-
-    public List<TupleStream> children() {
-      return this.tupleStream.children();
-    }
-
-    @Override
-    public Explanation toExplanation(StreamFactory factory) throws IOException {
-      return null;
-    }
-
-    public Tuple read() throws IOException {
-      Tuple tuple = this.tupleStream.read();
-      if(tuple.EOF) {
-        long totalTime = (System.nanoTime() - begin) / 1000000;
-        tuple.fields.put("RESPONSE_TIME", totalTime);
-      }
-      return tuple;
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/handler/HaversineMetersEvaluator.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/HaversineMetersEvaluator.java b/solr/core/src/java/org/apache/solr/handler/HaversineMetersEvaluator.java
deleted file mode 100644
index 2e30555..0000000
--- a/solr/core/src/java/org/apache/solr/handler/HaversineMetersEvaluator.java
+++ /dev/null
@@ -1,59 +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 java.io.IOException;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.ml.distance.DistanceMeasure;
-import org.apache.lucene.util.SloppyMath;
-import org.apache.solr.client.solrj.io.Tuple;
-import org.apache.solr.client.solrj.io.eval.RecursiveEvaluator;
-import org.apache.solr.client.solrj.io.stream.expr.StreamExpression;
-import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;
-
-public class HaversineMetersEvaluator extends RecursiveEvaluator {
-  protected static final long serialVersionUID = 1L;
-
-  public HaversineMetersEvaluator(StreamExpression expression, StreamFactory factory) throws IOException{
-    super(expression, factory);
-  }
-
-
-  @Override
-  public Object evaluate(Tuple tuple) throws IOException {
-    return new HaversineDistance();
-  }
-
-  @Override
-  public Object doWork(Object... values) throws IOException {
-    // Nothing to do here
-    throw new IOException("This call should never occur");
-  }
-
-  public static class HaversineDistance implements DistanceMeasure {
-    private static final long serialVersionUID = -9108154600539125566L;
-
-    public HaversineDistance() {
-    }
-
-    public double compute(double[] a, double[] b) throws DimensionMismatchException {
-      return SloppyMath.haversinMeters(a[0], a[1], b[0], b[1]);
-    }
-  }
-
-}