Class searchengine_msg

Description

The SearchEngine msg class. This is a raw class which holds the basic message fields and data and knows how to build them into a full message for sending to the SearchEngine server.

Located in /search-lucene-defs.php (line 413)

search
   |
   --searchengine_connection
      |
      --searchengine_msg
Direct descendents
Class Description
 class searchengine_message The SearchEngine message class. This class extends its parent class searchengine_msg and adds some higher level methods for adding groups of fields to the message.
Variable Summary
 mixed $built
 mixed $error_msg
 mixed $fieldset
 mixed $type
 mixed $xmltags
Method Summary
 searchengine_msg searchengine_msg ([string $type = ""], [string $application = "?"], [string $host = ""], [string $port = ""])
 void add_field (string $fieldname, [string $fieldvalue = ""])
 void add_xmltag (object $tag, [string $mode = "append"])
 void clear ()
 boolean send ([integer $timeoutsecs = ""])
 void set_application (string $application)
 void set_domain (string $domain)
Variables
mixed $built = false (line 427)

True if message has been built

mixed $error_msg = "" (line 430)

Error message if any error occurred

mixed $fieldset (line 424)

Object containing SearchEngine fields

mixed $type = "" (line 416)

Type/name of this message

mixed $xmltags = array() (line 421)

Array containing XML tags

Inherited Variables

Inherited from searchengine_connection

searchengine_connection::$connected
searchengine_connection::$enabled
searchengine_connection::$host
searchengine_connection::$message
searchengine_connection::$port
searchengine_connection::$responsebuf
searchengine_connection::$sockfp
searchengine_connection::$timeoutsecs
searchengine_connection::$timer

Inherited from search

search::$date_end
search::$date_fieldname
search::$date_start
search::$executed
search::$hit
search::$max_results
search::$query
search::$searchterm
search::$skip_results
search::$title
Methods
Constructor searchengine_msg (line 444)

Constructor

Notes: The application is either specified in the formal paramters or it can be determined for an Axyl application by using the APP_PREFIX which is unique to the application. This is the recommended option. Other developers have, however, also used the configvalue 'SearchEngine Application' for some reason, so this is still supported here. If none of these methods results in a valid identifier, 'default' is used.

searchengine_msg searchengine_msg ([string $type = ""], [string $application = "?"], [string $host = ""], [string $port = ""])
  • string $type: Type of message this is, eg; QUERY, INDEX..
  • string $application: The application name. Sets default SearchEngine config.
  • string $host: Hostname or IP of SearchEngine server
  • string $port: Port of SearchEngine server
add_field (line 548)

Add a field to the fieldset.

void add_field (string $fieldname, [string $fieldvalue = ""])
  • string $fieldname: Name of the field
  • string $fieldvalue: Value to associate with this field
add_xmltag (line 481)

Add a new XML tag object to this SearchEngine message. We usually just

append the tag to an array of tags, which is produced for the message, however the $mode option allows us to replace an existing tag previously added, by tag name. Eg. this could be used to re-assign the 'application' tag, since there should only ever be one of those. This mode will only ever replace the first occurence, not multiple.

void add_xmltag (object $tag, [string $mode = "append"])
  • object $tag: The xmltag object to add to our SearchEngine msg
  • string $mode: If "replace": replace existing, "append": append tag
clear (line 554)

Clear all data/fields, leaving type definition alone.

void clear ()
send (line 594)

Sends the current message to SearchEngine, and checks for protocol errors in the received response.

  • return: True if the send operation was a success
boolean send ([integer $timeoutsecs = ""])
  • integer $timeoutsecs: Override for timeout in seconds

Redefinition of:
searchengine_connection::send()
Sends a message to the SearchEngine server, and receives the response. We operate on the understanding that every time we send something to SearchEngine we expect a response. Since this method already calls the recieve() method, there is no need to call it from your application.

Redefined in descendants as:
  • searchengine_querymsg::send() : Send the message to SearchEngine, and then post-process the response for
  • searchengine_indexmsg::send() : Send the message to SearchEngine, and then post-process the response for indication of a successful index operation. We expect to receive a response back from SearchEngine which has our serialno in it. This method returns True if the indexing was successful, else False.
  • searchengine_unindexmsg::send() : Send the message to SearchEngine, and then post-process the response for indication of a successful index operation.
  • searchengine_utilitymsg::send() : Send the message to SearchEngine, and then post-process the response for indication of a successful utility operation. We expect to receive a response back from SearchEngine which has nothing much it, unless there has been an error.
set_application (line 523)

Specify the application. The application is the name of a configuration

set which has been specified either by a control message, or by using configuration files on the server. A given configuration set identified by an application name can have specific fields already defined, such as Sort: or Domain: etc. Notes: The 'Application' header can only appear once in the message. To this end we call 'add_xmltag' in "replace" mode, so this method can in fact be called multiple times, and only one application tag will be present in the final message.

void set_application (string $application)
  • string $application: The application name to set.
set_domain (line 540)

Specify a domain. A domain is an identifier which groups indexed objects internally to SearchEngine. This allows searches on multiple archives of documents in a single SearchEngine installation.

Notes: There may be zero or more domain headers in the message. If it does not appear, then any domain header defined for the application will be applied on its own. Otherwise any definitions added by this method are OR'd with any specified in the application config. NB: If no domains are specified anywhere, any searching will be done across all domains (which would probably yield very confusing return data!).

void set_domain (string $domain)
  • string $domain: The domain to set.

Inherited Methods

Inherited From searchengine_connection

 searchengine_connection::searchengine_connection()
 searchengine_connection::send()
 searchengine_connection::set_host_and_port()
 searchengine_connection::set_timeout()

Inherited From search

 search::search()
 search::clear_daterange()
 search::clear_search()
 search::does_not_match()
 search::has_daterange()
 search::hitcount()
 search::initialise()
 search::match()
 search::may_match()
 search::must_match()
 search::reset_search()
 search::set_daterange()
 search::set_maxresults()
 search::set_skipresults()
 search::termcount()

Documentation generated by phpDocumentor 1.3.0RC3