true, objects of this type will be available to be searched for in
+ * the scope of a single repository or a namespace. This implies, that the id for this type
+ * has to have a repository set that can be queried. This implicitly enables the search in
+ * the scope of a namespace, too (so implicitly sets {@link #namespaceScoped()}
+ * true).
+ *
+ * @return true, if this object shall be available to be searched for in the
+ * scope of a repository.
+ *
+ * @since 2.38.0
+ */
+ boolean repositoryScoped() default false;
+
+ /**
+ * If this is true, objects of this type will be available to be searched for in
+ * the scope of a single namespace. This implies, that the id for this type has a repository
+ * set that can be queried. If {@link #repositoryScoped()} is set to true, this
+ * will be assumed to be true, too, so this does not have to be set explicitly
+ * in this case.
+ *
+ * @return true, if this object shall be available to be searched for in the
+ * scope of a namespace.
+ *
+ * @since 2.38.0
+ */
+ boolean namespaceScoped() default false;
}
diff --git a/scm-core/src/main/java/sonia/scm/repository/Repository.java b/scm-core/src/main/java/sonia/scm/repository/Repository.java
index 5af2086488..c5f51bef2c 100644
--- a/scm-core/src/main/java/sonia/scm/repository/Repository.java
+++ b/scm-core/src/main/java/sonia/scm/repository/Repository.java
@@ -53,7 +53,7 @@ import java.util.Set;
*
* @author Sebastian Sdorra
*/
-@IndexedType
+@IndexedType(namespaceScoped = true)
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "repositories")
@StaticPermissions(
diff --git a/scm-core/src/main/java/sonia/scm/search/QueryBuilder.java b/scm-core/src/main/java/sonia/scm/search/QueryBuilder.java
index e0a385aac8..24e0078929 100644
--- a/scm-core/src/main/java/sonia/scm/search/QueryBuilder.java
+++ b/scm-core/src/main/java/sonia/scm/search/QueryBuilder.java
@@ -29,9 +29,13 @@ import lombok.Value;
import sonia.scm.ModelObject;
import sonia.scm.repository.Repository;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
+import static java.util.Arrays.asList;
+
/**
* Build and execute queries against an index.
*
@@ -41,7 +45,7 @@ import java.util.Map;
@Beta
public abstract class QueryBuilder