r785 - in trunk: . wikitty-jdbc wikitty-jdbc/src/main/java/org/nuiton/wikitty/services wikitty-jdbc-impl wikitty-solr wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr wikitty-solr/src/main/resources wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr wikitty-solr-impl
Author: jcouteau Date: 2011-04-12 10:41:03 +0200 (Tue, 12 Apr 2011) New Revision: 785 Url: http://nuiton.org/repositories/revision/wikitty/785 Log: Evolution #1320: remove '-impl' suffix on module name - SOLR and JDBC ok Added: trunk/wikitty-jdbc/ trunk/wikitty-jdbc/src/main/java/org/nuiton/wikitty/services/WikittyServiceInMemoryJdbcSolr.java trunk/wikitty-solr/ trunk/wikitty-solr/pom.xml trunk/wikitty-solr/src/main/resources/schema.xml trunk/wikitty-solr/src/main/resources/solrconfig.xml trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/SolrSearch2Test.java trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/TreeTest.java Removed: trunk/wikitty-jdbc-impl/LICENSE.txt trunk/wikitty-jdbc-impl/README.txt trunk/wikitty-jdbc-impl/changelog.txt trunk/wikitty-jdbc-impl/pom.xml trunk/wikitty-jdbc-impl/src/ trunk/wikitty-jdbc/src/main/java/org/nuiton/wikitty/services/WikittyServiceInMemoryJdbcSolr.java trunk/wikitty-solr-impl/LICENSE.txt trunk/wikitty-solr-impl/README.txt trunk/wikitty-solr-impl/changelog.txt trunk/wikitty-solr-impl/pom.xml trunk/wikitty-solr-impl/src/ trunk/wikitty-solr/pom.xml trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/RAMDirectoryFactory.java trunk/wikitty-solr/src/main/resources/schema.xml trunk/wikitty-solr/src/main/resources/solrconfig.xml trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/SolrSearch2Test.java trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/TreeTest.java Modified: trunk/pom.xml trunk/wikitty-jdbc/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2011-04-12 08:26:26 UTC (rev 784) +++ trunk/pom.xml 2011-04-12 08:41:03 UTC (rev 785) @@ -22,8 +22,8 @@ <module>wikitty-generators</module> <module>wikitty-api</module> <module>wikitty-dto</module> - <module>wikitty-solr-impl</module> - <module>wikitty-jdbc-impl</module> + <module>wikitty-solr</module> + <module>wikitty-jdbc</module> <module>wikitty-hessian-client</module> <module>wikitty-hessian-server</module> Modified: trunk/wikitty-jdbc/pom.xml =================================================================== --- trunk/wikitty-jdbc-impl/pom.xml 2011-04-11 16:02:52 UTC (rev 783) +++ trunk/wikitty-jdbc/pom.xml 2011-04-12 08:41:03 UTC (rev 785) @@ -10,7 +10,7 @@ </parent> <groupId>org.nuiton.wikitty</groupId> - <artifactId>wikitty-jdbc-impl</artifactId> + <artifactId>wikitty-jdbc</artifactId> <dependencies> @@ -90,7 +90,7 @@ <!-- ************************************************************* --> <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>Wikitty :: wikitty-jdbc-impl</name> + <name>Wikitty :: wikitty-jdbc</name> <description>Wikitty jdbc storage</description> <inceptionYear>2009</inceptionYear> </project> Deleted: trunk/wikitty-jdbc/src/main/java/org/nuiton/wikitty/services/WikittyServiceInMemoryJdbcSolr.java =================================================================== --- trunk/wikitty-jdbc-impl/src/main/java/org/nuiton/wikitty/services/WikittyServiceInMemoryJdbcSolr.java 2011-04-11 16:02:52 UTC (rev 783) +++ trunk/wikitty-jdbc/src/main/java/org/nuiton/wikitty/services/WikittyServiceInMemoryJdbcSolr.java 2011-04-12 08:41:03 UTC (rev 785) @@ -1,80 +0,0 @@ -/* - * #%L - * Wikitty :: wikitty-jdbc-impl - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 CodeLutin, Benjamin Poussin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ -package org.nuiton.wikitty.services; - - -import java.io.File; -import java.util.UUID; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.util.ApplicationConfig; -import org.nuiton.wikitty.WikittyConfig; -import org.nuiton.wikitty.jdbc.WikittyExtensionStorageJDBC; -import org.nuiton.wikitty.jdbc.WikittyStorageJDBC; -import org.nuiton.wikitty.storage.solr.RAMDirectoryFactory; -import org.nuiton.wikitty.storage.solr.WikittySearchEngineSolr; - -/** - * In memory implementation that use in memory h2 and in memory solr - * - * @author poussin - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ - */ -public class WikittyServiceInMemoryJdbcSolr extends WikittyServiceStorage { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private Log log = LogFactory.getLog(WikittyServiceInMemoryJdbcSolr.class); - - public WikittyServiceInMemoryJdbcSolr() { - super(null, null, null); - - // we use unique db name (this permit to use simultaneously many - // WikittyServiceInMemoryJdbcSolr) - String dbName = "wikitty-tx-" + UUID.randomUUID().toString(); - ApplicationConfig config = new WikittyConfig(); - config.setOption(WikittyConfig.WikittyOption. - WIKITTY_STORAGE_JDBC_URL.getKey(), - "jdbc:h2:mem:" + dbName); - // solr meme en RAMDirectoryFactory peut creer des fichiers si - // la config est mauvaise, pour prevenir tous problemes on fixe un - // repertoire unique si jamais ca arrive pour eviter les problemes - config.setOption(WikittyConfig.WikittyOption.WIKITTY_DATA_DIR.getKey(), - config.getOption("java.io.tmpdir") + File.separator + dbName); - config.setOption(WikittyConfig.WikittyOption. - WIKITTY_SEARCHENGINE_SOLR_DIRECTORY_FACTORY.getKey(), - RAMDirectoryFactory.class.getName()); - // others defaults value in config normaly is correct - // - WIKITTY_STORAGE_JDBC* - // - WIKITTY_STORAGE_JDBC_XADATASOURCE* - - extensionStorage = new WikittyExtensionStorageJDBC(config); - wikittyStorage = new WikittyStorageJDBC(config, extensionStorage); - searchEngine = new WikittySearchEngineSolr(config, extensionStorage); - } - -} Copied: trunk/wikitty-jdbc/src/main/java/org/nuiton/wikitty/services/WikittyServiceInMemoryJdbcSolr.java (from rev 784, trunk/wikitty-jdbc-impl/src/main/java/org/nuiton/wikitty/services/WikittyServiceInMemoryJdbcSolr.java) =================================================================== --- trunk/wikitty-jdbc/src/main/java/org/nuiton/wikitty/services/WikittyServiceInMemoryJdbcSolr.java (rev 0) +++ trunk/wikitty-jdbc/src/main/java/org/nuiton/wikitty/services/WikittyServiceInMemoryJdbcSolr.java 2011-04-12 08:41:03 UTC (rev 785) @@ -0,0 +1,80 @@ +/* + * #%L + * Wikitty :: wikitty-jdbc-impl + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2010 CodeLutin, Benjamin Poussin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +package org.nuiton.wikitty.services; + + +import java.io.File; +import java.util.UUID; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.solr.core.RAMDirectoryFactory; +import org.nuiton.util.ApplicationConfig; +import org.nuiton.wikitty.WikittyConfig; +import org.nuiton.wikitty.jdbc.WikittyExtensionStorageJDBC; +import org.nuiton.wikitty.jdbc.WikittyStorageJDBC; +import org.nuiton.wikitty.storage.solr.WikittySearchEngineSolr; + +/** + * In memory implementation that use in memory h2 and in memory solr + * + * @author poussin + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ +public class WikittyServiceInMemoryJdbcSolr extends WikittyServiceStorage { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Log log = LogFactory.getLog(WikittyServiceInMemoryJdbcSolr.class); + + public WikittyServiceInMemoryJdbcSolr() { + super(null, null, null); + + // we use unique db name (this permit to use simultaneously many + // WikittyServiceInMemoryJdbcSolr) + String dbName = "wikitty-tx-" + UUID.randomUUID().toString(); + ApplicationConfig config = new WikittyConfig(); + config.setOption(WikittyConfig.WikittyOption. + WIKITTY_STORAGE_JDBC_URL.getKey(), + "jdbc:h2:mem:" + dbName); + // solr meme en RAMDirectoryFactory peut creer des fichiers si + // la config est mauvaise, pour prevenir tous problemes on fixe un + // repertoire unique si jamais ca arrive pour eviter les problemes + config.setOption(WikittyConfig.WikittyOption.WIKITTY_DATA_DIR.getKey(), + config.getOption("java.io.tmpdir") + File.separator + dbName); + config.setOption(WikittyConfig.WikittyOption. + WIKITTY_SEARCHENGINE_SOLR_DIRECTORY_FACTORY.getKey(), + RAMDirectoryFactory.class.getName()); + // others defaults value in config normaly is correct + // - WIKITTY_STORAGE_JDBC* + // - WIKITTY_STORAGE_JDBC_XADATASOURCE* + + extensionStorage = new WikittyExtensionStorageJDBC(config); + wikittyStorage = new WikittyStorageJDBC(config, extensionStorage); + searchEngine = new WikittySearchEngineSolr(config, extensionStorage); + } + +} Deleted: trunk/wikitty-jdbc-impl/LICENSE.txt =================================================================== --- trunk/wikitty-jdbc-impl/LICENSE.txt 2011-04-12 08:26:26 UTC (rev 784) +++ trunk/wikitty-jdbc-impl/LICENSE.txt 2011-04-12 08:41:03 UTC (rev 785) @@ -1,166 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. - Deleted: trunk/wikitty-jdbc-impl/pom.xml =================================================================== --- trunk/wikitty-jdbc-impl/pom.xml 2011-04-12 08:26:26 UTC (rev 784) +++ trunk/wikitty-jdbc-impl/pom.xml 2011-04-12 08:41:03 UTC (rev 785) @@ -1,97 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.nuiton</groupId> - <artifactId>wikitty</artifactId> - <version>3.1-SNAPSHOT</version> - </parent> - - <groupId>org.nuiton.wikitty</groupId> - <artifactId>wikitty-jdbc-impl</artifactId> - - <dependencies> - - <!-- sibling dependencies --> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>wikitty-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>wikitty-solr-impl</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>wikitty-api</artifactId> - <version>${project.version}</version> - <classifier>tests</classifier> - <scope>test</scope> - </dependency> - - <!-- TEST --> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </dependency> - - <dependency> - <groupId>commons-dbcp</groupId> - <artifactId>commons-dbcp</artifactId> - </dependency> - <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils</artifactId> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - </dependency> - - <dependency> - <groupId>javax.transaction</groupId> - <artifactId>jta</artifactId> - </dependency> - - <dependency> - <groupId>jboss.jbossts</groupId> - <artifactId>jbossjta</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-utils</artifactId> - </dependency> - - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - </dependency> - - <dependency> - <groupId>postgresql</groupId> - <artifactId>postgresql</artifactId> - <scope>test</scope> - </dependency> - - </dependencies> - - <!-- ************************************************************* --> - <!-- *** Project Information ************************************* --> - <!-- ************************************************************* --> - <name>Wikitty :: wikitty-jdbc-impl</name> - <description>Wikitty jdbc storage</description> - <inceptionYear>2009</inceptionYear> -</project> - Deleted: trunk/wikitty-solr/pom.xml =================================================================== --- trunk/wikitty-solr-impl/pom.xml 2011-04-11 16:02:52 UTC (rev 783) +++ trunk/wikitty-solr/pom.xml 2011-04-12 08:41:03 UTC (rev 785) @@ -1,103 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.nuiton</groupId> - <artifactId>wikitty</artifactId> - <version>3.1-SNAPSHOT</version> - </parent> - - <!-- ************************************************************* --> - <!-- *** POM Relationships *************************************** --> - <!-- ************************************************************* --> - - <groupId>org.nuiton.wikitty</groupId> - <artifactId>wikitty-solr-impl</artifactId> - - <dependencies> - - <!-- sibling dependencies --> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>wikitty-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>wikitty-api</artifactId> - <version>${project.version}</version> - <classifier>tests</classifier> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>jboss.jbossts</groupId> - <artifactId>jbossjta</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-utils</artifactId> - </dependency> - - <!-- SOLR --> - <dependency> - <groupId>org.apache.solr</groupId> - <artifactId>solr-core</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.solr</groupId> - <artifactId>solr-solrj</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-core</artifactId> - </dependency> - - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - </dependency> - - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </dependency> - - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - </dependency> - - <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - </dependency> - <!-- TEST --> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - - </dependencies> - - <!-- ************************************************************* --> - <!-- *** Project Information ************************************* --> - <!-- ************************************************************* --> - - <name>Wikitty :: wikitty-solr-impl</name> - - <description>Wikiity solr search engine</description> - <inceptionYear>2009</inceptionYear> -</project> - Copied: trunk/wikitty-solr/pom.xml (from rev 784, trunk/wikitty-solr-impl/pom.xml) =================================================================== --- trunk/wikitty-solr/pom.xml (rev 0) +++ trunk/wikitty-solr/pom.xml 2011-04-12 08:41:03 UTC (rev 785) @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.nuiton</groupId> + <artifactId>wikitty</artifactId> + <version>3.1-SNAPSHOT</version> + </parent> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + + <groupId>org.nuiton.wikitty</groupId> + <artifactId>wikitty-solr</artifactId> + + <dependencies> + + <!-- sibling dependencies --> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>wikitty-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>wikitty-api</artifactId> + <version>${project.version}</version> + <classifier>tests</classifier> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>jboss.jbossts</groupId> + <artifactId>jbossjta</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>nuiton-utils</artifactId> + </dependency> + + <!-- SOLR --> + <dependency> + <groupId>org.apache.solr</groupId> + <artifactId>solr-core</artifactId> + <exclusions> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-jdk14</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.solr</groupId> + <artifactId>solr-solrj</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-core</artifactId> + </dependency> + + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + </dependency> + + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </dependency> + + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + </dependency> + + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + </dependency> + <!-- TEST --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + + </dependencies> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + + <name>Wikitty :: wikitty-solr</name> + + <description>Wikiity solr search engine</description> + <inceptionYear>2009</inceptionYear> +</project> + Deleted: trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/RAMDirectoryFactory.java =================================================================== --- trunk/wikitty-solr-impl/src/main/java/org/nuiton/wikitty/storage/solr/RAMDirectoryFactory.java 2011-04-11 16:02:52 UTC (rev 783) +++ trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/RAMDirectoryFactory.java 2011-04-12 08:41:03 UTC (rev 785) @@ -1,143 +0,0 @@ -/** - * %%Ignore-License - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.nuiton.wikitty.storage.solr; - -import java.io.File; -import java.util.HashMap; -import java.util.Map; -import org.apache.lucene.store.LockFactory; - -import org.apache.solr.core.StandardDirectoryFactory; -import java.io.IOException; -import java.util.concurrent.atomic.AtomicInteger; - -import org.apache.lucene.store.Directory; -import org.apache.lucene.store.RAMDirectory; -import org.apache.lucene.store.SingleInstanceLockFactory; - -/** - * Directory provider for using lucene RAMDirectory - * - * Only exists in version 4.0 of solr, but we used 1.4.1. Remove this class - * when solr 4.0 will be used - */ -public class RAMDirectoryFactory extends StandardDirectoryFactory { - - private static Map<String, RefCntRamDirectory> directories = new HashMap<String, RefCntRamDirectory>(); - - @Override - public Directory open(String path) throws IOException { - synchronized (RAMDirectoryFactory.class) { - RefCntRamDirectory directory = directories.get(path); - if (directory == null || !directory.isOpen()) { - directory = (RefCntRamDirectory) openNew(path); - directories.put(path, directory); - } else { - directory.incRef(); - } - - return directory; - } - } - - public boolean exists(String path) { - synchronized (RAMDirectoryFactory.class) { - RefCntRamDirectory directory = directories.get(path); - if (directory == null || !directory.isOpen()) { - return false; - } else { - return true; - } - } - } - - /** - * Non-public for unit-test access only. Do not use directly - */ - Directory openNew(String path) throws IOException { - Directory directory; - File dirFile = new File(path); - boolean indexExists = dirFile.canRead(); - if (indexExists) { - Directory dir = super.open(path); - directory = new RefCntRamDirectory(dir); - } else { - directory = new RefCntRamDirectory(); - } - return directory; - } - - static public class RefCntRamDirectory extends RAMDirectory { - - private final AtomicInteger refCount = new AtomicInteger(); - - public RefCntRamDirectory() { - super(); - refCount.set(1); - } - - public RefCntRamDirectory(Directory dir) throws IOException { - this(); - // CODELUTIN - Directory.copy(dir, this, false); -// for (String file : dir.listAll()) { -// dir.copy(this, file, file); -// } - // CODELUTIN - } - - // CODELUTIN - @Override - public void setLockFactory(LockFactory lockFactory) { - // on accept que SingleInstanceLockFactory, sinon on ecrit - // des locks sur disque ce qui cree le repertoire index - // et ensuite on croit que l'index existe et donc s'initialise mal - // puisque le repertoire est en fait vide - - // cela provient de la methode dans SolrIndexWriter - // public static Directory getDirectory(...) - // qui instancie bien un RAMDirectory, mais ensuite change le - // LockFactory avec celui trouve dans le fichier de config, fait - // pour les autre Directory de type FS - if (lockFactory instanceof SingleInstanceLockFactory) { - super.setLockFactory(lockFactory); - } - } - // CODELUTIN - - public void incRef() { - ensureOpen(); - refCount.incrementAndGet(); - } - - public void decRef() { - ensureOpen(); - if (refCount.getAndDecrement() == 1) { - super.close(); - } - } - - public final synchronized void close() { - decRef(); - } - - public boolean isOpen() { - return isOpen; - } - } -} Deleted: trunk/wikitty-solr/src/main/resources/schema.xml =================================================================== --- trunk/wikitty-solr-impl/src/main/resources/schema.xml 2011-04-11 16:02:52 UTC (rev 783) +++ trunk/wikitty-solr/src/main/resources/schema.xml 2011-04-12 08:41:03 UTC (rev 785) @@ -1,181 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - %%Ignore-License - - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<!-- - This is the Solr schema file. This file should be named "schema.xml" and - should be in the conf directory under the solr home - (i.e. ./solr/conf/schema.xml by default) - or located where the classloader for the Solr webapp can find it. - - This example schema is the recommended starting point for users. - It should be kept correct and concise, usable out-of-the-box. - - For more information, on how to customize this file, please see - http://wiki.apache.org/solr/SchemaXml ---> - -<schema name="wikitty" version="1.1"> - <types> - <!-- BINARY type: ignared --> - <fieldtype name="binary" stored="false" indexed="false" class="solr.StrField" /> - - <!-- BOOLEAN type: "true" or "false" --> - <fieldType name="boolean" class="solr.BoolField" - sortMissingLast="true" omitNorms="true"/> - - <!-- NUMERIC type --> - <fieldType name="numeric" class="solr.SortableDoubleField" - sortMissingLast="true" omitNorms="true"/> - - <!-- INT type --> - <fieldType name="int" class="solr.SortableIntField" - sortMissingLast="true" omitNorms="true"/> - - <!-- DATE type --> - <fieldType name="date" class="solr.DateField" sortMissingLast="true" omitNorms="true"/> - - <!-- STRING type: The StrField type is not analyzed, but indexed/stored verbatim. --> - <fieldType name="string" class="solr.StrField" - compressed="true" compressThreshold="1000" - sortMissingLast="true" omitNorms="true"/> - - <!-- STRING type copy: type to string all text is lower cased --> - <fieldType name="string_lc" class="solr.StrField" - compressed="true" compressThreshold="1000" - sortMissingLast="true"> - <analyzer> <!-- no type to indicated that used it for both type: index and query --> - <tokenizer class="solr.StandardTokenizerFactory"/> - <filter class="solr.ASCIIFoldingFilterFactory"/> - <filter class="solr.LowerCaseFilterFactory"/> - </analyzer> - </fieldType> - - <!-- STRING type copy - A text field that uses WordDelimiterFilter to enable splitting and matching of - words on case-change, alpha numeric boundaries, and non-alphanumeric chars, - so that a query of "wifi" or "wi fi" could match a document containing "Wi-Fi". - Synonyms and stopwords are customized by external files, and stemming is enabled. - Duplicate tokens at the same position (which may result from Stemmed Synonyms or - WordDelim parts) are removed. - --> - <fieldType name="text" class="solr.TextField" - compressed="true" compressThreshold="1000" - positionIncrementGap="100"> - <analyzer type="index"> - <tokenizer class="solr.WhitespaceTokenizerFactory"/> - <filter class="solr.ASCIIFoldingFilterFactory"/> - <filter class="solr.StopFilterFactory" - ignoreCase="true" - words="stopwords_fr.txt" - enablePositionIncrements="true" - /> - <filter class="solr.WordDelimiterFilterFactory" - generateWordParts="1" generateNumberParts="1" catenateWords="1" - catenateNumbers="1" catenateAll="0" splitOnCaseChange="1" - preserveOriginal="1"/> - <filter class="solr.LowerCaseFilterFactory"/> - <filter class="solr.EnglishPorterFilterFactory" - protected="protwords.txt"/> - <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> - </analyzer> - <analyzer type="query"> - <tokenizer class="solr.WhitespaceTokenizerFactory"/> - <filter class="solr.ASCIIFoldingFilterFactory"/> - <filter class="solr.SynonymFilterFactory" - synonyms="synonyms.txt" ignoreCase="true" expand="true"/> - <filter class="solr.StopFilterFactory" - ignoreCase="true" words="stopwords_fr.txt"/> - <filter class="solr.WordDelimiterFilterFactory" - generateWordParts="1" generateNumberParts="1" catenateWords="0" - catenateNumbers="0" catenateAll="0" splitOnCaseChange="1" - preserveOriginal="1"/> - <filter class="solr.LowerCaseFilterFactory"/> - <filter class="solr.EnglishPorterFilterFactory" - protected="protwords.txt"/> - <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> - </analyzer> - </fieldType> - - <!-- WIKITTY type --> - <fieldType name="wikitty" class="solr.StrField" sortMissingLast="true" omitNorms="true"/> - - </types> - - - <fields> - - <!-- WARNING ALL DATA MUST BE STORED, WE MUST CAN REINDEX WIKITTY WITH - INDEXED BECAUSE FOR HIEARCHICAL FACET, THERE ARE COPY OF DOCUMENT --> - - <field name="#id" type="string" required="true" indexed="true" stored="true" multiValued="false"/> - <field name="#extensions" type="string" indexed="true" stored="true" multiValued="true"/> - <field name="#tree.root" type="string" indexed="true" stored="true" multiValued="false"/> - <field name="#tree.parents" type="string" indexed="true" stored="true" multiValued="true"/> - <field name="#tree.depth" type="int" indexed="true" stored="true" multiValued="false"/> - <field name="#tree.attached-all" type="string" indexed="true" stored="false" multiValued="true"/> - <dynamicfield name="#tree.attached.*" type="string" indexed="true" stored="true" multiValued="true"/> - <dynamicfield name="#null_field-*" type="boolean" indexed="true" stored="true" multiValued="false"/> - - <!-- copy all field (except binary) in '#fulltext' field for fulltext search --> - <field name="#fulltext" type="text" indexed="true" stored="false" multiValued="true"/> - <!-- copied field not stored --> - <dynamicField name="*_s_c" type="string_lc" indexed="true" stored="false" multiValued="true"/> - <dynamicField name="*_s_t" type="text" indexed="true" stored="false" multiValued="true"/> - - <!-- on indexe pas les binary field --> - <dynamicField name="*_bi" type="binary" indexed="false" stored="false" multiValued="true"/> - <dynamicField name="*_b" type="boolean" indexed="true" stored="true" multiValued="true"/> - <dynamicField name="*_d" type="numeric" indexed="true" stored="true" multiValued="true"/> - <dynamicField name="*_dt" type="date" indexed="true" stored="true" multiValued="true"/> - <dynamicField name="*_s" type="string" indexed="true" stored="true" multiValued="true"/> - <dynamicField name="*_w" type="wikitty" indexed="true" stored="true" multiValued="true"/> - - <!-- all other field, needed if we do query with unregistered extension. - No result is returned but is the right behavior --> - <dynamicField name="*" type="string" indexed="true" stored="false" multiValued="true"/> - - </fields> - - <!-- Field to use to determine and enforce document uniqueness. - Unless this field is marked with required="false", it will be a required field - --> - <uniqueKey>#id</uniqueKey> - - <!-- field for the QueryParser to use when an explicit fieldname is absent --> - <defaultSearchField>#fulltext</defaultSearchField> - - <!-- SolrQueryParser configuration: defaultOperator="AND|OR" --> - <solrQueryParser defaultOperator="AND"/> - - <copyField source="#tree.attached.*" dest="#tree.attached-all"/> - - <copyField source="*_b" dest="#fulltext"/> - <copyField source="*_d" dest="#fulltext"/> - <copyField source="*_dt" dest="#fulltext"/> - <copyField source="*_s" dest="#fulltext"/> - <copyField source="*_w" dest="#fulltext"/> - - <!-- copy String field for to lower case version --> - <copyField source="*_s" dest="*_s_c"/> - <!-- copy String field for text indexed format version --> - <copyField source="*_s" dest="*_s_t"/> - - -</schema> Copied: trunk/wikitty-solr/src/main/resources/schema.xml (from rev 784, trunk/wikitty-solr-impl/src/main/resources/schema.xml) =================================================================== --- trunk/wikitty-solr/src/main/resources/schema.xml (rev 0) +++ trunk/wikitty-solr/src/main/resources/schema.xml 2011-04-12 08:41:03 UTC (rev 785) @@ -0,0 +1,182 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + %%Ignore-License + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<!-- + This is the Solr schema file. This file should be named "schema.xml" and + should be in the conf directory under the solr home + (i.e. ./solr/conf/schema.xml by default) + or located where the classloader for the Solr webapp can find it. + + This example schema is the recommended starting point for users. + It should be kept correct and concise, usable out-of-the-box. + + For more information, on how to customize this file, please see + http://wiki.apache.org/solr/SchemaXml +--> + +<schema name="wikitty" version="1.1"> + + <types> + <!-- BINARY type: ignared --> + <fieldtype name="binary" stored="false" indexed="false" class="solr.StrField" /> + + <!-- BOOLEAN type: "true" or "false" --> + <fieldType name="boolean" class="solr.BoolField" + sortMissingLast="true" omitNorms="true"/> + + <!-- NUMERIC type --> + <fieldType name="numeric" class="solr.SortableDoubleField" + sortMissingLast="true" omitNorms="true"/> + + <!-- INT type --> + <fieldType name="int" class="solr.SortableIntField" + sortMissingLast="true" omitNorms="true"/> + + <!-- DATE type --> + <fieldType name="date" class="solr.DateField" sortMissingLast="true" omitNorms="true"/> + + <!-- STRING type: The StrField type is not analyzed, but indexed/stored verbatim. --> + <fieldType name="string" class="solr.StrField" + compressThreshold="1000" + sortMissingLast="true" omitNorms="true"/> + + <!-- STRING type copy: type to string all text is lower cased --> + <fieldType name="string_lc" class="solr.StrField" + compressThreshold="1000" + sortMissingLast="true"> + <!--analyzer!--> <!-- no type to indicated that used it for both type: index and query --> + <!--<tokenizer class="solr.StandardTokenizerFactory"/> + <filter class="solr.ASCIIFoldingFilterFactory"/> + <filter class="solr.LowerCaseFilterFactory"/> + </analyzer>--> + </fieldType> + + <!-- STRING type copy + A text field that uses WordDelimiterFilter to enable splitting and matching of + words on case-change, alpha numeric boundaries, and non-alphanumeric chars, + so that a query of "wifi" or "wi fi" could match a document containing "Wi-Fi". + Synonyms and stopwords are customized by external files, and stemming is enabled. + Duplicate tokens at the same position (which may result from Stemmed Synonyms or + WordDelim parts) are removed. + --> + <fieldType name="text" class="solr.TextField" + compressThreshold="1000" + positionIncrementGap="100"> + <analyzer type="index"> + <tokenizer class="solr.WhitespaceTokenizerFactory"/> + <filter class="solr.ASCIIFoldingFilterFactory"/> + <filter class="solr.StopFilterFactory" + ignoreCase="true" + words="stopwords_fr.txt" + enablePositionIncrements="true" + /> + <filter class="solr.WordDelimiterFilterFactory" + generateWordParts="1" generateNumberParts="1" catenateWords="1" + catenateNumbers="1" catenateAll="0" splitOnCaseChange="1" + preserveOriginal="1"/> + <filter class="solr.LowerCaseFilterFactory"/> + <filter class="solr.SnowballPorterFilterFactory" + protected="protwords.txt"/> + <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> + </analyzer> + <analyzer type="query"> + <tokenizer class="solr.WhitespaceTokenizerFactory"/> + <filter class="solr.ASCIIFoldingFilterFactory"/> + <filter class="solr.SynonymFilterFactory" + synonyms="synonyms.txt" ignoreCase="true" expand="true"/> + <filter class="solr.StopFilterFactory" + ignoreCase="true" words="stopwords_fr.txt"/> + <filter class="solr.WordDelimiterFilterFactory" + generateWordParts="1" generateNumberParts="1" catenateWords="0" + catenateNumbers="0" catenateAll="0" splitOnCaseChange="1" + preserveOriginal="1"/> + <filter class="solr.LowerCaseFilterFactory"/> + <filter class="solr.SnowballPorterFilterFactory" + protected="protwords.txt"/> + <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> + </analyzer> + </fieldType> + + <!-- WIKITTY type --> + <fieldType name="wikitty" class="solr.StrField" sortMissingLast="true" omitNorms="true"/> + + </types> + + + <fields> + + <!-- WARNING ALL DATA MUST BE STORED, WE MUST CAN REINDEX WIKITTY WITH + INDEXED BECAUSE FOR HIEARCHICAL FACET, THERE ARE COPY OF DOCUMENT --> + + <field name="#id" type="string" required="true" indexed="true" stored="true" multiValued="false"/> + <field name="#extensions" type="string" indexed="true" stored="true" multiValued="true"/> + <field name="#tree.root" type="string" indexed="true" stored="true" multiValued="false"/> + <field name="#tree.parents" type="string" indexed="true" stored="true" multiValued="true"/> + <field name="#tree.depth" type="int" indexed="true" stored="true" multiValued="false"/> + <field name="#tree.attached-all" type="string" indexed="true" stored="false" multiValued="true"/> + <dynamicfield name="#tree.attached.*" type="string" indexed="true" stored="true" multiValued="true"/> + <dynamicfield name="#null_field-*" type="boolean" indexed="true" stored="true" multiValued="false"/> + + <!-- copy all field (except binary) in '#fulltext' field for fulltext search --> + <field name="#fulltext" type="text" indexed="true" stored="false" multiValued="true"/> + <!-- copied field not stored --> + <dynamicField name="*_s_c" type="string_lc" indexed="true" stored="false" multiValued="true"/> + <dynamicField name="*_s_t" type="text" indexed="true" stored="false" multiValued="true"/> + + <!-- on indexe pas les binary field --> + <dynamicField name="*_bi" type="binary" indexed="false" stored="false" multiValued="true"/> + <dynamicField name="*_b" type="boolean" indexed="true" stored="true" multiValued="true"/> + <dynamicField name="*_d" type="numeric" indexed="true" stored="true" multiValued="true"/> + <dynamicField name="*_dt" type="date" indexed="true" stored="true" multiValued="true"/> + <dynamicField name="*_s" type="string" indexed="true" stored="true" multiValued="true"/> + <dynamicField name="*_w" type="wikitty" indexed="true" stored="true" multiValued="true"/> + + <!-- all other field, needed if we do query with unregistered extension. + No result is returned but is the right behavior --> + <dynamicField name="*" type="string" indexed="true" stored="false" multiValued="true"/> + + </fields> + + <!-- Field to use to determine and enforce document uniqueness. + Unless this field is marked with required="false", it will be a required field + --> + <uniqueKey>#id</uniqueKey> + + <!-- field for the QueryParser to use when an explicit fieldname is absent --> + <defaultSearchField>#fulltext</defaultSearchField> + + <!-- SolrQueryParser configuration: defaultOperator="AND|OR" --> + <solrQueryParser defaultOperator="AND"/> + + <copyField source="#tree.attached.*" dest="#tree.attached-all"/> + + <copyField source="*_b" dest="#fulltext"/> + <copyField source="*_d" dest="#fulltext"/> + <copyField source="*_dt" dest="#fulltext"/> + <copyField source="*_s" dest="#fulltext"/> + <copyField source="*_w" dest="#fulltext"/> + + <!-- copy String field for to lower case version --> + <copyField source="*_s" dest="*_s_c"/> + <!-- copy String field for text indexed format version --> + <copyField source="*_s" dest="*_s_t"/> + + +</schema> Deleted: trunk/wikitty-solr/src/main/resources/solrconfig.xml =================================================================== --- trunk/wikitty-solr-impl/src/main/resources/solrconfig.xml 2011-04-11 16:02:52 UTC (rev 783) +++ trunk/wikitty-solr/src/main/resources/solrconfig.xml 2011-04-12 08:41:03 UTC (rev 785) @@ -1,562 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - #%L - Wikitty :: wikitty-solr-impl - - $Id$ - $HeadURL$ - %% - Copyright (C) 2009 - 2010 CodeLutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Lesser Public License for more details. - - You should have received a copy of the GNU General Lesser Public - License along with this program. If not, see - <http://www.gnu.org/licenses/lgpl-3.0.html>. - #L% - --> - -<config> - <!-- Set this to 'false' if you want solr to continue working after it has - encountered an severe configuration error. In a production environment, - you may want solr to keep working even if one handler is mis-configured. - - You may also set this to false using by setting the system property: - -Dsolr.abortOnConfigurationError=false - --> - <abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError> - - <!-- Used to specify an alternate directory to hold all index data - other than the default ./data under the Solr home. - If replication is in use, this should match the replication configuration. --> - <dataDir>${wikitty.searchengine.solr.directory.data:./solr/data}</dataDir> - - <!-- The DirectoryFactory to use for indexes. - solr.StandardDirectoryFactory, the default, is filesystem based. - solr.RAMDirectoryFactory is memory based, not persistent, and doesn't work with replication. - A prefix of "solr." for class names is an alias that - causes solr to search appropriate packages, including - org.apache.solr.(search|update|request|core|analysis) - --> - <directoryFactory name="DirectoryFactory" class="${wikitty.searchengine.solr.directory.factory:solr.StandardDirectoryFactory}"/> - <directoryFactory name="IndexReaderFactory" class="${wikitty.searchengine.solr.indexReader.factory:solr.StandardIndexReaderFactory}"/> - - - <indexDefaults> - <!-- Values here affect all index writers and act as a default unless overridden. --> - <useCompoundFile>false</useCompoundFile> - - <mergeFactor>10</mergeFactor> - <!-- - If both ramBufferSizeMB and maxBufferedDocs is set, then Lucene will flush based on whichever limit is hit first. - - --> - <!--<maxBufferedDocs>1000</maxBufferedDocs>--> - <!-- Tell Lucene when to flush documents to disk. - Giving Lucene more memory for indexing means faster indexing at the cost of more RAM - - If both ramBufferSizeMB and maxBufferedDocs is set, then Lucene will flush based on whichever limit is hit first. - - --> - <ramBufferSizeMB>32</ramBufferSizeMB> - <maxMergeDocs>2147483647</maxMergeDocs> - <maxFieldLength>10000</maxFieldLength> - <writeLockTimeout>1000</writeLockTimeout> - <commitLockTimeout>10000</commitLockTimeout> - - <!-- - This option specifies which Lucene LockFactory implementation to use. - - single = SingleInstanceLockFactory - suggested for a read-only index - or when there is no possibility of another process trying - to modify the index. - native = NativeFSLockFactory - simple = SimpleFSLockFactory - - (For backwards compatibility with Solr 1.2, 'simple' is the default - if not specified.) - --> - <lockType>simple</lockType> - </indexDefaults> - - <mainIndex> - <!-- options specific to the main on-disk lucene index --> - <useCompoundFile>false</useCompoundFile> - <ramBufferSizeMB>32</ramBufferSizeMB> - <mergeFactor>10</mergeFactor> - <!-- Deprecated --> - <!--<maxBufferedDocs>1000</maxBufferedDocs>--> - <maxMergeDocs>2147483647</maxMergeDocs> - <maxFieldLength>10000</maxFieldLength> - - <!-- If true, unlock any held write or commit locks on startup. - This defeats the locking mechanism that allows multiple - processes to safely access a lucene index, and should be - used with care. - This is not needed if lock type is 'none' or 'single' - --> - <unlockOnStartup>true</unlockOnStartup> - </mainIndex> - - <!-- Enables JMX if and only if an existing MBeanServer is found, use - this if you want to configure JMX through JVM parameters. Remove - this to disable exposing Solr configuration and statistics to JMX. - - If you want to connect to a particular server, specify the agentId - e.g. <jmx agentId="myAgent" /> - - If you want to start a new MBeanServer, specify the serviceUrl - e.g <jmx serviceurl="service:jmx:rmi:///jndi/rmi://localhost:9999/solr" /> - - For more details see http://wiki.apache.org/solr/SolrJmx - --> - <jmx /> - - <!-- the default high-performance update handler --> - <updateHandler class="solr.DirectUpdateHandler2"> - </updateHandler> - - - <query> - <!-- Maximum number of clauses in a boolean query (default: 1024). can affect - range or prefix queries that expand to big boolean - queries. An exception is thrown if exceeded. --> - <maxBooleanClauses>2147483647</maxBooleanClauses> - - - <!-- Cache used by SolrIndexSearcher for filters (DocSets), - unordered sets of *all* documents that match a query. - When a new searcher is opened, its caches may be prepopulated - or "autowarmed" using data from caches in the old searcher. - autowarmCount is the number of items to prepopulate. For LRUCache, - the autowarmed items will be the most recently accessed items. - Parameters: - class - the SolrCache implementation (currently only LRUCache) - size - the maximum number of entries in the cache - initialSize - the initial capacity (number of entries) of - the cache. (seel java.util.HashMap) - autowarmCount - the number of entries to prepopulate from - and old cache. - --> - <filterCache - class="solr.LRUCache" - size="512" - initialSize="512" - autowarmCount="0"/> - - <!-- queryResultCache caches results of searches - ordered lists of - document ids (DocList) based on a query, a sort, and the range - of documents requested. --> - <queryResultCache - class="solr.LRUCache" - size="512" - initialSize="512" - autowarmCount="0"/> - - <!-- documentCache caches Lucene Document objects (the stored fields for each document). - Since Lucene internal document ids are transient, this cache will not be autowarmed. --> - <documentCache - class="solr.LRUCache" - size="512" - initialSize="512" - autowarmCount="0"/> - - <!-- If true, stored fields that are not requested will be loaded lazily. - - This can result in a significant speed improvement if the usual case is to - not load all stored fields, especially if the skipped fields are large compressed - text fields. - --> - <enableLazyFieldLoading>true</enableLazyFieldLoading> - - <!-- An optimization for use with the queryResultCache. When a search - is requested, a superset of the requested number of document ids - are collected. For example, if a search for a particular query - requests matching documents 10 through 19, and queryWindowSize is 50, - then documents 0 through 49 will be collected and cached. Any further - requests in that range can be satisfied via the cache. --> - <!-- - | Code Lutin - | 1 si Wikitty est plus utilise pour de l'ecriture que de la lecture - | la valeur par defaut est 50. Il semble convenable de mettre deux fois - | la taille de la recherche. Si on pagine par 25, 50 est une bonne valeur. - +--> - <queryResultWindowSize>1</queryResultWindowSize> - - <!-- Maximum number of documents to cache for any entry in the - queryResultCache. --> - <queryResultMaxDocsCached>200</queryResultMaxDocsCached> - - <!-- This entry enables an int hash representation for filters (DocSets) - when the number of items in the set is less than maxSize. For smaller - sets, this representation is more memory efficient, more efficient to - iterate over, and faster to take intersections. --> - <HashDocSet maxSize="3000" loadFactor="0.75"/> - - <!-- If a search request comes in and there is no current registered searcher, - then immediately register the still warming searcher and use it. If - "false" then all requests will block until the first searcher is done - warming. --> - <useColdSearcher>false</useColdSearcher> - - <!-- Maximum number of searchers that may be warming in the background - concurrently. An error is returned if this limit is exceeded. Recommend - 1-2 for read-only slaves, higher for masters w/o cache warming. --> - <maxWarmingSearchers>5</maxWarmingSearchers> - - </query> - - <!-- - Let the dispatch filter handler /select?qt=XXX - handleSelect=true will use consistent error handling for /select and /update - handleSelect=false will use solr1.1 style error formatting - --> - <requestDispatcher handleSelect="true" > - <!--Make sure your system has some authentication before enabling remote streaming! --> - <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" /> - </requestDispatcher> - - - -<!-- FIXME clean requestHandler to keep only necessary requestHandler --> - - - - <!-- requestHandler plugins... incoming queries will be dispatched to the - correct handler based on the path or the qt (query type) param. - Names starting with a '/' are accessed with the a path equal to the - registered name. Names without a leading '/' are accessed with: - http://host/app/select?qt=name - If no qt is defined, the requestHandler that declares default="true" - will be used. - --> - <requestHandler name="standard" class="solr.SearchHandler" default="true"> - <!-- default values for query parameters --> - <lst name="defaults"> - <str name="echoParams">explicit</str> - <!-- - <int name="rows">10</int> - <str name="fl">*</str> - <str name="version">2.1</str> - --> - </lst> - </requestHandler> - - - <!-- DisMaxRequestHandler allows easy searching across multiple fields - for simple user-entered phrases. It's implementation is now - just the standard SearchHandler with a default query type - of "dismax". - see http://wiki.apache.org/solr/DisMaxRequestHandler - --> - <requestHandler name="dismax" class="solr.SearchHandler" > - <lst name="defaults"> - <str name="defType">dismax</str> - <str name="echoParams">explicit</str> - <float name="tie">0.01</float> - <str name="qf"> - text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 - </str> - <str name="pf"> - text^0.2 features^1.1 name^1.5 manu^1.4 manu_exact^1.9 - </str> - <str name="bf"> - ord(popularity)^0.5 recip(rord(price),1,1000,1000)^0.3 - </str> - <str name="fl"> - id,name,price,score - </str> - <str name="mm"> - 2<-1 5<-2 6<90% - </str> - <int name="ps">100</int> - <str name="q.alt">*:*</str> - <!-- example highlighter config, enable per-query with hl=true --> - <str name="hl.fl">text features name</str> - <!-- for this field, we want no fragmenting, just highlighting --> - <str name="f.name.hl.fragsize">0</str> - <!-- instructs Solr to return the field itself if no query terms are - found --> - <str name="f.name.hl.alternateField">name</str> - <str name="f.text.hl.fragmenter">regex</str> <!-- defined below --> - </lst> - </requestHandler> - - <!-- Note how you can register the same handler multiple times with - different names (and different init parameters) - --> - <!-- - poussin 20101224 - je ne vois pas trop a quoi ca sert. Je pense que c juste un exemple - <requestHandler name="partitioned" class="solr.SearchHandler" > - <lst name="defaults"> - <str name="defType">dismax</str> - <str name="echoParams">explicit</str> - <str name="qf">text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0</str> - <str name="mm">2<-1 5<-2 6<90%</str> - < ! - - This is an example of using Date Math to specify a constantly - moving date range in a config... - - - > - <str name="bq">incubationdate_dt:[* TO NOW/DAY-1MONTH]^2.2</str> - </lst> - < ! - - In addition to defaults, "appends" params can be specified - to identify values which should be appended to the list of - multi-val params from the query (or the existing "defaults"). - - In this example, the param "fq=instock:true" will be appended to - any query time fq params the user may specify, as a mechanism for - partitioning the index, independent of any user selected filtering - that may also be desired (perhaps as a result of faceted searching). - - NOTE: there is *absolutely* nothing a client can do to prevent these - "appends" values from being used, so don't use this mechanism - unless you are sure you always want it. - - - > - <lst name="appends"> - <str name="fq">inStock:true</str> - </lst> - <! - - "invariants" are a way of letting the Solr maintainer lock down - the options available to Solr clients. Any params values - specified here are used regardless of what values may be specified - in either the query, the "defaults", or the "appends" params. - - In this example, the facet.field and facet.query params are fixed, - limiting the facets clients can use. Faceting is not turned on by - default - but if the client does specify facet=true in the request, - these are the only facets they will be able to see counts for; - regardless of what other facet.field or facet.query params they - may specify. - - NOTE: there is *absolutely* nothing a client can do to prevent these - "invariants" values from being used, so don't use this mechanism - unless you are sure you always want it. - - - > - <lst name="invariants"> - <str name="facet.field">cat</str> - <str name="facet.field">manu_exact</str> - <str name="facet.query">price:[* TO 500]</str> - <str name="facet.query">price:[500 TO *]</str> - </lst> - </requestHandler> - --> - - - <!-- - Search components are registered to SolrCore and used by Search Handlers - - By default, the following components are avaliable: - - <searchComponent name="query" class="org.apache.solr.handler.component.QueryComponent" /> - <searchComponent name="facet" class="org.apache.solr.handler.component.FacetComponent" /> - <searchComponent name="mlt" class="org.apache.solr.handler.component.MoreLikeThisComponent" /> - <searchComponent name="highlight" class="org.apache.solr.handler.component.HighlightComponent" /> - <searchComponent name="debug" class="org.apache.solr.handler.component.DebugComponent" /> - - Default configuration in a requestHandler would look like: - <arr name="components"> - <str>query</str> - <str>facet</str> - <str>mlt</str> - <str>highlight</str> - <str>debug</str> - </arr> - - If you register a searchComponent to one of the standard names, that will be used instead. - To insert handlers before or after the 'standard' components, use: - - <arr name="first-components"> - <str>myFirstComponentName</str> - </arr> - - <arr name="last-components"> - <str>myLastComponentName</str> - </arr> - --> - - <!-- The spell check component can return a list of alternative spelling - suggestions. --> - <!-- - poussin 20101224 - pas besoin du spell check, et surtout il cree des repertoires, donc - pour le in memory c'est pas super. Si on ne veut pas qu'il cree de repertoire - il faut que les *Dir soit null. Dans ce cas il utilise des RAMDirectory - <searchComponent name="spellcheck" class="solr.SpellCheckComponent"> - - <str name="queryAnalyzerFieldType">textSpell</str> - - <lst name="spellchecker"> - <str name="name">default</str> - <str name="field">spell</str> - <str name="spellcheckIndexDir">./spellchecker1</str> - - </lst> - <lst name="spellchecker"> - <str name="name">jarowinkler</str> - <str name="field">spell</str> - <str name="distanceMeasure">org.apache.lucene.search.spell.JaroWinklerDistance</str> - <str name="spellcheckIndexDir">./spellchecker2</str> - - </lst> - - <lst name="spellchecker"> - <str name="classname">solr.FileBasedSpellChecker</str> - <str name="name">file</str> - <str name="sourceLocation">spellings.txt</str> - <str name="characterEncoding">UTF-8</str> - <str name="spellcheckIndexDir">./spellcheckerFile</str> - </lst> - </searchComponent> - - < ! - - a request handler utilizing the spellcheck component - - > - <requestHandler name="/spellCheckCompRH" class="solr.SearchHandler"> - <lst name="defaults"> - <str name="spellcheck.onlyMorePopular">false</str> - <str name="spellcheck.extendedResults">false</str> - <str name="spellcheck.count">1</str> - </lst> - <arr name="last-components"> - <str>spellcheck</str> - </arr> - </requestHandler> - --> - - <!-- a search component that enables you to configure the top results for - a given query regardless of the normal lucene scoring.--> - -<!-- poussin 20090902 remove elevate this file is empty, what need ? - <searchComponent name="elevator" class="solr.QueryElevationComponent" > - <str name="queryFieldType">string</str> - <str name="config-file">elevate.xml</str> - </searchComponent> - --> - <!-- a request handler utilizing the elevator component --> -<!-- - <requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy"> - <lst name="defaults"> - <str name="echoParams">explicit</str> - </lst> - <arr name="last-components"> - <str>elevator</str> - </arr> - </requestHandler> - --> - - <!-- Update request handler. - - Note: Since solr1.1 requestHandlers requires a valid content type header if posted in - the body. For example, curl now requires: -H 'Content-type:text/xml; charset=utf-8' - The response format differs from solr1.1 formatting and returns a standard error code. - - To enable solr1.1 behavior, remove the /update handler or change its path - --> - <requestHandler name="/update" class="solr.XmlUpdateRequestHandler" /> - - <!-- - Analysis request handler. Since Solr 1.3. Use to returnhow a document is analyzed. Useful - for debugging and as a token server for other types of applications - --> - <requestHandler name="/analysis" class="solr.AnalysisRequestHandler" /> - - - <!-- CSV update handler, loaded on demand --> - <requestHandler name="/update/csv" class="solr.CSVRequestHandler" startup="lazy" /> - - - <!-- - Admin Handlers - This will register all the standard admin RequestHandlers. Adding - this single handler is equivolent to registering: - - <requestHandler name="/admin/luke" class="org.apache.solr.handler.admin.LukeRequestHandler" /> - <requestHandler name="/admin/system" class="org.apache.solr.handler.admin.SystemInfoHandler" /> - <requestHandler name="/admin/plugins" class="org.apache.solr.handler.admin.PluginInfoHandler" /> - <requestHandler name="/admin/threads" class="org.apache.solr.handler.admin.ThreadDumpHandler" /> - <requestHandler name="/admin/properties" class="org.apache.solr.handler.admin.PropertiesRequestHandler" /> - <requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" > - - If you wish to hide files under ${solr.home}/conf, explicitly register the ShowFileRequestHandler using: - <requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" > - <lst name="invariants"> - <str name="hidden">synonyms.txt</str> - <str name="hidden">anotherfile.txt</str> - </lst> - </requestHandler> - --> - <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" /> - - <!-- ping/healthcheck --> - <requestHandler name="/admin/ping" class="PingRequestHandler"> - <lst name="defaults"> - <str name="qt">standard</str> - <str name="q">solrpingquery</str> - <str name="echoParams">all</str> - </lst> - </requestHandler> - - <!-- Echo the request contents back to the client --> - <requestHandler name="/debug/dump" class="solr.DumpRequestHandler" > - <lst name="defaults"> - <str name="echoParams">explicit</str> <!-- for all params (including the default etc) use: 'all' --> - <str name="echoHandler">true</str> - </lst> - </requestHandler> - - - - - - - - - - - <highlighting> - <!-- Configure the standard fragmenter --> - <!-- This could most likely be commented out in the "default" case --> - <fragmenter name="gap" class="org.apache.solr.highlight.GapFragmenter" default="true"> - <lst name="defaults"> - <int name="hl.fragsize">100</int> - </lst> - </fragmenter> - - <!-- A regular-expression-based fragmenter (f.i., for sentence extraction) --> - <fragmenter name="regex" class="org.apache.solr.highlight.RegexFragmenter"> - <lst name="defaults"> - <!-- slightly smaller fragsizes work better because of slop --> - <int name="hl.fragsize">70</int> - <!-- allow 50% slop on fragment sizes --> - <float name="hl.regex.slop">0.5</float> - <!-- a basic sentence pattern --> - <str name="hl.regex.pattern">[-\w ,/\n\"']{20,200}</str> - </lst> - </fragmenter> - </highlighting> - - <queryParser name="lucene" class="org.nuiton.wikitty.storage.solr.WikittyQueryParser"/> - <queryParser name="wikitty" class="org.nuiton.wikitty.storage.solr.WikittyQueryParser"/> - - <!-- example of registering a query parser - <queryParser name="lucene" class="org.apache.solr.search.LuceneQParserPlugin"/> - --> - - <!-- example of registering a custom function parser - <valueSourceParser name="myfunc" class="com.mycompany.MyValueSourceParser" /> - --> - - <!-- config for the admin interface --> - <admin> - <defaultQuery>solr</defaultQuery> - - <!-- configure a healthcheck file for servers behind a loadbalancer - <healthcheck type="file">server-enabled</healthcheck> - --> - </admin> - -</config> Copied: trunk/wikitty-solr/src/main/resources/solrconfig.xml (from rev 784, trunk/wikitty-solr-impl/src/main/resources/solrconfig.xml) =================================================================== --- trunk/wikitty-solr/src/main/resources/solrconfig.xml (rev 0) +++ trunk/wikitty-solr/src/main/resources/solrconfig.xml 2011-04-12 08:41:03 UTC (rev 785) @@ -0,0 +1,565 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + #%L + Wikitty :: wikitty-solr-impl + + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2010 CodeLutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> + +<config> + + <luceneMatchVersion>LUCENE_31</luceneMatchVersion> + + <!-- Set this to 'false' if you want solr to continue working after it has + encountered an severe configuration error. In a production environment, + you may want solr to keep working even if one handler is mis-configured. + + You may also set this to false using by setting the system property: + -Dsolr.abortOnConfigurationError=false + --> + <abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError> + + <!-- Used to specify an alternate directory to hold all index data + other than the default ./data under the Solr home. + If replication is in use, this should match the replication configuration. --> + <dataDir>${wikitty.searchengine.solr.directory.data:./solr/data}</dataDir> + + <!-- The DirectoryFactory to use for indexes. + solr.StandardDirectoryFactory, the default, is filesystem based. + solr.RAMDirectoryFactory is memory based, not persistent, and doesn't work with replication. + A prefix of "solr." for class names is an alias that + causes solr to search appropriate packages, including + org.apache.solr.(search|update|request|core|analysis) + --> + <directoryFactory name="DirectoryFactory" class="${wikitty.searchengine.solr.directory.factory:solr.StandardDirectoryFactory}"/> + <directoryFactory name="IndexReaderFactory" class="${wikitty.searchengine.solr.indexReader.factory:solr.StandardIndexReaderFactory}"/> + + + <indexDefaults> + <!-- Values here affect all index writers and act as a default unless overridden. --> + <useCompoundFile>false</useCompoundFile> + + <mergeFactor>10</mergeFactor> + <!-- + If both ramBufferSizeMB and maxBufferedDocs is set, then Lucene will flush based on whichever limit is hit first. + + --> + <!--<maxBufferedDocs>1000</maxBufferedDocs>--> + <!-- Tell Lucene when to flush documents to disk. + Giving Lucene more memory for indexing means faster indexing at the cost of more RAM + + If both ramBufferSizeMB and maxBufferedDocs is set, then Lucene will flush based on whichever limit is hit first. + + --> + <ramBufferSizeMB>32</ramBufferSizeMB> + <maxMergeDocs>2147483647</maxMergeDocs> + <maxFieldLength>10000</maxFieldLength> + <writeLockTimeout>1000</writeLockTimeout> + <commitLockTimeout>10000</commitLockTimeout> + + <!-- + This option specifies which Lucene LockFactory implementation to use. + + single = SingleInstanceLockFactory - suggested for a read-only index + or when there is no possibility of another process trying + to modify the index. + native = NativeFSLockFactory + simple = SimpleFSLockFactory + + (For backwards compatibility with Solr 1.2, 'simple' is the default + if not specified.) + --> + <lockType>simple</lockType> + </indexDefaults> + + <mainIndex> + <!-- options specific to the main on-disk lucene index --> + <useCompoundFile>false</useCompoundFile> + <ramBufferSizeMB>32</ramBufferSizeMB> + <mergeFactor>10</mergeFactor> + <!-- Deprecated --> + <!--<maxBufferedDocs>1000</maxBufferedDocs>--> + <maxMergeDocs>2147483647</maxMergeDocs> + <maxFieldLength>10000</maxFieldLength> + + <!-- If true, unlock any held write or commit locks on startup. + This defeats the locking mechanism that allows multiple + processes to safely access a lucene index, and should be + used with care. + This is not needed if lock type is 'none' or 'single' + --> + <unlockOnStartup>true</unlockOnStartup> + </mainIndex> + + <!-- Enables JMX if and only if an existing MBeanServer is found, use + this if you want to configure JMX through JVM parameters. Remove + this to disable exposing Solr configuration and statistics to JMX. + + If you want to connect to a particular server, specify the agentId + e.g. <jmx agentId="myAgent" /> + + If you want to start a new MBeanServer, specify the serviceUrl + e.g <jmx serviceurl="service:jmx:rmi:///jndi/rmi://localhost:9999/solr" /> + + For more details see http://wiki.apache.org/solr/SolrJmx + --> + <jmx /> + + <!-- the default high-performance update handler --> + <updateHandler class="solr.DirectUpdateHandler2"> + </updateHandler> + + + <query> + <!-- Maximum number of clauses in a boolean query (default: 1024). can affect + range or prefix queries that expand to big boolean + queries. An exception is thrown if exceeded. --> + <maxBooleanClauses>2147483647</maxBooleanClauses> + + + <!-- Cache used by SolrIndexSearcher for filters (DocSets), + unordered sets of *all* documents that match a query. + When a new searcher is opened, its caches may be prepopulated + or "autowarmed" using data from caches in the old searcher. + autowarmCount is the number of items to prepopulate. For LRUCache, + the autowarmed items will be the most recently accessed items. + Parameters: + class - the SolrCache implementation (currently only LRUCache) + size - the maximum number of entries in the cache + initialSize - the initial capacity (number of entries) of + the cache. (seel java.util.HashMap) + autowarmCount - the number of entries to prepopulate from + and old cache. + --> + <filterCache + class="solr.LRUCache" + size="512" + initialSize="512" + autowarmCount="0"/> + + <!-- queryResultCache caches results of searches - ordered lists of + document ids (DocList) based on a query, a sort, and the range + of documents requested. --> + <queryResultCache + class="solr.LRUCache" + size="512" + initialSize="512" + autowarmCount="0"/> + + <!-- documentCache caches Lucene Document objects (the stored fields for each document). + Since Lucene internal document ids are transient, this cache will not be autowarmed. --> + <documentCache + class="solr.LRUCache" + size="512" + initialSize="512" + autowarmCount="0"/> + + <!-- If true, stored fields that are not requested will be loaded lazily. + + This can result in a significant speed improvement if the usual case is to + not load all stored fields, especially if the skipped fields are large compressed + text fields. + --> + <enableLazyFieldLoading>true</enableLazyFieldLoading> + + <!-- An optimization for use with the queryResultCache. When a search + is requested, a superset of the requested number of document ids + are collected. For example, if a search for a particular query + requests matching documents 10 through 19, and queryWindowSize is 50, + then documents 0 through 49 will be collected and cached. Any further + requests in that range can be satisfied via the cache. --> + <!-- + | Code Lutin + | 1 si Wikitty est plus utilise pour de l'ecriture que de la lecture + | la valeur par defaut est 50. Il semble convenable de mettre deux fois + | la taille de la recherche. Si on pagine par 25, 50 est une bonne valeur. + +--> + <queryResultWindowSize>1</queryResultWindowSize> + + <!-- Maximum number of documents to cache for any entry in the + queryResultCache. --> + <queryResultMaxDocsCached>200</queryResultMaxDocsCached> + + <!-- This entry enables an int hash representation for filters (DocSets) + when the number of items in the set is less than maxSize. For smaller + sets, this representation is more memory efficient, more efficient to + iterate over, and faster to take intersections. --> + <HashDocSet maxSize="3000" loadFactor="0.75"/> + + <!-- If a search request comes in and there is no current registered searcher, + then immediately register the still warming searcher and use it. If + "false" then all requests will block until the first searcher is done + warming. --> + <useColdSearcher>false</useColdSearcher> + + <!-- Maximum number of searchers that may be warming in the background + concurrently. An error is returned if this limit is exceeded. Recommend + 1-2 for read-only slaves, higher for masters w/o cache warming. --> + <maxWarmingSearchers>5</maxWarmingSearchers> + + </query> + + <!-- + Let the dispatch filter handler /select?qt=XXX + handleSelect=true will use consistent error handling for /select and /update + handleSelect=false will use solr1.1 style error formatting + --> + <requestDispatcher handleSelect="true" > + <!--Make sure your system has some authentication before enabling remote streaming! --> + <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" /> + </requestDispatcher> + + + +<!-- FIXME clean requestHandler to keep only necessary requestHandler --> + + + + <!-- requestHandler plugins... incoming queries will be dispatched to the + correct handler based on the path or the qt (query type) param. + Names starting with a '/' are accessed with the a path equal to the + registered name. Names without a leading '/' are accessed with: + http://host/app/select?qt=name + If no qt is defined, the requestHandler that declares default="true" + will be used. + --> + <requestHandler name="standard" class="solr.SearchHandler" default="true"> + <!-- default values for query parameters --> + <lst name="defaults"> + <str name="echoParams">explicit</str> + <!-- + <int name="rows">10</int> + <str name="fl">*</str> + <str name="version">2.1</str> + --> + </lst> + </requestHandler> + + + <!-- DisMaxRequestHandler allows easy searching across multiple fields + for simple user-entered phrases. It's implementation is now + just the standard SearchHandler with a default query type + of "dismax". + see http://wiki.apache.org/solr/DisMaxRequestHandler + --> + <requestHandler name="dismax" class="solr.SearchHandler" > + <lst name="defaults"> + <str name="defType">dismax</str> + <str name="echoParams">explicit</str> + <float name="tie">0.01</float> + <str name="qf"> + text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 + </str> + <str name="pf"> + text^0.2 features^1.1 name^1.5 manu^1.4 manu_exact^1.9 + </str> + <str name="bf"> + ord(popularity)^0.5 recip(rord(price),1,1000,1000)^0.3 + </str> + <str name="fl"> + id,name,price,score + </str> + <str name="mm"> + 2<-1 5<-2 6<90% + </str> + <int name="ps">100</int> + <str name="q.alt">*:*</str> + <!-- example highlighter config, enable per-query with hl=true --> + <str name="hl.fl">text features name</str> + <!-- for this field, we want no fragmenting, just highlighting --> + <str name="f.name.hl.fragsize">0</str> + <!-- instructs Solr to return the field itself if no query terms are + found --> + <str name="f.name.hl.alternateField">name</str> + <str name="f.text.hl.fragmenter">regex</str> <!-- defined below --> + </lst> + </requestHandler> + + <!-- Note how you can register the same handler multiple times with + different names (and different init parameters) + --> + <!-- + poussin 20101224 + je ne vois pas trop a quoi ca sert. Je pense que c juste un exemple + <requestHandler name="partitioned" class="solr.SearchHandler" > + <lst name="defaults"> + <str name="defType">dismax</str> + <str name="echoParams">explicit</str> + <str name="qf">text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0</str> + <str name="mm">2<-1 5<-2 6<90%</str> + < ! - - This is an example of using Date Math to specify a constantly + moving date range in a config... + - - > + <str name="bq">incubationdate_dt:[* TO NOW/DAY-1MONTH]^2.2</str> + </lst> + < ! - - In addition to defaults, "appends" params can be specified + to identify values which should be appended to the list of + multi-val params from the query (or the existing "defaults"). + + In this example, the param "fq=instock:true" will be appended to + any query time fq params the user may specify, as a mechanism for + partitioning the index, independent of any user selected filtering + that may also be desired (perhaps as a result of faceted searching). + + NOTE: there is *absolutely* nothing a client can do to prevent these + "appends" values from being used, so don't use this mechanism + unless you are sure you always want it. + - - > + <lst name="appends"> + <str name="fq">inStock:true</str> + </lst> + <! - - "invariants" are a way of letting the Solr maintainer lock down + the options available to Solr clients. Any params values + specified here are used regardless of what values may be specified + in either the query, the "defaults", or the "appends" params. + + In this example, the facet.field and facet.query params are fixed, + limiting the facets clients can use. Faceting is not turned on by + default - but if the client does specify facet=true in the request, + these are the only facets they will be able to see counts for; + regardless of what other facet.field or facet.query params they + may specify. + + NOTE: there is *absolutely* nothing a client can do to prevent these + "invariants" values from being used, so don't use this mechanism + unless you are sure you always want it. + - - > + <lst name="invariants"> + <str name="facet.field">cat</str> + <str name="facet.field">manu_exact</str> + <str name="facet.query">price:[* TO 500]</str> + <str name="facet.query">price:[500 TO *]</str> + </lst> + </requestHandler> + --> + + + <!-- + Search components are registered to SolrCore and used by Search Handlers + + By default, the following components are avaliable: + + <searchComponent name="query" class="org.apache.solr.handler.component.QueryComponent" /> + <searchComponent name="facet" class="org.apache.solr.handler.component.FacetComponent" /> + <searchComponent name="mlt" class="org.apache.solr.handler.component.MoreLikeThisComponent" /> + <searchComponent name="highlight" class="org.apache.solr.handler.component.HighlightComponent" /> + <searchComponent name="debug" class="org.apache.solr.handler.component.DebugComponent" /> + + Default configuration in a requestHandler would look like: + <arr name="components"> + <str>query</str> + <str>facet</str> + <str>mlt</str> + <str>highlight</str> + <str>debug</str> + </arr> + + If you register a searchComponent to one of the standard names, that will be used instead. + To insert handlers before or after the 'standard' components, use: + + <arr name="first-components"> + <str>myFirstComponentName</str> + </arr> + + <arr name="last-components"> + <str>myLastComponentName</str> + </arr> + --> + + <!-- The spell check component can return a list of alternative spelling + suggestions. --> + <!-- + poussin 20101224 + pas besoin du spell check, et surtout il cree des repertoires, donc + pour le in memory c'est pas super. Si on ne veut pas qu'il cree de repertoire + il faut que les *Dir soit null. Dans ce cas il utilise des RAMDirectory + <searchComponent name="spellcheck" class="solr.SpellCheckComponent"> + + <str name="queryAnalyzerFieldType">textSpell</str> + + <lst name="spellchecker"> + <str name="name">default</str> + <str name="field">spell</str> + <str name="spellcheckIndexDir">./spellchecker1</str> + + </lst> + <lst name="spellchecker"> + <str name="name">jarowinkler</str> + <str name="field">spell</str> + <str name="distanceMeasure">org.apache.lucene.search.spell.JaroWinklerDistance</str> + <str name="spellcheckIndexDir">./spellchecker2</str> + + </lst> + + <lst name="spellchecker"> + <str name="classname">solr.FileBasedSpellChecker</str> + <str name="name">file</str> + <str name="sourceLocation">spellings.txt</str> + <str name="characterEncoding">UTF-8</str> + <str name="spellcheckIndexDir">./spellcheckerFile</str> + </lst> + </searchComponent> + + < ! - - a request handler utilizing the spellcheck component - - > + <requestHandler name="/spellCheckCompRH" class="solr.SearchHandler"> + <lst name="defaults"> + <str name="spellcheck.onlyMorePopular">false</str> + <str name="spellcheck.extendedResults">false</str> + <str name="spellcheck.count">1</str> + </lst> + <arr name="last-components"> + <str>spellcheck</str> + </arr> + </requestHandler> + --> + + <!-- a search component that enables you to configure the top results for + a given query regardless of the normal lucene scoring.--> + +<!-- poussin 20090902 remove elevate this file is empty, what need ? + <searchComponent name="elevator" class="solr.QueryElevationComponent" > + <str name="queryFieldType">string</str> + <str name="config-file">elevate.xml</str> + </searchComponent> + --> + <!-- a request handler utilizing the elevator component --> +<!-- + <requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy"> + <lst name="defaults"> + <str name="echoParams">explicit</str> + </lst> + <arr name="last-components"> + <str>elevator</str> + </arr> + </requestHandler> + --> + + <!-- Update request handler. + + Note: Since solr1.1 requestHandlers requires a valid content type header if posted in + the body. For example, curl now requires: -H 'Content-type:text/xml; charset=utf-8' + The response format differs from solr1.1 formatting and returns a standard error code. + + To enable solr1.1 behavior, remove the /update handler or change its path + --> + <requestHandler name="/update" class="solr.XmlUpdateRequestHandler" /> + + <!-- + Analysis request handler. Since Solr 1.3. Use to returnhow a document is analyzed. Useful + for debugging and as a token server for other types of applications + --> + <requestHandler name="/analysis" class="solr.AnalysisRequestHandler" /> + + + <!-- CSV update handler, loaded on demand --> + <requestHandler name="/update/csv" class="solr.CSVRequestHandler" startup="lazy" /> + + + <!-- + Admin Handlers - This will register all the standard admin RequestHandlers. Adding + this single handler is equivolent to registering: + + <requestHandler name="/admin/luke" class="org.apache.solr.handler.admin.LukeRequestHandler" /> + <requestHandler name="/admin/system" class="org.apache.solr.handler.admin.SystemInfoHandler" /> + <requestHandler name="/admin/plugins" class="org.apache.solr.handler.admin.PluginInfoHandler" /> + <requestHandler name="/admin/threads" class="org.apache.solr.handler.admin.ThreadDumpHandler" /> + <requestHandler name="/admin/properties" class="org.apache.solr.handler.admin.PropertiesRequestHandler" /> + <requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" > + + If you wish to hide files under ${solr.home}/conf, explicitly register the ShowFileRequestHandler using: + <requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" > + <lst name="invariants"> + <str name="hidden">synonyms.txt</str> + <str name="hidden">anotherfile.txt</str> + </lst> + </requestHandler> + --> + <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" /> + + <!-- ping/healthcheck --> + <requestHandler name="/admin/ping" class="PingRequestHandler"> + <lst name="defaults"> + <str name="qt">standard</str> + <str name="q">solrpingquery</str> + <str name="echoParams">all</str> + </lst> + </requestHandler> + + <!-- Echo the request contents back to the client --> + <requestHandler name="/debug/dump" class="solr.DumpRequestHandler" > + <lst name="defaults"> + <str name="echoParams">explicit</str> <!-- for all params (including the default etc) use: 'all' --> + <str name="echoHandler">true</str> + </lst> + </requestHandler> + + + + + + + + +<!-- TODO JC 2011-04-12 Commented when migrating to solr 3.1.0. Is this useful ? --> +<!--Highlighting should be moved to searchComponents--> + <!-- <highlighting> + <!– Configure the standard fragmenter –> + <!– This could most likely be commented out in the "default" case –> + <fragmenter name="gap" class="org.apache.solr.highlight.GapFragmenter" default="true"> + <lst name="defaults"> + <int name="hl.fragsize">100</int> + </lst> + </fragmenter> + + <!– A regular-expression-based fragmenter (f.i., for sentence extraction) –> + <fragmenter name="regex" class="org.apache.solr.highlight.RegexFragmenter"> + <lst name="defaults"> + <!– slightly smaller fragsizes work better because of slop –> + <int name="hl.fragsize">70</int> + <!– allow 50% slop on fragment sizes –> + <float name="hl.regex.slop">0.5</float> + <!– a basic sentence pattern –> + <str name="hl.regex.pattern">[-\w ,/\n\"']{20,200}</str> + </lst> + </fragmenter> + </highlighting>--> + + <queryParser name="lucene" class="org.nuiton.wikitty.storage.solr.WikittyQueryParser"/> + <queryParser name="wikitty" class="org.nuiton.wikitty.storage.solr.WikittyQueryParser"/> + + <!-- example of registering a query parser + <queryParser name="lucene" class="org.apache.solr.search.LuceneQParserPlugin"/> + --> + + <!-- example of registering a custom function parser + <valueSourceParser name="myfunc" class="com.mycompany.MyValueSourceParser" /> + --> + + <!-- config for the admin interface --> + <admin> + <defaultQuery>solr</defaultQuery> + + <!-- configure a healthcheck file for servers behind a loadbalancer + <healthcheck type="file">server-enabled</healthcheck> + --> + </admin> + +</config> Deleted: trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/SolrSearch2Test.java =================================================================== --- trunk/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/storage/solr/SolrSearch2Test.java 2011-04-11 16:02:52 UTC (rev 783) +++ trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/SolrSearch2Test.java 2011-04-12 08:41:03 UTC (rev 785) @@ -1,27 +0,0 @@ -package org.nuiton.wikitty.storage.solr; - -import org.nuiton.wikitty.WikittyConfig; -import org.nuiton.wikitty.WikittyService; -import org.nuiton.wikitty.api.AbstractSearchTest; - -/** - * User: couteau - * Date: 06/04/11 - */ -public class SolrSearch2Test extends AbstractSearchTest { - - WikittyService service; - - @Override - public WikittyService getWikittyService() { - - if (service == null) { - WikittyConfig config = new WikittyConfig(); - service = new WikittyServiceSolr(config); - } - - service.clear(null); - - return service; - } -} \ No newline at end of file Copied: trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/SolrSearch2Test.java (from rev 784, trunk/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/storage/solr/SolrSearch2Test.java) =================================================================== --- trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/SolrSearch2Test.java (rev 0) +++ trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/SolrSearch2Test.java 2011-04-12 08:41:03 UTC (rev 785) @@ -0,0 +1,51 @@ +/* + * #%L + * Wikitty :: wikitty-solr-impl + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2011 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +package org.nuiton.wikitty.storage.solr; + +import org.nuiton.wikitty.WikittyConfig; +import org.nuiton.wikitty.WikittyService; +import org.nuiton.wikitty.api.AbstractSearchTest; + +/** + * User: couteau + * Date: 06/04/11 + */ +public class SolrSearch2Test extends AbstractSearchTest { + + WikittyService service; + + @Override + public WikittyService getWikittyService() { + + if (service == null) { + WikittyConfig config = new WikittyConfig(); + service = new WikittyServiceSolr(config); + } + + service.clear(null); + + return service; + } +} \ No newline at end of file Deleted: trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/TreeTest.java =================================================================== --- trunk/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/storage/solr/TreeTest.java 2011-04-11 16:02:52 UTC (rev 783) +++ trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/TreeTest.java 2011-04-12 08:41:03 UTC (rev 785) @@ -1,570 +0,0 @@ -/* - * #%L - * Wikitty :: wikitty-solr-impl - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 CodeLutin, Benjamin Poussin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ - -package org.nuiton.wikitty.storage.solr; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.junit.Before; -import org.junit.Test; -import org.nuiton.wikitty.search.Criteria; -import org.nuiton.wikitty.entities.ExtensionFactory; -import org.nuiton.wikitty.entities.FieldType.TYPE; -import org.nuiton.wikitty.entities.WikittyTreeNode; -import org.nuiton.wikitty.entities.WikittyTreeNodeImpl; -import org.nuiton.wikitty.entities.Wikitty; -import org.nuiton.wikitty.entities.WikittyExtension; -import org.nuiton.wikitty.entities.WikittyImpl; -import org.nuiton.wikitty.services.WikittyEvent; -import org.nuiton.wikitty.conform.StorageTest; -import org.nuiton.wikitty.entities.WikittyTreeNodeHelper; -import org.nuiton.wikitty.search.Search; -import org.nuiton.wikitty.search.TreeNodeResult; - -/** - * - * @author ruchaud, martel - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ - */ -public class TreeTest extends AbstractTestSolr { - - static private Log log = LogFactory.getLog(TreeTest.class); - - protected WikittyExtension extension; - - @Before - public void onSetUp() throws Exception { - createBasicWikitty(); - createTestData(); - } - - /** - * Create a extension, use to store element in tree - */ - private void createBasicWikitty() { - extension = ExtensionFactory.create("test", "1") - .addField("name", TYPE.STRING) - .extension(); - ws.storeExtension(null, Arrays.asList(extension)); - } - - /** - * Init data with a basic tree - */ - private void createTestData() { - // Create tree as following : - // root - // |_ node 1 - // | |_ node 11 (2) - // | | |_ node 111 (1) - // | |_ node 12 - // | | |_ node 121 (2) - // | |_ node 13 - // |_ node 2 (1) - - createBranch("root/node1/node11/node111"); - createBranch("root/node1/node12/node121"); - createBranch("root/node1/node13"); - createBranch("root/node2"); - - addNode("node11", "value 1"); - addNode("node11", "value 2"); - - addNode("node111", "value 3"); - - addNode("node121", "value 4"); - addNode("node121", "value 5"); - - addNode("node2", "value 6"); - } - - /** - * Create all node contains in path - */ - protected void createBranch(String path) { - String parent = null; - String[] names = path.split("/"); - for (String name : names) { - - Wikitty found = findNode(name); - if(found == null) { - found = createNode(name, parent); - log.debug("[Storing] " + name + " with id " + found.getId()); - ws.store(null, found); - assertNotNull(findNode(name)); - } - parent = found.getId(); - } - } - - /** - * Attach value in node - */ - protected void addNode(String nodeName, String value) { - Wikitty leaf = new WikittyImpl(); - leaf.addExtension(extension); - leaf.setField("test", "name", value); - - log.debug("[Storing] " + value + " with id " + leaf.getId()); - ws.store(null, leaf); - - Wikitty node = findNode(nodeName); - assertNotNull(node); - WikittyTreeNodeHelper.addAttachment(node, leaf.getId()); - ws.store(null, node); - } - - /** - * Find node by name - */ - protected Wikitty findNode(String nodeName) { - Criteria criteria = Search.query().eq( - WikittyTreeNode.FQ_FIELD_WIKITTYTREENODE_NAME, nodeName).criteria(); - Wikitty wikitty = getProxy().findByCriteria(criteria); - return wikitty; - } - - /** - * Find value by name - */ - protected Wikitty findValue(String value) { - Criteria criteria = Search.query().eq("test.name", value).criteria(); - Wikitty wikitty = getProxy().findByCriteria(criteria); - return wikitty; - } - - static private class CollectAttachmentVisitor implements TreeNodeResult.Visitor<WikittyTreeNode> { - - protected Set attachment = new HashSet(); - - public Set getAttachment() { - return attachment; - } - - @Override - public boolean visitEnter(TreeNodeResult<WikittyTreeNode> node) { - Collection att = node.getObject().getAttachment(); - if (att != null) { - attachment.addAll(att); - } - return true; - } - - @Override - public boolean visitLeave(TreeNodeResult<WikittyTreeNode> node) { - return true; - } - } - - /** - * Count all element in sub tree, with element in node - */ - protected int sum(Wikitty node) { - // Sum attachment object in node - String nodeId = node.getId(); - TreeNodeResult<WikittyTreeNode> tree = getProxy().findTreeNode( - WikittyTreeNode.class, nodeId, -1, true, null); - CollectAttachmentVisitor visitor = new CollectAttachmentVisitor(); - tree.acceptVisitor(visitor); - - int result=visitor.getAttachment().size(); - return result; - } -// int sum = 0; -// -// // Sum value in node -// Set<String> values = WikittyTreeNodeHelper.getAttachment(node); -// if(values != null) { -// sum = values.size(); -// } -// -// // Sum children node in node -// String nodeId = node.getId(); -// TreeNodeResult<WikittyTreeNode> children = getProxy().findTreeNode( -// nodeId, 1, true, null); -// -// /* -// for (Integer count : children.values()) { -// sum += count; -// } -// */ -// -// for (TreeNodeResult<WikittyTreeNode> e : children.getChildren()) { -// log.debug("*treeNode = " + e.getObject().getName() + " " -// + e.getAttCount() + " -> " + e.getObject().getAttachment()); -// } -// -// for (TreeNodeResult<WikittyTreeNode> treeNodeResult : children) { -// WikittyTreeNode treeNode = treeNodeResult.getObject(); -// Set<String> treeNodeChildren = treeNode.getAttachment(); -// log.debug("+treeNode = " + treeNode.getName() + " " + -// (treeNodeChildren==null?0:treeNodeChildren.size()) + -// " -> " + treeNodeChildren); -//// if (treeNodeChildren == null) { -//// sum += 0; -//// } else { -//// sum += treeNodeChildren.size(); -//// } -// sum += sum(((WikittyTreeNodeImpl)treeNode).getWikitty()); -// } -// -// return sum; -// } - - /** - * Create a Wikitty WikittyTreeNode - * - * @param name - * name of the node - * @param parentId - * id of the parent - * @return - * the wikitty object corresponding to the WikittyTreeNode - */ - protected Wikitty createNode(String name, String parentId) { - // on force l'id pour simplifier le debuggage - WikittyImpl w = new WikittyImpl("id" + name); - WikittyTreeNodeImpl node = new WikittyTreeNodeImpl(w); - node.setName(name); - node.setParent(parentId); - Wikitty nodeWikitty = node.getWikitty(); - return nodeWikitty; - } - - @Test - public void testRestoreTree() throws Exception { - Wikitty root = findNode("root"); - String rootId = root.getId(); - - TreeNodeResult<WikittyTreeNode> tree = - getProxy().findTreeNode(WikittyTreeNode.class, rootId, -1, false, null); - assertNotNull(tree); - } - - @Test - public void testHiearchicalFacet() throws Exception { - Wikitty root = findNode("root"); - int sum = sum(root); - assertEquals(6, sum); - - Wikitty node1 = findNode("node1"); - sum = sum(node1); - assertEquals(5, sum); - - Wikitty node11 = findNode("node11"); - sum = sum(node11); - assertEquals(3, sum); - } - - @Test - public void testRestoreChildren() throws Exception { - Wikitty node1 = findNode("node1"); - String node1Id = node1.getId(); - - TreeNodeResult<WikittyTreeNode> children = getProxy().findTreeNode( - WikittyTreeNode.class, node1Id, 1, false, null); - assertEquals(3, children.getChildCount()); - } - - @Test - public void testFilterRestoreChildren() { - Map<String, Integer> result = new HashMap<String, Integer>(); - result.put("node11", 1); - result.put("node13", 0); - result.put("node12", 0); - - Wikitty node1 = findNode("node1"); - String node1Id = node1.getId(); - - Criteria filter = Search.query().eq("test.name", "value 3").criteria(); - TreeNodeResult<WikittyTreeNode> children = getProxy().findTreeNode( - WikittyTreeNode.class, node1Id, 1, true, filter); - System.out.println(children); - assertEquals(3, children.getChildCount()); - for (TreeNodeResult<WikittyTreeNode> e : children.getChildren()) { - assertEquals(result.get(e.getObject().getName()), Integer.valueOf(e.getAttCount())); - } - } - - @Test - public void testRestoreNode() throws Exception { - Wikitty node11 = findNode("node11"); - String node11Id = node11.getId(); - - TreeNodeResult<WikittyTreeNode> count = getProxy().findTreeNode( - WikittyTreeNode.class, node11Id, 0, true, null); - assertEquals(3, count.getAttCount()); - } - - @Test - public void testFilterRestoreNode() throws Exception { - Wikitty node11 = findNode("node11"); - String node11Id = node11.getId(); - - Criteria filter = Search.query().eq("test.name", "value 3").criteria(); - TreeNodeResult<WikittyTreeNode> count = getProxy().findTreeNode( - WikittyTreeNode.class, node11Id, 0, true, filter); - System.out.println(count); - assertEquals(1, count.getAttCount()); - } - - @Test - public void testNewNode() throws Exception { - // Check that node 2 it has any child - Wikitty node2 = findNode("node2"); - String node2Id = node2.getId(); - TreeNodeResult<WikittyTreeNode> children = getProxy().findTreeNode( - WikittyTreeNode.class, node2Id, 1, true, null); - assertEquals(0, children.getChildCount()); - - // Create a new node, child of node 2 - Wikitty nodeWikitty = createNode("node21", node2Id); - ws.store(null, nodeWikitty); - - // Retrieve it to check - Wikitty found = findNode("node21"); - assertNotNull(found); - - // Check that it was great added as node2 child - children = getProxy().findTreeNode( - WikittyTreeNode.class, node2Id, 1, false, null); - assertEquals(1, children.getChildCount()); - } - - @Test - public void testAddValueInNode() throws Exception { - // Get the initial number of values for Root node - Wikitty root = findNode("root"); - int childInit = sum(root); - - // Create a leaf - Wikitty leaf = StorageTest.createWikitty("name=totoTheLeaf", "test", extension); - ws.store(null, leaf); - - // Add it in the node2 (now: two values in it) - Wikitty node = findNode("node2"); - assertNotNull(node); - WikittyTreeNodeHelper.addAttachment(node, leaf.getId()); - ws.store(null, node); - - // now, there is one more value for the root node - int newSum = sum(root); - assertEquals(childInit + 1, newSum); - } - - @Test - public void testDeleteNode() throws Exception { - // Get the initial number of values for Root node - Wikitty root = findNode("root"); - int rootChildInit = sum(root); - - // Remove the node 121 - Wikitty node121 = findNode("node121"); - int node121Init = sum(node121); - String node121Id = node121.getId(); - ws.delete(null, node121Id); - - // node12 must have any child - Wikitty node12 = findNode("node12"); - int sum = sum(node12); - assertEquals(0, sum); - - // check that root node has weel one less children value - int newRootChidlren = sum(root); - assertEquals(rootChildInit - node121Init, newRootChidlren); - - // Remove the node 1 and node 11 simultaneously - Wikitty node1 = findNode("node1"); - int node1Init = sum(node1); - String node1Id = node1.getId(); - - Wikitty node11 = findNode("node11"); - String node11Id = node11.getId(); - ws.delete(null, Arrays.asList(node1Id, node11Id)); - - // check that root node has weel one less children value - newRootChidlren = sum(root); - assertEquals(rootChildInit - node121Init - node1Init, newRootChidlren); - } - - @Test - public void testDeleteChild() throws Exception { - // Get the initial number of values for Root node - Wikitty root = findNode("root"); - int childInit = sum(root); - - // Remove a value on node11 - Wikitty node = findNode("node11"); - - List<String> leafs = new ArrayList<String>(WikittyTreeNodeHelper.getAttachment(node)); - node.removeFromField(WikittyTreeNode.EXT_WIKITTYTREENODE, WikittyTreeNode.FIELD_WIKITTYTREENODE_ATTACHMENT, leafs.get(0)); - - leafs = new ArrayList<String>(WikittyTreeNodeHelper.getAttachment(node)); - log.info("leafs after remove = " + leafs); - - ws.store(null, node); - - node = ws.restore(null, node.getId()); - leafs = new ArrayList<String>(WikittyTreeNodeHelper.getAttachment(node)); - log.info("leafs after restore = " + leafs); - - // now, there is one more value for the root node - int newSum = sum(root); - assertEquals(childInit - 1, newSum); - } - - /** regression test, for unknown reason the child may not be removed in the index */ - @Test - public void testSimpleDeleteChild() throws Exception { - - WikittyTreeNodeImpl parent = new WikittyTreeNodeImpl(); - ws.store(null, parent.getWikitty()); - - WikittyTreeNodeImpl child = new WikittyTreeNodeImpl(); - child.setParent(parent.getWikittyId()); - WikittyEvent event = ws.store(null, child.getWikitty()); - event.update(child.getWikitty()); - - TreeNodeResult<WikittyTreeNode> children = getProxy().findTreeNode( - WikittyTreeNode.class, parent.getWikittyId(), 1, true, null); - - assertEquals(1, children.getChildCount()); - assertEquals(0, children.getChild(child).getAttCount()); - - child.setParent(null); - - ws.store(null, child.getWikitty()); - - children = getProxy().findTreeNode( - WikittyTreeNode.class, parent.getWikittyId(), 1, true, null); - - assertEquals(0, children.getChildCount()); - } - - @Test - public void testDeleteValue() throws Exception { - // Get the initial number of values for Root node - Wikitty root = findNode("root"); - int childInit = sum(root); - - // Remove a value - Wikitty value4 = findValue("value 4"); - String value4Id = value4.getId(); - ws.delete(null, value4Id); - - // now, there is one more value for the root node - int newSum = sum(root); - assertEquals(childInit - 1, newSum); - } - - @Test - public void testMoveNode() throws Exception { - // Get the initial number of values for node 1 - Wikitty node1 = findNode("node1"); - int childSum1 = sum(node1); - - // Get the initial number of values for node 121 - Wikitty node121 = findNode("node121"); - int childSum121 = sum(node121); - - // Get the initial number of values for node 2 - Wikitty node2 = findNode("node2"); - int childSum2 = sum(node2); - - // Move node 1 in mode 2 - WikittyTreeNodeHelper.setParent(node121, node2.getId()); - ws.store(null, node121); - - // now, there is less value node 121 for the node 1 - int newSum1 = sum(node1); - assertEquals(childSum1 - childSum121, newSum1); - - // now, there is more value node 121 for the node 2 - int newSum2 = sum(node2); - assertEquals(childSum2 + childSum121, newSum2); - } - - @Test - public void testValueInMultipleNode() throws Exception { - createBranch("node3/node31"); - createBranch("node3/node32"); - - Wikitty value = StorageTest.createWikitty("name=value", "test", extension); - ws.store(null, value); - String valueId = value.getId(); - - Wikitty node31 = findNode("node31"); - WikittyTreeNodeHelper.addAttachment(node31, valueId); - ws.store(null, node31); - - Wikitty node32 = findNode("node32"); - WikittyTreeNodeHelper.addAttachment(node32, valueId); - ws.store(null, node32); - - Wikitty node3 = findNode("node3"); - int sum = sum(node3); - assertEquals(1, sum); - - TreeNodeResult<WikittyTreeNode> count = getProxy().findTreeNode( - WikittyTreeNode.class, node3.getId(), 0, true, null); - assertEquals(1, count.getAttCount()); - - sum = sum(node31); - assertEquals(1, sum); - - sum = sum(node32); - assertEquals(1, sum); - } - - // verifier que l'indexation de l'arbre fonctionne bien et la reindexation aussi - @Test - public void testReindexation() throws Exception { -// FIXME poussin 20101222 a faire - // creer deux arbres (3 noeud) - // mettre 3 attachments par noeud (les memes) dans les 2 arbres - - // enlever un attachment par noeud et supprime le noeud intermediaire - // en meme temps et store les arbres - - // verifier que tout est bien reindexe et que le dernier noeud est bien - // devenu un noeud root - } - -} Copied: trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/TreeTest.java (from rev 784, trunk/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/storage/solr/TreeTest.java) =================================================================== --- trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/TreeTest.java (rev 0) +++ trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/TreeTest.java 2011-04-12 08:41:03 UTC (rev 785) @@ -0,0 +1,570 @@ +/* + * #%L + * Wikitty :: wikitty-solr-impl + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2010 CodeLutin, Benjamin Poussin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +package org.nuiton.wikitty.storage.solr; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.junit.Before; +import org.junit.Test; +import org.nuiton.wikitty.search.Criteria; +import org.nuiton.wikitty.entities.ExtensionFactory; +import org.nuiton.wikitty.entities.FieldType.TYPE; +import org.nuiton.wikitty.entities.WikittyTreeNode; +import org.nuiton.wikitty.entities.WikittyTreeNodeImpl; +import org.nuiton.wikitty.entities.Wikitty; +import org.nuiton.wikitty.entities.WikittyExtension; +import org.nuiton.wikitty.entities.WikittyImpl; +import org.nuiton.wikitty.services.WikittyEvent; +import org.nuiton.wikitty.conform.StorageTest; +import org.nuiton.wikitty.entities.WikittyTreeNodeHelper; +import org.nuiton.wikitty.search.Search; +import org.nuiton.wikitty.search.TreeNodeResult; + +/** + * + * @author ruchaud, martel + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ +public class TreeTest extends AbstractTestSolr { + + static private Log log = LogFactory.getLog(TreeTest.class); + + protected WikittyExtension extension; + + @Before + public void onSetUp() throws Exception { + createBasicWikitty(); + createTestData(); + } + + /** + * Create a extension, use to store element in tree + */ + private void createBasicWikitty() { + extension = ExtensionFactory.create("test", "1") + .addField("name", TYPE.STRING) + .extension(); + ws.storeExtension(null, Arrays.asList(extension)); + } + + /** + * Init data with a basic tree + */ + private void createTestData() { + // Create tree as following : + // root + // |_ node 1 + // | |_ node 11 (2) + // | | |_ node 111 (1) + // | |_ node 12 + // | | |_ node 121 (2) + // | |_ node 13 + // |_ node 2 (1) + + createBranch("root/node1/node11/node111"); + createBranch("root/node1/node12/node121"); + createBranch("root/node1/node13"); + createBranch("root/node2"); + + addNode("node11", "value 1"); + addNode("node11", "value 2"); + + addNode("node111", "value 3"); + + addNode("node121", "value 4"); + addNode("node121", "value 5"); + + addNode("node2", "value 6"); + } + + /** + * Create all node contains in path + */ + protected void createBranch(String path) { + String parent = null; + String[] names = path.split("/"); + for (String name : names) { + + Wikitty found = findNode(name); + if(found == null) { + found = createNode(name, parent); + log.debug("[Storing] " + name + " with id " + found.getId()); + ws.store(null, found); + assertNotNull(findNode(name)); + } + parent = found.getId(); + } + } + + /** + * Attach value in node + */ + protected void addNode(String nodeName, String value) { + Wikitty leaf = new WikittyImpl(); + leaf.addExtension(extension); + leaf.setField("test", "name", value); + + log.debug("[Storing] " + value + " with id " + leaf.getId()); + ws.store(null, leaf); + + Wikitty node = findNode(nodeName); + assertNotNull(node); + WikittyTreeNodeHelper.addAttachment(node, leaf.getId()); + ws.store(null, node); + } + + /** + * Find node by name + */ + protected Wikitty findNode(String nodeName) { + Criteria criteria = Search.query().eq( + WikittyTreeNode.FQ_FIELD_WIKITTYTREENODE_NAME, nodeName).criteria(); + Wikitty wikitty = getProxy().findByCriteria(criteria); + return wikitty; + } + + /** + * Find value by name + */ + protected Wikitty findValue(String value) { + Criteria criteria = Search.query().eq("test.name", value).criteria(); + Wikitty wikitty = getProxy().findByCriteria(criteria); + return wikitty; + } + + static private class CollectAttachmentVisitor implements TreeNodeResult.Visitor<WikittyTreeNode> { + + protected Set attachment = new HashSet(); + + public Set getAttachment() { + return attachment; + } + + @Override + public boolean visitEnter(TreeNodeResult<WikittyTreeNode> node) { + Collection att = node.getObject().getAttachment(); + if (att != null) { + attachment.addAll(att); + } + return true; + } + + @Override + public boolean visitLeave(TreeNodeResult<WikittyTreeNode> node) { + return true; + } + } + + /** + * Count all element in sub tree, with element in node + */ + protected int sum(Wikitty node) { + // Sum attachment object in node + String nodeId = node.getId(); + TreeNodeResult<WikittyTreeNode> tree = getProxy().findTreeNode( + WikittyTreeNode.class, nodeId, -1, true, null); + CollectAttachmentVisitor visitor = new CollectAttachmentVisitor(); + tree.acceptVisitor(visitor); + + int result=visitor.getAttachment().size(); + return result; + } +// int sum = 0; +// +// // Sum value in node +// Set<String> values = WikittyTreeNodeHelper.getAttachment(node); +// if(values != null) { +// sum = values.size(); +// } +// +// // Sum children node in node +// String nodeId = node.getId(); +// TreeNodeResult<WikittyTreeNode> children = getProxy().findTreeNode( +// nodeId, 1, true, null); +// +// /* +// for (Integer count : children.values()) { +// sum += count; +// } +// */ +// +// for (TreeNodeResult<WikittyTreeNode> e : children.getChildren()) { +// log.debug("*treeNode = " + e.getObject().getName() + " " +// + e.getAttCount() + " -> " + e.getObject().getAttachment()); +// } +// +// for (TreeNodeResult<WikittyTreeNode> treeNodeResult : children) { +// WikittyTreeNode treeNode = treeNodeResult.getObject(); +// Set<String> treeNodeChildren = treeNode.getAttachment(); +// log.debug("+treeNode = " + treeNode.getName() + " " + +// (treeNodeChildren==null?0:treeNodeChildren.size()) + +// " -> " + treeNodeChildren); +//// if (treeNodeChildren == null) { +//// sum += 0; +//// } else { +//// sum += treeNodeChildren.size(); +//// } +// sum += sum(((WikittyTreeNodeImpl)treeNode).getWikitty()); +// } +// +// return sum; +// } + + /** + * Create a Wikitty WikittyTreeNode + * + * @param name + * name of the node + * @param parentId + * id of the parent + * @return + * the wikitty object corresponding to the WikittyTreeNode + */ + protected Wikitty createNode(String name, String parentId) { + // on force l'id pour simplifier le debuggage + WikittyImpl w = new WikittyImpl("id" + name); + WikittyTreeNodeImpl node = new WikittyTreeNodeImpl(w); + node.setName(name); + node.setParent(parentId); + Wikitty nodeWikitty = node.getWikitty(); + return nodeWikitty; + } + + @Test + public void testRestoreTree() throws Exception { + Wikitty root = findNode("root"); + String rootId = root.getId(); + + TreeNodeResult<WikittyTreeNode> tree = + getProxy().findTreeNode(WikittyTreeNode.class, rootId, -1, false, null); + assertNotNull(tree); + } + + @Test + public void testHierarchicalFacet() throws Exception { + Wikitty root = findNode("root"); + int sum = sum(root); + assertEquals(6, sum); + + Wikitty node1 = findNode("node1"); + sum = sum(node1); + assertEquals(5, sum); + + Wikitty node11 = findNode("node11"); + sum = sum(node11); + assertEquals(3, sum); + } + + @Test + public void testRestoreChildren() throws Exception { + Wikitty node1 = findNode("node1"); + String node1Id = node1.getId(); + + TreeNodeResult<WikittyTreeNode> children = getProxy().findTreeNode( + WikittyTreeNode.class, node1Id, 1, false, null); + assertEquals(3, children.getChildCount()); + } + + @Test + public void testFilterRestoreChildren() { + Map<String, Integer> result = new HashMap<String, Integer>(); + result.put("node11", 1); + result.put("node13", 0); + result.put("node12", 0); + + Wikitty node1 = findNode("node1"); + String node1Id = node1.getId(); + + Criteria filter = Search.query().eq("test.name", "value 3").criteria(); + TreeNodeResult<WikittyTreeNode> children = getProxy().findTreeNode( + WikittyTreeNode.class, node1Id, 1, true, filter); + System.out.println(children); + assertEquals(3, children.getChildCount()); + for (TreeNodeResult<WikittyTreeNode> e : children.getChildren()) { + assertEquals(result.get(e.getObject().getName()), Integer.valueOf(e.getAttCount())); + } + } + + @Test + public void testRestoreNode() throws Exception { + Wikitty node11 = findNode("node11"); + String node11Id = node11.getId(); + + TreeNodeResult<WikittyTreeNode> count = getProxy().findTreeNode( + WikittyTreeNode.class, node11Id, 0, true, null); + assertEquals(3, count.getAttCount()); + } + + @Test + public void testFilterRestoreNode() throws Exception { + Wikitty node11 = findNode("node11"); + String node11Id = node11.getId(); + + Criteria filter = Search.query().eq("test.name", "value 3").criteria(); + TreeNodeResult<WikittyTreeNode> count = getProxy().findTreeNode( + WikittyTreeNode.class, node11Id, 0, true, filter); + System.out.println(count); + assertEquals(1, count.getAttCount()); + } + + @Test + public void testNewNode() throws Exception { + // Check that node 2 it has any child + Wikitty node2 = findNode("node2"); + String node2Id = node2.getId(); + TreeNodeResult<WikittyTreeNode> children = getProxy().findTreeNode( + WikittyTreeNode.class, node2Id, 1, true, null); + assertEquals(0, children.getChildCount()); + + // Create a new node, child of node 2 + Wikitty nodeWikitty = createNode("node21", node2Id); + ws.store(null, nodeWikitty); + + // Retrieve it to check + Wikitty found = findNode("node21"); + assertNotNull(found); + + // Check that it was great added as node2 child + children = getProxy().findTreeNode( + WikittyTreeNode.class, node2Id, 1, false, null); + assertEquals(1, children.getChildCount()); + } + + @Test + public void testAddValueInNode() throws Exception { + // Get the initial number of values for Root node + Wikitty root = findNode("root"); + int childInit = sum(root); + + // Create a leaf + Wikitty leaf = StorageTest.createWikitty("name=totoTheLeaf", "test", extension); + ws.store(null, leaf); + + // Add it in the node2 (now: two values in it) + Wikitty node = findNode("node2"); + assertNotNull(node); + WikittyTreeNodeHelper.addAttachment(node, leaf.getId()); + ws.store(null, node); + + // now, there is one more value for the root node + int newSum = sum(root); + assertEquals(childInit + 1, newSum); + } + + @Test + public void testDeleteNode() throws Exception { + // Get the initial number of values for Root node + Wikitty root = findNode("root"); + int rootChildInit = sum(root); + + // Remove the node 121 + Wikitty node121 = findNode("node121"); + int node121Init = sum(node121); + String node121Id = node121.getId(); + ws.delete(null, node121Id); + + // node12 must have any child + Wikitty node12 = findNode("node12"); + int sum = sum(node12); + assertEquals(0, sum); + + // check that root node has weel one less children value + int newRootChidlren = sum(root); + assertEquals(rootChildInit - node121Init, newRootChidlren); + + // Remove the node 1 and node 11 simultaneously + Wikitty node1 = findNode("node1"); + int node1Init = sum(node1); + String node1Id = node1.getId(); + + Wikitty node11 = findNode("node11"); + String node11Id = node11.getId(); + ws.delete(null, Arrays.asList(node1Id, node11Id)); + + // check that root node has weel one less children value + newRootChidlren = sum(root); + assertEquals(rootChildInit - node121Init - node1Init, newRootChidlren); + } + + @Test + public void testDeleteChild() throws Exception { + // Get the initial number of values for Root node + Wikitty root = findNode("root"); + int childInit = sum(root); + + // Remove a value on node11 + Wikitty node = findNode("node11"); + + List<String> leafs = new ArrayList<String>(WikittyTreeNodeHelper.getAttachment(node)); + node.removeFromField(WikittyTreeNode.EXT_WIKITTYTREENODE, WikittyTreeNode.FIELD_WIKITTYTREENODE_ATTACHMENT, leafs.get(0)); + + leafs = new ArrayList<String>(WikittyTreeNodeHelper.getAttachment(node)); + log.info("leafs after remove = " + leafs); + + ws.store(null, node); + + node = ws.restore(null, node.getId()); + leafs = new ArrayList<String>(WikittyTreeNodeHelper.getAttachment(node)); + log.info("leafs after restore = " + leafs); + + // now, there is one more value for the root node + int newSum = sum(root); + assertEquals(childInit - 1, newSum); + } + + /** regression test, for unknown reason the child may not be removed in the index */ + @Test + public void testSimpleDeleteChild() throws Exception { + + WikittyTreeNodeImpl parent = new WikittyTreeNodeImpl(); + ws.store(null, parent.getWikitty()); + + WikittyTreeNodeImpl child = new WikittyTreeNodeImpl(); + child.setParent(parent.getWikittyId()); + WikittyEvent event = ws.store(null, child.getWikitty()); + event.update(child.getWikitty()); + + TreeNodeResult<WikittyTreeNode> children = getProxy().findTreeNode( + WikittyTreeNode.class, parent.getWikittyId(), 1, true, null); + + assertEquals(1, children.getChildCount()); + assertEquals(0, children.getChild(child).getAttCount()); + + child.setParent(null); + + ws.store(null, child.getWikitty()); + + children = getProxy().findTreeNode( + WikittyTreeNode.class, parent.getWikittyId(), 1, true, null); + + assertEquals(0, children.getChildCount()); + } + + @Test + public void testDeleteValue() throws Exception { + // Get the initial number of values for Root node + Wikitty root = findNode("root"); + int childInit = sum(root); + + // Remove a value + Wikitty value4 = findValue("value 4"); + String value4Id = value4.getId(); + ws.delete(null, value4Id); + + // now, there is one more value for the root node + int newSum = sum(root); + assertEquals(childInit - 1, newSum); + } + + @Test + public void testMoveNode() throws Exception { + // Get the initial number of values for node 1 + Wikitty node1 = findNode("node1"); + int childSum1 = sum(node1); + + // Get the initial number of values for node 121 + Wikitty node121 = findNode("node121"); + int childSum121 = sum(node121); + + // Get the initial number of values for node 2 + Wikitty node2 = findNode("node2"); + int childSum2 = sum(node2); + + // Move node 1 in mode 2 + WikittyTreeNodeHelper.setParent(node121, node2.getId()); + ws.store(null, node121); + + // now, there is less value node 121 for the node 1 + int newSum1 = sum(node1); + assertEquals(childSum1 - childSum121, newSum1); + + // now, there is more value node 121 for the node 2 + int newSum2 = sum(node2); + assertEquals(childSum2 + childSum121, newSum2); + } + + @Test + public void testValueInMultipleNode() throws Exception { + createBranch("node3/node31"); + createBranch("node3/node32"); + + Wikitty value = StorageTest.createWikitty("name=value", "test", extension); + ws.store(null, value); + String valueId = value.getId(); + + Wikitty node31 = findNode("node31"); + WikittyTreeNodeHelper.addAttachment(node31, valueId); + ws.store(null, node31); + + Wikitty node32 = findNode("node32"); + WikittyTreeNodeHelper.addAttachment(node32, valueId); + ws.store(null, node32); + + Wikitty node3 = findNode("node3"); + int sum = sum(node3); + assertEquals(1, sum); + + TreeNodeResult<WikittyTreeNode> count = getProxy().findTreeNode( + WikittyTreeNode.class, node3.getId(), 0, true, null); + assertEquals(1, count.getAttCount()); + + sum = sum(node31); + assertEquals(1, sum); + + sum = sum(node32); + assertEquals(1, sum); + } + + // verifier que l'indexation de l'arbre fonctionne bien et la reindexation aussi + @Test + public void testReindexation() throws Exception { +// FIXME poussin 20101222 a faire + // creer deux arbres (3 noeud) + // mettre 3 attachments par noeud (les memes) dans les 2 arbres + + // enlever un attachment par noeud et supprime le noeud intermediaire + // en meme temps et store les arbres + + // verifier que tout est bien reindexe et que le dernier noeud est bien + // devenu un noeud root + } + +} Deleted: trunk/wikitty-solr-impl/LICENSE.txt =================================================================== --- trunk/wikitty-solr-impl/LICENSE.txt 2011-04-12 08:26:26 UTC (rev 784) +++ trunk/wikitty-solr-impl/LICENSE.txt 2011-04-12 08:41:03 UTC (rev 785) @@ -1,166 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. - Deleted: trunk/wikitty-solr-impl/pom.xml =================================================================== --- trunk/wikitty-solr-impl/pom.xml 2011-04-12 08:26:26 UTC (rev 784) +++ trunk/wikitty-solr-impl/pom.xml 2011-04-12 08:41:03 UTC (rev 785) @@ -1,109 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.nuiton</groupId> - <artifactId>wikitty</artifactId> - <version>3.1-SNAPSHOT</version> - </parent> - - <!-- ************************************************************* --> - <!-- *** POM Relationships *************************************** --> - <!-- ************************************************************* --> - - <groupId>org.nuiton.wikitty</groupId> - <artifactId>wikitty-solr-impl</artifactId> - - <dependencies> - - <!-- sibling dependencies --> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>wikitty-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>wikitty-api</artifactId> - <version>${project.version}</version> - <classifier>tests</classifier> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>jboss.jbossts</groupId> - <artifactId>jbossjta</artifactId> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-utils</artifactId> - </dependency> - - <!-- SOLR --> - <dependency> - <groupId>org.apache.solr</groupId> - <artifactId>solr-core</artifactId> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-jdk14</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.apache.solr</groupId> - <artifactId>solr-solrj</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-core</artifactId> - </dependency> - - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - </dependency> - - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </dependency> - - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - </dependency> - - <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - </dependency> - <!-- TEST --> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - - </dependencies> - - <!-- ************************************************************* --> - <!-- *** Project Information ************************************* --> - <!-- ************************************************************* --> - - <name>Wikitty :: wikitty-solr-impl</name> - - <description>Wikiity solr search engine</description> - <inceptionYear>2009</inceptionYear> -</project> -
participants (1)
-
jcouteau@users.nuiton.org