public class Lucene extends Object
Context
may be given which provides the necessary context for operations that refer to previously ran queries and a context document, like bestFragments(String, int, int)
, highlightItem(String, String, String, String)
and highlightMeta(String, String, String)
.Modifier and Type | Class and Description |
---|---|
class |
Lucene.FieldIndexType
This object represents a specific field configuration for the Lucene fulltext index, like it is specified on the Lucene configuration for individual OpenWGA applications.
|
class |
Lucene.FileIndexType
This object represents a specific file configuration for the Lucene fulltext index, like it is specified on the Lucene configuration for individual OpenWGA applications.
|
Modifier and Type | Method and Description |
---|---|
List<String> |
bestFileFragments(int fragmentSize,
int maxFragments) |
List<String> |
bestFileFragments(int fragmentSize,
int maxFragments,
String prefix,
String suffix) |
List<String> |
bestFileFragments(int fragmentSize,
int maxFragments,
String prefix,
String suffix,
String encode) |
List |
bestFragments(String itemname,
int fragmentSize,
int maxFragments)
Returns those parts of an items value that matched a lucene search
The method provides an advanced feature of lucene result highlighting which automatically provides those fragments of an items content that matched the lucene query.
|
List |
bestFragments(String itemname,
int fragmentSize,
int maxFragments,
String prefix,
String suffix)
Returns those parts of an items value that matched a lucene search
The method provides an advanced feature of lucene result highlighting which automatically provides those fragments of an items content that matched the lucene query.
|
List |
bestFragments(String itemname,
int fragmentSize,
int maxFragments,
String prefix,
String suffix,
String encode)
Returns those parts of an items value that matched a lucene search
The method provides an advanced feature of lucene result highlighting which automatically provides those fragments of an items content that matched the lucene query.
|
Lucene.FieldIndexType |
getFieldIndexType(String fieldName)
Returns the FieldIndexType for a specific field name
Use this method to find out about the lucene index configuration for a specific item name.
|
Lucene.FileIndexType |
getFileIndexType(String fileName)
Returns the FileIndexType for a specific file name
Use this method to find out about the lucene index configuration for a specific file attachment name.
|
String |
highlightItem(String name,
String prefix,
String suffix)
Returns an item of the current context document, highlighting found terms of the last lucene search
This puts out items of a lucene search result while highlighting the found terms.
|
String |
highlightItem(String name,
String prefix,
String suffix,
String encode)
Returns an item of the current context document, highlighting found terms of the last lucene search
This puts out items of a lucene search result while highlighting the found terms.
|
List |
highlightMeta(String name,
String prefix,
String suffix)
Returns a metadata field of the current context document, highlighting found terms of the last lucene search
This puts out metadata fields of a lucene search result while highlighting the found terms.
|
List |
highlightMeta(String name,
String prefix,
String suffix,
String encode)
Returns a metadata field of the current context document, highlighting found terms of the last lucene search
This puts out metadata fields of a lucene search result while highlighting the found terms.
|
void |
removeQuery()
Removes the data of the last lucene query with activated result highlighting from the users session
The lucene functionality around highlighting consumes some memory on the users session as the data of found terms need to be preserved while highlighting should be possible.
|
de.innovationgate.webgate.api.WGResultSet |
search(String phrase)
Deprecated.
Use
Database.query(String, String) and variants instead |
de.innovationgate.webgate.api.WGResultSet |
search(String phrase,
String scope)
Deprecated.
Use
Database.query(String, String) and variants instead |
de.innovationgate.webgate.api.WGResultSet |
search(String phrase,
String scope,
Map params)
Deprecated.
Use
Database.query(String, String) and variants instead |
void |
updateIndex()
Runs the lucene index updater immediately which will process all currently pending indexing request.
|
public de.innovationgate.webgate.api.WGResultSet search(String phrase) throws de.innovationgate.webgate.api.WGException
Database.query(String, String)
and variants insteadphrase
- Search phrasede.innovationgate.webgate.api.WGQueryException
de.innovationgate.webgate.api.WGException
public de.innovationgate.webgate.api.WGResultSet search(String phrase, String scope) throws de.innovationgate.webgate.api.WGException
Database.query(String, String)
and variants insteadphrase
- Search phrasescope
- Either "db" for the current context application, "domain" for all apps in the same domain or "wga" for all appsde.innovationgate.webgate.api.WGQueryException
de.innovationgate.webgate.api.WGException
public de.innovationgate.webgate.api.WGResultSet search(String phrase, String scope, Map params) throws de.innovationgate.webgate.api.WGException
Database.query(String, String)
and variants insteadphrase
- Search phrasescope
- Either "db" for the current context application, "domain" for all apps in the same domain or "wga" for all appsparams
- Additional parameters for the queryde.innovationgate.webgate.api.WGQueryException
de.innovationgate.webgate.api.WGException
public void removeQuery() throws de.innovationgate.webgate.api.WGException
de.innovationgate.webgate.api.WGException
public List bestFragments(String itemname, int fragmentSize, int maxFragments) throws de.innovationgate.webgate.api.WGException
itemname
- Name of the item on the current context document whose fragments are retrievedfragmentSize
- Desired number of characters in the fragmentsmaxFragments
- Maximum number of fragments to return.de.innovationgate.webgate.api.WGAPIException
de.innovationgate.webgate.api.WGException
public List bestFragments(String itemname, int fragmentSize, int maxFragments, String prefix, String suffix) throws de.innovationgate.webgate.api.WGException
itemname
- Name of the item on the current context document whose fragments are retrievedfragmentSize
- Desired number of characters in the fragmentsmaxFragments
- Maximum number of fragments to return.prefix
- Prefix text to put out before each found search phrase in the fragmentssuffix
- Suffix text to put out after each found search phrase in the fragmentsde.innovationgate.webgate.api.WGAPIException
de.innovationgate.webgate.api.WGException
public List bestFragments(String itemname, int fragmentSize, int maxFragments, String prefix, String suffix, String encode) throws de.innovationgate.webgate.api.WGException
itemname
- Name of the item on the current context document whose fragments are retrievedfragmentSize
- Desired number of characters in the fragmentsmaxFragments
- Maximum number of fragments to return.prefix
- Prefix HTML code that is put out before each term in a fragment that was matched by the lucene query, meant to highlight those terms.suffix
- Suffix HTML code that is put out after each term in a fragment that was matched by the lucene query, meant to close tags that were opened in the prefix.encode
- A WebTML encoding to encode the fragments before output. Accepts the encodings also available to WebTML attribute encodede.innovationgate.webgate.api.WGAPIException
de.innovationgate.webgate.api.WGException
public String highlightItem(String name, String prefix, String suffix) throws de.innovationgate.webgate.api.WGException
name
- Name of the item to returnprefix
- HTML code that is added before each found lucene termsuffix
- HTML code that is added after each found lucene termde.innovationgate.webgate.api.WGAPIException
de.innovationgate.webgate.api.WGException
public String highlightItem(String name, String prefix, String suffix, String encode) throws de.innovationgate.webgate.api.WGException
name
- Name of the item to returnprefix
- HTML code that is added before each found lucene termsuffix
- HTML code that is added after each found lucene termencode
- A WebTML encoding in which the item text is encoded before the prefix and suffixes are applied. Accepts alle encodings that are available to the OpenWGA runtimede.innovationgate.webgate.api.WGAPIException
de.innovationgate.webgate.api.WGException
public List highlightMeta(String name, String prefix, String suffix) throws de.innovationgate.webgate.api.WGException
name
- Name of the metadata field to returnprefix
- HTML code that is added before each found lucene termsuffix
- HTML code that is added after each found lucene termde.innovationgate.webgate.api.WGAPIException
de.innovationgate.webgate.api.WGException
public List highlightMeta(String name, String prefix, String suffix, String encode) throws de.innovationgate.webgate.api.WGException
name
- Name of the metadata field to returnprefix
- HTML code that is added before each found lucene termsuffix
- HTML code that is added after each found lucene termencode
- A WebTML encoding in which the metadata text is encoded before the prefix and suffixes are applied. Accepts alle encodings that are available to the OpenWGA runtimede.innovationgate.webgate.api.WGAPIException
de.innovationgate.webgate.api.WGException
public Lucene.FieldIndexType getFieldIndexType(String fieldName) throws de.innovationgate.webgate.api.WGException
fieldName
- The field namede.innovationgate.webgate.api.WGException
public Lucene.FileIndexType getFileIndexType(String fileName) throws de.innovationgate.webgate.api.WGException
fileName
- The file namede.innovationgate.webgate.api.WGException
public void updateIndex() throws de.innovationgate.webgate.api.WGException, InterruptedException
InterruptedException
de.innovationgate.webgate.api.WGException
public List<String> bestFileFragments(int fragmentSize, int maxFragments) throws de.innovationgate.webgate.api.WGException
de.innovationgate.webgate.api.WGException
public List<String> bestFileFragments(int fragmentSize, int maxFragments, String prefix, String suffix) throws de.innovationgate.webgate.api.WGException
de.innovationgate.webgate.api.WGException