diff --git a/search-services/alfresco-search/src/main/java/org/alfresco/solr/component/FingerPrintComponent.java b/search-services/alfresco-search/src/main/java/org/alfresco/solr/component/FingerPrintComponent.java index 5b022446f..45d30d150 100644 --- a/search-services/alfresco-search/src/main/java/org/alfresco/solr/component/FingerPrintComponent.java +++ b/search-services/alfresco-search/src/main/java/org/alfresco/solr/component/FingerPrintComponent.java @@ -72,18 +72,14 @@ public class FingerPrintComponent extends SearchComponent implements SolrCoreAwa NamedList response = responseBuilder.rsp.getValues(); String id = responseBuilder.req.getParams().get("id"); - if(id.contains("-")) { - long dbid = fetchDBID(id, responseBuilder.req.getSearcher()); - if(dbid > -1) { - id = Long.toString(dbid); - } else { - id = null; - } + long dbid = fetchDBID(id, responseBuilder.req.getSearcher()); + if(dbid == -1 && isNumber(id) ) { + dbid = Long.parseLong(id); } NamedList fingerPrint = new NamedList(); - if(id != null) { - SolrInputDocument solrDoc = solrContentStore.retrieveDocFromSolrContentStore(AlfrescoSolrDataModel.getTenantId(TenantService.DEFAULT_DOMAIN), Long.parseLong(id)); + if(dbid > -1) { + SolrInputDocument solrDoc = solrContentStore.retrieveDocFromSolrContentStore(AlfrescoSolrDataModel.getTenantId(TenantService.DEFAULT_DOMAIN), dbid); if (solrDoc != null) { SolrInputField mh = solrDoc.getField("MINHASH"); if (mh != null) { @@ -114,6 +110,16 @@ public class FingerPrintComponent extends SearchComponent implements SolrCoreAwa return -1; } + private boolean isNumber(String s) { + for(int i=0; i -1) { + if(dbid > -1) + { SolrInputDocument solrDoc = solrContentStore.retrieveDocFromSolrContentStore(AlfrescoSolrDataModel.getTenantId(TenantService.DEFAULT_DOMAIN), dbid); - if (solrDoc != null) { + if (solrDoc != null) + { SolrInputField mh = solrDoc.getField("MINHASH"); - if (mh != null) { + if (mh != null) + { values = mh.getValues(); } } @@ -733,7 +734,7 @@ public class Solr4QueryParser extends QueryParser implements QueryConstants { //we are in distributed mode //Fetch the fingerPrint from the shards. - //The UUID and DBID will work both work for method call. + //The UUID and DBID will both work for method call. values = fetchFingerPrint(shards, nodeId); } @@ -767,6 +768,16 @@ public class Solr4QueryParser extends QueryParser implements QueryConstants } + private boolean isNumber(String s) { + for(int i=0; i urls = ((HttpShardHandlerFactory)shardHandlerFactory).makeURLList(shards);