SMILA (incubation) API documentation

org.eclipse.smila.search.index
Class IndexConnection

java.lang.Object
  extended by org.eclipse.smila.search.index.IndexConnection
Direct Known Subclasses:
IndexConnection

public abstract class IndexConnection
extends java.lang.Object

A Class class.

Author:
BROX IT-Solutions GmbH

Field Summary
protected  DIndex _index
          Index configuration from data dictionary.
protected  java.lang.String _indexName
          Index name.
 
Constructor Summary
protected IndexConnection(java.lang.String indexName)
           
 
Method Summary
protected abstract  void addHighlightAnnotation(IQueryExpression dQE, Record record, int fieldNo, java.lang.String attributeName, java.lang.String indexName)
          Adds a highlighting annotation on the given record and attribute
protected abstract  void close()
          Close index connection.
abstract  void deleteDocument(Id id)
          Delete document from index.
abstract  void deleteDocument(java.lang.String key)
          Delete document from index.
abstract  boolean docExists(Id id)
          Checks whether a document exists in index.
abstract  boolean docExists(java.lang.String key)
          Checks whether a document exists in index.
 LuceneSearchResult doQuery(DQuery dQuery)
          Performs a search for a fully complex query expression.
 LuceneSearchResult doQuery(IQueryExpression dQE)
           
protected abstract  LuceneSearchResult doQuery(IQueryExpression dQE, int startPos)
          Execute search query.
 LuceneSearchResult doTestQuery(java.lang.String text)
          Execute test query.
protected abstract  void encodeTextField(DTextField tf)
           
 DIndex getIndex()
          Get index configuration definition from data dictionary.
 java.lang.String getName()
          Get index name.
protected abstract  java.lang.String[] getResultValues(Id id, int fieldNo)
           
protected abstract  void getResultValues(java.lang.String[] keys, int[] fields, java.lang.String[][] values)
           
abstract  IQueryExpression getSimpleSearchQuery(DQuery dQuery)
          Transform a simple search to the corresponding advanced search.
protected abstract  IQueryExpression getTestQueryExpression(java.lang.String text)
           
protected abstract  void insertDateParameter(DDateField field, IDFParameter configParameter, java.lang.String config, java.lang.StringBuffer sb)
           
protected abstract  void insertNumberParameter(DNumberField field, INFParameter configParameter, java.lang.String config, java.lang.StringBuffer sb)
           
protected abstract  void insertTextParameter(DTextField field, ITFParameter configParameter, java.lang.String config, java.lang.StringBuffer sb)
           
protected abstract  void isSupportedValue(int fieldNo, java.lang.Object value)
           
abstract  void learnDocument(Blackboard blackboard, Id id, java.util.Map<java.lang.String,java.lang.Integer> attributeMapping, java.util.Map<java.lang.String,java.lang.Integer> attachmentMapping)
          Add a document to index.
protected abstract  void setLiteralValue(Literal literal, int fieldNo, java.lang.String value)
          Set the value of the given literal using the appropriate type method.
protected abstract  void startBurstmode()
          Start burst mode.
protected abstract  void stopBurstmode()
          Stop burst mode.
 void validateQuery(DQuery dQuery)
          This method extends a given search query with all possible configurable attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_index

protected DIndex _index
Index configuration from data dictionary.


_indexName

protected java.lang.String _indexName
Index name.

Constructor Detail

IndexConnection

protected IndexConnection(java.lang.String indexName)
                   throws IndexException
Parameters:
indexName - name of index to be created
Throws:
IndexException - Unable to create index connection.
Method Detail

getName

public java.lang.String getName()
Get index name.

Returns:
Index name.

getIndex

public DIndex getIndex()
Get index configuration definition from data dictionary.

Returns:
Index configuration definition from data dictionary.

close

protected abstract void close()
Close index connection.


docExists

public abstract boolean docExists(java.lang.String key)
                           throws IndexException
Checks whether a document exists in index.

Parameters:
key - Key.
Returns:
Whether a document exists.
Throws:
IndexException - Unable to check the document exists in index.

docExists

public abstract boolean docExists(Id id)
                           throws IndexException
Checks whether a document exists in index.

Parameters:
id - the Id
Returns:
Whether a document exists.
Throws:
IndexException - Unable to check the document exists in index.

deleteDocument

public abstract void deleteDocument(java.lang.String key)
                             throws IndexException
Delete document from index.

Parameters:
key - Key.
Throws:
IndexException - Unable to delete document from index.

deleteDocument

public abstract void deleteDocument(Id id)
                             throws IndexException
Delete document from index.

Parameters:
id - the Id
Throws:
IndexException - Unable to delete document from index.

learnDocument

public abstract void learnDocument(Blackboard blackboard,
                                   Id id,
                                   java.util.Map<java.lang.String,java.lang.Integer> attributeMapping,
                                   java.util.Map<java.lang.String,java.lang.Integer> attachmentMapping)
                            throws IndexException,
                                   BlackboardAccessException
Add a document to index.

Parameters:
blackboard - the BlackboardService
id - the Id of the record to add.
attributeMapping - Map containing the attribute to FieldNo mapping
attachmentMapping - Map containing the attachment to FieldNo mapping
Throws:
IndexException - Unable to add document to index.
BlackboardAccessException - if errors occur accessing the Blackboard

startBurstmode

protected abstract void startBurstmode()
                                throws IndexException
Start burst mode.

Throws:
IndexException - Unable to start burst mode.

stopBurstmode

protected abstract void stopBurstmode()
                               throws IndexException
Stop burst mode.

Throws:
IndexException - Unable to stop burst mode.

getSimpleSearchQuery

public abstract IQueryExpression getSimpleSearchQuery(DQuery dQuery)
                                               throws IndexException,
                                                      NodeTransformerException,
                                                      TemplateException
Transform a simple search to the corresponding advanced search.

Parameters:
dQuery - Simple search.
Returns:
Advanced search.
Throws:
IndexException - Unable to get advanced search.
NodeTransformerException - Unable to perform node transformation.
TemplateException - Unable to apply template.

doQuery

protected abstract LuceneSearchResult doQuery(IQueryExpression dQE,
                                              int startPos)
                                       throws IndexException
Execute search query.

Parameters:
dQE - Advanced search query.
startPos - Start position.
Returns:
Result.
Throws:
IndexException - Unable to perform search query.

getTestQueryExpression

protected abstract IQueryExpression getTestQueryExpression(java.lang.String text)
                                                    throws IndexException
Parameters:
text - -
Returns:
IQueryExpression
Throws:
IndexException - -

insertTextParameter

protected abstract void insertTextParameter(DTextField field,
                                            ITFParameter configParameter,
                                            java.lang.String config,
                                            java.lang.StringBuffer sb)
Parameters:
field - -
configParameter - -
config - -
sb - -

insertNumberParameter

protected abstract void insertNumberParameter(DNumberField field,
                                              INFParameter configParameter,
                                              java.lang.String config,
                                              java.lang.StringBuffer sb)
Parameters:
field - -
configParameter - -
config - -
sb - -

insertDateParameter

protected abstract void insertDateParameter(DDateField field,
                                            IDFParameter configParameter,
                                            java.lang.String config,
                                            java.lang.StringBuffer sb)
Parameters:
field - -
configParameter - -
config - -
sb - -

getResultValues

protected abstract void getResultValues(java.lang.String[] keys,
                                        int[] fields,
                                        java.lang.String[][] values)
                                 throws IndexException
Parameters:
keys - -
fields - -
values - -
Throws:
IndexException - -

getResultValues

protected abstract java.lang.String[] getResultValues(Id id,
                                                      int fieldNo)
                                               throws IndexException
Throws:
IndexException

encodeTextField

protected abstract void encodeTextField(DTextField tf)
                                 throws IndexException
Parameters:
tf - -
Throws:
IndexException - -

isSupportedValue

protected abstract void isSupportedValue(int fieldNo,
                                         java.lang.Object value)
                                  throws IndexException
Parameters:
fieldNo - -
value - -
Throws:
IndexException - -

validateQuery

public void validateQuery(DQuery dQuery)
                   throws IndexException
This method extends a given search query with all possible configurable attributes. Additionally checks this method wether there are any conflicts with the index structure or the query constraints.

Parameters:
dQuery - -
Throws:
IndexException - -

doQuery

public LuceneSearchResult doQuery(IQueryExpression dQE)
                           throws IndexException
Throws:
IndexException

doQuery

public LuceneSearchResult doQuery(DQuery dQuery)
                           throws IndexException
Performs a search for a fully complex query expression.

Parameters:
dQuery - -
Returns:
LuceneSearchResult
Throws:
IndexException - -

setLiteralValue

protected abstract void setLiteralValue(Literal literal,
                                        int fieldNo,
                                        java.lang.String value)
                                 throws IndexException
Set the value of the given literal using the appropriate type method.

Parameters:
literal - the literal to set the value
fieldNo - the fieldNo
value - the string value
Throws:
IndexException - if any error occurs

addHighlightAnnotation

protected abstract void addHighlightAnnotation(IQueryExpression dQE,
                                               Record record,
                                               int fieldNo,
                                               java.lang.String attributeName,
                                               java.lang.String indexName)
                                        throws IndexException
Adds a highlighting annotation on the given record and attribute

Parameters:
dQE - the IQueryExpression
record - the Record
fieldNo - the fieldNo
attributeName - the name of the attribute
indexName - the name of the index
Throws:
IndexException - if any errorr occurs

doTestQuery

public LuceneSearchResult doTestQuery(java.lang.String text)
                               throws IndexException
Execute test query.

Parameters:
text - Query text.
Returns:
Result.
Throws:
IndexException - Unable to perform test query.

SMILA (incubation) API documentation