Reputation: 672
I have upgraded alfresco version from Community 5.2 (zip version) to community 7.3.1 (Docker version) with java 17. I have migrated database.
My searchService method doesn't find old documents (before migration) with customized metadata but it works with standard alfresco metadata (ex:cm:created) Moreover it works fine from Share interface. Endly, it works with new document (post migration) So I think there is no problem with SOLR.
This is my code :
public List<Map<String, Object>> searchDocuments(String idaipatient, String medecin, String typologie, String nomService,
String documentDateRangeStart, String documentDateRangeEnd, String integrationDateRangeStart, String integrationDateRangeEnd, String origine) {
ResultSet rs = null;
List<Map<String, Object>> finalResult = new ArrayList<Map<String, Object>>();
try {
Map<String, Object> results = new HashMap<String, Object>();
Map<String, Object> resultObject = new HashMap<String, Object>();
String query = "TYPE:\"os:documed" + "\" "
+ "AND @os\\:idPatient:\"" + idaipatient + "\" "
+ "AND @os\\:medName:\"" + medecin + "\" "
+ "AND @os\\:typologie:\"" + typologie + "\" "
+ "AND @os\\:nomService:\"" + nomService + "\" "
+ "AND @cm\\:created:[\"" + integrationDateRangeStart + "\" TO \"" + integrationDateRangeEnd + "\"] "
+ "AND @os\\:docDate:[\"" + documentDateRangeStart + "\" TO \"" + documentDateRangeEnd + "\"] "
+ "AND @os\\:origine:\"" + origine + "\" ";
logger.debug("Query : " + query);
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
rs = searchService.query(storeRef, SearchService.LANGUAGE_LUCENE, query);
if (rs.length() == 0) {
logger.debug("Aucun résultat pour la recherche " + query);
// initialisation Json retour
resultObject.put("properties", initProperties());
results.put("item", resultObject);
results.put("nodeRef", "");
finalResult.add(results);
} else {
logger.debug(rs.length() + " document(s) trouvé(s) pour la recherche " + query);
/* Récupération et mise en forme des résultats */
for (NodeRef item : rs.getNodeRefs()) {
results = new HashMap<String, Object>();
resultObject = new HashMap<String, Object>();
resultObject.put("properties", getProperties(item));
results.put("item", resultObject);
results.put("nodeRef", item.getId());
finalResult.add(results);
}
}
} catch (Exception e) {
logger.debug("Erreur Recherche documents: {}", ExceptionUtils.getStackTrace(e));
finalResult = new ArrayList<Map<String, Object>>();
} finally {
rs.close();
}
return finalResult;
}
My pom.xml:
<!-- Alfresco Maven Plugin version to use -->
<alfresco.sdk.version>4.5.0</alfresco.sdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Properties used in dependency declarations, you don't need to change these -->
<alfresco.groupId>org.alfresco</alfresco.groupId>
<alfresco.bomDependencyArtifactId>acs-community-packaging</alfresco.bomDependencyArtifactId>
<alfresco.platform.version>7.3.0</alfresco.platform.version>
<alfresco.platform.docker.user>alfresco</alfresco.platform.docker.user>
<alfresco.share.version>17.137</alfresco.share.version>
<alfresco.share.docker.version>7.3.0</alfresco.share.docker.version>
<!-- Docker images -->
<docker.acs.image>alfresco/alfresco-content-repository-community</docker.acs.image>
<docker.share.image>alfresco/alfresco-share</docker.share.image>
How can I solve that ? I have no error when I build amp from eclipse...
Upvotes: 0
Views: 159
Reputation: 672
Found :
We must update alfresco-search-services/solrhome/conf/shared.properties file and execute full reindex
https://docs.alfresco.com/search-services/latest/config/indexing/#exact-term-search
Upvotes: 0