OpenWGA 7.6 - TMLScript reference

Lucene
Property :

bestFileFragments(fragmentSize, maxFragments, [String prefix, [String suffix, [String encode])]]

On object Lucene
Usage Returns those parts of a files contents that matched a lucene search
Description

The method provides an advanced feature of lucene result highlighting which automatically provides those fragments of a file attachments content that matched the lucene query. The fragments are returned in descending order of relevance. Note that this only is available on lucene query querying doctype "attachment" or "all" and when a content document was really returned by that query with metadata field SEARCHDOCTYPE being "attachment".

Unlike with method bestFragments() you do not need to choose which file to pick the fragments from as a file attachment match in lucene is always only matching one file which is chosen automatically.

You must have activated the highlighting feature on the lucene search via attribute highlight. The fragments of the last lucene search stays available until another lucene search is performed under the same user session.

Parameters fragmentSize (Number): Desired number of characters in the fragments

maxFragments (Number):
Maximum number of fragments to return.

prefix (String, optional): 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 (String, optional): 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 (String, optional): A WebTML encoding to encode the fragments before output. Accepts the encodings also available to WebTML attribute encode
Return value List of text fragments (String)
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events