Class lucene_connection

Description

The lucene connection class

This class inherits the functionality of the 'search' class since mostly that is what we will be connecting to Lucene for. The Indexing and Control descendants can just ignore this inherited basic searching functionality. This class knows how to connect to a Lucene server and send and receive messages to/from it. Child classes which need to talk to this server to do indexing or querying should inherit this class.

Located in /lucene-defs.php (line 86)

search
   |
   --lucene_connection
Direct descendents
Class Description
 class lucene_msg The lucene 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 lucene server.
Variable Summary
 mixed $connected
 mixed $enabled
 mixed $host
 mixed $message
 mixed $port
 mixed $responsebuf
 mixed $sockfp
 mixed $timeoutsecs
 mixed $timer
Method Summary
 lucene_connection lucene_connection ([string $host = ""], [string $port = ""], [integer $timeoutsecs = ""])
 boolean send ([integer $timeoutsecs = ""])
 void set_timeout (integer $timeoutsecs)
Variables
mixed $connected = false (line 110)

True if we are connected to socket

mixed $enabled = true (line 98)

Whether Lucene is enabled..

mixed $host = "" (line 89)

HOST running the Lucene query server

mixed $message = "" (line 101)

The message waiting to be sent

mixed $port = "" (line 91)

PORT that the server is listening on

mixed $responsebuf = "" (line 104)

Raw response content we receive back from the Lucene server

mixed $sockfp = false (line 107)

Socket file pointer

mixed $timeoutsecs = 10 (line 93)

Timeout for send in seconds

mixed $timer (line 113)

An execution timer

Inherited Variables

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 lucene_connection (line 120)

Constructor - Lucene connection

lucene_connection lucene_connection ([string $host = ""], [string $port = ""], [integer $timeoutsecs = ""])
  • string $host: Hostname or IP of Lucene server
  • string $port: Port of Lucene server
  • integer $timeoutsecs: Seconds to timeout the connection
send (line 213)

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

The content to be sent is expected to be already in the class string variable $message. The response is put into $response which is an array of LF-delimited lines sent back.

  • return: True if the message was sent ok
boolean send ([integer $timeoutsecs = ""])
  • integer $timeoutsecs: Override for timeout in seconds

Redefined in descendants as:
  • lucene_msg::send() : Sends the current message to Lucene, and checks for protocol errors in the received response.
  • lucene_querymsg::send() : Send the message to Lucene, and then post-process the response for
  • lucene_indexmsg::send() : Send the message to Lucene, and then post-process the response for indication of a successful index operation. We expect to receive a response back from Lucene which has our serialno in it. This method returns True if the indexing was successful, else False.
  • lucene_utilitymsg::send() : Send the message to Lucene, and then post-process the response for indication of a successful utility operation. We expect to receive a response back from Lucene which has nothing much it, unless there has been an error.
set_timeout (line 192)

Set the socket timeout. Deals with the special case of setting the socket to non-blocking mode (zero timeout)..

void set_timeout (integer $timeoutsecs)
  • integer $timeoutsecs: Set the timeout in seconds

Inherited Methods

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