cancel
Showing results for 
Search instead for 
Did you mean: 

Search Service Docker Version

anakin98000
Champ on-the-rise
Champ on-the-rise

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.

image

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 ACCEPTED ANSWER

angelborroy
Community Manager Community Manager
Community Manager

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 answer in original post

1 REPLY 1

angelborroy
Community Manager Community Manager
Community Manager

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