Class lucene_message

Description

The lucene message class. This class extends its parent class lucene_msg and adds some higher level methods for adding groups of fields to the message.

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

search
   |
   --lucene_connection
      |
      --lucene_msg
         |
         --lucene_message
Direct descendents
Class Description
 class lucene_querymsg The lucene query message class. This class inherits all the functionality of the lucene_connection, lucene_msg and lucene_message classes. It adds query-specific methods for searching.
 class lucene_indexmsg The lucene index message class. This class inherits all the functionality of the lucene_connection, lucene_msg and lucene_message classes. It adds indexing-specific methods.
 class lucene_unindexmsg The lucene unindex message class. This class allows you to remove an item from the Lucene index. You must know the unique ID that identifies the document.
 class lucene_purgemsg The lucene purge message class. This class allows you to remove all
 class lucene_utilitymsg The lucene utility message class. Used for special Lucene operations.
Variable Summary
 mixed $response
Method Summary
 lucene_message lucene_message ([string $type = ""], [string $application = "?"], [string $host = ""], [string $port = ""])
 void define_field (string $fieldname, string $type, [boolean $stored = STORED], [boolean $indexed = INDEXED])
 void set_first (integer $first)
 void set_limit (integer $limit)
 void set_range ([string $range_from = ""], [string $range_to = ""], [string $range_fieldname = ""])
 void set_returnfields (mixed $fields)
 void set_sortorder (mixed $fields)
 void set_stopwords (mixed $stopwords)
Variables
Methods
Constructor lucene_message (line 573)

Constructor This is a more complex class which builds on the basic lucene_msg class to provide some higher level methods for adding fields in specific ways to support CONTROL, QUERY and INDEX message types.

lucene_message lucene_message ([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 Lucene config.
  • string $host: Hostname or IP of Lucene server
  • string $port: Port of Lucene server
define_field (line 641)

Define a field. We supply the name of the field, it's type (Text, Date or Id), and whether it should be stored by Lucene for later retreival in queries. For example you would not store the raw document/content as this is usually stored elsewhere.

We also cater for fields which might not need to be indexed. These would be fields of data you just want to return with the document, if found in a query, but not search on. An example might be a field containing the path to the physical document on disk. For these fields you would then specify NOT_INDEXED for the $indexed parameter. These fields MUST be stored, so we make the rule: if the field is NOT_INDEXED then it must be STORED (this will be forced). In the normal course of events, fields will be defined to be both stored and indexed. The exception is the special "Text" field associated with an item "Body", which is indexed, but never stored. This method adds the field settings directly via the add_field() method.

void define_field (string $fieldname, string $type, [boolean $stored = STORED], [boolean $indexed = INDEXED])
  • string $fieldname: Name of the field to index
  • string $type: Type of field data: Text, Date or Id.
  • boolean $stored: If true then Lucene will store the content itself
  • boolean $indexed: If true then Lucene will index the field content
set_first (line 689)

Specify query offset field 'First'. This sets the offset for the returned results. For example, if this was set to 3, and Lucene found 20 hits, then results would be sent back from the 3rd hit onwards.

void set_first (integer $first)
  • integer $first: Offset in result set to start from
set_limit (line 678)

Specify query limit field. This sets the maximum number of results that Lucene should return.

void set_limit (integer $limit)
  • integer $limit: Maximum number of results (hits) to return
set_range (line 735)

Specify a range on a field for querying. We specify the name of a field

which is used to select articles within the given limits, and the limits themeselves. Either limit may be passed as nullstring which indicates no limit on that side. Any dates must be passed as standard Unix timestamps (seconds since 1970). Notes: This method can be called multiple times to define additional ranges for different field names. This method adds the field setting directly via the add_field() method.

void set_range ([string $range_from = ""], [string $range_to = ""], [string $range_fieldname = ""])
  • string $range_from: Value of lowerbound range
  • string $range_to: Value of upperbound range
  • string $range_fieldname: Name of field to use in range query.
set_returnfields (line 658)

Specify the fields you want returned from Lucene.

Fields should be in a comma-separated list of field names. Each field name can have the field type included in the form 'Foo:Date', where 'Date' is the type in this instance. In fact, since 'Text' is the default filed type, 'Date' is probably the only one you need to use as the current implementation stands. This method adds the field setting directly via the add_field() method.

void set_returnfields (mixed $fields)
  • mixed $fields: Comma-delimited fieldname list, or array of fields
set_sortorder (line 705)

Specify the fields you want query results to be ordered by.

Fields should be in a comma-separated list of field names. Each field name can have the field type included in the form 'Foo:Date', where 'Date' is the type in this instance. In fact, since 'Text' is the default filed type, 'Date' is probably the only one you need to use as the current implementation stands. Note that sort field specification is a special case, where the syntax can be 'Foo:Date:Desc' or 'Foo:Desc' indicating the sort on the given field should be done in descending order.

void set_sortorder (mixed $fields)
  • mixed $fields: Comma-delimited fieldname list, or array of fields
set_stopwords (line 755)

Supply a stopword list to lucene.

This method adds the field setting directly via the add_field() method.

void set_stopwords (mixed $stopwords)
  • mixed $stopwords: Space-delimited list, or array of stopwords

Inherited Methods

Inherited From lucene_msg

 lucene_msg::lucene_msg()
 lucene_msg::add_field()
 lucene_msg::add_xmltag()
 lucene_msg::clear()
 lucene_msg::send()
 lucene_msg::set_application()
 lucene_msg::set_domain()

Inherited From lucene_connection

 lucene_connection::lucene_connection()
 lucene_connection::send()
 lucene_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