001/*
002 * File   : $Source$
003 * Date   : $Date$
004 * Version: $Revision$
005 *
006 * This library is part of OpenCms -
007 * the Open Source Content Management System
008 *
009 * Copyright (C) 2002 - 2009 Alkacon Software (https://www.alkacon.com)
010 *
011 * This library is free software; you can redistribute it and/or
012 * modify it under the terms of the GNU Lesser General Public
013 * License as published by the Free Software Foundation; either
014 * version 2.1 of the License, or (at your option) any later version.
015 *
016 * This library is distributed in the hope that it will be useful,
017 * but WITHOUT ANY WARRANTY; without even the implied warranty of
018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019 * Lesser General Public License for more details.
020 *
021 * For further information about Alkacon Software, please see the
022 * company website: https://www.alkacon.com
023 *
024 * For further information about OpenCms, please see the
025 * project website: https://www.opencms.org
026 *
027 * You should have received a copy of the GNU Lesser General Public
028 * License along with this library; if not, write to the Free Software
029 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
030 */
031
032package org.opencms.search.solr;
033
034import org.opencms.file.CmsObject;
035import org.opencms.file.CmsProperty;
036import org.opencms.file.CmsResource;
037import org.opencms.search.I_CmsSearchDocument;
038import org.opencms.search.I_CmsSearchIndex;
039import org.opencms.search.extractors.I_CmsExtractionResult;
040
041import java.util.List;
042
043/**
044 * The processor can be used in order to
045 * manipulate search documents before they are indexed.<p>
046 *
047 * @since 21.0
048 */
049public interface I_CmsSolrDocumentTransformer {
050
051    /**
052     * (Re-)Initializes the transformer.<p>
053     */
054    void init(I_CmsSearchIndex index);
055
056    /**
057     * Performs the transformation.<p>
058     *
059     * @param cms the CMS object
060     * @param doc the document to transform
061     * @param resource the resource for the found document
062     * @param extractionResult the extraction result
063     * @param properties the properties set directly at the resource
064     * @param propertiesSearched the properties read recursively from the resource
065     *
066     * @return the manipulated Solr document
067     */
068    I_CmsSearchDocument transform(
069        I_CmsSearchDocument doc,
070        CmsObject cms,
071        CmsResource resource,
072        I_CmsExtractionResult extractionResult,
073        List<CmsProperty> properties,
074        List<CmsProperty> propertiesSearched);
075}