Class searchengine_search

Description

The SearchEngine search class

This class inherits the functionality of the generic 'search' class. It extends it to implement a SearchEngine search. Use the methods in this class as the mainstay in implementing queries of content from SearchEngine. Most methods, such as match(), matchfield(), matchrange() etc. store the requirement in the class for subsequent building using the set_*() methods of the SearchEngine classes to set the relevant fields. This is only done when you call execute(), and the query is built from all the composite terms you have added via match() et al.

Located in /search-query-defs.php (line 48)

search
   |
   --searchengine_connection
      |
      --searchengine_msg
         |
         --searchengine_message
            |
            --searchengine_querymsg
               |
               --searchengine_search
Method Summary
 searchengine_search searchengine_search ([string $application = "?"], [string $host = ""], [string $port = ""])
 void does_not_matchfield (string $fieldname, string $fieldvalue, [string $id = ""], [numeric $boost = ""])
 void execute ([integer $timeoutsecs = ""])
 void match (string $term, [integer $op = "OR"], [string $id = ""], [numeric $boost = ""])
 void matchfield (string $fieldname, mixed $fieldvalue, [string $op = "OR"], [string $id = ""], [numeric $boost = ""])
 void matchrange (string $fromvalue, string $tovalue, string $fieldname)
 void may_matchfield (string $fieldname, string $fieldvalue, [string $id = ""], [numeric $boost = ""])
 void must_matchfield (string $fieldname, string $fieldvalue, [string $id = ""], [numeric $boost = ""])
 void rawquery (string $raw_query_text)
Variables
Methods
Constructor searchengine_search (line 57)

Constructor

Create a new SearchEngine search

searchengine_search searchengine_search ([string $application = "?"], [string $host = ""], [string $port = ""])
  • string $application: Application name/domain name for searching in
  • string $host: Hostname or IP of SearchEngine server
  • string $port: Port of SearchEngine server
does_not_matchfield (line 185)

Add search term: must not match a field value.

This is used to add a search term which defines the value that a given field must not contain for the search to succeed.

void does_not_matchfield (string $fieldname, string $fieldvalue, [string $id = ""], [numeric $boost = ""])
  • string $fieldname: Name of field
  • string $fieldvalue: Value of field to match
  • string $id: Optional identity tag for this term
  • numeric $boost: Boost factor. Can be a fraction eg. 0.2, or integer 1,2,3..
execute (line 208)

Execute the search Here we execute a SearchEngine search, overriding the method in the parent class. This involves building the query string, sending it to the SearchEngine server, and receiving the search results back.

void execute ([integer $timeoutsecs = ""])
  • integer $timeoutsecs: Override for timeout in seconds
match (line 76)

Add a new search term to match. Search terms can be a single word or compound patterns, Each time one of these is added, it has an operator associated with it - whether this term is a "may have" (OR), or a "must have" (AND) term.

NB: This method overrides the parent method in order to ensure that all boolean logic terms are in upper case as SearchEngine requires.

void match (string $term, [integer $op = "OR"], [string $id = ""], [numeric $boost = ""])
  • string $term: Search term text to match.
  • integer $op: Joining operator: 'AND', 'OR', 'NOT, 'AND NOT'.
  • string $id: An optional ID to associate with this search term.
  • numeric $boost: Boost factor. Can be a fraction eg. 0.2, or integer 1,2,3..

Redefinition of:
search::match()
Add a new search term to match. Search terms can be a single word or compound patterns, Each time one of these is added, it has an operator associated with it - whether this term is a "may have" (OR), or a "must have" (AND) term.
matchfield (line 97)

Add search term to match a field value.

This is used to add a search term which defines the value that a given field may or may not contain for the search to succeed. For adding terms which are 'free' (as a user might type into a search box for example) then you can use the match() method which this class inherits from the search class.

void matchfield (string $fieldname, mixed $fieldvalue, [string $op = "OR"], [string $id = ""], [numeric $boost = ""])
  • string $fieldname: Name of field to reference in the index
  • mixed $fieldvalue: Value or array of values, for field to match
  • string $op: Operator to join this term to others in the query
  • string $id: Optional identity tag for this term
  • numeric $boost: Boost factor. Can be a fraction eg. 0.2, or integer 1,2,3..
matchrange (line 144)

Add search term to match a field value range.

This is used to add a search term which defines the range of values that a given field may or may not contain for the search to succeed. NB: This method is always a must match (implied AND) search term. In other words the search is always restricted/refined by it.

void matchrange (string $fromvalue, string $tovalue, string $fieldname)
  • string $fromvalue: Lower range value of field to match
  • string $tovalue: Upper range value of field to match
  • string $fieldname: Name of field, defaulted to 'Text'
may_matchfield (line 172)

Add search term: may match a field value.

This is used to add a search term which defines the value that a given field may contain for the search to succeed.

void may_matchfield (string $fieldname, string $fieldvalue, [string $id = ""], [numeric $boost = ""])
  • string $fieldname: Name of field
  • string $fieldvalue: Value of field to match
  • string $id: Optional identity tag for this term
  • numeric $boost: Boost factor. Can be a fraction eg. 0.2, or integer 1,2,3..
must_matchfield (line 159)

Add search term: must match a field value.

This is used to add a search term which defines the value that a given field must contain for the search to succeed.

void must_matchfield (string $fieldname, string $fieldvalue, [string $id = ""], [numeric $boost = ""])
  • string $fieldname: Name of field
  • string $fieldvalue: Value of field to match
  • string $id: Optional identity tag for this term
  • numeric $boost: Boost factor. Can be a fraction eg. 0.2, or integer 1,2,3..
rawquery (line 197)

Define the query text directly, without recourse to any of this class's

high-level query-building methods. This method simply assigns the class variable 'query' to what is passed, assuming that this string is a ready-built query string that the underlying SearchEngine will be able to understand and execute.

void rawquery (string $raw_query_text)
  • string $raw_query_text: The ready-built query string to use

Inherited Methods

Inherited From searchengine_querymsg

 searchengine_querymsg::searchengine_querymsg()
 searchengine_querymsg::send()
 searchengine_querymsg::set_query()

Inherited From searchengine_message

 searchengine_message::searchengine_message()
 searchengine_message::define_field()
 searchengine_message::set_first()
 searchengine_message::set_limit()
 searchengine_message::set_range()
 searchengine_message::set_returnfields()
 searchengine_message::set_sortorder()
 searchengine_message::set_stopwords()

Inherited From searchengine_msg

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

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