wam 2004/02/10 07:51:41
Modified: src/stores/org/apache/slide/search/basic/sample
BasicExpressionSample.java
Log:
introduce properties and content indexer
Revision Changes Path
1.3 +30 -20
jakarta-slide/src/stores/org/apache/slide/search/basic/sample/BasicExpressionSample.java
Index: BasicExpressionSample.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/stores/org/apache/slide/search/basic/sample/BasicExpressionSample.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BasicExpressionSample.java 14 Jan 2003 16:23:14 -0000 1.2
+++ BasicExpressionSample.java 10 Feb 2004 15:51:41 -0000 1.3
@@ -86,14 +86,14 @@
* @version $Revision$
*/
public class BasicExpressionSample implements IBasicExpression {
-
-
+
+
/** an example for an executable command */
String theExecutableCommand;
-
+
/** backptr to the factory */
IBasicExpressionFactory factory;
-
+
/**
* constructor for a compare expression like gt, eq, ...
* For your concrete implementation you are free, which parameters have to
@@ -103,7 +103,7 @@
theExecutableCommand = command;
this.factory = factory;
}
-
+
/**
* contructor for a merge expression
*/
@@ -115,19 +115,19 @@
this.factory = factory;
Iterator it = children.iterator();
BasicExpressionSample firstChild = (BasicExpressionSample)it.next();
-
+
if (firstChild == null)
throw new BadQueryException (mergeOperator + " needs at least one
nested element");
-
+
theExecutableCommand = firstChild.theExecutableCommand;
-
+
// create the executable command
while (it.hasNext()) {
BasicExpressionSample exp = (BasicExpressionSample)it.next();
theExecutableCommand += " " + mergeOperator + " " +
exp.theExecutableCommand;
}
}
-
+
/**
* fake executer. The executable command is printed and a fake result is
created.
*
@@ -137,20 +137,20 @@
*
*/
public IBasicResultSet execute() throws SearchException {
-
+
IBasicResultSet result = new BasicResultSetImpl (true);
-
+
// here the miracle happens. The command is executed, and ObjectNodes
// are created from all results, that match the query.
System.out.println("now execute: " + theExecutableCommand);
-
+
//
// fake one result
//
ObjectNode node = new SubjectNode("/"); // this will return the root folder
RequestedResource resource = null;
IBasicQuery query = factory.getQuery();
-
+
try {
resource = new ComparableResourceImpl
(node, query.getSearchToken(), query.getScope(),
@@ -159,11 +159,21 @@
catch (SlideException e) {
throw new SearchException (e);
}
-
+
result.add (resource);
-
-
+
+
return result;
}
+
+ public void setFactory (IBasicExpressionFactory factory) {
+ this.factory = factory;
+ }
+
+ public IBasicExpressionFactory getFactory() {
+ return this.factory;
+ }
+
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]