magoffin.matt.ma2.lucene
Class LuceneBiz

java.lang.Object
  extended by magoffin.matt.ma2.biz.impl.AbstractSearchBiz
      extended by magoffin.matt.ma2.lucene.LuceneBiz
All Implemented Interfaces:
IndexBiz, SearchBiz

public class LuceneBiz
extends AbstractSearchBiz
implements SearchBiz, IndexBiz

Lucene implementation of SearchBiz and IndexBiz.

Version:
$Revision: 43 $ $Date: 2007-10-21 11:10:01 +1300 (Sun, 21 Oct 2007) $
Author:
Matt Magoffin (spamsqr@msqr.us)

Nested Class Summary
 
Nested classes/interfaces inherited from interface magoffin.matt.ma2.biz.SearchBiz
SearchBiz.AlbumSearchCriteria, SearchBiz.MediaItemSearchCriteria
 
Field Summary
static long DEFAULT_THREAD_SLEEP
          Default value for the reindexWaitForFinishThreadSleep property.
 
Constructor Summary
LuceneBiz()
           
 
Method Summary
 SearchResults findMediaItems(SearchBiz.MediaItemSearchCriteria criteria, PaginationCriteria pagination, BizContext context)
          Search for media items.
 SearchResults findUsersForIndex(PaginationCriteria pagination, BizContext context)
          Get an index of UserSearchResult objects.
 magoffin.matt.lucene.LuceneService getLucene()
           
 java.lang.String getMediaItemIndexType()
           
 org.springframework.context.MessageSource getMessages()
           
 long getReindexWaitForFinishThreadSleep()
           
 java.lang.String getUserIndexType()
           
 WorkBiz getWorkBiz()
           
 void indexMediaItem(java.lang.Long itemId)
          Index a MediaItem object based on its ID.
 void indexUser(java.lang.Long userId)
          Index a user object based on its ID.
 WorkBiz.WorkInfo recreateMediaItemIndex(BizContext context)
          Rebuild the entire MediaItem index.
 WorkBiz.WorkInfo recreateUserIndex(BizContext context)
          Rebuild the entire user index.
 void removeMediaItemFromIndex(java.lang.Long itemId)
          Remove a MediaItem from the index.
 void removeUserFromIndex(java.lang.Long userId)
          Remove a user from the index.
 void setLucene(magoffin.matt.lucene.LuceneService lucene)
           
 void setMediaItemIndexType(java.lang.String mediaItemIndexType)
           
 void setMessages(org.springframework.context.MessageSource messages)
           
 void setReindexWaitForFinishThreadSleep(long reindexWaitForFinishThreadSleep)
           
 void setUserIndexType(java.lang.String userIndexType)
           
 void setWorkBiz(WorkBiz workBiz)
           
 
Methods inherited from class magoffin.matt.ma2.biz.impl.AbstractSearchBiz
findAlbums, findAlbumsForBrowsing, getAlbumDao, getDomainObjectFactory, getSystemBiz, getUserBiz, setAlbumDao, setDomainObjectFactory, setSystemBiz, setUserBiz
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface magoffin.matt.ma2.biz.SearchBiz
findAlbums, findAlbumsForBrowsing
 

Field Detail

DEFAULT_THREAD_SLEEP

public static final long DEFAULT_THREAD_SLEEP
Default value for the reindexWaitForFinishThreadSleep property.

See Also:
Constant Field Values
Constructor Detail

LuceneBiz

public LuceneBiz()
Method Detail

findUsersForIndex

public SearchResults findUsersForIndex(PaginationCriteria pagination,
                                       BizContext context)
Description copied from interface: SearchBiz
Get an index of UserSearchResult objects.

Specified by:
findUsersForIndex in interface SearchBiz
Parameters:
pagination - the index pagination criteria
context - the current context
Returns:
search results with the pagination index and user results

findMediaItems

public SearchResults findMediaItems(SearchBiz.MediaItemSearchCriteria criteria,
                                    PaginationCriteria pagination,
                                    BizContext context)
Description copied from interface: SearchBiz
Search for media items.

Specified by:
findMediaItems in interface SearchBiz
Parameters:
criteria - the criteria
pagination - the pagination criteria
context - the current context
Returns:
search results

indexUser

public void indexUser(java.lang.Long userId)
Description copied from interface: IndexBiz
Index a user object based on its ID.

This method must support indexing a user that may or may not have been indexed before.

Specified by:
indexUser in interface IndexBiz
Parameters:
userId - the ID of the user to index

recreateUserIndex

public WorkBiz.WorkInfo recreateUserIndex(BizContext context)
Description copied from interface: IndexBiz
Rebuild the entire user index.

Specified by:
recreateUserIndex in interface IndexBiz
Parameters:
context - the current context
Returns:
the work info

removeUserFromIndex

public void removeUserFromIndex(java.lang.Long userId)
Description copied from interface: IndexBiz
Remove a user from the index.

Specified by:
removeUserFromIndex in interface IndexBiz
Parameters:
userId - the ID of the user to remove

indexMediaItem

public void indexMediaItem(java.lang.Long itemId)
Description copied from interface: IndexBiz
Index a MediaItem object based on its ID.

This method must support indexing an item that may or may not have been indexed before.

Specified by:
indexMediaItem in interface IndexBiz
Parameters:
itemId - the ID of the item to index

recreateMediaItemIndex

public WorkBiz.WorkInfo recreateMediaItemIndex(BizContext context)
Description copied from interface: IndexBiz
Rebuild the entire MediaItem index.

Specified by:
recreateMediaItemIndex in interface IndexBiz
Parameters:
context - the current context
Returns:
the work info

removeMediaItemFromIndex

public void removeMediaItemFromIndex(java.lang.Long itemId)
Description copied from interface: IndexBiz
Remove a MediaItem from the index.

Specified by:
removeMediaItemFromIndex in interface IndexBiz
Parameters:
itemId - the ID of the item to remove

getLucene

public magoffin.matt.lucene.LuceneService getLucene()
Returns:
the lucene

setLucene

public void setLucene(magoffin.matt.lucene.LuceneService lucene)
Parameters:
lucene - the lucene to set

getMessages

public org.springframework.context.MessageSource getMessages()
Returns:
the messages

setMessages

public void setMessages(org.springframework.context.MessageSource messages)
Parameters:
messages - the messages to set

getUserIndexType

public java.lang.String getUserIndexType()
Returns:
the userIndexType

setUserIndexType

public void setUserIndexType(java.lang.String userIndexType)
Parameters:
userIndexType - the userIndexType to set

getMediaItemIndexType

public java.lang.String getMediaItemIndexType()
Returns:
the mediaItemIndexType

setMediaItemIndexType

public void setMediaItemIndexType(java.lang.String mediaItemIndexType)
Parameters:
mediaItemIndexType - the mediaItemIndexType to set

getWorkBiz

public WorkBiz getWorkBiz()
Returns:
the workBiz

setWorkBiz

public void setWorkBiz(WorkBiz workBiz)
Parameters:
workBiz - the workBiz to set

getReindexWaitForFinishThreadSleep

public long getReindexWaitForFinishThreadSleep()
Returns:
the reindexWaitForFinishThreadSleep

setReindexWaitForFinishThreadSleep

public void setReindexWaitForFinishThreadSleep(long reindexWaitForFinishThreadSleep)
Parameters:
reindexWaitForFinishThreadSleep - the reindexWaitForFinishThreadSleep to set