org.apache.solr.core
Class SolrCore

java.lang.Object
  extended by org.apache.solr.core.SolrCore

public final class SolrCore
extends Object

Version:
$Id: SolrCore.java 487199 2006-12-14 13:03:40Z bdelacretaz $
Author:
yonik, Mike Baranczak

Field Summary
static Logger log
           
static SolrIndexConfig mainIndexConfig
           
static String version
           
 
Constructor Summary
SolrCore(String dataDir, IndexSchema schema)
           
 
Method Summary
 void close()
           
 void closeSearcher()
           
 void execute(SolrQueryRequest req, SolrQueryResponse rsp)
           
 String getDataDir()
           
 String getIndexDir()
           
 QueryResponseWriter getQueryResponseWriter(SolrQueryRequest request)
          Returns the appropriate writer for a request.
 QueryResponseWriter getQueryResponseWriter(String writerName)
          Finds a writer by name, or returns the default writer if not found.
 SolrRequestHandler getRequestHandler(String handlerName)
           
 IndexSchema getSchema()
           
 RefCounted<SolrIndexSearcher> getSearcher()
           
 RefCounted<SolrIndexSearcher> getSearcher(boolean forceNew, boolean returnSearcher, Future[] waitSearcher)
          Get a SolrIndexSearcher or start the process of creating a new one.
static SolrCore getSolrCore()
           
 long getStartTime()
           
static void log(Throwable e)
           
 SolrIndexSearcher newSearcher(String name)
           
static List<SolrEventListener> parseListener(String path)
           
protected  void setResponseHeaderValues(NamedList responseHeader, SolrQueryRequest req, SolrQueryResponse rsp)
           
 void update(Reader reader, Writer writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version

public static final String version
See Also:
Constant Field Values

log

public static Logger log

mainIndexConfig

public static SolrIndexConfig mainIndexConfig
Constructor Detail

SolrCore

public SolrCore(String dataDir,
                IndexSchema schema)
Method Detail

getStartTime

public long getStartTime()

parseListener

public static List<SolrEventListener> parseListener(String path)

getSchema

public IndexSchema getSchema()

getDataDir

public String getDataDir()

getIndexDir

public String getIndexDir()

getRequestHandler

public SolrRequestHandler getRequestHandler(String handlerName)

newSearcher

public SolrIndexSearcher newSearcher(String name)
                              throws IOException
Throws:
IOException

getSolrCore

public static SolrCore getSolrCore()

close

public void close()

getSearcher

public RefCounted<SolrIndexSearcher> getSearcher()

getSearcher

public RefCounted<SolrIndexSearcher> getSearcher(boolean forceNew,
                                                 boolean returnSearcher,
                                                 Future[] waitSearcher)
                                          throws IOException
Get a SolrIndexSearcher or start the process of creating a new one.

The registered searcher is the default searcher used to service queries. A searcher will normally be registered after all of the warming and event handlers (newSearcher or firstSearcher events) have run. In the case where there is no registered searcher, the newly created searcher will be registered before running the event handlers (a slow searcher is better than no searcher).

If forceNew==true then A new searcher will be opened and registered regardless of whether there is already a registered searcher or other searchers in the process of being created.

If forceNew==false then:

If returnSearcher==true then a RefCounted<SolrIndexSearcher> will be returned with the reference count incremented. It must be decremented when no longer needed.

If waitSearcher!=null and a new SolrIndexSearcher was created, then it is filled in with a Future that will return after the searcher is registered. The Future may be set to null in which case the SolrIndexSearcher created has already been registered at the time this method returned.

Parameters:
forceNew - if true, force the open of a new index searcher regardless if there is already one open.
returnSearcher - if true, returns a SolrIndexSearcher holder with the refcount already incremented.
waitSearcher - if non-null, will be filled in with a Future that will return after the new searcher is registered.
Throws:
IOException

closeSearcher

public void closeSearcher()

execute

public void execute(SolrQueryRequest req,
                    SolrQueryResponse rsp)

setResponseHeaderValues

protected void setResponseHeaderValues(NamedList responseHeader,
                                       SolrQueryRequest req,
                                       SolrQueryResponse rsp)

update

public void update(Reader reader,
                   Writer writer)

log

public static final void log(Throwable e)

getQueryResponseWriter

public final QueryResponseWriter getQueryResponseWriter(String writerName)
Finds a writer by name, or returns the default writer if not found.


getQueryResponseWriter

public final QueryResponseWriter getQueryResponseWriter(SolrQueryRequest request)
Returns the appropriate writer for a request. If the request specifies a writer via the 'wt' parameter, attempts to find that one; otherwise return the default writer.



Copyright © 2006 - 2006 The Apache Software Foundation