cancel
Showing results for 
Search instead for 
Did you mean: 

luceneSearch remove duplicates

lckaley
Champ in-the-making
Champ in-the-making
I am using the following calls and getting back all the values associated with one of the attributes I have defined for my stored documents.

   var results = search.luceneSearch(query);
   l_search_docs.results = results;

The problem is that there are duplicate entries.  I want to remove them but calling unique or trying to iterate over the results looking for where the results 'contains' a value has not worked.  Are there any available methods and is there an API entry concerning the luceneSearch?
Thank you
1 REPLY 1

tonyc
Champ in-the-making
Champ in-the-making
If you want to remove duplicates that have a property of a given value here's how you would do that…

var results = search.luceneSearch(query);

for (i in results)
{
     if ( results.length > 1 && results[i].properties["cm:someproperty"] == "some value") //Check for duplicates, compare a property
     {
          results[i].remove(); // to remove the document, or anything else you want to do with it
     }
}
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.