-
-
Notifications
You must be signed in to change notification settings - Fork 496
Subtemplates fixes #8893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Subtemplates fixes #8893
Conversation
8f6a389
to
d85b6ce
Compare
4577f96
to
0307b20
Compare
0307b20
to
398c814
Compare
@@ -55,7 +55,7 @@ | |||
lazy-init="true"/> | |||
|
|||
<bean id="ThesaurusManager" class="org.fao.geonet.kernel.ThesaurusManager" lazy-init="true"> | |||
<property name="thesaurusCacheMaxSize" value="\${thesaurus.cache.maxsize}"/> | |||
<property name="thesaurusCacheMaxSize" value="${thesaurus.cache.maxsize}"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fxprunayre Hello. We couldn't work out the meaning of the "\" you introduced. We had to remove it to make our tests pass. Could you please have a look and confirm this is OK with you ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure but all properties loaded from config.properties
(cf. https://github.com/geonetwork/core-geonetwork/blob/main/web/src/main/webResources/WEB-INF/config.properties#L1) are escaped (eg. https://github.com/geonetwork/core-geonetwork/blob/main/web/src/main/webResources/WEB-INF/config-spring-geonetwork.xml#L76-L77) if we don't want them to be filtered by maven filtered resource ?
Can be that thesaurus.cache.maxsize
is missing somewhere when running test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be simplier for first approach to keep the escaping \
: with escaping \
test runs green from bash with mvn but fails with ide:
Error creating bean with name 'org.fao.geonet.kernel.datamanager.base.BaseMetadataManager#0': Unsatisfied dependency expressed through field 'thesaurusManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ThesaurusManager' defined in URL [file:/home/cmangeat/sources/core-geonetwork/core/target/classes/config-spring-geonetwork.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'thesaurusCacheMaxSize'; nested exception is java.lang.NumberFormatException: For input string: "\400000"
...
@fxprunayre thank you for the explaination.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fxprunayre @cmangeat Indeed. Thanks for the explanations :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Locally, I also get bad substitution message like NumberFormatException: For input string: "\400000" ...
in Intellij from time to time but if building from command line, then it is solved (Intellij probably refresh some files). Not sure if it is an Intellij build issue or mis configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fxprunayre @cmangeat @josegar74 Based on your feedback, I reverted this change. I don't mark it as resolved to let you confirm
@@ -0,0 +1,34 @@ | |||
//============================================================================= | |||
//=== Copyright (C) 2001-2023 Food and Agriculture Organization of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//=== Copyright (C) 2001-2023 Food and Agriculture Organization of the | |
//=== Copyright (C) 2001-2025 Food and Agriculture Organization of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josegar74 Done. I don't mark it as resolved to let you confirm.
@@ -1,9 +1,15 @@ | |||
package org.fao.geonet.kernel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the file header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josegar74 Done. I don't mark it as resolved to let you confirm.
@@ -0,0 +1,114 @@ | |||
package org.fao.geonet.api.processing; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add file header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josegar74 Done. I don't mark it as resolved to let you confirm.
List<Hit> hits = (List<Hit>) response.hits().hits(); | ||
hits.stream().map(Hit::id).forEach(consumerUuid -> { | ||
try { | ||
String consumerId = this.metadataUtils.getMetadataId(consumerUuid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you check to retrieve the metadata id from the index? That should avoid querying the database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josegar74 Indeed it was possible. Thanks. I don't mark it as resolved to let you confirm.
if (srvContext != null) { | ||
srvContext.setAsThreadLocal(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain this code? It can be good to add some comment to clarify it, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josegar74 Done. I don't mark it as resolved to let you confirm.
String query = String.format("xlink:*%s*", subTemplate.getUuid()); | ||
SearchResponse response = this.searchManager.query(query, null, 0, maxMdsReferencingSubTemplate); | ||
if (response.hits().total().value() > maxMdsReferencingSubTemplate) { | ||
throw new GNException("Not implemented"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be relevant to log the details and the exception message can be more clear than Not implemented
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josegar74 Done. I don't mark it as resolved to let you confirm.
//============================================================================== | ||
package org.fao.geonet.exceptions; | ||
|
||
public class GNException extends RuntimeException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This exception seems only used when the number of metadata referencing the subtemplates exceeds a number. Maybe can be given a clear name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josegar74 Done. I don't mark it as resolved to let you confirm.
f230412
to
438a82b
Compare
…nguage while processing subtemplates
rely on metadataIndexer.batchIndexInThreadPool for async indexing test threadPoolIndexation starts for expected md throw exception when updating a subtemplate too resource hungry (too many md to index, i.e. more than 10000)
438a82b
to
2b3c10a
Compare
This PR fixes the following issues:
Checklist
I have read the contribution guidelines
Pull request provided for
main
branch, backports managed with labelGood housekeeping of code, cleaning up comments, tests, and documentation
Clean commit history broken into understandable chucks, avoiding big commits with hundreds of files, cautious of reformatting and whitespace changes
Clean commit messages, longer verbose messages are encouraged
API Changes are identified in commit messages
Testing provided for features or enhancements using automatic tests
User documentation provided for new features or enhancements in manual
Build documentation provided for development instructions in
README.md
filesLibrary management using
pom.xml
dependency management. Update build documentation with intended library use and library tutorials or documentationFunded by https://www.swisstopo.admin.ch/en