You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by lu...@apache.org on 2005/03/11 10:48:52 UTC
cvs commit: jakarta-slide/src/stores/org/apache/slide/index/lucene defaultConfig.xml Index.java IndexConfiguration.java
luetzkendorf 2005/03/11 01:48:52
Modified: src/stores/org/apache/slide/index/lucene defaultConfig.xml
Index.java IndexConfiguration.java
Log:
resourcetype indexing generalized
Revision Changes Path
1.2 +6 -0 jakarta-slide/src/stores/org/apache/slide/index/lucene/defaultConfig.xml
Index: defaultConfig.xml
===================================================================
RCS file: /home/cvs/jakarta-slide/src/stores/org/apache/slide/index/lucene/defaultConfig.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- defaultConfig.xml 8 Nov 2004 09:46:13 -0000 1.1
+++ defaultConfig.xml 11 Mar 2005 09:48:52 -0000 1.2
@@ -43,5 +43,11 @@
</property>
</indexed-properties>
+
+ <resource-types>
+ <resource-type name="collection" namespace="DAV:"/>
+ <resource-type name="principal" namespace="DAV:"/>
+ <resource-type name="version-history" namespace="DAV:"/>
+ </resource-types>
</index-configuration>
1.10 +7 -9 jakarta-slide/src/stores/org/apache/slide/index/lucene/Index.java
Index: Index.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/stores/org/apache/slide/index/lucene/Index.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Index.java 28 Feb 2005 17:25:44 -0000 1.9
+++ Index.java 11 Mar 2005 09:48:52 -0000 1.10
@@ -229,14 +229,12 @@
// resource type
String rtype = descriptor.getResourceType();
- if (rtype.indexOf("collection") != -1) {
- doc.add(unstoredString(configuration.generateFieldName(
- NodeProperty.DEFAULT_NAMESPACE, "resourcetype"),
- "collection"));
- if (rtype.indexOf("principal") != -1) {
+ for(Iterator i = configuration.knownResourceTypes(); i.hasNext();) {
+ String name = (String)i.next();
+ if (rtype.indexOf(name) != -1) {
doc.add(unstoredString(configuration.generateFieldName(
NodeProperty.DEFAULT_NAMESPACE, "resourcetype"),
- "principal"));
+ name));
}
}
1.9 +37 -5 jakarta-slide/src/stores/org/apache/slide/index/lucene/IndexConfiguration.java
Index: IndexConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/stores/org/apache/slide/index/lucene/IndexConfiguration.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- IndexConfiguration.java 28 Feb 2005 17:25:44 -0000 1.8
+++ IndexConfiguration.java 11 Mar 2005 09:48:52 -0000 1.9
@@ -30,6 +30,7 @@
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
@@ -69,6 +70,7 @@
protected boolean indexAsynchron = false;
protected String namespaceName = null;
protected int priority = Thread.NORM_PRIORITY;
+ protected Set knownResourceTypes = new HashSet();
public void addStringProperty(String namespace, String name) {
PropertyName key = PropertyName.getPropertyName(name, namespace);
@@ -163,6 +165,10 @@
this.dateProperties.contains(name);
}
+ Iterator knownResourceTypes() {
+ return knownResourceTypes.iterator();
+ }
+
public int getOptimizeThreshold() {
return this.optimizeThreshold;
}
@@ -227,8 +233,18 @@
Configuration conf = new ConfigurationElement(
pop.load(new InputSource(is), parser.getXMLReader()));
- readPropertyConfiguration(conf.getConfiguration(
- "indexed-properties"));
+ try {
+ readPropertyConfiguration(conf.getConfiguration("indexed-properties"));
+ } catch(ConfigurationException e) {
+ // ok none
+ }
+
+ try {
+ readResourceTypeConfiguration(conf.getConfiguration("resource-types"));
+ } catch(ConfigurationException e) {
+ // ok none
+ }
+
} catch (Exception e) {
throw new IndexException
("error while loading configuration from " + resourceName, e);
@@ -238,6 +254,22 @@
}
}
+ void readResourceTypeConfiguration(Configuration conf) {
+ for(Enumeration e = conf.getConfigurations("resource-type");e.hasMoreElements();) {
+ Configuration resourceType = (Configuration)e.nextElement();
+
+ String n; //, ns;
+ try {
+ n = resourceType.getAttribute("name");
+ //ns = resourceType.getAttribute("namespace");
+ } catch (ConfigurationException ex) {
+ continue;
+ }
+
+ this.knownResourceTypes.add(n); // TODO do we need the namespace
+ }
+ }
+
void readPropertyConfiguration(Configuration conf)
throws IndexException
{
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org