Package org.apache.roller.model

Examples of org.apache.roller.model.IndexManager


    }
   
   
    public void testSearch() throws Exception {
        try {
            IndexManager imgr = RollerFactory.getRoller().getIndexManager();
           
            WeblogEntryData wd1 = new WeblogEntryData();
            wd1.setId("dummy");
            wd1.setTitle("The Tholian Web");
            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("dummy");
            wd2.setTitle("A Piece of the Action");
            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));
           
            SearchOperation search = new SearchOperation(imgr);
            search.setTerm("Enterprise");
            imgr.executeIndexOperationNow(search);
            assertTrue(search.getResultsCount() == 2);
           
            SearchOperation search2 = new SearchOperation(imgr);
            search2.setTerm("Tholian");
            imgr.executeIndexOperationNow(search2);
            assertTrue(search2.getResultsCount() == 1);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here


        }
    }
   
    private void executeSearch(Roller roller, SearchOperation search)
        throws RollerException {
        IndexManager indexMgr = roller.getIndexManager();
        indexMgr.executeIndexOperationNow(search);
        if (mLogger.isDebugEnabled()) {
            mLogger.debug("numresults = " + search.getResultsCount());
        }
    }
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

            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

      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");
      }
    }
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

    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

            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

            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

     * 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

TOP

Related Classes of org.apache.roller.model.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.