Skip to content

Commit c02e725

Browse files
committed
#574: mlUpdateIndexes disables forest creation automatically
1 parent 05604ff commit c02e725

File tree

2 files changed

+77
-64
lines changed

2 files changed

+77
-64
lines changed

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
group=com.marklogic
22
version=4.1.0-SNAPSHOT
33
javadocsDir=../gh-pages-marklogic-java/javadocs
4+
5+
snykToken=

src/main/groovy/com/marklogic/gradle/task/databases/UpdateIndexesTask.groovy

Lines changed: 75 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -14,70 +14,81 @@ class UpdateIndexesTask extends MarkLogicTask {
1414

1515
@TaskAction
1616
void updateIndexes() {
17-
if (command != null) {
18-
command.execute(getCommandContext())
19-
} else {
20-
getAppConfig().setIncludeProperties(
21-
"database-name",
22-
"stemmed-searches",
23-
"word-searches",
24-
"word-positions",
25-
"fast-phrase-searches",
26-
"fast-reverse-searches",
27-
"triple-index",
28-
"triple-positions",
29-
"fast-case-sensitive-searches",
30-
"fast-diacritic-sensitive-searches",
31-
"fast-element-word-searches",
32-
"element-word-positions",
33-
"fast-element-phrase-searches",
34-
"element-value-positions",
35-
"attribute-value-positions",
36-
"field-value-searches",
37-
"field-value-positions",
38-
"three-character-searches",
39-
"three-character-word-positions",
40-
"fast-element-character-searches",
41-
"trailing-wildcard-searches",
42-
"trailing-wildcard-word-positions",
43-
"fast-element-trailing-wildcard-searches",
44-
"word-lexicon",
45-
"word-lexicons",
46-
"two-character-searches",
47-
"one-character-searches",
48-
"uri-lexicon",
49-
"collection-lexicon",
50-
"element-word-query-through",
51-
"element-word-query-throughs",
52-
"phrase-through",
53-
"phrase-throughs",
54-
"phrase-around",
55-
"phrase-arounds",
56-
"range-element-index",
57-
"range-element-indexes",
58-
"range-element-attribute-index",
59-
"range-element-attribute-indexes",
60-
"range-path-index",
61-
"range-path-indexes",
62-
"range-field-index",
63-
"range-field-indexes",
64-
"field",
65-
"fields",
66-
"geospatial-element-index",
67-
"geospatial-element-indexes",
68-
"geospatial-element-child-index",
69-
"geospatial-element-child-indexes",
70-
"geospatial-element-pair-index",
71-
"geospatial-element-pair-indexes",
72-
"geospatial-element-attribute-pair-index",
73-
"geospatial-element-attribute-pair-indexes",
74-
"geospatial-path-index",
75-
"geospatial-path-indexes",
76-
"geospatial-region-path-index",
77-
"geospatial-region-path-indexes"
78-
)
79-
80-
deployWithCommandListProperty("mlDatabaseCommands")
17+
final boolean originalCreateForests = getAppConfig().isCreateForests()
18+
try {
19+
// Ensure forests are never created by this task, as the expectation is that only index-specific database
20+
// properties will be updated
21+
getAppConfig().setCreateForests(false)
22+
if (command != null) {
23+
command.execute(getCommandContext())
24+
} else {
25+
configureIndexPropertiesToInclude()
26+
deployWithCommandListProperty("mlDatabaseCommands")
27+
}
28+
} finally {
29+
getAppConfig().setCreateForests(originalCreateForests)
8130
}
8231
}
32+
33+
void configureIndexPropertiesToInclude() {
34+
getAppConfig().setIncludeProperties(
35+
"database-name",
36+
"stemmed-searches",
37+
"word-searches",
38+
"word-positions",
39+
"fast-phrase-searches",
40+
"fast-reverse-searches",
41+
"triple-index",
42+
"triple-positions",
43+
"fast-case-sensitive-searches",
44+
"fast-diacritic-sensitive-searches",
45+
"fast-element-word-searches",
46+
"element-word-positions",
47+
"fast-element-phrase-searches",
48+
"element-value-positions",
49+
"attribute-value-positions",
50+
"field-value-searches",
51+
"field-value-positions",
52+
"three-character-searches",
53+
"three-character-word-positions",
54+
"fast-element-character-searches",
55+
"trailing-wildcard-searches",
56+
"trailing-wildcard-word-positions",
57+
"fast-element-trailing-wildcard-searches",
58+
"word-lexicon",
59+
"word-lexicons",
60+
"two-character-searches",
61+
"one-character-searches",
62+
"uri-lexicon",
63+
"collection-lexicon",
64+
"element-word-query-through",
65+
"element-word-query-throughs",
66+
"phrase-through",
67+
"phrase-throughs",
68+
"phrase-around",
69+
"phrase-arounds",
70+
"range-element-index",
71+
"range-element-indexes",
72+
"range-element-attribute-index",
73+
"range-element-attribute-indexes",
74+
"range-path-index",
75+
"range-path-indexes",
76+
"range-field-index",
77+
"range-field-indexes",
78+
"field",
79+
"fields",
80+
"geospatial-element-index",
81+
"geospatial-element-indexes",
82+
"geospatial-element-child-index",
83+
"geospatial-element-child-indexes",
84+
"geospatial-element-pair-index",
85+
"geospatial-element-pair-indexes",
86+
"geospatial-element-attribute-pair-index",
87+
"geospatial-element-attribute-pair-indexes",
88+
"geospatial-path-index",
89+
"geospatial-path-indexes",
90+
"geospatial-region-path-index",
91+
"geospatial-region-path-indexes"
92+
)
93+
}
8394
}

0 commit comments

Comments
 (0)