cancel
Showing results for 
Search instead for 
Did you mean: 

searchService returns same nodeRef twice (duplicate index in solr)

vincent-kali
Star Contributor
Star Contributor

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

21 REPLIES 21

Hi Andy,

Thanks for your reply.

Could you please explain or give an example of how to "reindex nodes that match a query - or just do them one at a time" ?

Vincent