# SwishCtl - SWISH-E ActiveX API

void swishctl.Init(str regkey)
  `swishctl.Init("IndexFiles")`

  `regkey` specifies a string value under the "HKLM\Software\SWISH-E Team\SwishCtl\Options" key which is a space separated list of filenames. Example: "IndexFiles" = "docs.idx help.idx"

  `regkey` is relative to the directory specified in "HKLM\Software\SWISH-E Team\SwishCtl\Options\IndexLocation" string value. Example: "IndexLocation" = "c:\swishctl\"

var swishctl.NewSearch( str query )
  `var res = swishctl.NewSearch( "test" )`

  `query` is equivalent to swish-e's -w command line option. It is the full text of your query. It can be changed later through swishctl.Execute.

void swishctl.SetSort( str sort )
  `swishctl.SetSort("swishdocpath")`
  `swishctl.SetSort("asc swishdocpath")`
  `swishctl.SetSort("desc swishdocpath")`

  `sort` order of search results. The string is a space separated list of valid document properties. Each property may contain a qualifier that sets the direction of the sort.

str swishctl.Error()
  `alert( swishctl.Error() )`

  returns the text of the last SWISH-E error that occured; returns 0 if no errors.

void swishctl.SetSearchLimit( str property, str low, str high )
  `swishctl.SetSearchLimit( "year", startyr, stopyr )`

  Sets a range from `low` to `high` inclusive that the given `property` must be in to be selected as a result. Call multiple times to set more than one limit on different properties. Limits are ANDed, that is, a result must be within the range of all limits specified to be included in a list of results.

void swishctl.Execute( str query )
  `swishctl.Execute( "some words" )`

  Executes a query based on the parameters in the search object.`query` is an optional query string to use for the search (`query` replaces the set query string in the search object).

int swishctl.Hits()

  Returns the number of results for the query. If zero and no errors were reported after calling swishctl.Execute then the query returned zero results.

void swishctl.SeekResult( int position )
  `swishctl.SeekResult( startresult - 1 )`

  Seeks to the `position` specified in the result list. Zero is the first position and swishctl.Hits-1 is the last position. Seeking past the end of results sets a non-critical error condition.

int swishctl.NextResult()

  Fetches the next result from the list of results. Returns 0 if no more results are available.

str swishctl.ResultPropertyString( str property )
  `swishctl.ResultPropertyString( "swishdocpath" )`

  Fetches the `property` specified for the current result.