Author: epbernard
Date: 2007-07-31 13:41:01 -0400 (Tue, 31 Jul 2007)
New Revision: 12868
Modified:
trunk/HibernateExt/search/src/java/org/hibernate/search/backend/LuceneIndexingParameters.java
trunk/HibernateExt/search/src/java/org/hibernate/search/backend/Workspace.java
trunk/HibernateExt/search/src/java/org/hibernate/search/store/DirectoryProviderFactory.java
trunk/HibernateExt/search/src/test/org/hibernate/search/test/SearchTestCase.java
Log:
HSEARCH-67 class lucene indexing prperties by transaction and batch
Modified:
trunk/HibernateExt/search/src/java/org/hibernate/search/backend/LuceneIndexingParameters.java
===================================================================
---
trunk/HibernateExt/search/src/java/org/hibernate/search/backend/LuceneIndexingParameters.java 2007-07-31
16:55:45 UTC (rev 12867)
+++
trunk/HibernateExt/search/src/java/org/hibernate/search/backend/LuceneIndexingParameters.java 2007-07-31
17:41:01 UTC (rev 12868)
@@ -12,11 +12,11 @@
*/
public class LuceneIndexingParameters {
- private int mergeFactor = 10;
+ private int transactionMergeFactor = 10;
- private int maxMergeDocs = Integer.MAX_VALUE;
+ private int transactionMaxMergeDocs = Integer.MAX_VALUE;
- private int maxBufferedDocs = 10;
+ private int transactionMaxBufferedDocs = 10;
private int batchMergeFactor = 10;
@@ -35,28 +35,28 @@
* Constructor which instantiates a new parameter object with the the default values.
*/
public LuceneIndexingParameters() {
- mergeFactor = DEFAULT_MERGE_FACTOR;
+ transactionMergeFactor = DEFAULT_MERGE_FACTOR;
batchMergeFactor = DEFAULT_MERGE_FACTOR;
- maxMergeDocs = DEFAULT_MAX_MERGE_DOCS;
+ transactionMaxMergeDocs = DEFAULT_MAX_MERGE_DOCS;
batchMaxMergeDocs = DEFAULT_MAX_MERGE_DOCS;
- maxBufferedDocs = DEFAULT_MAX_BUFFERED_DOCS;
+ transactionMaxBufferedDocs = DEFAULT_MAX_BUFFERED_DOCS;
batchMaxBufferedDocs = DEFAULT_MAX_BUFFERED_DOCS;
}
- public int getMaxMergeDocs() {
- return maxMergeDocs;
+ public int getTransactionMaxMergeDocs() {
+ return transactionMaxMergeDocs;
}
- public void setMaxMergeDocs(int maxMergeDocs) {
- this.maxMergeDocs = maxMergeDocs;
+ public void setTransactionMaxMergeDocs(int transactionMaxMergeDocs) {
+ this.transactionMaxMergeDocs = transactionMaxMergeDocs;
}
- public int getMergeFactor() {
- return mergeFactor;
+ public int getTransactionMergeFactor() {
+ return transactionMergeFactor;
}
- public void setMergeFactor(int mergeFactor) {
- this.mergeFactor = mergeFactor;
+ public void setTransactionMergeFactor(int transactionMergeFactor) {
+ this.transactionMergeFactor = transactionMergeFactor;
}
public int getBatchMaxMergeDocs() {
@@ -83,11 +83,11 @@
this.batchMaxBufferedDocs = batchMaxBufferedDocs;
}
- public int getMaxBufferedDocs() {
- return maxBufferedDocs;
+ public int getTransactionMaxBufferedDocs() {
+ return transactionMaxBufferedDocs;
}
- public void setMaxBufferedDocs(int maxBufferedDocs) {
- this.maxBufferedDocs = maxBufferedDocs;
+ public void setTransactionMaxBufferedDocs(int transactionMaxBufferedDocs) {
+ this.transactionMaxBufferedDocs = transactionMaxBufferedDocs;
}
}
Modified: trunk/HibernateExt/search/src/java/org/hibernate/search/backend/Workspace.java
===================================================================
---
trunk/HibernateExt/search/src/java/org/hibernate/search/backend/Workspace.java 2007-07-31
16:55:45 UTC (rev 12867)
+++
trunk/HibernateExt/search/src/java/org/hibernate/search/backend/Workspace.java 2007-07-31
17:41:01 UTC (rev 12868)
@@ -124,9 +124,9 @@
writer.setMaxBufferedDocs( indexingParams.getBatchMaxBufferedDocs() );
}
else {
- writer.setMergeFactor( indexingParams.getMergeFactor() );
- writer.setMaxMergeDocs( indexingParams.getMaxMergeDocs() );
- writer.setMaxBufferedDocs( indexingParams.getMaxBufferedDocs() );
+ writer.setMergeFactor( indexingParams.getTransactionMergeFactor() );
+ writer.setMaxMergeDocs( indexingParams.getTransactionMaxMergeDocs() );
+ writer.setMaxBufferedDocs( indexingParams.getTransactionMaxBufferedDocs() );
}
writers.put( provider, writer );
Modified:
trunk/HibernateExt/search/src/java/org/hibernate/search/store/DirectoryProviderFactory.java
===================================================================
---
trunk/HibernateExt/search/src/java/org/hibernate/search/store/DirectoryProviderFactory.java 2007-07-31
16:55:45 UTC (rev 12867)
+++
trunk/HibernateExt/search/src/java/org/hibernate/search/store/DirectoryProviderFactory.java 2007-07-31
17:41:01 UTC (rev 12868)
@@ -53,9 +53,8 @@
private static final String MERGE_FACTOR = "merge_factor";
private static final String MAX_MERGE_DOCS = "max_merge_docs";
private static final String MAX_BUFFERED_DOCS = "max_buffered_docs";
- private static final String BATCH_MERGE_FACTOR = "merge_factor.batch";
- private static final String BATCH_MAX_MERGE_DOCS = "max_merge_docs.batch";
- private static final String BATCH_MAX_BUFFERED_DOCS =
"max_buffered_docs.batch";
+ private static final String BATCH = "batch.";
+ private static final String TRANSACTION = "transaction.";
private static final String SHARDING_STRATEGY = "sharding_strategy";
private static final String NBR_OF_SHARDS = SHARDING_STRATEGY +
".nbr_of_shards";
@@ -189,61 +188,61 @@
private void configureIndexingParameters(SearchFactoryImplementor
searchFactoryImplementor, Properties indexProps, DirectoryProvider<?> provider) {
LuceneIndexingParameters indexingParams = new LuceneIndexingParameters();
- String s = indexProps.getProperty(MERGE_FACTOR);
+ String s = indexProps.getProperty(TRANSACTION + MERGE_FACTOR);
if (!StringHelper.isEmpty( s )) {
try{
- indexingParams.setMergeFactor(Integer.valueOf(s));
+ indexingParams.setTransactionMergeFactor(Integer.valueOf(s));
indexingParams.setBatchMergeFactor(Integer.valueOf(s));
} catch (NumberFormatException ne) {
- throw new HibernateException("Invalid value for " + MERGE_FACTOR + ":
" + s);
+ throw new SearchException("Invalid value for " + TRANSACTION + MERGE_FACTOR
+ ": " + s);
}
}
- s = indexProps.getProperty(MAX_MERGE_DOCS);
+ s = indexProps.getProperty(TRANSACTION + MAX_MERGE_DOCS);
if (!StringHelper.isEmpty( s )) {
try{
- indexingParams.setMaxMergeDocs(Integer.valueOf(s));
+ indexingParams.setTransactionMaxMergeDocs(Integer.valueOf(s));
indexingParams.setBatchMaxMergeDocs(Integer.valueOf(s));
} catch (NumberFormatException ne) {
- throw new HibernateException("Invalid value for " + MAX_MERGE_DOCS +
": " + s);
+ throw new SearchException("Invalid value for " + TRANSACTION +
MAX_MERGE_DOCS + ": " + s);
}
}
- s = indexProps.getProperty(MAX_BUFFERED_DOCS);
+ s = indexProps.getProperty(TRANSACTION + MAX_BUFFERED_DOCS);
if (!StringHelper.isEmpty( s )) {
try{
- indexingParams.setMaxBufferedDocs(Integer.valueOf(s));
+ indexingParams.setTransactionMaxBufferedDocs(Integer.valueOf(s));
indexingParams.setBatchMaxBufferedDocs(Integer.valueOf(s));
} catch (NumberFormatException ne) {
- throw new HibernateException("Invalid value for " + MAX_BUFFERED_DOCS +
": " + s);
+ throw new SearchException("Invalid value for " + TRANSACTION +
MAX_BUFFERED_DOCS + ": " + s);
}
}
- s = indexProps.getProperty(BATCH_MERGE_FACTOR);
+ s = indexProps.getProperty(BATCH + MERGE_FACTOR);
if (!StringHelper.isEmpty( s )) {
try{
indexingParams.setBatchMergeFactor(Integer.valueOf(s));
} catch (NumberFormatException ne) {
- throw new HibernateException("Invalid value for " + BATCH_MERGE_FACTOR +
": " + s);
+ throw new SearchException("Invalid value for " + BATCH + MERGE_FACTOR +
": " + s);
}
}
- s = indexProps.getProperty(BATCH_MAX_MERGE_DOCS);
+ s = indexProps.getProperty(BATCH + MAX_MERGE_DOCS);
if (!StringHelper.isEmpty( s )) {
try{
indexingParams.setBatchMaxMergeDocs(Integer.valueOf(s));
} catch (NumberFormatException ne) {
- throw new HibernateException("Invalid value for " + BATCH_MAX_MERGE_DOCS +
": " + s);
+ throw new SearchException("Invalid value for " + BATCH + MAX_MERGE_DOCS +
": " + s);
}
}
- s = indexProps.getProperty(BATCH_MAX_BUFFERED_DOCS);
+ s = indexProps.getProperty(BATCH + MAX_BUFFERED_DOCS);
if (!StringHelper.isEmpty( s )) {
try{
indexingParams.setBatchMaxBufferedDocs(Integer.valueOf(s));
} catch (NumberFormatException ne) {
- throw new HibernateException("Invalid value for " + BATCH_MAX_BUFFERED_DOCS
+ ": " + s);
+ throw new SearchException("Invalid value for " + BATCH + MAX_BUFFERED_DOCS
+ ": " + s);
}
}
searchFactoryImplementor.addIndexingParmeters(provider, indexingParams);
Modified:
trunk/HibernateExt/search/src/test/org/hibernate/search/test/SearchTestCase.java
===================================================================
---
trunk/HibernateExt/search/src/test/org/hibernate/search/test/SearchTestCase.java 2007-07-31
16:55:45 UTC (rev 12867)
+++
trunk/HibernateExt/search/src/test/org/hibernate/search/test/SearchTestCase.java 2007-07-31
17:41:01 UTC (rev 12868)
@@ -40,7 +40,7 @@
protected void configure(org.hibernate.cfg.Configuration cfg) {
cfg.setProperty( "hibernate.search.default.directory_provider",
RAMDirectoryProvider.class.getName() );
cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
- cfg.setProperty( "hibernate.search.default.merge_factor", "100" );
- cfg.setProperty( "hibernate.search.default.max_buffered_docs",
"1000" );
+ cfg.setProperty( "hibernate.search.default.transaction.merge_factor",
"100" );
+ cfg.setProperty( "hibernate.search.default.batch.max_buffered_docs",
"1000" );
}
}
Show replies by date