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

Deiverson Silveira deiverson at solutioncms.com
Mon Oct 19 23:27:24 CEST 2009


Hi Alex and List,

I'm trying index deleted files, I can list files, and show me in moment with
rebuild but, when I try to not look files.

I'm custom function rebuildIndex in class CmsVfsIndexerDeletedFiles:

public void rebuildIndex(IndexWriter writer, CmsIndexingThreadManager
threadManager, CmsSearchIndexSource source)
    throws CmsIndexException {
    System.out.println("Entrou no RebuildIndex");
        List resourceNames = source.getResourcesNames();
        Iterator i = resourceNames.iterator();
        while (i.hasNext()) {
            // read the resources from all configured source folders
            String resourceName = (String)i.next();
            List resources = null;
            List resourceDeleted = null;
            try {
                // read all resources (only files) below the given path
                resources = m_cms.readResources(resourceName,
CmsResourceFilter.DEFAULT.addRequireFile());
                // read resource deleted and add in List
                resourceDeleted =
m_cms.readDeletedResources(resourceName,true);//
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

            } catch (CmsException e) {
            System.out.println("Entrou CmsException");
                if (m_report != null) {
                    System.out.println("Entrou CmsException 1");
                    m_report.println(Messages.get().container(
                        Messages.RPT_UNABLE_TO_READ_SOURCE_2,
                        resourceName,
                        e.getLocalizedMessage()),
I_CmsReport.FORMAT_WARNING);
                }
                if (LOG.isWarnEnabled()) {
                    System.out.println("Entrou CmsException 2");
                    LOG.warn(Messages.get().getBundle().key(
                        Messages.LOG_UNABLE_TO_READ_SOURCE_2,
                        resourceName,
                        m_index.getName()), e);
                }
            }
            if (resources != null) {
                // iterate all resources found in the folder
                Iterator j = resources.iterator();
                while (j.hasNext()) {
                    // now update all the resources individually
                    CmsResource resource = (CmsResource)j.next();
                    updateResource(writer, threadManager, resource);
                }
            }
            if (resourceDeleted != null) {
                // iterate all resources found in the folder
                Iterator j = resourceDeleted.iterator();
                while (j.hasNext()) {
                    // now update resource deleted
                    CmsResource resource = (CmsResource)j.next();
                    updateResource(writer, threadManager, resource); //
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                }
            }
        }
    }

But result dont work, i tested wirh Luke, dont sucess, you can tell me what
is missing I can do to perform search with deleted files?

Thanks for any help and Kind Regards,

Deiverson Silveira
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20091019/79b3700d/attachment.htm>


More information about the opencms-dev mailing list