cancel
Showing results for 
Search instead for 
Did you mean: 

Archive Store Lucene query

kirit
Champ on-the-rise
Champ on-the-rise
Hi,
I am trying to delete the files from Archive store as i dont want to keep file after delete from user space to archive store.
here i am building the lucene query to search the file to delete, if there is only one file in store then no problem, but if there is multiple entries with the same file name in the store then it returns size or result set as zero.
here the strenge is that the same query works fine in node browser but with code its not working.

code which i am using is like this

                String query = "@cm\:name:"fileName*";
      ResultSet resultSetOfArchive = searchService.query(storeRefOfArchive, SearchService.LANGUAGE_LUCENE, query);
      if (resultSetOfArchive != null && resultSetOfArchive.length() > 0)
      {
         for(int i=0; i<resultSetOfArchive.length(); i++)
         {
            fileFolderService.delete(resultSetOfArchive.getNodeRef(i));
         }
      }
2 REPLIES 2

derek
Star Contributor
Star Contributor
Hi,

Wiki

If you want to delete a specific file without archival, then you can just apply the sys:temporary aspect prior to deletion.
nodeService.addAspect(nodeRef, ContentModel.ASPECT_TEMPORARY);

kirit
Champ on-the-rise
Champ on-the-rise
Thanks, Derek
This has solved my Problem. Thanks again  Smiley Very Happy