AnsweredAssumed Answered

searchService returns same nodeRef twice (duplicate index in solr)

Question asked by vincent-kali on Jun 14, 2017
Latest reply on Sep 20, 2017 by andy1

Dear all,

For some reason, we're using a custom REST API to perform searches on repo (alf community 5.1.g). We discovered that "sometimes", this custom API returns the same nodeRef more than once.

Search code is below:

<code>

ResultSet resultSet = null;
 List<NodeRef> results = null;
 try{
    SearchParameters sp = new SearchParameters();
    sp.setLanguage(this.services.getSearchService().LANGUAGE_SOLR_FTS_ALFRESCO);
    sp.addStore(new StoreRef("workspace://SpacesStore"));
    sp.setQuery(query);
    sp.setMaxItems(maxItems);
    SortDefinition sortDefinition = new SortDefinition(
    SearchParameters.SortDefinition.SortType.FIELD, "@" + sortField, sortAscending);
    sp.addSort(sortDefinition);
    logger.debug(" search - query: " + sp.getQuery());
    resultSet = this.services.getSearchService().query(sp);
    logger.debug("Results found: " + resultSet.getNumberFound());
    results = resultSet.getNodeRefs();
}
 finally{
    if(resultSet != null)
   {
       resultSet.close();
   }
   }
 return results;

 

</code>

The solr4 report indicates: "Count of duplicate nodes in the index":"100", meaning that there is errors in solr4 indexes.

1) Does somebody know how to fix this ?

2) When running the same query using "alfresco/service/slingshot/node/search" API, only one result is returned. Does it means that a duplicate check in performed within java node (I did not find anything in code related to this)

 

Thanks

vincent

Outcomes