/** * Create a request to perform a full-text search of the workspace. * * @param workspaceName the name of the workspace containing the node * @param fullTextSearchExpression the full-text search expression * @param maxResults the maximum number of results that are to be returned; always positive * @param offset the number of initial results to skip, or 0 if the first results are to be returned * @return the request; never null * @throws IllegalArgumentException if any of the parameters are null or if the expression is empty */ public FullTextSearchRequest search( String workspaceName, String fullTextSearchExpression, int maxResults, int offset ) { return process(new FullTextSearchRequest(fullTextSearchExpression, workspaceName, maxResults, offset)); }
/** * {@inheritDoc} * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals( Object obj ) { if (obj == this) return true; if (this.getClass().isInstance(obj)) { FullTextSearchRequest that = (FullTextSearchRequest)obj; if (!this.expression().equals(that.expression())) return false; if (!this.workspace().equals(that.workspace())) return false; if (this.offset() != that.offset()) return false; if (this.maxResults() != that.maxResults()) return false; return true; } return false; }
/** * Search the current workspace using the supplied full-text search expression. * * @param fullTextSearchExpression the full-text search expression * @param maxResults the maximum number of results that are to be returned; always positive * @param offset the number of initial results to skip, or 0 if the first results are to be returned * @return the results of the search; never null * @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.modeshape.graph.query.process.QueryResults(request.getResultColumns(), request.getStatistics(), request.getTuples()); return results; }
@Override public void process( FullTextSearchRequest request ) { PathWorkspace workspace = getWorkspace(request, request.workspace()); if (workspace == null) return; final ExecutionContext context = getExecutionContext(); QueryResults results = workspace.search(context, request.expression()); if (results != null) { request.setResults(results.getColumns(), results.getTuples(), results.getStatistics()); } else { super.processUnknownRequest(request); } }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.FullTextSearchRequest) */ @Override public void process( FullTextSearchRequest request ) { if (nextTuples == null) { super.process(request); // should result in error } request.setResults(nextColumns, nextTuples, nextStatistics); nextColumns = null; nextTuples = null; nextStatistics = null; }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.FullTextSearchRequest) */ @Override public void process( FullTextSearchRequest request ) { WorkspaceType workspace = getWorkspace(request, request.workspace()); if (workspace == null) return; QueryResults results = txn.search(workspace, request); if (results != null) { request.setResults(results.getColumns(), results.getTuples(), results.getStatistics()); } else { super.processUnknownRequest(request); } }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.FullTextSearchRequest) */ @Override public void process( FullTextSearchRequest request ) { MapWorkspace workspace = getWorkspace(request, request.workspace()); if (workspace == null) return; final ExecutionContext context = getExecutionContext(); QueryResults results = workspace.search(context, request.expression()); if (results != null) { request.setResults(results.getColumns(), results.getTuples(), results.getStatistics()); } else { super.processUnknownRequest(request); } }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.FullTextSearchRequest) */ @Override public void process( FullTextSearchRequest request ) { record(request); List<Object[]> tuples = new ArrayList<Object[]>(); Statistics stats = new Statistics(); request.setResults(new FullTextSearchResultColumns(), tuples, stats); }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.FullTextSearchRequest) */ @Override public void process( FullTextSearchRequest request ) { record(request); List<Object[]> tuples = new ArrayList<Object[]>(); Statistics stats = new Statistics(); request.setResults(new FullTextSearchResultColumns(), tuples, stats); }