Groovy Documentation

services
Class IndexingService

java.lang.Object
  services.IndexingService

class IndexingService

Nutch+Solr Indexing service.

author:
Niraj Aswani


Property Summary
static int DELETE_CMD

static int INDEX_CMD

constansts

static int UPDATE_CMD

static Map conf

Get configuration

static String indexingTimeStamp

Time stamp for last indexing.

static Logger log

Logger

boolean transactional

is not transactional

 
Constructor Summary
IndexingService()

 
Method Summary
boolean addToQueue(String url, String wikiId, int command)

Adds the request to queue

private boolean callAnt(List toIndex, String wikiId, int command)

calls the ant command thread

boolean delete(String urlToRemove, String wikiId)

Adds the given url to the queue for deletion.

boolean index(String urlToIndex, String wikiId)

Adds the given url to the queue for indexing.

boolean update(String urlToUpdate, String wikiId)

Adds the given url to the queue for updating.

 
Methods inherited from class Object
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll
 

Property Detail

DELETE_CMD

static final int DELETE_CMD


INDEX_CMD

static final int INDEX_CMD
constansts


UPDATE_CMD

static final int UPDATE_CMD


conf

static Map conf
Get configuration


indexingTimeStamp

static String indexingTimeStamp
Time stamp for last indexing. This is used for deciding if the result cache should be cleared.


log

static Logger log
Logger


transactional

boolean transactional
is not transactional


 
Constructor Detail

IndexingService

IndexingService()


 
Method Detail

addToQueue

boolean addToQueue(String url, String wikiId, int command)
Adds the request to queue
param:
toIndex (e.g. a list of file urls = file://path-to-a-sandbox/
param:
wikiId (one of INDEX_CMD, DELETE_CMD, or UPDATE_CMD)
param:
command (one of index, delete, or update)
return:
true if request is submitted successfully. False, if it is already being indexed or is in the queue.


callAnt

private boolean callAnt(List toIndex, String wikiId, int command)
calls the ant command
param:
request web request object
param:
toIndex (e.g. a list of file urls = file://path-to-a-sandbox/
param:
wikiId (e.g. 1 for help, 2 for main etc)
param:
command (one of index, delete, or update)
param:
asynchronousMode if set to true, execution starts in a separate thread
return:
true only if the process finishes successfully. If the process has is started in the asynchronous mode, it will always return true.


delete

boolean delete(String urlToRemove, String wikiId)
Adds the given url to the queue for deletion. It must not be a directory url
param:
urlToRemove (e.g. file://path-to-a-file/, use * to delete all)
param:
wikiId (e.g. 1 for help, 2 for main etc)
return:
true if the url is added successfully. false if it is being indexed or is already in the queue for deletion.


index

boolean index(String urlToIndex, String wikiId)
Adds the given url to the queue for indexing. If folder, it iterates through all documents
param:
urlToIndex (e.g. file://path-to-a-file-or-directory/)
param:
wikiId (e.g. 1 for help, 2 for main etc)
return:
true if the url is added successfully. false if is already being indexed.


update

boolean update(String urlToUpdate, String wikiId)
Adds the given url to the queue for updating. It must not be a directory url
param:
urlToUpdate (e.g. file://path-to-a-file/)
param:
wikiId (e.g. 1 for help, 2 for main etc)
return:
true if the url is submitted successfully. false, if it is already being indexed.


 

Groovy Documentation