|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.avalon.framework.logger.AbstractLoggable | +--org.apache.cocoon.xml.AbstractXMLProducer | +--org.apache.cocoon.generation.AbstractGenerator | +--org.apache.cocoon.generation.ComposerGenerator | +--org.apache.cocoon.generation.SearchGenerator
Generates an XML representation of a search result.
This generator generates xml content representening an XML search. The generated xml content contains the search result, the search query information, and navigation information about the search results.
Search xml sample generated by this generator:
<?xml version="1.0" encoding="UTF-8"?> <search:results date="1008437081064" query-string="cocoon" start-index="0" page-length="10" xmlns:search="http://apache.org/cocoon/search/1.0" xmlns:xlink="http://www.w3.org/1999/xlink"> <search:hits total-count="125" count-of-pages="13"> <search:hit rank="0" score="1.0" uri="http://localhost:8080/cocoon/documents/hosting.html"> <search:field name="title">Document Title<search:field/> <search:hit/> ... </search:hits> <search:navigation total-count="125" count-of-pages="13" has-next="true" has-previous="false" next-index="10" previous-index="0"> <search:navigation-page start-index="0"/> <search:navigation-page start-index="10"/> ... <search:navigation-page start-index="120"/> </search:navigation> </search:results>
Field Summary | |
protected static java.lang.String |
CDATA
Description of the Field |
protected static java.lang.String |
COUNT_OF_PAGES_ATTRIBUTE
Attribute count-of-pages of hits element.
|
protected static java.lang.String |
DATE_ATTRIBUTE
Attribute date of results element.
|
protected static java.lang.String |
FIELD_ELEMENT
Child element field of the hit element.
|
protected static java.lang.String |
HAS_NEXT_ATTRIBUTE
Attribute has-next of navigation-page element.
|
protected static java.lang.String |
HAS_PREVIOUS_ATTRIBUTE
Attribute has-next of navigation-page element.
|
protected static java.lang.String |
HIT_ELEMENT
Child element of generated xml content, ie hit .
|
protected static java.lang.String |
HITS_ELEMENT
Child element of generated xml content, ie hits .
|
protected static java.lang.String |
INDEX_PARAM
Setup parameter name of index directory, ie index . |
protected static java.lang.String |
INDEX_PARAM_DEFAULT
Default value of setup parameter index , ie index . |
protected static java.lang.String |
namespace
The XML namespace for the output document. |
protected static java.lang.String |
NAVIGATION_ELEMENT
Child element of generated xml content, ie navigation .
|
protected static java.lang.String |
NAVIGATION_PAGE_ELEMENT
Child element of generated xml content, ie navigation .
|
protected static java.lang.String |
NEXT_INDEX_ATTRIBUTE
Attribute next-index of navigation-page element.
|
protected static java.lang.String |
PAGE_LENGTH_ATTRIBUTE
Attribute page-length of results element.
|
protected static int |
PAGE_LENGTH_DEFAULT
Description of the Field |
protected static java.lang.String |
PAGE_LENGTH_PARAM
Setup parameter name specifying the name of page-length query parameter, ie page-length . |
protected static java.lang.String |
PAGE_LENGTH_PARAM_DEFAULT
Description of the Field |
protected static java.lang.String |
PREVIOUS_INDEX_ATTRIBUTE
Attribute previous-index of navigation-page element.
|
protected static java.lang.String |
QUERY_STRING_ATTRIBUTE
Attribute query-string of results element.
|
protected static java.lang.String |
QUERY_STRING_PARAM
Setup parameter name specifying the name of query-string query parameter, ie query-string . |
protected static java.lang.String |
QUERY_STRING_PARAM_DEFAULT
Default value of setup parameter query-string , ie queryString . |
protected static java.lang.String |
RANK_ATTRIBUTE
Attribute rank of hit element.
|
protected static java.lang.String |
RESULTS_ELEMENT
Root element of generated xml content, ie results . |
protected static java.lang.String |
SCORE_ATTRIBUTE
Attribute score of hit element.
|
protected static java.lang.String |
START_INDEX_ATTRIBUTE
Attribute start-index of results element.
|
protected static int |
START_INDEX_DEFAULT
Description of the Field |
protected static java.lang.String |
START_INDEX_NEXT_PARAM
Setup parameter name specifying the name of start-next-index query parameter, ie start-next-index . |
protected static java.lang.String |
START_INDEX_NEXT_PARAM_DEFAULT
Default value of setup parameter start-next-index , ie startNextIndex . |
protected static java.lang.String |
START_INDEX_PARAM
Setup parameter name specifying the name of start-index query parameter, ie start-index . |
protected static java.lang.String |
START_INDEX_PARAM_DEFAULT
Default value of setup parameter start-index , ie startIndex . |
protected static java.lang.String |
START_INDEX_PREVIOUS_PARAM
Setup parameter name specifying the name of start-previous-index query parameter, ie start-previous-index . |
protected static java.lang.String |
START_INDEX_PREVIOUS_PARAM_DEFAULT
Default value of setup parameter start-previous-index , ie startPreviousIndex . |
protected static java.lang.String |
TOTAL_COUNT_ATTRIBUTE
Attribute total-count of hits element.
|
protected static java.lang.String |
URI_ATTRIBUTE
Attribute uri of hit element.
|
protected static java.lang.String |
xlinkNamespace
The XML namespace for xlink |
Fields inherited from class org.apache.cocoon.generation.ComposerGenerator |
manager |
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator |
objectModel, parameters, resolver, source |
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer |
contentHandler, lexicalHandler, xmlConsumer |
Fields inherited from interface org.apache.cocoon.generation.Generator |
ROLE |
Constructor Summary | |
SearchGenerator()
|
Method Summary | |
void |
compose(org.apache.avalon.framework.component.ComponentManager manager)
Set the current ComponentManager instance used by this
Composable . |
void |
contextualize(org.apache.avalon.framework.context.Context context)
Contextualize this class. |
void |
dispose()
Release all resources. |
void |
generate()
Generate xml content describing search results. |
void |
initialize()
|
void |
recycle()
Recycle the generator |
void |
setup(SourceResolver resolver,
java.util.Map objectModel,
java.lang.String src,
org.apache.avalon.framework.parameters.Parameters par)
setup all members of this generator. |
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer |
setConsumer, setContentHandler, setLexicalHandler |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable |
getLogger, setLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.cocoon.xml.XMLProducer |
setConsumer |
Field Detail |
protected static final java.lang.String namespace
protected static final java.lang.String xlinkNamespace
protected static final java.lang.String CDATA
protected static final java.lang.String RESULTS_ELEMENT
results
.protected static final java.lang.String DATE_ATTRIBUTE
date
of results
element.
It contains the date a long value, indicating when a search
generated this xml content.protected static final java.lang.String QUERY_STRING_ATTRIBUTE
query-string
of results
element.
Echos the queryString
query parameter.protected static final java.lang.String START_INDEX_ATTRIBUTE
start-index
of results
element.
Echos the startIndex
query parameter.protected static final java.lang.String PAGE_LENGTH_ATTRIBUTE
page-length
of results
element.
Echos the pageLenth
query parameter.protected static final java.lang.String HITS_ELEMENT
hits
.
This element describes all hits.protected static final java.lang.String TOTAL_COUNT_ATTRIBUTE
total-count
of hits
element.
The value describes total number of hits found by the search engine.protected static final java.lang.String COUNT_OF_PAGES_ATTRIBUTE
count-of-pages
of hits
element.
The value describes number of pages needed for all hits.protected static final java.lang.String HIT_ELEMENT
hit
.
This element describes a single hit.protected static final java.lang.String RANK_ATTRIBUTE
rank
of hit
element.
The value describes the count index of this hits, ranging between 0, and
total-count minus 1.protected static final java.lang.String SCORE_ATTRIBUTE
score
of hit
element.
The value describes the score of this hits, ranging between 0, and 1.0.protected static final java.lang.String URI_ATTRIBUTE
uri
of hit
element.
The value describes the uri of a document matching the search query.protected static final java.lang.String FIELD_ELEMENT
field
of the hit
element.
This element contains value of the stored field of a hit.protected static final java.lang.String NAVIGATION_ELEMENT
navigation
.
This element describes some hints for easier navigation.protected static final java.lang.String NAVIGATION_PAGE_ELEMENT
navigation
.
This element describes the start-index of page containing hits.protected static final java.lang.String HAS_NEXT_ATTRIBUTE
has-next
of navigation-page
element.
The value is true if a next navigation control should be presented.protected static final java.lang.String HAS_PREVIOUS_ATTRIBUTE
has-next
of navigation-page
element.
The value is true if a previous navigation control should be presented.protected static final java.lang.String NEXT_INDEX_ATTRIBUTE
next-index
of navigation-page
element.
The value describes the start-index of the next-to-be-presented page.protected static final java.lang.String PREVIOUS_INDEX_ATTRIBUTE
previous-index
of navigation-page
element.
The value describes the start-index of the previous-to-be-presented page.protected static final java.lang.String INDEX_PARAM
index
.protected static final java.lang.String INDEX_PARAM_DEFAULT
index
, ie index
.protected static final java.lang.String QUERY_STRING_PARAM
query-string
.protected static final java.lang.String QUERY_STRING_PARAM_DEFAULT
query-string
, ie queryString
.protected static final java.lang.String START_INDEX_PARAM
start-index
.protected static final java.lang.String START_INDEX_PARAM_DEFAULT
start-index
, ie startIndex
.protected static final java.lang.String START_INDEX_NEXT_PARAM
start-next-index
.protected static final java.lang.String START_INDEX_NEXT_PARAM_DEFAULT
start-next-index
, ie startNextIndex
.protected static final java.lang.String START_INDEX_PREVIOUS_PARAM
start-previous-index
.protected static final java.lang.String START_INDEX_PREVIOUS_PARAM_DEFAULT
start-previous-index
, ie startPreviousIndex
.protected static final int START_INDEX_DEFAULT
protected static final java.lang.String PAGE_LENGTH_PARAM
page-length
.protected static final java.lang.String PAGE_LENGTH_PARAM_DEFAULT
protected static final int PAGE_LENGTH_DEFAULT
Constructor Detail |
public SearchGenerator()
Method Detail |
public void compose(org.apache.avalon.framework.component.ComponentManager manager) throws org.apache.avalon.framework.component.ComponentException
ComponentManager
instance used by this
Composable
.compose
in class ComposerGenerator
public void setup(SourceResolver resolver, java.util.Map objectModel, java.lang.String src, org.apache.avalon.framework.parameters.Parameters par) throws ProcessingException, org.xml.sax.SAXException, java.io.IOException
setup
in class AbstractGenerator
public void contextualize(org.apache.avalon.framework.context.Context context) throws org.apache.avalon.framework.context.ContextException
Especially retrieve the work directory. If the index directory is specified relativly, the working directory is used as home directory of the index directory.
contextualize
in interface org.apache.avalon.framework.context.Contextualizable
context
- Context to useorg.apache.avalon.framework.context.ContextException
- If contextualizing fails.public void initialize() throws java.io.IOException
initialize
in interface org.apache.avalon.framework.activity.Initializable
public void generate() throws java.io.IOException, org.xml.sax.SAXException, ProcessingException
java.io.IOException
- when there is a problem reading the from file system.org.xml.sax.SAXException
- when there is a problem creating the output SAX events.ProcessingException
- when there is a problem obtaining the hitspublic void recycle()
recycle
in class AbstractGenerator
public void dispose()
ComposerGenerator
dispose
in interface org.apache.avalon.framework.activity.Disposable
dispose
in class ComposerGenerator
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |