ccc.services.ejb3
Class SearchEngineEJB

java.lang.Object
  extended by ccc.services.ejb3.SearchEngineEJB
All Implemented Interfaces:
Scheduler, SearchEngine

@RolesAllowed(value={})
public class SearchEngineEJB
extends java.lang.Object
implements SearchEngine

Lucene Implementation of the SearchEngine interface.

Author:
Civic Computing Ltd.

Field Summary
 
Fields inherited from interface ccc.api.core.SearchEngine
NAME
 
Constructor Summary
SearchEngineEJB()
          Constructor.
SearchEngineEJB(ResourceRepository rdao)
          Constructor.
 
Method Summary
 SearchResult find(java.lang.String searchTerms, int resultCount, int page)
          Find the entities that match the specified search terms.
 SearchResult find(java.lang.String searchTerms, java.lang.String sort, SortOrder order, int resultCount, int page)
          Find the results that match the specified search terms.
 void index()
          Rebuild the search index.
 boolean isRunning()
          Query whether the scheduler is running.
 void run(javax.ejb.Timer timer)
          Run the scheduled action.
 SearchResult similar(java.lang.String uuid, int noOfResultsPerPage, int page)
          Find the results that are similar to the specified page.
 void start()
          Start the scheduler running.
 void stop()
          Stop the scheduler running.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchEngineEJB

public SearchEngineEJB()
Constructor.


SearchEngineEJB

public SearchEngineEJB(ResourceRepository rdao)
Constructor.

Parameters:
rdao - The ResourceDao.
Method Detail

find

@PermitAll
public SearchResult find(java.lang.String searchTerms,
                                   int resultCount,
                                   int page)
Find the entities that match the specified search terms.

Specified by:
find in interface SearchEngine
Parameters:
searchTerms - The terms to match.
resultCount - The number of results to return.
page - The page of results to return (first page has index of 0).
Returns:
The SearchResult object with set entities and total count.

find

@PermitAll
public SearchResult find(java.lang.String searchTerms,
                                   java.lang.String sort,
                                   SortOrder order,
                                   int resultCount,
                                   int page)
Find the results that match the specified search terms.

Specified by:
find in interface SearchEngine
Parameters:
searchTerms - The terms to match.
sort - The field to sort on.
order - The order of the sort.
resultCount - The number of results to return.
page - The page of results to return (first page has index of 0).
Returns:
The SearchResult object with set entities and total count.

index

@RolesAllowed(value="SEARCH_REINDEX")
public void index()
Rebuild the search index.

Specified by:
index in interface SearchEngine

run

public void run(javax.ejb.Timer timer)
Run the scheduled action.

Parameters:
timer - The timer that called this method.

start

@RolesAllowed(value="SEARCH_SCHEDULE")
public void start()
Start the scheduler running.

Specified by:
start in interface Scheduler

stop

@RolesAllowed(value="SEARCH_SCHEDULE")
public void stop()
Stop the scheduler running.

Specified by:
stop in interface Scheduler

isRunning

@RolesAllowed(value="SEARCH_SCHEDULE")
public boolean isRunning()
Query whether the scheduler is running.

Specified by:
isRunning in interface Scheduler
Returns:
True if the scheduler is running; false otherwise.

similar

@PermitAll
public SearchResult similar(java.lang.String uuid,
                                      int noOfResultsPerPage,
                                      int page)
Find the results that are similar to the specified page.

Specified by:
similar in interface SearchEngine
Parameters:
uuid - The page to match.
noOfResultsPerPage - The number of results to return.
page - The page of results to return (first page has index of 0).
Returns:
The SearchResult object with set entities and total count.


Copyright © 2010. All Rights Reserved.