2013-11-21 16 views
11

はここに私のsolrconfig.xmlファイルからデフォルト設定ですか?もしそうなら、私はタグを完全に削除しても同じ結果になるでしょうか?私が手動でソフトコミットをしなければならない場合は、 'commitWithin'でこれを行うことができますか(私はこれをGoogleで検索しましたが、矛盾する回答があります)。

ああ、私はSolrの4.5.0

答えて

16

まずオフを使用している、あなたは、タグ内の式${solr.autoSoftCommit.maxTime:-1}を見ることができます。これにより、Solrの変数置換を利用することができます。その特徴は、詳細にはhere in the referenceで説明されています。その変数がこれらの手段のいずれかに置き換えられていない場合は、その構成の値として取られます。

commitMaxTimeを-1に設定すると、は効果的に自動コミットをオフにします。以下の関連するコードを見ると、の値がcommitMaxTimeであれば、scheduleCommitWithinメソッドがすぐに戻りますので、それが無効であることがわかります。私はこの動作が文書化されていないことを発見したので、コードを調べました。

private void _scheduleCommitWithin(long commitMaxTime) { 
    if (commitMaxTime <= 0) return; 
    synchronized (this) { 
     if (pending != null && pending.getDelay(TimeUnit.MILLISECONDS) <= commitMaxTime) { 
     // There is already a pending commit that will happen first, so 
     // nothing else to do here. 
     // log.info("###returning since getDelay()==" + pending.getDelay(TimeUnit.MILLISECONDS) + " less than " + commitMaxTime); 

     return; 
     } 

     if (pending != null) { 
     // we need to schedule a commit to happen sooner than the existing one, 
     // so lets try to cancel the existing one first. 
     boolean canceled = pending.cancel(false); 
     if (!canceled) { 
      // It looks like we can't cancel... it must have just started running! 
      // this is possible due to thread scheduling delays and a low commitMaxTime. 
      // Nothing else to do since we obviously can't schedule our commit *before* 
      // the one that just started running (or has just completed). 
      // log.info("###returning since cancel failed"); 
      return; 
     } 
     } 

     // log.info("###scheduling for " + commitMaxTime); 

     // schedule our new commit 
     pending = scheduler.schedule(this, commitMaxTime, TimeUnit.MILLISECONDS); 
    } 
} 

あなたがこの値を-1に設定した場合と同じ結果になりますすべて一緒タグを削除場合は、あなたの質問の後半部分にhttps://github.com/apache/lucene-solr/blob/lucene_solr_4_5/solr/core/src/java/org/apache/solr/update/CommitTracker.java

から撮影。下記のように、xpath式がnullを返すと、デフォルト値として-1が返されます。

ただし、構成から式全体を削除すると、Solrの変数置換によってその構成を上書きするオプションも削除されます。 https://github.com/apache/lucene-solr/blob/lucene_solr_4_5/solr/core/src/java/org/apache/solr/core/SolrConfig.java

から撮影

protected UpdateHandlerInfo loadUpdatehandlerInfo() { 
    return new UpdateHandlerInfo(get("updateHandler/@class",null), 
    getInt("updateHandler/autoCommit/maxDocs",-1), 
    getInt("updateHandler/autoCommit/maxTime",-1), 
    getBool("updateHandler/autoCommit/openSearcher",true), 
    getInt("updateHandler/commitIntervalLowerBound",-1), 
    getInt("updateHandler/autoSoftCommit/maxDocs",-1), 
    getInt("updateHandler/autoSoftCommit/maxTime",-1), 
    getBool("updateHandler/commitWithin/softCommit",true)); 
} 

関連する問題