Wikitty-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
April 2011
- 6 participants
- 99 discussions
r793 - trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication
by mfortun@users.nuiton.org 12 Apr '11
by mfortun@users.nuiton.org 12 Apr '11
12 Apr '11
Author: mfortun
Date: 2011-04-12 17:31:01 +0200 (Tue, 12 Apr 2011)
New Revision: 793
Url: http://nuiton.org/repositories/revision/wikitty/793
Log:
* add a new class used as a value in a map when harvest for file as wikitty
* complete the restore method within the wikittypublicationfilesystem
* add some static method for file harvesting
Added:
trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/FileSystemWIkittyId.java
Modified:
trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublication.java
trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublicationFileSystem.java
Added: trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/FileSystemWIkittyId.java
===================================================================
--- trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/FileSystemWIkittyId.java (rev 0)
+++ trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/FileSystemWIkittyId.java 2011-04-12 15:31:01 UTC (rev 793)
@@ -0,0 +1,37 @@
+package org.nuiton.wikitty.publication;
+
+/**
+ *
+ * Class usefull to save location and file name of a wikitty on a file system
+ *
+ * @author mfortun
+ *
+ */
+public class FileSystemWIkittyId {
+
+ protected String fileName;
+ protected String path;
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public FileSystemWIkittyId(String fileName, String path) {
+ super();
+ this.setFileName(fileName);
+ this.setPath(path);
+ }
+
+}
Property changes on: trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/FileSystemWIkittyId.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublication.java
===================================================================
--- trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublication.java 2011-04-12 12:41:07 UTC (rev 792)
+++ trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublication.java 2011-04-12 15:31:01 UTC (rev 793)
@@ -262,7 +262,7 @@
* @return list of harvested file
*/
static protected List<File> listFile(File starts, boolean recursivly) {
- ArrayList<File> result = new ArrayList<File>();
+ List<File> result = new ArrayList<File>();
if (!starts.isDirectory()) {
result.add(starts);
}
@@ -780,4 +780,30 @@
props.store(new FileWriter(propertiesFiles), "");
}
}
+
+
+ /**
+ * Method that create a list of the properties directory
+ *
+ * @param starts
+ * harvested directory
+ * @param recursivly
+ * @return list of harvested file
+ */
+ static public List<File> harvestPropertyDirectory (File starts, boolean recursivly){
+
+ List<File> result = new ArrayList<File>();
+
+ for (File child : starts.listFiles()) {
+
+ if (child.isDirectory() && child.getName().equals(PROPERTY_DIRECTORY)) {
+ result.add(child);
+ } else if (child.isDirectory() && recursivly){
+ result.addAll(harvestPropertyDirectory(child, recursivly));
+ }
+ }
+ return result;
+
+
+ }
}
Modified: trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublicationFileSystem.java
===================================================================
--- trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublicationFileSystem.java 2011-04-12 12:41:07 UTC (rev 792)
+++ trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublicationFileSystem.java 2011-04-12 15:31:01 UTC (rev 793)
@@ -29,8 +29,11 @@
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.FileWriter;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import java.util.Set;
@@ -217,19 +220,17 @@
}
// create the directories from the label
- boolean pathFilecreated = createFilesFromLabelPath(ourDir,
- homeFile);
+ boolean pathFilecreated = createFilesFromLabelPath(ourDir);
if (pathFilecreated) {
// create the path with the label
String path = homeFile.getCanonicalFile() + File.separator
+ ourDir.replace(".", File.separator);
-
- //correct the pb with directory name begin by .
+
+ // correct the pb with directory name begin by .
path = path.replace(File.separator + File.separator,
File.separator + ".");
-
// create the propertie directory if necessary
File propertieDirectory = new File(path + File.separator
+ WikittyPublication.PROPERTY_DIRECTORY);
@@ -245,6 +246,7 @@
if (!propertieFile.exists()) {
propertieFile.createNewFile();
}
+
// load/create id propertie file
File idPropertieFile = new File(
propertieDirectory.getCanonicalPath()
@@ -301,6 +303,9 @@
Properties metaProperties = new Properties();
metaProperties.load(new FileReader(propertieFile));
// update
+ metaProperties.setProperty(
+ WikittyPublication.META_CURRENT_LABEL, ourDir);
+
metaProperties.setProperty(name + "." + extension
+ ".version", w.getVersion());
metaProperties.setProperty(name + "." + extension
@@ -321,7 +326,6 @@
}
}
-
} catch (Exception e) {
e.printStackTrace();
// TODO mfortun-2011-04-12 really handle exceptions
@@ -387,15 +391,73 @@
@Override
public List<Wikitty> restore(String securityToken, List<String> id) {
- // TODO mfortun-2011-04-05
+ List<Wikitty> result = new ArrayList<Wikitty>();
+ try {
+ Map<String, FileSystemWIkittyId> locations = harvestLocalWikitties(
+ homeFile, recursion);
- /*
- *
- */
+ for (String wikid : id) {
+ FileSystemWIkittyId localisation = locations.get(wikid);
+ // create the wikitty with his id
+ Wikitty wikitty = new WikittyImpl(wikid);
+ // add label extension
+ wikitty.addExtension(WikittyLabelImpl.extensionWikittyLabel);
- throw new UnsupportedOperationException("not yet implemented");
- // return null;
+ // preparation for mime research and file research
+ String path = localisation.getPath();
+ String completeName = localisation.getFileName();
+ // search for the file
+ File fileToTransform = new File(path + File.separator
+ + completeName);
+
+ String extension = FileUtil.extension(fileToTransform);
+ String name = FileUtil.basename(completeName, "." + extension);
+ // search for the mimetype
+ String mimeType = mimeTypeForExtension(extension);
+
+ // load properties
+ Properties props = new Properties();
+ File propsFile = new File(path + File.separator
+ + WikittyPublication.PROPERTY_DIRECTORY
+ + File.separator
+ + WikittyPublication.WIKITTY_FILE_META_PROPERTIES_FILE);
+ props.load(new FileReader(propsFile));
+ // re set the id
+ wikitty.setVersion(props.getProperty(completeName
+ + WikittyPublication.META_SUFFIX_KEY_ID));
+
+ // set the current label
+ WikittyLabelHelper.addLabels(wikitty, props
+ .getProperty(WikittyPublication.META_CURRENT_LABEL));
+
+ /*
+ * TODO mfortun-2011-04-12 need to merge part of this code with
+ * filetowikitty method 'cause it is basically the same
+ */
+
+ // create the correct wikittypubxxx
+ if (isMimeWikittyPubText(mimeType)) {
+ wikitty.addExtension(WikittyPubTextImpl.extensionWikittyPubText);
+ WikittyPubTextHelper.setName(wikitty, name);
+ WikittyPubTextHelper.setMimeType(wikitty, mimeType);
+ WikittyPubTextHelper.setContent(wikitty,
+ FileUtil.readAsString(fileToTransform));
+ } else {
+ wikitty.addExtension(WikittyPubDataImpl.extensionWikittyPubData);
+ WikittyPubDataHelper.setName(wikitty, name);
+ WikittyPubDataHelper.setMimeType(wikitty, mimeType);
+ WikittyPubDataHelper.setContent(wikitty,
+ FileUtil.fileToByte(fileToTransform));
+ }
+
+ result.add(wikitty);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ // TODO mfortun-2011-01-12 really handle exception
+ }
+ return result;
}
@Override
@@ -476,7 +538,6 @@
static public Wikitty fileToWikitty(File fileToTransform, File starts)
throws Exception {
-
String completeName = fileToTransform.getName();
// isolate extension and file name
@@ -506,11 +567,11 @@
String path = startDirName + pathToFile.replaceAll(pathToStart, "");
/*
- * FIXME actually with a dot as a wikittylabel_separator,
- * when restauring label to directory it destroy directory that containt dot
+ * FIXME actually with a dot as a wikittylabel_separator, when
+ * restauring label to directory it destroy directory that containt dot
* in the name e.g.: /home/truc.machin/bob
*/
-
+
String label = path.replaceAll(File.separator, WIKITTYLABEL_SEPARATOR);
WikittyLabelHelper.addLabels(result, label);
@@ -594,13 +655,10 @@
*
* @param label
* the path string
- * @param starts
- * the working directory
* @return if all the path was created
* @throws Exception
*/
- static public boolean createFilesFromLabelPath(String label, File starts)
- throws Exception {
+ protected boolean createFilesFromLabelPath(String label) throws Exception {
label = label.replace(".", File.separator);
label = label.replace(File.separator + File.separator, File.separator
@@ -609,8 +667,8 @@
boolean result = false;
- if (starts.exists() && starts.isDirectory()) {
- String path = starts.getCanonicalPath();
+ if (homeFile.exists() && homeFile.isDirectory()) {
+ String path = homeFile.getCanonicalPath();
result = true;
for (int i = 0; i < pathElements.length; i++) {
@@ -623,4 +681,56 @@
return result;
}
+
+ /**
+ *
+ * @param starts
+ * @param recursivly
+ * @return
+ * @throws Exception
+ */
+ static public Map<String, FileSystemWIkittyId> harvestLocalWikitties(
+ File starts, boolean recursivly) throws Exception {
+ Map<String, FileSystemWIkittyId> result = new HashMap<String, FileSystemWIkittyId>();
+
+ /*
+ * TODO mfortun-2011-04-12 find a better way to have cohesion class that
+ * call another class that call last class <_<. May be a class for file
+ * access/harvest method
+ */
+ List<File> propertiesDirectory = WikittyPublication
+ .harvestPropertyDirectory(starts, recursivly);
+
+ for (File propsDir : propertiesDirectory) {
+
+ Properties idProps = new Properties();
+ File idFile = new File(propsDir.getCanonicalPath() + File.separator
+ + WikittyPublication.WIKITTY_ID_PROPERTIES_FILE);
+ if (idFile.exists()) {
+ idProps.load(new FileReader(idFile));
+ }
+
+ Set<Object> ids = idProps.keySet();
+
+ for (Object id : ids) {
+ String name = idProps.getProperty((String) id);
+ String path = propsDir.getParent();
+ FileSystemWIkittyId value = new FileSystemWIkittyId(name, path);
+
+ result.put((String) id, value);
+ }
+
+ }
+
+ /*
+ * Pour l'arborescence des fichiers on va aller chercher les fichiers de
+ * propriété id et meta dans le dossier .wp pour aller récup les labels
+ * courant et les id liés on va renvoyer la map
+ *
+ * id, label
+ */
+
+ return result;
+ }
+
}
1
0
r792 - trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication
by mfortun@users.nuiton.org 12 Apr '11
by mfortun@users.nuiton.org 12 Apr '11
12 Apr '11
Author: mfortun
Date: 2011-04-12 14:41:07 +0200 (Tue, 12 Apr 2011)
New Revision: 792
Url: http://nuiton.org/repositories/revision/wikitty/792
Log:
*Correct pb with directory with a name that begin with a "."
Modified:
trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublication.java
trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublicationFileSystem.java
Modified: trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublication.java
===================================================================
--- trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublication.java 2011-04-12 11:05:53 UTC (rev 791)
+++ trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublication.java 2011-04-12 12:41:07 UTC (rev 792)
@@ -216,6 +216,7 @@
WikittyProxy remoteWikittyService = new WikittyProxy(
WikittyServiceFactory.buildWikittyService(applicationConfig));
+ remoteWikittyService.clear();
// load the list of file
List<File> toTransfert = listFile(dir, !noRecur);
@@ -307,7 +308,7 @@
WikittyProxy remoteWikittyService = new WikittyProxy(
WikittyServiceFactory.buildWikittyService(applicationConfig));
WikittyPublicationFileSystem localWikittyService = new WikittyPublicationFileSystem(
- dir, noRecur, label);
+ dir, !noRecur, label);
@@ -340,11 +341,7 @@
PagedResult<Wikitty> pageResult= remoteWikittyService.findAllByCriteria(labelCriteria);
List<Wikitty> wikittiesToWrite = pageResult.getAll();
-
- for ( Wikitty w : wikittiesToWrite){
- System.out.println(w);
-
- }
+
// write the proper properties file!
Modified: trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublicationFileSystem.java
===================================================================
--- trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublicationFileSystem.java 2011-04-12 11:05:53 UTC (rev 791)
+++ trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublicationFileSystem.java 2011-04-12 12:41:07 UTC (rev 792)
@@ -25,19 +25,14 @@
package org.nuiton.wikitty.publication;
import java.io.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.FileWriter;
-import java.io.InputStreamReader;
import java.util.Collection;
-import java.util.HashSet;
import java.util.List;
import java.util.Properties;
import java.util.Set;
-import java.util.TreeSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -48,7 +43,6 @@
import org.nuiton.wikitty.entities.Wikitty;
import org.nuiton.wikitty.entities.WikittyExtension;
import org.nuiton.wikitty.entities.WikittyImpl;
-import org.nuiton.wikitty.entities.WikittyLabel;
import org.nuiton.wikitty.entities.WikittyLabelHelper;
import org.nuiton.wikitty.entities.WikittyLabelImpl;
import org.nuiton.wikitty.publication.entities.WikittyPubData;
@@ -229,8 +223,13 @@
if (pathFilecreated) {
// create the path with the label
String path = homeFile.getCanonicalFile() + File.separator
- + ourDir.replaceAll(".", File.separator);
+ + ourDir.replace(".", File.separator);
+
+ //correct the pb with directory name begin by .
+ path = path.replace(File.separator + File.separator,
+ File.separator + ".");
+
// create the propertie directory if necessary
File propertieDirectory = new File(path + File.separator
+ WikittyPublication.PROPERTY_DIRECTORY);
@@ -305,7 +304,7 @@
metaProperties.setProperty(name + "." + extension
+ ".version", w.getVersion());
metaProperties.setProperty(name + "." + extension
- + ".id", w.getVersion());
+ + ".id", w.getId());
metaProperties.setProperty(name + "." + extension
+ ".checksum", localMd5);
// save
@@ -322,29 +321,15 @@
}
}
- /*
- * pour chaque wikitty en fonction du type on va aller écrire le
- * fichier avec la bonne extention en fonction du mime.
- *
- * Et niveau propriété : double entré d'id, checksum, version aussi.
- *
- *
- * faire en deux passes, pour mettre les labels et labels courant
- * aussi les ranger et tout.
- */
- // StringUtil.encodeMD5(toEncode)
-
} catch (Exception e) {
e.printStackTrace();
- //TODO mfortun-2011-04-12 really handle exceptions
+ // TODO mfortun-2011-04-12 really handle exceptions
}
WikittyEvent result = new WikittyEvent(this);
return result;
- // return null;
-
}
@Override
@@ -491,6 +476,7 @@
static public Wikitty fileToWikitty(File fileToTransform, File starts)
throws Exception {
+
String completeName = fileToTransform.getName();
// isolate extension and file name
@@ -519,6 +505,12 @@
*/
String path = startDirName + pathToFile.replaceAll(pathToStart, "");
+ /*
+ * FIXME actually with a dot as a wikittylabel_separator,
+ * when restauring label to directory it destroy directory that containt dot
+ * in the name e.g.: /home/truc.machin/bob
+ */
+
String label = path.replaceAll(File.separator, WIKITTYLABEL_SEPARATOR);
WikittyLabelHelper.addLabels(result, label);
@@ -572,9 +564,9 @@
* TODO mfortun-2011-04-11 really implements this method
*/
if (mime.equalsIgnoreCase("ws")) {
- return "application/javascript";
+ return "ws";
} else {
- return "image/png";
+ return "ws";
}
}
@@ -609,18 +601,23 @@
*/
static public boolean createFilesFromLabelPath(String label, File starts)
throws Exception {
- String[] pathElements = StringUtil.split(label, ".");
+ label = label.replace(".", File.separator);
+ label = label.replace(File.separator + File.separator, File.separator
+ + ".");
+ String[] pathElements = StringUtil.split(label, File.separator);
+
boolean result = false;
if (starts.exists() && starts.isDirectory()) {
String path = starts.getCanonicalPath();
-
+ result = true;
for (int i = 0; i < pathElements.length; i++) {
path = path + File.separator + pathElements[i];
File temp = new File(path);
- result = result && FileUtil.createDirectoryIfNecessary(temp);
+ FileUtil.createDirectoryIfNecessary(temp);
+ result = result && temp.exists();
}
}
1
0
Author: jcouteau
Date: 2011-04-12 13:05:53 +0200 (Tue, 12 Apr 2011)
New Revision: 791
Url: http://nuiton.org/repositories/revision/wikitty/791
Log:
Use wikitty-solr instead of wikitty-solr-impl
Modified:
trunk/wikitty-jdbc/pom.xml
Modified: trunk/wikitty-jdbc/pom.xml
===================================================================
--- trunk/wikitty-jdbc/pom.xml 2011-04-12 10:04:16 UTC (rev 790)
+++ trunk/wikitty-jdbc/pom.xml 2011-04-12 11:05:53 UTC (rev 791)
@@ -23,7 +23,7 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>wikitty-solr-impl</artifactId>
+ <artifactId>wikitty-solr</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
1
0
r790 - in trunk/wikitty-solr: . src/test/java/org/nuiton/wikitty/storage/solr
by jcouteau@users.nuiton.org 12 Apr '11
by jcouteau@users.nuiton.org 12 Apr '11
12 Apr '11
Author: jcouteau
Date: 2011-04-12 12:04:16 +0200 (Tue, 12 Apr 2011)
New Revision: 790
Url: http://nuiton.org/repositories/revision/wikitty/790
Log:
Anomalie #1166: Bad test configuration - Fix for solr module
Added:
trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/SolrTestHelper.java
Modified:
trunk/wikitty-solr/pom.xml
trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/AbstractTestSolr.java
trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/SolrSearch2Test.java
trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/WikittySearchEngineSolrTest.java
Modified: trunk/wikitty-solr/pom.xml
===================================================================
--- trunk/wikitty-solr/pom.xml 2011-04-12 08:59:05 UTC (rev 789)
+++ trunk/wikitty-solr/pom.xml 2011-04-12 10:04:16 UTC (rev 790)
@@ -105,5 +105,33 @@
<description>Wikiity solr search engine</description>
<inceptionYear>2009</inceptionYear>
+
+
+ <build>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefirePluginVersion}</version>
+ <configuration>
+ <systemPropertyVariables>
+ <!-- Override property so that solr temp dir is in target during tests -->
+ <wikitty.searchengine.solr.directory.data>
+ ${java.io.tmpdir}/solr/data
+ </wikitty.searchengine.solr.directory.data>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefirePluginVersion}</version>
+ </plugin>
+ </plugins>
+ </build>
</project>
Modified: trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/AbstractTestSolr.java
===================================================================
--- trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/AbstractTestSolr.java 2011-04-12 08:59:05 UTC (rev 789)
+++ trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/AbstractTestSolr.java 2011-04-12 10:04:16 UTC (rev 790)
@@ -25,17 +25,20 @@
package org.nuiton.wikitty.storage.solr;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.nuiton.wikitty.WikittyConfig;
import org.nuiton.wikitty.WikittyProxy;
+import org.nuiton.wikitty.entities.Wikitty;
import org.nuiton.wikitty.services.WikittyServiceEnhanced;
public abstract class AbstractTestSolr {
protected WikittyProxy proxy = null;
- protected WikittyServiceEnhanced ws =
- new WikittyServiceEnhanced(new WikittyServiceSolr(new WikittyConfig()));
+ protected static WikittyConfig instance = new WikittyConfig();
+ protected static WikittyServiceEnhanced ws;
+
public WikittyProxy getProxy() {
if (proxy == null) {
proxy = new WikittyProxy(ws);
@@ -48,4 +51,12 @@
ws.clear(null);
}
+ @BeforeClass
+ public static void initTests() throws Exception {
+
+ SolrTestHelper.initTests(instance);
+
+ ws = new WikittyServiceEnhanced(new WikittyServiceSolr(instance));
+ }
+
}
Modified: trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/SolrSearch2Test.java
===================================================================
--- trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/SolrSearch2Test.java 2011-04-12 08:59:05 UTC (rev 789)
+++ trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/SolrSearch2Test.java 2011-04-12 10:04:16 UTC (rev 790)
@@ -24,6 +24,7 @@
*/
package org.nuiton.wikitty.storage.solr;
+import org.junit.BeforeClass;
import org.nuiton.wikitty.WikittyConfig;
import org.nuiton.wikitty.WikittyService;
import org.nuiton.wikitty.api.AbstractSearchTest;
@@ -36,11 +37,17 @@
WikittyService service;
+ static protected WikittyConfig config = new WikittyConfig();
+
+ @BeforeClass
+ public static void initTests() {
+ SolrTestHelper.initTests(config);
+ }
+
@Override
public WikittyService getWikittyService() {
if (service == null) {
- WikittyConfig config = new WikittyConfig();
service = new WikittyServiceSolr(config);
}
Added: trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/SolrTestHelper.java
===================================================================
--- trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/SolrTestHelper.java (rev 0)
+++ trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/SolrTestHelper.java 2011-04-12 10:04:16 UTC (rev 790)
@@ -0,0 +1,35 @@
+package org.nuiton.wikitty.storage.solr;
+
+import java.io.File;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.ApplicationConfig;
+import org.nuiton.wikitty.WikittyConfig;
+
+/**
+ * User: couteau
+ * Date: 12/04/11
+ */
+public class SolrTestHelper {
+
+ static private Log log = LogFactory.getLog(SolrTestHelper.class);
+
+ public static void initTests(ApplicationConfig config) {
+ // Create tmpdir if not exist
+ String tmpdir = System.getProperty("java.io.tmpdir");
+ File file = new File(tmpdir);
+ if (!file.exists()) {
+ file.mkdirs();
+ }
+
+ // file where to put wikitty datas
+ File dataDirectory = new File(tmpdir, "wikitty-data-store");
+ if (log.isInfoEnabled()) {
+ log.info("Will use data directory : " + dataDirectory);
+ }
+
+ // set data dir configuration
+ config.setOption(WikittyConfig.WikittyOption.WIKITTY_DATA_DIR.key,
+ dataDirectory.getAbsolutePath());
+ }
+}
Modified: trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/WikittySearchEngineSolrTest.java
===================================================================
--- trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/WikittySearchEngineSolrTest.java 2011-04-12 08:59:05 UTC (rev 789)
+++ trunk/wikitty-solr/src/test/java/org/nuiton/wikitty/storage/solr/WikittySearchEngineSolrTest.java 2011-04-12 10:04:16 UTC (rev 790)
@@ -34,6 +34,7 @@
import org.apache.commons.logging.LogFactory;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.nuiton.wikitty.WikittyConfig;
import org.nuiton.wikitty.WikittyProxy;
@@ -59,8 +60,10 @@
/** to use log facility, just put in your code: log.info(\"...\"); */
private static final Log log = LogFactory.getLog(WikittySearchEngineSolrTest.class);
- protected WikittyServiceSolr ws = new WikittyServiceSolr(new WikittyConfig());
+ protected static WikittyServiceSolr ws;
+ protected static WikittyConfig instance = new WikittyConfig();
+
protected WikittyProxy proxy = new WikittyProxy(ws);
@Before
@@ -68,6 +71,14 @@
ws.clear(null);
}
+ @BeforeClass
+ public static void initTests() throws Exception {
+
+ SolrTestHelper.initTests(instance);
+
+ ws = new WikittyServiceSolr(instance);
+ }
+
@Test
public void testFullTextSearch() throws Exception {
// for id for easy debugging
1
0
Author: jcouteau
Date: 2011-04-12 10:59:05 +0200 (Tue, 12 Apr 2011)
New Revision: 789
Url: http://nuiton.org/repositories/revision/wikitty/789
Log:
Remove hbase-impl
Removed:
trunk/wikitty-hbase-impl/
1
0
Author: jcouteau
Date: 2011-04-12 10:52:45 +0200 (Tue, 12 Apr 2011)
New Revision: 788
Url: http://nuiton.org/repositories/revision/wikitty/788
Log:
Remove wikitty-jdbc-impl and wikitty-solr-impl
Removed:
trunk/wikitty-jdbc-impl/
trunk/wikitty-solr-impl/
1
0
Author: jcouteau
Date: 2011-04-12 10:52:05 +0200 (Tue, 12 Apr 2011)
New Revision: 787
Url: http://nuiton.org/repositories/revision/wikitty/787
Log:
Evolution #1267: Remove unmaintained module or update it (hbase, jpa, jms, multistorage, ui) - Removed all unbuild and unmaintained modules
Removed:
trunk/wikitty-jms-impl/
trunk/wikitty-jpa-impl/
trunk/wikitty-multistorage-impl/
trunk/wikitty-ui-gwt/
trunk/wikitty-ui-zk/
1
0
r786 - trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication
by mfortun@users.nuiton.org 12 Apr '11
by mfortun@users.nuiton.org 12 Apr '11
12 Apr '11
Author: mfortun
Date: 2011-04-12 10:50:53 +0200 (Tue, 12 Apr 2011)
New Revision: 786
Url: http://nuiton.org/repositories/revision/wikitty/786
Log:
* fixed the directory creation before write file, now "recursivly" create all the parents necessary using the "label/path"
Modified:
trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublicationFileSystem.java
Modified: trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublicationFileSystem.java
===================================================================
--- trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublicationFileSystem.java 2011-04-12 08:41:03 UTC (rev 785)
+++ trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublicationFileSystem.java 2011-04-12 08:50:53 UTC (rev 786)
@@ -37,6 +37,7 @@
import java.util.List;
import java.util.Properties;
import java.util.Set;
+import java.util.TreeSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -205,8 +206,6 @@
public WikittyEvent store(String securityToken,
Collection<Wikitty> wikitties, boolean force) {
-
- // FIXME mfortun-2011-04-11 need to create the directory file first
try {
for (Wikitty w : wikitties) {
@@ -223,98 +222,103 @@
}
}
- // create the path with the label
- String path = homeFile.getCanonicalFile() + File.separator
- + ourDir.replaceAll(".", File.separator);
- // create the directory
- File directory = new File(path);
- if (!directory.exists() || !directory.isDirectory()) {
- directory.mkdir();
- }
- // create the propertie directory if necessary
- File propertieDirectory = new File(path + File.separator
- + WikittyPublication.PROPERTY_DIRECTORY);
- if (!propertieDirectory.exists()
- || !propertieDirectory.isDirectory()) {
- propertieDirectory.mkdir();
- }
- // load/create meta propertie file
- File propertieFile = new File(
- propertieDirectory.getCanonicalPath()
- + File.separator
- + WikittyPublication.WIKITTY_FILE_META_PROPERTIES_FILE);
- if (!propertieFile.exists()) {
- propertieFile.createNewFile();
- }
- // load/create id propertie file
- File idPropertieFile = new File(
- propertieDirectory.getCanonicalPath() + File.separator
- + WikittyPublication.WIKITTY_ID_PROPERTIES_FILE);
- if (!idPropertieFile.exists()) {
- idPropertieFile.createNewFile();
- }
+ // create the directories from the label
+ boolean pathFilecreated = createFilesFromLabelPath(ourDir,
+ homeFile);
- String name = "";
- String extension = "";
+ if (pathFilecreated) {
+ // create the path with the label
+ String path = homeFile.getCanonicalFile() + File.separator
+ + ourDir.replaceAll(".", File.separator);
- File wikittyFile = null;
- if (w.hasExtension(WikittyPubData.EXT_WIKITTYPUBDATA)) {
- name = WikittyPubDataHelper.getName(w);
- String mime = WikittyPubDataHelper.getMimeType(w);
- byte[] content = WikittyPubDataHelper.getContent(w);
+ // create the propertie directory if necessary
+ File propertieDirectory = new File(path + File.separator
+ + WikittyPublication.PROPERTY_DIRECTORY);
+ if (!propertieDirectory.exists()
+ || !propertieDirectory.isDirectory()) {
+ propertieDirectory.mkdir();
+ }
+ // load/create meta propertie file
+ File propertieFile = new File(
+ propertieDirectory.getCanonicalPath()
+ + File.separator
+ + WikittyPublication.WIKITTY_FILE_META_PROPERTIES_FILE);
+ if (!propertieFile.exists()) {
+ propertieFile.createNewFile();
+ }
+ // load/create id propertie file
+ File idPropertieFile = new File(
+ propertieDirectory.getCanonicalPath()
+ + File.separator
+ + WikittyPublication.WIKITTY_ID_PROPERTIES_FILE);
+ if (!idPropertieFile.exists()) {
+ idPropertieFile.createNewFile();
+ }
- extension = extensionFormimeType(mime);
+ String name = "";
+ String extension = "";
- wikittyFile = new File(path + File.separator + name + "."
- + extension);
+ File wikittyFile = null;
+ if (w.hasExtension(WikittyPubData.EXT_WIKITTYPUBDATA)) {
+ name = WikittyPubDataHelper.getName(w);
+ String mime = WikittyPubDataHelper.getMimeType(w);
+ byte[] content = WikittyPubDataHelper.getContent(w);
- wikittyFile.createNewFile();
+ extension = extensionFormimeType(mime);
- FileUtil.byteToFile(content, wikittyFile);
+ wikittyFile = new File(path + File.separator + name
+ + "." + extension);
- } else if (w.hasExtension(WikittyPubText.EXT_WIKITTYPUBTEXT)) {
- name = WikittyPubTextHelper.getName(w);
- String mime = WikittyPubTextHelper.getMimeType(w);
- String content = WikittyPubTextHelper.getContent(w);
+ wikittyFile.createNewFile();
- extension = extensionFormimeType(mime);
+ FileUtil.byteToFile(content, wikittyFile);
- wikittyFile = new File(path + File.separator + name + "."
- + extension);
+ } else if (w
+ .hasExtension(WikittyPubText.EXT_WIKITTYPUBTEXT)) {
+ name = WikittyPubTextHelper.getName(w);
+ String mime = WikittyPubTextHelper.getMimeType(w);
+ String content = WikittyPubTextHelper.getContent(w);
- wikittyFile.createNewFile();
+ extension = extensionFormimeType(mime);
- FileUtil.writeString(wikittyFile, content);
- }
+ wikittyFile = new File(path + File.separator + name
+ + "." + extension);
- if (wikittyFile != null) {
- // prepare for checksum
- BufferedInputStream input = new BufferedInputStream(
- new FileInputStream(wikittyFile));
+ wikittyFile.createNewFile();
- byte[] byt = MD5InputStream.hash(input);
+ FileUtil.writeString(wikittyFile, content);
+ }
- String localMd5 = StringUtil.asHex(byt);
+ if (wikittyFile != null) {
+ // prepare for checksum
+ BufferedInputStream input = new BufferedInputStream(
+ new FileInputStream(wikittyFile));
- // load meta properties
- Properties metaProperties = new Properties();
- metaProperties.load(new FileReader(propertieFile));
- // update
- metaProperties.setProperty(name + "." + extension
- + ".version", w.getVersion());
- metaProperties.setProperty(name + "." + extension + ".id",
- w.getVersion());
- metaProperties.setProperty(name + "." + extension
- + ".checksum", localMd5);
- // save
- metaProperties.store(new FileWriter(propertieFile), "");
- // load id properties
- Properties idProperties = new Properties();
- idProperties.load(new FileReader(idPropertieFile));
- // update
- idProperties.setProperty(w.getId(), name + "." + extension);
- // save
- idProperties.store(new FileWriter(idPropertieFile), "");
+ byte[] byt = MD5InputStream.hash(input);
+
+ String localMd5 = StringUtil.asHex(byt);
+
+ // load meta properties
+ Properties metaProperties = new Properties();
+ metaProperties.load(new FileReader(propertieFile));
+ // update
+ metaProperties.setProperty(name + "." + extension
+ + ".version", w.getVersion());
+ metaProperties.setProperty(name + "." + extension
+ + ".id", w.getVersion());
+ metaProperties.setProperty(name + "." + extension
+ + ".checksum", localMd5);
+ // save
+ metaProperties.store(new FileWriter(propertieFile), "");
+ // load id properties
+ Properties idProperties = new Properties();
+ idProperties.load(new FileReader(idPropertieFile));
+ // update
+ idProperties.setProperty(w.getId(), name + "."
+ + extension);
+ // save
+ idProperties.store(new FileWriter(idPropertieFile), "");
+ }
}
}
@@ -332,7 +336,8 @@
// StringUtil.encodeMD5(toEncode)
} catch (Exception e) {
-
+ e.printStackTrace();
+ //TODO mfortun-2011-04-12 really handle exceptions
}
WikittyEvent result = new WikittyEvent(this);
@@ -591,4 +596,34 @@
}
}
+ /**
+ * Creates all the file system require from a label path in the working
+ * directory
+ *
+ * @param label
+ * the path string
+ * @param starts
+ * the working directory
+ * @return if all the path was created
+ * @throws Exception
+ */
+ static public boolean createFilesFromLabelPath(String label, File starts)
+ throws Exception {
+ String[] pathElements = StringUtil.split(label, ".");
+
+ boolean result = false;
+
+ if (starts.exists() && starts.isDirectory()) {
+ String path = starts.getCanonicalPath();
+
+ for (int i = 0; i < pathElements.length; i++) {
+
+ path = path + File.separator + pathElements[i];
+ File temp = new File(path);
+ result = result && FileUtil.createDirectoryIfNecessary(temp);
+ }
+ }
+
+ return result;
+ }
}
1
0
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
by jcouteau@users.nuiton.org 12 Apr '11
by jcouteau@users.nuiton.org 12 Apr '11
12 Apr '11
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>
-
1
0
Author: jcouteau
Date: 2011-04-12 10:26:26 +0200 (Tue, 12 Apr 2011)
New Revision: 784
Url: http://nuiton.org/repositories/revision/wikitty/784
Log:
Evolution #1429: Update to solr 3.1.0 - Everything works fine except tree indexation, test will fail
Add license on files
Removed:
trunk/wikitty-solr-impl/src/main/java/org/nuiton/wikitty/storage/solr/RAMDirectoryFactory.java
Modified:
trunk/pom.xml
trunk/src/site/rst/user/faq.rst
trunk/src/site/rst/user/search.rst
trunk/src/site/rst/user/security.rst
trunk/wikitty-api/src/main/java/org/nuiton/wikitty/ScriptEvaluator.java
trunk/wikitty-api/src/main/java/org/nuiton/wikitty/search/operators/False.java
trunk/wikitty-api/src/main/java/org/nuiton/wikitty/search/operators/Like.java
trunk/wikitty-api/src/main/java/org/nuiton/wikitty/search/operators/True.java
trunk/wikitty-api/src/main/java/org/nuiton/wikitty/search/operators/Unlike.java
trunk/wikitty-api/src/main/java/org/nuiton/wikitty/services/WikittyServiceHook.java
trunk/wikitty-api/src/main/resources/wikitty-config-sample-inmemory.properties
trunk/wikitty-api/src/site/rst/dataModel.rst
trunk/wikitty-api/src/test/java/org/nuiton/wikitty/api/AbstractSearchTest.java
trunk/wikitty-api/src/test/java/org/nuiton/wikitty/api/InMemorySearchTest.java
trunk/wikitty-jdbc-impl/src/main/java/org/nuiton/wikitty/services/WikittyServiceInMemoryJdbcSolr.java
trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublication.java
trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublicationFileSystem.java
trunk/wikitty-solr-impl/pom.xml
trunk/wikitty-solr-impl/src/main/resources/schema.xml
trunk/wikitty-solr-impl/src/main/resources/solrconfig.xml
trunk/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/storage/solr/SolrSearch2Test.java
trunk/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/storage/solr/TreeTest.java
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-04-11 16:02:52 UTC (rev 783)
+++ trunk/pom.xml 2011-04-12 08:26:26 UTC (rev 784)
@@ -156,21 +156,21 @@
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-core</artifactId>
- <version>1.4.1</version>
+ <version>3.1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
- <version>1.4.1</version>
+ <version>3.1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
- <version>2.9.4</version>
+ <version>3.1.0</version>
<scope>compile</scope>
</dependency>
Modified: trunk/src/site/rst/user/faq.rst
===================================================================
--- trunk/src/site/rst/user/faq.rst 2011-04-11 16:02:52 UTC (rev 783)
+++ trunk/src/site/rst/user/faq.rst 2011-04-12 08:26:26 UTC (rev 784)
@@ -1,3 +1,27 @@
+.. -
+.. * #%L
+.. * Wikitty
+.. *
+.. * $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%
+.. -
=========================
FAQ - Foire aux questions
=========================
Modified: trunk/src/site/rst/user/search.rst
===================================================================
--- trunk/src/site/rst/user/search.rst 2011-04-11 16:02:52 UTC (rev 783)
+++ trunk/src/site/rst/user/search.rst 2011-04-12 08:26:26 UTC (rev 784)
@@ -1,3 +1,27 @@
+.. -
+.. * #%L
+.. * Wikitty
+.. *
+.. * $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%
+.. -
======================
Recherche avec Wikitty
======================
Modified: trunk/src/site/rst/user/security.rst
===================================================================
--- trunk/src/site/rst/user/security.rst 2011-04-11 16:02:52 UTC (rev 783)
+++ trunk/src/site/rst/user/security.rst 2011-04-12 08:26:26 UTC (rev 784)
@@ -1,3 +1,27 @@
+.. -
+.. * #%L
+.. * Wikitty
+.. *
+.. * $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%
+.. -
Utiliser la sécurité dans Wikitty
=================================
Modified: trunk/wikitty-api/src/main/java/org/nuiton/wikitty/ScriptEvaluator.java
===================================================================
--- trunk/wikitty-api/src/main/java/org/nuiton/wikitty/ScriptEvaluator.java 2011-04-11 16:02:52 UTC (rev 783)
+++ trunk/wikitty-api/src/main/java/org/nuiton/wikitty/ScriptEvaluator.java 2011-04-12 08:26:26 UTC (rev 784)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * Wikitty :: api
+ *
+ * $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;
Modified: trunk/wikitty-api/src/main/java/org/nuiton/wikitty/search/operators/False.java
===================================================================
--- trunk/wikitty-api/src/main/java/org/nuiton/wikitty/search/operators/False.java 2011-04-11 16:02:52 UTC (rev 783)
+++ trunk/wikitty-api/src/main/java/org/nuiton/wikitty/search/operators/False.java 2011-04-12 08:26:26 UTC (rev 784)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * Wikitty :: api
+ *
+ * $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.search.operators;
import java.io.Serializable;
Modified: trunk/wikitty-api/src/main/java/org/nuiton/wikitty/search/operators/Like.java
===================================================================
--- trunk/wikitty-api/src/main/java/org/nuiton/wikitty/search/operators/Like.java 2011-04-11 16:02:52 UTC (rev 783)
+++ trunk/wikitty-api/src/main/java/org/nuiton/wikitty/search/operators/Like.java 2011-04-12 08:26:26 UTC (rev 784)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * Wikitty :: api
+ *
+ * $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.search.operators;
import java.io.Serializable;
Modified: trunk/wikitty-api/src/main/java/org/nuiton/wikitty/search/operators/True.java
===================================================================
--- trunk/wikitty-api/src/main/java/org/nuiton/wikitty/search/operators/True.java 2011-04-11 16:02:52 UTC (rev 783)
+++ trunk/wikitty-api/src/main/java/org/nuiton/wikitty/search/operators/True.java 2011-04-12 08:26:26 UTC (rev 784)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * Wikitty :: api
+ *
+ * $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.search.operators;
import java.io.Serializable;
Modified: trunk/wikitty-api/src/main/java/org/nuiton/wikitty/search/operators/Unlike.java
===================================================================
--- trunk/wikitty-api/src/main/java/org/nuiton/wikitty/search/operators/Unlike.java 2011-04-11 16:02:52 UTC (rev 783)
+++ trunk/wikitty-api/src/main/java/org/nuiton/wikitty/search/operators/Unlike.java 2011-04-12 08:26:26 UTC (rev 784)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * Wikitty :: api
+ *
+ * $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.search.operators;
import java.io.Serializable;
Modified: trunk/wikitty-api/src/main/java/org/nuiton/wikitty/services/WikittyServiceHook.java
===================================================================
--- trunk/wikitty-api/src/main/java/org/nuiton/wikitty/services/WikittyServiceHook.java 2011-04-11 16:02:52 UTC (rev 783)
+++ trunk/wikitty-api/src/main/java/org/nuiton/wikitty/services/WikittyServiceHook.java 2011-04-12 08:26:26 UTC (rev 784)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * Wikitty :: api
+ *
+ * $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.services;
Modified: trunk/wikitty-api/src/main/resources/wikitty-config-sample-inmemory.properties
===================================================================
--- trunk/wikitty-api/src/main/resources/wikitty-config-sample-inmemory.properties 2011-04-11 16:02:52 UTC (rev 783)
+++ trunk/wikitty-api/src/main/resources/wikitty-config-sample-inmemory.properties 2011-04-12 08:26:26 UTC (rev 784)
@@ -39,7 +39,7 @@
wikitty.WikittyServiceStorage.components=org.nuiton.wikitty.jdbc.WikittyExtensionStorageJDBC,\
org.nuiton.wikitty.jdbc.WikittyStorageJDBC,\
org.nuiton.wikitty.storage.solr.WikittySearchEngineSolr
-wikitty.searchengine.solr.directory.factory=org.nuiton.wikitty.storage.solr.RAMDirectoryFactory
+wikitty.searchengine.solr.directory.factory=org.apache.solr.core.RAMDirectoryFactory
wikitty.service.cache.allwaysRestoreCopies=false
wikitty.service.event.propagate=false
wikitty.service.event.listen=false
Modified: trunk/wikitty-api/src/site/rst/dataModel.rst
===================================================================
--- trunk/wikitty-api/src/site/rst/dataModel.rst 2011-04-11 16:02:52 UTC (rev 783)
+++ trunk/wikitty-api/src/site/rst/dataModel.rst 2011-04-12 08:26:26 UTC (rev 784)
@@ -1,3 +1,27 @@
+.. -
+.. * #%L
+.. * Wikitty :: api
+.. *
+.. * $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%
+.. -
====================
Le modèle de données
====================
Modified: trunk/wikitty-api/src/test/java/org/nuiton/wikitty/api/AbstractSearchTest.java
===================================================================
--- trunk/wikitty-api/src/test/java/org/nuiton/wikitty/api/AbstractSearchTest.java 2011-04-11 16:02:52 UTC (rev 783)
+++ trunk/wikitty-api/src/test/java/org/nuiton/wikitty/api/AbstractSearchTest.java 2011-04-12 08:26:26 UTC (rev 784)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * Wikitty :: api
+ *
+ * $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.api;
import org.junit.Assert;
Modified: trunk/wikitty-api/src/test/java/org/nuiton/wikitty/api/InMemorySearchTest.java
===================================================================
--- trunk/wikitty-api/src/test/java/org/nuiton/wikitty/api/InMemorySearchTest.java 2011-04-11 16:02:52 UTC (rev 783)
+++ trunk/wikitty-api/src/test/java/org/nuiton/wikitty/api/InMemorySearchTest.java 2011-04-12 08:26:26 UTC (rev 784)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * Wikitty :: api
+ *
+ * $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.api;
import org.nuiton.wikitty.WikittyConfig;
Modified: trunk/wikitty-jdbc-impl/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-impl/src/main/java/org/nuiton/wikitty/services/WikittyServiceInMemoryJdbcSolr.java 2011-04-12 08:26:26 UTC (rev 784)
@@ -29,11 +29,11 @@
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.RAMDirectoryFactory;
import org.nuiton.wikitty.storage.solr.WikittySearchEngineSolr;
/**
Modified: trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublication.java
===================================================================
--- trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublication.java 2011-04-11 16:02:52 UTC (rev 783)
+++ trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublication.java 2011-04-12 08:26:26 UTC (rev 784)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * Wikitty :: publication
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 - 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.publication;
import java.io.File;
Modified: trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublicationFileSystem.java
===================================================================
--- trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublicationFileSystem.java 2011-04-11 16:02:52 UTC (rev 783)
+++ trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/WikittyPublicationFileSystem.java 2011-04-12 08:26:26 UTC (rev 784)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * Wikitty :: publication
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 - 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.publication;
import java.io.BufferedInputStream;
Modified: trunk/wikitty-solr-impl/pom.xml
===================================================================
--- trunk/wikitty-solr-impl/pom.xml 2011-04-11 16:02:52 UTC (rev 783)
+++ trunk/wikitty-solr-impl/pom.xml 2011-04-12 08:26:26 UTC (rev 784)
@@ -46,6 +46,12 @@
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-core</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
Deleted: trunk/wikitty-solr-impl/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-impl/src/main/java/org/nuiton/wikitty/storage/solr/RAMDirectoryFactory.java 2011-04-12 08:26:26 UTC (rev 784)
@@ -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;
- }
- }
-}
Modified: trunk/wikitty-solr-impl/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-impl/src/main/resources/schema.xml 2011-04-12 08:26:26 UTC (rev 784)
@@ -32,6 +32,7 @@
-->
<schema name="wikitty" version="1.1">
+
<types>
<!-- BINARY type: ignared -->
<fieldtype name="binary" stored="false" indexed="false" class="solr.StrField" />
@@ -53,18 +54,18 @@
<!-- STRING type: The StrField type is not analyzed, but indexed/stored verbatim. -->
<fieldType name="string" class="solr.StrField"
- compressed="true" compressThreshold="1000"
+ 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"
+ compressThreshold="1000"
sortMissingLast="true">
- <analyzer> <!-- no type to indicated that used it for both type: index and query -->
- <tokenizer class="solr.StandardTokenizerFactory"/>
+ <!--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>
+ </analyzer>-->
</fieldType>
<!-- STRING type copy
@@ -76,7 +77,7 @@
WordDelim parts) are removed.
-->
<fieldType name="text" class="solr.TextField"
- compressed="true" compressThreshold="1000"
+ compressThreshold="1000"
positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
@@ -91,7 +92,7 @@
catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"
preserveOriginal="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
- <filter class="solr.EnglishPorterFilterFactory"
+ <filter class="solr.SnowballPorterFilterFactory"
protected="protwords.txt"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
@@ -107,7 +108,7 @@
catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"
preserveOriginal="1"/>
<filter class="solr.LowerCaseFilterFactory"/>
- <filter class="solr.EnglishPorterFilterFactory"
+ <filter class="solr.SnowballPorterFilterFactory"
protected="protwords.txt"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
</analyzer>
Modified: trunk/wikitty-solr-impl/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-impl/src/main/resources/solrconfig.xml 2011-04-12 08:26:26 UTC (rev 784)
@@ -25,6 +25,9 @@
-->
<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.
@@ -515,29 +518,29 @@
-
-
- <highlighting>
- <!-- Configure the standard fragmenter -->
- <!-- This could most likely be commented out in the "default" case -->
+<!-- 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) -->
+ <!– 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 -->
+ <!– slightly smaller fragsizes work better because of slop –>
<int name="hl.fragsize">70</int>
- <!-- allow 50% slop on fragment sizes -->
+ <!– allow 50% slop on fragment sizes –>
<float name="hl.regex.slop">0.5</float>
- <!-- a basic sentence pattern -->
+ <!– a basic sentence pattern –>
<str name="hl.regex.pattern">[-\w ,/\n\"']{20,200}</str>
</lst>
</fragmenter>
- </highlighting>
+ </highlighting>-->
<queryParser name="lucene" class="org.nuiton.wikitty.storage.solr.WikittyQueryParser"/>
<queryParser name="wikitty" class="org.nuiton.wikitty.storage.solr.WikittyQueryParser"/>
Modified: trunk/wikitty-solr-impl/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-impl/src/test/java/org/nuiton/wikitty/storage/solr/SolrSearch2Test.java 2011-04-12 08:26:26 UTC (rev 784)
@@ -1,3 +1,27 @@
+/*
+ * #%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;
Modified: trunk/wikitty-solr-impl/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-impl/src/test/java/org/nuiton/wikitty/storage/solr/TreeTest.java 2011-04-12 08:26:26 UTC (rev 784)
@@ -279,7 +279,7 @@
}
@Test
- public void testHiearchicalFacet() throws Exception {
+ public void testHierarchicalFacet() throws Exception {
Wikitty root = findNode("root");
int sum = sum(root);
assertEquals(6, sum);
1
0