lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1058390 [13/16] - in /lucene/dev/branches/bulkpostings: ./ dev-tools/ dev-tools/eclipse/ dev-tools/idea/ dev-tools/idea/.idea/ dev-tools/idea/.idea/libraries/ dev-tools/idea/lucene/ dev-tools/idea/lucene/contrib/ dev-tools/idea/lucene/cont...
Date Thu, 13 Jan 2011 02:09:56 GMT
Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/Config.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/Config.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/Config.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/Config.java Thu Jan 13 02:09:33 2011
@@ -52,15 +52,6 @@ public class Config {
   private final SolrResourceLoader loader;
 
   /**
-   * @deprecated Use {@link #Config(SolrResourceLoader, String, InputStream, String)} instead. 
-   */
-  @Deprecated
-  public Config(String name, InputStream is, String prefix) throws ParserConfigurationException, IOException, SAXException 
-  {
-    this( null, name, is, prefix );
-  }
-
-  /**
    * Builds a config from a resource name with no xpath prefix.
    * @param loader
    * @param name
@@ -310,55 +301,4 @@ public class Config {
     
     return version;
   }
-
-  // The following functions were moved to ResourceLoader
-  //-----------------------------------------------------------------------------
-  
-   /**
-    * @deprecated Use {@link SolrResourceLoader#getConfigDir()} instead.
-    */
-  @Deprecated
-  public String getConfigDir() {
-    return loader.getConfigDir();
-  }
-
-  /**
-   * @deprecated Use {@link SolrResourceLoader#openResource(String)} instead.
-   */
-  @Deprecated
-  public InputStream openResource(String resource) {
-    return loader.openResource(resource);
-  }
-
-  /**
-   * @deprecated Use {@link SolrResourceLoader#getLines(String)} instead.
-   */
-  @Deprecated
-  public List<String> getLines(String resource) throws IOException {
-    return loader.getLines(resource);
-  }
-
-  /**
-   * @deprecated Use {@link SolrResourceLoader#findClass(String, String[])} instead.
-   */
-  @Deprecated
-  public Class findClass(String cname, String... subpackages) {
-    return loader.findClass(cname, subpackages);
-  }
-
-  /**
-   * @deprecated Use {@link SolrResourceLoader#newInstance(String, String[])} instead.
-   */
-  @Deprecated
-  public Object newInstance(String cname, String ... subpackages) {
-    return loader.newInstance(cname, subpackages);
-  }
-  
-  /**
-   * @deprecated Use {@link SolrResourceLoader#getInstanceDir()} instead.
-   */
-  @Deprecated
-  public String getInstanceDir() {
-    return loader.getInstanceDir();
-  }
 }

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/CoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/CoreContainer.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/CoreContainer.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/CoreContainer.java Thu Jan 13 02:09:33 2011
@@ -78,8 +78,6 @@ public class CoreContainer 
   protected String adminHandler;
   protected boolean shareSchema;
   protected String solrHome;
-  @Deprecated
-  protected String solrConfigFilenameOverride;
   protected String defaultCoreName = "";
   private ZkController zkController;
   private SolrZkServer zkServer;
@@ -219,15 +217,6 @@ public class CoreContainer 
            "Setting abortOnConfigurationError==false is no longer supported");
     }
 
-    public String getSolrConfigFilename() {
-      return solrConfigFilename;
-    }
-
-    @Deprecated
-    public void setSolrConfigFilename(String solrConfigFilename) {
-      this.solrConfigFilename = solrConfigFilename;
-    }
-
     // core container instantiation
     public CoreContainer initialize() throws IOException,
         ParserConfigurationException, SAXException {
@@ -379,9 +368,7 @@ public class CoreContainer 
           // deal with optional settings
           String opt = DOMUtil.getAttr(node, "config", null);
 
-          if(solrConfigFilenameOverride != null) {
-            p.setConfigName(solrConfigFilenameOverride);
-          } else if (opt != null) {
+          if (opt != null) {
             p.setConfigName(opt);
           }
           opt = DOMUtil.getAttr(node, "schema", null);

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/SolrConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/SolrConfig.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/SolrConfig.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/SolrConfig.java Thu Jan 13 02:09:33 2011
@@ -71,12 +71,6 @@ public class SolrConfig extends Config {
   
   public static final String DEFAULT_CONF_FILE = "solrconfig.xml";
 
-  /**
-   * Compatibility feature for single-core (pre-solr{215,350} patch); should go away at solr-2.0
-   * @deprecated Use {@link SolrCore#getSolrConfig()} instead.
-   */
-  @Deprecated
-  public static SolrConfig config = null; 
 
   /**
    * Singleton keeping track of configuration errors
@@ -176,8 +170,6 @@ public class SolrConfig extends Config {
 
     hashSetInverseLoadFactor = 1.0f / getFloat("//HashDocSet/@loadFactor",0.75f);
     hashDocSetMaxSize= getInt("//HashDocSet/@maxSize",3000);
-    
-    pingQueryParams = readPingQueryParams(this);
 
     httpCachingConfig = new HttpCachingConfig(this);
     
@@ -211,17 +203,9 @@ public class SolrConfig extends Config {
      loadPluginInfo(IndexReaderFactory.class,"indexReaderFactory",false, true);
      loadPluginInfo(UpdateRequestProcessorChain.class,"updateRequestProcessorChain",false, false);
 
-     //TODO deprecated remove it later
-     loadPluginInfo(SolrHighlighter.class,"highlighting",false, false);
-     if( pluginStore.containsKey( SolrHighlighter.class.getName() ) )
-       log.warn( "Deprecated syntax found. <highlighting/> should move to <searchComponent/>" );
-
      updateHandlerInfo = loadUpdatehandlerInfo();
 
     Config.log.info("Loaded SolrConfig: " + name);
-    
-    // TODO -- at solr 2.0. this should go away
-    config = this;
   }
 
   protected UpdateHandlerInfo loadUpdatehandlerInfo() {
@@ -288,47 +272,6 @@ public class SolrConfig extends Config {
   public HttpCachingConfig getHttpCachingConfig() {
     return httpCachingConfig;
   }
-  
-  /**
-   * ping query request parameters
-   * @deprecated Use {@link PingRequestHandler} instead.
-   */
-  @Deprecated
-  private final NamedList pingQueryParams;
-
-  static private NamedList readPingQueryParams(SolrConfig config) {  
-    String urlSnippet = config.get("admin/pingQuery", "").trim();
-    
-    StringTokenizer qtokens = new StringTokenizer(urlSnippet,"&");
-    String tok;
-    NamedList params = new NamedList();
-    while (qtokens.hasMoreTokens()) {
-      tok = qtokens.nextToken();
-      String[] split = tok.split("=", 2);
-      params.add(split[0], split[1]);
-    }
-    if (0 < params.size()) {
-      log.warn("The <pingQuery> syntax is deprecated, " +
-               "please use PingRequestHandler instead");
-    }
-    return params;
-  }
-  
-  /**
-   * Returns a Request object based on the admin/pingQuery section
-   * of the Solr config file.
-   * 
-   * @deprecated use {@link PingRequestHandler} instead 
-   */
-  @Deprecated
-  public SolrQueryRequest getPingQueryRequest(SolrCore core) {
-    if(pingQueryParams.size() == 0) {
-      throw new IllegalStateException
-        ("<pingQuery> not configured (consider registering " +
-         "PingRequestHandler with the name '/admin/ping' instead)");
-    }
-    return new LocalSolrQueryRequest(core, pingQueryParams);
-  }
 
   public static class JmxConfiguration {
     public boolean enabled = false;
@@ -336,12 +279,6 @@ public class SolrConfig extends Config {
     public String serviceUrl;
     public String rootName;
 
-    @Deprecated
-    public JmxConfiguration(boolean enabled, 
-                            String agentId, 
-                            String serviceUrl) {
-      this(enabled,agentId,serviceUrl,null);
-    }
     public JmxConfiguration(boolean enabled, 
                             String agentId, 
                             String serviceUrl,

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/SolrCore.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/SolrCore.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/SolrCore.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/SolrCore.java Thu Jan 13 02:09:33 2011
@@ -105,12 +105,6 @@ public final class SolrCore implements S
 
   public long getStartTime() { return startTime; }
 
-  /**
-   * @deprecated Use {@link CoreContainer#getCore(String)} instead.
-   */
-  @Deprecated
-  private static SolrCore instance;
-
   static int boolean_query_max_clause_count = Integer.MIN_VALUE;
   // only change the BooleanQuery maxClauseCount once for ALL cores...
   void booleanQueryMaxClauseCount()  {
@@ -140,15 +134,7 @@ public final class SolrCore implements S
   public String getConfigResource() {
     return solrConfig.getResourceName();
   }
-  
-  /**
-   * Gets the configuration resource name used by this core instance.
-   * @deprecated Use {@link #getConfigResource()} instead.
-   */
-  @Deprecated
-  public String getConfigFile() {
-    return solrConfig.getResourceName();
-  }
+
   /**
    * Gets the configuration object used by this core instance.
    */
@@ -165,15 +151,6 @@ public final class SolrCore implements S
   }
 
   /**
-   * Gets the schema resource name used by this core instance.
-   * @deprecated Use {@link #getSchemaResource()} instead.
-   */
-  @Deprecated
-  public String getSchemaFile() {
-    return schema.getResourceName();
-  }
-  
-  /**
    * Gets the schema object used by this core instance.
    */
   public IndexSchema getSchema() { 
@@ -463,30 +440,6 @@ public final class SolrCore implements S
     return createInstance(className, UpdateHandler.class, "Update Handler");
   }
   
-
-  /** 
-   * @return the last core initialized.  If you are using multiple cores, 
-   * this is not a function to use.
-   * 
-   * @deprecated Use {@link CoreContainer#getCore(String)} instead.
-   */
-  @Deprecated
-  public static SolrCore getSolrCore() {
-    synchronized( SolrCore.class ) {
-      if( instance == null ) {
-        try {
-          // sets 'instance' to the latest solr core          
-          CoreContainer.Initializer init = new CoreContainer.Initializer();
-          instance = init.initialize().getCore("");
-        } catch(Exception xany) {
-          throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,
-              "error creating core", xany );
-        }
-      }
-    }
-    return instance;
-  }
-  
   /**
    * 
    * @param dataDir
@@ -555,7 +508,7 @@ public final class SolrCore implements S
     initQParsers();
     initValueSourceParsers();
 
-    this.searchComponents = loadSearchComponents();
+    this.searchComponents = Collections.unmodifiableMap(loadSearchComponents());
 
     // Processors initialized before the handlers
     updateProcessorChains = loadUpdateProcessorChains();
@@ -592,7 +545,6 @@ public final class SolrCore implements S
       // Finally tell anyone who wants to know
       resourceLoader.inform( resourceLoader );
       resourceLoader.inform( this );  // last call before the latch is released.
-      instance = this;   // set singleton for backwards compatibility
     } catch (IOException e) {
       throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, null, e, false);
     } finally {
@@ -768,16 +720,7 @@ public final class SolrCore implements S
      closeHooks.add( hook );
    }
 
-  /**
-   * Returns a Request object based on the admin/pingQuery section
-   * of the Solr config file.
-   * 
-   * @deprecated use {@link org.apache.solr.handler.PingRequestHandler} instead
-   */
-  @Deprecated
-  public SolrQueryRequest getPingQueryRequest() {
-    return solrConfig.getPingQueryRequest(this);
-  }
+
   ////////////////////////////////////////////////////////////////////////////////
   // Request Handler
   ////////////////////////////////////////////////////////////////////////////////
@@ -805,14 +748,6 @@ public final class SolrCore implements S
     return reqHandlers.getRequestHandlers();
   }
 
-  /**
-   * Get the SolrHighlighter
-   */
-  @Deprecated
-  public SolrHighlighter getHighlighter() {
-    HighlightComponent hl = (HighlightComponent) searchComponents.get(HighlightComponent.COMPONENT_NAME);
-    return hl==null? null: hl.getHighlighter();
-  }
 
   /**
    * Registers a handler at the specified location.  If one exists there, it will be replaced.
@@ -892,7 +827,7 @@ public final class SolrCore implements S
    * @return An unmodifiable Map of Search Components
    */
   public Map<String, SearchComponent> getSearchComponents() {
-    return Collections.unmodifiableMap(searchComponents);
+    return searchComponents;
   }
 
   ////////////////////////////////////////////////////////////////////////////////
@@ -1351,7 +1286,7 @@ public final class SolrCore implements S
     rsp.add("responseHeader", responseHeader);
 
     // toLog is a local ref to the same NamedList used by the request
-    NamedList toLog = rsp.getToLog();
+    NamedList<Object> toLog = rsp.getToLog();
     // for back compat, we set these now just in case other code
     // are expecting them during handleRequest
     toLog.add("webapp", req.getContext().get("webapp"));
@@ -1377,7 +1312,7 @@ public final class SolrCore implements S
   
   public static void setResponseHeaderValues(SolrRequestHandler handler, SolrQueryRequest req, SolrQueryResponse rsp) {
     // TODO should check that responseHeader has not been replaced by handler
-	NamedList responseHeader = rsp.getResponseHeader();
+    NamedList<Object> responseHeader = rsp.getResponseHeader();
     final int qtime=(int)(rsp.getEndTime() - req.getStartTime());
     int status = 0;
     Exception exception = rsp.getException();
@@ -1651,7 +1586,7 @@ public final class SolrCore implements S
   }
 
   public NamedList getStatistics() {
-    NamedList lst = new SimpleOrderedMap();
+    NamedList<Object> lst = new SimpleOrderedMap<Object>();
     lst.add("coreName", name==null ? "(null)" : name);
     lst.add("startTime", new Date(startTime));
     lst.add("refCount", getOpenCount());

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/SolrResourceLoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/SolrResourceLoader.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/SolrResourceLoader.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/core/SolrResourceLoader.java Thu Jan 13 02:09:33 2011
@@ -278,6 +278,8 @@ public class SolrResourceLoader implemen
       }
       // delegate to the class loader (looking into $INSTANCE_DIR/lib jars)
       is = classLoader.getResourceAsStream(resource);
+      if (is == null)
+        is = classLoader.getResourceAsStream(getConfigDir() + resource);
     } catch (Exception e) {
       throw new RuntimeException("Error opening " + resource, e);
     }
@@ -634,10 +636,7 @@ public class SolrResourceLoader implemen
     }
     return normalizeDir( home );
   }
-  @Deprecated
-  public static String locateInstanceDir() {
-    return locateSolrHome();
-  }
+
 
   public String getInstanceDir() {
     return instanceDir;

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java Thu Jan 13 02:09:33 2011
@@ -47,6 +47,8 @@ import java.util.*;
  */
 public abstract class AnalysisRequestHandlerBase extends RequestHandlerBase {
 
+  public static final Set<String> EMPTY_STRING_SET = Collections.emptySet();
+
   public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
     rsp.add("analysis", doAnalysis(req));
   }
@@ -70,7 +72,7 @@ public abstract class AnalysisRequestHan
    *
    * @return NamedList containing the tokens produced by analyzing the given value
    */
-  protected NamedList<List<NamedList>> analyzeValue(String value, AnalysisContext context) {
+  protected NamedList<? extends Object> analyzeValue(String value, AnalysisContext context) {
 
     Analyzer analyzer = context.getAnalyzer();
 
@@ -93,7 +95,7 @@ public abstract class AnalysisRequestHan
     TokenizerFactory tfac = tokenizerChain.getTokenizerFactory();
     TokenFilterFactory[] filtfacs = tokenizerChain.getTokenFilterFactories();
 
-    NamedList<List<NamedList>> namedList = new NamedList<List<NamedList>>();
+    NamedList<Object> namedList = new NamedList<Object>();
 
     if( cfiltfacs != null ){
       String source = value;
@@ -234,7 +236,7 @@ public abstract class AnalysisRequestHan
     return tokensNamedLists;
   }
   
-  private String writeCharStream(NamedList out, CharStream input ){
+  private String writeCharStream(NamedList<Object> out, CharStream input ){
     final int BUFFER_SIZE = 1024;
     char[] buf = new char[BUFFER_SIZE];
     int len = 0;
@@ -252,7 +254,6 @@ public abstract class AnalysisRequestHan
     return sb.toString();
   }
 
-
   // ================================================= Inner classes =================================================
 
   /**
@@ -342,7 +343,7 @@ public abstract class AnalysisRequestHan
      *
      */
     public AnalysisContext(String fieldName, FieldType fieldType, Analyzer analyzer) {
-      this(fieldName, fieldType, analyzer, Collections.EMPTY_SET);
+      this(fieldName, fieldType, analyzer, EMPTY_STRING_SET);
     }
 
     /**

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/BinaryUpdateRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/BinaryUpdateRequestHandler.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/BinaryUpdateRequestHandler.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/BinaryUpdateRequestHandler.java Thu Jan 13 02:09:33 2011
@@ -62,7 +62,7 @@ public class BinaryUpdateRequestHandler 
     };
   }
 
-  private void parseAndLoadDocs(SolrQueryRequest req, SolrQueryResponse rsp, InputStream stream,
+  private void parseAndLoadDocs(final SolrQueryRequest req, SolrQueryResponse rsp, InputStream stream,
                                 final UpdateRequestProcessor processor) throws IOException {
     UpdateRequest update = null;
     update = new JavaBinUpdateRequestCodec().unmarshal(stream,
@@ -71,7 +71,7 @@ public class BinaryUpdateRequestHandler 
 
               public void document(SolrInputDocument document, UpdateRequest updateRequest) {
                 if (addCmd == null) {
-                  addCmd = getAddCommand(updateRequest.getParams());
+                  addCmd = getAddCommand(req, updateRequest.getParams());
                 }
                 addCmd.solrDoc = document;
                 try {
@@ -83,25 +83,25 @@ public class BinaryUpdateRequestHandler 
               }
             });
     if (update.getDeleteById() != null) {
-      delete(update.getDeleteById(), processor, true);
+      delete(req, update.getDeleteById(), processor, true);
     }
     if (update.getDeleteQuery() != null) {
-      delete(update.getDeleteQuery(), processor, false);
+      delete(req, update.getDeleteQuery(), processor, false);
     }
 
   }
 
-  private AddUpdateCommand getAddCommand(SolrParams params) {
-    AddUpdateCommand addCmd = new AddUpdateCommand();
+  private AddUpdateCommand getAddCommand(SolrQueryRequest req, SolrParams params) {
+    AddUpdateCommand addCmd = new AddUpdateCommand(req);
 
     addCmd.overwrite = params.getBool(UpdateParams.OVERWRITE, true);
     addCmd.commitWithin = params.getInt(COMMIT_WITHIN, -1);
     return addCmd;
   }
 
-  private void delete(List<String> l, UpdateRequestProcessor processor, boolean isId) throws IOException {
+  private void delete(SolrQueryRequest req, List<String> l, UpdateRequestProcessor processor, boolean isId) throws IOException {
     for (String s : l) {
-      DeleteUpdateCommand delcmd = new DeleteUpdateCommand();
+      DeleteUpdateCommand delcmd = new DeleteUpdateCommand(req);
       if (isId) {
         delcmd.id = s;
       } else {

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/CSVRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/CSVRequestHandler.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/CSVRequestHandler.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/CSVRequestHandler.java Thu Jan 13 02:09:33 2011
@@ -185,7 +185,7 @@ abstract class CSVLoader extends Content
     this.params = req.getParams();
     schema = req.getSchema();
 
-    templateAdd = new AddUpdateCommand();
+    templateAdd = new AddUpdateCommand(req);
     templateAdd.overwrite=params.getBool(OVERWRITE,true);
 
     strategy = new CSVStrategy(',', '"', CSVStrategy.COMMENTS_DISABLED, CSVStrategy.ESCAPE_DISABLED, false, false, false, true);

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/ContentStreamHandlerBase.java Thu Jan 13 02:09:33 2011
@@ -45,7 +45,7 @@ public abstract class ContentStreamHandl
 
       Iterable<ContentStream> streams = req.getContentStreams();
       if (streams == null) {
-        if (!RequestHandlerUtils.handleCommit(processor, params, false) && !RequestHandlerUtils.handleRollback(processor, params, false)) {
+        if (!RequestHandlerUtils.handleCommit(req, processor, params, false) && !RequestHandlerUtils.handleRollback(req, processor, params, false)) {
           throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "missing content stream");
         }
       } else {
@@ -55,8 +55,8 @@ public abstract class ContentStreamHandl
         }
 
         // Perhaps commit from the parameters
-        RequestHandlerUtils.handleCommit(processor, params, false);
-        RequestHandlerUtils.handleRollback(processor, params, false);
+        RequestHandlerUtils.handleCommit(req, processor, params, false);
+        RequestHandlerUtils.handleRollback(req, processor, params, false);
       }
     } finally {
       // finish the request

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java Thu Jan 13 02:09:33 2011
@@ -230,9 +230,8 @@ public class DocumentAnalysisRequestHand
 
         if (request.getQuery() != null) {
           try {
-            AnalysisContext analysisContext = new AnalysisContext(fieldType, fieldType.getQueryAnalyzer(), Collections.EMPTY_SET);
-            NamedList<List<NamedList>> tokens = analyzeValue(request.getQuery(), analysisContext);
-            fieldTokens.add("query", tokens);
+            AnalysisContext analysisContext = new AnalysisContext(fieldType, fieldType.getQueryAnalyzer(), EMPTY_STRING_SET);
+            fieldTokens.add("query", analyzeValue(request.getQuery(), analysisContext));
           } catch (Exception e) {
             // ignore analysis exceptions since we are applying arbitrary text to all fields
           }
@@ -241,10 +240,11 @@ public class DocumentAnalysisRequestHand
         Analyzer analyzer = fieldType.getAnalyzer();
         AnalysisContext analysisContext = new AnalysisContext(fieldType, analyzer, termsToMatch);
         Collection<Object> fieldValues = document.getFieldValues(name);
-        NamedList<NamedList<List<NamedList>>> indexTokens = new SimpleOrderedMap<NamedList<List<NamedList>>>();
+        NamedList<NamedList<? extends Object>> indexTokens 
+          = new SimpleOrderedMap<NamedList<? extends Object>>();
         for (Object fieldValue : fieldValues) {
-          NamedList<List<NamedList>> tokens = analyzeValue(fieldValue.toString(), analysisContext);
-          indexTokens.add(String.valueOf(fieldValue), tokens);
+          indexTokens.add(String.valueOf(fieldValue), 
+                          analyzeValue(fieldValue.toString(), analysisContext));
         }
         fieldTokens.add("index", indexTokens);
       }

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/DumpRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/DumpRequestHandler.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/DumpRequestHandler.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/DumpRequestHandler.java Thu Jan 13 02:09:33 2011
@@ -38,7 +38,7 @@ public class DumpRequestHandler extends 
         
     // Write the streams...
     if( req.getContentStreams() != null ) {
-      ArrayList streams = new ArrayList();
+      ArrayList<NamedList<Object>> streams = new ArrayList<NamedList<Object>>();
       // Cycle through each stream
       for( ContentStream content : req.getContentStreams() ) {
         NamedList<Object> stream = new SimpleOrderedMap<Object>();

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/JsonLoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/JsonLoader.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/JsonLoader.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/JsonLoader.java Thu Jan 13 02:09:33 2011
@@ -62,14 +62,15 @@ class JsonLoader extends ContentStreamLo
       }
 
       JSONParser parser = new JSONParser(reader);
-      this.processUpdate(processor, parser);
+      this.processUpdate(req, processor, parser);
     }
     finally {
       IOUtils.closeQuietly(reader);
     }
   }
 
-  void processUpdate(UpdateRequestProcessor processor, JSONParser parser) throws IOException 
+  @SuppressWarnings("fallthrough")
+  void processUpdate(SolrQueryRequest req, UpdateRequestProcessor processor, JSONParser parser) throws IOException 
   {
     int ev = parser.nextEvent();
     while( ev != JSONParser.EOF ) {
@@ -80,25 +81,25 @@ class JsonLoader extends ContentStreamLo
         if( parser.wasKey() ) {
           String v = parser.getString();
           if( v.equals( XmlUpdateRequestHandler.ADD ) ) {
-            processor.processAdd( parseAdd( parser ) );
+            processor.processAdd( parseAdd(req, parser ) );
           }
           else if( v.equals( XmlUpdateRequestHandler.COMMIT ) ) {
-            CommitUpdateCommand cmd = new CommitUpdateCommand( false );
+            CommitUpdateCommand cmd = new CommitUpdateCommand(req,  false );
             cmd.waitFlush = cmd.waitSearcher = true;
             parseCommitOptions( parser, cmd );
             processor.processCommit( cmd );
           }
           else if( v.equals( XmlUpdateRequestHandler.OPTIMIZE ) ) {
-            CommitUpdateCommand cmd = new CommitUpdateCommand( true );
+            CommitUpdateCommand cmd = new CommitUpdateCommand(req, true );
             cmd.waitFlush = cmd.waitSearcher = true;
             parseCommitOptions( parser, cmd );
             processor.processCommit( cmd );
           }
           else if( v.equals( XmlUpdateRequestHandler.DELETE ) ) {
-            processor.processDelete( parseDelete( parser ) );
+            processor.processDelete( parseDelete(req, parser ) );
           }
           else if( v.equals( XmlUpdateRequestHandler.ROLLBACK ) ) {
-            processor.processRollback( parseRollback( parser ) );
+            processor.processRollback( parseRollback(req, parser ) );
           }
           else {
             throw new IOException( "Unknown command: "+v+" ["+parser.getPosition()+"]" );
@@ -129,10 +130,10 @@ class JsonLoader extends ContentStreamLo
     }
   }
 
-  DeleteUpdateCommand parseDelete(JSONParser js) throws IOException {
+  DeleteUpdateCommand parseDelete(SolrQueryRequest req, JSONParser js) throws IOException {
     assertNextEvent( js, JSONParser.OBJECT_START );
 
-    DeleteUpdateCommand cmd = new DeleteUpdateCommand();
+    DeleteUpdateCommand cmd = new DeleteUpdateCommand(req);
     
     while( true ) {
       int ev = js.nextEvent();
@@ -169,10 +170,10 @@ class JsonLoader extends ContentStreamLo
     }
   }
   
-  RollbackUpdateCommand parseRollback(JSONParser js) throws IOException {
+  RollbackUpdateCommand parseRollback(SolrQueryRequest req, JSONParser js) throws IOException {
     assertNextEvent( js, JSONParser.OBJECT_START );
     assertNextEvent( js, JSONParser.OBJECT_END );
-    return new RollbackUpdateCommand();
+    return new RollbackUpdateCommand(req);
   }
 
   void parseCommitOptions( JSONParser js, CommitUpdateCommand cmd ) throws IOException
@@ -211,10 +212,10 @@ class JsonLoader extends ContentStreamLo
     }
   }
   
-  AddUpdateCommand parseAdd( JSONParser js ) throws IOException
+  AddUpdateCommand parseAdd(SolrQueryRequest req, JSONParser js ) throws IOException
   {
     assertNextEvent( js, JSONParser.OBJECT_START );
-    AddUpdateCommand cmd = new AddUpdateCommand();
+    AddUpdateCommand cmd = new AddUpdateCommand(req);
     float boost = 1.0f;
     
     while( true ) {

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/ReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/ReplicationHandler.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/ReplicationHandler.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/ReplicationHandler.java Thu Jan 13 02:09:33 2011
@@ -94,7 +94,7 @@ public class ReplicationHandler extends 
 
   private volatile IndexCommit indexCommitPoint;
 
-  volatile NamedList snapShootDetails;
+  volatile NamedList<Object> snapShootDetails;
 
   private AtomicBoolean replicationEnabled = new AtomicBoolean(true);
 
@@ -189,13 +189,13 @@ public class ReplicationHandler extends 
    }
   }
 
-  private List<NamedList> getCommits() {
+  private List<NamedList<Object>> getCommits() {
     Map<Long, IndexCommit> commits = core.getDeletionPolicy().getCommits();
-    List<NamedList> l = new ArrayList<NamedList>();
+    List<NamedList<Object>> l = new ArrayList<NamedList<Object>>();
 
     for (IndexCommit c : commits.values()) {
       try {
-        NamedList nl = new NamedList();
+        NamedList<Object> nl = new NamedList<Object>();
         nl.add("indexVersion", c.getVersion());
         nl.add(GENERATION, c.getGeneration());
         nl.add(CMD_GET_FILE_LIST, c.getFileNames());
@@ -701,7 +701,7 @@ public class ReplicationHandler extends 
     return details;
   }
 
-  private void addVal(NamedList nl, String key, Properties props, Class clzz) {
+  private void addVal(NamedList<Object> nl, String key, Properties props, Class clzz) {
     String s = props.getProperty(key);
     if (s == null || s.trim().length() == 0) return;
     if (clzz == Date.class) {

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/RequestHandlerBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/RequestHandlerBase.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/RequestHandlerBase.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/RequestHandlerBase.java Thu Jan 13 02:09:33 2011
@@ -168,8 +168,8 @@ public abstract class RequestHandlerBase
     return null;  // this can be overridden, but not required
   }
 
-  public NamedList getStatistics() {
-    NamedList lst = new SimpleOrderedMap();
+  public NamedList<Object> getStatistics() {
+    NamedList<Object> lst = new SimpleOrderedMap<Object>();
     lst.add("handlerStart",handlerStart);
     lst.add("requests", numRequests);
     lst.add("errors", numErrors);

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/RequestHandlerUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/RequestHandlerUtils.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/RequestHandlerUtils.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/RequestHandlerUtils.java Thu Jan 13 02:09:33 2011
@@ -65,7 +65,7 @@ public class RequestHandlerUtils
     boolean commit   = params.getBool( UpdateParams.COMMIT,   false );
     
     if( optimize || commit || force ) {
-      CommitUpdateCommand cmd = new CommitUpdateCommand( optimize );
+      CommitUpdateCommand cmd = new CommitUpdateCommand(req, optimize );
       cmd.waitFlush    = params.getBool( UpdateParams.WAIT_FLUSH,    cmd.waitFlush    );
       cmd.waitSearcher = params.getBool( UpdateParams.WAIT_SEARCHER, cmd.waitSearcher );
       cmd.expungeDeletes = params.getBool( UpdateParams.EXPUNGE_DELETES, cmd.expungeDeletes);
@@ -89,7 +89,7 @@ public class RequestHandlerUtils
    * Check the request parameters and decide if it should commit or optimize.
    * If it does, it will check parameters for "waitFlush" and "waitSearcher"
    */
-  public static boolean handleCommit( UpdateRequestProcessor processor, SolrParams params, boolean force ) throws IOException
+  public static boolean handleCommit(SolrQueryRequest req, UpdateRequestProcessor processor, SolrParams params, boolean force ) throws IOException
   {
     if( params == null ) {
       params = new MapSolrParams( new HashMap<String, String>() ); 
@@ -99,7 +99,7 @@ public class RequestHandlerUtils
     boolean commit   = params.getBool( UpdateParams.COMMIT,   false );
     
     if( optimize || commit || force ) {
-      CommitUpdateCommand cmd = new CommitUpdateCommand( optimize );
+      CommitUpdateCommand cmd = new CommitUpdateCommand(req, optimize );
       cmd.waitFlush    = params.getBool( UpdateParams.WAIT_FLUSH,    cmd.waitFlush    );
       cmd.waitSearcher = params.getBool( UpdateParams.WAIT_SEARCHER, cmd.waitSearcher );
       cmd.expungeDeletes = params.getBool( UpdateParams.EXPUNGE_DELETES, cmd.expungeDeletes);      
@@ -113,7 +113,7 @@ public class RequestHandlerUtils
   /**
    * @since Solr 1.4
    */
-  public static boolean handleRollback( UpdateRequestProcessor processor, SolrParams params, boolean force ) throws IOException
+  public static boolean handleRollback(SolrQueryRequest req, UpdateRequestProcessor processor, SolrParams params, boolean force ) throws IOException
   {
     if( params == null ) {
       params = new MapSolrParams( new HashMap<String, String>() ); 
@@ -122,7 +122,7 @@ public class RequestHandlerUtils
     boolean rollback = params.getBool( UpdateParams.ROLLBACK, false );
     
     if( rollback || force ) {
-      RollbackUpdateCommand cmd = new RollbackUpdateCommand();
+      RollbackUpdateCommand cmd = new RollbackUpdateCommand(req);
       processor.processRollback( cmd );
       return true;
     }

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/SnapPuller.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/SnapPuller.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/SnapPuller.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/SnapPuller.java Thu Jan 13 02:09:33 2011
@@ -22,12 +22,16 @@ import org.apache.commons.httpclient.met
 import org.apache.commons.io.IOUtils;
 import org.apache.lucene.index.IndexCommit;
 import org.apache.solr.common.SolrException;
+import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.util.FastInputStream;
 import org.apache.solr.common.util.JavaBinCodec;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.FileUtils;
 import org.apache.solr.core.SolrCore;
 import static org.apache.solr.handler.ReplicationHandler.*;
+
+import org.apache.solr.request.LocalSolrQueryRequest;
+import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.search.SolrIndexSearcher;
 import org.apache.solr.update.CommitUpdateCommand;
 import org.apache.solr.update.DirectUpdateHandler2;
@@ -59,6 +63,9 @@ import java.util.zip.InflaterInputStream
 public class SnapPuller {
   private static final Logger LOG = LoggerFactory.getLogger(SnapPuller.class.getName());
 
+  private static final List<Map<String,Object>> EMPTY_LIST_OF_MAPS 
+    = Collections.emptyList();
+
   private final String masterUrl;
 
   private final ReplicationHandler replicationHandler;
@@ -188,14 +195,14 @@ public class SnapPuller {
     return getNamedListResponse(post);
   }
 
-  private NamedList getNamedListResponse(PostMethod method) throws IOException {
+  private NamedList<?> getNamedListResponse(PostMethod method) throws IOException {
     try {
       int status = myHttpClient.executeMethod(method);
       if (status != HttpStatus.SC_OK) {
         throw new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE,
                 "Request failed for the url " + method);
       }
-      return (NamedList) new JavaBinCodec().unmarshal(method.getResponseBodyAsStream());
+      return (NamedList<?>) new JavaBinCodec().unmarshal(method.getResponseBodyAsStream());
     } finally {
       try {
         method.releaseConnection();
@@ -212,8 +219,12 @@ public class SnapPuller {
     post.addParameter(COMMAND, CMD_GET_FILE_LIST);
     post.addParameter(CMD_INDEX_VERSION, String.valueOf(version));
     post.addParameter("wt", "javabin");
-    NamedList nl = getNamedListResponse(post);
-    List<Map<String, Object>> f = (List<Map<String, Object>>) nl.get(CMD_GET_FILE_LIST);
+
+    @SuppressWarnings("unchecked")
+    NamedList<List<Map<String, Object>>> nl 
+      = (NamedList<List<Map<String, Object>>>) getNamedListResponse(post);
+
+    List<Map<String, Object>> f = nl.get(CMD_GET_FILE_LIST);
     if (f != null)
       filesToDownload = Collections.synchronizedList(f);
     else {
@@ -221,7 +232,7 @@ public class SnapPuller {
       LOG.error("No files to download for indexversion: "+ version);
     }
 
-    f = (List<Map<String, Object>>) nl.get(CONF_FILES);
+    f = nl.get(CONF_FILES);
     if (f != null)
       confFilesToDownload = Collections.synchronizedList(f);
   }
@@ -461,18 +472,23 @@ public class SnapPuller {
   }
 
   private void doCommit() throws IOException {
-    CommitUpdateCommand cmd = new CommitUpdateCommand(false);
-    cmd.waitFlush = true;
-    cmd.waitSearcher = true;
-    solrCore.getUpdateHandler().commit(cmd);
-    if (solrCore.getUpdateHandler() instanceof DirectUpdateHandler2) {
-      LOG.info("Force open index writer to make sure older index files get deleted");
-      DirectUpdateHandler2 handler = (DirectUpdateHandler2) solrCore.getUpdateHandler();
-      handler.forceOpenWriter();
-      replicationHandler.refreshCommitpoint();
-    } else  {
-      LOG.warn("The update handler is not an instance or sub-class of DirectUpdateHandler2. " +
-              "ReplicationHandler may not be able to cleanup un-used index files.");
+    SolrQueryRequest req = new LocalSolrQueryRequest(solrCore, new ModifiableSolrParams());
+    try {
+      CommitUpdateCommand cmd = new CommitUpdateCommand(req, false);
+      cmd.waitFlush = true;
+      cmd.waitSearcher = true;
+      solrCore.getUpdateHandler().commit(cmd);
+      if (solrCore.getUpdateHandler() instanceof DirectUpdateHandler2) {
+        LOG.info("Force open index writer to make sure older index files get deleted");
+        DirectUpdateHandler2 handler = (DirectUpdateHandler2) solrCore.getUpdateHandler();
+        handler.forceOpenWriter();
+        replicationHandler.refreshCommitpoint();
+      } else  {
+        LOG.warn("The update handler is not an instance or sub-class of DirectUpdateHandler2. " +
+            "ReplicationHandler may not be able to cleanup un-used index files.");
+      }
+    } finally {
+      req.close();
     }
   }
 
@@ -695,10 +711,11 @@ public class SnapPuller {
    */
   private Collection<Map<String, Object>> getModifiedConfFiles(List<Map<String, Object>> confFilesToDownload) {
     if (confFilesToDownload == null || confFilesToDownload.isEmpty())
-      return Collections.EMPTY_LIST;
+      return EMPTY_LIST_OF_MAPS;
+
     //build a map with alias/name as the key
     Map<String, Map<String, Object>> nameVsFile = new HashMap<String, Map<String, Object>>();
-    NamedList names = new NamedList();
+    NamedList<String> names = new NamedList<String>();
     for (Map<String, Object> map : confFilesToDownload) {
       //if alias is present that is the name the file may have in the slave
       String name = (String) (map.get(ALIAS) == null ? map.get(NAME) : map.get(ALIAS));
@@ -716,7 +733,7 @@ public class SnapPuller {
         nameVsFile.remove(name); //checksums are same so the file need not be downloaded
       }
     }
-    return nameVsFile.isEmpty() ? Collections.EMPTY_LIST : nameVsFile.values();
+    return nameVsFile.isEmpty() ? EMPTY_LIST_OF_MAPS : nameVsFile.values();
   }
 
   /**
@@ -779,25 +796,25 @@ public class SnapPuller {
     //make a copy first because it can be null later
     List<Map<String, Object>> tmp = confFilesToDownload;
     //create a new instance. or else iterator may fail
-    return tmp == null ? Collections.EMPTY_LIST : new ArrayList<Map<String, Object>>(tmp);
+    return tmp == null ? EMPTY_LIST_OF_MAPS : new ArrayList<Map<String, Object>>(tmp);
   }
 
   List<Map<String, Object>> getConfFilesDownloaded() {
     //make a copy first because it can be null later
     List<Map<String, Object>> tmp = confFilesDownloaded;
     // NOTE: it's safe to make a copy of a SynchronizedCollection(ArrayList)
-    return tmp == null ? Collections.EMPTY_LIST : new ArrayList<Map<String, Object>>(tmp);
+    return tmp == null ? EMPTY_LIST_OF_MAPS : new ArrayList<Map<String, Object>>(tmp);
   }
 
   List<Map<String, Object>> getFilesToDownload() {
     //make a copy first because it can be null later
     List<Map<String, Object>> tmp = filesToDownload;
-    return tmp == null ? Collections.EMPTY_LIST : new ArrayList<Map<String, Object>>(tmp);
+    return tmp == null ? EMPTY_LIST_OF_MAPS : new ArrayList<Map<String, Object>>(tmp);
   }
 
   List<Map<String, Object>> getFilesDownloaded() {
     List<Map<String, Object>> tmp = filesDownloaded;
-    return tmp == null ? Collections.EMPTY_LIST : new ArrayList<Map<String, Object>>(tmp);
+    return tmp == null ? EMPTY_LIST_OF_MAPS : new ArrayList<Map<String, Object>>(tmp);
   }
 
   Map<String, Object> getCurrentFile() {

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/SnapShooter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/SnapShooter.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/SnapShooter.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/SnapShooter.java Thu Jan 13 02:09:33 2011
@@ -71,7 +71,8 @@ public class SnapShooter {
   }
 
   void createSnapshot(final IndexCommit indexCommit, ReplicationHandler replicationHandler) {
-    NamedList details = new NamedList();
+
+    NamedList<Object> details = new NamedList<Object>();
     details.add("startTime", new Date().toString());
     File snapShotDir = null;
     String directoryName = null;

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/XMLLoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/XMLLoader.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/XMLLoader.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/XMLLoader.java Thu Jan 13 02:09:33 2011
@@ -66,7 +66,7 @@ class XMLLoader extends ContentStreamLoa
       }
 
       XMLStreamReader parser = inputFactory.createXMLStreamReader(reader);
-      this.processUpdate(processor, parser);
+      this.processUpdate(req, processor, parser);
     }
     catch (XMLStreamException e) {
       throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e.getMessage(), e);
@@ -81,7 +81,7 @@ class XMLLoader extends ContentStreamLoa
   /**
    * @since solr 1.2
    */
-  void processUpdate(UpdateRequestProcessor processor, XMLStreamReader parser)
+  void processUpdate(SolrQueryRequest req, UpdateRequestProcessor processor, XMLStreamReader parser)
           throws XMLStreamException, IOException, FactoryConfigurationError,
           InstantiationException, IllegalAccessException,
           TransformerConfigurationException {
@@ -98,7 +98,7 @@ class XMLLoader extends ContentStreamLoa
           if (currTag.equals(XmlUpdateRequestHandler.ADD)) {
             XmlUpdateRequestHandler.log.trace("SolrCore.update(add)");
 
-            addCmd = new AddUpdateCommand();
+            addCmd = new AddUpdateCommand(req);
 
             for (int i = 0; i < parser.getAttributeCount(); i++) {
               String attrName = parser.getAttributeLocalName(i);
@@ -120,7 +120,7 @@ class XMLLoader extends ContentStreamLoa
           } else if (XmlUpdateRequestHandler.COMMIT.equals(currTag) || XmlUpdateRequestHandler.OPTIMIZE.equals(currTag)) {
             XmlUpdateRequestHandler.log.trace("parsing " + currTag);
 
-            CommitUpdateCommand cmd = new CommitUpdateCommand(XmlUpdateRequestHandler.OPTIMIZE.equals(currTag));
+            CommitUpdateCommand cmd = new CommitUpdateCommand(req, XmlUpdateRequestHandler.OPTIMIZE.equals(currTag));
 
             boolean sawWaitSearcher = false, sawWaitFlush = false;
             for (int i = 0; i < parser.getAttributeCount(); i++) {
@@ -151,13 +151,13 @@ class XMLLoader extends ContentStreamLoa
           else if (XmlUpdateRequestHandler.ROLLBACK.equals(currTag)) {
             XmlUpdateRequestHandler.log.trace("parsing " + currTag);
 
-            RollbackUpdateCommand cmd = new RollbackUpdateCommand();
+            RollbackUpdateCommand cmd = new RollbackUpdateCommand(req);
 
             processor.processRollback(cmd);
           } // end rollback
           else if (XmlUpdateRequestHandler.DELETE.equals(currTag)) {
             XmlUpdateRequestHandler.log.trace("parsing delete");
-            processDelete(processor, parser);
+            processDelete(req, processor, parser);
           } // end delete
           break;
       }
@@ -167,9 +167,9 @@ class XMLLoader extends ContentStreamLoa
   /**
    * @since solr 1.3
    */
-  void processDelete(UpdateRequestProcessor processor, XMLStreamReader parser) throws XMLStreamException, IOException {
+  void processDelete(SolrQueryRequest req, UpdateRequestProcessor processor, XMLStreamReader parser) throws XMLStreamException, IOException {
     // Parse the command
-    DeleteUpdateCommand deleteCmd = new DeleteUpdateCommand();
+    DeleteUpdateCommand deleteCmd = new DeleteUpdateCommand(req);
 
     for (int i = 0; i < parser.getAttributeCount(); i++) {
       String attrName = parser.getAttributeLocalName(i);

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/XmlUpdateRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/XmlUpdateRequestHandler.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/XmlUpdateRequestHandler.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/XmlUpdateRequestHandler.java Thu Jan 13 02:09:33 2011
@@ -84,47 +84,6 @@ public class XmlUpdateRequestHandler ext
     return new XMLLoader(processor, inputFactory);
   }
 
-
-  /**
-   * A Convenience method for getting back a simple XML string indicating
-   * success or failure from an XML formated Update (from the Reader)
-   *
-   * @since solr 1.2
-   * @deprecated Direct updates fro ma Reader, as well as the response 
-   *             format produced by this method, have been deprecated 
-   *             and will be removed in future versions.  Any code using
-   *             this method should be changed to use {@link #handleRequest} 
-   *             method with a ContentStream. 
-   */
-  @Deprecated
-  public void doLegacyUpdate(Reader input, Writer output) {
-    SolrCore core = SolrCore.getSolrCore();
-    SolrQueryRequest req = new LocalSolrQueryRequest(core, new HashMap<String,String[]>());
-
-    try {
-      // Old style requests do not choose a custom handler
-      UpdateRequestProcessorChain processorFactory = core.getUpdateProcessingChain(null);
-
-      SolrQueryResponse rsp = new SolrQueryResponse(); // ignored
-      XMLStreamReader parser = inputFactory.createXMLStreamReader(input);
-      UpdateRequestProcessor processor = processorFactory.createProcessor(req, rsp);
-      XMLLoader loader = (XMLLoader) newLoader(req, processor);
-      loader.processUpdate(processor, parser);
-      processor.finish();
-      output.write("<result status=\"0\"></result>");
-    }
-    catch (Exception ex) {
-      try {
-        SolrException.logOnce(log, "Error processing \"legacy\" update command", ex);
-        XML.writeXML(output, "result", SolrException.toStr(ex), "status", "1");
-      } catch (Exception ee) {
-        log.error("Error writing to output stream: " + ee);
-      }
-    }
-    finally {
-      req.close();
-    }
-  }
   //////////////////////// SolrInfoMBeans methods //////////////////////
 
   @Override

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/admin/CoreAdminHandler.java Thu Jan 13 02:09:33 2011
@@ -194,7 +194,7 @@ public class CoreAdminHandler extends Re
         wrappedReq = new LocalSolrQueryRequest(core, req.getParams());
         UpdateRequestProcessor processor =
                 processorChain.createProcessor(wrappedReq, rsp);
-        processor.processMergeIndexes(new MergeIndexesCommand(dirs));
+        processor.processMergeIndexes(new MergeIndexesCommand(dirs, req));
       } finally {
         core.close();
         wrappedReq.close();

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java Thu Jan 13 02:09:33 2011
@@ -450,7 +450,7 @@ public class LukeRequestHandler extends 
       if (ft.getAnalyzer().getPositionIncrementGap(f.getName()) != 0) {
     	  field.add("positionIncrementGap", ft.getAnalyzer().getPositionIncrementGap(f.getName()));
       }
-      field.add("copyDests", schema.getCopyFields(f.getName()));
+      field.add("copyDests", schema.getCopyFieldsList(f.getName()));
       field.add("copySources", schema.getCopySources(f.getName()));
 
       

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java Thu Jan 13 02:09:33 2011
@@ -20,6 +20,7 @@ package org.apache.solr.handler.admin;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URISyntaxException;
 import java.util.Date;
 import java.util.HashSet;
 import java.util.Locale;
@@ -122,7 +123,15 @@ public class ShowFileRequestHandler exte
     File adminFile = null;
     
     final SolrResourceLoader loader = req.getCore().getResourceLoader();
-    File configdir = new File( loader.getConfigDir() ); 
+    File configdir = new File( loader.getConfigDir() );
+    if (!configdir.exists()) {
+      // TODO: maybe we should just open it this way to start with?
+      try {
+        configdir = new File( loader.getClassLoader().getResource(loader.getConfigDir()).toURI() );
+      } catch (URISyntaxException e) {
+        throw new SolrException( ErrorCode.FORBIDDEN, "Can not access configuration directory!");
+      }
+    }
     String fname = req.getParams().get("file", null);
     if( fname == null ) {
       adminFile = configdir;
@@ -191,12 +200,8 @@ public class ShowFileRequestHandler exte
    * 
    * It is only used so that we can get rid of "/admin/get-file.jsp" and include
    * "admin-extra.html" in "/admin/index.html" using jsp scriptlets
-   * 
-   * @deprecated This functionality is implemented in
-   *             {@link #handleRequestBody(SolrQueryRequest, SolrQueryResponse)}.
    */
-  @Deprecated
-  public static String getFileContents( String path )
+  public static String getFileContents(SolrCore core, String path )
   {
     if( instance != null && instance.hiddenFiles != null ) {
       if( instance.hiddenFiles.contains( path ) ) {
@@ -204,7 +209,6 @@ public class ShowFileRequestHandler exte
       }
     }
     try {
-      SolrCore core = SolrCore.getSolrCore();
       InputStream input = core.getResourceLoader().openResource(path);
       return IOUtils.toString( input );
     }

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/admin/SolrInfoMBeanHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/admin/SolrInfoMBeanHandler.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/admin/SolrInfoMBeanHandler.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/admin/SolrInfoMBeanHandler.java Thu Jan 13 02:09:33 2011
@@ -35,17 +35,17 @@ public class SolrInfoMBeanHandler extend
   public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
     SolrCore core = req.getCore();
     
-    NamedList cats = new NamedList();
+    NamedList<NamedList<NamedList<Object>>> cats = new NamedList<NamedList<NamedList<Object>>>();
     rsp.add("solr-mbeans", cats);
     
     String[] requestedCats = req.getParams().getParams("cat");
     if (null == requestedCats || 0 == requestedCats.length) {
       for (SolrInfoMBean.Category cat : SolrInfoMBean.Category.values()) {
-        cats.add(cat.name(), new SimpleOrderedMap());
+        cats.add(cat.name(), new SimpleOrderedMap<NamedList<Object>>());
       }
     } else {
       for (String catName : requestedCats) {
-        cats.add(catName,new SimpleOrderedMap());
+        cats.add(catName,new SimpleOrderedMap<NamedList<Object>>());
       }
     }
          
@@ -58,10 +58,10 @@ public class SolrInfoMBeanHandler extend
 
       if ( ! ( requestedKeys.isEmpty() || requestedKeys.contains(key) ) ) continue;
 
-      NamedList catInfo = (NamedList) cats.get(m.getCategory().name());
+      NamedList<NamedList<Object>> catInfo = cats.get(m.getCategory().name());
       if ( null == catInfo ) continue;
 
-      NamedList mBeanInfo = new SimpleOrderedMap();
+      NamedList<Object> mBeanInfo = new SimpleOrderedMap<Object>();
       mBeanInfo.add("class", m.getName());
       mBeanInfo.add("version", m.getVersion());
       mBeanInfo.add("description", m.getDescription());

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/DebugComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/DebugComponent.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/DebugComponent.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/DebugComponent.java Thu Jan 13 02:09:33 2011
@@ -115,7 +115,7 @@ public class DebugComponent extends Sear
   @Override
   public void finishStage(ResponseBuilder rb) {
     if (rb.isDebug() && rb.stage == ResponseBuilder.STAGE_GET_FIELDS) {
-      NamedList info = null;
+      NamedList<Object> info = null;
       NamedList explain = new SimpleOrderedMap();
 
       Map.Entry<String, Object>[]  arr =  new NamedList.NamedListEntry[rb.resultIds.size()];
@@ -140,11 +140,11 @@ public class DebugComponent extends Sear
       }
 
       if (rb.isDebugResults()) {
-        explain = SolrPluginUtils.removeNulls(new SimpleOrderedMap(arr));
+        explain = SolrPluginUtils.removeNulls(new SimpleOrderedMap<Object>(arr));
       }
 
       if (info == null) {
-        info = new SimpleOrderedMap();
+        info = new SimpleOrderedMap<Object>();
       }
       if (rb.isDebugResults()) {
         int idx = info.indexOf("explain",0);
@@ -196,9 +196,11 @@ public class DebugComponent extends Sear
 
 
     if (source instanceof NamedList && dest instanceof NamedList) {
-      NamedList tmp = new NamedList();
-      NamedList sl = (NamedList)source;
-      NamedList dl = (NamedList)dest;
+      NamedList<Object> tmp = new NamedList<Object>();
+      @SuppressWarnings("unchecked")
+      NamedList<Object> sl = (NamedList<Object>)source;
+      @SuppressWarnings("unchecked")
+      NamedList<Object> dl = (NamedList<Object>)dest;
       for (int i=0; i<sl.size(); i++) {
         String skey = sl.getName(i);
         if (exclude != null && exclude.contains(skey)) continue;
@@ -228,7 +230,7 @@ public class DebugComponent extends Sear
     }
 
     // merge unlike elements in a list
-    List t = new ArrayList();
+    List<Object> t = new ArrayList<Object>();
     t.add(dest);
     t.add(source);
     return t;

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/FacetComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/FacetComponent.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/FacetComponent.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/FacetComponent.java Thu Jan 13 02:09:33 2011
@@ -78,7 +78,7 @@ public class FacetComponent extends Sear
               params,
               rb );
 
-      NamedList counts = f.getFacetCounts();
+      NamedList<Object> counts = f.getFacetCounts();
       String[] pivots = params.getParams( FacetParams.FACET_PIVOT );
       if( pivots != null && pivots.length > 0 ) {
         NamedList v = pivotHelper.process(rb, params, pivots);
@@ -264,7 +264,9 @@ public class FacetComponent extends Sear
       int shardNum = rb.getShardNum(srsp.getShard());
       NamedList facet_counts = (NamedList)srsp.getSolrResponse().getResponse().get("facet_counts");
 
-      fi.addExceptions((List)facet_counts.get("exception"));
+      @SuppressWarnings("unchecked")
+      List<String> excepts = (List<String>)facet_counts.get("exception");
+      fi.addExceptions(excepts);
 
       // handle facet queries
       NamedList facet_queries = (NamedList)facet_counts.get("facet_queries");
@@ -298,7 +300,10 @@ public class FacetComponent extends Sear
       if (dff.limit <= 0) continue; // no need to check these facets for refinement
       if (dff.minCount <= 1 && dff.sort.equals(FacetParams.FACET_SORT_INDEX)) continue;
 
-      dff._toRefine = new List[rb.shards.length];
+      @SuppressWarnings("unchecked") // generic array's are anoying
+      List<String>[] tmp = (List<String>[]) new List[rb.shards.length];
+      dff._toRefine = tmp;
+
       ShardFacetCount[] counts = dff.getCountSorted();
       int ntop = Math.min(counts.length, dff.offset + dff.limit);
       long smallestCount = counts.length == 0 ? 0 : counts[ntop-1].count;
@@ -353,8 +358,10 @@ public class FacetComponent extends Sear
       // int shardNum = rb.getShardNum(srsp.shard);
       NamedList facet_counts = (NamedList)srsp.getSolrResponse().getResponse().get("facet_counts");
       NamedList facet_fields = (NamedList)facet_counts.get("facet_fields");
-
-      fi.addExceptions((List)facet_counts.get("exception"));
+  
+      @SuppressWarnings("unchecked") 
+      List<String> excepts = (List<String>)facet_counts.get("exception");
+      fi.addExceptions(excepts);
 
       if (facet_fields == null) continue; // this can happen when there's an exception      
 
@@ -384,23 +391,23 @@ public class FacetComponent extends Sear
 
     FacetInfo fi = rb._facetInfo;
 
-    NamedList facet_counts = new SimpleOrderedMap();
+    NamedList<Object> facet_counts = new SimpleOrderedMap<Object>();
 
     if (fi.exceptionList != null) {
       facet_counts.add("exception",fi.exceptionList);
     }
 
-    NamedList facet_queries = new SimpleOrderedMap();
+    NamedList<Number> facet_queries = new SimpleOrderedMap<Number>();
     facet_counts.add("facet_queries",facet_queries);
     for (QueryFacet qf : fi.queryFacets.values()) {
       facet_queries.add(qf.getKey(), num(qf.count));
     }
 
-    NamedList facet_fields = new SimpleOrderedMap();
+    NamedList<Object> facet_fields = new SimpleOrderedMap<Object>();
     facet_counts.add("facet_fields", facet_fields);
 
     for (DistribFieldFacet dff : fi.facets.values()) {
-      NamedList fieldCounts = new NamedList(); // order is more important for facets
+      NamedList<Object> fieldCounts = new NamedList<Object>(); // order is more important for facets
       facet_fields.add(dff.getKey(), fieldCounts);
 
       ShardFacetCount[] counts;
@@ -486,7 +493,7 @@ public class FacetComponent extends Sear
   public static class FacetInfo {
     public LinkedHashMap<String,QueryFacet> queryFacets;
     public LinkedHashMap<String,DistribFieldFacet> facets;
-    public List exceptionList;
+    public List<String> exceptionList;
 
     void parse(SolrParams params, ResponseBuilder rb) {
       queryFacets = new LinkedHashMap<String,QueryFacet>();
@@ -510,9 +517,9 @@ public class FacetComponent extends Sear
       }
     }
         
-    public void addExceptions(List exceptions) {
+    public void addExceptions(List<String> exceptions) {
       if (exceptions == null) return;
-      if (exceptionList == null) exceptionList = new ArrayList();
+      if (exceptionList == null) exceptionList = new ArrayList<String>();
       exceptionList.addAll(exceptions);
     }
   }

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/HighlightComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/HighlightComponent.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/HighlightComponent.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/HighlightComponent.java Thu Jan 13 02:09:33 2011
@@ -50,6 +50,10 @@ public class HighlightComponent extends 
   private PluginInfo info = PluginInfo.EMPTY_INFO;
   private SolrHighlighter highlighter;
 
+  public static SolrHighlighter getHighlighter(SolrCore core) {
+    HighlightComponent hl = (HighlightComponent) core.getSearchComponents().get(HighlightComponent.COMPONENT_NAME);
+    return hl==null ? null: hl.getHighlighter();    
+  }
 
   public void init(PluginInfo info) {
     this.info = info;

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/QueryComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/QueryComponent.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/QueryComponent.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/QueryComponent.java Thu Jan 13 02:09:33 2011
@@ -527,8 +527,7 @@ public class QueryComponent extends Sear
     SolrQueryResponse rsp = rb.rsp;
     //pre-fetch returned documents
     if (!req.getParams().getBool(ShardParams.IS_SHARD,false) && rb.getResults().docList != null && rb.getResults().docList.size()<=50) {
-      // TODO: this may depend on the highlighter component (or other components?)
-      SolrPluginUtils.optimizePreFetchDocs(rb.getResults().docList, rb.getQuery(), req, rsp);
+      SolrPluginUtils.optimizePreFetchDocs(rb, rb.getResults().docList, rb.getQuery(), req, rsp);
     }
   }
 

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/StatsComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/StatsComponent.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/StatsComponent.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/StatsComponent.java Thu Jan 13 02:09:33 2011
@@ -124,8 +124,8 @@ public class StatsComponent extends Sear
 
     StatsInfo si = rb._statsInfo;
 
-    NamedList stats = new SimpleOrderedMap();
-    NamedList stats_fields = new SimpleOrderedMap();
+    NamedList<NamedList<Object>> stats = new SimpleOrderedMap<NamedList<Object>>();
+    NamedList<Object> stats_fields = new SimpleOrderedMap<Object>();
     stats.add("stats_fields", stats_fields);
     for (String field : si.statsFields.keySet()) {
       NamedList stv = si.statsFields.get(field).getStatsValues();
@@ -209,8 +209,8 @@ class SimpleStats {
     return res;
   }
 
-  public NamedList getStatsFields() throws IOException {
-    NamedList<NamedList<Number>> res = new SimpleOrderedMap<NamedList<Number>>();
+  public NamedList<Object> getStatsFields() throws IOException {
+    NamedList<Object> res = new SimpleOrderedMap<Object>();
     String[] statsFs = params.getParams(StatsParams.STATS_FIELD);
     boolean isShard = params.getBool(ShardParams.IS_SHARD, false);
     if (null != statsFs) {
@@ -221,7 +221,7 @@ class SimpleStats {
         }
         SchemaField sf = searcher.getSchema().getField(f);
         FieldType ft = sf.getType();
-        NamedList stv;
+        NamedList<?> stv;
 
         // Currently, only UnInvertedField can deal with multi-part trie fields
         String prefix = TrieField.getMainValuePrefix(ft);
@@ -243,7 +243,7 @@ class SimpleStats {
     return res;
   }
   
-  public NamedList getFieldCacheStats(String fieldName, String[] facet ) {
+  public NamedList<?> getFieldCacheStats(String fieldName, String[] facet ) {
     FieldType ft = searcher.getSchema().getFieldType(fieldName);
 
     FieldCache.DocTermsIndex si = null;

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/TermVectorComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/TermVectorComponent.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/TermVectorComponent.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/TermVectorComponent.java Thu Jan 13 02:09:33 2011
@@ -77,7 +77,7 @@ public class TermVectorComponent extends
       return;
     }
 
-    NamedList termVectors = new NamedList();
+    NamedList<Object> termVectors = new NamedList<Object>();
     rb.rsp.add(TERM_VECTORS, termVectors);
     FieldOptions allFields = new FieldOptions();
     //figure out what options we have, and try to get the appropriate vector
@@ -106,7 +106,7 @@ public class TermVectorComponent extends
     IndexSchema schema = rb.req.getSchema();
     //Build up our per field mapping
     Map<String, FieldOptions> fieldOptions = new HashMap<String, FieldOptions>();
-    NamedList warnings = new NamedList();
+    NamedList<List<String>> warnings = new NamedList<List<String>>();
     List<String>  noTV = new ArrayList<String>();
     List<String>  noPos = new ArrayList<String>();
     List<String>  noOff = new ArrayList<String>();
@@ -187,7 +187,7 @@ public class TermVectorComponent extends
     mapper.fieldOptions = allFields; //this will only stay set if fieldOptions.isEmpty() (in other words, only if the user didn't set any fields)
     while (iter.hasNext()) {
       Integer docId = iter.next();
-      NamedList docNL = new NamedList();
+      NamedList<Object> docNL = new NamedList<Object>();
       mapper.docNL = docNL;
       termVectors.add("doc-" + docId, docNL);
 
@@ -272,7 +272,7 @@ public class TermVectorComponent extends
 
   private static class TVMapper extends TermVectorMapper {
     private IndexReader reader;
-    private NamedList docNL;
+    private NamedList<Object> docNL;
 
     //needs to be set for each new field
     FieldOptions fieldOptions;
@@ -280,7 +280,7 @@ public class TermVectorComponent extends
     //internal vars not passed in by construction
     private boolean useOffsets, usePositions;
     //private Map<String, Integer> idfCache;
-    private NamedList fieldNL;
+    private NamedList<Object> fieldNL;
     private Term currentTerm;
 
 
@@ -289,34 +289,34 @@ public class TermVectorComponent extends
     }
 
     public void map(BytesRef term, int frequency, TermVectorOffsetInfo[] offsets, int[] positions) {
-      NamedList termInfo = new NamedList();
-        fieldNL.add(term.utf8ToString(), termInfo);
-        if (fieldOptions.termFreq == true) {
-          termInfo.add("tf", frequency);
-        }
-        if (useOffsets == true) {
-          NamedList theOffsets = new NamedList();
-          termInfo.add("offsets", theOffsets);
-          for (int i = 0; i < offsets.length; i++) {
-            TermVectorOffsetInfo offset = offsets[i];
-            theOffsets.add("start", offset.getStartOffset());
-            theOffsets.add("end", offset.getEndOffset());
-          }
-        }
-        if (usePositions == true) {
-          NamedList positionsNL = new NamedList();
-          for (int i = 0; i < positions.length; i++) {
-            positionsNL.add("position", positions[i]);
-          }
-          termInfo.add("positions", positionsNL);
-        }
-        if (fieldOptions.docFreq == true) {
-          termInfo.add("df", getDocFreq(term));
+      NamedList<Object> termInfo = new NamedList<Object>();
+      fieldNL.add(term.utf8ToString(), termInfo);
+      if (fieldOptions.termFreq == true) {
+        termInfo.add("tf", frequency);
+      }
+      if (useOffsets == true) {
+        NamedList<Number> theOffsets = new NamedList<Number>();
+        termInfo.add("offsets", theOffsets);
+        for (int i = 0; i < offsets.length; i++) {
+          TermVectorOffsetInfo offset = offsets[i];
+          theOffsets.add("start", offset.getStartOffset());
+          theOffsets.add("end", offset.getEndOffset());
         }
-        if (fieldOptions.tfIdf == true) {
-          double tfIdfVal = ((double) frequency) / getDocFreq(term);
-          termInfo.add("tf-idf", tfIdfVal);
+      }
+      if (usePositions == true) {
+        NamedList<Integer> positionsNL = new NamedList<Integer>();
+        for (int i = 0; i < positions.length; i++) {
+          positionsNL.add("position", positions[i]);
         }
+        termInfo.add("positions", positionsNL);
+      }
+      if (fieldOptions.docFreq == true) {
+        termInfo.add("df", getDocFreq(term));
+      }
+      if (fieldOptions.tfIdf == true) {
+        double tfIdfVal = ((double) frequency) / getDocFreq(term);
+        termInfo.add("tf-idf", tfIdfVal);
+      }
     }
 
     private int getDocFreq(BytesRef term) {
@@ -343,7 +343,7 @@ public class TermVectorComponent extends
       }
       useOffsets = storeOffsets && fieldOptions.offsets;
       usePositions = storePositions && fieldOptions.positions;
-      fieldNL = new NamedList();
+      fieldNL = new NamedList<Object>();
       docNL.add(field, fieldNL);
     }
 
@@ -394,4 +394,4 @@ public class TermVectorComponent extends
 class FieldOptions {
   String fieldName;
   boolean termFreq, positions, offsets, docFreq, tfIdf;
-}
\ No newline at end of file
+}

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/TermsComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/TermsComponent.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/TermsComponent.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/handler/component/TermsComponent.java Thu Jan 13 02:09:33 2011
@@ -75,7 +75,7 @@ public class TermsComponent extends Sear
 
     String[] fields = params.getParams(TermsParams.TERMS_FIELD);
 
-    NamedList termsResult = new SimpleOrderedMap();
+    NamedList<Object> termsResult = new SimpleOrderedMap<Object>();
     rb.rsp.add("terms", termsResult);
 
     if (fields == null || fields.length==0) return;
@@ -107,7 +107,7 @@ public class TermsComponent extends Sear
     Fields lfields = MultiFields.getFields(sr);
 
     for (String field : fields) {
-      NamedList fieldTerms = new NamedList();
+      NamedList<Integer> fieldTerms = new NamedList<Integer>();
       termsResult.add(field, fieldTerms);
 
       Terms terms = lfields == null ? null : lfields.terms(field);
@@ -273,7 +273,9 @@ public class TermsComponent extends Sear
     TermsHelper th = rb._termsHelper;
     if (th != null) {
       for (ShardResponse srsp : sreq.responses) {
-        th.parse((NamedList) srsp.getSolrResponse().getResponse().get("terms"));
+        @SuppressWarnings("unchecked")
+        NamedList<NamedList<Number>> terms = (NamedList<NamedList<Number>>) srsp.getSolrResponse().getResponse().get("terms");
+        th.parse(terms);
       }
     }
   }
@@ -331,7 +333,7 @@ public class TermsComponent extends Sear
       }
     }
 
-    public void parse(NamedList terms) {
+    public void parse(NamedList<NamedList<Number>> terms) {
       // exit if there is no terms
       if (terms == null) {
         return;
@@ -364,7 +366,7 @@ public class TermsComponent extends Sear
     }
 
     public NamedList buildResponse() {
-      NamedList response = new SimpleOrderedMap();
+      NamedList<Object> response = new SimpleOrderedMap<Object>();
 
       // determine if we are going index or count sort
       boolean sort = !TermsParams.TERMS_SORT_INDEX.equals(params.get(
@@ -393,7 +395,7 @@ public class TermsComponent extends Sear
 
       // loop though each field we want terms from
       for (String key : fieldmap.keySet()) {
-        NamedList fieldterms = new SimpleOrderedMap();
+        NamedList<Number> fieldterms = new SimpleOrderedMap<Number>();
         TermsResponse.Term[] data = null;
         if (sort) {
           data = getCountSorted(fieldmap.get(key));

Modified: lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/request/PerSegmentSingleValuedFaceting.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/request/PerSegmentSingleValuedFaceting.java?rev=1058390&r1=1058389&r2=1058390&view=diff
==============================================================================
--- lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/request/PerSegmentSingleValuedFaceting.java (original)
+++ lucene/dev/branches/bulkpostings/solr/src/java/org/apache/solr/request/PerSegmentSingleValuedFaceting.java Thu Jan 13 02:09:33 2011
@@ -1,5 +1,6 @@
 package org.apache.solr.request;
 
+import org.apache.lucene.index.IndexReader.AtomicReaderContext;
 import org.apache.lucene.index.TermsEnum;
 import org.apache.lucene.search.DocIdSet;
 import org.apache.lucene.search.DocIdSetIterator;
@@ -7,6 +8,7 @@ import org.apache.lucene.search.FieldCac
 import org.apache.lucene.search.Filter;
 import org.apache.lucene.util.PriorityQueue;
 import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.ReaderUtil;
 import org.apache.lucene.util.packed.Direct16;
 import org.apache.lucene.util.packed.Direct32;
 import org.apache.lucene.util.packed.Direct8;
@@ -16,7 +18,6 @@ import org.apache.solr.common.params.Fac
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.schema.FieldType;
 import org.apache.solr.search.DocSet;
-import org.apache.solr.search.SolrIndexReader;
 import org.apache.solr.search.SolrIndexSearcher;
 import org.apache.solr.util.BoundedTreeSet;
 import org.apache.solr.util.ByteUtils;
@@ -60,17 +61,14 @@ class PerSegmentSingleValuedFaceting {
   }
 
 
-  NamedList getFacetCounts(Executor executor) throws IOException {
+  NamedList<Integer> getFacetCounts(Executor executor) throws IOException {
 
     CompletionService<SegFacet> completionService = new ExecutorCompletionService<SegFacet>(executor);
 
     // reuse the translation logic to go from top level set to per-segment set
     baseSet = docs.getTopFilter();
 
-    SolrIndexReader topReader = searcher.getReader();
-    final SolrIndexReader[] leafReaders = topReader.getLeafReaders();
-    int[] offsets = topReader.getLeafOffsets();
-
+    final AtomicReaderContext[] leaves = ReaderUtil.leaves(searcher.getTopReaderContext());
     // The list of pending tasks that aren't immediately submitted
     // TODO: Is there a completion service, or a delegating executor that can
     // limit the number of concurrent tasks submitted to a bigger executor?
@@ -78,8 +76,8 @@ class PerSegmentSingleValuedFaceting {
 
     int threads = nThreads <= 0 ? Integer.MAX_VALUE : nThreads;
 
-    for (int i=0; i<leafReaders.length; i++) {
-      final SegFacet segFacet = new SegFacet(leafReaders[i], offsets[i]);
+    for (int i=0; i<leaves.length; i++) {
+      final SegFacet segFacet = new SegFacet(leaves[i]);
 
       Callable<SegFacet> task = new Callable<SegFacet>() {
         public SegFacet call() throws Exception {
@@ -101,7 +99,7 @@ class PerSegmentSingleValuedFaceting {
     // now merge the per-segment results
     PriorityQueue<SegFacet> queue = new PriorityQueue<SegFacet>() {
       {
-        initialize(leafReaders.length);
+        initialize(leaves.length);
       }
       @Override
       protected boolean lessThan(SegFacet a, SegFacet b) {
@@ -112,7 +110,7 @@ class PerSegmentSingleValuedFaceting {
 
     boolean hasMissingCount=false;
     int missingCount=0;
-    for (int i=0; i<leafReaders.length; i++) {
+    for (int i=0; i<leaves.length; i++) {
       SegFacet seg = null;
 
       try {
@@ -189,7 +187,7 @@ class PerSegmentSingleValuedFaceting {
       if (stop) break;
     }
 
-    NamedList res = collector.getFacetCounts();
+    NamedList<Integer> res = collector.getFacetCounts();
 
     // convert labels to readable form    
     FieldType ft = searcher.getSchema().getFieldType(fieldName);
@@ -209,12 +207,9 @@ class PerSegmentSingleValuedFaceting {
   }
 
   class SegFacet {
-    SolrIndexReader reader;
-    int readerOffset;
-
-    SegFacet(SolrIndexReader reader, int readerOffset) {
-      this.reader = reader;
-      this.readerOffset = readerOffset;
+    AtomicReaderContext context;
+    SegFacet(AtomicReaderContext context) {
+      this.context = context;
     }
     
     FieldCache.DocTermsIndex si;
@@ -228,7 +223,7 @@ class PerSegmentSingleValuedFaceting {
     BytesRef tempBR = new BytesRef();
 
     void countTerms() throws IOException {
-      si = FieldCache.DEFAULT.getTermsIndex(reader, fieldName);
+      si = FieldCache.DEFAULT.getTermsIndex(context.reader, fieldName);
       // SolrCore.log.info("reader= " + reader + "  FC=" + System.identityHashCode(si));
 
       if (prefix!=null) {
@@ -250,7 +245,7 @@ class PerSegmentSingleValuedFaceting {
         // count collection array only needs to be as big as the number of terms we are
         // going to collect counts for.
         final int[] counts = this.counts = new int[nTerms];
-        DocIdSet idSet = baseSet.getDocIdSet(reader);
+        DocIdSet idSet = baseSet.getDocIdSet(context);
         DocIdSetIterator iter = idSet.iterator();
 
 
@@ -324,7 +319,7 @@ class PerSegmentSingleValuedFaceting {
 abstract class FacetCollector {
   /*** return true to stop collection */
   public abstract boolean collect(BytesRef term, int count);
-  public abstract NamedList getFacetCounts();
+  public abstract NamedList<Integer> getFacetCounts();
 }
 
 
@@ -358,8 +353,8 @@ class CountSortedFacetCollector extends 
   }
 
   @Override
-  public NamedList getFacetCounts() {
-    NamedList res = new NamedList();
+  public NamedList<Integer> getFacetCounts() {
+    NamedList<Integer> res = new NamedList<Integer>();
     int off=offset;
     int lim=limit>=0 ? limit : Integer.MAX_VALUE;
      // now select the right page from the results
@@ -377,7 +372,7 @@ class IndexSortedFacetCollector extends 
   int offset;
   int limit;
   final int mincount;
-  final NamedList res = new NamedList();
+  final NamedList<Integer> res = new NamedList<Integer>();
 
 
   public IndexSortedFacetCollector(int offset, int limit, int mincount) {
@@ -406,7 +401,7 @@ class IndexSortedFacetCollector extends 
   }
 
   @Override
-  public NamedList getFacetCounts() {
+  public NamedList<Integer> getFacetCounts() {
     return res;
   }
 }



Mime
View raw message