Package org.apache.cocoon.components.search

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


* Test for search functionality.
*/
public class SearchTest extends AbstractAccessControlTest {

    public void testSearch() throws Exception {
        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);

            /*
             * The indexing doesn't work at the moment when the tests are executed because the
             * cocoon:// protocol is not supported in the test environment.
             *
 
View Full Code Here

TOP

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

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.