[opencms-dev] Problem for index deleted file vfs in opencms

Deiverson Silveira deiverson at solutioncms.com
Wed Oct 21 14:33:21 CEST 2009


Hi Michael and list,

I need actually deleted (deleted and published), I had to modify another
class for sucess, the class CmsSearchIndex:

For this:
   protected boolean hasReadPermission(CmsObject cms, Document doc) {
       return true;
   }

I removed the code below and kept returning always true:
       if (!isCheckingPermissions()) {
           // no permission check is performed at all
           return true;
       }

       Fieldable typeField = doc.getFieldable(CmsSearchField.FIELD_TYPE);
       Fieldable pathField = doc.getFieldable(CmsSearchField.FIELD_PATH);
       if ((typeField == null) || (pathField == null)) {
           // permission check needs only to be performed for VFS documents
that contain both fields
           return true;
       }

       String type = typeField.stringValue();
       if
(!CmsSearchFieldConfiguration.VFS_DOCUMENT_KEY_PREFIX.equals(type)
           && !OpenCms.getResourceManager().hasResourceType(type)) {
           // this is not a known VFS resource type (also not the generic
"VFS" type of OpenCms before 7.0)
           return true;
       }

       // check if the resource exits in the VFS,
       // this will implicitly check read permission and if the resource
was deleted
       String contextPath =
cms.getRequestContext().removeSiteRoot(pathField.stringValue());
       return cms.existsResource(contextPath);

I do not know the side effect of this, but this way I can get files that
were deleted and published the vfs. I tested Luke and Search, and sucess, I
can see files that were deleted also... I have to test to see if I create a
new search index, and choose the CmsVfsIndexer default, will work...

Kind Regards,

Deiverson Silveira
SolutionCms



Message: 2
> Date: Tue, 20 Oct 2009 12:07:27 +0200
> From: Michael Moossen <m.moossen at alkacon.com>
> Subject: Re: [opencms-dev] Problem for index deleted file vfs in
>        search
> To: The OpenCms mailing list <opencms-dev at opencms.org>
> Message-ID: <4ADD8BDF.1080208 at alkacon.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi Deiverson!
>
> first, what do you mean by deleted? marked as deleted or actually deleted?
>
> then,
>  >                 resources = m_cms.readResources(resourceName,
>  > CmsResourceFilter.DEFAULT.addRequireFile());
> this method wont include files MARKED as deleted. if you want to read
> files MARKED as deleted use CmsResourceFilter.ALL instead of
> CmsResourceFilter.DEFAULT.
>
>  >                 resourceDeleted =
>  > m_cms.readDeletedResources(resourceName,true);
> this method will return resources that no longer exists in VFS but in
> the history, ie. CmsHistoryFile objects instead of CmsResource objects.
> ie. if you do not have the history feature activated there wont be any.
>
> HTH
>
> -------------------
> Michael Moossen
>
> Alkacon Software GmbH  - The OpenCms Experts
> http://www.alkacon.com - http://www.opencms.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20091021/227db83d/attachment.htm>


More information about the opencms-dev mailing list