abstract - generate an abstract from text


<abstract $text [$maxsz [$style [$query]]]>

The abstract function generates an abstract of a given portion of text. The abstract will be less than $maxsz characters long, and will attempt to end at a word boundary. If $maxsz is not specified (or is less than or equal to 0) then a default size of 230 characters is used.

The $style argument allows a choice between several different ways of creating the abstract. Note that some of these styles require the $query argument as well, which is a Metamorph query to look for:

  • dumb (0) Start the abstract at the top of the document.

  • smart (1) This style will look for the first meaningful chunk of text, skipping over any headers at the top of the text. This is the default if neither $style nor $query is given.

  • querysingle (2) Center the abstract contiguously on the best occurence of $query in the document.

  • querymultiple (3) Like querysingle, but also break up the abstract into multiple sections (separated with "...") if needed to help ensure all terms are visible. Also take care with URLs to try to show the start and end.

  • querybest An alias for the best available query-based style; currently the same as querymultiple. Using querybest in a script ensures that if improved styles become available in future Vortex releases, the script will automatically "upgrade" to the best style.

If no $query is given with a query... mode, it falls back to dumb mode. If a $query is given with a non-query... mode (dumb/smart), the mode is promoted to querybest. The current locale and index expressions also have an effect on the abstract in the query... modes, so that it more closely reflects an index-obtained hit.

If there are fewer values of $maxsz or $style than $text, the last value(s) are re-used.

abstract returns an abstract for each of the supplied texts.


<LOOP $docid $fulltext>
  <A HREF=$url/fulldoc.html>View full-text</A> <P>
  <abstract $fulltext 230 querybest $query>

The abstract function was added Oct. 24 1996.

The querymultiple and querybest styles were added in Version 6.

Copyright © Thunderstone Software     Last updated: Oct 24 2023
Copyright © 2024 Thunderstone Software LLC. All rights reserved.