public SolrIndexSearcher getSearcher() { if(core == null) return null;//a request for a core admin will no have a core // should this reach out and get a searcher from the core singleton, or // should the core populate one in a factory method to create requests? // or there could be a setSearcher() method that Solr calls if (searcherHolder==null) { searcherHolder = core.getSearcher(); } return searcherHolder.get(); }
/** * Return a registered {@link RefCounted}<{@link SolrIndexSearcher}> with * the reference count incremented. It <b>must</b> be decremented when no longer needed. * This method should not be called from SolrCoreAware.inform() since it can result * in a deadlock if useColdSearcher==false. * If handling a normal request, the searcher should be obtained from * {@link org.apache.solr.request.SolrQueryRequest#getSearcher()} instead. */ public RefCounted<SolrIndexSearcher> getSearcher() { try { return getSearcher(false,true,null); } catch (IOException e) { SolrException.log(log,null,e); return null; } }
private long getIndexVersion(){ RefCounted<SolrIndexSearcher> searcherRef = index.getSearcher(); try { return getIndexVersion(searcherRef.get()); } finally { searcherRef.decref(); } }
/** * Get a reference to the searcher for the required collection. If the collection is * not the same as the search collection, we assume it is under the same Solr instance. * @param rb the response builder holding the facets. * @return a counted reference to the searcher. * @throws SolrException if the collection cannot be found. */ private RefCounted<SolrIndexSearcher> getSearcherReference(ResponseBuilder rb) throws SolrException { RefCounted<SolrIndexSearcher> searcherRef; SolrCore currentCore = rb.req.getCore(); if (StringUtils.isBlank(collection)) { searcherRef = currentCore.getSearcher(); } else { // Using an alternative core - find it SolrCore reqCore = currentCore.getCoreDescriptor().getCoreContainer().getCore(collection); if (reqCore == null) { throw new SolrException(ErrorCode.BAD_REQUEST, "Collection \"" + collection + "\" cannot be found"); } searcherRef = reqCore.getSearcher(); } return searcherRef; }
@Override public void run() { TaggerFstCorpus corpus = null; RefCounted<SolrIndexSearcher> searcherRef = core.getSearcher(); try { SolrIndexSearcher searcher = searcherRef.get();
@Override public void run() { TaggerFstCorpus corpus = null; RefCounted<SolrIndexSearcher> searcherRef = core.getSearcher(); try { SolrIndexSearcher searcher = searcherRef.get();
core.getSearcher(true,false,waitSearcher);
/** * If this {@link IndexConfiguration} is still in sync with the version * of the {@link #getIndex() SolrCore}. This will return true if * <code>{@link #isRuntimeGeneration()} == false </code> * @return <code>true</code> if still active. Otherwise <code>false</code> */ public boolean isCurrent(){ if(!runtimeGeneration){ return true; } else { RefCounted<SolrIndexSearcher> searcherRef = index.getSearcher(); try { long version = searcherRef.get().getIndexReader().getVersion(); return indexVersion == version; } finally { searcherRef.decref(); } } }
RefCounted<SolrIndexSearcher> searcherRef = core.getSearcher(); try { for(FstConfig fstConfig : fstConfigs){
RefCounted<SolrIndexSearcher> searcherRef = core.getSearcher(); try { for(FstConfig fstConfig : fstConfigs){
/** * Updates the configuration based on the current version of the * {@link #getIndex()}. If the SolrCore was not updated this will do * nothing. */ public void update(){ RefCounted<SolrIndexSearcher> searcherRef = index.getSearcher(); try { update(getIndexVersion(searcherRef.get()), searcherRef.get()); } finally { searcherRef.decref(); //decrease the count on the searcher } } /**
RefCounted<SolrIndexSearcher> searcherRef = core.getSearcher(); try { //STANBOL-1177: create FST models in AccessController.doPrivileged(..) final SolrIndexSearcher searcher = searcherRef.get();
private long[] getIndexVersion() { long version[] = new long[2]; RefCounted<SolrIndexSearcher> searcher = core.getSearcher(); try { version[0] = searcher.get().getReader().getIndexCommit().getVersion(); version[1] = searcher.get().getReader().getIndexCommit().getGeneration(); } catch (IOException e) { LOG.warn("Unable to get index version : ", e); } finally { searcher.decref(); } return version; }
public int getNumberOfSegments() { return this.getCore().getSearcher().get().getIndexReader().leaves().size(); }
public int getNumberOfSegments() { return this.getCore().getSearcher().get().getIndexReader().leaves().size(); }
core.getSearcher(true,false,waitSearcher);
getSearcher(false,false,null);
this.config = config; searcherRef = config.getIndex().getSearcher(); SolrIndexSearcher searcher = searcherRef.get(); DirectoryReader indexReader = searcher.getIndexReader();
protected NamedList<Object> getCoreStatus(CoreContainer cores, String cname) throws IOException { NamedList<Object> info = new SimpleOrderedMap<Object>(); SolrCore core = cores.getCore(cname); if (core != null) { try { info.add("name", core.getName()); info.add("instanceDir", normalizePath(core.getResourceLoader().getInstanceDir())); info.add("dataDir", normalizePath(core.getDataDir())); info.add("startTime", new Date(core.getStartTime())); info.add("uptime", System.currentTimeMillis() - core.getStartTime()); RefCounted<SolrIndexSearcher> searcher = core.getSearcher(); try { info.add("index", LukeRequestHandler.getIndexInfo(searcher.get().getReader(), false)); } finally { searcher.decref(); } } finally { core.close(); } } return info; }