Search Service Docker Version

cancel
Showing results for 
Search instead for 
Did you mean: 
anakin98000
Active Member

Search Service Docker Version

Jump to solution

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.

2023-03-26_21-06-23.png

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

1 Solution

Accepted Solutions
angelborroy
Alfresco Employee

Re: Search Service Docker Version

Jump 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.

Hyland Developer Evangelist

View solution in original post

1 Reply
angelborroy
Alfresco Employee

Re: Search Service Docker Version

Jump 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.

Hyland Developer Evangelist