Hello,
I have upgraded alfresco version from Community 5.2 (zip version) to community 7.3.1 (Docker version). I have migrated database.
My searchService method doesn't find documents with customized metadata but it works with alfresco metadata (ex:cm:created) But it works from Share interface.
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; }
How can I solve that ?
Thx
Solved! Go to Solution.
Try enabling "exact term search":
https://docs.alfresco.com/search-services/latest/config/indexing/#exact-term-search
This configuration change requires indexing the repository again from scratch.
Try enabling "exact term search":
https://docs.alfresco.com/search-services/latest/config/indexing/#exact-term-search
This configuration change requires indexing the repository again from scratch.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.