com.atlassian.confluence.search.lucene
Class ConfluenceDocumentBuilder

java.lang.Object
  extended by com.atlassian.confluence.search.lucene.ConfluenceDocumentBuilder
All Implemented Interfaces:
com.atlassian.bonnie.search.DocumentBuilder, org.springframework.beans.factory.InitializingBean

public class ConfluenceDocumentBuilder
extends Object
implements com.atlassian.bonnie.search.DocumentBuilder, org.springframework.beans.factory.InitializingBean

A Confluence specific implementation of the DocumentBuilder that is aware of plugin's and the fact that new document extractors may become available or unavailable based on the current plugins installed.

Since the BaseDocumentBuilder is immutable when the extractors change a new documentBuilder is created.

Produces documents with of type SearchResultType.CONTENT.


Nested Class Summary
static class ConfluenceDocumentBuilder.FieldName
           
 
Field Summary
static String TYPE_FIELD
           
static String URL_PATH_FIELD
           
 
Constructor Summary
ConfluenceDocumentBuilder(com.atlassian.bonnie.HandleResolver handleResolver, com.atlassian.plugin.PluginAccessor pluginAccessor)
           
ConfluenceDocumentBuilder(com.atlassian.bonnie.HandleResolver handleResolver, com.atlassian.plugin.PluginAccessor pluginAccessor, List<com.atlassian.bonnie.search.Extractor> luceneExtractors)
          Constructor for tests.
 
Method Summary
 void afterPropertiesSet()
           
 org.apache.lucene.document.Document getDocument(com.atlassian.bonnie.Searchable searchable)
          Generates a Lucene document using the extractors defined by construction of BaseDocumentBuilder.
 com.atlassian.bonnie.Handle getHandle(Object obj)
           
protected  org.apache.lucene.document.Document getInitialDocument(com.atlassian.bonnie.Searchable searchable)
          Get the initial document that will be passed through the chain of extractors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_FIELD

public static final String TYPE_FIELD
See Also:
Constant Field Values

URL_PATH_FIELD

public static final String URL_PATH_FIELD
See Also:
Constant Field Values
Constructor Detail

ConfluenceDocumentBuilder

public ConfluenceDocumentBuilder(com.atlassian.bonnie.HandleResolver handleResolver,
                                 com.atlassian.plugin.PluginAccessor pluginAccessor)

ConfluenceDocumentBuilder

public ConfluenceDocumentBuilder(com.atlassian.bonnie.HandleResolver handleResolver,
                                 com.atlassian.plugin.PluginAccessor pluginAccessor,
                                 List<com.atlassian.bonnie.search.Extractor> luceneExtractors)
Constructor for tests.

Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

getDocument

public org.apache.lucene.document.Document getDocument(com.atlassian.bonnie.Searchable searchable)
Generates a Lucene document using the extractors defined by construction of BaseDocumentBuilder. Note: The 'contentBody' field will only be used if the data is below the value defined by system property 'atlassian.indexing.contentbody.maxsize'. If this property is not defined, threshold will default to 1 MiB.

Specified by:
getDocument in interface com.atlassian.bonnie.search.DocumentBuilder
Parameters:
searchable - The object to be processed
Returns:
a Lucene Document with extracted data from searchable object

getInitialDocument

protected org.apache.lucene.document.Document getInitialDocument(com.atlassian.bonnie.Searchable searchable)
Get the initial document that will be passed through the chain of extractors

Parameters:
searchable - the object the document is being created for
Returns:
a new Document pre-filled with the absolute minimum necessary data for it to be added.

getHandle

public com.atlassian.bonnie.Handle getHandle(Object obj)
Specified by:
getHandle in interface com.atlassian.bonnie.search.DocumentBuilder


Copyright © 2003–2015 Atlassian. All rights reserved.