Package org.apache.cocoon.components.search

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


        getLogger().debug("use luceneIndexTransformer with indexer component");
        // lookup the indexer
        try {
            indexer = (Indexer) this.manager.lookup(Indexer.ROLE+"/default");
        } catch (ServiceException e) {
            throw new IndexException(e);
        }

        File indexDirectory = new File(queryConfiguration.indexDirectory);
        if (!indexDirectory.isAbsolute()) {
            indexDirectory = new File(workDir,
                    queryConfiguration.indexDirectory);
        }
        // If the index directory doesn't exist, then always create it.
        boolean indexExists = IndexReader.indexExists(indexDirectory);
        if (!indexExists) {
            createIndex = true;
        }
        // Get the index directory, creating it if necessary
        try {
            Directory directory = LuceneCocoonHelper.getDirectory(
                    indexDirectory, createIndex);
            indexer.setIndex(directory);
        } catch (IOException e) {
            throw new IndexException("set directory " + indexDirectory
                    + " error", e);
        }
        // Get the analyzer
        Analyzer analyzer = LuceneCocoonHelper
                .getAnalyzer(queryConfiguration.analyzerClassname);
View Full Code Here


     * @see org.apache.cocoon.components.search.components.IndexManager#getIndex(java.lang.String)
     */
    public Index getIndex(String id) throws IndexException {

        if (id == null || id.equals("")) {
            throw new IndexException(" index with no name was called");
        }

        Index index = (Index) this.indexes().get(id);
        if (index == null) {
            throw new IndexException("Index " + id + " doesn't exist. Check if configuration "
                    + INDEX_CONF_FILE + " exists for this publication!");
        }

        return index;
    }
View Full Code Here

        // optimize index
        try {
            this.switchToADD_MODE(false);
            add_writer.optimize();
        } catch (IOException ex) {
            throw new IndexException("optimization error", ex);
        }
    }
View Full Code Here

        // now open writer
        try {
            add_writer = new IndexWriter(dir, analyzer, create);
            // add_writer.setUseCompoundFile(true);
        } catch (IOException e) {
            throw new IndexException("open writer error", e);
        }

        if (mergeFactor > add_writer.mergeFactor) {
            add_writer.minMergeDocs = mergeFactor * 2;
            add_writer.mergeFactor = mergeFactor;
View Full Code Here

     */
    final protected void openIndexReader() throws IndexException {
        try {
            this.delete_reader = IndexReader.open(dir);
        } catch (IOException e) {
            throw new IndexException("open reader error", e);
        }
        if (getLogger().isDebugEnabled()) {
            getLogger().debug("reader is opened");
        }

View Full Code Here

    final protected void closeWriter() throws IndexException {
        if (add_writer != null) {
            try {
                add_writer.close();
            } catch (IOException ex) {
                throw new IndexException("close writer error", ex);
            } finally {
                add_writer = null;
            }
            if (getLogger().isDebugEnabled()) {
                getLogger().debug("writer is closed");
View Full Code Here

            throws IndexException {
        try {
            release();
        } catch (IndexException e) {
        }
        throw new IndexException(message, exception);
    }
View Full Code Here

                                + "] is not being indexed because resource type ["
                                + resourceType.getName() + "] does not support indexing!");
            }
        } catch (Exception e) {
            getLogger().error("Invoking indexing failed for URL [" + uri + "]: ", e);
            throw new IndexException(e);
        }
    }
View Full Code Here

                getLogger().debug(
                        "Ignoring document [" + pubId + ":" + area + ":" + uuid + ":" + language
                                + "] because it doesn't exist (anymore).");
            }
        } catch (Exception e) {
            throw new IndexException(e);
        }
    }
View Full Code Here

        // now open writer
        try {
            add_writer = new IndexWriter(dir, analyzer, create);
            // add_writer.setUseCompoundFile(true);
        } catch (IOException e) {
            throw new IndexException("open writer error", e);
        }

        if (mergeFactor > add_writer.mergeFactor) {
            add_writer.minMergeDocs = mergeFactor * 2;
            add_writer.mergeFactor = mergeFactor;
View Full Code Here

TOP

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

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.