Package org.jahia.services.search

Examples of org.jahia.services.search.SearchService


        }
    }

    @Test
    public void testSimpleFulltextSearchOnSingleSite() throws Exception {
        SearchService searchService = ServicesRegistry.getInstance().getSearchService();
        try {
            ProcessingContext ctx = Jahia.getThreadParamBean();
            RenderContext context = new RenderContext(((ParamBean) ctx).getRequest(), ((ParamBean) ctx).getResponse(),
                    ctx.getUser());
            JCRSessionWrapper session = JCRSessionFactory.getInstance().getCurrentUserSession(null, Locale.ENGLISH);
            JCRNodeWrapper homeNode = session.getNode(FIRST_SITECONTENT_ROOT_NODE + "/home");
            Resource resource = new Resource(homeNode, "html", null, Resource.CONFIGURATION_PAGE);
            context.setMainResource(resource);
            context.setSite(homeNode.getResolveSite());
            new URLGenerator(context, resource);

            SearchCriteria criteria = createSearchCriteria();
            StopWatch stopWatch = new StopWatch("search");
            stopWatch.start("Starting 1000 searchs");
            for (int j = 0; j < 1000; j++) {
                List<Hit<?>> hits = searchService.search(criteria, context).getResults();
                int i = 0;
                for (Hit<?> hit : hits) {
                    logger.info("[" + j + "][" + (++i) + "]: " + hit.getLink());
                }
            }
View Full Code Here

TOP

Related Classes of org.jahia.services.search.SearchService

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.