Package org.jboss.dna.graph.request

Examples of org.jboss.dna.graph.request.FullTextSearchRequest


                    searchProcessor.process(queryRequest);
                } finally {
                    searchProcessor.close();
                }
            } else if (request instanceof FullTextSearchRequest) {
                FullTextSearchRequest searchRequest = (FullTextSearchRequest)request;
                RequestProcessor searchProcessor = searchEngine().createProcessor(context, null, true);
                try {
                    searchProcessor.process(searchRequest);
                } finally {
                    searchProcessor.close();
                }
            } else if (request instanceof CompositeRequest) {
                CompositeRequest composite = (CompositeRequest)request;
                CompositeRequestChannel channel = null;
                RequestProcessor searchProcessor = null;
                try {
                    for (Request nested : composite) {
                        if (nested instanceof AccessQueryRequest) {
                            AccessQueryRequest queryRequest = (AccessQueryRequest)request;
                            if (searchProcessor == null) searchProcessor = searchEngine().createProcessor(context, null, true);
                            searchProcessor.process(queryRequest);
                        } else if (nested instanceof FullTextSearchRequest) {
                            FullTextSearchRequest searchRequest = (FullTextSearchRequest)request;
                            if (searchProcessor == null) searchProcessor = searchEngine().createProcessor(context, null, true);
                            searchProcessor.process(searchRequest);
                        } else {
                            // Delegate to the channel ...
                            if (channel == null) {
View Full Code Here


                    searchProcessor.process(queryRequest);
                } finally {
                    searchProcessor.close();
                }
            } else if (request instanceof FullTextSearchRequest) {
                FullTextSearchRequest searchRequest = (FullTextSearchRequest)request;
                RequestProcessor searchProcessor = searchEngine().createProcessor(context, null, true);
                try {
                    searchProcessor.process(searchRequest);
                } finally {
                    searchProcessor.close();
                }
            } else if (request instanceof CompositeRequest) {
                CompositeRequest composite = (CompositeRequest)request;
                List<Request> delegateRequests = null;
                RequestProcessor searchProcessor = null;
                try {
                    Request delegateRequest = composite;
                    for (Request nested : composite) {
                        if (nested instanceof AccessQueryRequest) {
                            AccessQueryRequest queryRequest = (AccessQueryRequest)request;
                            if (searchProcessor == null) searchProcessor = searchEngine().createProcessor(context, null, true);
                            searchProcessor.process(queryRequest);
                            delegateRequest = null;
                        } else if (nested instanceof FullTextSearchRequest) {
                            FullTextSearchRequest searchRequest = (FullTextSearchRequest)request;
                            if (searchProcessor == null) searchProcessor = searchEngine().createProcessor(context, null, true);
                            searchProcessor.process(searchRequest);
                            delegateRequest = null;
                        } else {
                            // Delegate the request ...
View Full Code Here

     * @throws IllegalArgumentException if the expression is null
     */
    public QueryResults search( final String fullTextSearchExpression,
                                int maxResults,
                                int offset ) {
        FullTextSearchRequest request = requests.search(getCurrentWorkspaceName(), fullTextSearchExpression, maxResults, offset);
        QueryResults results = new org.jboss.dna.graph.query.process.QueryResults(request.getResultColumns(),
                                                                                  request.getStatistics(), request.getTuples());
        return results;
    }
View Full Code Here

                                   String searchExpression,
                                   int maxResults,
                                   int offset ) {
        RequestProcessor processor = engine.createProcessor(context, null, true);
        try {
            FullTextSearchRequest request = new FullTextSearchRequest(searchExpression, workspaceName, maxResults, offset);
            processor.process(request);
            if (request.hasError()) {
                fail(request.getError().getMessage());
                return null;
            }
            assertThat(request.getResultColumns().getColumnCount(), is(0));
            assertThat(request.getResultColumns().getLocationCount(), is(1));
            assertThat(request.getResultColumns().hasFullTextSearchScores(), is(true));
            // Convert the results to a List<Location>
            List<Object[]> tuples = request.getTuples();
            List<Location> results = new ArrayList<Location>(tuples.size());
            for (Object[] tuple : tuples) {
                results.add((Location)tuple[0]);
                Float score = (Float)tuple[1];
                assertThat(score, is(notNullValue()));
            }
            return new org.jboss.dna.graph.query.process.QueryResults(request.getResultColumns(), request.getStatistics(),
                                                                      request.getTuples());
        } finally {
            processor.close();
        }
    }
View Full Code Here

                                   String searchExpression,
                                   int maxResults,
                                   int offset ) {
        RequestProcessor processor = searchEngine.createProcessor(context, null, true);
        try {
            FullTextSearchRequest request = new FullTextSearchRequest(searchExpression, workspaceName, maxResults, offset);
            processor.process(request);
            if (request.hasError()) {
                fail(request.getError().getMessage());
                return null;
            }
            assertThat(request.getResultColumns().getColumnCount(), is(0));
            assertThat(request.getResultColumns().getLocationCount(), is(1));
            assertThat(request.getResultColumns().hasFullTextSearchScores(), is(true));
            // Convert the results to a List<Location>
            List<Object[]> tuples = request.getTuples();
            List<Location> results = new ArrayList<Location>(tuples.size());
            for (Object[] tuple : tuples) {
                results.add((Location)tuple[0]);
                Float score = (Float)tuple[1];
                assertThat(score, is(notNullValue()));
            }
            return new org.jboss.dna.graph.query.process.QueryResults(request.getResultColumns(), request.getStatistics(),
                                                                      request.getTuples());
        } finally {
            processor.close();
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.dna.graph.request.FullTextSearchRequest

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.