wam 2004/01/12 05:11:26
Modified: src/share/org/apache/slide/search/basic
BasicQueryEnvelope.java BasicQueryScope.java
Literals.java
src/share/org/apache/slide/search QueryScope.java
Log:
enable include - exclude for query scope
Revision Changes Path
1.8 +20 -16
jakarta-slide/src/share/org/apache/slide/search/basic/BasicQueryEnvelope.java
Index: BasicQueryEnvelope.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicQueryEnvelope.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- BasicQueryEnvelope.java 8 Oct 2003 15:31:33 -0000 1.7
+++ BasicQueryEnvelope.java 12 Jan 2004 13:11:25 -0000 1.8
@@ -138,7 +138,7 @@
String slideScope = slideUri.getSlidePath(queryScope.getHref());
Scope topScope = new Scope (slideScope);
- Set ex = queryScope.getExcluded();
+ Set ex = queryScope.getExcludedScopes();
int size = ex.size();
Scope [] excludedScopes = new Scope [size] ;
Iterator it = ex.iterator();
@@ -214,16 +214,16 @@
public SearchQueryResult execute() throws ServiceAccessException {
Iterator it = subQueries.keySet().iterator();
SearchQueryResult result = null;
-
- if (topLevelQuery.orderBy != null) {
- result = new SearchQueryResult
(topLevelQuery.orderBy.getComparator());
- }
- else {
- result = new SearchQueryResult ();
- }
-
-
-
+
+ if (topLevelQuery.orderBy != null) {
+ result = new SearchQueryResult (topLevelQuery.orderBy.getComparator());
+ }
+ else {
+ result = new SearchQueryResult ();
+ }
+
+
+
while (it.hasNext()) {
Scope scope = (Scope)it.next();
@@ -262,8 +262,12 @@
}
String contextPath = slideUri.getContextPath (scope.toString());
+
+ Set inclSet = topLevelQueryScope.getIncludeSet();
+ Set exclSet = topLevelQueryScope.getExcludeSet();
+
QueryScope queryScope = new BasicQueryScope
- (contextPath, subQueryDepth);
+ (contextPath, subQueryDepth, inclSet, exclSet);
return queryScope;
}
1.11 +52 -6
jakarta-slide/src/share/org/apache/slide/search/basic/BasicQueryScope.java
Index: BasicQueryScope.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/BasicQueryScope.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- BasicQueryScope.java 12 Dec 2003 02:48:28 -0000 1.10
+++ BasicQueryScope.java 12 Jan 2004 13:11:25 -0000 1.11
@@ -100,6 +100,9 @@
private Set excludedScopes = new HashSet ();
+ private Set includeSet = new HashSet ();
+ private Set excludeSet = new HashSet ();
+
/**
* Constructs a scope
*
@@ -114,9 +117,11 @@
*
* @param propertyName the name of the property
*/
- public BasicQueryScope (String href, int depth) {
+ public BasicQueryScope (String href, int depth, Set includeSet, Set excludeSet)
{
this.href = href;
this.depth = depth;
+ this.includeSet = includeSet;
+ this.excludeSet = excludeSet;
}
/**
@@ -169,6 +174,21 @@
String href = excluded.getText();
excludedScopes.add (href);
}
+
+ it = scope.getChildren (Literals.INCLUDE_LASTPATHSEGEMENT,
namespace).iterator();
+ while (it.hasNext()) {
+ Element incl = (Element)it.next();
+ String pattern = incl.getText();
+ includeSet.add (pattern);
+ }
+
+ it = scope.getChildren (Literals.EXCLUDE_LASTPATHSEGEMENT,
namespace).iterator();
+ while (it.hasNext()) {
+ Element incl = (Element)it.next();
+ String pattern = incl.getText();
+ excludeSet.add (pattern);
+ }
+
}
@@ -235,7 +255,33 @@
}
- public Set getExcluded() {
+ /**
+ * Method getExcludedScopes
+ *
+ * @return a Set
+ *
+ */
+ public Set getExcludedScopes() {
return excludedScopes;
}
+
+ /**
+ * Method getIncludeSet
+ *
+ * @return a Set
+ */
+ public Set getIncludeSet() {
+ return includeSet;
+ }
+
+ /**
+ * Method getExcludeSet
+ *
+ * @return a Set
+ */
+ public Set getExcludeSet() {
+ return excludeSet;
+ }
+
+
}
1.15 +6 -4
jakarta-slide/src/share/org/apache/slide/search/basic/Literals.java
Index: Literals.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/share/org/apache/slide/search/basic/Literals.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Literals.java 7 Aug 2003 12:41:25 -0000 1.14
+++ Literals.java 12 Jan 2004 13:11:25 -0000 1.15
@@ -82,11 +82,13 @@
public static final String DESCENDING = "descending";
public static final String EQ = "eq";
public static final String EXCLUDE = "exclude";
+ public static final String EXCLUDE_LASTPATHSEGEMENT = "exclude-lastpathsegment";
public static final String FROM = "from";
public static final String GT = "gt";
public static final String GTE = "gte";
public static final String HREF = "href";
public static final String INFINITY = "infinity";
+ public static final String INCLUDE_LASTPATHSEGEMENT = "include-lastpathsegment";
public static final String ISCOLLECTION = "is-collection";
public static final String ISDEFINED = "isdefined";
public static final String ISPRINCIPAL = "is-principal";
1.9 +21 -5 jakarta-slide/src/share/org/apache/slide/search/QueryScope.java
Index: QueryScope.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/search/QueryScope.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- QueryScope.java 12 Dec 2003 02:48:30 -0000 1.8
+++ QueryScope.java 12 Jan 2004 13:11:26 -0000 1.9
@@ -78,6 +78,22 @@
public static final int DEPTH_INFINITY = Integer.MAX_VALUE;
/**
+ * Method getExcludeSet
+ *
+ * @return a Set
+ */
+ public Set getExcludeSet();
+
+
+ /**
+ * Method getIncludeSet
+ *
+ * @return a Set
+ */
+ public Set getIncludeSet();
+
+
+ /**
* href accessor.
*
* @return a String
@@ -119,6 +135,6 @@
* @return an Iterator of Scope objects
*
*/
- public Set getExcluded ();
+ public Set getExcludedScopes ();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]