com.atlassian.confluence.search.v2.lucene
Class LuceneSearchManager

java.lang.Object
  extended by com.atlassian.confluence.search.v2.lucene.LuceneSearchManager
All Implemented Interfaces:
SearchManager

public class LuceneSearchManager
extends Object
implements SearchManager


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.confluence.search.v2.SearchManager
SearchManager.EntityVersionPolicy
 
Field Summary
static org.apache.log4j.Logger log
          Deprecated. since 3.1 do not use this logger.
 
Constructor Summary
LuceneSearchManager(LuceneSearchMapper luceneSearchMapper, LuceneSearcher luceneSearcher, AnyTypeDao anyTypeDao, com.atlassian.bonnie.analyzer.LuceneAnalyzerFactory luceneAnalyzerFactory, ContentEntityObjectDao contentEntityObjectDao)
           
 
Method Summary
 List<com.atlassian.bonnie.Searchable> convertToEntities(SearchResults searchResults, boolean stripNull)
          Deprecated. 
 List<com.atlassian.bonnie.Searchable> convertToEntities(SearchResults searchResults, SearchManager.EntityVersionPolicy versionPolicy)
          Helper method to convert search results into a list of database entities.
 SearchResults search(ISearch search)
          Perform a search with a given criteria.
 SearchResults search(ISearch search, Set<String> requestedFields)
          Perform a search with a given criteria, the returns searchResults only have the fields requested in the projection filled out, no other fields are valid in the searchResult.
 SearchResults search(Search search)
          Deprecated. 
 List<com.atlassian.bonnie.Searchable> searchEntities(ISearch search)
          Deprecated. 
 List<com.atlassian.bonnie.Searchable> searchEntities(ISearch search, SearchManager.EntityVersionPolicy versionPolicy)
          Perform a search with the given criteria, returning the results as a list of database entity objects.
 List<com.atlassian.bonnie.Searchable> searchEntities(Search search)
          Deprecated. 
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

@Deprecated
public static final org.apache.log4j.Logger log
Deprecated. since 3.1 do not use this logger.
Constructor Detail

LuceneSearchManager

public LuceneSearchManager(LuceneSearchMapper luceneSearchMapper,
                           LuceneSearcher luceneSearcher,
                           AnyTypeDao anyTypeDao,
                           com.atlassian.bonnie.analyzer.LuceneAnalyzerFactory luceneAnalyzerFactory,
                           ContentEntityObjectDao contentEntityObjectDao)
Method Detail

search

public SearchResults search(ISearch search)
                     throws InvalidSearchException
Description copied from interface: SearchManager
Perform a search with a given criteria.

Will throw an InvalidSearchException if some error occurred converting the search object into a search that could be performed in the back-end. Usually this is a sign that some plugin that was used to create the search is no longer available.

Specified by:
search in interface SearchManager
Parameters:
search - the specified search
Returns:
search results.
Throws:
InvalidSearchException - when this manager is unable to translate and conduct the specified search. Clients should just discard the search if this occurs.

searchEntities

public List<com.atlassian.bonnie.Searchable> searchEntities(ISearch search,
                                                            SearchManager.EntityVersionPolicy versionPolicy)
                                                     throws InvalidSearchException
Description copied from interface: SearchManager
Perform a search with the given criteria, returning the results as a list of database entity objects. Unlike the SearchManager.convertToEntities(SearchResults, EntityVersionPolicy) method, the list of entities returned will not contain any nulls: search results that do not match a database record will be silently discarded.

The versionPolicy determines whether the entities returned should be the same version as stored in the index (SearchManager.EntityVersionPolicy.INDEXED_VERSION) or the latest version of the same content (SearchManager.EntityVersionPolicy.LATEST_VERSION). If you don't have a particular need to retrieve the latest version, it is recommended that you retrieve the indexed version so that any permission changes made to the document when updating it will be respected.

Specified by:
searchEntities in interface SearchManager
Parameters:
search - the search to perform
versionPolicy - whether to retrieve the indexed version of content found via search (recommended), or the latest version of content (not recommended)
Returns:
a list of Searchable objects representing the search results
Throws:
InvalidSearchException - when this manager is unable to translate and conduct the specified search. Clients should just discard the search if this occurs.

searchEntities

@Deprecated
public List<com.atlassian.bonnie.Searchable> searchEntities(ISearch search)
                                                     throws InvalidSearchException
Deprecated. 

Specified by:
searchEntities in interface SearchManager
Throws:
InvalidSearchException

convertToEntities

@Deprecated
public List<com.atlassian.bonnie.Searchable> convertToEntities(SearchResults searchResults,
                                                                          boolean stripNull)
Deprecated. 

Specified by:
convertToEntities in interface SearchManager

convertToEntities

public List<com.atlassian.bonnie.Searchable> convertToEntities(SearchResults searchResults,
                                                               SearchManager.EntityVersionPolicy versionPolicy)
Description copied from interface: SearchManager
Helper method to convert search results into a list of database entities. Because the search index does not update at the same time as the database, a search may contain references to entities that have since been modified or deleted from the db.

Entries that have been deleted from the database are removed from the returned list of entities, so the index of the entities in the returned list may not match the indexes of the search result it corresponds to.

The behaviour for entries that have been modified in the database varies based on the versionPolicy argument. If it is set to SearchManager.EntityVersionPolicy.INDEXED_VERSION, which is the recommended default, the returned entities will be the same version as found in the index. If it is set to SearchManager.EntityVersionPolicy.LATEST_VERSION, the latest version of the content will be returned. Using the latest version is not recommended because it can mean permissions added to the document when it was most recently updated may not be respected.

Specified by:
convertToEntities in interface SearchManager
Parameters:
searchResults - the results of a search from this manager
versionPolicy - whether to retrieve the indexed version of content found via search (recommended), or the latest version of content (not recommended)
Returns:
the entities represented by that search result. List may be empty if the search returned no results, or may contain null values where the result does not map to a valid database record.

search

@Deprecated
public SearchResults search(Search search)
                     throws InvalidSearchException
Deprecated. 

Specified by:
search in interface SearchManager
Throws:
InvalidSearchException
See Also:
Search, ContentSearch

searchEntities

@Deprecated
public List<com.atlassian.bonnie.Searchable> searchEntities(Search search)
                                                     throws InvalidSearchException
Deprecated. 

Specified by:
searchEntities in interface SearchManager
Throws:
InvalidSearchException

search

public SearchResults search(ISearch search,
                            Set<String> requestedFields)
                     throws InvalidSearchException
Description copied from interface: SearchManager
Perform a search with a given criteria, the returns searchResults only have the fields requested in the projection filled out, no other fields are valid in the searchResult. SearchResults will throw an FieldNotRequestedException if an attempt is made to access a field value that has not had it's key included in the projection Set.

Will throw an InvalidSearchException if some error occurred converting the search object into a search that could be performed in the back-end. Usually this is a sign that some plugin that was used to create the search is no longer available.

Specified by:
search in interface SearchManager
Returns:
Throws:
InvalidSearchException


Copyright © 2003-2012 Atlassian. All Rights Reserved.