fr.paris.lutece.plugins.comarquage.util.search
Class XslXalanExtension

java.lang.Object
  extended by fr.paris.lutece.plugins.comarquage.util.search.XslXalanExtension

public class XslXalanExtension
extends java.lang.Object

Give extended functions to help to construct an index by XSL parsing
Functions must be declared in XSL source file with (it's an example):
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:axslt="http://xml.apache.org/xslt" xmlns:lucene="http://www.lutece.fr/plugins/comarquage/lucene" extension-element-prefixes="lucene" > <axslt:component prefix="lucene" functions="startIndexer,startDocument,addText,endDocument,endIndexer"> <axslt:script lang="javaclass" src="fr.paris.lutece.plugins.comarquage.util.Test"/> </axslt:component>
And must be used like:
<xsl:value-of select="lucene:startIndexer('indexDir', true())"/>


Constructor Summary
XslXalanExtension()
          Public constructor Reflection
 
Method Summary
 java.lang.Boolean addKeyword(org.apache.xalan.extensions.ExpressionContext context, java.lang.String strKey, java.lang.String strValue)
          Add a new keyword attribute to the document (a keyword attribute is store, indexed and not tokenized)
 java.lang.Boolean addKeywords(org.apache.xalan.extensions.ExpressionContext context, java.lang.String strKey, java.lang.String strValues, java.lang.String separators)
          Add a new keywords attributes to the document (a keyword attribute is store, indexed and not tokenized)
 java.lang.Boolean addText(org.apache.xalan.extensions.ExpressionContext context, java.lang.String strKey, java.lang.String strValue)
          Add a new text attribute to the document (a text attribute is store, indexed and tokenized)
 java.lang.Boolean addUnIndexed(org.apache.xalan.extensions.ExpressionContext context, java.lang.String strKey, java.lang.String strValue)
          Add a new undexed attribute to the document (a undexed attribute is store, no indexed and tokenized)
 java.lang.Boolean addUnStored(org.apache.xalan.extensions.ExpressionContext context, java.lang.String strKey, java.lang.String strValue)
          Add a new unstored (indexed) attribute to the document (a unstored attribute is no stored, indexed and tokenized)
 java.lang.Boolean endDocument(org.apache.xalan.extensions.ExpressionContext context)
          Add a document to index
 java.lang.Boolean endIndexer(org.apache.xalan.extensions.ExpressionContext context)
          Stop (close) the indexer
 java.lang.Boolean optimize(org.apache.xalan.extensions.ExpressionContext context)
          Optimize the index directory
 java.lang.Boolean startDocument(org.apache.xalan.extensions.ExpressionContext context)
          Start a new Lucene document
 java.lang.Boolean startIndexer(org.apache.xalan.extensions.ExpressionContext context, java.lang.String strPath, java.lang.Boolean bCreate)
          Start Lucene indexer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XslXalanExtension

public XslXalanExtension()
Public constructor Reflection

Method Detail

startIndexer

public java.lang.Boolean startIndexer(org.apache.xalan.extensions.ExpressionContext context,
                                      java.lang.String strPath,
                                      java.lang.Boolean bCreate)
Start Lucene indexer

Parameters:
context - The node context of Xalan execution
strPath - The path to directory index
bCreate - The directory must be create?
Returns:
Information about success of call (true means "All is ok")

optimize

public java.lang.Boolean optimize(org.apache.xalan.extensions.ExpressionContext context)
Optimize the index directory

Parameters:
context - The node context of Xalan execution
Returns:
Information about success of call (true means "All is ok")

endIndexer

public java.lang.Boolean endIndexer(org.apache.xalan.extensions.ExpressionContext context)
Stop (close) the indexer

Parameters:
context - The node context of Xalan execution
Returns:
Information about success of call (true means "All is ok")

startDocument

public java.lang.Boolean startDocument(org.apache.xalan.extensions.ExpressionContext context)
Start a new Lucene document

Parameters:
context - The node context of Xalan execution
Returns:
Information about success of call (true means "All is ok")

addText

public java.lang.Boolean addText(org.apache.xalan.extensions.ExpressionContext context,
                                 java.lang.String strKey,
                                 java.lang.String strValue)
Add a new text attribute to the document (a text attribute is store, indexed and tokenized)

Parameters:
context - The node context of Xalan execution
strKey - Lucene attribute name
strValue - Text value
Returns:
Information about success of call (true means "All is ok")

addKeyword

public java.lang.Boolean addKeyword(org.apache.xalan.extensions.ExpressionContext context,
                                    java.lang.String strKey,
                                    java.lang.String strValue)
Add a new keyword attribute to the document (a keyword attribute is store, indexed and not tokenized)

Parameters:
context - The node context of Xalan execution
strKey - Lucene attribute name
strValue - Keyword value
Returns:
Information about success of call (true means "All is ok")

addKeywords

public java.lang.Boolean addKeywords(org.apache.xalan.extensions.ExpressionContext context,
                                     java.lang.String strKey,
                                     java.lang.String strValues,
                                     java.lang.String separators)
Add a new keywords attributes to the document (a keyword attribute is store, indexed and not tokenized)

Parameters:
context - The node context of Xalan execution
strKey - Lucene attribute name
strValues - Keywords value (separate by separators char)
separators - The separators of key words (for use with StringTokenizer)
Returns:
Information about success of call (true means "All is ok")

addUnIndexed

public java.lang.Boolean addUnIndexed(org.apache.xalan.extensions.ExpressionContext context,
                                      java.lang.String strKey,
                                      java.lang.String strValue)
Add a new undexed attribute to the document (a undexed attribute is store, no indexed and tokenized)

Parameters:
context - The node context of Xalan execution
strKey - Lucene attribute name
strValue - Text value
Returns:
Information about success of call (true means "All is ok")

addUnStored

public java.lang.Boolean addUnStored(org.apache.xalan.extensions.ExpressionContext context,
                                     java.lang.String strKey,
                                     java.lang.String strValue)
Add a new unstored (indexed) attribute to the document (a unstored attribute is no stored, indexed and tokenized)

Parameters:
context - The node context of Xalan execution
strKey - Lucene attribute name
strValue - Text value
Returns:
Information about success of call (true means "All is ok")

endDocument

public java.lang.Boolean endDocument(org.apache.xalan.extensions.ExpressionContext context)
Add a document to index

Parameters:
context - The node context of Xalan execution
Returns:
Information about success of call (true means "All is ok")


Copyright © 2007 Mairie de Paris. All Rights Reserved.