Package org.apache.cocoon.components.search.components

Examples of org.apache.cocoon.components.search.components.AnalyzerManager


        if (analyzerId == null) {
            analyzerId = index.getDefaultAnalyzerID();
        }
        if (analyzerId != null) {
            Analyzer analyzer = null;
            AnalyzerManager analyzerManager = null;
            try {
                analyzerManager = (AnalyzerManager) manager.lookup(AnalyzerManager.ROLE);
                analyzer = analyzerManager.getAnalyzer(analyzerId);
                indexer.setAnalyzer(analyzer);
            } catch (ServiceException ex1) {
                handleError(ex1);
            } catch (ConfigurationException ex2) {
                handleError("error setting analyzer for index [" + this.index.getID() + "]", ex2);
View Full Code Here


        // set a custum analyzer (default: the analyzer of the index)
        if (analyzerid != null) {
            Analyzer analyzer = null;
            try {
                AnalyzerManager analyzerM = (AnalyzerManager) manager.lookup(IndexManager.ROLE);
                analyzer = analyzerM.getAnalyzer(analyzerid);
                indexer.setAnalyzer(analyzer);
                manager.release(analyzerM);
            } catch (ServiceException ex1) {
                handleError(ex1);
            } catch (ConfigurationException ex2) {
View Full Code Here

        if (indexer_busy) {
            throw new IndexException(
                    "Timeout to access to the indexer (the indexer is indexing)");
        }
        AnalyzerManager analyzerM = null;
        try {

            indexer_busy = true;
            Indexer indexer = (Indexer) this.manager.lookup(indexer_role);

            // update maybe the analyzer
            analyzerM = (AnalyzerManager) this.manager
                    .lookup(AnalyzerManager.ROLE);

            indexer.setAnalyzer(analyzerM.getAnalyzer(getDefaultAnalyzerID()));
            indexer.setIndex(directory);

            return indexer;
        } catch (ServiceException ex1) {
            throw new IndexException(ex1);
View Full Code Here

     * Adds indexes from the given configuration object to the index manager.
     * @param configuration
     * @throws ConfigurationException
     */
    private void addIndexes(Configuration configuration) throws ConfigurationException {
        AnalyzerManager analyzerManager = null;
        Configuration[] confs = configuration.getChildren(INDEX_ELEMENT);

        if (confs.length == 0) {
            throw new ConfigurationException("no index is defined !");
        }
        try {
            analyzerManager = (AnalyzerManager) this.manager.lookup(AnalyzerManager.ROLE);

            // configure each index
            for (int i = 0; i < confs.length; i++) {
                String id = confs[i].getAttribute(ID_ATTRIBUTE);
                String analyzerid = confs[i].getAttribute(INDEX_DEFAULTANALZER_ATTRIBUTE);
                String directory = confs[i].getAttribute(INDEX_DIRECTORY_ATTRIBUTE);
                if (!analyzerManager.exist(analyzerid)) {
                    throw new ConfigurationException("Analyzer " + analyzerid + " no found");
                }

                Configuration[] fields = confs[i].getChild(STRUCTURE_ELEMENT)
                        .getChildren(FIELD_ELEMENT);
View Full Code Here

     * Adds indexes from the given configuration object to the index manager.
     * @param configuration
     * @throws ConfigurationException
     */
    private void addIndexes(Configuration configuration) throws ConfigurationException {
        AnalyzerManager analyzerManager = null;
        MetaDataFieldRegistry registry = null;

        Configuration[] confs = configuration.getChildren(INDEX_ELEMENT);

        if (confs.length == 0) {
            throw new ConfigurationException("no index is defined !");
        }
        try {
            analyzerManager = (AnalyzerManager) this.manager.lookup(AnalyzerManager.ROLE);
            registry = (MetaDataFieldRegistry) this.manager.lookup(MetaDataFieldRegistry.ROLE);

            // configure each index
            for (int i = 0; i < confs.length; i++) {
                String id = confs[i].getAttribute(ID_ATTRIBUTE);
                String analyzerid = confs[i].getAttribute(INDEX_DEFAULTANALZER_ATTRIBUTE, null);
                if (analyzerid != null && !analyzerManager.exist(analyzerid)) {
                    throw new ConfigurationException("Analyzer " + analyzerid + " no found");
                }

                String directory = confs[i].getAttribute(INDEX_DIRECTORY_ATTRIBUTE);

View Full Code Here

        if (analyzerId == null) {
            analyzerId = index.getDefaultAnalyzerID();
        }
        if (analyzerId != null) {
            Analyzer analyzer = null;
            AnalyzerManager analyzerManager = null;
            try {
                analyzerManager = (AnalyzerManager) manager.lookup(AnalyzerManager.ROLE);
                analyzer = analyzerManager.getAnalyzer(analyzerId);
                indexer.setAnalyzer(analyzer);
            } catch (ServiceException ex1) {
                handleError(ex1);
            } catch (ConfigurationException ex2) {
                handleError("error setting analyzer for index [" + this.index.getID() + "]", ex2);
View Full Code Here

        if (indexer_busy) {
            throw new IndexException(
                    "Timeout to access to the indexer (the indexer is indexing)");
        }
        AnalyzerManager analyzerM = null;
        try {

            indexer_busy = true;
            Indexer indexer = (Indexer) this.manager.lookup(indexer_role);

            // update maybe the analyzer
            analyzerM = (AnalyzerManager) this.manager
                    .lookup(AnalyzerManager.ROLE);

            String analyzerId = getDefaultAnalyzerID();
            if (analyzerId != null) {
                Analyzer analyzer = analyzerM.getAnalyzer(analyzerId);
                indexer.setAnalyzer(analyzer);
            }
            indexer.setIndex(directory);

            return indexer;
View Full Code Here

TOP

Related Classes of org.apache.cocoon.components.search.components.AnalyzerManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.