From 716de67e4450c1d87b6714a61f12e6eba53d7891 Mon Sep 17 00:00:00 2001 From: kimchy Date: Sat, 4 Mar 2006 00:03:43 +0000 Subject: [PATCH] more schema configuration support --- docs/reference/src/core-configuration.xml | 4 +- docs/reference/src/core-introduction.xml | 2 +- running-tests.txt | 2 +- .../org/compass/core/compass-core-config.xsd | 753 ++++++++++++++++-- .../builder/SmartConfigurationBuilder.java | 3 +- .../core/lucene/LuceneEnvironment.java | 2 +- .../compass/core/load/multi/compass.cfg.xml | 2 +- .../compass/core/load/simple/compass.cfg.xml | 2 +- upgrade.txt | 1 + 9 files changed, 686 insertions(+), 85 deletions(-) diff --git a/docs/reference/src/core-configuration.xml b/docs/reference/src/core-configuration.xml index 483dd31b..a3889428 100644 --- a/docs/reference/src/core-configuration.xml +++ b/docs/reference/src/core-configuration.xml @@ -826,7 +826,7 @@ resources, excluding from the index terms that occur further in the resource. Defaults to 10,000 terms. - copmass.engine.useCompoundFile + compass.engine.useCompoundFile Turn on (true) or off (false) the use of compound files. If used lowers the number of files open, but have very small performance overhead. Defaults to true. Note, when compass starts up, it will validate that the current index structure maps the configured setting, and if it is not, it will automatically try and convert it to the correct structure. @@ -1038,7 +1038,7 @@ - Setting file entry handlers is done using the following setting prefix: compass.engine.store.jdbc.fe.[name]. The name can be either default which is used for all unmapped files, it can be the full name of the file stored, or the suffix of the file (the last 3 charecters). Some of the currently supported settings are: + Setting file entry handlers is done using the following setting prefix: compass.engine.store.jdbc.fe.[name]. The name can be either __default__ which is used for all unmapped files, it can be the full name of the file stored, or the suffix of the file (the last 3 charecters). Some of the currently supported settings are: File Entry Handler Settings diff --git a/docs/reference/src/core-introduction.xml b/docs/reference/src/core-introduction.xml index 4c2bbc0d..f7f2e193 100644 --- a/docs/reference/src/core-introduction.xml +++ b/docs/reference/src/core-introduction.xml @@ -8,7 +8,7 @@ - Compass provide access to search engine management functionality and CompassSession's for managing data within the Search Engine. It is created using CompassConfiguration (loads configuration and mappings files). When Compass is created, it will either join an existing index or create a new one if none is available, then instantiates the configured Search Engine Optimizer. After this, an application will use Compass to obtain a CompassSession in order to start managing the data with the Search Engine. Compass is a heavyweight object, usually created at application startup and shared within an application for CopmassSession creation. + Compass provide access to search engine management functionality and CompassSession's for managing data within the Search Engine. It is created using CompassConfiguration (loads configuration and mappings files). When Compass is created, it will either join an existing index or create a new one if none is available, then instantiates the configured Search Engine Optimizer. After this, an application will use Compass to obtain a CompassSession in order to start managing the data with the Search Engine. Compass is a heavyweight object, usually created at application startup and shared within an application for CompassSession creation. diff --git a/running-tests.txt b/running-tests.txt index ebce56ae..2db9529c 100644 --- a/running-tests.txt +++ b/running-tests.txt @@ -16,7 +16,7 @@ compass.engine.store.jdbc.dialect=org.apache.lucene.store.jdbc.dialect.MySQLInno compass.engine.store.jdbc.connection.driverClass=com.mysql.jdbc.Driver compass.engine.store.jdbc.connection.username=root compass.engine.store.jdbc.connection.password= -copmass.engine.useCompoundFile=false +compass.engine.useCompoundFile=false # END TEST PROPERTIES diff --git a/src/main/src/org/compass/core/compass-core-config.xsd b/src/main/src/org/compass/core/compass-core-config.xsd index abb60ec5..c64dedff 100644 --- a/src/main/src/org/compass/core/compass-core-config.xsd +++ b/src/main/src/org/compass/core/compass-core-config.xsd @@ -15,14 +15,25 @@ + + + Configures a Compass instance. + + - + - + + + + The name of the Compass instance. Will be used as the registration name when using Jndi registation. + + + @@ -30,14 +41,14 @@ - - - + + + - + @@ -55,7 +66,7 @@ - + @@ -78,15 +89,20 @@ - - - - - + + + + + + + + Controls the search engine connection. + + @@ -96,171 +112,705 @@ - + + + A file system based index. + + + + + + The path to the index directory. + + + - + + + A file system based index using NIO MMAp Class. Considered slower than the general file system one, but + might have memory benefits (according to the Lucene documentation). + + + + + + The path to the index directory. + + + - + + + Creates a memory based index, follows the Compass life-cycle. Created when the Compass is created, and + disposed when Compass is closed. + + + + + + The logical path of the memory index. (Used to support multiple Compass instances with ram based + index). + + + + + + Uses Jdbc to store the index in a database. + + + + + Configures the Jdbc DataSource provider. + + + + + A simple DataSource provider, with no other dependencies. Returns a new Jdbc + Connection for each getConnection DataSource call. Good for testing, but should not + be used for production since no pooling is performed. + + - - - - - + + + + The Jdbc url for the database connection. + + + + + + + The user name for the database connection. + + + + + + + The password for the database connection. + + + + + + + The driver class of Jdbc. + + + + + + + Sets the auto commit mode for the Jdbc connection. + + + + + + A c3p0 data source provider. Creates a new C3P0 pooled data source. For + extra configuration, use a file called c3p0.properties and storing it as a top-level + resource in the same CLASSPATH / classloader that loads c3p0's jar file. + + - - - - - + + + + The Jdbc url for the database connection. + + + + + + + The user name for the database connection. + + + + + + + The password for the database connection. + + + + + + + The driver class of Jdbc. + + + + + + + Sets the auto commit mode for the Jdbc connection. + + + + + + A Jakarta Commons DBCP connection pool DataSource provider. + + - - - - - + + + + The Jdbc url for the database connection. + + + + + + + The user name for the database connection. + + + + + + + The password for the database connection. + + + + + + + The driver class of Jdbc. + + + + + + + Sets the auto commit mode for the Jdbc connection. + + + + use="optional" default="0"> + + + The default TransactionIsolation state of connections created by this pool. + + + + default="0"> + + + The initial number of connections that are created when the pool is started. + + + - - - + default="0"> + + + The maximum number of active connections that can be allocated from this + pool at the same time, or zero for no limit. + + + + + + + The maximum number of active connections that can remain idle in the pool, + without extra ones being released, or zero for no limit. + + + + + + + The minimum number of active connections that can remain idle in the pool, + without extra ones being created, or 0 to create none. + + + + + + + The maximum number of milliseconds that the pool will wait (when there are + no available connections) for a connection to be returned before throwing an + exception, or -1 to wait indefinitely. + + + + use="optional" default="0"> + + + The maximum number of open statements that can be allocated from the + statement pool at the same time, or zero for no limit. + + + + default="false"> + + + Sets if the pool will cache prepared statements. + + + + + + Uses Jndi to lookup a Jdbc DataSource. If special Jndi configuration is needed, use + the jndi element to set it. + + - - - - + + + + The Jndi lookup value. Will be used to lookup the DataSource. + + + + + + + The user name for the database connection. Optional since most of the time + will be set in Jndi. + + + + + + + The password for the database connection. Optional since most of the time + will be set in Jndi. + + + + + + + Sets the auto commit mode for the Jdbc connection. + + + + + + A data source provider that can use an externally configured DataSource. In order + to set the external DataSource to be used, the + ExternalDataSourceProvider#setDataSource(javax.sql.DataSource) static method needs + to be called before the Compass instance is created. + + - - - + + + + The user name for the database connection. Optional since most of the time + will already be set. + + + + + + + The password for the database connection. Optional since most of the time + will already be set. + + + + + + + Sets the auto commit mode for the Jdbc connection. + + + + + + Control the database schema of the tables that will be created to store the index information. + + + + + The schema definition of the name column. + + - - + + + + The name of the name column. + + + + + + + The length of the name column. + + + + + + The schema definition of the value column. + + - - + + + + The name of the value column. + + + + + + + The length (in K) of the value column (for databases that require it). + + + + + + The schema definition of the size column. + + - + + + + The name of the size column. + + + + + + The schema definition of the last modified column. + + - + + + + The name of the last modified column. + + + + + + The schema definition of the deleted column. + + - + + + + The name of the deleted column. + + + + + + Allows for special configuration of file entries. Most of the times, the __default__ file entry + name will be configured, usually using special bufferSize values for indexInput and bufferSize + and threshold for indexOutput. Note, that Compass alreay comes with sensible defaults for the + file entries. + + + + + Configures a file entry handling strategy. + + + + + Configures the IndexInput settings (applies only for specific + FileEntryHandlers). + + + + + The type of the IndexInput implementation. Allows to configure + one of the implementations that comes with Compass. If not set, + will use the default implementation. + + - - - + + + + An IndexInput implementation, that for every buffer + refill will go and fetch the data from the database. + + + + + + + An IndexInput implementation that will read all the + relevant data from the database when created, and + will cache it untill it is closed. + + + + + + + Caches blobs per transaction. Only supported for + dialects that supports blobs per transaction. + + + - - + + + + For user defined implementation of IndexInput, allows to set the + fully qulified class name of the implementation. + + + + + + + For IndexInput implementation that support it, allows to set the + memory based cached buffer size. A larger value will usually + mean less hits to the database. + + + + + + Configures the IndexOutput settings (applies only for specific + FileEntryHandlers). + + + + + The type of the IndexOutput implementation. Allows to configure + one of the implementations that comes with Compass. If not set, + will use the default implementation. + + - - + + + + An IndexOutput implementation that initially writes + the data to a memory buffer. Once it exceeds the + configured threshold, will start working with a + temporary file, releasing the previous buffer. + + + + + + + An IndexOutput implemenation that stores all the + data written to it in memory, and flushes it to the + database when the output is closed. + + + - - - + + + + For user defined implementation of IndexOutput, allows to set + the fully qulified class name of the implementation. + + + + + + + For IndexOutput implementation that support it, allows to set + the memory based cached buffer size. + + + + + + + Allows to set the threshold for RAMAndFileJdbcIndexOutput. + + + - + + + + Allows to set additonal settings to a FileEntryHanlder. Handy when using + user defined implementations. + + + - + + + + The name can be either __default__ which is used for all unmapped files, it + can be the full name of the file stored, or the suffix of the file (the last + 3 charecters). + + + + + + The type of the file entry handler (implements FileEntryHandler + interface). Allows using one of FileEntryHandler implementations that come + with Compass. + + - - - + + + + A No Operation file entry handler. Performs no actual dirty + operations, and returns empty data for read operations. + + + + + + + Does not delete entries from the database, just marks them for + deletion by updating the deleted column to true. Allows for + registration of IndexInput and IndexOutput handlers. + + + + + + + Removes file entries from the database by deleting the relevant + rows from the database. Allows for registration of IndexInput + and IndexOutput handlers. + + + - + + + + For special user defined implementation of FileEntryHandler, allows to set + the fully qualified class name of the implementation. + + + - - + + + + If the connection is managed or not. Basically, if set to true, compass will commit and rollback the + transaction. If set to false, compass will not perform it. Should be set to true if using external + transaction managers (like JTA or Spring PlatformTransactionManager), and false if using + LocalTransactionFactory. + + + + + + + The fully qualified user defined class name of the implementation of the Dialect class. + + + + + + A dialect allows to work with a specific database. One of Compass intenral provided dialects. + + @@ -279,15 +829,66 @@ - - - + + + + If the system will try to acquire commit lock as well. + + + + + + + Some of the entries in the database are marked as deleted, and not actually gets to be deleted from + the database. The settings controls the delta time of when they should be deleted. They will be + deleted if they were marked for deleted "delta" time ago (base on database time, if possible by + dialect). The value is in milliseconds. + + + + + + + The fully qulified class name of a user defined Lock implementation. + + + + + + A lock strategy implementation using one of Compass provided implementations. + + - - - + + + + A lock based on select...for update. Note, that not all databases support select ... for + update, if the database (dialect) does not support it, a exception will be thrown. Also + note, that when using select for update locking, when the database is created, the + commit and write locks will be created and the select for update will be performed on + them. If one wishes to switch to PhantomReadLock, they must be manually deleted. + + + + + + + A lock based on phantom reads and table level locking. For most database and most + transaction isolation levels this lock is suffecient. The existance of the lock in the + database, marks it as being locked. The benefits of using this lock is the ability to + release it. + + + + + + + A simple no op lock. Performs no locking. + + + diff --git a/src/main/src/org/compass/core/config/builder/SmartConfigurationBuilder.java b/src/main/src/org/compass/core/config/builder/SmartConfigurationBuilder.java index 203f9c73..e637f01a 100644 --- a/src/main/src/org/compass/core/config/builder/SmartConfigurationBuilder.java +++ b/src/main/src/org/compass/core/config/builder/SmartConfigurationBuilder.java @@ -24,7 +24,6 @@ import org.compass.core.config.CompassConfiguration; import org.compass.core.config.CompassEnvironment; import org.compass.core.config.ConfigurationException; -import org.springframework.beans.FatalBeanException; /** * @author kimchy @@ -110,7 +109,7 @@ private int detectValidationMode(InputStream stream, String resourceName) { return (isDtdValidated ? VALIDATION_DTD : VALIDATION_XSD); } catch (IOException ex) { - throw new FatalBeanException( + throw new ConfigurationException( "Unable to determine validation mode for [" + resourceName + "]. Did you attempt to load directly from a SAX InputSource?", ex); } diff --git a/src/main/src/org/compass/core/lucene/LuceneEnvironment.java b/src/main/src/org/compass/core/lucene/LuceneEnvironment.java index cb64a76c..62826695 100644 --- a/src/main/src/org/compass/core/lucene/LuceneEnvironment.java +++ b/src/main/src/org/compass/core/lucene/LuceneEnvironment.java @@ -626,7 +626,7 @@ public static abstract class SearchEngineIndex { * finished. This is done regardless of what directory is in use.

* Default value id true */ - public static final String USE_COMPOUND_FILE = "copmass.engine.useCompoundFile"; + public static final String USE_COMPOUND_FILE = "compass.engine.useCompoundFile"; /** * The maximum number of terms that will be indexed for a single field in a diff --git a/src/main/test/org/compass/core/load/multi/compass.cfg.xml b/src/main/test/org/compass/core/load/multi/compass.cfg.xml index 5e095521..f68cdfda 100644 --- a/src/main/test/org/compass/core/load/multi/compass.cfg.xml +++ b/src/main/test/org/compass/core/load/multi/compass.cfg.xml @@ -55,7 +55,7 @@ false - false + false org.compass.core.lucene.engine.transaction.ReadCommittedTransaction diff --git a/src/main/test/org/compass/core/load/simple/compass.cfg.xml b/src/main/test/org/compass/core/load/simple/compass.cfg.xml index 1fad9266..a7d27960 100644 --- a/src/main/test/org/compass/core/load/simple/compass.cfg.xml +++ b/src/main/test/org/compass/core/load/simple/compass.cfg.xml @@ -48,7 +48,7 @@ false - false + false org.compass.core.lucene.engine.transaction.ReadCommittedTransaction diff --git a/upgrade.txt b/upgrade.txt index 160c27d3..34c19f0d 100644 --- a/upgrade.txt +++ b/upgrade.txt @@ -32,6 +32,7 @@ VERSION 0.9.0 () Compass will try to auto-detect the correct Dialect. 7. compass.transaction.managerLookup is no longer required when using JTA. Compass will try to auto-detect it based on the JTA implementation used. +8. The setting for compound file format was wrongly named, changed to: compass.engine.useCompoundFile. VERSION 0.8.1 (Jan 22, 2006) ============================