Package org.apache.cocoon.components.search

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


        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!");
        }
View Full Code Here


                    this.getLogger().debug("field added: " + fielddecl);
                    docdecl.addFieldDef(fielddecl);
                }

                Index index = new Index();
                index.setID(id);
                index.setIndexer(indexerRole);

                // if the directory path is relative, prepend context path:
                if (!directory.startsWith(File.separator)) {
                    directory = getServletContextPath() + File.separator + directory;
                }

                if (index.setDirectory(directory)) {
                    this.getLogger().warn("directory " + directory + " was locked ");
                }
                index.setDefaultAnalyzerID(analyzerid);
                index.setStructure(docdecl);
                index.setManager(manager);

                this.addIndex(index);
                this.getLogger()
                        .info("add index  " + index.getID() + " for directory " + directory);
            }
        } catch (ServiceException e) {
            throw new ConfigurationException("AnalyzerManager lookup error", e);
        } catch (Exception e) {
            throw new ConfigurationException(e.getMessage(), e);
View Full Code Here

        LuceneCocoonSearcher searcher = null;
        IndexManager indexManager = null;
        try {
            searcher = (LuceneCocoonSearcher) getManager().lookup(LuceneCocoonSearcher.ROLE);
            indexManager = (IndexManager) getManager().lookup(IndexManager.ROLE);
            Index index = indexManager.getIndex("test-authoring");
            searcher.setDirectory(index.getDirectory());

            Term term = new Term("body", "tutorial");
            Query query = new TermQuery(term);

            Hits hits = searcher.search(query);
View Full Code Here

        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!");
        }
View Full Code Here

                    this.getLogger().debug("field added: " + fielddecl);
                    docdecl.addFieldDef(fielddecl);
                }

                Index index = new Index();
                index.setID(id);
                index.setIndexer(indexerRole);

                // if the directory path is relative, prepend context path:
                if (!directory.startsWith(File.separator)) {
                    directory = getServletContextPath() + File.separator + directory;
                }

                if (index.setDirectory(directory)) {
                    this.getLogger().warn("directory " + directory + " was locked ");
                }
                if (analyzerid != null) {
                    index.setDefaultAnalyzerID(analyzerid);
                }
                index.setStructure(docdecl);
                index.setManager(manager);

                this.addIndex(index);
                this.getLogger()
                        .info("add index  " + index.getID() + " for directory " + directory);
            }
        } catch (ServiceException e) {
            throw new ConfigurationException("AnalyzerManager lookup error", e);
        } catch (Exception e) {
            throw new ConfigurationException(e.getMessage(), e);
View Full Code Here

       
        IndexManager indexManager = null;
        try {
            indexManager = (IndexManager) this.serviceManager.lookup(IndexManager.ROLE);
           
            Index index = indexManager.getIndex(name);
           
            if (index == null) {
                throw new ConfigurationException("no search index with id [" + name + "] found.");
            }
           
            value = ((FSDirectory)index.getDirectory()).getFile().getCanonicalPath();

            if (getLogger().isDebugEnabled()) {
                getLogger().debug("resolved search index with id [" + name + "] to directory " + value);
            }
        } catch (Exception e) {
View Full Code Here

TOP

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

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.