Package org.apache.roller.business.search

Examples of org.apache.roller.business.search.IndexManager


            RollerRequest rreq  = RollerRequest.getRollerRequest(request);
            WebsiteData website = rreq.getWebsite();
            RollerSession rses = RollerSession.getRollerSession(request);
           
            if (rses.isUserAuthorizedToAdmin(website) ) {
                IndexManager manager =
                        RollerFactory.getRoller().getIndexManager();
                manager.rebuildWebsiteIndex(website);
               
                ActionMessages messages = new ActionMessages();
                messages.add(null, new ActionMessage("maintenance.message.indexed"));
                saveMessages(request, messages);
            }
View Full Code Here


    public static Test suite() {
        return new TestSuite(IndexManagerTest.class);
    }
       
    public void testSearch() throws Exception {
        IndexManager imgr = RollerFactory.getRoller().getIndexManager();

        WebsiteData website = new WebsiteData();
        website.setHandle("trekker");

        UserData user = new UserData();
        user.setUserName("nimoy");

        WeblogEntryData wd1 = new WeblogEntryData();           
        wd1.setId("dummy1");
        wd1.setAnchor("dummy1");
        wd1.setCreator(user);
        wd1.setUpdateTime(new Timestamp(System.currentTimeMillis()));
        wd1.setPubTime(new Timestamp(System.currentTimeMillis()));
        wd1.setTitle("The Tholian Web");
        wd1.setWebsite(website);
        wd1.setText(
         "When the Enterprise attempts to ascertain the fate of the  "
        +"U.S.S. Defiant which vanished 3 weeks ago, the warp engines  "
        +"begin to lose power, and Spock reports strange sensor readings.");
        imgr.executeIndexOperationNow(
            new AddEntryOperation((IndexManagerImpl) imgr, wd1));

        WeblogEntryData wd2 = new WeblogEntryData();
        wd2.setId("dummy2");
        wd2.setAnchor("dummy2");
        wd2.setCreator(user);
        wd2.setUpdateTime(new Timestamp(System.currentTimeMillis()));
        wd2.setPubTime(new Timestamp(System.currentTimeMillis()));
        wd2.setTitle("A Piece of the Action");
        wd2.setWebsite(website);
        wd2.setText(
          "The crew of the Enterprise attempts to make contact with "
          +"the inhabitants of planet Sigma Iotia II, and Uhura puts Kirk "
          +"in communication with Boss Oxmyx.");
         imgr.executeIndexOperationNow(
             new AddEntryOperation((IndexManagerImpl) imgr, wd2));

        Thread.sleep(1000);

        SearchOperation search = new SearchOperation(imgr);
        search.setTerm("Enterprise");
        imgr.executeIndexOperationNow(search);
        assertEquals(2, search.getResultsCount());

        SearchOperation search2 = new SearchOperation(imgr);
        search2.setTerm("Tholian");
        imgr.executeIndexOperationNow(search2);
        assertEquals(1, search2.getResultsCount());

        // Clean up
        imgr.removeEntryIndexOperation(wd1);
        imgr.removeEntryIndexOperation(wd2);

        SearchOperation search3 = new SearchOperation(imgr);
        search3.setTerm("Enterprise");
        imgr.executeIndexOperationNow(search3);
        assertEquals(0, search3.getResultsCount());
    }   
View Full Code Here

     * Re-index the WeblogEntry so that the new comment gets indexed.
     */
    private void reindexEntry(WeblogEntryData entry)
        throws RollerException {
       
        IndexManager manager = RollerFactory.getRoller().getIndexManager();
       
        // remove entry before (re)adding it, or in case it isn't Published
        manager.removeEntryIndexOperation(entry);
       
        // if published, index the entry
        if (entry.isPublished()) {
            manager.addEntryIndexOperation(entry);
        }
    }
View Full Code Here

     * is being deleted then mark it published = false.
     * @param entry
     */
    private void reindexEntry(Roller roller, WeblogEntryData entry)
    throws RollerException {
        IndexManager manager = roller.getIndexManager();
       
        // remove entry before (re)adding it, or in case it isn't Published
        //manager.removeEntryIndexOperation(entry);
       
        // if published, index the entry
        if (entry.isPublished()) {
            manager.addEntryReIndexOperation(entry);
        }
    }
View Full Code Here

            RollerSession rollerSession = RollerSession.getRollerSession(request);
            if (rollerSession.isGlobalAdminUser() ) {
                UserAdminForm uaf = (UserAdminForm)actionForm;
               
                // if admin requests an index be re-built, do it
                IndexManager manager = RollerFactory.getRoller().getIndexManager();
                manager.rebuildWebsiteIndex();
                request.getSession().setAttribute(
                        RollerSession.STATUS_MESSAGE,
                        "Successfully scheduled rebuild of index for");
            }
        } catch (Exception e) {
View Full Code Here

            pager = new SearchResultsPager(searchRequest, results, false);
            return;
        }
       
        // setup the search
        IndexManager indexMgr = RollerFactory.getRoller().getIndexManager();
       
        SearchOperation search = new SearchOperation(indexMgr);
        search.setTerm(searchRequest.getQuery());
       
        if(RollerRuntimeConfig.isSiteWideWeblog(searchRequest.getWeblogHandle())) {
            this.websiteSpecificSearch = false;
        } else {
            search.setWebsiteHandle(searchRequest.getWeblogHandle());
        }
       
        if(StringUtils.isNotEmpty(searchRequest.getWeblogCategoryName())) {
            search.setCategory(searchRequest.getWeblogCategoryName());
        }
       
        // execute search
        indexMgr.executeIndexOperationNow(search);
       
        if (search.getResultsCount() == -1) {
            // this means there has been a parsing (or IO) error
            this.errorMessage = bundle.getString("error.searchProblem");
        } else {
View Full Code Here

TOP

Related Classes of org.apache.roller.business.search.IndexManager

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.