]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.api.acr/src/org/argeo/api/acr/search/BasicSearch.java
Prepare next development cycle
[lgpl/argeo-commons.git] / org.argeo.api.acr / src / org / argeo / api / acr / search / BasicSearch.java
index 2e4f249d4ce5dbe35206f621e250368c003ce184..7aae8cca07721df4cc8a40b819e75eab2d743995 100644 (file)
@@ -34,10 +34,20 @@ public class BasicSearch {
                return this;
        }
 
+       /**
+        * Convenience method, to search below this absolute path, with depth
+        * {@link Depth#INFINITTY}.
+        */
+       public BasicSearch from(String path) {
+               return from(URI.create(path), Depth.INFINITTY);
+       }
+
+       /** Search below this URI, with depth {@link Depth#INFINITTY}. */
        public BasicSearch from(URI uri) {
                return from(uri, Depth.INFINITTY);
        }
 
+       /** Search below this URI, with this {@link Depth}. */
        public BasicSearch from(URI uri, Depth depth) {
                Objects.requireNonNull(uri);
                Objects.requireNonNull(depth);
@@ -47,11 +57,11 @@ public class BasicSearch {
        }
 
        public BasicSearch where(Consumer<AndFilter> and) {
-               if (where != null)
-                       throw new IllegalStateException("A where clause is already set");
-               AndFilter subFilter = new AndFilter();
-               and.accept(subFilter);
-               where = subFilter;
+//             if (where != null)
+//                     throw new IllegalStateException("A where clause is already set");
+//             AndFilter subFilter = new AndFilter();
+               and.accept((AndFilter) getWhere());
+//             where = subFilter;
                return this;
        }
 
@@ -64,6 +74,8 @@ public class BasicSearch {
        }
 
        public ContentFilter<? extends Composition> getWhere() {
+               if (where == null)
+                       where = new AndFilter();
                return where;
        }