You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2022/06/21 00:39:05 UTC
[sling-org-apache-sling-app-cms] 02/02: SLING-11223 - Further index optimizations
This is an automated email from the ASF dual-hosted git repository.
dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git
commit 072350ef4d4b87c46a33d8c3e02b9f66ae27d291
Author: Dan Klco <kl...@adobe.com>
AuthorDate: Mon Jun 20 20:04:00 2022 -0400
SLING-11223 - Further index optimizations
---
feature/src/main/features/cms/cms.json | 2 +-
reference/bnd.bnd | 8 +++-
.../apache/sling/cms/reference/models/Search.java | 2 +-
.../sling:Page/properties/hideInSitemap.json | 7 ++++
.../sling:Page/properties/publishDate.json | 8 ++++
ui/bnd.bnd | 14 ++++++-
.../resources/jcr_root/oak%3Aindex/ntBase.json | 45 ----------------------
.../oak%3Aindex/slingResourceSuperType.json | 5 ---
.../ntHierarchyNode.json | 0
.../{oak%3Aindex => oak:index}/slingComponent.json | 0
.../{oak%3Aindex => oak:index}/slingFile.json | 12 ------
.../{oak%3Aindex => oak:index}/slingPage.json | 43 ++++++---------------
.../{oak%3Aindex => oak:index}/slingTaxonomy.json | 6 ---
13 files changed, 49 insertions(+), 103 deletions(-)
diff --git a/feature/src/main/features/cms/cms.json b/feature/src/main/features/cms/cms.json
index f6fd8b11..6c9a251a 100644
--- a/feature/src/main/features/cms/cms.json
+++ b/feature/src/main/features/cms/cms.json
@@ -6,7 +6,7 @@
},
{
"id": "org.apache.sling:org.apache.sling.cms.ui:${cms-version}",
- "start-order": "20"
+ "start-order": "19"
},
{
"id": "org.apache.sling:org.apache.sling.cms.core:${cms-version}",
diff --git a/reference/bnd.bnd b/reference/bnd.bnd
index f0ad403f..0bc4047f 100644
--- a/reference/bnd.bnd
+++ b/reference/bnd.bnd
@@ -1,2 +1,8 @@
-Sling-Initial-Content: jcr_root;ignoreImportProviders:=xml,jcr_root/content/apache.json;overwrite:=false;uninstall:=false;path:=/content/apache,jcr_root/etc/taxonomy/reference.json;overwrite:=false;uninstall:=false;path:=/etc/taxonomy/reference,jcr_root;ignoreImportProviders:=xml,jcr_root/apps/reference;overwrite:=true;uninstall:=true;path:=/apps/reference,jcr_root/static/clientlibs/reference;overwrite:=true;ignoreImportProviders:=xml;path:=/static/clientlibs/reference,jcr_root/conf/asf. [...]
+Sling-Initial-Content: jcr_root/apps/reference;overwrite:=true;uninstall:=true;path:=/apps/reference,\
+ jcr_root/conf/asf.json;overwrite:=true;ignoreImportProviders:=xml;path:=/conf/asf,\
+ jcr_root/content/apache.json;overwrite:=false;uninstall:=false;path:=/content/apache,\
+ jcr_root/etc/taxonomy/reference.json;overwrite:=false;uninstall:=false;path:=/etc/taxonomy/reference,\
+ jcr_root/oak:index/slingPage/indexRules/sling:Page/properties/hideInSitemap.json;overwrite:=true;path:=/oak:index/slingPage/indexRules/sling:Page/properties/hideInSitemap,\
+ jcr_root/oak:index/slingPage/indexRules/sling:Page/properties/publishDate.json;overwrite:=true;path:=/oak:index/slingPage/indexRules/sling:Page/properties/publishDate,\
+ jcr_root/static/clientlibs/reference;overwrite:=true;ignoreImportProviders:=xml;path:=/static/clientlibs/reference
Sling-Model-Packages: org.apache.sling.cms.reference.models,org.apache.sling.cms.reference.forms.impl
\ No newline at end of file
diff --git a/reference/src/main/java/org/apache/sling/cms/reference/models/Search.java b/reference/src/main/java/org/apache/sling/cms/reference/models/Search.java
index 6fd1bdf3..40ba5855 100644
--- a/reference/src/main/java/org/apache/sling/cms/reference/models/Search.java
+++ b/reference/src/main/java/org/apache/sling/cms/reference/models/Search.java
@@ -77,7 +77,7 @@ public class Search {
resolver = searchService.getResourceResolver(request);
- String query = "SELECT * FROM [sling:Page] AS p WHERE [jcr:content/sling:published]=true AND p.[jcr:content/hideInSitemap] <> true AND ISDESCENDANTNODE(p, '"
+ String query = "SELECT * FROM [sling:Page] AS p WHERE [jcr:content/sling:published]=true AND (p.[jcr:content/hideInSitemap] <> true OR [jcr:content/hideInSitemap] IS NULL) AND ISDESCENDANTNODE(p, '"
+ basePath + "') AND CONTAINS(p.*, '" + term + "')";
log.debug("Searching for pages with {} under {} with query: {}", term, basePath, query);
Iterator<Resource> res = resolver.findResources(query, Query.JCR_SQL2);
diff --git a/reference/src/main/resources/jcr_root/oak:index/slingPage/indexRules/sling:Page/properties/hideInSitemap.json b/reference/src/main/resources/jcr_root/oak:index/slingPage/indexRules/sling:Page/properties/hideInSitemap.json
new file mode 100644
index 00000000..eadf480d
--- /dev/null
+++ b/reference/src/main/resources/jcr_root/oak:index/slingPage/indexRules/sling:Page/properties/hideInSitemap.json
@@ -0,0 +1,7 @@
+{
+ "jcr:primaryType": "nt:unstructured",
+ "propertyIndex": true,
+ "name": "jcr:content/hideInSitemap",
+ "type": "Boolean",
+ "nullCheckEnabled": true
+}
diff --git a/reference/src/main/resources/jcr_root/oak:index/slingPage/indexRules/sling:Page/properties/publishDate.json b/reference/src/main/resources/jcr_root/oak:index/slingPage/indexRules/sling:Page/properties/publishDate.json
new file mode 100644
index 00000000..403cd390
--- /dev/null
+++ b/reference/src/main/resources/jcr_root/oak:index/slingPage/indexRules/sling:Page/properties/publishDate.json
@@ -0,0 +1,8 @@
+{
+ "jcr:primaryType": "nt:unstructured",
+ "propertyIndex": true,
+ "name": "jcr:content/publishDate",
+ "type": "String",
+ "nullCheckEnabled": true,
+ "ordered": true
+}
diff --git a/ui/bnd.bnd b/ui/bnd.bnd
index afd3c18a..ba52afba 100644
--- a/ui/bnd.bnd
+++ b/ui/bnd.bnd
@@ -1,3 +1,15 @@
Sling-Nodetypes: SLING-INF/nodetypes/nodetypes.cnd
-Sling-Initial-Content: jcr_root;overwriteProperties:=true;overwrite:=false;ignoreImportProviders:=xml,jcr_root/conf/global.json;overwrite:=true;ignoreImportProviders:=xml;path:=/conf/global,jcr_root/etc/taxonomy;overwrite:=false;uninstall:=true;path:=/etc/taxonomy,jcr_root/oak%3Aindex;overwrite:=false;uninstall:=true;path:=/oak:index,jcr_root/libs/sling-cms;overwrite:=true;uninstall:=true;path:=/libs/sling-cms,jcr_root/libs/sling/thumbnails;overwrite:=true;uninstall:=true;path:=/libs/sli [...]
+Sling-Initial-Content: jcr_root;overwriteProperties:=true;overwrite:=false;ignoreImportProviders:=xml,\
+ jcr_root/conf/global.json;overwrite:=true;ignoreImportProviders:=xml;path:=/conf/global,\
+ jcr_root/etc/taxonomy;overwrite:=false;path:=/etc/taxonomy,\
+ jcr_root/libs/sling-cms;overwrite:=true;path:=/libs/sling-cms,\
+ jcr_root/libs/sling/thumbnails;overwrite:=true;path:=/libs/sling/thumbnails,\
+ jcr_root/oak:index/ntHierarchyNode.json;overwrite:=true;path:=/oak:index/ntHierarchyNode,\
+ jcr_root/oak:index/slingComponent.json;overwrite:=true;path:=/oak:index/slingComponent,\
+ jcr_root/oak:index/slingFile.json;overwrite:=true;path:=/oak:index/slingFile,\
+ jcr_root/oak:index/slingPage.json;overwrite:=true;path:=/oak:index/slingPage,\
+ jcr_root/oak:index/slingTaxonomy.json;overwrite:=true;path:=/oak:index/slingTaxonomy,\
+ jcr_root/static/clientlibs/sling-cms;overwrite:=true;path:=/static/clientlibs/sling-cms;ignoreImportProviders:=xml,\
+ jcr_root/static/clientlibs/sling-cms-editor;overwrite:=true;path:=/static/clientlibs/sling-cms-editor;ignoreImportProviders:=xml,\
+ jcr_root/static/sling-cms;overwrite:=true;path:=/static/sling-cms;ignoreImportProviders:=xml
-includeresource: target/frontend/dist
\ No newline at end of file
diff --git a/ui/src/main/resources/jcr_root/oak%3Aindex/ntBase.json b/ui/src/main/resources/jcr_root/oak%3Aindex/ntBase.json
deleted file mode 100644
index 3a50e6a1..00000000
--- a/ui/src/main/resources/jcr_root/oak%3Aindex/ntBase.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "jcr:primaryType": "oak:QueryIndexDefinition",
- "compatVersion": 2,
- "type": "lucene",
- "async": ["async", "nrt"],
- "evaluatePathRestrictions": false,
- "excludedPaths": ["/jcr:system"],
- "indexRules": {
- "jcr:primaryType": "nt:unstructured",
- "nt:base": {
- "jcr:primaryType": "nt:unstructured",
- "properties": {
- "jcr:primaryType": "nt:unstructured",
- "slingTaxonomy": {
- "jcr:primaryType": "nt:unstructured",
- "ordered": false,
- "propertyIndex": true,
- "name": "sling:taxonomy",
- "type": "String"
- },
- "slingResourceType": {
- "jcr:primaryType": "nt:unstructured",
- "ordered": false,
- "propertyIndex": true,
- "name": "sling:resourceType",
- "type": "String"
- },
- "slingPublished": {
- "jcr:primaryType": "nt:unstructured",
- "ordered": false,
- "propertyIndex": true,
- "name": "sling:published",
- "type": "Boolean"
- },
- "slingVanityPath": {
- "jcr:primaryType": "nt:unstructured",
- "notNullCheckEnabled": true,
- "propertyIndex": true,
- "name": "sling:vanityPath",
- "type": "String"
- }
- }
- }
- }
-}
diff --git a/ui/src/main/resources/jcr_root/oak%3Aindex/slingResourceSuperType.json b/ui/src/main/resources/jcr_root/oak%3Aindex/slingResourceSuperType.json
deleted file mode 100644
index 8eb9b0f8..00000000
--- a/ui/src/main/resources/jcr_root/oak%3Aindex/slingResourceSuperType.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "jcr:primaryType": "oak:QueryIndexDefinition",
- "jcr:name:propertyNames": ["sling:resourceSuperType"],
- "type": "property"
-}
diff --git a/ui/src/main/resources/jcr_root/oak%3Aindex/ntHierarchyNode.json b/ui/src/main/resources/jcr_root/oak:index/ntHierarchyNode.json
similarity index 100%
rename from ui/src/main/resources/jcr_root/oak%3Aindex/ntHierarchyNode.json
rename to ui/src/main/resources/jcr_root/oak:index/ntHierarchyNode.json
diff --git a/ui/src/main/resources/jcr_root/oak%3Aindex/slingComponent.json b/ui/src/main/resources/jcr_root/oak:index/slingComponent.json
similarity index 100%
rename from ui/src/main/resources/jcr_root/oak%3Aindex/slingComponent.json
rename to ui/src/main/resources/jcr_root/oak:index/slingComponent.json
diff --git a/ui/src/main/resources/jcr_root/oak%3Aindex/slingFile.json b/ui/src/main/resources/jcr_root/oak:index/slingFile.json
similarity index 84%
rename from ui/src/main/resources/jcr_root/oak%3Aindex/slingFile.json
rename to ui/src/main/resources/jcr_root/oak:index/slingFile.json
index cc221060..1f21a3f6 100644
--- a/ui/src/main/resources/jcr_root/oak%3Aindex/slingFile.json
+++ b/ui/src/main/resources/jcr_root/oak:index/slingFile.json
@@ -27,10 +27,7 @@
"jcr:primaryType": "nt:unstructured",
"jcrDescription": {
"jcr:primaryType": "nt:unstructured",
- "nodeScopeIndex": true,
- "useInSuggest": true,
"propertyIndex": true,
- "useInSpellcheck": true,
"analyzed": true,
"name": "jcr:content/jcr:description"
},
@@ -49,20 +46,14 @@
},
"jcrTitle": {
"jcr:primaryType": "nt:unstructured",
- "nodeScopeIndex": true,
- "useInSuggest": true,
"propertyIndex": true,
- "useInSpellcheck": true,
"analyzed": true,
"name": "jcr:content/jcr:title",
"boost": 2
},
"nodeName": {
"jcr:primaryType": "nt:unstructured",
- "nodeScopeIndex": true,
- "useInSuggest": true,
"propertyIndex": true,
- "useInSpellcheck": true,
"name": ":nodeName",
"type": "String"
},
@@ -74,10 +65,7 @@
},
"slingTaxonomy": {
"jcr:primaryType": "nt:unstructured",
- "nodeScopeIndex": true,
- "useInSuggest": true,
"propertyIndex": true,
- "useInSpellcheck": true,
"analyzed": true,
"name": "jcr:content/sling:taxonomy"
}
diff --git a/ui/src/main/resources/jcr_root/oak%3Aindex/slingPage.json b/ui/src/main/resources/jcr_root/oak:index/slingPage.json
similarity index 74%
rename from ui/src/main/resources/jcr_root/oak%3Aindex/slingPage.json
rename to ui/src/main/resources/jcr_root/oak:index/slingPage.json
index 0db94979..1e06bede 100644
--- a/ui/src/main/resources/jcr_root/oak%3Aindex/slingPage.json
+++ b/ui/src/main/resources/jcr_root/oak:index/slingPage.json
@@ -13,36 +13,22 @@
"jcr:primaryType": "nt:unstructured",
"relativeNode": true,
"path": "jcr:content"
- }
- },
- "nt:file": {
- "jcr:primaryType": "nt:unstructured",
- "include0": {
- "jcr:primaryType": "nt:unstructured",
- "path": "jcr:content"
- }
- },
- "nt:unstructured": {
- "jcr:primaryType": "nt:unstructured",
- "include0": {
- "jcr:primaryType": "nt:unstructured",
- "path": "*"
},
"include1": {
"jcr:primaryType": "nt:unstructured",
- "path": "*/*"
+ "path": "jcr:content/*"
},
"include2": {
"jcr:primaryType": "nt:unstructured",
- "path": "*/*/*"
+ "path": "jcr:content/*/*"
},
"include3": {
"jcr:primaryType": "nt:unstructured",
- "path": "*/*/*/*"
+ "path": "jcr:content/*/*/*"
},
"include4": {
"jcr:primaryType": "nt:unstructured",
- "path": "*/*/*/*/*"
+ "path": "jcr:content/*/*/*/*"
}
}
},
@@ -54,19 +40,13 @@
"jcr:primaryType": "nt:unstructured",
"jcrDescription": {
"jcr:primaryType": "nt:unstructured",
- "nodeScopeIndex": true,
- "useInSuggest": true,
"propertyIndex": true,
- "useInSpellcheck": true,
"analyzed": true,
"name": "jcr:content/jcr:description"
},
"jcrTitle": {
"jcr:primaryType": "nt:unstructured",
- "nodeScopeIndex": true,
- "useInSuggest": true,
"propertyIndex": true,
- "useInSpellcheck": true,
"analyzed": true,
"name": "jcr:content/jcr:title",
"type": "String",
@@ -74,10 +54,7 @@
},
"nodeName": {
"jcr:primaryType": "nt:unstructured",
- "nodeScopeIndex": true,
- "useInSuggest": true,
"propertyIndex": true,
- "useInSpellcheck": true,
"name": ":nodeName",
"type": "String"
},
@@ -102,18 +79,22 @@
},
"slingTaxonomy": {
"jcr:primaryType": "nt:unstructured",
- "nodeScopeIndex": true,
- "useInSuggest": true,
"propertyIndex": true,
- "useInSpellcheck": true,
"analyzed": true,
- "name": "jcr:content/sling:taxonomy"
+ "name": "jcr:content/sling:taxonomy",
+ "type": "String"
},
"slingTemplate": {
"jcr:primaryType": "nt:unstructured",
"propertyIndex": true,
"name": "jcr:content/sling:template",
"type": "String"
+ },
+ "allProperties": {
+ "jcr:primaryType": "nt:unstructured",
+ "isRegexp": true,
+ "propertyIndex": true,
+ "name": "jcr:content/\\w*"
}
}
}
diff --git a/ui/src/main/resources/jcr_root/oak%3Aindex/slingTaxonomy.json b/ui/src/main/resources/jcr_root/oak:index/slingTaxonomy.json
similarity index 79%
rename from ui/src/main/resources/jcr_root/oak%3Aindex/slingTaxonomy.json
rename to ui/src/main/resources/jcr_root/oak:index/slingTaxonomy.json
index 7147f6b9..9e072920 100644
--- a/ui/src/main/resources/jcr_root/oak%3Aindex/slingTaxonomy.json
+++ b/ui/src/main/resources/jcr_root/oak:index/slingTaxonomy.json
@@ -13,20 +13,14 @@
"jcr:primaryType": "nt:unstructured",
"jcrTitle": {
"jcr:primaryType": "nt:unstructured",
- "nodeScopeIndex": true,
- "useInSuggest": true,
"propertyIndex": true,
- "useInSpellcheck": true,
"analyzed": true,
"name": "jcr:title",
"type": "String"
},
"nodeName": {
"jcr:primaryType": "nt:unstructured",
- "nodeScopeIndex": true,
- "useInSuggest": true,
"propertyIndex": true,
- "useInSpellcheck": true,
"name": ":nodeName",
"type": "String"
}