pax_global_header00006660000000000000000000000064137404153710014517gustar00rootroot0000000000000052 comment=d8c74b8c214efcf647b65a99b3ca41ab0a0a68d7 php-solr-2.5.1+2.4.0/000077500000000000000000000000001374041537100137255ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/package-5.xml000066400000000000000000001367571374041537100162270ustar00rootroot00000000000000 solr pecl.php.net The Apache Solr PHP extension is an extremely fast, light-weight, feature-rich library that allows PHP applications to communicate easily and efficiently with Apache Solr server instances using an object-oriented API. It effectively simplifies the process of interacting with Apache Solr using PHP5 and it already comes with built-in readiness for the latest features. The extension has features such as built-in, serializable query string builder objects which effectively simplifies the manipulation of name-value pair request parameters across repeated requests. The response from the Solr server is also automatically parsed into native php objects whose properties can be accessed as array keys or object properties without any additional configuration on the client-side. Its advanced HTTP client reuses the same connection across multiple requests and provides built-in support for connecting to Solr servers secured behind HTTP Authentication or HTTP proxy servers. It is also able to connect to SSL-enabled containers. Please consult the documentation for more details on features. Included in the source code are phpdoc stubs that enable autocomplete of Solr classes and methods in IDE during development in userland. PECL Solr 2+ is only compatible with Apache Solr Server 4.0+ Omar Shaban omars omars@php.net yes 2016-03-30 2.4.0 2.4.0 stable stable PHP License - PHP 7 Support [Request #70696] - Performance Optimizations - Enabled SolrUtils::getSolrStats() - Fix SolrException*::getInternalInfo - Fix SolrQueryResponse::getRequestUrl returns wrong url with terms [Bug #71591] - Fix SolrClient::deleteByIds Segfaults with invalid ids [Bug #71853] - Fix SolrObject::offsetExists SegFault [Bug #71852] - Fix float formatting with decimal comma [Bug #71568] 5.3 1.4.0 libxml solr Omar Shaban omars omars@php.net yes 2.4.0 2.4.0 stable stable 2016-03-30 PHP License - PHP 7 Support [Request #70696] - Performance Optimizations - Enabled SolrUtils::getSolrStats() - Fix SolrException*::getInternalInfo - Fix SolrQueryResponse::getRequestUrl returns wrong url with terms [Bug #71591] - Fix SolrClient::deleteByIds Segfaults with invalid ids [Bug #71853] - Fix SolrObject::offsetExists SegFault [Bug #71852] - Fix float formatting with decimal comma [Bug #71568] Omar Shaban omars omars@php.net yes 2.3.0 2.3.0 stable stable 2015-11-29 PHP License - Support indexing child/nested documents [Request #70739] - Support nested documents parsing SolrObject [Request #70953] - Support nested documents parsing SolrDocument [Request #70974] - Added maxScore to SolrResponse [Request #68610] - Fixed issues on big endean processors (Remi Collet) - Enhancements on method parameter naming (reflections) Omar Shaban omars omars@php.net yes 2.2.1 2.2.1 stable stable 2015-09-27 PHP License - Fix windows build Omar Shaban omars omars@php.net yes 2.2.0 2.2.0 stable stable 2015-09-26 PHP License - Support Real Time Get (Request #68647) - Support Result Grouping (Request #68793) - Support Field Collapsing (Request #70175) - Support Expand Component (Request #70176) - SolrMissingMandatoryParameterException (Request #70301) - Fix SegFault on Solr Server 500 Response with no msg [xml RW] (Bug #69156) - Fix SegFault on non-phpserialized 500 responses from Solr Server with PHPS RW (Bug #69156) - Fix Failed to parse 500 error response when it lacks msg JSON/PHPS RW (Bug #70495, #70496) - Fix compatibility tests with Solr Server 5 (Bug #70333) - Fix Error unserializing raw response on statistics response having NaN as value (Bug #67394) Omar Shaban omars omars@php.net yes 2.1.0 2.1.0 stable stable 2014-01-15 PHP License - New Feature: SolrDisMaxQuery Builder (dismax/edismax) [Feature #67101] - Support PHPS (PHP Serialized) Response Writer [Request #61329] - SolrResponse::getArrayResponse [Feature #67660] - SolrResponse::getResponse() returns SolrObject instead of array (with json response writer) [Bug #67579] - Argument list parameter: Argument to value separator disappears [Bug #68179] - Conflict Occurs When using SolrDisMax::addBoostQuery and setBoostQuery [Bug #68181] - Doc Fix [Doc #67542] - Internals: simple_list parameter type allow custom delimiter - Internals: Allowed zero-length argument value - Internals: Allowed zero-length argument-to-argument-value separator - Security Fix Omar Shaban omars omars@php.net yes 2.0.0 2.0.0 stable stable 2014-06-24 PHP License - Introduced SolrServerException which handles exception responses produced by Solr Server [Feature #67063] - SolrClient::commit $maxSegments removed - Removed php curl extension dependency for static builds [Bug #59028] - SolrParams/SolrModifiableParams/SolrQuery throws SolrIllegalArguments Exception instead of E_ERROR [Feature #66858] - SolrQuery::__construct throws SolrIllegalArgumentException instead of E_ERROR - Dropped Support for phpnative Response Writer - Fix config that always enables solr debug [Bug #60361] Omar Shaban omars omars@php.net yes 1.1.1 1.1.1 stable stable 2014-06-20 PHP License - Fix Windows Build Omar Shaban omars omars@php.net yes 1.1.0 1.1.0 stable stable 2014-06-19 PHP License 1.1.0 Stable - Introduced SolrServerException which handles exception responses produced by Solr Server [Feature #67063] - SolrClient::commit $maxSegments removed - SolrQuery::__construct throws SolrIllegalArgumentException instead of E_ERROR - Removed php curl extension dependency for static builds [Bug #59028] From 1.1.0b - SolrClient::system Access system servlet which fetch Solr Server System Information - SolrClient::commit argument $maxSegments is now DEPRECATED - SolrClient::commit Added support for expungeDeletes on - All SolrClient methods throws SolrClientExceptions instead of E_WARNING + SolrClientException - SolrClientExceptions' messages are more informative in case of connection errors - Added json extension validation - All SolrResponse, SolrQueryResponse, SolrUpdateResponse, SolrPingResponse, SolrGenericResponse, SolrDocument, and SolrInputDocument classes are now final - All parameters functions throws SolrIllegalArgumentException instead of E_RROR - SolrParams/SolrModifiableParams/SolrQuery throws SolrIllegalArguments Exception instead of E_ERROR [Feature #66858] - Various Bug Fixes Omar Shaban omars omars@php.net yes 1.1.0b 1.1.0b beta beta 2014-03-17 PHP License - SolrClient::system Access system servlet which fetch Solr Server System Information - SolrClient::commit argument $maxSegments is now DEPRECATED - SolrClient::commit Added support for expungeDeletes on - All SolrClient methods throws SolrClientExceptions instead of E_WARNING + SolrClientException - SolrClientExceptions' messages are more informative in case of connection errors - Added json extension validation - All SolrResponse, SolrQueryResponse, SolrUpdateResponse, SolrPingResponse, SolrGenericResponse, SolrDocument, and SolrInputDocument classes are now final - All parameters functions throws SolrIllegalArgumentException instead of E_RROR - SolrParams/SolrModifiableParams/SolrQuery throws SolrIllegalArguments Exception instead of E_ERROR (Feature #66858) - Various Bug Fixes Omar Shaban omars omars@php.net yes 2.0.0b 2.0.0b beta beta 2014-02-28 PHP License - Support Solr version 4.0+ - Added support for retreiving Solr Server system information through SolrClient SolrClient::system() - Support for softCommit - Suppport for expungeDeletes - maxSegments for commit is deprecated - Added escape character / as per Solr 4 it is reserved for REGEX - Disabled warnings for connection errors, SolrClientException is thrown - SolrClientException messages for connection errors are more meaningful indicating error messages and codes - API changes for: SolrClient::commit($maxSegments = 0, $softCommit = false, $waitSearcher = true, $expungeDeletes = false) SolrClient::optimize($maxSegments = 1, $softCommit = false, $waitSearcher = true) SolrClient::addDocument(SolrInputDocument &$doc, $overwrite = true, $commitWithin = 0) SolrClient::addDocuments(array &$docs, $overwrite = true, $commitWithin = 0) - Several Bug Fixes Warning: PECL Solr >= 2 is not compatible with Solr Server < 4.0 Israel Ekpo iekpo iekpo@php.net yes 1.0.2 1.0.2 stable stable 2011-11-29 PHP License - Several Bug Fixes by Pierrick, Felipe and Tony - Changes to make the code compile on 5.2.3 and greater - Changes to Tests by Pierrick Israel Ekpo iekpo iekpo@php.net yes 1.0.1 1.0.1 stable stable 2011-06-04 PHP License - Added support for json response writer in SolrClient - Removed final bit from classes so that they can be mocked in unit tests - Changed from beta to stable - Included phpdoc stubs in source to enable autocomplete of Solr classes and methods in IDE during development - Lowered libxml2 version requirement to 2.6.16 Israel Ekpo iekpo iekpo@php.net yes 0.9.11 0.9.11 beta beta 2010-06-22 PHP License - Added ability to specify response writer in constructor option - Added new method to set response writer SolrClient::setResponseWriter() - Currently, the only supported response writers are 'xml' and 'phpnative' - Added support for new native Solr response writer - New response writer is available at https://issues.apache.org/jira/browse/SOLR-1967 Israel Ekpo iekpo iekpo@php.net yes 0.9.10 0.9.10 beta beta 2010-05-04 PHP License - Increased compatibility with older systems running CentOS 4 or 5 and RHEL4 or 5 - Added ability to compile directly without having to build libcurl and libxml2 from source on older systems - Lowered minimum supported version for libcurl to 7.15.0 (Alex Samorukov) - Lowered minimum supported version for libxml2 to 2.6.26 (Alex Samorukov) - Fixed PECL Bug# 17172 MoreLikeThis only parses one doc (trevor at blubolt dot com, max at blubolt dot com) - Declared workaround macros for SSL private key constants due to support for earlier versions of libcurl (Alex Samorukov) - Changed extension version numbers to start using hexadecimal numbers (Israel Ekpo) - Added instructions on how to attempt to compile on windows (Israel Ekpo) - Fixed PECL Bug# 17292 sending UTF-8 encoding in header (giguet at info dot unicaen dot fr) Israel Ekpo iekpo iekpo@php.net yes 0.9.9 0.9.9 beta beta 2010-01-10 PHP License - Fixed Bug #17009 Creating two SolrQuery objects leads to wrong query value - Reset the buffer for the request data from the previous request in SolrClient - Added new internal static function solr_set_initial_curl_handle_options() - Moved the intialization of CURL handle options to solr_set_initial_curl_handle_options() function - Resetting the CURL options on the (CURL *) handle after each request is completed - Added more explicit error message to indicate that cloning SolrParams objects and its descendants is currently not yet supported Israel Ekpo iekpo iekpo@php.net yes 0.9.8 0.9.8 beta beta 2009-12-04 PHP License - Fixed config.w32 for Windows build support (Pierre, Pierrick) - Fixed Bug #16943 Segmentation Fault from solr_encode_string() during attempt to retrieve solrXmlNode->children->content when solrXmlNode->children is NULL (Israel) - Disabled Expect header in libcurl (Israel) - Disabled Memory Debugging when normal debug is enabled (Israel) - Added list of contributors to the project Israel Ekpo iekpo iekpo@php.net yes 0.9.7 0.9.7 beta beta 2009-11-17 PHP License - Fixed bug 16924 AC_MSG_NOTICE() is undefined in autoconf 2.13 - Added new method SolrClient::getDebug() - Modified SolrClient::__construct() so that port numbers and other integer values for the options can be passed as strings. - Changed internal string handling mechanism to allow for tracking of memory allocation in debug mode. - Lowered minimum php version to 5.2.3. Unfortunately, this is the lowest PHP version that will be supported. PHP versions lower than 5.2.3 are not compatible or are causing tests to FAIL. - Added php stubs for code-completion assists in IDEs and editors. - Added more examples Israel Ekpo iekpo iekpo@php.net yes 0.9.6 0.9.6 beta beta 2009-11-01 PHP License Reduced minimum php version to 5.2.4 Israel Ekpo iekpo iekpo@php.net yes 0.9.5 0.9.5 beta beta 2009-10-27 PHP License Added support for secure connections to SSL-enabled Solr servers (SSL/HTTPS). Made connection errors more verbose. The following options where added to the SolrClient constructor : - secure (Boolean value indicating whether or not to connect in secure mode) - timeout (This is maximum time in seconds allowed for the http data transfer operation. Default is 30 seconds) - ssl_cert (File name to a PEM-formatted file containing the private key + private certificate (concatenated in that order) ) - ssl_key (File name to a PEM-formatted private key file only) - ssl_keypassword (Password for private key) - ssl_cainfo (Name of file holding one or more CA certificates to verify peer with) - ssl_capath (Name of directory holding multiple CA certificates to verify peer with ) Israel Ekpo iekpo iekpo@php.net yes 0.9.4 0.9.4 beta beta 2009-10-23 PHP License Fixed bug 16897 - ap_php_vasprintf not available in 5.2.11 Israel Ekpo iekpo iekpo@php.net yes 0.9.3 0.9.3 beta beta 2009-10-19 PHP License - Corrected configuration options for automated installation via PECL. Removed extra hyphens. Israel Ekpo iekpo iekpo@php.net yes 0.9.2 0.9.2 beta beta 2009-10-19 PHP License - Fixed bug #16874 Added explanation in documentation - Updated SolrParams::__toString() - modified to return name-value pair list instead of serialized object string - Added the following methods to SolrParams : SolrParams::toString() SolrParams::getParam() - Created the following aliases in SolrParams : SolrParams::set() SolrParams::add() SolrParams::get() - Added the following methods to SolrQuery : SolrQuery::getQuery() SolrQuery::getStart() SolrQuery::getRows() SolrQuery::getFields() SolrQuery::getSortFields() SolrQuery::getFilterQueries() SolrQuery::getTimeAllowed() SolrQuery::getFacet() SolrQuery::getFacetFields() SolrQuery::getFacetQueries() SolrQuery::getFacetPrefix() SolrQuery::getFacetSort() SolrQuery::getFacetLimit() SolrQuery::getFacetOffset() SolrQuery::getFacetMinCount() SolrQuery::getFacetMissing() SolrQuery::getFacetMethod() SolrQuery::getFacetDateFields() SolrQuery::getFacetDateStart() SolrQuery::getFacetDateEnd() SolrQuery::getFacetDateGap() SolrQuery::getFacetDateHardEnd() SolrQuery::getFacetDateOther() SolrQuery::getHighlight() SolrQuery::getHighlightFields() SolrQuery::getHighlightSnippets() SolrQuery::getHighlightFragsize() SolrQuery::getHighlightMergeContiguous() SolrQuery::getHighlightRequireFieldMatch() SolrQuery::getHighlightMaxAnalyzedChars() SolrQuery::getHighlightAlternateField() SolrQuery::getHighlightMaxAlternateFieldLength() SolrQuery::getHighlightFormatter() SolrQuery::getHighlightSimplePre() SolrQuery::getHighlightSimplePost() SolrQuery::getHighlightFragmenter() SolrQuery::getHighlightUsePhraseHighlighter() SolrQuery::getHighlightHighlightMultiTerm() SolrQuery::getHighlightRegexSlop() SolrQuery::getHighlightRegexPattern() SolrQuery::getHighlightRegexMaxAnalyzedChars() SolrQuery::getStats() SolrQuery::getStatsFields() SolrQuery::getStatsFacets() SolrQuery::getMlt() SolrQuery::getMltCount() SolrQuery::getMltFields() SolrQuery::getMltQueryFields() SolrQuery::getMltMinTermFrequency() SolrQuery::getMltMinDocFrequency() SolrQuery::getMltMinWordLength() SolrQuery::getMltMaxWordLength() SolrQuery::getMltMaxNumTokens() SolrQuery::getMltMaxNumQueryTerms() SolrQuery::getMltBoost() SolrQuery::getTerms() SolrQuery::getTermsField() SolrQuery::getTermsLowerBound() SolrQuery::getTermsUpperBound() SolrQuery::getTermsIncludeLowerBound() SolrQuery::getTermsIncludeUpperBound() SolrQuery::getTermsMinCount() SolrQuery::getTermsMaxCount() SolrQuery::getTermsPrefix() SolrQuery::getTermsLimit() SolrQuery::getTermsReturnRaw() SolrQuery::getTermsSort() Israel Ekpo iekpo iekpo@php.net yes 0.9.1 0.9.1 beta beta 2009-10-07 PHP License - Fixed bug #16864 (Build failure in Non-ZTS builds) Israel Ekpo iekpo iekpo@php.net yes 0.9.0 0.9.0 beta beta 2009-10-05 PHP License - Initial release after approximately 10 months of development and 3 weeks of testing. This is the beta version. Some of the features may be modified in future releases. php-solr-2.5.1+2.4.0/package.xml000066400000000000000000001531311374041537100160460ustar00rootroot00000000000000 solr pecl.php.net The Apache Solr PHP extension is an extremely fast, light-weight, feature-rich library that allows PHP applications to communicate easily and efficiently with Apache Solr server instances using an object-oriented API. It effectively simplifies the process of interacting with Apache Solr using PHP. The extension has features such as built-in, serializable query string builder objects which effectively simplifies the manipulation of name-value pair request parameters across repeated requests. The response from the Solr server is also automatically parsed into native php objects whose properties can be accessed as array keys or object properties without any additional configuration on the client-side. Its advanced HTTP client reuses the same connection across multiple requests and provides built-in support for connecting to Solr servers secured behind HTTP Authentication or HTTP proxy servers. It is also able to connect to SSL-enabled containers. Please consult the documentation for more details on features. Included in the source code are phpdoc stubs that enable autocomplete of Solr classes and methods in IDE during development in userland. Please consider staring the package on github, and get a free release ;) https://github.com/php/pecl-search_engine-solr Omar Shaban omars omars@php.net yes 2020-09-09 2.5.1 2.5.1 stable stable PHP License - PHP 7.4 compatible - PHP 7 windows support - PHP 8.0.0beta3 compatible - Bug #72740 Fixes NULL byte when using addQueryField() w/o boost 7.0 1.4.0 libxml solr Omar Shaban omars omars@php.net yes 2.5.1 2.5.1 stable stable 2020-09-09 PHP License - PHP 7.4 compatible - PHP 7 windows support - PHP 8.0.0beta3 compatible - Bug #72740 Fixes NULL byte when using addQueryField() w/o boost Omar Shaban omars omars@php.net yes 2.5.0 2.5.0 stable stable 2019-07-04 PHP License - Atomic Updates (partials) - Simple Optimistic Concurrency - Compatibility with PHP 7.1, 7.2, 7.3, latest 7.4 - Enable gzip encoding if server supports it - Fix Real Time Get requests fails if it wasn't the first request - Fix addQueryField return wrong query - Fix Solr Extension build fail with curl 7.19+ Omar Shaban omars omars@php.net yes 2.4.0 2.4.0 stable stable 2016-03-30 PHP License - PHP 7 Support [Request #70696] - Performance Optimizations - Enabled SolrUtils::getSolrStats() - Fix SolrException*::getInternalInfo - Fix SolrQueryResponse::getRequestUrl returns wrong url with terms [Bug #71591] - Fix SolrClient::deleteByIds Segfaults with invalid ids [Bug #71853] - Fix SolrObject::offsetExists SegFault [Bug #71852] - Fix float formatting with decimal comma [Bug #71568] Omar Shaban omars omars@php.net yes 2.3.0 2.3.0 stable stable 2015-11-29 PHP License - Support indexing child/nested documents [Request #70739] - Support nested documents parsing SolrObject [Request #70953] - Support nested documents parsing SolrDocument [Request #70974] - Added maxScore to SolrResponse [Request #68610] - Fixed issues on big endean processors (Remi Collet) - Enhancements on method parameter naming (reflections) Omar Shaban omars omars@php.net yes 2.2.1 2.2.1 stable stable 2015-09-27 PHP License - Fix windows build Omar Shaban omars omars@php.net yes 2.2.0 2.2.0 stable stable 2015-09-26 PHP License - Support Real Time Get (Request #68647) - Support Result Grouping (Request #68793) - Support Field Collapsing (Request #70175) - Support Expand Component (Request #70176) - SolrMissingMandatoryParameterException (Request #70301) - Fix SegFault on Solr Server 500 Response with no msg [xml RW] (Bug #69156) - Fix SegFault on non-phpserialized 500 responses from Solr Server with PHPS RW (Bug #69156) - Fix Failed to parse 500 error response when it lacks msg JSON/PHPS RW (Bug #70495, #70496) - Fix compatibility tests with Solr Server 5 (Bug #70333) - Fix Error unserializing raw response on statistics response having NaN as value (Bug #67394) Omar Shaban omars omars@php.net yes 2.1.0 2.1.0 stable stable 2014-01-15 PHP License - New Feature: SolrDisMaxQuery Builder (dismax/edismax) [Feature #67101] - Support PHPS (PHP Serialized) Response Writer [Request #61329] - SolrResponse::getArrayResponse [Feature #67660] - SolrResponse::getResponse() returns SolrObject instead of array (with json response writer) [Bug #67579] - Argument list parameter: Argument to value separator disappears [Bug #68179] - Conflict Occurs When using SolrDisMax::addBoostQuery and setBoostQuery [Bug #68181] - Doc Fix [Doc #67542] - Internals: simple_list parameter type allow custom delimiter - Internals: Allowed zero-length argument value - Internals: Allowed zero-length argument-to-argument-value separator - Security Fix Omar Shaban omars omars@php.net yes 2.0.0 2.0.0 stable stable 2014-06-24 PHP License - Introduced SolrServerException which handles exception responses produced by Solr Server [Feature #67063] - SolrClient::commit $maxSegments removed - Removed php curl extension dependency for static builds [Bug #59028] - SolrParams/SolrModifiableParams/SolrQuery throws SolrIllegalArguments Exception instead of E_ERROR [Feature #66858] - SolrQuery::__construct throws SolrIllegalArgumentException instead of E_ERROR - Dropped Support for phpnative Response Writer - Fix config that always enables solr debug [Bug #60361] Omar Shaban omars omars@php.net yes 1.1.1 1.1.1 stable stable 2014-06-20 PHP License - Fix Windows Build Omar Shaban omars omars@php.net yes 1.1.0 1.1.0 stable stable 2014-06-19 PHP License 1.1.0 Stable - Introduced SolrServerException which handles exception responses produced by Solr Server [Feature #67063] - SolrClient::commit $maxSegments removed - SolrQuery::__construct throws SolrIllegalArgumentException instead of E_ERROR - Removed php curl extension dependency for static builds [Bug #59028] From 1.1.0b - SolrClient::system Access system servlet which fetch Solr Server System Information - SolrClient::commit argument $maxSegments is now DEPRECATED - SolrClient::commit Added support for expungeDeletes on - All SolrClient methods throws SolrClientExceptions instead of E_WARNING + SolrClientException - SolrClientExceptions' messages are more informative in case of connection errors - Added json extension validation - All SolrResponse, SolrQueryResponse, SolrUpdateResponse, SolrPingResponse, SolrGenericResponse, SolrDocument, and SolrInputDocument classes are now final - All parameters functions throws SolrIllegalArgumentException instead of E_RROR - SolrParams/SolrModifiableParams/SolrQuery throws SolrIllegalArguments Exception instead of E_ERROR [Feature #66858] - Various Bug Fixes Omar Shaban omars omars@php.net yes 1.1.0b 1.1.0b beta beta 2014-03-17 PHP License - SolrClient::system Access system servlet which fetch Solr Server System Information - SolrClient::commit argument $maxSegments is now DEPRECATED - SolrClient::commit Added support for expungeDeletes on - All SolrClient methods throws SolrClientExceptions instead of E_WARNING + SolrClientException - SolrClientExceptions' messages are more informative in case of connection errors - Added json extension validation - All SolrResponse, SolrQueryResponse, SolrUpdateResponse, SolrPingResponse, SolrGenericResponse, SolrDocument, and SolrInputDocument classes are now final - All parameters functions throws SolrIllegalArgumentException instead of E_RROR - SolrParams/SolrModifiableParams/SolrQuery throws SolrIllegalArguments Exception instead of E_ERROR (Feature #66858) - Various Bug Fixes Omar Shaban omars omars@php.net yes 2.0.0b 2.0.0b beta beta 2014-02-28 PHP License - Support Solr version 4.0+ - Added support for retreiving Solr Server system information through SolrClient SolrClient::system() - Support for softCommit - Suppport for expungeDeletes - maxSegments for commit is deprecated - Added escape character / as per Solr 4 it is reserved for REGEX - Disabled warnings for connection errors, SolrClientException is thrown - SolrClientException messages for connection errors are more meaningful indicating error messages and codes - API changes for: SolrClient::commit($maxSegments = 0, $softCommit = false, $waitSearcher = true, $expungeDeletes = false) SolrClient::optimize($maxSegments = 1, $softCommit = false, $waitSearcher = true) SolrClient::addDocument(SolrInputDocument &$doc, $overwrite = true, $commitWithin = 0) SolrClient::addDocuments(array &$docs, $overwrite = true, $commitWithin = 0) - Several Bug Fixes Warning: PECL Solr >= 2 is not compatible with Solr Server < 4.0 Israel Ekpo iekpo iekpo@php.net yes 1.0.2 1.0.2 stable stable 2011-11-29 PHP License - Several Bug Fixes by Pierrick, Felipe and Tony - Changes to make the code compile on 5.2.3 and greater - Changes to Tests by Pierrick Israel Ekpo iekpo iekpo@php.net yes 1.0.1 1.0.1 stable stable 2011-06-04 PHP License - Added support for json response writer in SolrClient - Removed final bit from classes so that they can be mocked in unit tests - Changed from beta to stable - Included phpdoc stubs in source to enable autocomplete of Solr classes and methods in IDE during development - Lowered libxml2 version requirement to 2.6.16 Israel Ekpo iekpo iekpo@php.net yes 0.9.11 0.9.11 beta beta 2010-06-22 PHP License - Added ability to specify response writer in constructor option - Added new method to set response writer SolrClient::setResponseWriter() - Currently, the only supported response writers are 'xml' and 'phpnative' - Added support for new native Solr response writer - New response writer is available at https://issues.apache.org/jira/browse/SOLR-1967 Israel Ekpo iekpo iekpo@php.net yes 0.9.10 0.9.10 beta beta 2010-05-04 PHP License - Increased compatibility with older systems running CentOS 4 or 5 and RHEL4 or 5 - Added ability to compile directly without having to build libcurl and libxml2 from source on older systems - Lowered minimum supported version for libcurl to 7.15.0 (Alex Samorukov) - Lowered minimum supported version for libxml2 to 2.6.26 (Alex Samorukov) - Fixed PECL Bug# 17172 MoreLikeThis only parses one doc (trevor at blubolt dot com, max at blubolt dot com) - Declared workaround macros for SSL private key constants due to support for earlier versions of libcurl (Alex Samorukov) - Changed extension version numbers to start using hexadecimal numbers (Israel Ekpo) - Added instructions on how to attempt to compile on windows (Israel Ekpo) - Fixed PECL Bug# 17292 sending UTF-8 encoding in header (giguet at info dot unicaen dot fr) Israel Ekpo iekpo iekpo@php.net yes 0.9.9 0.9.9 beta beta 2010-01-10 PHP License - Fixed Bug #17009 Creating two SolrQuery objects leads to wrong query value - Reset the buffer for the request data from the previous request in SolrClient - Added new internal static function solr_set_initial_curl_handle_options() - Moved the intialization of CURL handle options to solr_set_initial_curl_handle_options() function - Resetting the CURL options on the (CURL *) handle after each request is completed - Added more explicit error message to indicate that cloning SolrParams objects and its descendants is currently not yet supported Israel Ekpo iekpo iekpo@php.net yes 0.9.8 0.9.8 beta beta 2009-12-04 PHP License - Fixed config.w32 for Windows build support (Pierre, Pierrick) - Fixed Bug #16943 Segmentation Fault from solr_encode_string() during attempt to retrieve solrXmlNode->children->content when solrXmlNode->children is NULL (Israel) - Disabled Expect header in libcurl (Israel) - Disabled Memory Debugging when normal debug is enabled (Israel) - Added list of contributors to the project Israel Ekpo iekpo iekpo@php.net yes 0.9.7 0.9.7 beta beta 2009-11-17 PHP License - Fixed bug 16924 AC_MSG_NOTICE() is undefined in autoconf 2.13 - Added new method SolrClient::getDebug() - Modified SolrClient::__construct() so that port numbers and other integer values for the options can be passed as strings. - Changed internal string handling mechanism to allow for tracking of memory allocation in debug mode. - Lowered minimum php version to 5.2.3. Unfortunately, this is the lowest PHP version that will be supported. PHP versions lower than 5.2.3 are not compatible or are causing tests to FAIL. - Added php stubs for code-completion assists in IDEs and editors. - Added more examples Israel Ekpo iekpo iekpo@php.net yes 0.9.6 0.9.6 beta beta 2009-11-01 PHP License Reduced minimum php version to 5.2.4 Israel Ekpo iekpo iekpo@php.net yes 0.9.5 0.9.5 beta beta 2009-10-27 PHP License Added support for secure connections to SSL-enabled Solr servers (SSL/HTTPS). Made connection errors more verbose. The following options where added to the SolrClient constructor : - secure (Boolean value indicating whether or not to connect in secure mode) - timeout (This is maximum time in seconds allowed for the http data transfer operation. Default is 30 seconds) - ssl_cert (File name to a PEM-formatted file containing the private key + private certificate (concatenated in that order) ) - ssl_key (File name to a PEM-formatted private key file only) - ssl_keypassword (Password for private key) - ssl_cainfo (Name of file holding one or more CA certificates to verify peer with) - ssl_capath (Name of directory holding multiple CA certificates to verify peer with ) Israel Ekpo iekpo iekpo@php.net yes 0.9.4 0.9.4 beta beta 2009-10-23 PHP License Fixed bug 16897 - ap_php_vasprintf not available in 5.2.11 Israel Ekpo iekpo iekpo@php.net yes 0.9.3 0.9.3 beta beta 2009-10-19 PHP License - Corrected configuration options for automated installation via PECL. Removed extra hyphens. Israel Ekpo iekpo iekpo@php.net yes 0.9.2 0.9.2 beta beta 2009-10-19 PHP License - Fixed bug #16874 Added explanation in documentation - Updated SolrParams::__toString() - modified to return name-value pair list instead of serialized object string - Added the following methods to SolrParams : SolrParams::toString() SolrParams::getParam() - Created the following aliases in SolrParams : SolrParams::set() SolrParams::add() SolrParams::get() - Added the following methods to SolrQuery : SolrQuery::getQuery() SolrQuery::getStart() SolrQuery::getRows() SolrQuery::getFields() SolrQuery::getSortFields() SolrQuery::getFilterQueries() SolrQuery::getTimeAllowed() SolrQuery::getFacet() SolrQuery::getFacetFields() SolrQuery::getFacetQueries() SolrQuery::getFacetPrefix() SolrQuery::getFacetSort() SolrQuery::getFacetLimit() SolrQuery::getFacetOffset() SolrQuery::getFacetMinCount() SolrQuery::getFacetMissing() SolrQuery::getFacetMethod() SolrQuery::getFacetDateFields() SolrQuery::getFacetDateStart() SolrQuery::getFacetDateEnd() SolrQuery::getFacetDateGap() SolrQuery::getFacetDateHardEnd() SolrQuery::getFacetDateOther() SolrQuery::getHighlight() SolrQuery::getHighlightFields() SolrQuery::getHighlightSnippets() SolrQuery::getHighlightFragsize() SolrQuery::getHighlightMergeContiguous() SolrQuery::getHighlightRequireFieldMatch() SolrQuery::getHighlightMaxAnalyzedChars() SolrQuery::getHighlightAlternateField() SolrQuery::getHighlightMaxAlternateFieldLength() SolrQuery::getHighlightFormatter() SolrQuery::getHighlightSimplePre() SolrQuery::getHighlightSimplePost() SolrQuery::getHighlightFragmenter() SolrQuery::getHighlightUsePhraseHighlighter() SolrQuery::getHighlightHighlightMultiTerm() SolrQuery::getHighlightRegexSlop() SolrQuery::getHighlightRegexPattern() SolrQuery::getHighlightRegexMaxAnalyzedChars() SolrQuery::getStats() SolrQuery::getStatsFields() SolrQuery::getStatsFacets() SolrQuery::getMlt() SolrQuery::getMltCount() SolrQuery::getMltFields() SolrQuery::getMltQueryFields() SolrQuery::getMltMinTermFrequency() SolrQuery::getMltMinDocFrequency() SolrQuery::getMltMinWordLength() SolrQuery::getMltMaxWordLength() SolrQuery::getMltMaxNumTokens() SolrQuery::getMltMaxNumQueryTerms() SolrQuery::getMltBoost() SolrQuery::getTerms() SolrQuery::getTermsField() SolrQuery::getTermsLowerBound() SolrQuery::getTermsUpperBound() SolrQuery::getTermsIncludeLowerBound() SolrQuery::getTermsIncludeUpperBound() SolrQuery::getTermsMinCount() SolrQuery::getTermsMaxCount() SolrQuery::getTermsPrefix() SolrQuery::getTermsLimit() SolrQuery::getTermsReturnRaw() SolrQuery::getTermsSort() Israel Ekpo iekpo iekpo@php.net yes 0.9.1 0.9.1 beta beta 2009-10-07 PHP License - Fixed bug #16864 (Build failure in Non-ZTS builds) Israel Ekpo iekpo iekpo@php.net yes 0.9.0 0.9.0 beta beta 2009-10-05 PHP License - Initial release after approximately 10 months of development and 3 weeks of testing. This is the beta version. Some of the features may be modified in future releases. php-solr-2.5.1+2.4.0/solr-2.4.0/000077500000000000000000000000001374041537100153435ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.4.0/CREDITS000066400000000000000000000000421374041537100163570ustar00rootroot00000000000000solr Israel Koko Ekpo Omar Shaban php-solr-2.5.1+2.4.0/solr-2.4.0/LICENSE000066400000000000000000000062211374041537100163510ustar00rootroot00000000000000-------------------------------------------------------------------- The PHP License, version 3.01 Copyright (c) 1999 - 2009 The PHP Group. All rights reserved. -------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, is permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name "PHP" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact group@php.net. 4. Products derived from this software may not be called "PHP", nor may "PHP" appear in their name, without prior written permission from group@php.net. You may indicate that your software works in conjunction with PHP by saying "Foo for PHP" instead of calling it "PHP Foo" or "phpfoo" 5. The PHP Group may publish revised and/or new versions of the license from time to time. Each version will be given a distinguishing version number. Once covered code has been published under a particular version of the license, you may always continue to use it under the terms of that version. You may also choose to use such covered code under the terms of any subsequent version of the license published by the PHP Group. No one other than the PHP Group has the right to modify the terms applicable to covered code created under this License. 6. Redistributions of any form whatsoever must retain the following acknowledgment: "This product includes PHP software, freely available from ". THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------- This software consists of voluntary contributions made by many individuals on behalf of the PHP Group. The PHP Group can be contacted via Email at group@php.net. For more information on the PHP Group and the PHP project, please see . PHP includes the Zend Engine, freely available at .php-solr-2.5.1+2.4.0/solr-2.4.0/README.ABOUT_SOLR_EXTENSION000066400000000000000000000141171374041537100213730ustar00rootroot00000000000000 $Id$ ================================================================================ Introducing the Solr PHP Extension ================================================================================ The Solr extension is an extremely fast, light-weight, feature-rich library that allows PHP developers to communicate effectively with Solr server instances. There are tools to add documents and make updates to the solr server. It also contains tools that allows you to build advanced queries to the server when searching for documents. There are also special objects that simplifies the sending of name-value requests to the server. This includes the SolrParams class and all its child classes. The SolrClient object allows one to communicate with Solr containers that are behind proxy servers or that require HTTP Authentication to proceed. The SolrClient constructor accepts options such as http authentication username and passwor, proxy server name, port, login and passwords etc. Using an advanced http client like libcurl allows us to leverage the features available with the library. We can reuse the HTTP connections without having to create a separate one for each request. ================================================================================ How to Install ================================================================================ Please refer to the README.INSTALLATION file. ================================================================================ Magic Methods and Interfaces Implemented ================================================================================ SolrDocument implements the following interfaces. (1) ArrayAccess - to access the fields as array keys using field names. (2) Iterator - to iterate over the document fields using foreach() (3) Serializable - provides custom serialization of the object. SolrDocument also contains the __get and __set magic methods which allows developers to access the fields directly. When setting fields, if the field already has a value the new value will be appended to the list of values for that field. Each field is a SolrDocumentField object with the following public properties : (a) name - a string with name of the field. (b) boost - a double representing the boost value of the field (intentionally empty) (c) values - an array of all the field values as strings. Custom Serialization string SolrDocument::serialize(void) returns an XML document representing a SolrDocument as shown below : A0F43D Israel Ekpo Israel.Ekpo@israel.ekpo.com Reading Writing Soccer Teaching Inglés Espanól Here is a complete example of a serialized SolrDocument object: C:12:"SolrDocument":679:{ A0F43D Israel Ekpo Israel.Ekpo@israel.ekpo.com Reading Writing Soccer Teaching Inglés Espanól } One of the items on my todo list is to create a response writer to return serialized SolrDocument objects instead of document arrays. SolrDocument::unserialize(string $serialized) accepts an XML document representing the SolrDocument object. It will the bring the object back to live. The SolrDocument class also has the method SolrDocument::getInputDocument() to allow one do get the SolrInputDocument version of a SolrDocument instance. This method may be helpful if one needs to resubmit the document to the server to updates. The Solr extension has the SolrQuery object (a child of SolrParams) that enables the developer to send custom advanced name-value requests to the solr server. The SolrQuery object can also be serialized and reused later, which makes it very helpful to saving the state of the application across multiple requests. This may be very useful in cases such as facet browsing where additional parameters may need to be added to the current object or removed from it to get the desired results without having to start over from scratch. ================================================================================ Parsing of XML Responses from the Solr Server ================================================================================ XML responses from the solr server are expected to be formatted using version 2.2 These xml documents are parsed into serialized php code and returned as read-only SolrObject instances whose properties can also be accessed as array keys in addition to being accessible directly via the object->member notation. Having the properties accessible via object[member] notation is helpful in cases where the property name is not valid (contains dots and other characters not legal in php. ================================================================================ How to Report Bugs ================================================================================ Please report bugs to http://bugs.php.net If you experience a crash due to a segmentation fault, please follow the instructions on the link below to get a gdb backtrace and then submit the trace in your bug report as well http://bugs.php.net/bugs-generating-backtrace.php Thank you for using PHP php-solr-2.5.1+2.4.0/solr-2.4.0/README.CONTRIBUTORS000066400000000000000000000063441374041537100201660ustar00rootroot00000000000000 ================================================================================ Omar Shaban (omars@php.net) ================================================================================ - Lead Maintainer ================================================================================ Thanks to all our [contributors](https://github.com/php/pecl-search_engine-solr/graphs/contributors). ================================================================================ These are the people that made version 1.0 release of the Apache Solr PECL extension possible. If I have left anyone out or mis-stated your contributions, please let me know so that it can be correct to reflect your contributions accurately. Thanks again for making this possible. ================================================================================ Israel Ekpo (iekpo@php.net) ================================================================================ - Orignal Author of the Apache Solr PECL extension - Orignal Extension Concept and Design - Lead Maintainer ================================================================================ Pierre-Alain Joye (pajoye@php.net) ================================================================================ - Fine tuned and created the final version of the config.w32 script (291135) - Compiled and made available several versions of the .dll binaries for Windows. - Currently hosting the windows .dll binaries for the Apache Solr PECL extension. ================================================================================ Kalle Sommer Nielsen (kalle@php.net) ================================================================================ - Significant refactoring of the config.w32 script for Windows (288890) - Corrected Windows C++ compiler bugs (288890) ================================================================================ Pierrick Charron (pierrick@php.net) ================================================================================ - Assisted in the testing of the extension using various test cases. - Uncovered and reported several bugs due to his insight of the extension internals. - Discovered bugs 16943 and 16924 - Patched the config.w32 for its first successful compilation on Windows (291101). ================================================================================ Felipe Pena (felipe@php.net) ================================================================================ - Participated significantly after the intial release and uncovered a serious bug that lead to segfaults. - Discovered bugs 16855 thru 16859 - Contributed to development of UNIX config.m4 script (289148) ================================================================================ Alex Samorukov (alexey.samorukov@varien.com) ================================================================================ - Lowered minimum supported version for libcurl to 7.15.0 - Lowered minimum supported version for libxml2 to 2.6.26 ================================================================================ (trevor at blubolt dot com, max at blubolt dot com) ================================================================================ - Fixed PECL Bug# 17172 MoreLikeThis only parses one doc php-solr-2.5.1+2.4.0/solr-2.4.0/README.INSTALLATION000066400000000000000000000166111374041537100201300ustar00rootroot00000000000000 $Id$ ================================================================================ PHP VERSION Dependencies ================================================================================ PHP version 5.3 or later is needed ================================================================================ Extension Dependencies ================================================================================ LIBXML extension JSON extension ================================================================================ Library Dependencies ================================================================================ libxml2 2.6.26 or later is required libcurl 7.15.0 or later is required ================================================================================ On UNIX ================================================================================ As mentioned before, the libxml and curl extensions must be enabled for the Apache Solr extension to be functional. Do not attempt to hack the code to make it compile. It will fail, possibly with errors that could be hard to debug To install the Apache Solr extension directly from PECL, please enter the following command, then follow the prompts pecl install solr To compile from source, please follow the following steps $ phpize $ ./configure $ make && make install This should compile the code and install it in the extension_dir specified in the ini file. Then open your php.ini file and add the following line to it extension=solr.so Then restart your webserver. For CLI only, you do not have to restart your webserver. Note : If your system does not have the minimum version of the libcurl or libxml libraries, you can download the libraries and compile them from source into a separate install prefix. wget http://curl.haxx.se/download/curl-7.19.6.tar.gz tar -zxvf curl-7.19.6.tar.gz cd curl-7.19.6 configure --prefix=/root/custom/software make && make install cd .. wget ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz tar -zxvf libxml2-2.7.6.tar.gz cd libxml2-2.7.6 configure --prefix=/root/custom/software make && make install This example assumes that the libxml2 and libcurl libraries were compiled from source and installed using "/root/custom/software" as the --prefix So the absolute path to the easy.h header file will be /root/custom/software/include/curl/easy.h And the absolute path to the libxml/parser.h header file wil be /root/custom/software/include/libxml2/libxml/parser.h The absolute path to the xml2-config script will be /root/custom/software/bin/xml2-config And the absolute path to the curl-config script will be /root/custom/software/bin/curl-config Then you can pass libcurl prefix to the configure script for CURL and LIBXML respectively during the configuration phase as shown here : 4B ./configure --enable-solr --with-curl=/root/custom/software --with-libxml-dir=/root/custom/software If you already have the latest versions of the libraries then the step listed in 4A alone is sufficient. 5. make && make install This should compile the code and install it in the extension_dir specified in the ini file. Then open your php.ini file and add the following line to it extension=solr.so If you would prefer to compile the Solr extension statically into php, you will need to follow the following steps. 1. copy the solr_xxx folder into the ext folder in the php source 2. Include the --enable-solr flag as one of the options when configuring php This will build the Solr extension statically into php. After the installation is completed, you will have to restart your webserver for the changes to take effect. For CLI only use, you do not have to restart your webserver. ================================================================================ On Windows ================================================================================ If you are using a pre-compiled dll, simply copy the php_solr.dll file to your extension_dir specified in the ini file. Then open your php.ini file and add the following line to it extension=php_solr.dll Then restart your webserver. For CLI only, you do not have to restart your webserver. If you are building from source, you will need to download the library dependencies for libxml and libcurl from the following link to the deps folder before running buildconf.bat http://wiki.php.net/internals/windows/libs http://pecl2.php.net/downloads/php-windows-builds/php-libs/ More details are avialable here http://wiki.php.net/internals/windows Windows DLLs are now available here http://downloads.php.net/pierre/ If you are building from source, you will need to download the library dependencies for libxml and libcurl from the following link to the deps folder before running buildconf.bat The Apache Solr extension can be compiled statically or shared. - Shared compilation creates a php_solr.dll file. - Static compilation puts the Solr extension directly into PHP (therefore it does not need to be loaded and cannot be unloaded). You can toggle between compiling statically or as library by adding =static or =shared to the configure.js command during the compilation. configure --with-solr=static configure --with-solr=shared - In the first configure command, the Apache Solr extension will be included in PHP - In the second configure command, the Apache Solr extension will be compiled as separate DLL Here is a more detail list of steps to follow : 1. Get visual studio 2008 ((express edition or professional) and install it. 2. Get and install windows sdk 6.1. 3. Get a php 5.3 snapshot (do not extract yet!). 4. Create the folder "c:\php-sdk" 5. Unpack the binary tools archive into this directory, there should be one sub-directory called "bin" and one called "script" 6. Open the "windows sdk 6.1 shell" (which is available from the start menu group) and execute the following commands in it: setenv /x86 /xp /release cd c:\php-sdk\ bin\phpsdk_setvars.bat bin\phpsdk_buildtree.bat php53dev 7. Now extract the snapshot from Step 3 to C:\php-sdk\php53dev\vc9\x86 with your favourite unpacker so that the following directory gets created: C:\php-sdk\php53dev\vc9\x86\php5.3-xyz 8. run in the windows-sdk-shell: cd C:\php-sdk\php53dev\vc9\x86\php5.3-xyz buildconf 9. now run configure --help, to get an overview of the compiling flags 10. configure --disable-all --enable-cli --with-solr=yes --with-curl=yes --with-libxml=yes 11. nmake If you are using Visual Studio 2005, use vc8 wherever you see vc9. If you are on a 64-bit system, use x64 instead of x86. The following resources can provide you with more information : http://wiki.php.net/internals/windows/libs http://pecl2.php.net/downloads/php-windows-builds/php-libs/ More details are avialable here : http://wiki.php.net/internals/windows The binary tools archive is available at : http://pecl2.php.net/downloads/php-windows-builds/php-libs/binary-tools.zip Windows SDK 6.1 is available at : http://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC&displaylang=en The PHP 5.3 shapshot is available at: http://windows.php.net/downloads/snaps/php-5.3/php-5.3-src-latest.zip ================================================================================ How to Report Bugs ================================================================================ Please report bugs to omars@php.net You can also register bugs here http://pecl.php.net/bugs/report.php?package=solr Thank you for using PHP php-solr-2.5.1+2.4.0/solr-2.4.0/README.MEMORY_ALLOCATION000066400000000000000000000053151374041537100207430ustar00rootroot00000000000000 $Id$ ================================================================================ Solr Notes about Memory Allocation and interaction with HashTables ================================================================================ The following notes are for C-space PHP developers. If you are not really familiar with how the Zend HashTable API or the memory allocation marcros really works, please take sometime to read the notes below : This is correct as of Zend Engine version 2.3.0 - If memory was allocated with emalloc(), it has to be freed with efree(). - If memory was allocated using pemalloc(), the same value for the persistent parameter must be used during pefree() to deallocated the allocated memory. The memory manager for the Zend API will then decide whether to use free() or efree() depending on whether persistent is 1 or 0 respectively. The same principle applies to pestrdup(), pecalloc() and the other memory allocation macros. - When inserting values into the HashTables, if the value for the persistent parameter is set, then the memory allocation for the entered item should be persistent to i.e. pemalloc() with persistent set to 1. The following will apply when adding new values into a HashTable for items that were dynamically allocated : (a) If the value for the nDataSize parameter is the size of that of a pointer sizeof(void *), the HashTable API copies the contents of the pData parameter into the Bucket->pDataPtr member for that data Bucket. Then it sets the Bucket->pData member to the address of the Bucket->pDataPtr member for that data Bucket. (b) If the value for the nDataSize parameter is not equal to sizeof(void *), the HashTable API allocates new memory for the Bucket->pData member using the size equivalent to nDataSize and the same value for the persistent flag set for the target HashTable. The the contents of the pData parameter is copied into the Bucket->pData member in this newly allocated memory location. Then the Bucket->pDataPtr member for this Bucket is set to NULL. Do not worry about the newly allocated memory allocated by the HashTable API; if the nDataSize parameter was not equal to sizeof(void *), then during the cleanup process, the Zend API will free the new memory it allocated during the insert process. It will also call the destructor function if a valid one was passed when the HashTable was initialized with zend_hash_init(). In the extension, I have used the p* version of the memory allocation functions to allow me toggle if there is any need to do so in the future. This will prevent a massive search and replace effort. For all the HashTables, I set the intial size to 8 to reduce the looping when zend_hash_init() is setting up the HashTable pointer to use. php-solr-2.5.1+2.4.0/solr-2.4.0/README.SUBMITTING_CONTRIBUTIONS000066400000000000000000000043321374041537100220330ustar00rootroot00000000000000 $Id$ ================================================================================ Submitting contributions ================================================================================ A lot of time has been put into designing, implementing and documenting this extension. A lot of work has also been put into ensuring that users of the extension experience very minimal defects during usage. New ideas, corrections, bug fixes, feature improvements are always welcome. However, you must discuss any changes you are about to make to any of the source files prior to making or submitting such changes either in the PECL developers mailing list (pecl-dev@lists.php.net) or by contacting the current author(s) or maintainer(s) of this extension directly. Test scripts should be included when making the submissions. Also explain thoroughly what has been fixed/added/changed by your patch. If your patch is easy to review and has obviously no side-effects, it might take up to a few hours until it is committed. Since this is a volunteer-driven effort, more complex patches will require more patience on the part of the submitter. ================================================================================ Testing thoroughly before submissions ================================================================================ This is a fairly large library and each component is dependent on another component either directly or indirectly. As a consequence, any and all changes must be tested thoroughly before commiting them. It is only polite to the users, author(s) or maintainer(s) that you do so. ================================================================================ Checklist for making submissions ================================================================================ - Did you run "make test" to check if your patch didn't break other features? - Did you compile PHP with --enable-debug and check the PHP and web server error logs when you test your patch? - Did you build PHP for multi-threaded web servers. - Did you create test script for "make test"? (Recommended) - Did you check your patch is unified format and it does not contain white space changes? - Did you read the patch again? php-solr-2.5.1+2.4.0/solr-2.4.0/TODO000066400000000000000000000014671374041537100160430ustar00rootroot00000000000000 2014-02-17 $Id$ ================================================================================ Features and things to do in the library ================================================================================ - Set up php.ini entries for default servlet values. This will allow developers to set custom values for the servlets. - Ability to send custom requests to Solr (custom url, custom request contents) - Ability to add files (pdf, office documents, etc) - Ensure the SolrQuery::getFields(), SolrQuery::getFacets() et all returns an array consistently. - More frequent compilations of releases for PHP 5.3 on Windows - Support JSON Writer - Support Solr Spatial Features Natively - Introduce SolrServerException to parse and return Solr Server error messages instead of dumping xml docs php-solr-2.5.1+2.4.0/solr-2.4.0/config.m4000066400000000000000000000126171374041537100170610ustar00rootroot00000000000000 dnl $Id$ dnl config.m4 for the solr extension dnl Configuring the CURL external library dnl This folder is the grand-parent folder of easy.h PHP_ARG_WITH(curl, for cURL support, [ --with-curl[=DIR] SOLR : libcurl install prefix]) if test -r $PHP_CURL/include/curl/easy.h; then CURL_DIR=$PHP_CURL AC_MSG_RESULT(curl headers found in $PHP_CURL) else AC_MSG_CHECKING(for cURL in default path) for i in /usr/local /usr; do if test -r $i/include/curl/easy.h; then CURL_DIR=$i AC_MSG_RESULT(found in $i) break fi done fi if test -z "$CURL_DIR"; then AC_MSG_RESULT(not found) AC_MSG_ERROR([Please reinstall the libcurl distribution - easy.h should be in /include/curl/]) fi CURL_CONFIG="curl-config" AC_MSG_CHECKING(for cURL 7.15.0 or greater) if ${CURL_DIR}/bin/curl-config --libs > /dev/null 2>&1; then CURL_CONFIG=${CURL_DIR}/bin/curl-config else if ${CURL_DIR}/curl-config --libs > /dev/null 2>&1; then CURL_CONFIG=${CURL_DIR}/curl-config fi fi curl_version_full=`$CURL_CONFIG --version` curl_version=`echo ${curl_version_full} | sed -e 's/libcurl //' | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` if test "$curl_version" -ge 7015000; then AC_MSG_RESULT($curl_version_full) CURL_LIBS=`$CURL_CONFIG --libs` else AC_MSG_ERROR([The Solr extension does not support libcurl libraries < 7.15.0. Please update your libraries]) fi PHP_ARG_ENABLE(solr, whether to enable the Solr extension, [ --enable-solr Enable solr support]) PHP_ARG_ENABLE(solr-debug, whether to compile with solr in verbose mode, [ --enable-solr-debug Compile with solr in verbose mode], no, no) dnl Configuring the LibXML external Library if test -z "$PHP_LIBXML_DIR"; then PHP_ARG_WITH(libxml-dir, libxml2 install dir, [ --with-libxml-dir=[DIR] SOLR : libxml2 install prefix], no, no) fi PHP_ARG_ENABLE(coverage, whether to enable code coverage, [ --enable-coverage Enable developer code coverage information],, no) dnl Setting up the apache Solr extension if test "$PHP_SOLR" != "no"; then if test "$PHP_CURL" = "no"; then AC_MSG_ERROR([Solr extension requires curl extension, add --with-curl]) fi PHP_CHECK_LIBRARY(curl,curl_easy_perform, [ AC_DEFINE(HAVE_CURL,1,[ ]) ],[ AC_MSG_ERROR(There is something wrong. Please check config.log for more information.) ],[ $CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR ]) PHP_ADD_INCLUDE($CURL_DIR/include) PHP_EVAL_LIBLINE($CURL_LIBS, SOLR_SHARED_LIBADD) PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/lib, SOLR_SHARED_LIBADD) if test "$PHP_LIBXML" = "no"; then AC_MSG_ERROR([Solr extension requires LIBXML extension, add --enable-libxml]) fi AC_MSG_CHECKING(for JSON) if test -f "$phpincludedir/ext/json/php_json.h" || test "$HAVE_JSON" != "no"; then AC_DEFINE(HAVE_JSON, 1, [JSON support]) AC_MSG_RESULT(Yes) else AC_MSG_ERROR([Solr extension requires json or jsonc support]) fi PHP_SETUP_LIBXML(SOLR_SHARED_LIBADD, [ AC_DEFINE(HAVE_SOLR, 1,[Setting the value of HAVE_SOLR to 1 ]) if test "$PHP_SOLR_DEBUG" != "no"; then AC_DEFINE(SOLR_DEBUG, 1, [Setting the value of SOLR_DEBUG to 1 ]) else AC_DEFINE(SOLR_DEBUG_OFF, 1, [Setting the value of SOLR_DEBUG_OFF to 1 ]) fi if test "$PHP_COVERAGE" = "yes"; then PHP_CHECK_GCC_ARG(-fprofile-arcs, COVERAGE_CFLAGS="$COVERAGE_CFLAGS -fprofile-arcs") PHP_CHECK_GCC_ARG(-ftest-coverage, COVERAGE_CFLAGS="$COVERAGE_CFLAGS -ftest-coverage") EXTRA_LDFLAGS="$COVERAGE_CFLAGS" fi export OLD_CPPFLAGS="$CPPFLAGS" export CPPFLAGS="$CPPFLAGS $INCLUDES" AC_MSG_CHECKING(PHP version) AC_TRY_COMPILE([ #include ],[ #if PHP_MAJOR_VERSION > 5 #error PHP > 5 #endif ],[ subdir=src/php5 AC_MSG_RESULT([PHP 5]) ],[ subdir=src/php7 AC_MSG_RESULT([PHP 7]) ]) PHP_SOLR_SRC_FILES="$subdir/php_solr.c \ $subdir/php_solr_object.c \ $subdir/php_solr_document.c \ $subdir/php_solr_input_document.c \ $subdir/php_solr_client.c \ $subdir/php_solr_params.c \ $subdir/php_solr_query.c \ $subdir/php_solr_response.c \ $subdir/php_solr_exception.c \ $subdir/php_solr_utils.c \ $subdir/php_solr_dismax_query.c \ $subdir/php_solr_collapse_function.c \ $subdir/solr_string.c \ $subdir/solr_functions_document.c \ $subdir/solr_functions_client.c \ $subdir/solr_functions_helpers.c \ $subdir/solr_functions_params.c \ $subdir/solr_functions_response.c \ $subdir/solr_functions_debug.c" PHP_NEW_EXTENSION(solr, $PHP_SOLR_SRC_FILES, $ext_shared,, [$COVERAGE_CFLAGS]) PHP_ADD_BUILD_DIR($abs_builddir/$subdir, 1) PHP_SUBST(SOLR_SHARED_LIBADD) ], [ AC_MSG_ERROR([xml2-config not found. Please check your libxml2 installation.]) ]) fi php-solr-2.5.1+2.4.0/solr-2.4.0/config.w32000066400000000000000000000065501374041537100171530ustar00rootroot00000000000000// $Id$ // vim:ft=javascript // config.w32 for solr extension ARG_ENABLE('solr', 'Whether to enable Apache Solr support', 'no'); ARG_ENABLE('solr-debug', 'Whether to enable Solr debugging support', 'no'); if(PHP_SOLR != 'no') { if(!CHECK_LIB('libcurl_a.lib;libcurl.lib', 'solr', PHP_SOLR) || !CHECK_HEADER_ADD_INCLUDE('curl/easy.h', 'CFLAGS_SOLR')) { WARNING('solr was not enabled; curl libraries and/or headers not found'); PHP_SOLR = "no"; } if(!CHECK_LIB('ssleay32.lib', 'solr', PHP_SOLR) || !CHECK_LIB('libeay32.lib', 'solr', PHP_SOLR)) { WARNING('solr was not enabled; openssl libraries not found'); PHP_SOLR = "no"; } if(!CHECK_LIB('winmm.lib', 'solr', PHP_SOLR) || !CHECK_LIB('wldap32.lib', 'solr', PHP_SOLR)) { WARNING('solr not enabled; ldap libraries not found'); PHP_SOLR = "no"; } if(!((PHP_ZLIB == 'no' && CHECK_LIB('zlib_a.lib;zlib.lib', 'solr', PHP_SOLR)) || (PHP_ZLIB_SHARED && CHECK_LIB('zlib.lib', 'solr', PHP_SOLR)) || (PHP_ZLIB == 'yes' && !PHP_ZLIB_SHARED))) { WARNING('solr not enabled; zlib libraries not found'); PHP_SOLR = "no"; } if(PHP_LIBXML == 'no' || !ADD_EXTENSION_DEP('solr', 'libxml')) { WARNING('solr was not enabled; libxml is not enabled'); PHP_SOLR = "no"; } else { if (!CHECK_LIB("libxml2_a_dll.lib;libxml2_a.lib", "solr", PHP_SOLR) || !CHECK_LIB("libiconv_a.lib;iconv_a.lib;libiconv.lib;iconv.lib", "solr", PHP_SOLR) || !CHECK_HEADER_ADD_INCLUDE('libxml/parser.h', 'CFLAGS_SOLR', PHP_PHP_BUILD + "\\include\\libxml2") || !CHECK_HEADER_ADD_INCLUDE('libxml/tree.h', 'CFLAGS_SOLR', PHP_PHP_BUILD + "\\include\\libxml2") ) { WARNING('solr was not enabled; libxml or iconv not found'); PHP_SOLR = "no"; } } if(PHP_JSON == 'no' || !ADD_EXTENSION_DEP('solr', 'json')) { WARNING('solr was not enabled; json is not enabled'); PHP_SOLR = "no"; } if(PHP_SOLR != 'no') { if(PHP_SOLR_DEBUG == 'no') { AC_DEFINE('SOLR_DEBUG_OFF', 1, 'Solr debugging set to off'); } else { AC_DEFINE('SOLR_DEBUG', 1, 'Solr debugging set to on'); } var dll = get_define('PHPDLL'); var old_conf_dir = configure_module_dirname; /* XXX tricky job here, override configure_module_dirname, define the basic extension, then set it back*/ if (null != dll.match(/^php5/)) { configure_module_dirname = configure_module_dirname + "\\src\\php5"; } else if (null != dll.match(/^php7/)) { configure_module_dirname = configure_module_dirname + "\\src\\php7"; } else { ERROR("Cannot match any known PHP version with '" + dll + "'"); } EXTENSION('solr', 'php_solr.c php_solr_client.c php_solr_document.c php_solr_exception.c ' + 'php_solr_input_document.c php_solr_object.c php_solr_params.c php_solr_query.c ' + 'php_solr_response.c php_solr_utils.c solr_functions_client.c solr_functions_debug.c ' + 'solr_functions_document.c solr_functions_helpers.c solr_functions_params.c ' + 'solr_functions_response.c solr_string.c php_solr_dismax_query.c ' + 'php_solr_collapse_function.c' ); configure_module_dirname = old_conf_dir; ADD_FLAG('CFLAGS_SOLR', '/I"' + configure_module_dirname + '" /D CURL_STATICLIB /D LIBXML_STATICLIB'); AC_DEFINE('HAVE_SOLR', 1, 'Solr support'); if (!PHP_SOLR_SHARED) { ADD_FLAG("CFLAGS_SOLR", "/D LIBXML_STATIC"); } ADD_EXTENSION_DEP('solr', 'libxml'); } } php-solr-2.5.1+2.4.0/solr-2.4.0/docs/000077500000000000000000000000001374041537100162735ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.4.0/docs/documentation.php000066400000000000000000002444771374041537100216770ustar00rootroot00000000000000 | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ define('SOLR_MAJOR_VERSION', 2); define('SOLR_MINOR_VERSION', 3); define('SOLR_PATCH_VERSION', 0); define('SOLR_EXTENSION_VERSION', '2.3.0'); /** * Returns the current version of the Apache Solr extension * * @return string */ function solr_get_version() { return SOLR_EXTENSION_VERSION; } /** * This is the base class for all exception thrown by the Solr extension classes. * * @author Israel Ekpo */ class SolrException extends Exception { /* Properties */ protected $sourceline; protected $sourcefile; protected $zif_name; /** * Returns internal information where the Exception was thrown * @return array * @link http://docs.php.net/manual/en/solrexception.getinternalinfo.php */ public function getInternalInfo() {} } /** * An exception thrown when there is an error while making a request to the server from the client. * @author Israel Ekpo */ class SolrClientException extends SolrException { /** * Returns internal information where the Exception was thrown * * @return array * @link http://docs.php.net/manual/en/solrclientexception.getinternalinfo.php */ public function getInternalInfo() {} } /** * Used for Solr Related Exceptions * * @author Omar Shaban */ class SolrServerException extends SolrException { /** * Returns internal information where the Exception was thrown * * @return array * @link http://docs.php.net/manual/en/solrserverexception.getinternalinfo.php */ public function getInternalInfo() {} } /** * This object is thrown when an illeglal or invalid argument is passed to a method. * * @link http://docs.php.net/manual/en/class.solrillegalargumentexception.php * @author Israel Ekpo */ class SolrIllegalArgumentException extends SolrException { /** * Returns internal information where the Exception was thrown * @return string * @link http://docs.php.net/manual/en/solrillegalargumentexception.getinternalinfo.php */ public function getInternalInfo() {} } /** * @link http://docs.php.net/manual/en/class.solrillegaloperationexception.php * @author Israel Ekpo */ class SolrIllegalOperationException extends SolrException { /** * Returns internal information where the Exception was thrown * * @return string * @link http://docs.php.net/manual/en/solrillegaloperationexception.getinternalinfo.php */ public function getInternalInfo() {} } /** * @author Omar Shaban */ class SolrMissingMandatoryParameterException extends SolrException { } /** * * @author Israel Ekpo */ abstract class SolrUtils { /** * Parses an response XML string into a SolrObject * * @param string $xmlresponse * @param int $parse_mode * @return SolrObject * @link http://docs.php.net/manual/en/solrutils.digestxmlresponse.php */ public static function digestXmlResponse($xmlresponse, $parse_mode = 0) {} /** * Escapes a lucene query string * * @param string $str String to be escaped * @return string * @link http://docs.php.net/manual/en/solrutils.escapequerychars.php */ public static function escapeQueryChars($str) {} /** * Returns the current version of the Solr extension * @return string * @link http://docs.php.net/manual/en/solrutils.getsolrversion.php */ public static function getSolrVersion() {} /** * Prepares a phrase from an unescaped lucene string * * @param string $str * @return string * @link http://docs.php.net/manual/en/solrutils.queryphrase.php */ public static function queryPhrase($str) {} } /** * Represents a field in a Solr document. All its properties are read-only. * * @author Israel Ekpo */ class SolrDocumentField { /** * The name of the field * * @var string */ public $name; /** * The boost value for the field * * @var float */ public $boost; /** * An array of values for this field * @var array */ public $values; /** * Constructor */ public function __construct() {} /** * Destructor */ public function __destruct() {} } /** * Represents a Solr document that is about to be submitted to the Solr index * * @link http://docs.php.net/manual/en/class.solrinputdocument.php * @author Israel Ekpo */ final class SolrInputDocument { /** * Sorts the fields in ascending order */ const SORT_DEFAULT = 1 ; /** * Sorts the fields in ascending order */ const SORT_ASC = 1 ; /** * Sorts the fields in descending order */ const SORT_DESC = 2 ; /** * Sorts the fields by name */ const SORT_FIELD_NAME = 1 ; /** * Sorts the fields by number of values */ const SORT_FIELD_VALUE_COUNT = 2 ; /** * Sorts the fields by boost value */ const SORT_FIELD_BOOST_VALUE = 4 ; /** * Adds a field to the document * * @param string $fieldName The name of the field * @param string $fieldValue The value for the field * @param float $fieldBoostValue The index time boost for the field. Though this cannot be negative, you can still pass values less than 1.0 but they must be greater than zero. * @link http://docs.php.net/manual/en/solrinputdocument.addfield.php */ public function addField($fieldName, $fieldValue, $fieldBoostValue = 0.0) {} /** * Resets the document by dropping all the fields and resets the document boost to zero * * @link http://docs.php.net/manual/en/solrinputdocument.clear.php * @return bool Returns TRUE on success or FALSE on failure */ public function clear() {} public function __clone() {} public function __construct() {} public function __destruct() {} /** * Removes a field from the document * @param string $fieldName * @link http://docs.php.net/manual/en/solrinputdocument.deletefield.php */ public function deleteField($fieldName) {} /** * Checks if a field exists * * @param $fieldName * @return bool * @link http://docs.php.net/manual/en/solrinputdocument.fieldexists.php */ public function fieldExists($fieldName) {} /** * Retrieves the current boost value for the document * * @return float * @link http://docs.php.net/manual/en/solrinputdocument.getboost.php */ public function getBoost() {} /** * Retrieves a field by name * * @param string $fieldName * @return SolrDocumentField */ public function getField($fieldName) {} /** * Retrieves the boost value for a particular field * * @param string $fieldName * @return float * @link http://docs.php.net/manual/en/solrinputdocument.getfieldboost.php */ public function getFieldBoost($fieldName) {} /** * Returns the number of fields in the document * * @return int * @link http://docs.php.net/manual/en/solrinputdocument.getfieldcount.php */ public function getFieldCount() {} /** * Returns an array containing all the fields in the document * * @return array * @link http://docs.php.net/manual/en/solrinputdocument.getfieldnames.php */ public function getFieldNames() {} /** * Merges one input document into another * * @param SolrInputDocument $sourceDoc * @param bool $overwrite * @link http://docs.php.net/manual/en/solrinputdocument.merge.php */ public function merge(SolrInputDocument $sourceDoc, $overwrite = true) {} /** * This is an alias of SolrInputDocument::clear * * @return bool * @link http://docs.php.net/manual/en/solrinputdocument.reset.php */ public function reset() {} /** * Sets the boost value for this document * * @param float $documentBoostValue * @link http://docs.php.net/manual/en/solrinputdocument.setboost.php */ public function setBoost($documentBoostValue) {} /** * Sets the index-time boost value for a field * * @param string $fieldName * @param float $fieldBoostValue * @link http://docs.php.net/manual/en/solrinputdocument.setfieldboost.php */ public function setFieldBoost($fieldName, $fieldBoostValue) {} /** * Sorts the fields within the document * * @param int $sortOrderBy * @param int $sortDirection One of the SolrInputDocument::SORT_* constants * @link http://docs.php.net/manual/en/solrinputdocument.sort.php */ public function sort($sortOrderBy, $sortDirection = SolrInputDocument::SORT_ASC) {} /** * Returns an array representation of the input document * * @return array * @link http://docs.php.net/manual/en/solrinputdocument.toarray.php */ public function toArray() {} /** * Adds a child document * * @param SolrInputDocument $child * @return void * @throws SolrIllegalArgumentException * @throws SolrException */ public function addChildDocument(SolrInputDocument $child) {} /** * Adds child documents * * @param array $children * @return void * @throws SolrIllegalArgumentException * @throws SolrException */ public function addChildDocuments(array $children) {} /** * Whether this input document has child documents * * @return bool */ public function hasChildDocuments() {} /** * Returns an array of child documents (SolrInputDocument) * * @return array */ public function getChildDocuments() {} /** * Returns the number of child documents * * @return int */ public function getChildDocumentsCount() {} } /** * Represents a Solr document retrieved from a query response * * @link http://docs.php.net/manual/en/class.solrdocument.php * @author Israel Ekpo * @author Omar Shaban */ final class SolrDocument implements ArrayAccess, Iterator, Serializable { const SORT_DEFAULT = 1 ; const SORT_ASC = 1 ; const SORT_DESC = 2 ; const SORT_FIELD_NAME = 1 ; const SORT_FIELD_VALUE_COUNT = 2 ; const SORT_FIELD_BOOST_VALUE = 4 ; public function __construct() {} public function __clone() {} public function __destruct() {} /** * Adds a field to the document * * @param string $fieldName * @param string $fieldValue * @return Returns TRUE on success or FALSE on failure * @link http://docs.php.net/manual/en/solrdocument.addfield.php */ public function addField($fieldName, $fieldValue) {} /** * Drops all the fields in the document * * @return Returns TRUE on success or FALSE on failure * @link http://docs.php.net/manual/en/solrdocument.addfield.php */ public function clear() {} /** * Retrieves the current field * * @return SolrDocumentField * @link http://docs.php.net/manual/en/solrdocument.current.php */ public function current() {} /** * Removes a field from the document * * @param string $fieldName * @link http://docs.php.net/manual/en/solrdocument.deletefield.php */ public function deleteField($fieldName) {} /** * Checks if a field exists in the document * @param string $fieldName * @return Returns TRUE if the field is present and FALSE if it does not * @link http://docs.php.net/manual/en/solrdocument.fieldexists.php */ public function fieldExists($fieldName) {} /** * Magic method for accessing the field as a property * * @param string $fieldName * @link http://docs.php.net/manual/en/solrdocument.get.php */ public function __get($fieldName) {} /** * Retrieves a field by name * * @param string $fieldName * @return SolrDocumentField */ public function getField($fieldName) {} /** * Returns the number of fields in this document. Multi-value fields are only counted once. * * @return int * @link http://docs.php.net/manual/en/solrdocument.getfieldcount.php */ public function getFieldCount() {} /** * Returns an array of fields names in the document * * @return array * @link http://docs.php.net/manual/en/solrdocument.getfieldcount.php */ public function getFieldNames() {} /** * Returns a SolrInputDocument equivalent of the object * * @return SolrInputDocument * @link http://docs.php.net/manual/en/solrdocument.getinputdocument.php */ public function getInputDocument() {} public function __isset($fieldName) {} public function key() {} /** * Merges source to the current SolrDocument * * @param SolrDocument $sourceDoc * @param bool $overwrite * @link http://docs.php.net/manual/en/solrdocument.merge.php */ public function merge(SolrDocument $sourceDoc, $overwrite = true) {} public function next() {} public function offsetExists($fieldName) {} public function offsetGet($fieldName) {} public function offsetSet($fieldName, $fieldValue) {} public function offsetUnset($fieldName) {} public function reset() {} public function rewind() {} public function serialize() {} public function __set($fieldName, $fieldValue) {} public function sort($sortOrderBy, $sortDirection) {} public function toArray() {} public function unserialize($serialized) {} public function __unset($fieldName) {} public function valid() {} /** * Checks whether this document contains child documents * * @return bool */ public function hasChildDocuments() {} /** * Returns an array of child documents (SolrDocument) * * @return array */ public function getChildDocuments() {} /** * Returns the number of child documents * * @return int */ public function getChildDocumentsCount() {} } /** * * @author Israel Ekpo */ class SolrObject implements ArrayAccess { /* Methods */ public function __construct() {} public function __destruct() {} public function getPropertyNames() {} public function offsetExists($property_name) {} public function offsetGet($property_name) {} public function offsetSet($property_name, $property_value) {} public function offsetUnset($property_name) {} } /** * * @author Israel Ekpo * @author Omar Shaban */ final class SolrClient { /* Constants */ const SEARCH_SERVLET_TYPE = 1 ; const UPDATE_SERVLET_TYPE = 2 ; const THREADS_SERVLET_TYPE = 4 ; const PING_SERVLET_TYPE = 8 ; const TERMS_SERVLET_TYPE = 16 ; const SYSTEM_SERVLET_TYPE = 32; const DEFAULT_SEARCH_SERVLET = 'select' ; const DEFAULT_UPDATE_SERVLET = 'update' ; const DEFAULT_THREADS_SERVLET = 'admin/threads' ; const DEFAULT_PING_SERVLET = 'admin/ping' ; const DEFAULT_TERMS_SERVLET = 'terms' ; const DEFAULT_SYSTEM_SERVLET = 'admin/system' ; /** * Constructor * * @param array $clientOptions */ public function __construct(array $clientOptions) {} public function __destruct() {} /** * Adds a document to the index * * @param SolrInputDocument $doc * @param bool $overwrite * @param int $commitWithin 0 means disabled * @return SolrUpdateResponse */ public function addDocument(SolrInputDocument &$doc, $overwrite = true, $commitWithin = 0) {} /** * Adds a collection of SolrInputDocument instances to the index * * @param array $docs An array of SolrInputDocument objects * @param bool $overwrite * @param int $commitWithin * @return SolrUpdateResponse */ public function addDocuments(array &$docs, $overwrite = true, $commitWithin = 0) {} /** * Finalizes all add/deletes made to the index * * @param bool $softCommit * @param bool $waitSearcher * @param bool $expungeDeletes * @return SolrUpdateResponse */ public function commit($softCommit = false, $waitSearcher = true, $expungeDeletes = false) {} /** * Get Document By Id. Utilizes Solr Realtime Get (RTG). * * @param string $id * @return SolrQueryResponse */ public function getById($id) {} /** * Get Documents by their Ids. Utilizes Solr Realtime Get (RTG). * * @param array $ids * @return SolrQueryResponse */ public function getByIds(array $ids) {} /** * Deletes the document with the specified ID. * * Where ID is the value of the uniqueKey field declared in the schema * * @param string $id * @return SolrUpdateResponse */ public function deleteById($id) {} /** * Deletes a collection of documents with the specified set of ids * * @param array $ids * @return SolrUpdateResponse */ public function deleteByIds(array $ids) {} /** * Removes all documents matching any of the queries * * @param array $queries * @return SolrUpdateResponse */ public function deleteByQueries(array $queries) {} /** * Deletes all documents matching the given query * * @param string $query * @return SolrUpdateResponse */ public function deleteByQuery($query) {} /** * Returns the debug data for the last connection attempt * * @return string */ public function getDebug() {} /** * Returns the client options set internally * * @return array */ public function getOptions() {} /** * Defragments the index for faster search performance * * @param int $maxSegments * @param bool $softCommit * @param bool $waitSearcher * @return SolrUpdateResponse */ public function optimize($maxSegments = 1, $softCommit = false, $waitSearcher = true) {} /** * Checks if Solr server is still up * * @return SolrPingResponse */ public function ping() {} /** * Sends a query to the server * * @param SolrParams $query * @return SolrQueryResponse */ public function query(SolrParams $query) {} /** * Sends a raw XML update request to the server * * @param string $raw_request * @return SolrUpdateResponse */ public function request($raw_request) {} /** * Rollbacks all add/deletes made to the index since the last commit * * @return SolrUpdateResponse */ public function rollback() {} /** * Changes the specified servlet type to a new value * * @param int $type * @param string $value * * @return bool * @link http://docs.php.net/manual/en/solrclient.setservlet.php */ public function setServlet($type, $value) {} /** * Checks the threads status * * @return SolrGenericResponse * @link http://docs.php.net/manual/en/solrclient.threads.php */ public function threads() {} /** * Retrieve Solr Server System Information * * @return SolrGenericResponse */ public function system() {} } /** * * @author Israel Ekpo */ class SolrResponse { /* Constants */ const PARSE_SOLR_OBJ = 0 ; const PARSE_SOLR_DOC = 1 ; /* Properties */ protected $http_status; protected $parser_mode; protected $success; protected $http_status_message; protected $http_request_url; protected $http_raw_request_headers; protected $http_raw_request; protected $http_raw_response_headers; protected $http_raw_response; protected $http_digested_response; /* Methods */ public function __construct() {} public function __destruct() {} /** * Returns the XML response as serialized PHP data * * @return string * @link http://docs.php.net/manual/en/solrresponse.getdigestedresponse.php */ public function getDigestedResponse() {} /** * @return int * @link http://docs.php.net/manual/en/solrresponse.gethttpstatus.php */ public function getHttpStatus() {} /** * @return string * @link http://docs.php.net/manual/en/solrresponse.gethttpstatusmessage.php */ public function getHttpStatusMessage() {} /** * @return string * @link http://docs.php.net/manual/en/solrresponse.getrawrequest.php */ public function getRawRequest() {} /** * @return string * @link http://docs.php.net/manual/en/solrresponse.getrawrequestheaders.php */ public function getRawRequestHeaders() {} /** * @return string * @link http://docs.php.net/manual/en/solrresponse.getrawresponse.php */ public function getRawResponse() {} /** * Returns the raw response headers from the server * * @return string * @link http://docs.php.net/manual/en/solrresponse.getrawresponseheaders.php */ public function getRawResponseHeaders() {} /** * Returns the full URL the request was sent to * * @return string * @link http://docs.php.net/manual/en/solrresponse.getrequesturl.php */ public function getRequestUrl() {} /** * Returns a SolrObject representing the XML response from the server * * @return SolrObject * @link http://docs.php.net/manual/en/solrresponse.getresponse.php */ public function getResponse() {} /** * @param int $parser_mode * @return bool * @link http://docs.php.net/manual/en/solrresponse.setparsemode.php */ public function setParseMode($parser_mode) {} /** * @return bool * @link http://docs.php.net/manual/en/solrresponse.success.php */ public function success() {} } /** * * @author Israel Ekpo */ class SolrQueryResponse extends SolrResponse { } /** * * @author Israel Ekpo */ class SolrUpdateResponse extends SolrResponse { } /** * * @author Israel Ekpo */ class SolrPingResponse extends SolrResponse { } /** * * @author Israel Ekpo */ class SolrGenericResponse extends SolrResponse { } /** * * @author Israel Ekpo */ abstract class SolrParams implements Serializable { /** * This is an alias for SolrParams::addParam * * @param $name * @param $value * @return SolrParams */ public function add($name, $value) {} /** * Adds a parameter to the object * * @param string $name Param name * @param string $value Param value * @return SolrParams */ public function addParam($name, $value) {} /** * This is an alias for SolrParams::getParam * * Returns an array or string depending on the type of parameter * * @param string $param_name * * @return mixed */ public function get($param_name) {} /** * Returns an array or string depending on the type of parameter * * @param string $param_name * * @return mixed */ public function getParam($param_name) {} /** * Returns an array of non URL-encoded parameters * * @return array */ public function getParams() {} /** * Returns an array on URL-encoded parameters * * @return array */ public function getPreparedParams() {} /** * Used for custom serialization * * @return string */ public function serialize() {} /** * * @param $name * @param $value * @return SolrParams */ public function set($name, $value) {} /** * * @param $name * @param $value * @return SolrParams */ public function setParam($name, $value) {} /** * Returns all the name-value pair parameters in the object * * @param bool $url_encode Whether to return URL-encoded values * * @return string */ public function toString($url_encode) {} /** * Used for Custom serialization * * @param string $serialized * @return void */ public function unserialize($serialized) {} } /** * Represents a collection of name-value pairs sent to the Solr server during a request * * @author Israel Ekpo */ class SolrModifiableParams extends SolrParams implements Serializable { public function __construct() {} public function __destruct() {} /** * This is an alias for SolrParams::addParam * * @param $name * @param $value * @return SolrModifiableParams */ public function add($name, $value) {} /** * Adds a parameter to the object * * @param string $name Param name * @param string $value Param value * @return SolrParams */ public function addParam($name, $value) {} /** * Returns an array on URL-encoded parameters * * @return array */ public function getPreparedParams() {} /** * Used for custom serialization * * @return string */ public function serialize() {} /** * * @param $name * @param $value * @return SolrModifiableParams */ public function set($name, $value) {} /** * * @param $name * @param $value * @return SolrModifiableParams */ public function setParam($name, $value) {} /** * Returns all the name-value pair parameters in the object * * @param bool $url_encode Whether to return URL-encoded values * * @return string */ public function toString($url_encode) {} /** * Used for Custom serialization * * @param string $serialized * @return void */ public function unserialize($serialized) {} } /** * * @author Israel Ekpo * @author Omar Shaban */ class SolrQuery extends SolrModifiableParams implements Serializable { /* Constants */ const ORDER_ASC = 0 ; const ORDER_DESC = 1 ; const FACET_SORT_INDEX = 0 ; const FACET_SORT_COUNT = 1 ; const TERMS_SORT_INDEX = 0 ; const TERMS_SORT_COUNT = 1 ; /** * * @param string $q Query string */ public function __construct($q = null) {} public function __destruct() {} /** * This is an alias for SolrParams::addParam * * @param $name * @param $value * @return SolrQuery */ public function add($name, $value) {} /** * Adds a parameter to the object * * @param string $name Param name * @param string $value Param value * @return SolrParams */ public function addParam($name, $value) {} /** * This is an alias for SolrParams::getParam * * Returns an array or string depending on the type of parameter * * @param string $param_name * * @return mixed */ public function get($param_name) {} /** * Returns an array or string depending on the type of parameter * * @param string $param_name * * @return mixed */ public function getParam($param_name) {} /** * Returns an array of non URL-encoded parameters * * @return array */ public function getParams() {} /** * Returns an array on URL-encoded parameters * * @return array */ public function getPreparedParams() {} /** * Used for custom serialization * * @return string */ public function serialize() {} /** * * @param $name * @param $value * @return SolrQuery */ public function set($name, $value) {} /** * * @param $name * @param $value * @return SolrQuery */ public function setParam($name, $value) {} /** * Returns all the name-value pair parameters in the object * * @param bool $url_encode Whether to return URL-encoded values * * @return string */ public function toString($url_encode) {} /** * Used for Custom serialization * * @param string $serialized * @return void */ public function unserialize($serialized) {} /** * @param string $dateField * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addfacetdatefield.php */ public function addFacetDateField($dateField) {} /** * Adds another facet.date.other parameter * * @param string $value * @param string $field_override [optional] Field name for the override * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addfacetdateother.php */ public function addFacetDateOther($value, $field_override = null) {} /** * Adds another field to the facet * * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addfacetfield.php */ public function addFacetField($field) {} /** * @param string $facetQuery * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addfacetquery.php */ public function addFacetQuery($facetQuery) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addfield.php */ public function addField($field) {} /** * @param string $fq * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addfilterquery.php */ public function addFilterQuery($fq) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addhighlightfield.php */ public function addHighlightField($field) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addmltfield.php */ public function addMltField($field) {} /** * @param string $field * @param float $boost * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addmltqueryfield.php */ public function addMltQueryField($field, $boost) {} /** * @param string $field * @param int $order * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addsortfield.php */ public function addSortField($field, $order) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addstatsfacet.php */ public function addStatsFacet($field) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addstatsfield.php */ public function addStatsField($field) {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.getfacet.php */ public function getFacet() {} /** * @param string $field_override [optional] * @return string * @link http://docs.php.net/manual/en/solrquery.getfacetdateend.php */ public function getFacetDateEnd($field_override = null) {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getfacetdatefields.php */ public function getFacetDateFields() {} /** * @param string $field_override [optional] * @return string * @link http://docs.php.net/manual/en/solrquery.getfacetdategap.php */ public function getFacetDateGap($field_override = null) {} /** * @param string $field_override [optional] * @return string * @link http://docs.php.net/manual/en/solrquery.getfacetdatehardend.php */ public function getFacetDateHardEnd($field_override = null) {} /** * @param string $field_override [optional] * @return array * @link http://docs.php.net/manual/en/solrquery.getfacetdateother.php */ public function getFacetDateOther($field_override = null) {} /** * @param string $field_override [optional] * @return string * @link http://docs.php.net/manual/en/solrquery.getfacetdatestart.php */ public function getFacetDateStart($field_override = null) {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getfacetfields.php */ public function getFacetFields() {} /** * @param string $field_override [optional] * @return int * @link http://docs.php.net/manual/en/solrquery.getfacetlimit.php */ public function getFacetLimit($field_override) {} /** * @param string $field_override [optional] * @return string * @link http://docs.php.net/manual/en/solrquery.getfacetmethod.php */ public function getFacetMethod($field_override) {} /** * @param string $field_override [optional] * @return int * @link http://docs.php.net/manual/en/solrquery.getfacetmincount.php */ public function getFacetMinCount($field_override) {} /** * @param string $field_override [optional] * * @return bool * @link http://docs.php.net/manual/en/solrquery.getfacetmissing.php */ public function getFacetMissing($field_override) {} /** * @param string $field_override [optional] * * @return int * @link http://docs.php.net/manual/en/solrquery.getfacetoffset.php */ public function getFacetOffset($field_override) {} /** * @param string $field_override [optional] * * @return string * @link http://docs.php.net/manual/en/solrquery.getfacetprefix.php */ public function getFacetPrefix($field_override) {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getfacetqueries.php */ public function getFacetQueries() {} /** * @param string $field_override [optional] * * @return int * @link http://docs.php.net/manual/en/solrquery.getfacetsort.php */ public function getFacetSort($field_override) {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getfields.php */ public function getFields() {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getfilterqueries.php */ public function getFilterQueries() {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.gethighlight.php */ public function getHighlight() {} /** * @param string $field_override [optional] * * @return string * @link http://docs.php.net/manual/en/solrquery.gethighlightalternatefield.php */ public function getHighlightAlternateField($field_override = null) {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.gethighlightfields.php */ public function getHighlightFields() {} /** * @param string $field_override [optional] * * @return string * @link http://docs.php.net/manual/en/solrquery.gethighlightformatter.php */ public function getHighlightFormatter($field_override = null) {} /** * @param string $field_override [optional] * @return string * @link http://docs.php.net/manual/en/solrquery.gethighlightfragmenter.php */ public function getHighlightFragmenter($field_override = null) {} /** * @param string $field_override [optional] * @return int * @link http://docs.php.net/manual/en/solrquery.gethighlightfragsize.php */ public function getHighlightFragsize($field_override = null) {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.gethighlighthighlightmultiterm.php */ public function getHighlightHighlightMultiTerm() {} /** * @param string $field_override [optional] * @return int * @link http://docs.php.net/manual/en/solrquery.gethighlightmaxalternatefieldlength.php */ public function getHighlightMaxAlternateFieldLength($field_override = null) {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.gethighlightmaxanalyzedchars.php */ public function getHighlightMaxAnalyzedChars() {} /** * @param string $field_override [optional] * @return bool * @link http://docs.php.net/manual/en/solrquery.gethighlightmergecontiguous.php */ public function getHighlightMergeContiguous($field_override = null) {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.gethighlightregexmaxanalyzedchars.php */ public function getHighlightRegexMaxAnalyzedChars() {} /** * @return string * @link http://docs.php.net/manual/en/solrquery.gethighlightregexpattern.php */ public function getHighlightRegexPattern() {} /** * @return float * @link http://docs.php.net/manual/en/solrquery.gethighlightregexslop.php */ public function getHighlightRegexSlop() {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.gethighlightrequirefieldmatch.php */ public function getHighlightRequireFieldMatch() {} /** * @param string $field_override [optional] * @return string * @link http://docs.php.net/manual/en/solrquery.gethighlightsimplepost.php */ public function getHighlightSimplePost($field_override = null) {} /** * @param string $field_override [optional] * @return string * @link http://docs.php.net/manual/en/solrquery.gethighlightsimplepre.php */ public function getHighlightSimplePre($field_override = null) {} /** * @param string $field_override [optional] * @return int * @link http://docs.php.net/manual/en/solrquery.gethighlightsnippets.php */ public function getHighlightSnippets($field_override = null) {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.gethighlightusephrasehighlighter.php */ public function getHighlightUsePhraseHighlighter() {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.getmlt.php */ public function getMlt() {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.getmltboost.php */ public function getMltBoost() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.getmltcount.php */ public function getMltCount() {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getmltfields.php */ public function getMltFields() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.getmltmaxnumqueryterms.php */ public function getMltMaxNumQueryTerms() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.getmltmaxnumtokens.php */ public function getMltMaxNumTokens() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.getmltmaxwordlength.php */ public function getMltMaxWordLength() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.getmltmindocfrequency.php */ public function getMltMinDocFrequency() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.getmltmintermfrequency.php */ public function getMltMinTermFrequency() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.getmltminwordlength.php */ public function getMltMinWordLength() {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getmltqueryfields.php */ public function getMltQueryFields() {} /** * @return string * @link http://docs.php.net/manual/en/solrquery.getquery.php */ public function getQuery() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.getrows.php */ public function getRows() {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getsortfields.php */ public function getSortFields() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.getstart.php */ public function getStart() {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.getstats.php */ public function getStats() {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getstatsfacets.php */ public function getStatsFacets() {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getstatsfields.php */ public function getStatsFields() {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.getterms.php */ public function getTerms() {} /** * @return string * @link http://docs.php.net/manual/en/solrquery.gettermsfield.php */ public function getTermsField() {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.gettermsincludelowerbound.php */ public function getTermsIncludeLowerBound() {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.gettermsincludeupperbound.php */ public function getTermsIncludeUpperBound() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.gettermslimit.php */ public function getTermsLimit() {} /** * @return string * @link http://docs.php.net/manual/en/solrquery.gettermslowerbound.php */ public function getTermsLowerBound() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.gettermsmaxcount.php */ public function getTermsMaxCount() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.gettermsmincount.php */ public function getTermsMinCount() {} /** * @return string * @link http://docs.php.net/manual/en/solrquery.gettermsprefix.php */ public function getTermsPrefix() {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.gettermsreturnraw.php */ public function getTermsReturnRaw() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.gettermssort.php */ public function getTermsSort() {} /** * @return string * @link http://docs.php.net/manual/en/solrquery.gettermsupperbound.php */ public function getTermsUpperBound() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.gettimeallowed.php */ public function getTimeAllowed() {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removefacetdatefield.php */ public function removeFacetDateField($field) {} /** * @param string $value * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removefacetdateother.php */ public function removeFacetDateOther($value, $field_override) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removefacetfield.php */ public function removeFacetField($field) {} /** * @param string $value * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removefacetquery.php */ public function removeFacetQuery($value) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removefield.php */ public function removeField($field) {} /** * @param string $fq * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removefilterquery.php */ public function removeFilterQuery($fq) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removehighlightfield.php */ public function removeHighlightField($field) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removemltfield.php */ public function removeMltField($field) {} /** * @param string $queryField * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removemltqueryfield.php */ public function removeMltQueryField($queryField) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removesortfield.php */ public function removeSortField($field) {} /** * @param string $value * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removestatsfacet.php */ public function removeStatsFacet($value) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removestatsfield.php */ public function removeStatsField($field) {} /** * @param bool $flag * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setechohandler.php */ public function setEchoHandler($flag) {} /** * @param string $type * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setechoparams.php */ public function setEchoParams($type) {} /** * @param string $query * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setexplainother.php */ public function setExplainOther($query) {} /** * @param bool $flag * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacet.php */ public function setFacet($flag) {} /** * @param string $value * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetdateend.php */ public function setFacetDateEnd($value, $field_override) {} /** * @param string $value * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetdategap.php */ public function setFacetDateGap($value, $field_override) {} /** * @param bool $value * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetdatehardend.php */ public function setFacetDateHardEnd($value, $field_override) {} /** * @param string $value * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetdatestart.php */ public function setFacetDateStart($value, $field_override) {} /** * @param int $frequency * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetenumcachemindefaultfrequency.php */ public function setFacetEnumCacheMinDefaultFrequency($frequency, $field_override = null) {} /** * @param int $limit * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetlimit.php */ public function setFacetLimit($limit, $field_override = null) {} /** * @param string $method * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetmethod.php */ public function setFacetMethod($method, $field_override = null) {} /** * @param int $mincount * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetmincount.php */ public function setFacetMinCount($mincount, $field_override = null) {} /** * @param bool $flag * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetmissing.php */ public function setFacetMissing($flag, $field_override = null) {} /** * @param int $offset * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetoffset.php */ public function setFacetOffset($offset, $field_override = null) {} /** * @param string $prefix * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetprefix.php */ public function setFacetPrefix($prefix, $field_override = null) {} /** * @param int $facetSort * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetsort.php */ public function setFacetSort($facetSort, $field_override = null) {} /** * Enables or disables highlighting * * @param bool $flag * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlight.php */ public function setHighlight($flag) {} /** * Specifies the highlithing backup field to use * * @param string $field * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightalternatefield.php */ public function setHighlightAlternateField($field, $field_override = null) {} /** * Specify a formatter for the highlight output * * @param string $formatter * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightformatter.php */ public function setHighlightFormatter($formatter, $field_override) {} /** * Sets a text snippet generator for highlighted text * * @param string $fragmenter * @param string $field_override * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightfragmenter.php */ public function setHighlightFragmenter($fragmenter, $field_override = null) {} /** * The size of fragments to consider for highlighting * * @param int $size Size (in characters) of fragments to consider for highlighting * @param string $field_override Name of the field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightfragsize.php */ public function setHighlightFragsize($size, $field_override = null) {} /** * @param bool $flag * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlighthighlightmultiterm.php */ public function setHighlightHighlightMultiTerm($flag) {} /** * Sets the maximum number of characters of the field to return * * @param int $fieldLength Length of the field * @param string $field_override Name of the field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightmaxalternatefieldlength.php */ public function setHighlightMaxAlternateFieldLength($fieldLength, $field_override = null) {} /** * Specifies the number of characters into a document to look for suitable snippets * * @param int $value The number of characters into a document to look for suitable snippets * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightmaxanalyzedchars.php */ public function setHighlightMaxAnalyzedChars($value) {} /** * Sets whether or not to collapse contiguous fragments into a single fragment * * @param bool $flag Whether or not to collapse contiguous fragments into a single fragment * @param null $field_override * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightmergecontiguous.php */ public function setHighlightMergeContiguous($flag, $field_override = null) {} /** * Specify the maximum number of characters to analyze * * @param int $maxAnalyzedChars * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightregexmaxanalyzedchars.php */ public function setHighlightRegexMaxAnalyzedChars($maxAnalyzedChars) {} /** * Specify the regular expression for fragmenting * * @param string $value The regular expression for fragmenting. This could be used to extract sentences * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightregexpattern.php */ public function setHighlightRegexPattern($value) {} /** * Sets the factor by which the regex fragmenter can stray from the ideal fragment size * * @param float $factor The factor by which the regex fragmenter can stray from the ideal fragment size * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightregexslop.php */ public function setHighlightRegexSlop($factor) {} /** * Sets whether field matching is required when highlighting * * @param bool $flag If TRUE, then a field will only be highlighted if the query * matched in this particular field. This will only work if * SolrQuery::setHighlightUsePhraseHighlighter() was set to TRUE * * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightrequirefieldmatch.php */ public function setHighlightRequireFieldMatch($flag) {} /** * Sets the text which appears after a highlighted term * * @param string $simplePost * @param string $field_override [optional] Name of the field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightsimplepost.php */ public function setHighlightSimplePost($simplePost, $field_override = null) {} /** * Sets the text which appears before a highlighted term * * @param string $simplePre * @param string $field_override [optional] Name of the field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightsimplepre.php */ public function setHighlightSimplePre($simplePre, $field_override = null) {} /** * @param int $value Maximum number of highlighted snippets to generate per field * @param string $field_override [optional] Name of the field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightsnippets.php */ public function setHighlightSnippets($value, $field_override = null) {} /** * Whether to highlight phrase terms only when they appear within the query phrase * * @param bool $flag * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightusephrasehighlighter.php */ public function setHighlightUsePhraseHighlighter($flag) {} /** * Enables or disables moreLikeThis * * @param bool $flag TRUE enables it and FALSE turns it off * * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setmlt.php */ public function setMlt($flag) {} /** * Set if the query will be boosted by the interesting term relevance * * @param bool $flag * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setmltboost.php */ public function setMltBoost($flag) {} /** * Set the number of similar documents to return for each result * * @param int $count * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setmltcount.php */ public function setMltCount($count) {} /** * Sets the maximum number of query terms included * * @param int $value The maximum number of query terms that will be included in any generated query * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setmltmaxnumqueryterms.php */ public function setMltMaxNumQueryTerms($value) {} /** * Specifies the maximum number of tokens to parse * * @param int $value The maximum number of tokens to parse * * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setmltmaxnumtokens.php */ public function setMltMaxNumTokens($value) {} /** * Sets the maximum word length * * @param int $maxWordLength The maximum word length above which words will be ignored * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setmltmaxwordlength.php */ public function setMltMaxWordLength($maxWordLength) {} /** * The frequency at which words will be ignored which do not occur in at least this many docs * * @param int $minDocFrequency * * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setmltmindocfrequency.php */ public function setMltMinDocFrequency($minDocFrequency) {} /** * Sets the frequency below which terms will be ignored in the source docs * * @param int $minTermFrequency * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setmltmintermfrequency.php */ public function setMltMinTermFrequency($minTermFrequency) {} /** * Sets the minimum word length below which words will be ignored * * @param int $minWordLength * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setmltminwordlength.php */ public function setMltMinWordLength($minWordLength) {} /** * Exclude the header from the returned results * * @param bool $flag TRUE excludes the header from the result * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setomitheader.php */ public function setOmitHeader($flag) {} /** * Sets the search query * * @param string $query * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setquery.php */ public function setQuery($query) {} /** * Specifies the maximum number of rows to return in the result * * @param int $rows * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setrows.php */ public function setRows($rows) {} /** * Flag to show debug information * * @param bool $flag * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setshowdebuginfo.php */ public function setShowDebugInfo($flag) {} /** * Specifies the number of rows to skip * * @param int $start * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setstart.php */ public function setStart($start) {} /** * Enables or disables the Stats component * * @param bool $flag * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setstats.php */ public function setStats($flag) {} /** * Enables or disables the TermsComponent * * @param bool $flag * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setterms.php */ public function setTerms($flag) {} /** * Sets the name of the field to get the Terms from * * @param string $fieldname * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermsfield.php */ public function setTermsField($fieldname) {} /** * Sets whether to include the lower bound term in the result set * * @param bool $flag * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermsincludelowerbound.php */ public function setTermsIncludeLowerBound($flag) {} /** * Include the upper bound term in the result set * * @param bool $flag * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermsincludeupperbound.php */ public function setTermsIncludeUpperBound($flag) {} /** * Sets the maximum number of terms to return * * @param int $limit * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermslimit.php */ public function setTermsLimit($limit) {} /** * Specifies the Term to start from * * @param string $lowerBound * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermslowerbound.php */ public function setTermsLowerBound($lowerBound) {} /** * Sets the maximum document frequency * * @param int $frequency * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermsmaxcount.php */ public function setTermsMaxCount($frequency) {} /** * Sets the minimum document frequency * * @param int $frequency * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermsmincount.php */ public function setTermsMinCount($frequency) {} /** * Restrict matches to terms that start with the prefix * * @param string $prefix * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermsprefix.php */ public function setTermsPrefix($prefix) {} /** * Return the raw characters of the indexed term * * @param bool $flag * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermsreturnraw.php */ public function setTermsReturnRaw($flag) {} /** * Specifies how to sort the returned terms * * @param int $sortType If SolrQuery::TERMS_SORT_COUNT, sorts the terms by the term frequency (highest count first). If SolrQuery::TERMS_SORT_INDEX, returns the terms in index order * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermssort.php */ public function setTermsSort($sortType) {} /** * Sets the term to stop at * * @param string $upperBound * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermsupperbound.php */ public function setTermsUpperBound($upperBound) {} /** * The time allowed for search to finish * * @param int $timeAllowed Time in milliseconds * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settimeallowed.php */ public function setTimeAllowed($timeAllowed) {} /** * Collapses the result set to a single document per group before it forwards * the result set to the rest of the search components. * So all downstream components (faceting, highlighting, etc...) will work with * the collapsed result set. * * A collapse function object is passed to collapse the query * * @param SolrCollapseFunction $function * @throws SolrMissingMandatoryParameterException * @return SolrQuery */ public function collapse(SolrCollapseFunction $function) {} /** * Enable/Disable result grouping (group parameter) * * @param bool $value * @return SolrQuery */ public function setGroup($value) {} /** * Returns true if grouping is enabled * @return bool */ public function getGroup() {} /** * The name of the field by which to group results. The field must be single-valued, and either be indexed * or a field type that has a value source and works in a function query, * such as ExternalFileField. It must also be a string-based field, such as StrField or TextField * * @param string $value * @return SolrQuery */ public function addGroupField($value) {} /** * Returns group fields (group.field parameter values) * * @return array */ public function getGroupFields() {} /** * Adds a group function (group.func parameter) * Allows grouping results based on the unique values of a function query. * * @param string $value * @return SolrQuery */ public function addGroupFunction($value) {} /** * Returns group functions (group.func parameter values) * * @return array */ public function getGroupFunctions () {} /** * Adds query to the group.query parameter * Allows grouping of documents that match the given query. * * @param string $value * @return SolrQuery */ public function addGroupQuery($value) {} /** * Returns all the group.query parameter values * * @return array */ public function getGroupQueries() {} /** * Specifies the number of results to return for each group. The server default value is 1. * * @param integer $value * @return SolrQuery */ public function setGroupLimit($value) {} /** * Returns the group.limit value * @return integer */ public function getGroupLimit() {} /** * Sets the group.offset parameter. * @param integer $offset * @return SolrQuery */ public function setGroupOffset($offset) {} /** * Returns the group.offset value * * @return integer */ public function getGroupOffset() {} /** * Adds a group sort field (group.sort parameter). * * @param string $sort * @param integer $direction * @return SolrQuery */ public function addGroupSortField($sort, $direction) {} /** * Returns the group.sort value * * @return array */ public function getGroupSortFields() {} /** * Sets the group.format parameter. * If this parameter is set to simple, the grouped documents are presented in a single flat list, and the start and * rows parameters affect the numbers of documents instead of groups. * * @param string $value * @return SolrQuery */ public function setGroupFormat($value) {} /** * Returns the group.format value * * @return string */ public function getGroupFormat() {} /** * If true, the result of the first field grouping command is used as the main result list in the response, using group.format=simple. * * @param bool $value * @return SolrQuery */ public function setGroupMain($value) {} /** * Returns the group.main value * * @return bool */ public function getGroupMain() {} /** * If true, Solr includes the number of groups that have matched the query in the results. * The default value is false. (group.ngroups parameter) * * @param bool $value * @return SolrQuery */ public function setGroupNGroups($value) {} /** * Returns the group.ngroups value * @return bool */ public function getGroupNGroups() {} /** * If true, facet counts are based on the most relevant document of each group matching the query. * The server default value is false. * group.truncate parameter * * @param bool $value * @return SolrQuery */ public function setGroupTruncate($value) {} /** * Returns the group.truncate value * * @return bool */ public function getGroupTruncate() {} /** * Determines whether to compute grouped facets for the field facets specified in facet.field parameters. * Grouped facets are computed based on the first specified group. * group.facet parameter * * @param bool $value * @return SolrQuery */ public function setGroupFacet($value) {} /** * Returns the group.facet parameter value * * @return bool */ public function getGroupFacet() {} /** * Setting this parameter to a number greater than 0 enables caching for result grouping. * Result Grouping executes two searches; this option caches the second search. The default value is 0. * * Testing has shown that group caching only improves search time with Boolean, wildcard, and fuzzy queries. For simple queries like term or "match all" queries, group caching degrades performance. * group.cache.percent parameter * * @param integer * @throws SolrIllegalArgumentException * @return SolrQuery */ public function setGroupCachePercent($value) {} /** * Returns the group cache percent group.cache.percent value * * @return integer */ public function getGroupCachePercent() {} /** * Sets the expand parameter. This enables or disables group expanding. * * @param bool $value * @return SolrQuery */ public function setExpand($value) {} /** * Returns true if group expanding is enabled * @return bool */ public function getExpand() {} /** * Orders the documents within the expanded groups (expand.sort parameter). * * @param string $sort * @param integer $direction defaults to DESC * @return SolrQuery */ public function addExpandSortField($sort, $direction = SolrQuery::ORDER_DESC) {} /** * Removes an expand sort field from the expand.sort parameter. * * @param string $field * @return SolrQuery */ public function removeExpandSortField($field) {} /** * Returns an array of fields * * @return array */ public function getExpandSortFields() {} /** * Sets the number of rows to display in each group (expand.rows). Server Default 5 * @param integer $rows * @return SolrQuery */ public function setExpandRows($rows) {} /** * Returns The number of rows to display in each group (expand.rows) * * @return integer */ public function getExpandRows() {} /** * Sets the expand.q parameter. Overrides the main q parameter, * determines which documents to include in the main group. * * @param string $q * @return SolrQuery */ public function setExpandQuery($q) {} /** * Returns the expand query expand.q parameter * * @return string */ public function getExpandQuery() {} /** * Overrides main fq's, determines which documents to include in the main group. * * @param string $fq * @return SolrQuery */ public function addExpandFilterQuery($fq) {} /** * Removes an expand filter query. * * @param string $fq * @return SolrQuery */ public function removeExpandFilterQuery($fq) {} /** * Returns the expand filter queries * * @return array */ public function getExpandFilterQueries() {} } /** * SolrDisMaxQuery Makes use of the Solr's DisMax query parser * and eases the use of it using class methods * * @author Omar Shaban */ class SolrDisMaxQuery extends SolrQuery { public function __construct($q = null) {} /** * Switch Query Parser to dismax */ public function useDisMaxQueryParser() {} /** * Switch Query Parser to edismax */ public function useEDisMaxQueryParser() {} /** * Set Query Alternate (q.alt parameter) * When the main q parameter is not specified or is blank. The q.alt parameter is used * * @param string $q */ public function setQueryAlt($q) {} /** * Add a query field with optional boost (qf parameter) * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Theqf%28QueryFields%29Parameter * @param string $field * @param string $boost * @return SolrDisMaxQuery */ public function addQueryField ($field, $boost=null) {} /** * Remove query field (qf parameter) * * @param string $field * @return SolrDisMaxQuery */ public function removeQueryField($field) {} /** * Add a phrase field (pf parameter) * output format: field~slop^boost * * Sample output: title~2^4 * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Thepf%28PhraseFields%29Parameter * @param string $field * @param float $boost * @param integer $slop * @return SolrDisMaxQuery */ public function addPhraseField($field, $boost, $slop=null) {} /** * Removes a phrase field (pf parameter) * @param string $field * @return SolrDisMaxQuery */ public function removePhraseField($field) {} /** * Set Phrase Fields (pf parameter) * @param string $fields * @return SolrDisMaxQuery */ public function setPhraseFields($fields) {} /** * Set Phrase Slop (ps parameter) * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Theps%28PhraseSlop%29Parameter * @param integer $slop * @return SolrDisMaxQuery */ public function setPhraseSlop($slop) {} /** * Set Query Phrase Slop (qs parameter) * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Theqs%28QueryPhraseSlop%29Parameter * @param integer $slop * @return SolrDisMaxQuery */ public function setQueryPhraseSlop($slop) {} /** * Add a boost query field with value and boost * Sample Output: type:lucene^2 * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Thebq%28BoostQuery%29Parameter * * @param string $field * @param string $value * @param string $boost * @return SolrDisMaxQuery */ public function addBoostQuery($field, $value, $boost=null) {} /** * Remove a boost query field * * @param string $field * @return SolrDisMaxQuery */ public function removeBoostQuery($field) {} /** * Sets Boost Query Parameter (bq) * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Thebq%28BoostQuery%29Parameter * * @param string $q * @return SolrDisMaxQuery * */ public function setBoostQuery($q) {} /** * Sets the boost function (bf) * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Thebf%28BoostFunctions%29Parameter * * @param string $function * @return SolrDisMaxQuery */ public function setBoostFunction($function) {} /** * Set Tie Minimum *Should* Match parameter (mm) * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Themm%28MinimumShouldMatch%29Parameter * * @param mixed $value * @return SolrDisMaxQuery */ public function setMinimumMatch($value) {} /** * Set Tie Breaker parameter (tie) * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Thetie%28TieBreaker%29Parameter * @param float $tieBreaker * @return SolrDisMaxQuery */ public function setTieBreaker($tieBreaker) {} /** * Set Bigram Phrase Slop (ps2 parameter) * * @see https://cwiki.apache.org/confluence/display/solr/The+Extended+DisMax+Query+Parser * * @param integer $slop * @return SolrDisMaxQuery */ public function setBigramPhraseSlop($slop) {} /** * Add a phrase Bigram field (pf2 parameter) * output format: field~slop^boost * * Sample output: title~2^4 * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Thepf%28PhraseFields%29Parameter * * @param string $field * @param float $boost * @param integer $slop * @return SolrDisMaxQuery */ public function addBigramPhraseField($field, $boost, $slop=null) {} /** * Removes phrase bigram field (pf2 parameter) * * @param string $field * @return SolrDisMaxQuery */ public function removeBigramPhraseField($field) {} /** * Sets pf2 parameter * * @param string $fields * @return SolrDisMaxQuery */ public function setBigramPhraseFields($fields) {} /** * Add a Trigram Phrase Field (pf3 parameter) * output format: field~slop^boost * * Sample output: title~2^4 * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Thepf%28PhraseFields%29Parameter * @param string $field * @param float $boost * @param integer $slop * @return SolrDisMaxQuery */ public function addTrigramPhraseField($field, $boost, $slop=null) {} /** * Removes a Trigram Phrase Field (pf3 parameter) * @param string $field * @return SolrDisMaxQuery */ public function removeTrigramPhraseField($field) {} /** * Sets pf3 parameter * * @param string $fields * @return SolrDisMaxQuery */ public function setTrigramPhraseFields($fields) {} /** * Set Trigram Phrase Slop (ps3 parameter) * * @see https://cwiki.apache.org/confluence/display/solr/The+Extended+DisMax+Query+Parser * * @param integer $slop * @return SolrDisMaxQuery */ public function setTrigramPhraseSlop ($slop) {} /** * Adds a field to User Fields Parameter (uf) * * Specifies which schema fields the end user shall be allowed to query for explicitly. * This parameter supports wildcards. * * @param string $field * @return SolrDisMaxQuery */ public function addUserField($field){} /** * Removes a field from User Fields Parameter (uf) * * @param string $field * @return SolrDisMaxQuery */ public function removeUserField($field){} /** * Sets User Fields parameter (uf) * * Specifies which schema fields the end user shall be allowed to query for explicitly. * This parameter supports wildcards. * * @param string $fields * @return SolrDisMaxQuery */ public function setUserFields($fields){} } /** * Collapses the result set to a single document per group before it forwards * the result set to the rest of the search components. * So all downstream components (faceting, highlighting, etc...) will work with * the collapsed result set. * * @see https://cwiki.apache.org/confluence/display/solr/Collapse+and+Expand+Results * * @author Omar Shaban */ class SolrCollapseFunction { const NULLPOLICY_IGNORE = 'ignore'; const NULLPOLICY_EXPAND = 'expand'; const NULLPOLICY_COLLAPSE = 'collapse'; /** * Accepts the field to collapse on. * * @param string $field */ public function __construct($field = null) {} /** * Set the field that is being collapsed on. * In order to collapse a result. The field type must be a single valued String, Int or Float. * * @param string $field * @return SolrCollapseFunction */ public function setField($field) {} /** * Get the field that is being collapsed on. * * @return string */ public function getField() {} /** * Selects the group heads by the max value of a numeric field or function query. * * @param string $max * @return SolrCollapseFunction */ public function setMax($max) {} /** * Get max * * @return string */ public function getMax() {} /** * Sets the initial size of the collapse data structures when collapsing on a numeric field only. * * @param string $min * @return SolrCollapseFunction */ public function setMin($min) {} /** * Return min parameter * * @return string */ public function getMin() {} /** * Currently there is only one hint available "top_fc", which stands for top level FieldCache. * * @param string $hint * @return SolrCollapseFunction */ public function setHint($hint) {} /** * Get collapse hint. * * @return string */ public function getHint() {} /** * Sets the NULL Policy. * Accepts ignore, expand, or collapse. * * @param string $policy * @return SolrCollapseFunction */ public function setNullPolicy($policy) {} /** * Returns null policy * * @return string */ public function getNullPolicy() {} /** * Sets the initial size of the collapse data structures when collapsing on a numeric field only. * * @param integer $size * @return SolrCollapseFunction */ public function setSize($size) {} /** * Gets the initial size of the collapse data structures when collapsing on a numeric field only. * * @return integer */ public function getSize() {} /** * A string representation (Solr LocalParams) of the function. * @return string */ public function __toString() {} } /* phpdoc -f documentation.php --title Solr --parseprivate on --defaultpackagename Solr --output "HTML:frames:phphtmllib" -t solr_phpdoc */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/examples/000077500000000000000000000000001374041537100171615ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.4.0/examples/bootstrap.php000066400000000000000000000000421374041537100217030ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $query->setFacet(true); $query->addFacetField('cat')->addFacetField('name')->setFacetMinCount(2); $updateResponse = $client->query($query); $response_array = $updateResponse->getResponse(); $facet_data = $response_array->facet_counts->facet_fields; print_r($facet_data); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/facet_002.php000066400000000000000000000011671374041537100213420ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $query->setFacet(true); $query->addFacetField('cat')->addFacetField('name')->setFacetMinCount(2); $query->setFacetMinCount(4, 'name'); $updateResponse = $client->query($query); $response_array = $updateResponse->getResponse(); $facet_data = $response_array->facet_counts->facet_fields; print_r($facet_data); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrclient_001_adddocument_01.php000066400000000000000000000011411374041537100252740ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 334455); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Lucene'); $updateResponse = $client->addDocument($doc); print_r($updateResponse->getResponse()); /* you will have to commit changes to be written if you didn't use $commitWithin */ $client->commit(); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrclient_002_adddocument_02.php000066400000000000000000000011661374041537100253050ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 334455); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Lucene'); // No need to call commit() because $commitWithin is passed, so Solr Server will auto commit within 10 seconds $updateResponse = $client->addDocument($doc, false, 10000); print_r($updateResponse->getResponse()); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrclient_002_adddocument_03_child_docs.php000066400000000000000000000031221374041537100274530ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_STORE_PATH, ); $client = new SolrClient($options); $product = new SolrInputDocument(); $product->addField('id', 'black'); $product->addField('cat', 'tshirt'); $product->addField('cat', 'polo'); $product->addField('content_type', 'product'); $small = new SolrInputDocument(); $small->addField('id', 'TS-BLK-S'); $small->addField('content_type', 'sku'); $small->addField('size', 'S'); $small->addField('inventory', 100); $medium = new SolrInputDocument(); $medium->addField('id', 'TS-BLK-M'); $medium->addField('content_type', 'sku'); $medium->addField('size', 'M'); $medium->addField('inventory', 200); $large = new SolrInputDocument(); $large->addField('id', 'TS-BLK-L'); $large->addField('content_type', 'sku'); $large->addField('size', 'L'); $large->addField('inventory', 300); // add child documents $product->addChildDocument($small); $product->addChildDocument($medium); $product->addChildDocument($large); // or // $skus = [$small, $medium, $large]; // $product->addChildDocuments($skus); // add product document to the index $updateResponse = $client->addDocument( $product, true, // overwrite if the document exists 10000 // commit within 10 seconds ); print_r($updateResponse->getResponse()); /* OUTPUT SIMILAR TO: SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => 0 [QTime] => 5 ) ) */ php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrclient_003_adddocuments_01.php000066400000000000000000000013171374041537100254660ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 334455); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Lucene'); $doc2 = clone $doc; $doc2->deleteField('id'); $doc2->addField('id', 334456); $docs = array($doc, $doc2); $updateResponse = $client->addDocuments($docs); /* you will have to commit changes to be written if you didn't use $commitWithin */ $client->commit(); print_r($updateResponse->getResponse()); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrclient_004_adddocuments_02.php000066400000000000000000000011621374041537100254660ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 334455); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Lucene'); $doc2 = clone $doc; $doc2->deleteField('id'); $doc2->addField('id', 334456); $docs = array($doc, $doc2); $updateResponse = $client->addDocuments($docs, true, 1024); print $updateResponse->getRawRequest(); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrclient_005_optimize.php000066400000000000000000000006311374041537100243540ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $update_response = $client->optimize(4, false, false); $response = $update_response->getRawRequest(); print_r($response); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrclient_006_commit.php000066400000000000000000000006321374041537100240060ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $update_response = $client->commit(true, false, false); $response = $update_response->getRawRequest(); print_r($response); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrclient_007_query.php000066400000000000000000000011041374041537100236570ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setQuery('lucene'); $query->setStart(0); $query->setRows(50); $query->addField('cat')->addField('features')->addField('id')->addField('timestamp'); $query_response = $client->query($query); $response = $query_response->getResponse(); print_r($response); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrclient_008_query_lucene.php000066400000000000000000000011461374041537100252210ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setQuery('manu:"Apple Computer Inc." OR text:apple'); $query->setStart(0); $query->setRows(50); $query->addField('cat')->addField('features')->addField('id')->addField('timestamp'); $query_response = $client->query($query); $response = $query_response->getResponse(); print_r($response); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrclient_009_query_parsemode.php000066400000000000000000000012071374041537100257240ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setQuery('lucene'); $query->setStart(0); $query->setRows(50); $query->addField('cat')->addField('features')->addField('id')->addField('timestamp'); $query_response = $client->query($query); $query_response->setParseMode(SolrQueryResponse::PARSE_SOLR_DOC); $response = $query_response->getResponse(); print_r($response); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrclient_010_getbyid.php000066400000000000000000000005471374041537100241450ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $response = $client->getById('GB18030TEST'); print_r($response->getResponse()); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrclient_011_getbyids.php000066400000000000000000000005661374041537100243320ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $response = $client->getByIds(['GB18030TEST', '6H500F0']); print_r($response->getResponse()); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrclient_012_system.php000066400000000000000000000006041374041537100240360ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query_response = $client->system(); $response = $query_response->getResponse(); print_r($response); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrdismaxquery_001.php000066400000000000000000000017451374041537100235340ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $disMaxQuery = new SolrDisMaxQuery(); $disMaxQuery->setStart(0)->setQuery('solr')->setTimeAllowed(500)->setRows(17); $disMaxQuery->addSortField('price', 0); $disMaxQuery ->setQueryAlt('*:*')->addQueryField('text', 1.5) ->addQueryField('title', 5) ->addBoostQuery('cat', 'electronics', 2) ->setQueryPhraseSlop(1) ->setBigramPhraseSlop(3) ->addBigramPhraseField('text', 2.5) ->addBigramPhraseField('type', 3, 4) ->setTrigramPhraseFields('content^0.5 anchor~4^1.5 title^1.2 site^1.5') ; $queryResponse = $client->query($disMaxQuery); $response = $queryResponse->getResponse(); if($response->response->numFound > 0) { $docs = $response->response->docs; print_r($docs); } else { echo "No Documents Found".PHP_EOL; } php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrdocument_001.php000066400000000000000000000004521374041537100227710ustar00rootroot00000000000000addField('id', 1123); $doc->features = "PHP Client Side"; $doc->features = "Fast development cycles"; $doc['cat'] = 'Software'; $doc['cat'] = 'Custom Search'; $doc->cat = 'Information Technology'; print_r($doc->toArray()); ?>php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrdocument_002.php000066400000000000000000000005671374041537100230010ustar00rootroot00000000000000addField('id', 1123); $doc->features = "PHP Client Side"; $doc->features = "Fast development cycles"; $doc['cat'] = 'Software'; $doc['cat'] = 'Custom Search'; $doc->cat = 'Information Technology'; foreach ($doc as $fieldname => $fieldvalues) { print "$fieldname\n"; print_r($fieldvalues); } ?>php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrdocument_003.php000066400000000000000000000005321374041537100227720ustar00rootroot00000000000000addField('id', 1123); $doc->features = "PHP Client Side"; $doc->features = "Fast development cycles"; $doc['cat'] = 'Software'; $doc['cat'] = 'Custom Search'; $doc->cat = 'Information Technology'; $input_doc = $doc->getInputDocument(); var_dump(get_class($input_doc)); ?>php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrdocument_004.php000066400000000000000000000006461374041537100230010ustar00rootroot00000000000000addField('id', 1123); $doc->features = "PHP Client Side"; $doc->features = "Fast development cycles"; $doc['cat'] = 'Software'; $doc['cat'] = 'Custom Search'; $doc->cat = 'Information Technology'; $second_doc->addField('cat', 'Lucene Search'); $second_doc->merge($doc, true); print_r($second_doc->toArray()); ?>php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrobject_001.php000066400000000000000000000002601374041537100224160ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrobject_002.php000066400000000000000000000003411374041537100224170ustar00rootroot00000000000000email = "iekpo@php.net"; } catch (Exception $e) { var_dump($e->getCode()); var_dump($e->getMessage()); } var_dump($solrObject->getPropertyNames()); ?>php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrobject_003.php000066400000000000000000000003301374041537100224160ustar00rootroot00000000000000system->threadDump->thread->stackTrace); ?>php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrobject_004.php000066400000000000000000000004111374041537100224170ustar00rootroot00000000000000responseHeader); $system = $solrObject->system; print_r($header); print_r($system); ?>php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrobject_005.php000066400000000000000000000004161374041537100224250ustar00rootroot00000000000000 php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrquery_001.php000066400000000000000000000006121374041537100223160ustar00rootroot00000000000000setParam('a', 1); $query->setParam('b', 2); $query->setParam('c', 3); $query->setStart(4)->setQuery('solr')->setTimeAllowed(500)->setRows(17); $query->addField('israel')->addField('joshua')->addField('june'); $query->addSortField('cat', 0); $query->addFilterQuery('solr')->addFilterQuery('solr1')->addFilterQuery('solr2'); echo $query; echo "\n";php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrquery_002_facet.php000066400000000000000000000011351374041537100234620ustar00rootroot00000000000000setFacet(0); $query->addFacetField('israel')->addFacetField('israel2'); $query->addFacetQuery('silk')->addFacetQuery('name:june'); $query->setFacetPrefix('A')->setFacetPrefix('C', 'june'); $query->setFacetSort(1)->setFacetSort(0, 'june'); // $query->setFacetLimit(98)->setFacetLimit(44, 'june'); $query->setFacetOffset(110)->setFacetOffset(12, 'june'); $query->setFacetMinCount(4)->setFacetMinCount(30, 'june'); $query->setFacetMissing(1)->setFacetMissing(0, 'june'); $query->setFacetMethod('enum')->setFacetMethod('fc', 'june'); echo $query; echo "\n";php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrquery_003_date_facet.php000066400000000000000000000014071374041537100244620ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $query->setFacet(true); $query->addFacetDateField('manufacturedate_dt'); $query->setFacetDateStart('2006-02-13T00:00:00Z'); $query->setFacetDateEnd('2012-02-13T00:00:00Z'); $query->setFacetDateGap('+1YEAR'); $query->setFacetDateHardEnd(1); $query->addFacetDateOther('before'); $updateResponse = $client->query($query); $response_array = $updateResponse->getResponse(); $facet_data = $response_array->facet_counts->facet_dates; print_r($facet_data); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrquery_004_highlight.php000066400000000000000000000030441374041537100243520ustar00rootroot00000000000000setHighlight(0); $query->addHighlightField('a')->addHighlightField('a')->addHighlightField('a'); $query->removeHighlightField('a')->removeHighlightField('a')->removeHighlightField('a'); $query->setHighlightSnippets(4)->setHighlightSnippets(5, 'june'); $query->setHighlightFragsize(41)->setHighlightFragsize(52, 'june'); $query->setHighlightMergeContiguous(true)->setHighlightMergeContiguous(false, 'june'); $query->setHighlightRequireFieldMatch(true); $query->setHighlightMaxAnalyzedChars(44)->setHighlightMaxAnalyzedChars(53); $query->setHighlightAlternateField('pizza')->setHighlightAlternateField('bread', 'june'); $query->setHighlightAlternateField('blue')->setHighlightAlternateField('red','june'); $query->setHighlightAlternateField('a')->setHighlightAlternateField('b','june'); $query->setHighlightMaxAlternateFieldLength(300)->setHighlightMaxAlternateFieldLength(335, 'june'); $query->setHighlightFormatter('F')->setHighlightFormatter('G', 'june'); $query->setHighlightSimplePre('OO')->setHighlightSimplePre('PP', 'june'); $query->setHighlightSimplePost('ZZ')->setHighlightSimplePost('YY', 'june'); $query->setHighlightFragmenter('gap')->setHighlightFragmenter('space', 'june'); $query->setHighlightUsePhraseHighlighter(false); $query->setHighlightHighlightMultiTerm(1); $query->setHighlightRegexSlop(0.0025); $query->setHighlightRegexPattern("israel")->setHighlightRegexPattern("ekpo"); $query->setHighlightRegexMaxAnalyzedChars(444)->setHighlightRegexMaxAnalyzedChars(5.0); echo $query; echo "\n"; php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrquery_005_stats.php000066400000000000000000000003661374041537100235460ustar00rootroot00000000000000setStats(0); $query->addStatsField('hello')->addStatsField('june')->removeStatsField('hello'); $query->addStatsFacet('world')->addStatsFacet('pear')->removeStatsFacet('world'); echo $query; echo "\n"; php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrquery_006_mlt.php000066400000000000000000000010221374041537100231730ustar00rootroot00000000000000setMlt(1); $query->setMltCount(55)->setMltCount(90); $query->addMltField('june')->addMltField('joshua')->addMltField('mom')->removeMltField('joshua'); $query->addMltQueryField('june', 0.0)->addMltQueryField('israel', 9.558); $query->setMltMinTermFrequency(9); $query->setMltMinDocFrequency(5); $query->setMltMinWordLength(8); $query->setMltMaxWordLength(99); $query->setMltMaxNumTokens(6); $query->setMltMaxNumQueryTerms(2); $query->setMltBoost(true); echo $query; echo "\n"; php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrquery_007_terms.php000066400000000000000000000007111374041537100235360ustar00rootroot00000000000000setTerms(true); $query->setTermsField('israel'); $query->setTermsLowerBound('june'); $query->setTermsUpperBound('joshua'); $query->setTermsIncludeLowerBound(false); $query->setTermsIncludeUpperBound(0); $query->setTermsMinCount(50); $query->setTermsMaxCount(200); $query->setTermsPrefix('A'); $query->setTermsLimit(45); $query->setTermsReturnRaw(false); $query->setTermsSort(0); echo $query; echo "\n"; php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrquery_008_facetquery.php000066400000000000000000000010551374041537100245570ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $query->setFacet(true); $query->addFacetQuery('price:[* TO 500]')->addFacetQuery('price:[500 TO *]'); $query_response = $client->query($query); $response = $query_response->getResponse(); print_r($response->facet_counts->facet_queries); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrquery_009_grouping.php000066400000000000000000000011571374041537100242450ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $query = new SolrDismaxQuery('*:*'); $query->setRows(4); $query->setGroup(true); $query->addGroupField('manu_s_id'); $query->setGroupLimit(2); $query->addGroupSortField('price', SolrQuery::ORDER_ASC); $query->setGroupNGroups(true); $query_response = $client->query($query); $response = $query_response->getResponse(); print_r($response); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrquery_010_collapse.php000066400000000000000000000012371374041537100242040ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $collapseFunction = new SolrCollapseFunction('manu_id_s'); $collapseFunction ->setSize(2) ->setNullPolicy(SolrCollapseFunction::NULLPOLICY_IGNORE); // $collapseFunction->setMax('sum(cscore(),field(A))'); $query ->collapse($collapseFunction) ->setRows(4); $queryResponse = $client->query($query); $response = $queryResponse->getResponse(); print_r($response); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrquery_011_expand.php000066400000000000000000000012621374041537100236600ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $func = new SolrCollapseFunction('manu_id_s'); $query->collapse($func); $query->setExpand(true); $query->setExpandRows(10); $query->setExpandQuery('manu_id_s:corsair'); $query->addExpandFilterQuery('inStock:true'); $query->addExpandSortField('score', SolrQuery::ORDER_DESC); $queryResponse = $client->query($query); $response = $queryResponse->getResponse(); print_r($response); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/solrutils_001_digestxmlresponse.php000066400000000000000000000003351374041537100261520ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, ); $client = new SolrClient($options); $query = new SolrQuery(); $userInput = 'USB/2'; $escapedUserInput = SolrUtils::escapeQueryChars($userInput); $query->setQuery('text:'.$escapedUserInput); echo $query.PHP_EOL; php-solr-2.5.1+2.4.0/solr-2.4.0/examples/terms_001.php000066400000000000000000000007031374041537100214040ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setTerms(true); $query->setTermsField('cat'); $updateResponse = $client->query($query); print_r($updateResponse->getResponse()); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/terms_002.php000066400000000000000000000010321374041537100214010ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setTerms(true); /* Return only terms starting with $prefix */ $prefix = 'c'; $query->setTermsField('cat')->setTermsPrefix($prefix); $updateResponse = $client->query($query); print_r($updateResponse->getResponse()); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/terms_003.php000066400000000000000000000012121374041537100214020ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setTerms(true); /* Return only terms starting with $prefix */ $prefix = 'c'; /* Return only terms with a frequency of 2 or greater */ $min_frequency = 2; $query->setTermsField('cat')->setTermsPrefix($prefix)->setTermsMinCount($min_frequency); $updateResponse = $client->query($query); print_r($updateResponse->getResponse()); php-solr-2.5.1+2.4.0/solr-2.4.0/examples/test.config.php000066400000000000000000000033211374041537100221140ustar00rootroot00000000000000 php-solr-2.5.1+2.4.0/solr-2.4.0/pecl-compat/000077500000000000000000000000001374041537100175475ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.4.0/pecl-compat/compat.h000066400000000000000000000052301374041537100212030ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Compatibility macros for different PHP versions | +----------------------------------------------------------------------+ | Copyright (c) 2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Francois Laupretre | +----------------------------------------------------------------------+ */ #ifndef _COMPAT_H #define _COMPAT_H #define PECL_COMPAT_VERSION 1.2 #include #include #include #include "php.h" #include "zend.h" #include "zend_extensions.h" #include "zend_API.h" #define PHP_5_0_X_API_NO 220040412 #define PHP_5_1_X_API_NO 220051025 #define PHP_5_2_X_API_NO 220060519 #define PHP_5_3_X_API_NO 220090626 #define PHP_5_4_X_API_NO 220100525 #define PHP_5_5_X_API_NO 220121212 #define PHP_5_6_X_API_NO 220131226 #if PHP_MAJOR_VERSION >= 7 # define PHP_7 #endif #ifdef HAVE_CONFIG_H # include "config.h" #endif #if HAVE_STRING_H # include #endif #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef PHP_WIN32 # include "win32/time.h" #elif defined(NETWARE) # include # include #else # include #endif #ifdef HAVE_SYS_RESOURCE_H # include #endif #ifdef HAVE_STDARG_H #include #endif #ifdef HAVE_STDLIB_H # include #endif #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef PHP_WIN32 #include #else #include #endif #if ZEND_EXTENSION_API_NO >= PHP_5_6_X_API_NO #include "zend_virtual_cwd.h" #else #include "TSRM/tsrm_virtual_cwd.h" #endif #ifdef PHP_7 #include "Zend/zend_portability.h" #endif /*-- Include submodules */ #include "src/misc.h" #include "src/zend_string.h" #include "src/zend_hash.h" #endif /* _COMPAT_H */ php-solr-2.5.1+2.4.0/solr-2.4.0/pecl-compat/src/000077500000000000000000000000001374041537100203365ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.4.0/pecl-compat/src/misc.h000066400000000000000000000160251374041537100214460ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Compatibility between PHP versions | +----------------------------------------------------------------------+ | Copyright (c) 2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Francois Laupretre | +----------------------------------------------------------------------+ */ #ifndef __PECL_COMPAT_MISC_H #define __PECL_COMPAT_MISC_H 1 #ifdef PHP_7 /*============================================================================*/ typedef zend_string * OPENED_PATH_PTR; /* Type of stream opened_path argument */ typedef size_t COMPAT_ARG_SIZE_T; /* Size of string arguments */ typedef zend_long COMPAT_ARG_LONG_T; /* Type of long (integer) arguments */ #define compat_zval_ptr_dtor(zp) zval_ptr_dtor(zp) #include #else /*== PHP 5 ===================================================================*/ typedef char * OPENED_PATH_PTR; typedef off_t zend_off_t; typedef int COMPAT_ARG_SIZE_T; typedef long COMPAT_ARG_LONG_T; typedef long zend_long; #define compat_zval_ptr_dtor(zp) zval_dtor(zp) #endif /*============================================================================*/ #ifndef MIN # define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif #ifndef MAX # define MAX(a,b) (((a) > (b)) ? (a) : (b)) #endif /*---------------------------------------------------------------*/ /* (Taken from pcre/pcrelib/internal.h) */ /* To cope with SunOS4 and other systems that lack memmove() but have bcopy(), define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPY is set. Otherwise, include an emulating function for those systems that have neither (there are some non-Unix environments where this is the case). This assumes that all calls to memmove are moving strings upwards in store, which is the case in this extension. */ #if ! HAVE_MEMMOVE # ifdef memmove # undef memmove /* some systems may have a macro */ # endif # if HAVE_BCOPY # define memmove(a, b, c) bcopy(b, a, c) # else static void *my_memmove(unsigned char *dest, const unsigned char *src, size_t n) { int i; dest += n; src += n; for (i = 0; i < n; ++i) *(--dest) = *(--src); } # define memmove(a, b, c) my_memmove(a, b, c) # endif /* not HAVE_BCOPY */ #endif /* not HAVE_MEMMOVE */ #ifdef _AIX # undef PHP_SHLIB_SUFFIX # define PHP_SHLIB_SUFFIX "a" #endif #ifndef ZVAL_IS_ARRAY #define ZVAL_IS_ARRAY(zp) (Z_TYPE_P((zp))==IS_ARRAY) #endif #ifndef ZVAL_IS_STRING #define ZVAL_IS_STRING(zp) (Z_TYPE_P((zp))==IS_STRING) #endif #ifndef ZVAL_IS_LONG #define ZVAL_IS_LONG(zp) (Z_TYPE_P((zp))==IS_LONG) #endif #ifndef ZVAL_IS_BOOL #define ZVAL_IS_BOOL(zp) (Z_TYPE_P((zp))==IS_BOOL) #endif #ifndef INIT_ZVAL #define INIT_ZVAL(z) memset(&z, 0, sizeof(z)) #endif #ifndef ZVAL_UNDEF #define ZVAL_UNDEF(z) INIT_ZVAL(*(z)) #endif #ifndef MAKE_STD_ZVAL #define MAKE_STD_ZVAL(zp) { zp = emalloc(sizeof(zval)); INIT_ZVAL(*zp); } #endif #ifndef ALLOC_INIT_ZVAL #define ALLOC_INIT_ZVAL(zp) MAKE_STD_ZVAL(zp) #endif #ifndef ZEND_ASSUME #if defined(ZEND_WIN32) && !defined(__clang__) # define ZEND_ASSUME(c) __assume(c) #else # define ZEND_ASSUME(c) #endif #endif #ifndef ZEND_ASSERT #if ZEND_DEBUG # define ZEND_ASSERT(c) assert(c) #else # define ZEND_ASSERT(c) ZEND_ASSUME(c) #endif #endif #ifndef EMPTY_SWITCH_DEFAULT_CASE /* Only use this macro if you know for sure that all of the switches values are covered by its case statements */ #if ZEND_DEBUG # define EMPTY_SWITCH_DEFAULT_CASE() default: ZEND_ASSERT(0); break; #else # define EMPTY_SWITCH_DEFAULT_CASE() default: ZEND_ASSUME(0); break; #endif #endif #ifndef ZEND_IGNORE_VALUE #if defined(__GNUC__) && __GNUC__ >= 4 # define ZEND_IGNORE_VALUE(x) (({ __typeof__ (x) __x = (x); (void) __x; })) #else # define ZEND_IGNORE_VALUE(x) ((void) (x)) #endif #endif #if PHP_API_VERSION >= 20100412 typedef size_t PHP_ESCAPE_HTML_ENTITIES_SIZE; #else typedef int PHP_ESCAPE_HTML_ENTITIES_SIZE; #endif /* Avoid a warning when compiling stream wrapper declarations for openfile/opendir/url_stat */ #if ZEND_EXTENSION_API_NO >= PHP_5_6_X_API_NO # define COMPAT_STREAM_CONST_DECL const #else # define COMPAT_STREAM_CONST_DECL #endif #ifndef ZEND_MODULE_GLOBALS_ACCESSOR # ifdef ZTS # define ZEND_MODULE_GLOBALS_ACCESSOR(module_name, v) \ TSRMG(module_name##_globals_id, zend_##module_name##_globals *, v) # else # define ZEND_MODULE_GLOBALS_ACCESSOR(module_name, v) \ (module_name##_globals.v) # endif #endif #ifndef ZEND_MODULE_GLOBALS_BULK # ifdef ZTS # define ZEND_MODULE_GLOBALS_BULK(module_name) \ ((zend_##module_name##_globals *) \ (*((void ***) tsrm_ls))[module_name##_globals_id - 1]) # else # define ZEND_MODULE_GLOBALS_BULK(module_name) \ (&module_name##_globals) # endif #endif #ifndef ZEND_TSRMLS_CACHE_DEFINE # define ZEND_TSRMLS_CACHE_DEFINE() #endif #ifndef ZEND_TSRMLS_CACHE_UPDATE # define ZEND_TSRMLS_CACHE_UPDATE() #endif #ifndef PHP_FE_END # define PHP_FE_END { NULL, NULL, NULL } #endif #ifndef ZEND_MOD_END /* for php < 5.3.7 */ # define ZEND_MOD_END {NULL, NULL, NULL} #endif /*============================================================================*/ /* Duplicate a memory buffer */ /* Supports zero size (allocates 1 byte) */ static zend_always_inline void *_compat_dup(const void *ptr, size_t size, int persistent) { char *p; if (!ptr) return NULL; if (size) { p = pemalloc(size, persistent); memmove(p, ptr, size); } else { p = pemalloc(1,persistent); (*p) = '\0'; /* Ensures deterministic behavior */ } return p; } /*---------------------------------------------------------------*/ /* Duplicate a string and set terminating null. Input string does not have to be null-terminated */ static zend_always_inline void *_compat_dup_str(const void *ptr, size_t size, int persistent) { char *p; if (!ptr) return NULL; p = pemalloc(size + 1, persistent); if (size) memmove(p, ptr, size); p[size] = '\0'; return p; } /*-----------------------------------------------------*/ /* Fatal error - display message and abort process */ static zend_always_inline void compat_unsupported(char *msg) { php_error(E_CORE_ERROR, "This feature is not supported in this environment : %s", msg); exit(1); } /*============================================================================*/ #endif /* __PECL_COMPAT_MISC_H */ php-solr-2.5.1+2.4.0/solr-2.4.0/pecl-compat/src/zend_hash.h000066400000000000000000000256621374041537100224650ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | zend_hash compatibility layer for PHP 5 & 7 | +----------------------------------------------------------------------+ | Copyright (c) 2005-2007 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Francois Laupretre | +----------------------------------------------------------------------+ */ #ifndef _COMPAT_ZEND_HASH_H #define _COMPAT_ZEND_HASH_H #include "zend_hash.h" #ifdef PHP_7 /*============================================================================*/ #define compat_zend_hash_exists(ht, key) zend_hash_exists(ht, key) #define compat_zend_hash_str_exists(ht, str, len) zend_hash_str_exists(ht, str, len) #define COMPAT_HASH_PTR(_zp) (&(Z_PTR_P(_zp))) /*---------*/ /* Changes from original version: - If numeric key, returned (zend_string *) is set to NULL. - If non null, returned zend_string must be released. */ static zend_always_inline int compat_zend_hash_get_current_key_ex(const HashTable *ht , zend_string **str_index, zend_ulong *num_index, HashPosition *pos) { int status; if (str_index) (*str_index) = NULL; status = zend_hash_get_current_key_ex(ht, str_index, num_index, pos); if (*str_index) zend_string_addref(*str_index); return status; } /*---------*/ /* Added - This function is equivalent to the PHP 5 version of zend_hash_get_current_key_ex() */ static zend_always_inline int compat_zend_hash_str_get_current_key_ex(const HashTable *ht , char **str_index, size_t *str_length, zend_ulong *num_index , zend_bool duplicate, HashPosition *pos) { int status; zend_string *zp; zp = NULL; status = zend_hash_get_current_key_ex(ht, &zp, num_index, pos); if (zp) { if (duplicate) { (*str_index) = estrndup(ZSTR_VAL(zp), ZSTR_LEN(zp)); } else { (*str_index) = ZSTR_VAL(zp); } (*str_length) = ZSTR_LEN(zp); } return status; } /*---------*/ static zend_always_inline void *compat_zend_hash_get_current_data_ptr_ex(HashTable *ht , HashPosition *pos) { zval *zp; zp = zend_hash_get_current_data_ex(ht, pos); return Z_PTR_P(zp); } #define compat_zend_hash_get_current_data_ptr(ht) \ compat_zend_hash_get_current_data_ptr_ex(ht, &(ht)->nInternalPointer) /*---------*/ static zend_always_inline void *compat_zend_hash_get_current_data_ex(HashTable *ht , HashPosition *pos) { return (void *)zend_hash_get_current_data_ex(ht, pos); } #define compat_zend_hash_get_current_data(ht) \ compat_zend_hash_get_current_data_ex(ht, &(ht)->nInternalPointer) #define compat_zend_hash_get_current_zval_ex(ht, pos) \ (zval *)compat_zend_hash_get_current_data_ex(ht, pos) #define compat_zend_hash_get_current_zval(ht) \ compat_zend_hash_get_current_zval_ex(ht, &(ht)->nInternalPointer) #else /*= PHP 5 ====================================================================*/ #ifndef HASH_KEY_NON_EXISTENT #define HASH_KEY_NON_EXISTENT HASH_KEY_NON_EXISTANT #endif #define COMPAT_HASH_PTR(_zp) (_zp) /*------------------------------------------------*/ static zend_always_inline void *zend_hash_add_ptr(HashTable *ht , zend_string *key, void *pData) { int status; status = zend_hash_quick_add(ht, ZSTR_VAL(key), (uint)(ZSTR_LEN(key) + 1) , (ulong)ZSTR_HASH(key), &pData, sizeof(void *), NULL); return (status == SUCCESS ? pData : NULL); } #define zend_hash_add_new_ptr(ht, key, pData) zend_hash_add_ptr(ht, key, pData) #define zend_hash_add_mem(ht, key, pData, size) \ zend_hash_add_ptr(ht, key, _compat_dup(pData, size, ht->persistent)) /*---------*/ static zend_always_inline void *zend_hash_str_add_ptr(HashTable *ht , const char *str, size_t len, void *pData) { int status; char *strn = _compat_dup_str(str, len, 0); status = zend_hash_add(ht, strn, len + 1, &pData, sizeof(void *), NULL); efree(strn); return (status == SUCCESS ? pData : NULL); } #define zend_hash_str_add_new_ptr(ht, str, len, pData) zend_hash_str_add_ptr(ht, str, len, pData) #define zend_hash_str_add_mem(ht, str, len, pData, size) \ zend_hash_str_add_ptr(ht, str, len, _compat_dup(pData, size, ht->persistent)) /*---------*/ static zend_always_inline void *zend_hash_index_add_ptr(HashTable *ht , zend_ulong h, void *pData) { int status; status = zend_hash_index_update(ht, (ulong)h, &pData, sizeof(void *), NULL); return (status == SUCCESS ? pData : NULL); } #define zend_hash_index_add_new_ptr(ht, h, pData) \ zend_hash_index_add_ptr(ht, h, pData) #define zend_hash_index_add_mem(ht, h, pData, size) \ zend_hash_index_add_ptr(ht, h, _compat_dup(pData, size, ht->persistent)) /*---------*/ static zend_always_inline void *zend_hash_next_index_insert_ptr(HashTable *ht , void *pData) { int status; status = zend_hash_next_index_insert(ht, &pData, sizeof(void *), NULL); return (status == SUCCESS ? pData : NULL); } #define zend_hash_next_index_insert_mem(ht, pData, size) \ zend_hash_next_index_insert_ptr(ht, _compat_dup(pData, size, ht->persistent)) /*---------*/ static zend_always_inline void *zend_hash_update_ptr(HashTable *ht , zend_string *key, void *pData) { int status; status = zend_hash_quick_update(ht, ZSTR_VAL(key), (uint)(ZSTR_LEN(key) + 1) , (ulong)ZSTR_HASH(key), &pData, sizeof(void *), NULL); return (status == SUCCESS ? pData : NULL); } #define zend_hash_update_mem(ht, key, pData, size) \ zend_hash_update_ptr(ht, key, _compat_dup(pData, size, ht->persistent)) /*---------*/ static zend_always_inline void *zend_hash_str_update_ptr(HashTable *ht , const char *str, size_t len, void *pData) { int status; char *strn = _compat_dup_str(str, len, 0); status = zend_hash_update(ht, strn, len + 1, &pData, sizeof(void *), NULL); efree(strn); return (status == SUCCESS ? pData : NULL); } #define zend_hash_str_upate_mem(ht, str, len, pData, size) \ zend_hash_str_update_ptr(ht, str, len, _compat_dup(pData, size, ht->persistent)) #define zend_hash_index_update_ptr(ht, h, pData) \ zend_hash_index_add_ptr(ht, h, pData) #define zend_hash_index_update_mem(ht, h, pData, size) \ zend_hash_index_add_mem(ht, h, pData, size) /*---------*/ static zend_always_inline void *zend_hash_find_ptr(const HashTable *ht , zend_string *key) { int status; void **p; status = zend_hash_quick_find(ht, ZSTR_VAL(key), (uint)(ZSTR_LEN(key) + 1) , (ulong)ZSTR_HASH(key), (void **)(&p)); return (status == SUCCESS ? (*p) : NULL); } /*---------*/ static zend_always_inline void *zend_hash_str_find_ptr(const HashTable *ht , const char *str, size_t len) { int status; void **p; char *strn = _compat_dup_str(str, len, 0); status = zend_hash_find(ht, strn, len + 1, (void **)(&p)); efree(strn); return (status == SUCCESS ? (*p) : NULL); } /*---------*/ static zend_always_inline void *zend_hash_index_find_ptr(const HashTable *ht , zend_ulong h) { int status; void **p; status = zend_hash_index_find(ht, h, (void **)(&p)); return (status == SUCCESS ? (*p) : NULL); } /*---------*/ static zend_always_inline zend_bool compat_zend_hash_exists(const HashTable *ht , zend_string *key) { return zend_hash_quick_exists(ht, ZSTR_VAL(key), (uint)(ZSTR_LEN(key) + 1) , (ulong)ZSTR_HASH(key)); } /*---------*/ static zend_always_inline zend_bool compat_zend_hash_str_exists(const HashTable *ht , const char *str, size_t len) { zend_bool status; char *strn = _compat_dup_str(str, len, 0); status = zend_hash_exists(ht, strn, (uint)(len + 1)); efree(strn); return status; } /*---------*/ /* Changes from original version: - Returns a zend_string - If key is a string, returned zend_string must be released. */ static zend_always_inline int compat_zend_hash_get_current_key_ex(const HashTable *ht , zend_string **str_index, zend_ulong *num_index, HashPosition *pos) { int status; char *str; uint str_length; ulong num; status = zend_hash_get_current_key_ex(ht, &str, &str_length, &num, 0, pos); if (status == HASH_KEY_IS_STRING) { (*str_index) = zend_string_init(str, str_length - 1, ht->persistent); } else if (status == HASH_KEY_IS_LONG) { (*num_index) = (zend_ulong)num; } return status; } /*---------*/ /* Diff with original : - Type casts - Return string length, without trailing null */ static zend_always_inline int compat_zend_hash_str_get_current_key_ex(const HashTable *ht , char **str_index, size_t *str_length, zend_ulong *num_index , zend_bool duplicate, HashPosition *pos) { int status; uint length; ulong num; status = zend_hash_get_current_key_ex(ht, str_index, &length, &num, duplicate, pos); if (status == HASH_KEY_IS_STRING) { (*str_length) = (size_t)(length - 1); } else if (status == HASH_KEY_IS_LONG) { (*num_index) = (zend_ulong)num; } return status; } /*---------*/ static zend_always_inline void *compat_zend_hash_get_current_data_ptr_ex(HashTable *ht , HashPosition *pos) { int status; void **p; status = zend_hash_get_current_data_ex(ht, (void **)(&p), pos); return ((status == SUCCESS) ? (*p) : NULL); } #define compat_zend_hash_get_current_data_ptr(ht) \ compat_zend_hash_get_current_data_ptr_ex(ht, NULL) /*---------*/ static zend_always_inline void *compat_zend_hash_get_current_data_ex(HashTable *ht , HashPosition *pos) { int status; void **p; status = zend_hash_get_current_data_ex(ht, (void **)(&p), pos); return ((status == SUCCESS) ? p : NULL); } #define compat_zend_hash_get_current_data(ht) \ compat_zend_hash_get_current_data_ex(ht, NULL) #define compat_zend_hash_get_current_zval_ex(ht, pos) \ *((zval **)compat_zend_hash_get_current_data_ex(ht, pos)) #define compat_zend_hash_get_current_zval(ht) \ compat_zend_hash_get_current_zval_ex(ht, NULL) /*------------------------------------------------------------*/ #define ZEND_HASH_FOREACH(_ht, indirect) do { \ HashPosition _pos; \ for (zend_hash_internal_pointer_reset_ex(_ht, &_pos) \ ;;zend_hash_move_forward_ex(_ht, &_pos)) { \ if (zend_hash_has_more_elements_ex(_ht, &_pos) != SUCCESS) break; #define ZEND_HASH_FOREACH_END() \ } \ } while (0) #define ZEND_HASH_FOREACH_PTR(_ht, _ptr) \ ZEND_HASH_FOREACH(_ht, 0); \ _ptr = compat_zend_hash_get_current_data_ptr_ex(_ht, &_pos); #define ZEND_HASH_FOREACH_NUM_KEY(_ht, _h) \ ZEND_HASH_FOREACH(_ht, 0); \ compat_zend_hash_get_current_key_ex(_ht, NULL, &_h, &_pos); #define ZEND_HASH_FOREACH_NUM_KEY_PTR(_ht, _h, _ptr) \ ZEND_HASH_FOREACH(_ht, 0); \ _ptr = compat_zend_hash_get_current_data_ptr_ex(_ht, &_pos); \ compat_zend_hash_get_current_key_ex(_ht, NULL, &_h, &_pos); /*============================================================================*/ #endif /* PHP_7 */ #endif /* _COMPAT_ZEND_HASH_H */ php-solr-2.5.1+2.4.0/solr-2.4.0/pecl-compat/src/zend_string.h000066400000000000000000000160121374041537100230350ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | zend_string compatibility layer for PHP 5 & 7 | +----------------------------------------------------------------------+ | Copyright (c) 2005-2007 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Francois Laupretre | +----------------------------------------------------------------------+ */ #ifndef _COMPAT_ZEND_STRING_H #define _COMPAT_ZEND_STRING_H #ifdef PHP_7 /*============================================================================*/ #include "zend_string.h" #ifndef ZSTR_IS_PERSISTENT # define ZSTR_IS_PERSISTENT(s) (GC_FLAGS(s) & IS_STR_PERSISTENT) #endif #else /*============================================================================*/ /*---- zend_string for PHP 5 ----*/ struct _zend_string { int persistent; int hash_is_set; /* needed because computed hash may be null */ zend_ulong h; /* hash value */ uint32_t refcount; size_t len; char val[1]; }; typedef struct _zend_string zend_string; /* Shortcuts */ #define ZSTR_VAL(zstr) (zstr)->val #define ZSTR_LEN(zstr) (zstr)->len #define ZSTR_H(zstr) (zstr)->h #define ZSTR_HASH(zstr) zend_string_hash_val(zstr) #define _ZSTR_HEADER_SIZE XtOffsetOf(zend_string, val) #define _ZSTR_STRUCT_SIZE(len) (_ZSTR_HEADER_SIZE + len + 1) #define ZSTR_IS_PERSISTENT(s) (s->persistent) /*---------*/ static zend_always_inline uint32_t zend_string_refcount(zend_string *s) { return (s->refcount); } /*---------*/ static zend_always_inline uint32_t zend_string_addref(zend_string *s) { return ++(s->refcount); } /*---------*/ static zend_always_inline uint32_t zend_string_delref(zend_string *s) { return --(s->refcount); } /*---------*/ static zend_always_inline zend_ulong zend_string_hash_val(zend_string *s) { char c, *p; if (! s->hash_is_set) { /* Compute with terminating null but preserve string */ p = &(ZSTR_VAL(s)[ZSTR_LEN(s)]); c = (*p); (*p) = '\0'; ZSTR_H(s) = zend_get_hash_value(ZSTR_VAL(s), ZSTR_LEN(s)+1); (*p) = c; s->hash_is_set = 1; } return ZSTR_H(s); } /*---------*/ static zend_always_inline void zend_string_forget_hash_val(zend_string *s) { s->hash_is_set = 0; ZSTR_H(s) = 0; /* Security */ } /*---------*/ static zend_always_inline zend_string *zend_string_alloc(size_t len, int persistent) { zend_string *ret = (zend_string *)pemalloc(ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent); ret->persistent = persistent; zend_string_forget_hash_val(ret); ret->refcount = 1; ZSTR_LEN(ret) = len; return ret; } /*---------*/ static zend_always_inline zend_string *zend_string_safe_alloc(size_t n , size_t m, size_t l, int persistent) { zend_string *ret = (zend_string *)safe_pemalloc(n, m, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(l)), persistent); ret->persistent = persistent; zend_string_forget_hash_val(ret); ret->refcount = 1; ZSTR_LEN(ret) = l; return ret; } /*---------*/ static zend_always_inline zend_string *zend_string_init(const char *str, size_t len, int persistent) { zend_string *ret = zend_string_alloc(len, persistent); memcpy(ZSTR_VAL(ret), str, len); ZSTR_VAL(ret)[len] = '\0'; return ret; } /*---------*/ static zend_always_inline zend_string *zend_string_dup(zend_string *s, int persistent) { zend_string *target; target = zend_string_init(ZSTR_VAL(s), ZSTR_LEN(s), persistent); if (s->hash_is_set) { ZSTR_H(target) = ZSTR_H(s); target->hash_is_set = 1; } return target; } /*---------*/ static zend_always_inline zend_string *zend_string_realloc(zend_string *s , size_t len, int persistent) { zend_string *ret; if (EXPECTED(s->refcount == 1)) { ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent); ZSTR_LEN(ret) = len; zend_string_forget_hash_val(ret); return ret; } zend_string_delref(s); ret = zend_string_alloc(len, persistent); memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), MIN(len, ZSTR_LEN(s)) + 1); return ret; } /*---------*/ static zend_always_inline zend_string *zend_string_extend(zend_string *s , size_t len, int persistent) { zend_string *ret; ZEND_ASSERT(len >= ZSTR_LEN(s)); if (EXPECTED(s->refcount == 1)) { ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent); ZSTR_LEN(ret) = len; zend_string_forget_hash_val(ret); return ret; } zend_string_delref(s); ret = zend_string_alloc(len, persistent); memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), ZSTR_LEN(s) + 1); return ret; } /*---------*/ static zend_always_inline zend_string *zend_string_truncate(zend_string *s , size_t len, int persistent) { zend_string *ret; ZEND_ASSERT(len <= ZSTR_LEN(s)); if (EXPECTED(s->refcount == 1)) { ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent); ZSTR_LEN(ret) = len; zend_string_forget_hash_val(ret); return ret; } zend_string_delref(s); ret = zend_string_alloc(len, persistent); memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), len + 1); return ret; } /*---------*/ static zend_always_inline zend_string *zend_string_safe_realloc(zend_string *s , size_t n, size_t m, size_t l, int persistent) { zend_string *ret; if (EXPECTED(s->refcount == 1)) { ret = (zend_string *)safe_perealloc(s, n, m, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(l)), persistent); ZSTR_LEN(ret) = (n * m) + l; zend_string_forget_hash_val(ret); return ret; } zend_string_delref(s); ret = zend_string_safe_alloc(n, m, l, persistent); memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), MIN((n * m) + l, ZSTR_LEN(s)) + 1); return ret; } /*---------*/ static zend_always_inline void zend_string_free(zend_string *s) { if (s) { pefree(s, s->persistent); } } /*---------*/ static zend_always_inline void zend_string_release(zend_string *s) { if (s) { s->refcount--; if (s->refcount == 0) { zend_string_free(s); } } } /*---------*/ static zend_always_inline zend_string *zend_string_copy(zend_string *s) { zend_string_addref(s); return (s); } /*---------*/ static zend_always_inline zend_bool zend_string_equals(zend_string *s1, zend_string *s2) { return s1 == s2 || (s1->len == s2->len && !memcmp(s1->val, s2->val, s1->len)); } #define zend_string_equals_literal(str, literal) \ ((str)->len == sizeof(literal)-1 && !memcmp((str)->val, literal, sizeof(literal) - 1)) #endif /* PHP_7 */ #endif /* _COMPAT_ZEND_STRING_H */ php-solr-2.5.1+2.4.0/solr-2.4.0/solr.dsp000066400000000000000000000141051374041537100170330ustar00rootroot00000000000000# Microsoft Developer Studio Project File - Name="Solr" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # $Id$ # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=Solr - Win32 Debug_TS !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "Solr.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "Solr.mak" CFG="Solr - Win32 Debug_TS" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "Solr - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "Solr - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "Solr - Win32 Release_TS" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release_TS" # PROP BASE Intermediate_Dir "Release_TS" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release_TS" # PROP Intermediate_Dir "Release_TS" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SOLR_EXPORTS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_SOLR" /D ZTS=1 /D HAVE_SOLR=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x407 /d "NDEBUG" # ADD RSC /l 0x407 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386 # ADD LINK32 wsock32.lib php5ts.lib libcurl.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /machine:I386 /out:"..\..\Release_TS/php_solr.dll" /implib:"..\..\Release_TS/php_solr.lib" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\bindlib_w32\Release" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "Solr - Win32 Debug_TS" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug_TS" # PROP BASE Intermediate_Dir "Debug_TS" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug_TS" # PROP Intermediate_Dir "Debug_TS" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SOLR_EXPORTS" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_SOLR" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SOLR=1 /YX /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x407 /d "_DEBUG" # ADD RSC /l 0x407 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386 # ADD LINK32 php5ts_debug.lib libcurl.lib ws2_32.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"msvcrt" /out:"..\..\Debug_TS\php_solr.dll" /implib:"..\..\Debug_TS/php_solr.lib" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\bindlib_w32\Release" !ENDIF # Begin Target # Name "Solr - Win32 Release_TS" # Name "Solr - Win32 Debug_TS" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=./php_solr.c # End Source File # Begin Source File SOURCE=./php_solr_exception.c # End Source File # Begin Source File SOURCE=./php_solr_object.c # End Source File # Begin Source File SOURCE=./php_solr_response.c # End Source File # Begin Source File SOURCE=./php_solr_document.c # End Source File # Begin Source File SOURCE=./php_solr_input_document.c # End Source File # Begin Source File SOURCE=./php_solr_query.c # End Source File # Begin Source File SOURCE=./php_solr_client.c # End Source File # Begin Source File SOURCE=./php_solr_functions.c # End Source File # Begin Source File SOURCE=./php_solr_params.c # End Source File # Begin Source File SOURCE=./php_solr_utils.c # End Source File # Begin Source File SOURCE=./solr_functions_debug.c # End Source File # Begin Source File SOURCE=./solr_functions_params.c # End Source File # Begin Source File SOURCE=./solr_functions_document.c # End Source File # Begin Source File SOURCE=./solr_functions_response.c # End Source File # Begin Source File SOURCE=./solr_functions_client.c # End Source File # Begin Source File SOURCE=./solr_functions_helpers.c # End Source File # Begin Source File SOURCE=./solr_string.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=.\php_solr.h # End Source File # Begin Source File SOURCE=.\php_solr_api.h # End Source File # Begin Source File SOURCE=.\solr_constants.h # End Source File # Begin Source File SOURCE=.\solr_macros.h # End Source File # Begin Source File SOURCE=.\solr_string.h # End Source File # Begin Source File SOURCE=.\solr_types.h # End Source File # End Group # End Target # End Project php-solr-2.5.1+2.4.0/solr-2.4.0/src/000077500000000000000000000000001374041537100161325ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/000077500000000000000000000000001374041537100170065ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/php_solr.c000066400000000000000000002032051374041537100210020ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" #ifdef HAVE_SOLR /* PHP versions lower than 5.2.3 are not compatible or are causing tests to FAIL */ #if ((PHP_MAJOR_VERSION < 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 2) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 2 && PHP_RELEASE_VERSION < 3)) #error PHP 5.2.3 or newer is required. Please upgrade your php version. #endif #if LIBCURL_VERSION_NUM < 0x070F00 #error libcurl 7.15.0 or later is required. Please upgrade your libcurl version. #endif #if LIBXML_VERSION < 20616 #error libxml2 2.6.16 or later is required. Please upgrade your libxml2 version. #endif /******************************************************************************/ /** GLOBAL VARIABLE FOR THE EXTENSION **/ /******************************************************************************/ /* {{{ ZEND_DECLARE_MODULE_GLOBALS(solr) */ ZEND_DECLARE_MODULE_GLOBALS(solr) /* }}} */ /******************************************************************************/ /** OBJECT HANDLERS AND DECLARATIONS FOR CLASS ENTRIES **/ /******************************************************************************/ /* {{{ zend_class_entry declarations of the classes */ zend_class_entry *solr_ce_SolrObject; zend_class_entry *solr_ce_SolrInputDocument; zend_class_entry *solr_ce_SolrDocument; zend_class_entry *solr_ce_SolrDocumentField; zend_class_entry *solr_ce_SolrClient; zend_class_entry *solr_ce_SolrParams; zend_class_entry *solr_ce_SolrModifiableParams; zend_class_entry *solr_ce_SolrCollapseFunction; zend_class_entry *solr_ce_SolrQuery; zend_class_entry *solr_ce_SolrResponse; zend_class_entry *solr_ce_SolrQueryResponse; zend_class_entry *solr_ce_SolrUpdateResponse; zend_class_entry *solr_ce_SolrPingResponse; zend_class_entry *solr_ce_SolrGenericResponse; zend_class_entry *solr_ce_SolrUtils; zend_class_entry *solr_ce_SolrException; zend_class_entry *solr_ce_SolrIllegalOperationException; zend_class_entry *solr_ce_SolrIllegalArgumentException; zend_class_entry *solr_ce_SolrClientException; zend_class_entry *solr_ce_SolrServerException; zend_class_entry *solr_ce_SolrMissingMandatoryParameterException; /* }}} */ /* {{{ zend_object_handlers */ zend_object_handlers solr_object_handlers; zend_object_handlers solr_document_field_handlers; zend_object_handlers solr_input_document_object_handlers; zend_object_handlers solr_client_object_handlers; zend_object_handlers solr_response_object_handlers; zend_object_handlers solr_collapse_function_object_handlers; /* }}} */ /* {{{ static void php_solr_globals_ctor(zend_solr_globals *solr_globals_arg TSRMLS_DC) Global variable initializer. In ZTS mode, called once for each thread spawned. */ static void php_solr_globals_ctor(zend_solr_globals *solr_globals_arg TSRMLS_DC) { /* Initializing the counters to Zero */ solr_globals_arg->request_count = 0U; solr_globals_arg->document_count = 0U; solr_globals_arg->client_count = 0U; solr_globals_arg->functions_count = 0U; solr_globals_arg->documents = NULL; solr_globals_arg->clients = NULL; solr_globals_arg->params = NULL; solr_globals_arg->functions = NULL; } /* }}} */ /******************************************************************************/ /** DECLARING STRUCTURES FOR METHOD ARGUMENTS TYPE HINTING **/ /******************************************************************************/ /* {{{ arg_info vectors for functions and methods */ ZEND_BEGIN_ARG_INFO_EX(SolrObject__get_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, property_name) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrObject__set_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, property_name) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, property_value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrObject_one_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, property_name) ZEND_END_ARG_INFO() /* {{{ SolrDocument arguments */ ZEND_BEGIN_ARG_INFO_EX(SolrDocument__construct_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_addField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldValue) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_getField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_fieldExists_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_deleteField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_sort_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, sortOrderBy) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, sortDirection) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_merge_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, sourceDoc, SolrDocument, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, overwrite) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_current_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_getInputDocument_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(SolrDocument_unserialize_args, 0) ZEND_ARG_INFO(0, serialized) ZEND_END_ARG_INFO() /* }}} */ /* {{{ SolrInputDocument arguments */ ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument__construct_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_setBoost_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, documentBoostValue) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_addField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldValue) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldBoostValue) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_getFieldBoost_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_getField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_setFieldBoost_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldBoostValue) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_fieldExists_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_deleteField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_sort_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, sortOrderBy) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, sortDirection) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_merge_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, sourceDoc, SolrInputDocument, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, overwrite) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_addChildDocument_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, child, SolrInputDocument, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_addChildDocuments_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_ARRAY_INFO(SOLR_ARG_PASS_BY_REF_TRUE, docs, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() /* }}} */ /* {{{ SolrClient arguments */ ZEND_BEGIN_ARG_INFO_EX(SolrClient_constructor_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_ARRAY_INFO(SOLR_ARG_PASS_BY_REF_FALSE, clientOptions, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_query_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, query, SolrParams, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_addDocument_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, doc, SolrInputDocument, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, overwrite) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, commitWithin) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_addDocuments_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_ARRAY_INFO(SOLR_ARG_PASS_BY_REF_TRUE, docs, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, overwrite) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, commitWithin) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_request_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, raw_request) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_setResponseWriter_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, responseWriter) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_commit_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, softCommit) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, waitSearcher) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, expungeDeletes) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_optimize_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, maxSegments) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, softCommit) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, waitSearcher) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_rollback_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_deleteById_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, id) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_deleteByIds_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_ARRAY_INFO(SOLR_ARG_PASS_BY_REF_FALSE, ids, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_deleteByQuery_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, query) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_deleteByQueries_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_ARRAY_INFO(SOLR_ARG_PASS_BY_REF_FALSE, queries, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_ping_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_threads_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_info_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_setServlet_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, type) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() /* }}} */ /* {{{ SolrParams arguments */ ZEND_BEGIN_ARG_INFO_EX(SolrParams_setParam_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, name) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrParams_addParam_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, name) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrParams_toString_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, url_encode) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrParams_getParam_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, param_name) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(SolrParams_unserialize_args, 0) ZEND_ARG_INFO(0, serialized) ZEND_END_ARG_INFO() /* }}} */ /* {{{ SolrQuery arguments */ ZEND_BEGIN_ARG_INFO_EX(SolrQuery_constructor_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, q) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setQuery_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, q) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setStart_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, start) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setRows_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, rows) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_addField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_addSortField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, order) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_addFilterQuery_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fq) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setShowDebugInfo_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, flag) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setExplainOther_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, flag) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setTimeAllowed_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, timeAllowed) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setOmitHeader_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, flag) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setEchoHandler_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, flag) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setEchoParams_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, type) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_facet_get_1_0_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field_override) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_facet_1_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_facet_2_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field_override) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_group_1_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_hl_get_1_0_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field_override) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_hl_1_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_hl_2_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field_override) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_stats_1_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_mlt_1_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_mlt_2_2_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, boost) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_terms_1_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setGroupCachePct_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, percent) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_collapse_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, collapseFunction, SolrCollapseFunction, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() /* }}} */ /* {{{ Solr Generic arguments */ ZEND_BEGIN_ARG_INFO_EX(Solr_no_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_END_ARG_INFO() /* }}} */ /* {{{ */ ZEND_BEGIN_ARG_INFO_EX(SolrResponse_setParseMode_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, parser_mode) ZEND_END_ARG_INFO() /* }}} */ /* {{{ SolrUtils */ ZEND_BEGIN_ARG_INFO_EX(SolrUtils_escapeQueryChars_arg, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, str) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrUtils_digestXML_arg, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, xmlresponse) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, parse_mode) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrUtils_digestJson_arg, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, jsonResponse) ZEND_END_ARG_INFO() /* }}} */ ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_construct_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_set_size_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, size) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_set_hint_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, hint) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_set_max_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, max) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_set_min_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, min) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_set_field_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_set_null_policy_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, policy) ZEND_END_ARG_INFO() /* }}} */ /* {{{ solr_functions[] */ static zend_function_entry solr_functions[] = { PHP_FE(solr_get_version, Solr_no_args) PHP_FE_END }; /* }}} */ /* {{{ solr_object_methods */ static zend_function_entry solr_object_methods[] = { SOLR_CTOR(SolrObject, __construct, Solr_no_args) SOLR_DTOR(SolrObject, __destruct, Solr_no_args) /** Temporarily disconnected for now. May be brought back in the future. PHP_ME(SolrObject, __set, SolrObject__set_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, __get, SolrObject__get_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, __isset, SolrObject_one_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, __unset, SolrObject_one_args, ZEND_ACC_PUBLIC) */ PHP_ME(SolrObject, offsetSet, SolrObject__set_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, offsetGet, SolrObject__get_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, offsetExists, SolrObject_one_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, offsetUnset, SolrObject_one_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, getPropertyNames, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_document_methods */ static zend_function_entry solr_document_field_methods[] = { SOLR_CTOR(SolrDocumentField, __construct, Solr_no_args) SOLR_DTOR(SolrDocumentField, __destruct, Solr_no_args) PHP_FE_END }; /* }}} */ /* {{{ solr_collapse_function_methods for the SolrCollapseFunction ce */ static zend_function_entry solr_collapse_function_methods[] = { SOLR_CTOR(SolrCollapseFunction, __construct, SolrCollapseFunction_construct_args) SOLR_DTOR(SolrCollapseFunction, __destruct, Solr_no_args) PHP_ME(SolrCollapseFunction, setField, SolrCollapseFunction_set_field_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, getField, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, setMax, SolrCollapseFunction_set_max_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, getMax, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, setMin, SolrCollapseFunction_set_min_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, getMin, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, setSize, SolrCollapseFunction_set_size_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, getSize, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, setHint, SolrCollapseFunction_set_hint_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, getHint, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, setNullPolicy, SolrCollapseFunction_set_null_policy_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, getNullPolicy, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, __toString, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, __sleep, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, __wakeup, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_document_methods */ static zend_function_entry solr_document_methods[] = { SOLR_CTOR(SolrDocument, __construct, SolrDocument__construct_args) SOLR_DTOR(SolrDocument, __destruct, Solr_no_args) PHP_ME(SolrDocument, __clone, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CLONE) PHP_ME(SolrDocument, __set, SolrDocument_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, __get, SolrDocument_getField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, __isset, SolrDocument_fieldExists_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, __unset, SolrDocument_deleteField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, offsetSet, SolrDocument_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, offsetGet, SolrDocument_getField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, offsetExists, SolrDocument_fieldExists_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, offsetUnset, SolrDocument_deleteField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, current, SolrDocument_current_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, key, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, next, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, rewind, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, valid, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, serialize, NULL, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, unserialize, SolrDocument_unserialize_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, clear, Solr_no_args, ZEND_ACC_PUBLIC) PHP_MALIAS(SolrDocument, reset, clear, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, addField, SolrDocument_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, getFieldNames, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, getFieldCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, getField, SolrDocument_getField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, toArray, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, fieldExists, SolrDocument_fieldExists_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, deleteField, SolrDocument_deleteField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, sort, SolrDocument_sort_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, merge, SolrDocument_merge_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, getInputDocument, SolrDocument_getInputDocument_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, getChildDocumentsCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, hasChildDocuments, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, getChildDocuments, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_input_document_methods */ static zend_function_entry solr_input_document_methods[] = { SOLR_CTOR(SolrInputDocument, __construct, SolrInputDocument__construct_args) SOLR_DTOR(SolrInputDocument, __destruct, Solr_no_args) PHP_ME(SolrInputDocument, __clone, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CLONE) PHP_ME(SolrInputDocument, __sleep, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, __wakeup, NULL, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, setBoost, SolrInputDocument_setBoost_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getBoost, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, clear, Solr_no_args, ZEND_ACC_PUBLIC) PHP_MALIAS(SolrInputDocument, reset, clear, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, addField, SolrInputDocument_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getFieldBoost, SolrInputDocument_getFieldBoost_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, setFieldBoost, SolrInputDocument_setFieldBoost_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getFieldNames, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getFieldCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getField, SolrInputDocument_getField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, toArray, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, fieldExists, SolrInputDocument_fieldExists_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, deleteField, SolrInputDocument_deleteField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, sort, SolrInputDocument_sort_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, merge, SolrInputDocument_merge_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, addChildDocument, SolrInputDocument_addChildDocument_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getChildDocuments, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, hasChildDocuments, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getChildDocumentsCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, addChildDocuments, SolrInputDocument_addChildDocuments_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_client_methods */ static zend_function_entry solr_client_methods[] = { SOLR_CTOR(SolrClient, __construct, SolrClient_constructor_args) SOLR_DTOR(SolrClient, __destruct, Solr_no_args) PHP_ME(SolrClient, __sleep, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, __wakeup, NULL, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, __clone, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CLONE) PHP_ME(SolrClient, getOptions, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, getDebug, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, setServlet, SolrClient_setServlet_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, query, SolrClient_query_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, addDocument, SolrClient_addDocument_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, addDocuments, SolrClient_addDocuments_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, request, SolrClient_request_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, setResponseWriter, SolrClient_setResponseWriter_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, deleteById, SolrClient_deleteById_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, deleteByIds, SolrClient_deleteByIds_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, deleteByQuery, SolrClient_deleteByQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, deleteByQueries, SolrClient_deleteByQueries_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, getById, SolrClient_deleteById_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, getByIds, SolrClient_deleteByIds_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, commit, SolrClient_commit_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, optimize, SolrClient_optimize_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, rollback, SolrClient_rollback_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, ping, SolrClient_ping_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, system, SolrClient_info_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, threads, SolrClient_threads_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_exception_methods. None. */ static zend_function_entry solr_exception_methods[] = { PHP_ME(SolrException, getInternalInfo, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_exception_methods. None. */ static zend_function_entry solr_client_exception_methods[] = { PHP_ME(SolrClientException, getInternalInfo, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_exception_methods. None. */ static zend_function_entry solr_server_exception_methods[] = { PHP_ME(SolrServerException, getInternalInfo, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_exception_methods. None. */ static zend_function_entry solr_illegal_operation_exception_methods[] = { PHP_ME(SolrIllegalOperationException, getInternalInfo, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_exception_methods. None. */ static zend_function_entry solr_illegal_argument_exception_methods[] = { PHP_ME(SolrIllegalArgumentException, getInternalInfo, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* PHP_MALIAS(SolrInputDocument, reset, clear, Solr_no_args, ZEND_ACC_PUBLIC) */ /* {{{ solr_params_methods. */ static zend_function_entry solr_params_methods[] = { PHP_ME(SolrParams, setParam, SolrParams_setParam_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, addParam, SolrParams_addParam_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, __toString, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, toString, SolrParams_toString_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, getParams, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, getParam, SolrParams_getParam_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, getPreparedParams, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, __clone, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CLONE) PHP_ME(SolrParams, serialize, NULL, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, unserialize, SolrParams_unserialize_args, ZEND_ACC_PUBLIC) PHP_MALIAS(SolrParams, add, addParam, SolrParams_addParam_args, ZEND_ACC_PUBLIC) PHP_MALIAS(SolrParams, set, setParam, SolrParams_setParam_args, ZEND_ACC_PUBLIC) PHP_MALIAS(SolrParams, get, getParam, SolrParams_getParam_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_modifiable_params_methods. */ static zend_function_entry solr_modifiable_params_methods[] = { SOLR_CTOR(SolrModifiableParams, __construct, Solr_no_args) SOLR_DTOR(SolrModifiableParams, __destruct, Solr_no_args) PHP_FE_END }; /* }}} */ /* {{{ solr_query_methods. */ static zend_function_entry solr_query_methods[] = { SOLR_CTOR(SolrQuery, __construct, SolrQuery_constructor_args) SOLR_DTOR(SolrQuery, __destruct, Solr_no_args) /* CommonQueryParameters */ PHP_ME(SolrQuery, setQuery, SolrQuery_setQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getQuery, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setStart, SolrQuery_setStart_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getStart, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setRows, SolrQuery_setRows_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getRows, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addField, SolrQuery_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeField, SolrQuery_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addSortField, SolrQuery_addSortField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeSortField, SolrQuery_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getSortFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addFilterQuery, SolrQuery_addFilterQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeFilterQuery, SolrQuery_addFilterQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFilterQueries, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setShowDebugInfo, SolrQuery_setShowDebugInfo_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setExplainOther, SolrQuery_setExplainOther_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTimeAllowed, SolrQuery_setTimeAllowed_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTimeAllowed, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setOmitHeader, SolrQuery_setOmitHeader_args, ZEND_ACC_PUBLIC) /* CoreQueryParameters */ PHP_ME(SolrQuery, setEchoHandler, SolrQuery_setEchoHandler_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setEchoParams, SolrQuery_setEchoParams_args, ZEND_ACC_PUBLIC) /* SimpleFacetParameters */ PHP_ME(SolrQuery, setFacet, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacet, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addFacetField, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeFacetField, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addFacetQuery, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeFacetQuery, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetQueries, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetPrefix, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetPrefix, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetSort, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetSort, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetLimit, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetLimit, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetOffset, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetOffset, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetMinCount, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetMinCount, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetMissing, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetMissing, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetMethod, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetMethod, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetEnumCacheMinDefaultFrequency, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) /* Date Faceting Parameters */ PHP_ME(SolrQuery, addFacetDateField, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeFacetDateField, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetDateFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetDateStart, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetDateStart, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetDateEnd, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetDateEnd, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetDateGap, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetDateGap, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetDateHardEnd, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetDateHardEnd, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addFacetDateOther, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeFacetDateOther, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetDateOther, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) /* SimpleGroupParameters */ PHP_ME(SolrQuery, setGroup, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroup, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addGroupField, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addGroupFunction, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupFunctions, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addGroupQuery, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupQueries, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupLimit, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupLimit, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupOffset, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupOffset, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addGroupSortField, SolrQuery_addSortField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupSortFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupFormat, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupFormat, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupMain, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupMain, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupNGroups, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupNGroups, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupTruncate, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupTruncate, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupFacet, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupFacet, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupCachePercent, SolrQuery_setGroupCachePct_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupCachePercent, Solr_no_args, ZEND_ACC_PUBLIC) /* Collapse Function */ PHP_ME(SolrQuery, collapse, SolrQuery_collapse_args, ZEND_ACC_PUBLIC) /* Expand Componenet */ PHP_ME(SolrQuery, setExpand, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getExpand, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addExpandSortField, SolrQuery_addSortField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeExpandSortField, SolrQuery_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getExpandSortFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setExpandRows, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getExpandRows, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setExpandQuery, SolrQuery_setQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getExpandQuery, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addExpandFilterQuery, SolrQuery_addFilterQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeExpandFilterQuery, SolrQuery_addFilterQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getExpandFilterQueries, Solr_no_args, ZEND_ACC_PUBLIC) /* HighlightingParameters */ PHP_ME(SolrQuery, setHighlight, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlight, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addHighlightField, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeHighlightField, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightSnippets, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightSnippets, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightFragsize, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightFragsize, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightMergeContiguous, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightMergeContiguous, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightRequireFieldMatch, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightRequireFieldMatch, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightMaxAnalyzedChars, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightMaxAnalyzedChars, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightAlternateField, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightAlternateField, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightMaxAlternateFieldLength, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightMaxAlternateFieldLength, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightFormatter, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightFormatter, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightSimplePre, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightSimplePre, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightSimplePost, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightSimplePost, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightFragmenter, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightFragmenter, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightUsePhraseHighlighter, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightUsePhraseHighlighter, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightHighlightMultiTerm, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightHighlightMultiTerm, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightRegexSlop, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightRegexSlop, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightRegexPattern, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightRegexPattern, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightRegexMaxAnalyzedChars, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightRegexMaxAnalyzedChars, Solr_no_args, ZEND_ACC_PUBLIC) /* StatsComponent */ PHP_ME(SolrQuery, setStats, SolrQuery_stats_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getStats, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addStatsField, SolrQuery_stats_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeStatsField, SolrQuery_stats_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getStatsFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addStatsFacet, SolrQuery_stats_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeStatsFacet, SolrQuery_stats_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getStatsFacets, Solr_no_args, ZEND_ACC_PUBLIC) /* MoreLikeThis */ PHP_ME(SolrQuery, setMlt, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMlt, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltCount, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addMltField, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeMltField, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addMltQueryField, SolrQuery_mlt_2_2_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeMltQueryField, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltQueryFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltMinTermFrequency, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltMinTermFrequency, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltMinDocFrequency, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltMinDocFrequency, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltMinWordLength, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltMinWordLength, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltMaxWordLength, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltMaxWordLength, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltMaxNumTokens, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltMaxNumTokens, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltMaxNumQueryTerms, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltMaxNumQueryTerms, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltBoost, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltBoost, Solr_no_args, ZEND_ACC_PUBLIC) /* TermsComponent */ PHP_ME(SolrQuery, setTerms, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTerms, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsField, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsField, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsLowerBound, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsLowerBound, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsUpperBound, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsUpperBound, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsIncludeLowerBound, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsIncludeLowerBound, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsIncludeUpperBound, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsIncludeUpperBound, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsMinCount, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsMinCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsMaxCount, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsMaxCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsPrefix, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsPrefix, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsLimit, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsLimit, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsReturnRaw, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsReturnRaw, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsSort, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsSort, Solr_no_args, ZEND_ACC_PUBLIC) /* TODO : TermVectorComponent */ PHP_FE_END }; /* }}} */ /* {{{ solr_response_methods. */ static zend_function_entry solr_response_methods[] = { PHP_ME(SolrResponse, getHttpStatus, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getHttpStatusMessage, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, success, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getRequestUrl, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getRawRequestHeaders, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getRawRequest, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getRawResponseHeaders, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getRawResponse, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getDigestedResponse, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, setParseMode, SolrResponse_setParseMode_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getResponse, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getArrayResponse, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_query_response_methods. */ static zend_function_entry solr_query_response_methods[] = { SOLR_CTOR(SolrQueryResponse, __construct, Solr_no_args) SOLR_DTOR(SolrQueryResponse, __destruct, Solr_no_args) PHP_FE_END }; /* }}} */ /* {{{ solr_update_response_methods. */ static zend_function_entry solr_update_response_methods[] = { SOLR_CTOR(SolrUpdateResponse, __construct, Solr_no_args) SOLR_DTOR(SolrUpdateResponse, __destruct, Solr_no_args) PHP_FE_END }; /* }}} */ /* {{{ solr_ping_response_methods. */ static zend_function_entry solr_ping_response_methods[] = { SOLR_CTOR(SolrPingResponse, __construct, Solr_no_args) SOLR_DTOR(SolrPingResponse, __destruct, Solr_no_args) PHP_ME(SolrPingResponse, getResponse, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_generic_response_methods. */ static zend_function_entry solr_generic_response_methods[] = { SOLR_CTOR(SolrGenericResponse, __construct, Solr_no_args) SOLR_DTOR(SolrGenericResponse, __destruct, Solr_no_args) PHP_FE_END }; /* }}} */ /* {{{ solr_utils_methods. */ static zend_function_entry solr_utils_methods[] = { PHP_ME(SolrUtils, escapeQueryChars, SolrUtils_escapeQueryChars_arg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(SolrUtils, queryPhrase, SolrUtils_escapeQueryChars_arg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(SolrUtils, digestXmlResponse, SolrUtils_digestXML_arg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(SolrUtils, digestJsonResponse, SolrUtils_digestJson_arg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(SolrUtils, getSolrVersion, Solr_no_args, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(SolrUtils, getSolrStats, Solr_no_args, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_FE_END }; /* }}} */ /* {{{ solr_module_deps */ static zend_module_dep solr_module_deps[] = { ZEND_MOD_REQUIRED(PHP_LIBXML_EXTENSION_NAME) ZEND_MOD_REQUIRED(PHP_JSON_EXTENSION_NAME) ZEND_MOD_END }; /* }}} */ /* {{{ solr_module_entry */ zend_module_entry solr_module_entry = { STANDARD_MODULE_HEADER_EX, NULL, solr_module_deps, PHP_SOLR_EXTENSION_NAME, solr_functions, PHP_MINIT(solr), PHP_MSHUTDOWN(solr), PHP_RINIT(solr), PHP_RSHUTDOWN(solr), PHP_MINFO(solr), PHP_SOLR_DOTTED_VERSION, /* The current extension version number. */ STANDARD_MODULE_PROPERTIES }; /* }}} */ #ifdef COMPILE_DL_SOLR ZEND_GET_MODULE(solr) #endif /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(solr) { #ifdef ZTS /* As of ZE 2.2.0, this has to be NULL. */ /* It causes a segmentation fault, if it points to an actual function */ /* Probably a bug in the Zend Engine API */ ts_allocate_dtor php_solr_globals_dtor = NULL; #endif zend_class_entry ce; memcpy(&solr_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); memcpy(&solr_document_field_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); memcpy(&solr_input_document_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); memcpy(&solr_client_object_handlers, &solr_input_document_object_handlers, sizeof(zend_object_handlers)); memcpy(&solr_collapse_function_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); solr_collapse_function_object_handlers.clone_obj = solr_collapse_function_handlers_clone_object; /* solr_object_handlers.read_property = solr_object_read_property; */ solr_object_handlers.write_property = solr_object_write_property; solr_object_handlers.write_dimension = solr_object_write_dimension; solr_object_handlers.unset_property = solr_object_unset_property; solr_object_handlers.unset_dimension = solr_object_unset_dimension; solr_document_field_handlers.write_property = solr_document_field_write_property; solr_document_field_handlers.unset_property = solr_document_field_unset_property; #ifdef ZTS ZEND_INIT_MODULE_GLOBALS(solr, php_solr_globals_ctor, php_solr_globals_dtor); #else php_solr_globals_ctor(&solr_globals TSRMLS_CC); #endif /* Register extension constants */ solr_extension_register_constants(type, module_number TSRMLS_CC); /* Register the SolrObject class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_OBJECT_CLASSNAME, solr_object_methods); solr_ce_SolrObject = zend_register_internal_class(&ce TSRMLS_CC); solr_ce_SolrObject->ce_flags |= ZEND_ACC_FINAL_CLASS; /* SolrObject implements ArrayAccess */ zend_class_implements(solr_ce_SolrObject TSRMLS_CC, 1, solr_ce_ArrayAccess); /* Register the SolrDocument class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_DOCUMENT_CLASSNAME, solr_document_methods); solr_ce_SolrDocument = zend_register_internal_class(&ce TSRMLS_CC); solr_ce_SolrDocument->ce_flags |= ZEND_ACC_FINAL_CLASS; /* This internal property will be used to map to this SolrDocument instance */ zend_declare_property_long(solr_ce_SolrDocument, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) -1, 0L, ZEND_ACC_PRIVATE TSRMLS_CC); /* Register SolrDocument class constants */ solr_document_register_class_constants(solr_ce_SolrDocument TSRMLS_CC); /* SolrDocument implements ArrayAccess, Iterator, Serializable */ zend_class_implements(solr_ce_SolrDocument TSRMLS_CC, 3, solr_ce_ArrayAccess, solr_ce_Iterator, solr_ce_Serializable); /* Register the SolrDocumentField class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_DOCUMENT_FIELD_CLASSNAME, solr_document_field_methods); solr_ce_SolrDocumentField = zend_register_internal_class(&ce TSRMLS_CC); solr_ce_SolrDocumentField->ce_flags |= ZEND_ACC_FINAL_CLASS; /* Register the name, boost and values properties */ zend_declare_property_stringl(solr_ce_SolrDocumentField, SOLR_FIELD_NAME_PROPERTY_NAME, sizeof(SOLR_FIELD_NAME_PROPERTY_NAME)-1, SOLR_SPACE_STRING, sizeof(SOLR_SPACE_STRING)-1, ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_double(solr_ce_SolrDocumentField, SOLR_FIELD_BOOST_PROPERTY_NAME, sizeof(SOLR_FIELD_BOOST_PROPERTY_NAME)-1, 0.0f, ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_null(solr_ce_SolrDocumentField, SOLR_FIELD_VALUES_PROPERTY_NAME, sizeof(SOLR_FIELD_VALUES_PROPERTY_NAME)-1, ZEND_ACC_PUBLIC TSRMLS_CC); /* Register the SolrInputDocument class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_INPUT_DOCUMENT_CLASSNAME, solr_input_document_methods); solr_ce_SolrInputDocument = zend_register_internal_class(&ce TSRMLS_CC); solr_ce_SolrInputDocument->ce_flags |= ZEND_ACC_FINAL_CLASS; /* This internal property will be used to map to this SolrDocument instance */ zend_declare_property_long(solr_ce_SolrInputDocument, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) -1, 0L, ZEND_ACC_PRIVATE TSRMLS_CC); /* Register SolrInputDocument class constants */ solr_document_register_class_constants(solr_ce_SolrInputDocument TSRMLS_CC); /* Register SolrClient Class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_CLIENT_CLASSNAME, solr_client_methods); solr_ce_SolrClient = zend_register_internal_class(&ce TSRMLS_CC); /* solr_ce_SolrClient->ce_flags |= ZEND_ACC_FINAL_CLASS; */ /* This internal property will be used to map to this SolrClient instance */ zend_declare_property_long(solr_ce_SolrClient, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) -1, 0L, ZEND_ACC_PRIVATE TSRMLS_CC); /* Register SolrClient class constants */ solr_client_register_class_constants(solr_ce_SolrClient TSRMLS_CC); /* Register the SolrParams class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_PARAMS_CLASSNAME, solr_params_methods); solr_ce_SolrParams = zend_register_internal_class(&ce TSRMLS_CC); solr_ce_SolrParams->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; zend_class_implements(solr_ce_SolrParams TSRMLS_CC, 1, solr_ce_Serializable); /* This internal property will be used to map to this SolrParams instance */ zend_declare_property_long(solr_ce_SolrParams, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) -1, 0L, ZEND_ACC_PROTECTED TSRMLS_CC); /* Register the SolrModifiableParams class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_MODIFIABLE_PARAMS_CLASSNAME, solr_modifiable_params_methods); solr_ce_SolrModifiableParams = zend_register_internal_class_ex(&ce, solr_ce_SolrParams, NULL TSRMLS_CC); /* Register the SolrQuery class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_QUERY_CLASSNAME, solr_query_methods); solr_ce_SolrQuery = zend_register_internal_class_ex(&ce, solr_ce_SolrModifiableParams, NULL TSRMLS_CC); init_solr_dismax_query(TSRMLS_C); solr_query_register_class_constants(solr_ce_SolrQuery TSRMLS_CC); /* Register the SolrCollapseFunction class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_COLLAPSE_FUNCTION_CLASSNAME, solr_collapse_function_methods); solr_ce_SolrCollapseFunction = zend_register_internal_class_ex(&ce, solr_ce_SolrCollapseFunction, NULL TSRMLS_CC); zend_declare_property_long(solr_ce_SolrCollapseFunction, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME)-1, 0l, ZEND_ACC_PROTECTED TSRMLS_CC); solr_collapse_function_register_class_constants(solr_ce_SolrCollapseFunction TSRMLS_CC); /* Register the SolrResponse base class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_RESPONSE_CLASSNAME, solr_response_methods); solr_ce_SolrResponse = zend_register_internal_class(&ce TSRMLS_CC); solr_ce_SolrResponse->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; /* Register all the properties for the SolrResponse object */ solr_response_register_class_properties(solr_ce_SolrResponse TSRMLS_CC); /* Register all the constants for the SolrResponse object */ solr_response_register_class_constants(solr_ce_SolrResponse TSRMLS_CC); /* Register the SolrQueryResponse class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_QUERY_RESPONSE_CLASSNAME, solr_query_response_methods); solr_ce_SolrQueryResponse = zend_register_internal_class_ex(&ce, solr_ce_SolrResponse, NULL TSRMLS_CC); solr_ce_SolrQueryResponse->ce_flags |= ZEND_ACC_FINAL_CLASS; /* Register the SolrUpdateResponse class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_UPDATE_RESPONSE_CLASSNAME, solr_update_response_methods); solr_ce_SolrUpdateResponse = zend_register_internal_class_ex(&ce, solr_ce_SolrResponse, NULL TSRMLS_CC); solr_ce_SolrUpdateResponse->ce_flags |= ZEND_ACC_FINAL_CLASS; /* Register the SolrPingResponse class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_PING_RESPONSE_CLASSNAME, solr_ping_response_methods); solr_ce_SolrPingResponse = zend_register_internal_class_ex(&ce, solr_ce_SolrResponse, NULL TSRMLS_CC); solr_ce_SolrPingResponse->ce_flags |= ZEND_ACC_FINAL_CLASS; /* Register the SolrGenericResponse class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_GENERIC_RESPONSE_CLASSNAME, solr_generic_response_methods); solr_ce_SolrGenericResponse = zend_register_internal_class_ex(&ce, solr_ce_SolrResponse, NULL TSRMLS_CC); solr_ce_SolrGenericResponse->ce_flags |= ZEND_ACC_FINAL_CLASS; /* Register the SolrUtils class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_UTILS_CLASSNAME, solr_utils_methods); solr_ce_SolrUtils = zend_register_internal_class(&ce TSRMLS_CC); solr_ce_SolrUtils->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; /* Register the SolrException class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_EXCEPTION_CLASSNAME, solr_exception_methods); solr_ce_SolrException = zend_register_internal_class_ex(&ce, solr_ce_Exception, NULL TSRMLS_CC); solr_exception_register_class_properties(solr_ce_SolrException TSRMLS_CC); INIT_CLASS_ENTRY(ce, PHP_SOLR_ILLEGAL_OPERATION_EXCEPTION_CLASSNAME, solr_illegal_operation_exception_methods); solr_ce_SolrIllegalOperationException = zend_register_internal_class_ex(&ce, solr_ce_SolrException, NULL TSRMLS_CC); INIT_CLASS_ENTRY(ce, PHP_SOLR_ILLEGAL_ARGUMENT_EXCEPTION_CLASSNAME, solr_illegal_argument_exception_methods); solr_ce_SolrIllegalArgumentException = zend_register_internal_class_ex(&ce, solr_ce_SolrException, NULL TSRMLS_CC); INIT_CLASS_ENTRY(ce, PHP_SOLR_CLIENT_EXCEPTION_CLASSNAME, solr_client_exception_methods); solr_ce_SolrClientException = zend_register_internal_class_ex(&ce, solr_ce_SolrException, NULL TSRMLS_CC); INIT_CLASS_ENTRY(ce, PHP_SOLR_SERVER_EXCEPTION_CLASSNAME, solr_server_exception_methods); solr_ce_SolrServerException = zend_register_internal_class_ex(&ce, solr_ce_SolrException, NULL TSRMLS_CC); INIT_CLASS_ENTRY(ce, PHP_SOLR_MISSING_MANDATORY_PARAMETER_EXCEPTION_CLASSNAME, NULL); solr_ce_SolrMissingMandatoryParameterException = zend_register_internal_class_ex(&ce, solr_ce_SolrException, NULL TSRMLS_CC); return SUCCESS; } /* }}} */ /* {{{ PHP_RINIT_FUNCTION */ PHP_RINIT_FUNCTION(solr) { zend_bool persistent = SOLR_HASHTABLE_PERSISTENT; /* Initial size of the HashTable */ uint nSize = SOLR_INITIAL_HASH_TABLE_SIZE; ALLOC_HASHTABLE(SOLR_GLOBAL(documents)); ALLOC_HASHTABLE(SOLR_GLOBAL(clients)); ALLOC_HASHTABLE(SOLR_GLOBAL(params)); ALLOC_HASHTABLE(SOLR_GLOBAL(functions)); /* Initialize the HashTable for directory for SolrInputDocuments */ if (zend_hash_init(SOLR_GLOBAL(documents), nSize, NULL, solr_destroy_document, persistent) == FAILURE) { FREE_HASHTABLE(SOLR_GLOBAL(documents)); FREE_HASHTABLE(SOLR_GLOBAL(clients)); FREE_HASHTABLE(SOLR_GLOBAL(params)); FREE_HASHTABLE(SOLR_GLOBAL(functions)); php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to initialize hash table for documentsDirectory"); return FAILURE; } /* Initialize the HashTable for directory of SolrClients */ if (zend_hash_init(SOLR_GLOBAL(clients), nSize, NULL, solr_destroy_client, persistent) == FAILURE) { FREE_HASHTABLE(SOLR_GLOBAL(documents)); FREE_HASHTABLE(SOLR_GLOBAL(clients)); FREE_HASHTABLE(SOLR_GLOBAL(params)); FREE_HASHTABLE(SOLR_GLOBAL(functions)); php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to initialize hash table for clientsDirectory"); return FAILURE; } /* Initialize the HashTable for directory of SolrParams */ if (zend_hash_init(SOLR_GLOBAL(params), nSize, NULL, solr_destroy_params, persistent) == FAILURE) { FREE_HASHTABLE(SOLR_GLOBAL(documents)); FREE_HASHTABLE(SOLR_GLOBAL(clients)); FREE_HASHTABLE(SOLR_GLOBAL(params)); FREE_HASHTABLE(SOLR_GLOBAL(functions)); php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to initialize hash table for SolrParams"); return FAILURE; } /* Initialize the HashTable for directory of Functions */ if (zend_hash_init(SOLR_GLOBAL(functions), nSize, NULL, solr_destroy_function, persistent) == FAILURE) { FREE_HASHTABLE(SOLR_GLOBAL(documents)); FREE_HASHTABLE(SOLR_GLOBAL(clients)); FREE_HASHTABLE(SOLR_GLOBAL(params)); FREE_HASHTABLE(SOLR_GLOBAL(functions)); php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to initialize hash table for SolrFunction"); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_RSHUTDOWN_FUNCTION */ PHP_RSHUTDOWN_FUNCTION(solr) { zend_hash_destroy(SOLR_GLOBAL(documents)); zend_hash_destroy(SOLR_GLOBAL(clients)); zend_hash_destroy(SOLR_GLOBAL(params)); zend_hash_destroy(SOLR_GLOBAL(functions)); FREE_HASHTABLE(SOLR_GLOBAL(documents)); FREE_HASHTABLE(SOLR_GLOBAL(clients)); FREE_HASHTABLE(SOLR_GLOBAL(params)); FREE_HASHTABLE(SOLR_GLOBAL(functions)); return SUCCESS; } /* }}} */ /* {{{ PHP_MSHUTDOWN_FUNCTION */ PHP_MSHUTDOWN_FUNCTION(solr) { return SUCCESS; } /* }}} */ /* {{{ PHP_MINFO_FUNCTION */ PHP_MINFO_FUNCTION(solr) { php_info_print_table_start(); php_info_print_table_header(2, "Solr Support", "enabled"); php_info_print_table_row(2, "Version", PHP_SOLR_DOTTED_VERSION); php_info_print_table_row(2, "Last Build Date", __DATE__); php_info_print_table_row(2, "Last Build Time", __TIME__); php_info_print_table_end(); } /* }}} */ #endif /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/php_solr.h000066400000000000000000001071251374041537100210130ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #ifndef SOLRCLIENT_H #define SOLRCLIENT_H /* #define SOLR_MEM_DEBUG 1 */ #include
#ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_SOLR #include #include
#include
#include
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern zend_module_entry solr_module_entry; #define phpext_solr_ptr &solr_module_entry /* {{{ Startup, Shutdown, Activation, Deactivation and Info functions */ PHP_MINIT_FUNCTION(solr); /* Module Startup Function */ PHP_MSHUTDOWN_FUNCTION(solr); /* Module Shutdown Function */ PHP_RINIT_FUNCTION(solr); /* Request Activation Function */ PHP_RSHUTDOWN_FUNCTION(solr); /* Request Deactivation Function */ PHP_MINFO_FUNCTION(solr); /* Module Information Display Function */ /* }}} */ #ifdef ZTS #include #endif #if ((PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 2)) #define SOLR_ZEND_ENGINE_2_2 1 #endif /* List of constants */ #include "solr_constants.h" /* List of types */ #include "solr_types.h" #ifdef ZTS # define SOLR_GLOBAL(v) TSRMG(solr_globals_id, zend_solr_globals *, v) #else # define SOLR_GLOBAL(v) (solr_globals.v) #endif #include #include "php_solr_api.h" #include "php_solr_bc_macros.h" /* {{{ Variables declared elsewhere */ ZEND_EXTERN_MODULE_GLOBALS(solr) /* ZEND_EXTERN_MODULE_GLOBALS(json) */ extern zend_class_entry *solr_ce_SolrObject; extern zend_class_entry *solr_ce_SolrInputDocument; extern zend_class_entry *solr_ce_SolrDocument; extern zend_class_entry *solr_ce_SolrDocumentField; extern zend_class_entry *solr_ce_SolrClient; extern zend_class_entry *solr_ce_SolrParams; extern zend_class_entry *solr_ce_SolrModifiableParams; extern zend_class_entry *solr_ce_SolrCollapseFunction; extern zend_class_entry *solr_ce_SolrQuery; extern zend_class_entry *solr_ce_SolrResponse; extern zend_class_entry *solr_ce_SolrQueryResponse; extern zend_class_entry *solr_ce_SolrUpdateResponse; extern zend_class_entry *solr_ce_SolrPingResponse; extern zend_class_entry *solr_ce_SolrGenericResponse; extern zend_class_entry *solr_ce_SolrUtils; extern zend_class_entry *solr_ce_SolrException; extern zend_class_entry *solr_ce_SolrIllegalOperationException; extern zend_class_entry *solr_ce_SolrIllegalArgumentException; extern zend_class_entry *solr_ce_SolrClientException; extern zend_class_entry *solr_ce_SolrServerException; extern zend_class_entry *solr_ce_SolrMissingMandatoryParameterException; extern ZEND_API zend_class_entry *zend_ce_serializable; extern ZEND_API zend_class_entry *zend_ce_arrayaccess; extern ZEND_API zend_class_entry *zend_ce_iterator; /* {{{ Aliases for external class entries */ #define solr_ce_Serializable zend_ce_serializable #define solr_ce_ArrayAccess zend_ce_arrayaccess #define solr_ce_Iterator zend_ce_iterator #define solr_ce_Exception zend_exception_get_default(TSRMLS_C) /* }}} */ extern zend_object_handlers solr_object_handlers; extern zend_object_handlers solr_document_field_handlers; extern zend_object_handlers solr_input_document_object_handlers; extern zend_object_handlers solr_client_object_handlers; extern zend_object_handlers solr_response_object_handlers; extern zend_object_handlers solr_collapse_function_object_handlers; /* }}} */ /******************************************************************************/ /** DECLARATIONS FOR EXTENSION METHODS AND FUNCTIONS **/ /******************************************************************************/ /* {{{ Extension functions */ PHP_FUNCTION(solr_get_version); /* }}} */ /* {{{ SolrObject methods */ PHP_METHOD(SolrObject, __construct); PHP_METHOD(SolrObject, __destruct); PHP_METHOD(SolrObject, __set); PHP_METHOD(SolrObject, __get); PHP_METHOD(SolrObject, __isset); PHP_METHOD(SolrObject, __unset); PHP_METHOD(SolrObject, offsetSet); PHP_METHOD(SolrObject, offsetGet); PHP_METHOD(SolrObject, offsetExists); PHP_METHOD(SolrObject, offsetUnset); PHP_METHOD(SolrObject, getPropertyNames); /* }}} */ /* {{{ SolException object methods */ PHP_METHOD(SolrException, getInternalInfo); PHP_METHOD(SolrClientException, getInternalInfo); PHP_METHOD(SolrIllegalOperationException, getInternalInfo); PHP_METHOD(SolrIllegalArgumentException, getInternalInfo); PHP_METHOD(SolrServerException, getInternalInfo); /* }}} */ /* {{{ SolrDocument methods declarations */ PHP_METHOD(SolrDocument, __construct); PHP_METHOD(SolrDocument, __destruct); PHP_METHOD(SolrDocument, __clone); PHP_METHOD(SolrDocument, __get); PHP_METHOD(SolrDocument, __set); PHP_METHOD(SolrDocument, __isset); PHP_METHOD(SolrDocument, __unset); /* Methods from Serializable */ PHP_METHOD(SolrDocument, serialize); PHP_METHOD(SolrDocument, unserialize); /* Methods from ArrayAccess */ PHP_METHOD(SolrDocument, offsetExists); PHP_METHOD(SolrDocument, offsetGet); PHP_METHOD(SolrDocument, offsetSet); PHP_METHOD(SolrDocument, offsetUnset); /* Methods from Iterator */ PHP_METHOD(SolrDocument, current); PHP_METHOD(SolrDocument, key); PHP_METHOD(SolrDocument, next); PHP_METHOD(SolrDocument, rewind); PHP_METHOD(SolrDocument, valid); PHP_METHOD(SolrDocument, clear); PHP_METHOD(SolrDocument, addField); PHP_METHOD(SolrDocument, getFieldNames); PHP_METHOD(SolrDocument, getFieldCount); PHP_METHOD(SolrDocument, getField); PHP_METHOD(SolrDocument, toArray); PHP_METHOD(SolrDocument, fieldExists); PHP_METHOD(SolrDocument, deleteField); PHP_METHOD(SolrDocument, sort); PHP_METHOD(SolrDocument, merge); PHP_METHOD(SolrDocument, getInputDocument); PHP_METHOD(SolrDocument, hasChildDocuments); PHP_METHOD(SolrDocument, getChildDocuments); PHP_METHOD(SolrDocument, getChildDocumentsCount); /* }}} */ /* {{{ SolrDocumentField methods */ PHP_METHOD(SolrDocumentField, __construct); PHP_METHOD(SolrDocumentField, __destruct); /* }}} */ /* {{{ SolrInputDocument methods declarations */ PHP_METHOD(SolrInputDocument, __construct); PHP_METHOD(SolrInputDocument, __destruct); PHP_METHOD(SolrInputDocument, __clone); PHP_METHOD(SolrInputDocument, __sleep); PHP_METHOD(SolrInputDocument, __wakeup); PHP_METHOD(SolrInputDocument, setBoost); PHP_METHOD(SolrInputDocument, getBoost); PHP_METHOD(SolrInputDocument, clear); PHP_METHOD(SolrInputDocument, addField); PHP_METHOD(SolrInputDocument, setFieldBoost); PHP_METHOD(SolrInputDocument, getFieldBoost); PHP_METHOD(SolrInputDocument, getFieldNames); PHP_METHOD(SolrInputDocument, getFieldCount); PHP_METHOD(SolrInputDocument, getField); PHP_METHOD(SolrInputDocument, toArray); PHP_METHOD(SolrInputDocument, fieldExists); PHP_METHOD(SolrInputDocument, deleteField); PHP_METHOD(SolrInputDocument, sort); PHP_METHOD(SolrInputDocument, merge); PHP_METHOD(SolrInputDocument, addChildDocument); PHP_METHOD(SolrInputDocument, getChildDocuments); PHP_METHOD(SolrInputDocument, hasChildDocuments); PHP_METHOD(SolrInputDocument, getChildDocumentsCount); PHP_METHOD(SolrInputDocument, addChildDocuments); /* }}} */ /* {{{ SolrClient methods declarations */ PHP_METHOD(SolrClient, __construct); PHP_METHOD(SolrClient, __destruct); PHP_METHOD(SolrClient, __sleep); PHP_METHOD(SolrClient, __wakeup); PHP_METHOD(SolrClient, __clone); PHP_METHOD(SolrClient, query); PHP_METHOD(SolrClient, getOptions); PHP_METHOD(SolrClient, getDebug); PHP_METHOD(SolrClient, addDocument); PHP_METHOD(SolrClient, addDocuments); PHP_METHOD(SolrClient, setServlet); PHP_METHOD(SolrClient, setResponseWriter); PHP_METHOD(SolrClient, request); PHP_METHOD(SolrClient, ping); PHP_METHOD(SolrClient, system); PHP_METHOD(SolrClient, threads); PHP_METHOD(SolrClient, deleteById); PHP_METHOD(SolrClient, deleteByIds); PHP_METHOD(SolrClient, deleteByQuery); PHP_METHOD(SolrClient, deleteByQueries); PHP_METHOD(SolrClient, getById); PHP_METHOD(SolrClient, getByIds); PHP_METHOD(SolrClient, optimize); PHP_METHOD(SolrClient, commit); PHP_METHOD(SolrClient, rollback); /* }}} */ /* {{{ SolrParams methods declarations */ PHP_METHOD(SolrParams, setParam); /* Parameter can only accept one value */ PHP_METHOD(SolrParams, addParam); /* Parameter can accept more than one value */ PHP_METHOD(SolrParams, getParams); /* Retrieves the parameters and their values */ PHP_METHOD(SolrParams, getParam); /* Retrieves a parameter value */ PHP_METHOD(SolrParams, __toString); /* Returns a string representation of the object */ PHP_METHOD(SolrParams, toString); /* Returns a string representation of the object */ PHP_METHOD(SolrParams, getPreparedParams); /* Returns the prepared parameters */ PHP_METHOD(SolrParams, serialize); /* used by serialize() */ PHP_METHOD(SolrParams, unserialize); /* used by unserialize() */ PHP_METHOD(SolrParams, __clone); /* Used to enforce the cloning of SolrParams is currently unsupported */ /* }}} */ /* {{{ SolrModifiableParams methods declarations */ PHP_METHOD(SolrModifiableParams, __construct); PHP_METHOD(SolrModifiableParams, __destruct); /* }}} */ /* {{{ SolrQuery methods declarations */ /* Constructor and Destructor */ PHP_METHOD(SolrQuery, __construct); PHP_METHOD(SolrQuery, __destruct); /* CommonQueryParameters */ PHP_METHOD(SolrQuery, setQuery); PHP_METHOD(SolrQuery, getQuery); PHP_METHOD(SolrQuery, setStart); PHP_METHOD(SolrQuery, getStart); PHP_METHOD(SolrQuery, setRows); PHP_METHOD(SolrQuery, getRows); PHP_METHOD(SolrQuery, addField); PHP_METHOD(SolrQuery, removeField); PHP_METHOD(SolrQuery, getFields); PHP_METHOD(SolrQuery, addSortField); PHP_METHOD(SolrQuery, removeSortField); PHP_METHOD(SolrQuery, getSortFields); PHP_METHOD(SolrQuery, addFilterQuery); PHP_METHOD(SolrQuery, removeFilterQuery); PHP_METHOD(SolrQuery, getFilterQueries); PHP_METHOD(SolrQuery, setShowDebugInfo); PHP_METHOD(SolrQuery, setExplainOther); PHP_METHOD(SolrQuery, setTimeAllowed); PHP_METHOD(SolrQuery, getTimeAllowed); PHP_METHOD(SolrQuery, setOmitHeader); /* CoreQueryParameters */ PHP_METHOD(SolrQuery, setEchoHandler); PHP_METHOD(SolrQuery, setEchoParams); /* SimpleFacetParameters */ PHP_METHOD(SolrQuery, setFacet); PHP_METHOD(SolrQuery, getFacet); PHP_METHOD(SolrQuery, addFacetField); PHP_METHOD(SolrQuery, removeFacetField); PHP_METHOD(SolrQuery, getFacetFields); PHP_METHOD(SolrQuery, addFacetQuery); PHP_METHOD(SolrQuery, removeFacetQuery); PHP_METHOD(SolrQuery, getFacetQueries); PHP_METHOD(SolrQuery, setFacetPrefix); PHP_METHOD(SolrQuery, getFacetPrefix); PHP_METHOD(SolrQuery, setFacetSort); PHP_METHOD(SolrQuery, getFacetSort); PHP_METHOD(SolrQuery, setFacetLimit); PHP_METHOD(SolrQuery, getFacetLimit); PHP_METHOD(SolrQuery, setFacetOffset); PHP_METHOD(SolrQuery, getFacetOffset); PHP_METHOD(SolrQuery, setFacetMinCount); PHP_METHOD(SolrQuery, getFacetMinCount); PHP_METHOD(SolrQuery, setFacetMissing); PHP_METHOD(SolrQuery, getFacetMissing); PHP_METHOD(SolrQuery, setFacetMethod); PHP_METHOD(SolrQuery, getFacetMethod); PHP_METHOD(SolrQuery, setFacetEnumCacheMinDefaultFrequency); /* Date facet parameters */ PHP_METHOD(SolrQuery, addFacetDateField); PHP_METHOD(SolrQuery, removeFacetDateField); PHP_METHOD(SolrQuery, getFacetDateFields); PHP_METHOD(SolrQuery, setFacetDateStart); PHP_METHOD(SolrQuery, getFacetDateStart); PHP_METHOD(SolrQuery, setFacetDateEnd); PHP_METHOD(SolrQuery, getFacetDateEnd); PHP_METHOD(SolrQuery, setFacetDateGap); PHP_METHOD(SolrQuery, getFacetDateGap); PHP_METHOD(SolrQuery, setFacetDateHardEnd); PHP_METHOD(SolrQuery, getFacetDateHardEnd); PHP_METHOD(SolrQuery, addFacetDateOther); PHP_METHOD(SolrQuery, removeFacetDateOther); PHP_METHOD(SolrQuery, getFacetDateOther); /* GroupParameters */ PHP_METHOD(SolrQuery, setGroup); PHP_METHOD(SolrQuery, getGroup); PHP_METHOD(SolrQuery, addGroupField); PHP_METHOD(SolrQuery, getGroupFields); PHP_METHOD(SolrQuery, addGroupFunction); PHP_METHOD(SolrQuery, getGroupFunctions); PHP_METHOD(SolrQuery, addGroupQuery); PHP_METHOD(SolrQuery, getGroupQueries); PHP_METHOD(SolrQuery, setGroupLimit); PHP_METHOD(SolrQuery, getGroupLimit); PHP_METHOD(SolrQuery, setGroupOffset); PHP_METHOD(SolrQuery, getGroupOffset); PHP_METHOD(SolrQuery, addGroupSortField); PHP_METHOD(SolrQuery, getGroupSortFields); PHP_METHOD(SolrQuery, setGroupFormat); PHP_METHOD(SolrQuery, getGroupFormat); PHP_METHOD(SolrQuery, setGroupMain); PHP_METHOD(SolrQuery, getGroupMain); PHP_METHOD(SolrQuery, setGroupNGroups); PHP_METHOD(SolrQuery, getGroupNGroups); PHP_METHOD(SolrQuery, setGroupTruncate); PHP_METHOD(SolrQuery, getGroupTruncate); PHP_METHOD(SolrQuery, setGroupFacet); PHP_METHOD(SolrQuery, getGroupFacet); PHP_METHOD(SolrQuery, setGroupCachePercent); PHP_METHOD(SolrQuery, getGroupCachePercent); /* Collapse */ PHP_METHOD(SolrQuery, collapse); /* Expand Parameters */ PHP_METHOD(SolrQuery, setExpand); PHP_METHOD(SolrQuery, getExpand); PHP_METHOD(SolrQuery, addExpandSortField); PHP_METHOD(SolrQuery, removeExpandSortField); PHP_METHOD(SolrQuery, getExpandSortFields); PHP_METHOD(SolrQuery, setExpandRows); PHP_METHOD(SolrQuery, getExpandRows); PHP_METHOD(SolrQuery, setExpandQuery); PHP_METHOD(SolrQuery, getExpandQuery); PHP_METHOD(SolrQuery, addExpandFilterQuery); PHP_METHOD(SolrQuery, removeExpandFilterQuery); PHP_METHOD(SolrQuery, getExpandFilterQueries); /* HighlightingParameters */ PHP_METHOD(SolrQuery, setHighlight); PHP_METHOD(SolrQuery, getHighlight); PHP_METHOD(SolrQuery, addHighlightField); PHP_METHOD(SolrQuery, removeHighlightField); PHP_METHOD(SolrQuery, getHighlightFields); PHP_METHOD(SolrQuery, setHighlightSnippets); PHP_METHOD(SolrQuery, getHighlightSnippets); PHP_METHOD(SolrQuery, setHighlightFragsize); PHP_METHOD(SolrQuery, getHighlightFragsize); PHP_METHOD(SolrQuery, setHighlightMergeContiguous); PHP_METHOD(SolrQuery, getHighlightMergeContiguous); PHP_METHOD(SolrQuery, setHighlightRequireFieldMatch); PHP_METHOD(SolrQuery, getHighlightRequireFieldMatch); PHP_METHOD(SolrQuery, setHighlightMaxAnalyzedChars); PHP_METHOD(SolrQuery, getHighlightMaxAnalyzedChars); PHP_METHOD(SolrQuery, setHighlightAlternateField); PHP_METHOD(SolrQuery, getHighlightAlternateField); PHP_METHOD(SolrQuery, setHighlightMaxAlternateFieldLength); PHP_METHOD(SolrQuery, getHighlightMaxAlternateFieldLength); PHP_METHOD(SolrQuery, setHighlightFormatter); PHP_METHOD(SolrQuery, getHighlightFormatter); PHP_METHOD(SolrQuery, setHighlightSimplePre); PHP_METHOD(SolrQuery, getHighlightSimplePre); PHP_METHOD(SolrQuery, setHighlightSimplePost); PHP_METHOD(SolrQuery, getHighlightSimplePost); PHP_METHOD(SolrQuery, setHighlightFragmenter); PHP_METHOD(SolrQuery, getHighlightFragmenter); PHP_METHOD(SolrQuery, setHighlightUsePhraseHighlighter); PHP_METHOD(SolrQuery, getHighlightUsePhraseHighlighter); PHP_METHOD(SolrQuery, setHighlightHighlightMultiTerm); PHP_METHOD(SolrQuery, getHighlightHighlightMultiTerm); PHP_METHOD(SolrQuery, setHighlightRegexSlop); PHP_METHOD(SolrQuery, getHighlightRegexSlop); PHP_METHOD(SolrQuery, setHighlightRegexPattern); PHP_METHOD(SolrQuery, getHighlightRegexPattern); PHP_METHOD(SolrQuery, setHighlightRegexMaxAnalyzedChars); PHP_METHOD(SolrQuery, getHighlightRegexMaxAnalyzedChars); /* StatsComponent */ PHP_METHOD(SolrQuery, setStats); PHP_METHOD(SolrQuery, getStats); PHP_METHOD(SolrQuery, addStatsField); PHP_METHOD(SolrQuery, removeStatsField); PHP_METHOD(SolrQuery, getStatsFields); PHP_METHOD(SolrQuery, addStatsFacet); PHP_METHOD(SolrQuery, removeStatsFacet); PHP_METHOD(SolrQuery, getStatsFacets); /* MoreLikeThis */ PHP_METHOD(SolrQuery, setMlt); PHP_METHOD(SolrQuery, getMlt); PHP_METHOD(SolrQuery, setMltCount); PHP_METHOD(SolrQuery, getMltCount); PHP_METHOD(SolrQuery, addMltField); PHP_METHOD(SolrQuery, removeMltField); PHP_METHOD(SolrQuery, getMltFields); PHP_METHOD(SolrQuery, addMltQueryField); PHP_METHOD(SolrQuery, removeMltQueryField); PHP_METHOD(SolrQuery, getMltQueryFields); PHP_METHOD(SolrQuery, setMltMinTermFrequency); PHP_METHOD(SolrQuery, getMltMinTermFrequency); PHP_METHOD(SolrQuery, setMltMinDocFrequency); PHP_METHOD(SolrQuery, getMltMinDocFrequency); PHP_METHOD(SolrQuery, setMltMinWordLength); PHP_METHOD(SolrQuery, getMltMinWordLength); PHP_METHOD(SolrQuery, setMltMaxWordLength); PHP_METHOD(SolrQuery, getMltMaxWordLength); PHP_METHOD(SolrQuery, setMltMaxNumTokens); PHP_METHOD(SolrQuery, getMltMaxNumTokens); PHP_METHOD(SolrQuery, setMltMaxNumQueryTerms); PHP_METHOD(SolrQuery, getMltMaxNumQueryTerms); PHP_METHOD(SolrQuery, setMltBoost); PHP_METHOD(SolrQuery, getMltBoost); /* TermsComponent */ PHP_METHOD(SolrQuery, setTerms); PHP_METHOD(SolrQuery, getTerms); PHP_METHOD(SolrQuery, setTermsField); PHP_METHOD(SolrQuery, getTermsField); PHP_METHOD(SolrQuery, setTermsLowerBound); PHP_METHOD(SolrQuery, getTermsLowerBound); PHP_METHOD(SolrQuery, setTermsUpperBound); PHP_METHOD(SolrQuery, getTermsUpperBound); PHP_METHOD(SolrQuery, setTermsIncludeLowerBound); PHP_METHOD(SolrQuery, getTermsIncludeLowerBound); PHP_METHOD(SolrQuery, setTermsIncludeUpperBound); PHP_METHOD(SolrQuery, getTermsIncludeUpperBound); PHP_METHOD(SolrQuery, setTermsMinCount); PHP_METHOD(SolrQuery, getTermsMinCount); PHP_METHOD(SolrQuery, setTermsMaxCount); PHP_METHOD(SolrQuery, getTermsMaxCount); PHP_METHOD(SolrQuery, setTermsPrefix); PHP_METHOD(SolrQuery, getTermsPrefix); PHP_METHOD(SolrQuery, setTermsLimit); PHP_METHOD(SolrQuery, getTermsLimit); PHP_METHOD(SolrQuery, setTermsReturnRaw); PHP_METHOD(SolrQuery, getTermsReturnRaw); PHP_METHOD(SolrQuery, setTermsSort); PHP_METHOD(SolrQuery, getTermsSort); /* TODO : TermVectorComponent */ /* {{{ TermVectorComponent methods not yet defined */ PHP_METHOD(SolrQuery, setTermVector); PHP_METHOD(SolrQuery, setTermVectorTermFrequency); PHP_METHOD(SolrQuery, setTermVectorDocFrequency); PHP_METHOD(SolrQuery, setTermVectorPositions); PHP_METHOD(SolrQuery, setTermVectorOffsets); PHP_METHOD(SolrQuery, setTermVectorTfIdfProduct); PHP_METHOD(SolrQuery, setTermVectorAll); PHP_METHOD(SolrQuery, addTermVectorField); PHP_METHOD(SolrQuery, addTermVectorLuceneDocId); /* }}} */ /* }}} */ /* {{{ SolrResponse methods declarations */ PHP_METHOD(SolrResponse, getHttpStatus); PHP_METHOD(SolrResponse, getHttpStatusMessage); PHP_METHOD(SolrResponse, success); PHP_METHOD(SolrResponse, getRequestUrl); PHP_METHOD(SolrResponse, getRawRequestHeaders); PHP_METHOD(SolrResponse, getRawRequest); PHP_METHOD(SolrResponse, getRawResponseHeaders); PHP_METHOD(SolrResponse, getRawResponse); PHP_METHOD(SolrResponse, getDigestedResponse); PHP_METHOD(SolrResponse, setParseMode); PHP_METHOD(SolrResponse, getArrayResponse); PHP_METHOD(SolrResponse, getResponse); /* }}} */ /* {{{ SolrQueryResponse methods */ PHP_METHOD(SolrQueryResponse, __construct); PHP_METHOD(SolrQueryResponse, __destruct); /* }}} */ /* {{{ SolrUpdateResponse methods */ PHP_METHOD(SolrUpdateResponse, __construct); PHP_METHOD(SolrUpdateResponse, __destruct); /* }}} */ /* {{{ SolrPingResponse methods declarations */ PHP_METHOD(SolrPingResponse, __construct); PHP_METHOD(SolrPingResponse, __destruct); PHP_METHOD(SolrPingResponse, getResponse); /* }}} */ /* {{{ SolrGenericResponse methods */ PHP_METHOD(SolrGenericResponse, __construct); PHP_METHOD(SolrGenericResponse, __destruct); /* }}} */ /* {{{ SolrCollapseFunction methods */ PHP_METHOD(SolrCollapseFunction, __construct); PHP_METHOD(SolrCollapseFunction, __destruct); PHP_METHOD(SolrCollapseFunction, setField); PHP_METHOD(SolrCollapseFunction, getField); PHP_METHOD(SolrCollapseFunction, setMin); PHP_METHOD(SolrCollapseFunction, getMin); PHP_METHOD(SolrCollapseFunction, setMax); PHP_METHOD(SolrCollapseFunction, getMax); PHP_METHOD(SolrCollapseFunction, setNullPolicy); PHP_METHOD(SolrCollapseFunction, getNullPolicy); PHP_METHOD(SolrCollapseFunction, setHint); PHP_METHOD(SolrCollapseFunction, getHint); PHP_METHOD(SolrCollapseFunction, setSize); PHP_METHOD(SolrCollapseFunction, getSize); PHP_METHOD(SolrCollapseFunction, __toString); PHP_METHOD(SolrCollapseFunction, __sleep); PHP_METHOD(SolrCollapseFunction, __wakeup); /* }}} */ /* {{{ SolrUtils methods declarations */ PHP_METHOD(SolrUtils, escapeQueryChars); PHP_METHOD(SolrUtils, queryPhrase); PHP_METHOD(SolrUtils, digestXmlResponse); PHP_METHOD(SolrUtils, digestJsonResponse); PHP_METHOD(SolrUtils, getSolrVersion); PHP_METHOD(SolrUtils, getSolrStats); /* }}} */ /******************************************************************************/ /** DECLARATIONS FOR HELPERS AND EXTENSION-SPECIFIC FUNCTIONS **/ /******************************************************************************/ /* {{{ HTTP request function declarations */ size_t solr_curl_write(solr_char_t *data, size_t size, size_t nmemb, void *ctx); size_t solr_curl_write_header(solr_char_t *data, size_t size, size_t nmemb, void *ctx); int solr_curl_debug_callback(CURL *curl_handle, curl_infotype infotype, solr_char_t *debug_data, size_t size, void *ctx); PHP_SOLR_API int solr_init_options(solr_client_options_t *options TSRMLS_DC); PHP_SOLR_API int solr_init_handle(solr_curl_t *sch, solr_client_options_t *options TSRMLS_DC); PHP_SOLR_API int solr_make_request(solr_client_t *client, solr_request_type_t request_type TSRMLS_DC); PHP_SOLR_API void solr_free_handle(solr_curl_t *sch); PHP_SOLR_API void solr_free_option(solr_client_options_t *options); /* }}} */ PHP_SOLR_API void solr_extension_register_constants(int type, int module_number TSRMLS_DC); PHP_SOLR_API void solr_document_register_class_constants(zend_class_entry *ce TSRMLS_DC); PHP_SOLR_API void solr_client_register_class_constants(zend_class_entry *ce TSRMLS_DC); PHP_SOLR_API void solr_query_register_class_constants(zend_class_entry *ce TSRMLS_DC); PHP_SOLR_API void solr_collapse_function_register_class_constants(zend_class_entry *ce TSRMLS_DC); PHP_SOLR_API void solr_response_register_class_properties(zend_class_entry *ce TSRMLS_DC); PHP_SOLR_API void solr_response_register_class_constants(zend_class_entry *ce TSRMLS_DC); PHP_SOLR_API void solr_exception_register_class_properties(zend_class_entry *ce TSRMLS_DC); PHP_SOLR_API void solr_set_response_object_properties(zend_class_entry *scope, zval *response_object, const solr_client_t *client, const solr_string_t *request_url, zend_bool success TSRMLS_DC); PHP_SOLR_API void solr_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *filename, int file_line, const char *function_name, char *format, ...); PHP_SOLR_API void solr_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC, const char *filename, int file_line, const char *function_name); PHP_SOLR_API void solr_throw_solr_server_exception(solr_client_t *client,const char *requestType TSRMLS_DC); /* {{{ zval reference count post increment and decrement functions ++ and -- */ PHP_SOLR_API void solr_zval_add_ref(zval **p); PHP_SOLR_API void solr_zval_minus_ref(zval **p); /* }}} */ /* {{{ zend_hash_free functions */ PHP_SOLR_API void solr_destroy_field_list(solr_field_list_t **field_entry_ptr); PHP_SOLR_API void solr_destroy_document(void *document); PHP_SOLR_API void solr_destroy_client(void *document); PHP_SOLR_API void solr_destroy_params(void *solr_params); PHP_SOLR_API void solr_destroy_function(void *solr_function); PHP_SOLR_API void solr_destroy_param(solr_param_t **param); PHP_SOLR_API void solr_destroy_param_value(solr_param_t *param, solr_param_value_t *param_value); /* }}} */ /* {{{ used for SolrDocument field manipulations */ PHP_SOLR_API int solr_document_insert_field_value(solr_field_list_t *queue, const solr_char_t *field_value, double field_boost); PHP_SOLR_API void field_copy_constructor(solr_field_list_t **original_field_queue); /* }}} */ /* {{{ Used for comparison of document fields */ PHP_SOLR_API int solr_compare_field_name (const void *a, const void *b TSRMLS_DC); PHP_SOLR_API int solr_rcompare_field_name(const void *a, const void *b TSRMLS_DC); PHP_SOLR_API int solr_compare_field_value_count (const void *a, const void *b TSRMLS_DC); PHP_SOLR_API int solr_rcompare_field_value_count(const void *a, const void *b TSRMLS_DC); PHP_SOLR_API int solr_compare_field_boost_value (const void *a, const void *b TSRMLS_DC); PHP_SOLR_API int solr_rcompare_field_boost_value(const void *a, const void *b TSRMLS_DC); /* }}} */ PHP_SOLR_API solr_document_t *solr_init_document(long int document_index TSRMLS_DC); /* {{{ Functions for SolrParams Parameters */ PHP_SOLR_API solr_param_t *solr_create_new_param(const solr_char_t *param_name, size_t param_name_len, solr_param_type_t param_type, solr_bool allow_multiple, solr_param_value_equal_func_t value_equal_func, solr_param_fetch_func_t param_fetch_func, solr_param_value_free_func_t value_free_func, solr_char_t delimiter, solr_char_t arg_separator TSRMLS_DC); PHP_SOLR_API int solr_params_insert_param_value(solr_param_t *param, solr_param_value_t *param_value); PHP_SOLR_API int solr_params_delete_param_value(solr_param_t *param, const solr_param_value_t *target_value TSRMLS_DC); PHP_SOLR_API int solr_delete_solr_parameter(zval *objptr, solr_char_t *name, int name_length TSRMLS_DC); PHP_SOLR_API int solr_add_or_set_normal_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_bool allow_multiple TSRMLS_DC); PHP_SOLR_API int solr_add_simple_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC); PHP_SOLR_API int solr_add_simple_list_param_ex(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *separator TSRMLS_DC); PHP_SOLR_API int solr_add_arg_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t delimiter, solr_char_t arg_separator TSRMLS_DC); PHP_SOLR_API int solr_add_arg_list_param_ex(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t delimiter, solr_char_t arg_separator, solr_char_t delimiter_override TSRMLS_DC); PHP_SOLR_API solr_param_value_t* create_parameter_value_arg_list(solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t *delimiter_override, solr_bool delimiter_overriden TSRMLS_DC); #define solr_set_normal_param(objptr, pname, pname_length, pvalue, pvalue_length) solr_add_or_set_normal_param((objptr), (pname), (pname_length), (pvalue), (pvalue_length), 0 TSRMLS_CC) #define solr_add_normal_param(objptr, pname, pname_length, pvalue, pvalue_length) solr_add_or_set_normal_param((objptr), (pname), (pname_length), (pvalue), (pvalue_length), 1 TSRMLS_CC) PHP_SOLR_API int solr_normal_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b); PHP_SOLR_API int solr_simple_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b); PHP_SOLR_API int solr_arg_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b); PHP_SOLR_API void solr_normal_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer); PHP_SOLR_API void solr_simple_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer); PHP_SOLR_API void solr_arg_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer); PHP_SOLR_API void solr_normal_param_value_display(solr_param_t *solr_param, zval *param_value_array); PHP_SOLR_API void solr_simple_list_param_value_display(solr_param_t *solr_param, zval *param_value_array); PHP_SOLR_API void solr_arg_list_param_value_display(solr_param_t *solr_param, zval *param_value_array); /* Used to display values where allow_multiple is false */ PHP_SOLR_API void solr_normal_param_value_display_string(solr_param_t *solr_param, zval *param_value); PHP_SOLR_API void solr_normal_param_value_display_integer(solr_param_t *solr_param, zval *param_value); PHP_SOLR_API void solr_normal_param_value_display_double(solr_param_t *solr_param, zval *param_value); PHP_SOLR_API void solr_normal_param_value_display_boolean(solr_param_t *solr_param, zval *param_value); PHP_SOLR_API void solr_normal_param_value_display_sort_type(solr_param_t *solr_param, zval *param_value); PHP_SOLR_API int solr_param_find(zval *objptr, solr_char_t *pname, int pname_length, solr_param_t **solr_param TSRMLS_DC); PHP_SOLR_API void solr_normal_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode); PHP_SOLR_API void solr_simple_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode); PHP_SOLR_API void solr_arg_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode); PHP_SOLR_API void solr_normal_param_value_free(solr_param_value_t *param_value); PHP_SOLR_API void solr_simple_list_param_value_free(solr_param_value_t *param_value); PHP_SOLR_API void solr_arg_list_param_value_free(solr_param_value_t *param_value); /* Used for removing parameter values from the list of values for that param */ PHP_SOLR_API int solr_delete_normal_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC); PHP_SOLR_API int solr_delete_simple_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC); PHP_SOLR_API int solr_delete_arg_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC); /* initialize params_t structure */ PHP_SOLR_API int solr_init_params(solr_params_t **solr_params, long int index TSRMLS_DC); /* }}} */ /* {{{ Debugging functions */ /* Debug function used to print field values in the field queue */ PHP_SOLR_API void solr_debug_print_fields(const solr_field_list_t *queue); /* Used when debugging is enabled to run in verbose mode */ PHP_SOLR_API void solr_debug_printf(const char *format, ...); /* }}} */ /* {{{ Document utility functions */ PHP_SOLR_API void solr_generate_document_xml_from_fields(xmlNode *solr_doc_node, HashTable *document_fields TSRMLS_DC); PHP_SOLR_API void solr_create_document_field_object(solr_field_list_t *field_values, zval **field_obj TSRMLS_DC); PHP_SOLR_API void solr_add_doc_node(xmlNode *root_node, solr_document_t *doc_entry TSRMLS_DC); PHP_SOLR_API xmlDocPtr solr_xml_create_xml_doc(const xmlChar *root_node_name, xmlNode **root_node_ptr); /* }}} */ /* {{{ Utility functions */ PHP_SOLR_API long solr_get_json_last_error(TSRMLS_D); PHP_SOLR_API solr_char_t *solr_get_json_error_msg(solr_json_error_codes_t error_code); PHP_SOLR_API int solr_json_to_php_native(solr_string_t *buffer, const solr_char_t *json_string, int json_string_length TSRMLS_DC); PHP_SOLR_API int solr_is_supported_response_writer(const solr_char_t * response_writer, int length); PHP_SOLR_API int solr_hashtable_get_new_index(HashTable *ht TSRMLS_DC); PHP_SOLR_API int solr_fetch_document_entry(zval *objptr, solr_document_t **doc_entry TSRMLS_DC); PHP_SOLR_API int solr_fetch_client_entry(zval *objptr, solr_client_t **solr_client TSRMLS_DC); PHP_SOLR_API int solr_fetch_params_entry(zval *objptr, solr_params_t **solr_params TSRMLS_DC); PHP_SOLR_API int solr_fetch_function_entry(zval *objptr, solr_function_t **solr_params TSRMLS_DC); PHP_SOLR_API void solr_encode_generic_xml_response(solr_string_t *buffer, const solr_char_t *serialized, int size, long int parse_mode TSRMLS_DC); PHP_SOLR_API void solr_set_return_solr_params_object(zval **return_value_ptr, zval *current_objptr TSRMLS_DC); PHP_SOLR_API void solr_escape_query_chars(solr_string_t *sbuilder, solr_char_t *unescaped, long int unescaped_length); /* serialized array to serialized SolrObject */ PHP_SOLR_API int solr_sarray_to_sobject(solr_string_t *buffer TSRMLS_DC); PHP_SOLR_API int solr_sobject_to_sarray(solr_string_t *buffer TSRMLS_DC); PHP_SOLR_API void solr_response_get_response_impl(INTERNAL_FUNCTION_PARAMETERS, int return_array); /* }}} */ /* {{{ SolrFunction Helpers (solrfunc to avoid confusion with solr_function) */ PHP_SOLR_API int solr_solrfunc_update_string(zval *obj, solr_char_t *key, int key_len, solr_char_t *value, int value_len TSRMLS_DC); PHP_SOLR_API int solr_solrfunc_fetch_string(zval *obj, solr_char_t *key, int key_len, solr_string_t **string TSRMLS_DC); PHP_SOLR_API int solr_solrfunc_return_string(zval *obj, solr_char_t *key, int key_len, zval **return_value TSRMLS_DC); PHP_SOLR_API void solr_solrfunc_to_string(solr_function_t *function, solr_string_t **dest); PHP_SOLR_API int solr_solrfunc_display_string(zval *obj, solr_char_t *key, int key_len, zval **return_value TSRMLS_DC); zend_object_value solr_collapse_function_handlers_clone_object(zval *object TSRMLS_DC); /* }}} */ /* {{{ Solr Server Exception Handling */ PHP_SOLR_API int solr_get_xml_error(solr_string_t buffer, solr_exception_t *exceptionData TSRMLS_DC); PHP_SOLR_API int solr_get_json_error(solr_string_t buffer, solr_exception_t *exceptionData TSRMLS_DC); PHP_SOLR_API int solr_get_phpnative_error(solr_string_t buffer, solr_exception_t *exceptionData TSRMLS_DC); PHP_SOLR_API int hydrate_error_zval(zval *response, solr_exception_t *exceptionData TSRMLS_DC); /* }}} */ /* {{{ Solr Object Handlers */ #if PHP_VERSION_ID < 50399 PHP_SOLR_API void solr_object_write_property(zval *object, zval *member, zval *value TSRMLS_DC); PHP_SOLR_API zval *solr_object_read_property(zval *object, zval *member, int type TSRMLS_DC); PHP_SOLR_API void solr_object_unset_property(zval *object, zval *member TSRMLS_DC); #else PHP_SOLR_API void solr_object_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC); PHP_SOLR_API zval *solr_object_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC); PHP_SOLR_API void solr_object_unset_property(zval *object, zval *member, const zend_literal *key TSRMLS_DC); #endif PHP_SOLR_API void solr_object_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC); PHP_SOLR_API void solr_object_unset_dimension(zval *object, zval *offset TSRMLS_DC); #if PHP_VERSION_ID < 50399 PHP_SOLR_API void solr_document_field_write_property(zval *object, zval *member, zval *value TSRMLS_DC); PHP_SOLR_API void solr_document_field_unset_property(zval *object, zval *member TSRMLS_DC); #else PHP_SOLR_API void solr_document_field_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC); PHP_SOLR_API void solr_document_field_unset_property(zval *object, zval *member, const zend_literal *key TSRMLS_DC); #endif /* }}} */ int add_phrase_field(zval *obj, solr_char_t *pname, zval *boost, zval *slop, solr_char_t *field_name, int field_name_len TSRMLS_DC); #include "solr_macros.h" #include "php_solr_dismax_query.h" #endif /* HAVE_SOLR */ #endif /* SOLRCLIENT_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/php_solr_api.h000066400000000000000000000035721374041537100216450ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Israel Ekpo | +----------------------------------------------------------------------+ */ /* $Id$ */ /** * Declaring Macro for function attributes * * This is for functions on GNU systems and Win32 systems * * On Win32 systems __declspec(dllexport) adds the export directive to the * object file so you do not need to use a .def file * * Using __declspec(dllexport) in addition to using a .def file should * not cause build errors. */ #ifndef PHP_SOLR_API_H #define PHP_SOLR_API_H #ifdef PHP_WIN32 #define PHP_SOLR_API __declspec(dllexport) #elif defined(__GNUC__) && __GNUC__ >= 4 #define PHP_SOLR_API __attribute__ ((visibility("default"))) #else #define PHP_SOLR_API #endif #endif /* PHP_SOLR_API_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/php_solr_bc_macros.h000066400000000000000000000061111374041537100230140ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Israel Ekpo | +----------------------------------------------------------------------+ */ /* $Id$ */ /** * PHP 5 backward compatibility macros * * With the arrival of ZE 2.3.0, some of the member structures of the zval struct * were renamed. These macros will allow us to still be able to use the * new macros introduced since php 5.3.0 to compile code in the PHP 5.2.x series. * * We should allow up to php version 5.2.11. The latest stable release as of the * time of the initial release of this extension. */ #ifndef PHP_SOLR_BC_MACROS_H #define PHP_SOLR_BC_MACROS_H /* Retrieves the refcount */ #ifndef Z_REFCOUNT_P #define Z_REFCOUNT_P(pz) (pz)->refcount; #define Z_REFCOUNT_PP(ppz) Z_REFCOUNT_P(*(ppz)) #endif /* Sets the refcount to the specified value. */ #ifndef Z_SET_REFCOUNT_P #define Z_SET_REFCOUNT_P(pz, rc) (pz)->refcount = rc; #define Z_SET_REFCOUNT_PP(ppz) Z_SET_REFCOUNT_P((*ppz), rc) #endif /* Increases the recount by 1 */ #ifndef Z_ADDREF_P #define Z_ADDREF_P(pz) (pz)->refcount++; #define Z_ADDREF_PP(ppz) Z_ADDREF_P(*(ppz)) #endif /* Reduces the refcount by 1 */ #ifndef Z_DELREF_P #define Z_DELREF_P(pz) (pz)->refcount--; #define Z_DELREF_PP(ppz) Z_DELREF_P(*(ppz)) #endif /* Sets the isref member on the zval */ #ifndef Z_SET_ISREF_P #define Z_SET_ISREF_P(pz) (pz)->is_ref = 1; #define Z_SET_ISREF_PP(ppz) Z_SET_ISREF_P(*(ppz)) #endif /* Unsets the isref member on the zval */ #ifndef Z_UNSET_ISREF_P #define Z_UNSET_ISREF_P(pz) (pz)->is_ref = 0; #define Z_UNSET_ISREF_PP(ppz ) Z_UNSET_ISREF_P(*(ppz)) #endif /* Checks if is_ref is set on the zval */ #ifndef Z_ISREF_P #define Z_ISREF_P(pz) ((pz)->is_ref) #define Z_ISREF_PP(ppz) Z_ISREF_P(*(ppz)) #endif /* Sets the is_ref member to the specified value */ #ifndef Z_SET_ISREF_TO_P #define Z_SET_ISREF_TO_P(pz, isref) (pz)->is_ref = is_ref; #define Z_SET_ISREF_TO_PP(ppz, isref) Z_SET_ISREF_TO_P(*(ppz), isref) #endif #endif /* PHP_SOLR_BC_MACROS_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/php_solr_client.c000066400000000000000000001735311374041537100223500ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ Macros */ /* {{{ static void solr_client_init_urls(solr_client_t *solr_client) */ static void solr_client_init_urls(solr_client_t *solr_client) { solr_string_t url_prefix; solr_client_options_t *options = &(solr_client->options); memset(&url_prefix, 0, sizeof(solr_string_t)); /* Release all previously allocated URL values, if any */ solr_string_free(&(options->update_url)); solr_string_free(&(options->search_url)); solr_string_free(&(options->thread_url)); solr_string_free(&(options->ping_url)); solr_string_free(&(options->terms_url)); solr_string_free(&(options->system_url)); solr_string_free(&(options->get_url)); /* Making http://hostname:host_port/path/ */ if (options->secure) { solr_string_append_const(&url_prefix, "https://"); } else { solr_string_append_const(&url_prefix, "http://"); } solr_string_append_solr_string(&url_prefix, &(options->hostname)); solr_string_appendc(&url_prefix, ':'); solr_string_append_long(&url_prefix, options->host_port); solr_string_appendc(&url_prefix, '/'); solr_string_append_solr_string(&url_prefix, &(options->path)); solr_string_appendc(&url_prefix, '/'); /* Copying over the prefixes */ solr_string_append_solr_string(&(options->update_url), &url_prefix); solr_string_append_solr_string(&(options->search_url), &url_prefix); solr_string_append_solr_string(&(options->thread_url), &url_prefix); solr_string_append_solr_string(&(options->ping_url), &url_prefix); solr_string_append_solr_string(&(options->terms_url), &url_prefix); solr_string_append_solr_string(&(options->system_url), &url_prefix); solr_string_append_solr_string(&(options->get_url), &url_prefix); /* Making http://hostname:host_port/path/servlet/ */ solr_string_append_solr_string(&(options->update_url), &(options->update_servlet)); solr_string_append_solr_string(&(options->search_url), &(options->search_servlet)); solr_string_append_solr_string(&(options->thread_url), &(options->thread_servlet)); solr_string_append_solr_string(&(options->ping_url), &(options->ping_servlet)); solr_string_append_solr_string(&(options->terms_url), &(options->terms_servlet)); solr_string_append_solr_string(&(options->system_url), &(options->system_servlet)); solr_string_append_solr_string(&(options->get_url), &(options->get_servlet)); solr_string_append_const(&(options->update_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->search_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->thread_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->ping_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->terms_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->system_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->get_url), "/?version=2.2&indent=on&wt="); solr_string_append_solr_string(&(options->update_url), &(options->response_writer)); solr_string_append_solr_string(&(options->search_url), &(options->response_writer)); solr_string_append_solr_string(&(options->thread_url), &(options->response_writer)); solr_string_append_solr_string(&(options->ping_url), &(options->response_writer)); solr_string_append_solr_string(&(options->terms_url), &(options->response_writer)); solr_string_append_solr_string(&(options->system_url), &(options->response_writer)); solr_string_append_solr_string(&(options->get_url), &(options->response_writer)); solr_string_free(&url_prefix); } /* }}} */ /* {{{ static int solr_http_build_query(solr_string_t *buffer, zval *params_objptr, const solr_char_t *delimiter, int delimiter_length TSRMLS_DC) */ static int solr_http_build_query(solr_string_t *buffer, zval *params_objptr, const solr_char_t *delimiter, int delimiter_length TSRMLS_DC) { solr_params_t *solr_params = NULL; register zend_bool duplicate = 0; HashTable *params = NULL; if (solr_fetch_params_entry(params_objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve solr_params_t"); return FAILURE; } params = solr_params->params; SOLR_HASHTABLE_FOR_LOOP(params) { solr_param_t **solr_param_ptr = NULL; solr_param_t *solr_param = NULL; solr_string_t tmp_values_buffer; char *str_index = NULL; uint str_length = 0U; ulong num_index = 0L; zend_hash_get_current_key_ex(params, &str_index, &str_length, &num_index, duplicate, ((HashPosition *)0)); zend_hash_get_current_data_ex(params, (void **) &solr_param_ptr, ((HashPosition *)0)); memset(&tmp_values_buffer, 0, sizeof(solr_string_t)); solr_param = (*solr_param_ptr); solr_param->fetch_func(solr_param, &tmp_values_buffer); solr_string_append_solr_string(buffer, &tmp_values_buffer); solr_string_appends(buffer, delimiter, delimiter_length); solr_string_free(&tmp_values_buffer); } /* SOLR_HASHTABLE_FOR_LOOP(params) */ solr_string_remove_last_char(buffer); return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API solr_client_t* solr_init_client(zval * objptr TSRMLS_DC) inititialize solr_client_t and update zval's index */ PHP_SOLR_API solr_client_t *solr_init_client(zval *objptr TSRMLS_DC) { long int client_index = SOLR_UNIQUE_CLIENT_INDEX(); solr_client_t solr_client, *solr_client_dest; zend_update_property_long(solr_ce_SolrClient, objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, client_index TSRMLS_CC); memset(&solr_client, 0, sizeof(solr_client_t)); solr_client.client_index = client_index; if (zend_hash_index_update(SOLR_GLOBAL(clients), client_index, (void *)&solr_client, sizeof(solr_client_t), (void **)&solr_client_dest) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error while registering client in HashTable"); return NULL; } return solr_client_dest; } /* }}} */ /******************************************************************************/ /** DEFINITIONS FOR SOLR CLIENT METHODS **/ /******************************************************************************/ /* {{{ proto SolrClient::__construct(array options ) Constructor for SolrClient */ PHP_METHOD(SolrClient, __construct) { zval *options = NULL; HashTable *options_ht = NULL; zval **tmp1 = NULL, **tmp2 = NULL; solr_client_t *solr_client_dest = NULL; solr_client_options_t *client_options = NULL; solr_curl_t *handle = NULL; size_t num_options = 0; long int secure = 0L; long int verify_peer = 0L; long int verify_host = 2L; long int timeout = 30L; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &options) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter. The client options array is required for a SolrClient instance. It must also be passed as the only parameter"); return; } options_ht = Z_ARRVAL_P(options); num_options = zend_hash_num_elements(options_ht); if (!num_options) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "The SolrClient options cannot be an empty array"); return; } solr_client_dest = solr_init_client(getThis() TSRMLS_CC); client_options = &(solr_client_dest->options); handle = &(solr_client_dest->handle); solr_init_options(client_options TSRMLS_CC); solr_string_append_const(&(client_options->response_writer), SOLR_XML_RESPONSE_WRITER); solr_string_append_const(&(client_options->update_servlet), SOLR_DEFAULT_UPDATE_SERVLET); solr_string_append_const(&(client_options->search_servlet), SOLR_DEFAULT_SEARCH_SERVLET); solr_string_append_const(&(client_options->thread_servlet), SOLR_DEFAULT_THREADS_SERVLET); solr_string_append_const(&(client_options->ping_servlet), SOLR_DEFAULT_PING_SERVLET); solr_string_append_const(&(client_options->terms_servlet), SOLR_DEFAULT_TERMS_SERVLET); solr_string_append_const(&(client_options->system_servlet), SOLR_DEFAULT_SYSTEM_SERVLET); solr_string_append_const(&(client_options->get_servlet), SOLR_DEFAULT_GET_SERVLET); if (zend_hash_find(options_ht, "wt", sizeof("wt"), (void**) &tmp1) == SUCCESS && Z_TYPE_PP(tmp1) == IS_STRING && Z_STRLEN_PP(tmp1)) { if (solr_is_supported_response_writer((solr_char_t *) Z_STRVAL_PP(tmp1), Z_STRLEN_PP(tmp1))) { solr_string_set(&(client_options->response_writer), (const solr_char_t *) Z_STRVAL_PP(tmp1), Z_STRLEN_PP(tmp1)); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported response writer %s. This value will be ignored", Z_STRVAL_PP(tmp1)); } } if (zend_hash_find(options_ht, "secure", sizeof("secure"), (void**) &tmp1) == SUCCESS) { if (Z_TYPE_PP(tmp1) == IS_BOOL) { secure = (long int) Z_BVAL_PP(tmp1); } else if (Z_TYPE_PP(tmp1) == IS_LONG) { secure = Z_LVAL_PP(tmp1); } } client_options->secure = secure; /** * FOR NOW LET'S LEAVE IT AT 2 : This will force and require a match on the common name * if (secure && zend_hash_find(options_ht, "ssl_verifyhost", sizeof("ssl_verifyhost"), (void**) &tmp1) == SUCCESS && Z_TYPE_PP(tmp1) == IS_LONG) { verify_host = ((Z_LVAL_PP(tmp1) > 0L && Z_LVAL_PP(tmp1) < 3L) ? Z_LVAL_PP(tmp1) : verify_host); } */ client_options->ssl_verify_host = verify_host; if (secure && zend_hash_find(options_ht, "ssl_cert", sizeof("ssl_cert"), (void**) &tmp1) == SUCCESS && Z_TYPE_PP(tmp1) == IS_STRING && Z_STRLEN_PP(tmp1)) { verify_peer = 1L; solr_string_appends(&(client_options->ssl_cert), (solr_char_t *) Z_STRVAL_PP(tmp1), Z_STRLEN_PP(tmp1)); } if (secure && zend_hash_find(options_ht, "ssl_key", sizeof("ssl_key"), (void**) &tmp1) == SUCCESS && Z_TYPE_PP(tmp1) == IS_STRING && Z_STRLEN_PP(tmp1)) { verify_peer = 1L; solr_string_appends(&(client_options->ssl_key), (solr_char_t *) Z_STRVAL_PP(tmp1), Z_STRLEN_PP(tmp1)); } if (secure && zend_hash_find(options_ht, "ssl_keypassword", sizeof("ssl_keypassword"), (void**) &tmp1) == SUCCESS && Z_TYPE_PP(tmp1) == IS_STRING && Z_STRLEN_PP(tmp1)) { verify_peer = 1L; solr_string_appends(&(client_options->ssl_keypassword), (solr_char_t *) Z_STRVAL_PP(tmp1), Z_STRLEN_PP(tmp1)); } if (secure && zend_hash_find(options_ht, "ssl_cainfo", sizeof("ssl_cainfo"), (void**) &tmp1) == SUCCESS && Z_TYPE_PP(tmp1) == IS_STRING && Z_STRLEN_PP(tmp1)) { verify_peer = 1L; solr_string_appends(&(client_options->ssl_cainfo), (solr_char_t *) Z_STRVAL_PP(tmp1), Z_STRLEN_PP(tmp1)); } if (secure && zend_hash_find(options_ht, "ssl_capath", sizeof("ssl_capath"), (void**) &tmp1) == SUCCESS && Z_TYPE_PP(tmp1) == IS_STRING && Z_STRLEN_PP(tmp1)) { verify_peer = 1L; solr_string_appends(&(client_options->ssl_capath), (solr_char_t *) Z_STRVAL_PP(tmp1), Z_STRLEN_PP(tmp1)); } client_options->ssl_verify_peer = verify_peer; if (zend_hash_find(options_ht, "hostname", sizeof("hostname"), (void**) &tmp1) == SUCCESS && Z_TYPE_PP(tmp1) == IS_STRING && Z_STRLEN_PP(tmp1)) { solr_string_appends(&(client_options->hostname), (solr_char_t *) Z_STRVAL_PP(tmp1), Z_STRLEN_PP(tmp1)); } else { solr_string_append_const(&(client_options->hostname), SOLR_REQUEST_DEFAULT_HOST); } if (zend_hash_find(options_ht, "port", sizeof("port"), (void**) &tmp1) == SUCCESS && Z_TYPE_PP(tmp1) == IS_LONG) { client_options->host_port = Z_LVAL_PP(tmp1); } else if (zend_hash_find(options_ht, "port", sizeof("port"), (void**) &tmp1) == SUCCESS && Z_TYPE_PP(tmp1) == IS_STRING && Z_STRLEN_PP(tmp1)) { long int host_port = atol(Z_STRVAL_PP(tmp1)); if (host_port) { client_options->host_port = host_port; } else { client_options->host_port = SOLR_REQUEST_DEFAULT_PORT; } } else { client_options->host_port = SOLR_REQUEST_DEFAULT_PORT; } if (zend_hash_find(options_ht, "timeout", sizeof("timeout"), (void**) &tmp1) == SUCCESS) { long int timeout_value = 30L; if (Z_TYPE_PP(tmp1) == IS_LONG) { timeout_value = Z_LVAL_PP(tmp1); } else if (Z_TYPE_PP(tmp1) == IS_STRING && Z_STRLEN_PP(tmp1)) { timeout_value = atol(Z_STRVAL_PP(tmp1)); } timeout = ((timeout_value > 0L) ? timeout_value : timeout); } client_options->timeout = timeout; if (zend_hash_find(options_ht, "path", sizeof("path"), (void**) &tmp1) == SUCCESS && Z_TYPE_PP(tmp1) == IS_STRING && Z_STRLEN_PP(tmp1)) { char *path_to_solr = Z_STRVAL_PP(tmp1); size_t path_to_solr_start = 0; size_t length_adjustment = 0; if (path_to_solr[0] == '/') { path_to_solr_start = length_adjustment = 1; } if (path_to_solr[Z_STRLEN_PP(tmp1)] == '/') { length_adjustment++; } solr_string_appends(&(client_options->path), Z_STRVAL_PP(tmp1) + path_to_solr_start, Z_STRLEN_PP(tmp1) - length_adjustment); } else { solr_string_append_const(&(client_options->path), SOLR_REQUEST_DEFAULT_PATH); } if (zend_hash_find(options_ht, "query_string_delimiter", sizeof("query_string_delimiter"), (void**) &tmp1) == SUCCESS && Z_TYPE_PP(tmp1) == IS_STRING) { solr_string_appends(&(client_options->qs_delimiter), Z_STRVAL_PP(tmp1), Z_STRLEN_PP(tmp1)); } else { solr_string_append_const(&(client_options->qs_delimiter), SOLR_REQUEST_DEFAULT_QS_DELIMITER); } if (zend_hash_find(options_ht, "login", sizeof("login"), (void**) &tmp1) == SUCCESS && Z_TYPE_PP(tmp1) == IS_STRING && zend_hash_find(options_ht, "password", sizeof("password"), (void**) &tmp2) == SUCCESS && Z_TYPE_PP(tmp2) == IS_STRING) { solr_string_appends(&(client_options->http_auth_credentials), Z_STRVAL_PP(tmp1), Z_STRLEN_PP(tmp1)); solr_string_appendc(&(client_options->http_auth_credentials), ':'); solr_string_appends(&(client_options->http_auth_credentials), Z_STRVAL_PP(tmp2), Z_STRLEN_PP(tmp2)); } if (zend_hash_find(options_ht, "proxy_host", sizeof("proxy_host"), (void**) &tmp1) == SUCCESS && Z_TYPE_PP(tmp1) == IS_STRING) { solr_string_appends(&(client_options->proxy_hostname), Z_STRVAL_PP(tmp1), Z_STRLEN_PP(tmp1)); } if (zend_hash_find(options_ht, "proxy_port", sizeof("proxy_port"), (void**) &tmp1) == SUCCESS) { long int proxy_port_value = 0L; if (Z_TYPE_PP(tmp1) == IS_LONG) { proxy_port_value = Z_LVAL_PP(tmp1); } else if (Z_TYPE_PP(tmp1) == IS_STRING && Z_STRLEN_PP(tmp1)) { proxy_port_value = atol(Z_STRVAL_PP(tmp1)); } if (proxy_port_value > 0L) { client_options->proxy_port = proxy_port_value; } } if (zend_hash_find(options_ht, "proxy_login", sizeof("proxy_login"), (void**)&tmp1) == SUCCESS && Z_TYPE_PP(tmp1) == IS_STRING && zend_hash_find(options_ht, "proxy_password", sizeof("proxy_password"), (void**)&tmp2) == SUCCESS && Z_TYPE_PP(tmp2) == IS_STRING) { solr_string_appends(&(client_options->proxy_auth_credentials), Z_STRVAL_PP(tmp1), Z_STRLEN_PP(tmp1)); solr_string_appendc(&(client_options->proxy_auth_credentials), ':'); solr_string_appends(&(client_options->proxy_auth_credentials), Z_STRVAL_PP(tmp2), Z_STRLEN_PP(tmp2)); } solr_init_handle(handle, client_options TSRMLS_CC); SOLR_GLOBAL(client_count)++; } /* }}} */ /* {{{ proto SolrClient::__destruct(void) Destructor for SolrClient */ PHP_METHOD(SolrClient, __destruct) { solr_client_t *solr_client = NULL; if (solr_fetch_client_entry(getThis(), &solr_client TSRMLS_CC) == SUCCESS) { zend_hash_index_del(SOLR_GLOBAL(clients), solr_client->client_index); /* Keep track of how many SolrClient instances we have. */ SOLR_GLOBAL(client_count)--; return ; } } /* }}} */ /* {{{ proto SolrClient::__sleep(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrClient, __sleep) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1001 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1001_MSG); } /* }}} */ /* {{{ proto SolrClient::__wakeup(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrClient, __wakeup) { solr_init_client(getThis() TSRMLS_CC); solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1001 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1001_MSG); } /* }}} */ /* {{{ proto SolrClient::__clone(void) Should not be called directly. Cloning is not supported. */ PHP_METHOD(SolrClient, __clone) { solr_client_t *solr_client_ptr = NULL; solr_curl_t *handle = NULL; solr_client_ptr = solr_init_client(getThis() TSRMLS_CC); handle = &(solr_client_ptr->handle); solr_init_options(&(solr_client_ptr->options) TSRMLS_CC); solr_init_handle(handle, &(solr_client_ptr->options) TSRMLS_CC); solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_4001 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Cloning of SolrClient objects is currently not supported"); } /* }}} */ /* {{{ proto bool SolrClient::setServelet(int servlet_type, string new_value) Changes the specified servlet type to a new value */ PHP_METHOD(SolrClient, setServlet) { long int servlet_type_value = 0L; solr_char_t *new_servlet_value = NULL; int new_servlet_value_length = 0; solr_client_t *client = NULL; solr_servlet_type_t servlet_type = SOLR_SERVLET_TYPE_BEGIN; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &servlet_type_value, &new_servlet_value, &new_servlet_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter."); RETURN_FALSE; } if (!new_servlet_value_length) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid servlet value."); RETURN_FALSE; } /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client"); RETURN_FALSE; } servlet_type = (solr_servlet_type_t) servlet_type_value; switch(servlet_type) { case SOLR_SERVLET_TYPE_SEARCH : { solr_string_set(&(client->options.search_servlet), new_servlet_value, new_servlet_value_length); } break; case SOLR_SERVLET_TYPE_TERMS : { solr_string_set(&(client->options.terms_servlet), new_servlet_value, new_servlet_value_length); } break; case SOLR_SERVLET_TYPE_UPDATE : { solr_string_set(&(client->options.update_servlet), new_servlet_value, new_servlet_value_length); } break; case SOLR_SERVLET_TYPE_THREADS : { solr_string_set(&(client->options.thread_servlet), new_servlet_value, new_servlet_value_length); } break; case SOLR_SERVLET_TYPE_PING : { solr_string_set(&(client->options.ping_servlet), new_servlet_value, new_servlet_value_length); } break; case SOLR_SERVLET_TYPE_SYSTEM : { solr_string_set(&(client->options.system_servlet), new_servlet_value, new_servlet_value_length); } break; default : { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid Servlet type %ld specified. Value discarded.", servlet_type_value); RETURN_FALSE; } } RETURN_TRUE; } /* }}} */ // client->handle.err.str client->handle.request_body_debug.buffer.str /* {{{ proto SolrQueryResponse SolrClient::query(SolrParams query) Sends a name-value pair request to the Solr server. */ PHP_METHOD(SolrClient, query) { zval *solr_params_obj = NULL; solr_client_t *client = NULL; solr_params_t *solr_params = NULL; solr_string_t *buffer = NULL; solr_char_t *delimiter = NULL; int delimiter_length = 0; zend_bool success = 1; solr_request_type_t solr_request_type = SOLR_REQUEST_SEARCH; solr_string_t *request_url = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Return value requested but output not processed."); return; } /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &solr_params_obj, solr_ce_SolrParams) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_4000_MSG); return; } /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client"); return; } /* Make sure the SolrParams object passed is a valid one */ if (solr_fetch_params_entry(solr_params_obj, &solr_params TSRMLS_CC) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "SolrParams parameter passed is not a valid one."); return ; } /* The SolrParams instance must contain at least one parameter */ if (zend_hash_num_elements(solr_params->params) < 1) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "SolrParams parameter passed contains no parameters."); return ; } buffer = &(client->handle.request_body.buffer); /* Get rid of all the data from the previous request */ solr_string_free(buffer); delimiter = client->options.qs_delimiter.str; delimiter_length = client->options.qs_delimiter.len; /* Remove wt if any */ zend_hash_del(solr_params->params, "wt", sizeof("wt")-1); if (solr_http_build_query(buffer, solr_params_obj, delimiter, delimiter_length TSRMLS_CC) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1003 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Error building HTTP query from parameters"); return; } /* Always reset the URLs before making any request */ solr_client_init_urls(client); request_url = &(client->options.search_url); /* terms.fl is a required parameter for the TermsComponent */ if (zend_hash_exists(solr_params->params, "terms.fl", sizeof("terms.fl")-1)) { /* Change the request type to a TermsComponent request */ solr_request_type = SOLR_REQUEST_TERMS; request_url =&(client->options.terms_url); } /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, solr_request_type TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"query"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrQueryResponse); solr_set_response_object_properties(solr_ce_SolrQueryResponse, return_value, client, request_url, success TSRMLS_CC); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::addDocument(SolrInputDocument doc [, bool overwrite [, int commitWithin]]) Adds a document to the Solr server. */ PHP_METHOD(SolrClient, addDocument) { zval *solr_input_doc = NULL; zend_bool overwrite = 1; long int commitWithin = 0L; solr_document_t *doc_entry = NULL; solr_client_t *client = NULL; HashTable *document_fields; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; char *overwriteValue = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|bl", &solr_input_doc, solr_ce_SolrInputDocument, &overwrite, &commitWithin) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter."); return; } if (solr_fetch_document_entry(solr_input_doc, &doc_entry TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "SolrInputDocument is not valid. Object not present in HashTable"); return; } document_fields = doc_entry->fields; /* Document must contain at least one field */ if (0 == zend_hash_num_elements(document_fields)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "SolrInputDocument has no fields"); return; } /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client"); return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "add", &root_node); overwriteValue = (overwrite)? "true" : "false"; xmlNewProp(root_node, (xmlChar *) "overwrite", (xmlChar *) overwriteValue); if (commitWithin > 0L) { auto char commitWithinBuffer[32]; memset(commitWithinBuffer, 0, sizeof(commitWithinBuffer)); php_sprintf(commitWithinBuffer, "%ld", commitWithin); xmlNewProp(root_node, (xmlChar *) "commitWithin", (xmlChar *) commitWithinBuffer); } solr_add_doc_node(root_node, doc_entry TSRMLS_CC); xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } if (return_value_used) { object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::addDocuments(array docs [, bool overwrite [, int commitWithin]]) Adds an array of SolrInputDocuments to the Solr server. */ PHP_METHOD(SolrClient, addDocuments) { zval *docs_array = NULL; zend_bool overwrite = 1; long int commitWithin = 0L; HashTable *solr_input_docs; size_t num_input_docs = 0; solr_client_t *client = NULL; solr_document_t **doc_entries = NULL; size_t curr_pos = 0U; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; xmlChar *overwriteValue = NULL; size_t pos = 0U; solr_document_t *current_doc_entry = NULL; int format = 1; int size = 0; zend_bool success = 1; xmlChar *request_string = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|bl", &docs_array, &overwrite, &commitWithin) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } solr_input_docs = Z_ARRVAL_P(docs_array); num_input_docs = zend_hash_num_elements(solr_input_docs); if(!num_input_docs) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The array parameter passed is empty"); return; } /* This should be released if there is an error */ doc_entries = (solr_document_t **) pemalloc((sizeof(solr_document_t *) * (num_input_docs + 1)), SOLR_DOCUMENT_PERSISTENT); memset(doc_entries, 0, sizeof(solr_document_t *) * (num_input_docs + 1)); /* Please check all the SolrInputDocument instances passed via the array */ SOLR_HASHTABLE_FOR_LOOP(solr_input_docs) { zval **solr_input_doc = NULL; solr_document_t *doc_entry = NULL; HashTable *document_fields; zend_hash_get_current_data_ex(solr_input_docs, (void **) &solr_input_doc, ((HashPosition *)0)); if (Z_TYPE_PP(solr_input_doc) != IS_OBJECT || !instanceof_function(Z_OBJCE_PP(solr_input_doc), solr_ce_SolrInputDocument TSRMLS_CC)) { SOLR_FREE_DOC_ENTRIES(doc_entries); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u is not a valid SolrInputDocument instance", (curr_pos + 1U)); return; } if (solr_fetch_document_entry((*solr_input_doc), &doc_entry TSRMLS_CC) == FAILURE) { SOLR_FREE_DOC_ENTRIES(doc_entries); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u is not valid. Object not present in HashTable", (curr_pos + 1U)); return; } document_fields = doc_entry->fields; /* SolrInputDocument must contain at least one field */ if (0 == zend_hash_num_elements(document_fields)) { SOLR_FREE_DOC_ENTRIES(doc_entries); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u has no fields", (curr_pos + 1U)); return; } doc_entries[curr_pos] = doc_entry; curr_pos++; } /* Mark the end of the list */ doc_entries[curr_pos] = NULL; /* All the input documents have been validated. We can now retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { SOLR_FREE_DOC_ENTRIES(doc_entries); php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "add", &root_node); overwriteValue = (overwrite) ? (xmlChar *) "true" : (xmlChar *) "false"; xmlNewProp(root_node, (xmlChar *) "overwrite", overwriteValue); if (commitWithin > 0L) { auto char commitWithinBuffer[32]; memset(commitWithinBuffer, 0, sizeof(commitWithinBuffer)); php_sprintf(commitWithinBuffer, "%ld", commitWithin); xmlNewProp(root_node, (xmlChar *) "commitWithin", (xmlChar *) commitWithinBuffer); } /* Grab the first (solr_document_t *) pointer */ current_doc_entry = doc_entries[pos]; while(current_doc_entry != NULL) { solr_add_doc_node(root_node, current_doc_entry TSRMLS_CC); pos++; /* Grab the next (solr_document_t *) pointer */ current_doc_entry = doc_entries[pos]; } /* We are done with the doc_entries pointer */ SOLR_FREE_DOC_ENTRIES(doc_entries); xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } if (return_value_used) { object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::request(string request_string) Allows the user to send a manual XML update request */ PHP_METHOD(SolrClient, request) { solr_char_t *request_string = NULL; int request_length = 0; solr_client_t *client = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &request_string, &request_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } if (!request_length) { solr_throw_exception(solr_ce_SolrIllegalArgumentException, "Invalid request length. Request string is empty.", SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC); return; } if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } /* The update request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), request_string, request_length); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } if (return_value_used) { object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::deleteById(string id) Allows the user to delete a document by id */ PHP_METHOD(SolrClient, deleteById) { solr_char_t *id = NULL; int id_length = 0L; solr_client_t *client = NULL; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; xmlChar *escaped_id_value = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &id, &id_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } if (!id_length) { solr_throw_exception(solr_ce_SolrIllegalArgumentException, "Invalid id parameter", SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC); return; } if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "delete", &root_node); escaped_id_value = xmlEncodeEntitiesReentrant(doc_ptr, (xmlChar *) id); xmlNewChild(root_node, NULL, (xmlChar *) "id", escaped_id_value); xmlFree(escaped_id_value); xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } if (return_value_used) { object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::request(array ids) Allows the user to delete a set of documents by ids. This should be an array of strings */ PHP_METHOD(SolrClient, deleteByIds) { zval *ids_array = NULL; HashTable *doc_ids = NULL; size_t num_ids = 0; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; zend_bool invalid_param = 0; size_t error_pos = 1, current_position = 1; solr_client_t *client = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &ids_array) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } doc_ids = Z_ARRVAL_P(ids_array); num_ids = zend_hash_num_elements(doc_ids); if(!num_ids) { solr_throw_exception(solr_ce_SolrIllegalArgumentException, "The array parameter passed is empty", SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC); return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "delete", &root_node); SOLR_HASHTABLE_FOR_LOOP(doc_ids) { zval **id_zval = NULL; zend_hash_get_current_data_ex(doc_ids, (void **) &id_zval, ((HashPosition *)0)); if (Z_TYPE_PP(id_zval) == IS_STRING && Z_STRLEN_PP(id_zval)) { xmlChar *escaped_id_value = xmlEncodeEntitiesReentrant(doc_ptr, (xmlChar *) Z_STRVAL_PP(id_zval)); xmlNewChild(root_node, NULL, (xmlChar *) "id", escaped_id_value); xmlFree(escaped_id_value); } else { invalid_param = 1; /* This id is not a valid string */ error_pos = current_position; goto end_doc_ids_loop; } current_position++; } end_doc_ids_loop : if (invalid_param) { xmlFreeDoc(doc_ptr); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Id number %u is not a valid string", error_pos); return; } if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } if (return_value_used) { object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::deleteByQuery(string query) Allows the user to delete a set of documents matching the query */ PHP_METHOD(SolrClient, deleteByQuery) { solr_char_t *query = NULL; int query_length = 0L; solr_client_t *client = NULL; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; xmlChar *escaped_query_value = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &query, &query_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } if (!query_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "The query parameter is not a valid id"); return; } if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "delete", &root_node); escaped_query_value = xmlEncodeEntitiesReentrant(doc_ptr, (xmlChar *) query); xmlNewChild(root_node, NULL, (xmlChar *) "query", escaped_query_value); xmlFree(escaped_query_value); xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } if (return_value_used) { object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } } /* }}} */ /* {{{ proto SolrQueryResponse SolrClient::getById(string id) Get Document By Id. Utilizes Solr Realtime Get (RTG) */ PHP_METHOD(SolrClient, getById) { solr_client_t *client; solr_char_t *id; int id_len = 0; solr_string_t query_string; int success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &id, &id_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } /* Always reset the URLs before making any request */ solr_client_init_urls(client); solr_string_init(&query_string); solr_string_appends(&query_string, "id=", sizeof("id=")-1); solr_string_appends(&query_string, id, id_len); solr_string_append_solr_string(&(client->handle.request_body.buffer), &query_string); if (solr_make_request(client, SOLR_REQUEST_GET TSRMLS_CC) == FAILURE) { /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"get"); success = 0; } if (return_value_used) { object_init_ex(return_value, solr_ce_SolrQueryResponse); solr_set_response_object_properties(solr_ce_SolrQueryResponse, return_value, client, &(client->options.get_url), success TSRMLS_CC); } solr_string_free(&query_string); } /* }}} */ /* {{{ proto SolrQueryResponse SolrClient::getByIds(array ids) Get Documents by their Ids. Utilizes Solr Realtime Get (RTG) */ PHP_METHOD(SolrClient, getByIds) { solr_client_t *client; HashTable *ids = NULL; zval *ids_z = NULL; zend_bool invalid_param = 0; solr_string_t query_string; size_t current_position = 0; int success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &ids_z) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Internal Error: Cannot fetch client object"); return; } ids = Z_ARRVAL_P(ids_z); if (ids->nNumOfElements < 1) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, 4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter: at least 1 ID is required. Passed an empty array.", current_position); } /* Always reset the URLs before making any request */ solr_client_init_urls(client); solr_string_init(&query_string); solr_string_appends(&query_string, "ids=", sizeof("ids=")-1); SOLR_HASHTABLE_FOR_LOOP(ids) { zval **id_zv = NULL; zend_hash_get_current_data(ids, (void **) &id_zv); if (Z_TYPE_PP(id_zv) == IS_STRING && Z_STRLEN_PP(id_zv)) { solr_string_appends(&query_string, Z_STRVAL_PP(id_zv), Z_STRLEN_PP(id_zv)); solr_string_appendc(&query_string, ','); } else { invalid_param = 1; goto solr_getbyids_exit; } current_position++; } solr_getbyids_exit: if (invalid_param) { solr_string_free(&query_string); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, 4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid id at position %ld", current_position); return; } solr_string_remove_last_char(&query_string); solr_string_append_solr_string(&(client->handle.request_body.buffer), &query_string); if (solr_make_request(client, SOLR_REQUEST_GET TSRMLS_CC) == FAILURE) { /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"get"); success = 0; } if (return_value_used) { object_init_ex(return_value, solr_ce_SolrQueryResponse); solr_set_response_object_properties(solr_ce_SolrQueryResponse, return_value, client, &(client->options.get_url), success TSRMLS_CC); } solr_string_set_ex(&(client->handle.request_body.buffer),(solr_char_t *)0x00, 0); solr_string_free(&query_string); } /* }}} */ /* {{{ proto void SolrClient::setResponseWriter(string responseWriter) Allows the user to specify which response writer to use */ PHP_METHOD(SolrClient, setResponseWriter) { solr_char_t *wt = NULL; int wt_length = 0L; solr_client_t *client = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &wt, &wt_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } if (!wt_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "The response writer is not a valid string"); return; } if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } if (solr_is_supported_response_writer((const solr_char_t *) wt, wt_length)) { /* The response writer used to present the response from Solr */ solr_string_set(&(client->options.response_writer), (solr_char_t *) wt, wt_length); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported response writer %s. This value will be ignored", wt); } } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::deleteByQueries(array queries) Allows the user to delete a set of documents matching the queries specified */ PHP_METHOD(SolrClient, deleteByQueries) { zval *queries_array = NULL; HashTable *doc_queries = NULL; size_t num_queries = 0; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; zend_bool invalid_param = 0; size_t error_pos, current_position = 1; solr_client_t *client = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &queries_array) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } doc_queries = Z_ARRVAL_P(queries_array); num_queries = zend_hash_num_elements(doc_queries); if(!num_queries) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The array parameter passed is empty"); return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "delete", &root_node); SOLR_HASHTABLE_FOR_LOOP(doc_queries) { zval **query_zval = NULL; zend_hash_get_current_data_ex(doc_queries, (void **) &query_zval, ((HashPosition *)0)); if (Z_TYPE_PP(query_zval) == IS_STRING && Z_STRLEN_PP(query_zval)) { xmlChar *escaped_query_value = xmlEncodeEntitiesReentrant(doc_ptr, (xmlChar *) Z_STRVAL_PP(query_zval)); xmlNewChild(root_node, NULL, (xmlChar *) "query", escaped_query_value); xmlFree(escaped_query_value); } else { invalid_param = 1; /* This query is not a valid string */ error_pos = current_position; goto end_doc_queries_loop; } current_position++; } end_doc_queries_loop : if (invalid_param) { xmlFreeDoc(doc_ptr); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Query number %u is not a valid query string", error_pos); return; } if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } if (return_value_used) { object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::optimize([string maxSegments [, bool softCommit [, bool waitSearcher]]) Sends an optimize XML request to the server. */ PHP_METHOD(SolrClient, optimize) { zend_bool softCommit = 0, waitSearcher = 1; char *maxSegments = "1"; int maxSegmentsLen = sizeof("1")-1; char *softCommitValue, *waitSearcherValue; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; solr_client_t *client = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sbb", &maxSegments, &maxSegmentsLen, &softCommit, &waitSearcher) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } softCommitValue = (softCommit)? "true" : "false"; waitSearcherValue = (waitSearcher)? "true" : "false"; doc_ptr = solr_xml_create_xml_doc((xmlChar *) "optimize", &root_node); xmlNewProp(root_node, (xmlChar *) "maxSegments", (xmlChar *) maxSegments); xmlNewProp(root_node, (xmlChar *) "softCommit", (xmlChar *) softCommitValue); xmlNewProp(root_node, (xmlChar *) "waitSearcher", (xmlChar *) waitSearcherValue); if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } if (return_value_used) { object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::commit( [bool softCommit [, bool waitSearcher [, bool expungeDeletes]]]) Sends a commit XML request to the server. */ PHP_METHOD(SolrClient, commit) { zend_bool softCommit = 0, waitSearcher = 1, expungeDeletes = 0; char *softCommitValue, *waitSearcherValue, *expungeDeletesValue; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; solr_client_t *client = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|bbb", &softCommit, &waitSearcher, &expungeDeletes) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } softCommitValue = (softCommit)? "true" : "false"; waitSearcherValue = (waitSearcher)? "true" : "false"; expungeDeletesValue = (expungeDeletes)? "true": "false"; doc_ptr = solr_xml_create_xml_doc((xmlChar *) "commit", &root_node); xmlNewProp(root_node, (xmlChar *) "softCommit", (xmlChar *) softCommitValue); xmlNewProp(root_node, (xmlChar *) "waitSearcher", (xmlChar *) waitSearcherValue); xmlNewProp(root_node, (xmlChar *) "expungeDeletes", (xmlChar *) expungeDeletesValue); if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } if (return_value_used) { object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::rollback(void) Sends a rollback XML request to the server. */ PHP_METHOD(SolrClient, rollback) { xmlNode *root_node = NULL; zend_bool success = 1; xmlDoc *doc_ptr = NULL; solr_client_t *client = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; doc_ptr = solr_xml_create_xml_doc((xmlChar *) "rollback", &root_node); if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } if (return_value_used) { object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } } /* }}} */ /* {{{ proto SolrPingResponse SolrClient::ping() Sends a HEAD request to check if the server is still up and running. */ PHP_METHOD(SolrClient, ping) { solr_client_t *client = NULL; zend_bool success = 1; /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client"); return; } /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_PING TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"ping"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } if (return_value_used) { object_init_ex(return_value, solr_ce_SolrPingResponse); solr_set_response_object_properties(solr_ce_SolrPingResponse, return_value, client, &(client->options.ping_url), success TSRMLS_CC); } } /* }}} */ /* {{{ proto SolrGenericResponse SolrClient::threads() Sends a request to get info about threads. */ PHP_METHOD(SolrClient, threads) { zend_bool success = 1; solr_client_t *client = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Return value requested but output not processed."); return; } /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client"); return; } /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_THREADS TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"threads"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrGenericResponse); solr_set_response_object_properties(solr_ce_SolrGenericResponse, return_value, client, &(client->options.thread_url), success TSRMLS_CC); } /* }}} */ /* {{{ proto SolrGenericResponse SolrClient::info() Sends a request to get system info. */ PHP_METHOD(SolrClient, system) { zend_bool success = 1; solr_client_t *client = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Return value requested but output not processed."); return; } /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client"); return; } /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_SYSTEM TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"system"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } if (return_value_used) { object_init_ex(return_value, solr_ce_SolrGenericResponse); solr_set_response_object_properties(solr_ce_SolrGenericResponse, return_value, client, &(client->options.system_url), success TSRMLS_CC); } } /* }}} */ /* {{{ proto array SolrClient::getOptions() Returns all the options for this client. */ PHP_METHOD(SolrClient, getOptions) { solr_client_t *client = NULL; solr_client_options_t *options = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Return value requested but output not processed."); return; } /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client"); return; } options = &(client->options); array_init(return_value); add_assoc_long(return_value, "timeout", options->timeout); add_assoc_bool(return_value, "secure", (int) options->secure); add_assoc_stringl(return_value, "hostname", options->hostname.str, options->hostname.len, 1); add_assoc_stringl(return_value, "wt", options->response_writer.str, options->response_writer.len, 1); add_assoc_long(return_value, "port", options->host_port); add_assoc_stringl(return_value, "proxy_host", options->proxy_hostname.str, options->proxy_hostname.len, 1); add_assoc_long(return_value, "proxy_port", options->proxy_port); add_assoc_stringl(return_value, "path", options->path.str, options->path.len, 1); add_assoc_stringl(return_value, "http_auth", options->http_auth_credentials.str, options->http_auth_credentials.len, 1); add_assoc_stringl(return_value, "proxy_auth", options->proxy_auth_credentials.str, options->proxy_auth_credentials.len, 1); add_assoc_bool(return_value, "ssl_verify_peer", (int) options->ssl_verify_peer); add_assoc_long(return_value, "ssl_verify_host", options->ssl_verify_host); add_assoc_stringl(return_value, "ssl_cert", options->ssl_cert.str, options->ssl_cert.len, 1); add_assoc_stringl(return_value, "ssl_key", options->ssl_key.str, options->ssl_key.len, 1); add_assoc_stringl(return_value, "ssl_keypassword", options->ssl_keypassword.str, options->ssl_keypassword.len, 1); add_assoc_stringl(return_value, "ssl_cainfo", options->ssl_cainfo.str, options->ssl_cainfo.len, 1); add_assoc_stringl(return_value, "ssl_capath", options->ssl_capath.str, options->ssl_capath.len, 1); } /* }}} */ /* {{{ proto string SolrClient::getDebug() Returns all debug data captured in the process of making the request. */ PHP_METHOD(SolrClient, getDebug) { solr_client_t *client = NULL; solr_curl_t *handle = NULL; zend_bool duplicate_string = 1; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Return value requested but output not processed."); return; } /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client"); return; } handle = &(client->handle); if (!handle->debug_data_buffer.len) { RETURN_NULL(); } RETVAL_STRINGL(handle->debug_data_buffer.str, handle->debug_data_buffer.len, duplicate_string); } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/php_solr_collapse_function.c000066400000000000000000000256451374041537100246030ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: | | Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_solr.h" /* {{{ proto void SolrFunction::__construct([string field]) Constructor. */ PHP_METHOD(SolrCollapseFunction, __construct) { long int index = SOLR_UNIQUE_FUNCTION_INDEX(); uint nSize = SOLR_INITIAL_HASH_TABLE_SIZE; solr_function_t *solr_function_dest = NULL; solr_function_t solr_function; zval *objptr = getThis(); solr_char_t *param_name = (solr_char_t *)"field"; int param_name_len = sizeof("field"); solr_string_t field_str; solr_char_t *field_name = NULL; int field_name_len = 0; memset(&solr_function, 0, sizeof(solr_function_t)); if (zend_hash_index_update(SOLR_GLOBAL(functions),index,(void *) &solr_function, sizeof(solr_function_t), (void **) &solr_function_dest) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error while registering query parameters in HashTable"); return ; } zend_update_property_long(solr_ce_SolrCollapseFunction, objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, index TSRMLS_CC); solr_function_dest->function_index = index; solr_function_dest->name_length = strlen("collapse"); solr_function_dest->name = (solr_char_t *)"collapse"; /* Allocated memory for the params HashTable using fast cache for HashTables */ ALLOC_HASHTABLE(solr_function_dest->params); zend_hash_init(solr_function_dest->params, nSize, NULL, (dtor_func_t) solr_string_free_ex, SOLR_FUNCTIONS_PERSISTENT); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error Parsing Parameters"); return; } if (field_name_len > 0 ){ memset(&field_str, 0, sizeof(solr_string_t)); solr_string_set(&field_str, (solr_char_t *)field_name, field_name_len); if(zend_hash_update(solr_function_dest->params, param_name, param_name_len, (void **)&field_str, sizeof(solr_string_t), NULL) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error assigning field"); } } Z_OBJ_HT_P(getThis()) = &solr_collapse_function_object_handlers; } /* }}} */ /* {{{ proto void SolrFunction::__destruct(void) Destructor. */ PHP_METHOD(SolrCollapseFunction, __destruct) { solr_function_t *function = NULL; /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_function_entry(getThis(), &function TSRMLS_CC) == SUCCESS ) { zend_hash_index_del(SOLR_GLOBAL(functions), function->function_index); } return; } /* {{{ proto string SolrFunction::setField(string field) Set the field that is being collapsed on. The field must be a single valued String, Int or Float. */ PHP_METHOD(SolrCollapseFunction, setField) { solr_char_t *key = "field", *arg; int key_len = sizeof("field"), arg_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) { RETURN_NULL(); } if (solr_solrfunc_update_string(getThis(), key, key_len, (solr_char_t *)arg, arg_len TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error assigning field"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto string SolrFunction::getField(void) Get Collapse Field */ PHP_METHOD(SolrCollapseFunction, getField) { solr_char_t *key = "field"; int key_len = sizeof("field"); solr_solrfunc_display_string(getThis(), key, key_len, &return_value TSRMLS_CC); } /* }}} */ /* {{{ proto string SolrFunction::setMin(string value) Selects the group heads by the min value of a numeric field or function query. */ PHP_METHOD(SolrCollapseFunction, setMin) { solr_char_t *key = "min", *arg; int key_len = sizeof("min"), arg_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) { RETURN_NULL(); } if (solr_solrfunc_update_string(getThis(), key, key_len, (solr_char_t *)arg, arg_len TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error assigning field"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto string SolrFunction::setMax(string value) Selects the group heads by the max value of a numeric field or function query. */ PHP_METHOD(SolrCollapseFunction, setMax) { solr_char_t *key = "max", *arg; int key_len = sizeof("max"), arg_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) { RETURN_NULL(); } if (solr_solrfunc_update_string(getThis(), key, key_len, (solr_char_t *)arg, arg_len TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error assigning field"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto string SolrFunction::getMin(void) Get min parameter */ PHP_METHOD(SolrCollapseFunction, getMin) { solr_char_t *key = "min"; int key_len = sizeof("min"); solr_solrfunc_display_string(getThis(), key, key_len, &return_value TSRMLS_CC); } /* }}} */ /* {{{ proto string SolrFunction::getMax(void) Get max parameter */ PHP_METHOD(SolrCollapseFunction, getMax) { solr_char_t *key = "max"; int key_len = sizeof("max"); solr_solrfunc_display_string(getThis(), key, key_len, &return_value TSRMLS_CC); } /* }}} */ /* {{{ proto string SolrFunction::setSize(void) Sets the initial size of the collapse data structures when collapsing on a numeric field only */ PHP_METHOD(SolrCollapseFunction, setSize) { solr_char_t *key = "size", *arg; int key_len = sizeof("size"), arg_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) { RETURN_NULL(); } if (solr_solrfunc_update_string(getThis(), key, key_len, (solr_char_t *)arg, arg_len TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error assigning field"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto string SolrFunction::getSize(void) Get size parameter */ PHP_METHOD(SolrCollapseFunction, getSize) { solr_char_t *key = "size"; int key_len = sizeof("size"); solr_solrfunc_display_string(getThis(), key, key_len, &return_value TSRMLS_CC); } /* }}} */ /* {{{ proto string SolrFunction::setHint(void) Set collapse hint Currently there is only one hint available "top_fc", which stands for top level FieldCache */ PHP_METHOD(SolrCollapseFunction, setHint) { solr_char_t *key = "hint", *arg; int key_len = sizeof("hint"), arg_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) { RETURN_NULL(); } if (solr_solrfunc_update_string(getThis(), key, key_len, (solr_char_t *)arg, arg_len TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error assigning field"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto string SolrFunction::getHint(void) Get Hint */ PHP_METHOD(SolrCollapseFunction, getHint) { solr_char_t *key = "hint"; int key_len = sizeof("hint"); solr_solrfunc_display_string(getThis(), key, key_len, &return_value TSRMLS_CC); } /* }}} */ /* {{{ proto string SolrFunction::setNullPolicy(void) Sets the NULL Policy. Accepts ignore, expand, or collapse */ PHP_METHOD(SolrCollapseFunction, setNullPolicy) { solr_char_t *key = "nullPolicy", *arg; int key_len = sizeof("nullPolicy"), arg_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) { RETURN_NULL(); } if (solr_solrfunc_update_string(getThis(), key, key_len, (solr_char_t *)arg, arg_len TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error assigning field"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto string SolrFunction::getNullPolicy(void) Get NullPolicy */ PHP_METHOD(SolrCollapseFunction, getNullPolicy) { solr_char_t *key = "nullPolicy"; int key_len = sizeof("nullPolicy"); solr_solrfunc_display_string(getThis(), key, key_len, &return_value TSRMLS_CC); } /* }}} */ /* {{{ proto string SolrFunction::__toString(void) String value of the function object */ PHP_METHOD(SolrCollapseFunction, __toString) { solr_function_t *collapse_func; solr_string_t *buffer = NULL; if(solr_fetch_function_entry(getThis(), &collapse_func TSRMLS_CC) == FAILURE) { RETURN_NULL(); } buffer = (solr_string_t *)emalloc(sizeof(solr_string_t)); memset(buffer, 0, sizeof(solr_string_t)); solr_solrfunc_to_string(collapse_func, &buffer); ZVAL_STRINGL(return_value, buffer->str, buffer->len, 0); efree(buffer); } /* }}} */ /* {{{ proto SolrClient::__sleep(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrCollapseFunction, __sleep) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1001 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Serialization of SolrCollapseFunction objects is currently not supported"); } /* }}} */ /* {{{ proto SolrClient::__wakeup(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrCollapseFunction, __wakeup) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1001 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Unserialization of SolrCollapseFunction objects is currently not supported"); } /* }}} */ /* {{{ throw exception on cloning (clone handler) */ zend_object_value solr_collapse_function_handlers_clone_object(zval *object TSRMLS_DC) { zend_object_value retval; zend_object *fake; retval = zend_objects_new(&fake, zend_standard_class_def TSRMLS_CC); solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_4001 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Cloning of SolrCollapseFunction objects is currently not supported"); return retval; } /* }}} */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/php_solr_dismax_query.c000066400000000000000000001042531374041537100235770ustar00rootroot00000000000000#include "php_solr.h" /* extern function_entry; */ zend_class_entry *solr_ce_SolrDixMaxQuery; ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_zero_arg_info, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_addQueryField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, field) ZEND_ARG_INFO(0, boost) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery__construct_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(0, q) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery__queryAlt_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, q) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_remove_field_arg, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, field) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_addPhraseField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(0, field) ZEND_ARG_INFO(0, boost) ZEND_ARG_INFO(0, slop) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_addBoostQuery_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(0, field) ZEND_ARG_INFO(0, value) ZEND_ARG_INFO(0, boost) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_setPhraseSlop_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, slop) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_setBoostFunction_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, function) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_setMinimumMatch_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_setTieBreaker_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, tieBreaker) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_setFields_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, fields) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_uf_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, field) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_setufs_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, fields) ZEND_END_ARG_INFO() static zend_function_entry solr_dismax_query_methods[] = { PHP_ME(SolrDisMaxQuery, __construct, SolrDisMaxQuery__construct_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setQueryAlt, SolrDisMaxQuery__queryAlt_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, addQueryField, SolrDisMaxQuery_addQueryField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, removeQueryField, SolrDisMaxQuery_remove_field_arg, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, addPhraseField, SolrDisMaxQuery_addPhraseField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, removePhraseField, SolrDisMaxQuery_remove_field_arg, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setPhraseFields, SolrDisMaxQuery_setFields_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setPhraseSlop, SolrDisMaxQuery_setPhraseSlop_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setQueryPhraseSlop, SolrDisMaxQuery_setPhraseSlop_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setBoostQuery, SolrDisMaxQuery__queryAlt_args , ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, addBoostQuery, SolrDisMaxQuery_addBoostQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, removeBoostQuery, SolrDisMaxQuery_remove_field_arg, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setBoostFunction, SolrDisMaxQuery_setBoostFunction_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setMinimumMatch, SolrDisMaxQuery_setMinimumMatch_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setTieBreaker, SolrDisMaxQuery_setTieBreaker_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, useDisMaxQueryParser, SolrDisMaxQuery_zero_arg_info, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, useEDisMaxQueryParser, SolrDisMaxQuery_zero_arg_info, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setBigramPhraseFields, SolrDisMaxQuery_setFields_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, addBigramPhraseField, SolrDisMaxQuery_addPhraseField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, removeBigramPhraseField, SolrDisMaxQuery_remove_field_arg, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setBigramPhraseSlop, SolrDisMaxQuery_setPhraseSlop_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setTrigramPhraseFields, SolrDisMaxQuery_setFields_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, addTrigramPhraseField, SolrDisMaxQuery_addPhraseField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, removeTrigramPhraseField, SolrDisMaxQuery_remove_field_arg, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setTrigramPhraseSlop, SolrDisMaxQuery_setPhraseSlop_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, addUserField, SolrDisMaxQuery_uf_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, removeUserField, SolrDisMaxQuery_uf_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setUserFields, SolrDisMaxQuery_setufs_args, ZEND_ACC_PUBLIC) PHP_FE_END }; void init_solr_dismax_query(TSRMLS_D){ zend_class_entry ce; INIT_CLASS_ENTRY(ce, "SolrDisMaxQuery", solr_dismax_query_methods); solr_ce_SolrDixMaxQuery = zend_register_internal_class_ex( &ce, solr_ce_SolrQuery, NULL TSRMLS_CC ); } /* {{{ proto SolrQuery::__construct([string q]) Constructor for SolrDisMaxQuery */ PHP_METHOD(SolrDisMaxQuery, __construct) { zval *param_value = NULL; solr_char_t *deftype_param_name = "defType", *deftype_param_value = SOLR_DISMAX_DEFAULT_PARSER; int deftype_param_name_len = strlen("defType"), deftype_param_value_len = strlen(SOLR_DISMAX_DEFAULT_PARSER); if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", ¶m_value) == FAILURE){ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters"); RETURN_NULL(); } if(param_value == NULL){ zend_call_method_with_0_params(&getThis(), solr_ce_SolrDixMaxQuery, &solr_ce_SolrDixMaxQuery->parent->constructor, "__construct", NULL); }else{ zend_call_method_with_1_params(&getThis(), solr_ce_SolrDixMaxQuery, &solr_ce_SolrDixMaxQuery->parent->constructor, "__construct", NULL, param_value); } solr_add_or_set_normal_param( getThis(), deftype_param_name, deftype_param_name_len, deftype_param_value, deftype_param_value_len, 0 TSRMLS_CC ); } /* }}} */ /* {{{ proto SolrQuery::useDisMaxQueryParser() Switch Query Parser to dismax */ PHP_METHOD(SolrDisMaxQuery, useDisMaxQueryParser) { solr_char_t *param_name = "defType", *param_value = "dismax"; int param_name_len = strlen("defType"), param_value_len = strlen("dismax"), result=1; result = solr_add_or_set_normal_param( getThis(), param_name, param_name_len, param_value, param_value_len, 0 TSRMLS_CC ); if(result != SUCCESS) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrQuery::useDisMaxQueryParser() Switch Query Parser to edismax */ PHP_METHOD(SolrDisMaxQuery, useEDisMaxQueryParser) { solr_char_t *pname = "defType", *param_value = "edismax"; int pname_len = strlen("defType"), param_value_len = strlen("edismax"), result=1; result = solr_add_or_set_normal_param( getThis(), pname, pname_len, param_value, param_value_len, 0 TSRMLS_CC ); if(result != SUCCESS) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrQuery::setQueryAlt(string q) SetQueryAlt uses q.alt if the q param is not defined */ PHP_METHOD(SolrDisMaxQuery, setQueryAlt) { solr_char_t *pname = "q.alt"; int pname_len = sizeof("q.alt")-1; solr_char_t *param_value = NULL; int param_value_len = 0; int set_param_return = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE){ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters"); RETURN_NULL(); } set_param_return = solr_add_or_set_normal_param(getThis(), pname, pname_len, param_value, param_value_len, 0 TSRMLS_CC); if(set_param_return == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrQuery::addQueryField(string field[, bool boost]) SetQueryAlt uses q.alt if the q param is not defined */ PHP_METHOD(SolrDisMaxQuery, addQueryField) { solr_char_t *pname = "qf"; int pname_len = sizeof("qf")-1; solr_char_t *boost_str = NULL; solr_char_t *field_name = NULL; int field_name_len = 0; int add_result = 0; solr_char_t *delimiter = " "; solr_char_t *separator = "^"; solr_char_t *separator_override=""; zval * boost = NULL; int boost_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &field_name, &field_name_len, &boost) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters"); RETURN_NULL(); } if(boost != NULL) { convert_to_string(boost); boost_str = Z_STRVAL_P(boost); boost_len = Z_STRLEN_P(boost); add_result = solr_add_arg_list_param( getThis(), pname, pname_len, field_name, field_name_len, boost_str, boost_len, *delimiter, *separator TSRMLS_CC ); }else{ boost_str = ""; add_result = solr_add_arg_list_param_ex( getThis(), pname, pname_len, field_name, field_name_len, boost_str, boost_len, *delimiter, *separator, *separator_override TSRMLS_CC ); } if(add_result == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::removeQueryField(string field) Removes a sort field from the sort parameter. */ PHP_METHOD(SolrDisMaxQuery, removeQueryField) { solr_char_t *pname = (solr_char_t*) "qf"; int pname_len = sizeof("qf")-1; solr_char_t *field_name = NULL; int field_name_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value( getThis(), pname, pname_len, field_name, field_name_len TSRMLS_CC ); SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::addPhraseField(string field, float boost [, float slop]) * Adds a new phrase field */ PHP_METHOD(SolrDisMaxQuery, addPhraseField) { solr_char_t *pname = (solr_char_t*) "pf"; int pname_len = sizeof("pf")-1; solr_char_t *field_name = NULL; int field_name_len = 0; zval *boost = NULL; zval *slop = NULL; solr_char_t *boost_str = NULL; solr_char_t *slop_str = NULL; int add_result = 0; char * separator = "^"; solr_char_t * delimiter_override = ""; solr_string_t boost_slop_buffer; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|z", &field_name, &field_name_len, &boost, &slop) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if(boost != NULL) { convert_to_string(boost); boost_str = Z_STRVAL_P(boost); } if (slop != NULL) { convert_to_string(slop); slop_str = Z_STRVAL_P(slop); } if (slop != NULL && boost !=NULL) { delimiter_override = "~"; memset(&boost_slop_buffer, 0, sizeof(solr_string_t)); solr_string_appends(&boost_slop_buffer, (solr_char_t *)slop_str , Z_STRLEN_P(slop)); solr_string_appendc(&boost_slop_buffer, '^'); solr_string_appends(&boost_slop_buffer, boost_str , Z_STRLEN_P(boost)); add_result = solr_add_arg_list_param_ex( getThis(), pname, pname_len, field_name, field_name_len, boost_slop_buffer.str, boost_slop_buffer.len, ' ', *separator, *delimiter_override TSRMLS_CC ); solr_string_free(&boost_slop_buffer); } else { add_result = solr_add_arg_list_param( getThis(), pname, pname_len, field_name, field_name_len, boost_str, Z_STRLEN_P(boost),' ',*separator TSRMLS_CC ); } if(add_result == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::removeQueryField(string field) Removes a phrase field from pf. */ PHP_METHOD(SolrDisMaxQuery, removePhraseField) { solr_char_t *pname = (solr_char_t*) "pf"; int pname_len = sizeof("pf")-1; solr_char_t *field_name = NULL; int field_name_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value( getThis(), pname, pname_len, field_name, field_name_len TSRMLS_CC ); SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrQuery::setPhraseFields(string fields) setPhraseFields uses pf parameter */ PHP_METHOD(SolrDisMaxQuery, setPhraseFields) { solr_char_t *pname = "pf"; int pname_len = sizeof("pf")-1; int add_result = -1; solr_char_t *pvalue = NULL; int pvalue_len = 0; solr_param_t *param = NULL; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } /* if the parameter is registered with a different type, remove it first */ if(solr_param_find(getThis(), pname, pname_len, ¶m TSRMLS_CC) == SUCCESS && param->type != SOLR_PARAM_TYPE_NORMAL) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Parameter %s value(s) was overwritten by this call", pname); solr_delete_solr_parameter(getThis(), pname, pname_len TSRMLS_CC); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0 TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add parameter %s", pname); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setPhraseSlop(integer slop) sets Phrase Slop ps argument. */ PHP_METHOD(SolrDisMaxQuery, setPhraseSlop) { solr_char_t *pname = (solr_char_t*) "ps"; int pname_len = sizeof("ps")-1; int add_result = -1; solr_char_t *pvalue = NULL; int pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0 TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter value"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setQueryPhraseSlop(integer slop) sets QueryPhrase Slop qs argument. */ PHP_METHOD(SolrDisMaxQuery, setQueryPhraseSlop) { solr_char_t *pname = (solr_char_t*) "qs"; int pname_len = sizeof("qs")-1; int add_result = -1; solr_char_t *pvalue = NULL; int pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0 TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter value"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setBoostQuery(string q) sets Boost Query bq parameter. */ PHP_METHOD(SolrDisMaxQuery, setBoostQuery) { solr_char_t *pname = (solr_char_t*) "bq"; int pname_len = sizeof("bq")-1; int add_result = -1; solr_char_t *pvalue = NULL; int pvalue_len = 0; solr_param_t *param = NULL; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } /* if the parameter is registered with a different type, remove it first */ if(solr_param_find(getThis(), pname, pname_len, ¶m TSRMLS_CC) == SUCCESS && param->type != SOLR_PARAM_TYPE_NORMAL) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Parameter %s value(s) was overwritten by this call", pname); solr_delete_solr_parameter(getThis(), pname, pname_len TSRMLS_CC); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0 TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add parameter %s", pname); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::addBoostQueryField(string field, string value [, float boost]) * Adds a new boost query field using the bq parameter */ PHP_METHOD(SolrDisMaxQuery, addBoostQuery) { solr_char_t *pname = (solr_char_t*) "bq"; int pname_len = sizeof("bq")-1; solr_char_t *field_name = NULL; int field_name_len = 0; zval *boost = NULL; solr_char_t *field_value = NULL; int field_value_len = 0; solr_char_t *boost_str = NULL; int add_result = 0; char * separator = ":"; solr_char_t *boost_separator = "^"; solr_string_t *value_boost_str = NULL; solr_param_t *param = NULL; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|z", &field_name, &field_name_len, &field_value, &field_value_len, &boost) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } /* if the parameter is registered with a different type, remove it first */ if(solr_param_find(getThis(), pname, pname_len, ¶m TSRMLS_CC) == SUCCESS && param->type != SOLR_PARAM_TYPE_ARG_LIST) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Parameter %s value(s) was overwritten by this call", pname); solr_delete_solr_parameter(getThis(), pname, pname_len TSRMLS_CC); } if(boost != NULL) { convert_to_string(boost); boost_str = Z_STRVAL_P(boost); } if(boost !=NULL) { value_boost_str = emalloc(sizeof(solr_string_t)); memset(value_boost_str, 0, sizeof(solr_string_t)); solr_string_appends(value_boost_str, field_value, field_value_len); solr_string_appendc(value_boost_str, *boost_separator); solr_string_appends(value_boost_str, boost_str, Z_STRLEN_P(boost)); add_result = solr_add_arg_list_param( getThis(),pname, pname_len, field_name, field_name_len, value_boost_str->str, value_boost_str->len,' ',*separator TSRMLS_CC ); solr_string_free(value_boost_str); efree(value_boost_str); }else{ add_result = solr_add_arg_list_param( getThis(),pname, pname_len, field_name, field_name_len, field_value, field_value_len,' ',*separator TSRMLS_CC ); } if(add_result == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::removeBoostQuery(string field) Removes a sort field from the sort parameter. */ PHP_METHOD(SolrDisMaxQuery, removeBoostQuery) { solr_char_t *pname = (solr_char_t*) "bq"; int pname_len = sizeof("bq")-1; solr_char_t *field_name = NULL; int field_name_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value( getThis(), pname, pname_len, field_name, field_name_len TSRMLS_CC ); SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setBoostFunction(string function) sets Boost Query bf parameter. */ PHP_METHOD(SolrDisMaxQuery, setBoostFunction) { solr_char_t *pname = (solr_char_t*) "bf"; int pname_len = sizeof("bf")-1; int add_result = -1; solr_char_t *pvalue = NULL; int pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0 TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add parameter %s", pname); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setMinimumMatch(string value) sets Minimum Match (mm) parameter. */ PHP_METHOD(SolrDisMaxQuery, setMinimumMatch) { solr_char_t *pname = (solr_char_t*) "mm"; int pname_len = sizeof("mm")-1; int add_result = -1; solr_char_t *pvalue = NULL; int pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0 TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add parameter %s", pname); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setTieBreaker(float tieBreaker) sets Tie Breaker (tie) parameter. */ PHP_METHOD(SolrDisMaxQuery, setTieBreaker) { solr_char_t *pname = (solr_char_t*) "tie"; int pname_len = sizeof("tie")-1; int add_result = -1; solr_char_t *pvalue = NULL; int pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0 TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add parameter %s", pname); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setBigramPhraseFields(string bigramFields) setBigramPhraseFields uses pf2 parameter */ PHP_METHOD(SolrDisMaxQuery, setBigramPhraseFields) { solr_char_t *pname = "pf2"; int pname_len = sizeof("pf2")-1; solr_char_t *param_value = NULL; int param_value_len = 0; int set_param_return = 0; solr_param_t *param = NULL; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE){ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters"); RETURN_NULL(); } /* if the parameter is registered with a different type, remove it first */ if(solr_param_find(getThis(), pname, pname_len, ¶m TSRMLS_CC) == SUCCESS && param->type != SOLR_PARAM_TYPE_NORMAL) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Parameter %s value(s) was overwritten by this call", pname); solr_delete_solr_parameter(getThis(), pname, pname_len TSRMLS_CC); } set_param_return = solr_add_or_set_normal_param(getThis(), pname, pname_len, param_value, param_value_len, 0 TSRMLS_CC); if(set_param_return == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::addBigramPhraseField(string field, float boost [, float slop]) * Adds a new bigram phrase field (pf2) to the list of fields */ PHP_METHOD(SolrDisMaxQuery, addBigramPhraseField) { solr_char_t *field_name = NULL; int field_name_len = 0; zval *boost = NULL; zval *slop = NULL; int add_result = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|z", &field_name, &field_name_len, &boost, &slop) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = add_phrase_field(getThis(), "pf2", boost, slop, field_name, field_name_len TSRMLS_CC); if(add_result == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::removeQueryField(string field) Removes a bigram phrase field. */ PHP_METHOD(SolrDisMaxQuery, removeBigramPhraseField) { solr_char_t *pname = (solr_char_t*) "pf2"; int pname_len = sizeof("pf2")-1; solr_char_t *field_name = NULL; int field_name_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value( getThis(), pname, pname_len, field_name, field_name_len TSRMLS_CC ); SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setBigramPhraseSlop(integer slop) sets Bigram Phrase Slop ps argument. */ PHP_METHOD(SolrDisMaxQuery, setBigramPhraseSlop) { solr_char_t *pname = (solr_char_t*) "ps2"; int pname_len = sizeof("ps2")-1; int add_result = -1; solr_char_t *pvalue = NULL; int pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0 TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter value"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setTrigramPhraseFields(string fields) setTrigramPhraseFields uses pf3 parameter */ PHP_METHOD(SolrDisMaxQuery, setTrigramPhraseFields) { solr_char_t *pname = "pf3"; int pname_len = sizeof("pf3")-1; solr_char_t *param_value = NULL; int param_value_len = 0; int set_param_return = 0; solr_param_t *param = NULL; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE){ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters"); RETURN_NULL(); } /* if the parameter is registered with a different type, remove it first */ if(solr_param_find(getThis(), pname, pname_len, ¶m TSRMLS_CC) == SUCCESS && param->type != SOLR_PARAM_TYPE_NORMAL) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Parameter %s value(s) was overwritten by this call", pname); solr_delete_solr_parameter(getThis(), pname, pname_len TSRMLS_CC); } set_param_return = solr_add_or_set_normal_param(getThis(), pname, pname_len, param_value, param_value_len, 0 TSRMLS_CC); if(set_param_return == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::addTrigramPhraseField(string field, float boost [, float slop]) * Adds a new trigram phrase field (pf3) to the list of fields */ PHP_METHOD(SolrDisMaxQuery, addTrigramPhraseField) { solr_char_t *field_name = NULL; int field_name_len = 0; zval *boost = NULL; zval *slop = NULL; int add_result = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|z", &field_name, &field_name_len, &boost, &slop) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = add_phrase_field(getThis(), "pf3", boost, slop, field_name, field_name_len TSRMLS_CC); if(add_result == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::removeQueryField(string field) Removes a trigram phrase field. */ PHP_METHOD(SolrDisMaxQuery, removeTrigramPhraseField) { solr_char_t *pname = (solr_char_t*) "pf3"; int pname_len = sizeof("pf3")-1; solr_char_t *field_name = NULL; int field_name_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value( getThis(), pname, pname_len, field_name, field_name_len TSRMLS_CC ); SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setTrigramPhraseSlop(integer slop) sets Trigram Phrase Slop ps3 argument. */ PHP_METHOD(SolrDisMaxQuery, setTrigramPhraseSlop) { solr_char_t *pname = (solr_char_t*) "ps3"; int pname_len = sizeof("ps3")-1; int add_result = -1; solr_char_t *pvalue = NULL; int pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0 TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter value"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::addUserField(string field) Adds a userfield rule to uf parameter. */ PHP_METHOD(SolrDisMaxQuery, addUserField) { solr_char_t *pname = (solr_char_t*) "uf"; int pname_len = sizeof("uf")-1; int add_result = -1; solr_char_t *pvalue = NULL; int pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_simple_list_param_ex(getThis(), pname, pname_len, pvalue, pvalue_len, " " TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add user field: Invalid parameter value"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::removeUserField(string field) Removes a userfield rule from uf parameter. */ PHP_METHOD(SolrDisMaxQuery, removeUserField) { solr_char_t *pname = (solr_char_t*) "uf"; int pname_len = sizeof("uf")-1; solr_char_t *field_name = NULL; int field_name_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_simple_list_param_value(getThis(), pname, pname_len, field_name, field_name_len TSRMLS_CC); SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setUserFields(string fields) Sets user fields (uf parameter) */ PHP_METHOD(SolrDisMaxQuery, setUserFields) { solr_char_t *pname = "uf"; int pname_len = sizeof("uf")-1; solr_char_t *param_value = NULL; int param_value_len = 0; int set_param_return = 0; solr_param_t *param = NULL; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE){ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters"); RETURN_NULL(); } /* if the parameter is registered with a different type, remove it first */ if(solr_param_find(getThis(), pname, pname_len, ¶m TSRMLS_CC) == SUCCESS && param->type != SOLR_PARAM_TYPE_NORMAL) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Parameter %s value(s) was overwritten by this call", pname); solr_delete_solr_parameter(getThis(), pname, pname_len TSRMLS_CC); } set_param_return = solr_add_or_set_normal_param(getThis(), pname, pname_len, param_value, param_value_len, 0 TSRMLS_CC); if(set_param_return == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ int add_phrase_field(zval *obj, solr_char_t *pname, zval *boost, zval *slop, solr_char_t *field_name, int field_name_len TSRMLS_DC) { int pname_len = strlen(pname); int add_result = 0; solr_char_t *boost_str = NULL; solr_char_t *slop_str = NULL; char * separator = "^"; solr_char_t * delimiter_override = ""; solr_string_t boost_slop_buffer; if(boost != NULL) { convert_to_string(boost); boost_str = Z_STRVAL_P(boost); } if (slop != NULL) { convert_to_string(slop); slop_str = Z_STRVAL_P(slop); } if (slop != NULL && boost !=NULL) { delimiter_override = "~"; memset(&boost_slop_buffer, 0, sizeof(solr_string_t)); solr_string_appends(&boost_slop_buffer, (solr_char_t *)slop_str , Z_STRLEN_P(slop)); solr_string_appendc(&boost_slop_buffer, '^'); solr_string_appends(&boost_slop_buffer, boost_str , Z_STRLEN_P(boost)); add_result = solr_add_arg_list_param_ex( obj, pname, pname_len, field_name, field_name_len, boost_slop_buffer.str, boost_slop_buffer.len, ' ', *separator, *delimiter_override TSRMLS_CC ); solr_string_free(&boost_slop_buffer); } else { add_result = solr_add_arg_list_param( obj, pname, pname_len, field_name, field_name_len, boost_str, Z_STRLEN_P(boost),' ',*separator TSRMLS_CC ); } return add_result; } php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/php_solr_dismax_query.h000066400000000000000000000050751374041537100236060ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Omar Shaban | +----------------------------------------------------------------------+ */ #ifndef SOLR_DISMAX_QUERY_H_ #define SOLR_DISMAX_QUERY_H_ void init_solr_dismax_query(TSRMLS_D); PHP_METHOD(SolrDisMaxQuery, __construct); PHP_METHOD(SolrDisMaxQuery, setQueryAlt); PHP_METHOD(SolrDisMaxQuery, addQueryField); PHP_METHOD(SolrDisMaxQuery, removeQueryField); PHP_METHOD(SolrDisMaxQuery, addPhraseField); PHP_METHOD(SolrDisMaxQuery, removePhraseField); PHP_METHOD(SolrDisMaxQuery, setPhraseFields); PHP_METHOD(SolrDisMaxQuery, setPhraseSlop); PHP_METHOD(SolrDisMaxQuery, setQueryPhraseSlop); PHP_METHOD(SolrDisMaxQuery, setBoostQuery); PHP_METHOD(SolrDisMaxQuery, addBoostQuery); PHP_METHOD(SolrDisMaxQuery, removeBoostQuery); PHP_METHOD(SolrDisMaxQuery, setBoostFunction); PHP_METHOD(SolrDisMaxQuery, setMinimumMatch); PHP_METHOD(SolrDisMaxQuery, setTieBreaker); PHP_METHOD(SolrDisMaxQuery, useDisMaxQueryParser); PHP_METHOD(SolrDisMaxQuery, useEDisMaxQueryParser); PHP_METHOD(SolrDisMaxQuery, setBigramPhraseFields); PHP_METHOD(SolrDisMaxQuery, addBigramPhraseField); PHP_METHOD(SolrDisMaxQuery, removeBigramPhraseField); PHP_METHOD(SolrDisMaxQuery, setBigramPhraseSlop); PHP_METHOD(SolrDisMaxQuery, setTrigramPhraseFields); PHP_METHOD(SolrDisMaxQuery, addTrigramPhraseField); PHP_METHOD(SolrDisMaxQuery, removeTrigramPhraseField); PHP_METHOD(SolrDisMaxQuery, setTrigramPhraseSlop); PHP_METHOD(SolrDisMaxQuery, addUserField); PHP_METHOD(SolrDisMaxQuery, removeUserField); PHP_METHOD(SolrDisMaxQuery, setUserFields); #endif /* SOLR_DISMAX_QUERY_H_ */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/php_solr_document.c000066400000000000000000001266261374041537100227130ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /** ************************************************************************ **/ /** DEFINITIONS FOR SOLR DOCUMENT METHODS **/ /** ************************************************************************ **/ /* {{{ static int solr_document_set_field(zval *objptr, solr_char_t *field_name, int field_name_length, solr_char_t *field_value, int field_value_length TSRMLS_DC) */ static int solr_document_set_field(zval *objptr, solr_char_t *field_name, int field_name_length, solr_char_t *field_value, int field_value_length TSRMLS_DC) { double field_boost = 0.0f; solr_document_t *doc_entry = NULL; if (!field_name_length) { return FAILURE; } if (!field_value_length) { return FAILURE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(objptr, &doc_entry TSRMLS_CC) == SUCCESS) { solr_field_list_t **field_values_ptr = NULL; solr_field_list_t *field_values = NULL; /* If the field already exists in the SolrDocument instance append the value to the field list queue */ if (zend_hash_find(doc_entry->fields, field_name, field_name_length, (void **) &field_values_ptr) == SUCCESS) { if (solr_document_insert_field_value(*field_values_ptr, field_value, field_boost) == FAILURE) { return FAILURE; } } else { /* Otherwise, create a new one and add it to the hash table */ field_values = (solr_field_list_t *) pemalloc(sizeof(solr_field_list_t), SOLR_DOCUMENT_FIELD_PERSISTENT); memset(field_values, 0, sizeof(solr_field_list_t)); field_values_ptr = &field_values; field_values->count = 0L; field_values->field_boost = 0.0; field_values->field_name = (solr_char_t *) pestrdup(field_name,SOLR_DOCUMENT_FIELD_PERSISTENT); field_values->head = NULL; field_values->last = NULL; if (solr_document_insert_field_value(field_values, field_value, field_boost) == FAILURE) { solr_destroy_field_list(&field_values); return FAILURE; } if (zend_hash_add(doc_entry->fields, field_name, field_name_length, (void *) field_values_ptr, sizeof(solr_field_list_t *), (void **) NULL) == FAILURE) { solr_destroy_field_list(&field_values); return FAILURE; } /* Increment field count only when HEAD is added */ doc_entry->field_count++; } return SUCCESS; } return FAILURE; } /* }}} */ /* {{{ static int solr_document_get_field(zval *objptr, zval *return_value, solr_char_t *field_name, int field_name_length TSRMLS_DC) */ static int solr_document_get_field(zval *objptr, zval *return_value, solr_char_t *field_name, int field_name_length TSRMLS_DC) { solr_document_t *doc_entry = NULL; if (!field_name_length) { return FAILURE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(objptr, &doc_entry TSRMLS_CC) == SUCCESS) { solr_field_list_t **field_values = NULL; if (zend_hash_find(doc_entry->fields, (char *)field_name, field_name_length, (void **) &field_values) == SUCCESS) { solr_create_document_field_object(*field_values, &return_value TSRMLS_CC); /* The field was retrieved, so we're done here */ return SUCCESS; } return FAILURE; } return FAILURE; } /* }}} */ /* {{{ static int solr_document_remove_field(zval *objptr, solr_char_t *field_name, int field_name_length TSRMLS_DC) */ static int solr_document_remove_field(zval *objptr, solr_char_t *field_name, int field_name_length TSRMLS_DC) { solr_document_t *doc_entry = NULL; if (!field_name_length) { return FAILURE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(objptr, &doc_entry TSRMLS_CC) == SUCCESS) { if (zend_hash_del(doc_entry->fields, field_name, field_name_length) == SUCCESS) { doc_entry->field_count--; return SUCCESS; } return FAILURE; } return FAILURE; } /* }}} */ /* {{{ static int solr_document_field_exists(zval *objptr, solr_char_t *field_name, int field_name_length TSRMLS_DC) */ static int solr_document_field_exists(zval *objptr, solr_char_t *field_name, int field_name_length TSRMLS_DC) { solr_document_t *doc_entry = NULL; if (!field_name_length) { return FAILURE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(objptr, &doc_entry TSRMLS_CC) == SUCCESS) { if (zend_hash_exists(doc_entry->fields, field_name, field_name_length)) { return SUCCESS; } else { return FAILURE; } } return FAILURE; } /* }}} */ /* {{{ static void solr_serialize_document_object(HashTable *document_fields, xmlChar **buffer, int *size TSRMLS_DC) */ static void solr_serialize_document_object(HashTable *document_fields, xmlChar **buffer, int *size TSRMLS_DC) { xmlNode *root_node = NULL, *fields_node = NULL; xmlDoc *doc_ptr = NULL; int format = 1; if(!buffer) { return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "solr_document", &root_node); fields_node = xmlNewChild(root_node, NULL, (xmlChar *) "fields", NULL); SOLR_HASHTABLE_FOR_LOOP(document_fields) { solr_field_list_t **field = NULL; solr_char_t *doc_field_name = NULL; solr_field_value_t *doc_field_value = NULL; xmlNode *field_node = NULL; zend_hash_get_current_data_ex(document_fields, (void **) &field, ((HashPosition *)0)); doc_field_name = (*field)->field_name; doc_field_value = (*field)->head; field_node = xmlNewChild(fields_node, NULL, (xmlChar *) "field", NULL); xmlNewProp(field_node, (xmlChar *) "name", (xmlChar *) doc_field_name); /* Loop through all the values for this field */ while(doc_field_value != NULL) { xmlChar *escaped_field_value = xmlEncodeEntitiesReentrant(doc_ptr, (xmlChar *) doc_field_value->field_value); xmlNewChild(field_node, NULL, (xmlChar *) "field_value", escaped_field_value); /* Release the memory allocated by xmlEncodeEntitiesReentrant */ xmlFree(escaped_field_value); /* Grab the next value for this field if any */ doc_field_value = doc_field_value->next; } /* while(doc_field_value != NULL) */ } /* SOLR_HASHTABLE_FOR_LOOP(document_fields) */ xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, buffer, size, "UTF-8", format); xmlFreeDoc(doc_ptr); } /* }}} */ /* {{{ static void solr_unserialize_document_field(HashTable *document_fields, xmlNode *field_node TSRMLS_DC) */ static void solr_unserialize_document_field(HashTable *document_fields, xmlNode *field_node TSRMLS_DC) { solr_char_t *field_name = NULL; xmlNode *xml_curr_value = NULL; solr_field_list_t *field_values = (solr_field_list_t *) pemalloc(sizeof(solr_field_list_t), SOLR_DOCUMENT_FIELD_PERSISTENT); memset(field_values, 0, sizeof(solr_field_list_t)); field_name = (solr_char_t *) solr_xml_get_node_contents(field_node->properties); field_values->count = 0L; field_values->field_boost = 0.0f; field_values->field_name = (solr_char_t *) pestrdup(field_name, SOLR_DOCUMENT_FIELD_PERSISTENT); field_values->head = NULL; field_values->last = NULL; /* Grab the first field node */ xml_curr_value = field_node->children; /* Looping through all the field_value nodes */ while(xml_curr_value != NULL) { /* No assumptions. It must be the field value nodes */ if (xml_curr_value->type == XML_ELEMENT_NODE && solr_xml_match_node(xml_curr_value, "field_value")) { solr_char_t *field_value = (solr_char_t *) solr_xml_get_node_contents(xml_curr_value); /* Add this value to the list of values */ if (solr_document_insert_field_value(field_values, field_value, 0.0f) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error adding field value during SolrDocument unserialization"); } } /* Move to the next field_value */ xml_curr_value = xml_curr_value->next; } /* All the values have been retrieved for this field. Now let's drop the field in the HashTable */ if (zend_hash_add(document_fields, field_name, strlen(field_name), (void *) &field_values, sizeof(solr_field_list_t *), (void **) NULL) == FAILURE) { solr_destroy_field_list(&field_values); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error adding field values to HashTable during SolrDocument unserialization"); return; } } /* }}} */ /* {{{ static int solr_unserialize_child_documents(xmlDoc *doc, solr_document_t *doc_entry TSRMLS_DC) * 1. retrieve doc hashes * 2. base64_decode * 3. unserialize (call php method) * 4. add child to solr_doc_t.children */ static int solr_unserialize_child_documents(xmlDoc *doc, solr_document_t *doc_entry TSRMLS_DC) { xmlXPathContext *xp_ctx = NULL; xmlXPathObject *xp_obj = NULL; xmlNodeSet *result = NULL; xmlChar *hash, *xp_expression; int num_nodes = 0, idx = 0, hash_len = 0; /* unserialize vars */ php_unserialize_data_t var_hash; zval *solr_doc_zv = NULL; xp_expression = (xmlChar *)"/solr_document/child_docs/dochash"; xp_ctx = xmlXPathNewContext(doc); xp_obj = xmlXPathEvalExpression(xp_expression, xp_ctx); result = xp_obj->nodesetval; num_nodes = result->nodeNr; if (num_nodes > 0) { for (;idx < num_nodes; idx++) { char *sdoc; /* serialized document string */ unsigned char *sdoc_copy, *str_end; hash = result->nodeTab[idx]->children->content; sdoc = (char *)php_base64_decode((const unsigned char*)hash, strlen((char *)hash), &hash_len); memset(&var_hash, 0, sizeof(php_unserialize_data_t)); PHP_VAR_UNSERIALIZE_INIT(var_hash); MAKE_STD_ZVAL(solr_doc_zv); sdoc_copy = (unsigned char *)strdup(sdoc); efree(sdoc); str_end = (unsigned char *) (sdoc_copy + strlen((const char *)sdoc_copy)); if (!php_var_unserialize(&solr_doc_zv, (const unsigned char **)&sdoc_copy, str_end, &var_hash TSRMLS_CC)){ PHP_VAR_UNSERIALIZE_DESTROY(var_hash); php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to unserialize child document"); xmlXPathFreeContext(xp_ctx); xmlXPathFreeObject(xp_obj); return FAILURE; } if (zend_hash_next_index_insert(doc_entry->children, &solr_doc_zv, sizeof(zval *), NULL) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to add child document to parent document post-unserialize"); } PHP_VAR_UNSERIALIZE_DESTROY(var_hash); } } xmlXPathFreeContext(xp_ctx); xmlXPathFreeObject(xp_obj); return SUCCESS; } /* }}} */ static int solr_unserialize_document_fields(xmlDoc *doc, HashTable *document_fields TSRMLS_DC) { xmlXPathContext *xpathctxt = NULL; xmlChar *xpath_expression = NULL; xmlXPathObject *xpathObj = NULL; xmlNodeSet *result = NULL; register size_t num_nodes = 0U; register size_t i = 0U; xpathctxt = xmlXPathNewContext(doc); if (!xpathctxt) { xmlFreeDoc(doc); php_error_docref(NULL TSRMLS_CC, E_WARNING, "A valid XML xpath context could not be created"); return FAILURE; } xpath_expression = (xmlChar *) "/solr_document/fields/field/@name"; xpathObj = xmlXPathEval(xpath_expression, xpathctxt); if (!xpathObj) { xmlXPathFreeContext(xpathctxt); xmlFreeDoc(doc); php_error_docref(NULL TSRMLS_CC, E_WARNING, "A valid XML xpath object could not be created from the expression"); return FAILURE; } result = xpathObj->nodesetval; if (!result) { xmlXPathFreeContext(xpathctxt); xmlXPathFreeObject(xpathObj); xmlFreeDoc(doc); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Document has no fields"); return FAILURE; } num_nodes = result->nodeNr; i = 0U; if (!num_nodes) { xmlXPathFreeContext(xpathctxt); xmlXPathFreeObject(xpathObj); xmlFreeDoc(doc); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Document has no fields"); return FAILURE; } for (i = 0U; i < num_nodes; i++) { xmlNode *currNode = result->nodeTab[i]; /* Absolutely No assumptions. I have to make sure that this is the name attribute */ if (currNode->type == XML_ATTRIBUTE_NODE && solr_xml_match_node(currNode, "name")) { /* Get the field node */ xmlNode *field_xml_node = currNode->parent; /* Retrieve all the values for this field and put them in the HashTable */ solr_unserialize_document_field(document_fields, field_xml_node TSRMLS_CC); } } xmlXPathFreeContext(xpathctxt); xmlXPathFreeObject(xpathObj); return SUCCESS; } /* {{{ static int solr_unserialize_document_object(HashTable *document_fields, char *serialized, int size TSRMLS_DC) */ static int solr_unserialize_document_object(solr_document_t *doc_entry, char *serialized, int size TSRMLS_DC) { xmlDoc *doc = NULL; doc = xmlReadMemory(serialized, size, NULL, "UTF-8", 0); if (!doc) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The serialized document string is invalid"); return FAILURE; } if (solr_unserialize_document_fields(doc, doc_entry->fields TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to unserialize document fields"); return FAILURE; } if (solr_unserialize_child_documents(doc, doc_entry TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to unserialize document fields"); return FAILURE; } xmlFreeDoc(doc); return SUCCESS; } /* }}} */ /* {{{ proto void SolrDocument::__construct(void) SolrDocument constructor */ PHP_METHOD(SolrDocument, __construct) { zval *objptr = getThis(); ulong document_index = SOLR_UNIQUE_DOCUMENT_INDEX(); if (solr_init_document(document_index TSRMLS_CC) == NULL) { return; } /* Set the value of the internal id property */ zend_update_property_long(solr_ce_SolrDocument, objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, document_index TSRMLS_CC); /* Overriding the default object handlers */ Z_OBJ_HT_P(objptr) = &solr_input_document_object_handlers; } /* }}} */ /* {{{ proto void SolrDocument::__destruct(void) Destructor for SolrDocument */ PHP_METHOD(SolrDocument, __destruct) { solr_document_t *doc_entry = NULL; /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { zend_hash_index_del(SOLR_GLOBAL(documents), doc_entry->document_index); /* Keep track of how many SolrDocument instances we currently have */ SOLR_GLOBAL(document_count)--; return ; } } /* }}} */ /* {{{ proto SolrDocument::__clone(void) Clone method for SolrDocument */ PHP_METHOD(SolrDocument, __clone) { zval *objptr = getThis(); solr_document_t new_solr_doc; solr_document_t *new_doc_entry = NULL, *old_doc_entry = NULL; ulong document_index = SOLR_UNIQUE_DOCUMENT_INDEX(); memset(&new_solr_doc, 0, sizeof(solr_document_t)); new_doc_entry = &new_solr_doc; /* Retrieve the document entry for the original SolrDocument */ if (solr_fetch_document_entry(objptr, &old_doc_entry TSRMLS_CC) == FAILURE) { return ; } /* Duplicate the doc_entry contents */ memcpy(new_doc_entry, old_doc_entry, sizeof(solr_document_t)); /* Override the document index with a new one and create a new HashTable */ new_doc_entry->document_index = document_index; /* Allocate new memory for the fields HashTable, using fast cache for HashTables */ ALLOC_HASHTABLE(new_doc_entry->fields); ALLOC_HASHTABLE(new_doc_entry->children); /* Initializing the hash table used for storing fields in this SolrDocument */ zend_hash_init(new_doc_entry->fields, old_doc_entry->fields->nTableSize, NULL, (dtor_func_t) solr_destroy_field_list, SOLR_DOCUMENT_FIELD_PERSISTENT); zend_hash_init(new_doc_entry->children, old_doc_entry->children->nTableSize, NULL, ZVAL_PTR_DTOR, SOLR_DOCUMENT_FIELD_PERSISTENT); /* Copy the contents of the old fields HashTable to the new SolrDocument */ zend_hash_copy(new_doc_entry->fields, old_doc_entry->fields, (copy_ctor_func_t) field_copy_constructor, NULL, sizeof(solr_field_list_t *)); zend_hash_copy(new_doc_entry->children, old_doc_entry->children, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *)); /* Add the document entry to the directory of documents */ zend_hash_index_update(SOLR_GLOBAL(documents), document_index, (void *) new_doc_entry, sizeof(solr_document_t), NULL); /* Set the value of the internal id property */ zend_update_property_long(solr_ce_SolrDocument, objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, document_index TSRMLS_CC); /* Keep track of how many SolrDocument instances we currently have */ SOLR_GLOBAL(document_count)++; } /* }}} */ /* {{{ proto SolrDocument::__set(string fieldname, string field_value) Magic method for setting field names. */ PHP_METHOD(SolrDocument, __set) { solr_char_t *field_name = NULL; int field_name_length = 0; solr_char_t *field_value = NULL; int field_value_length = 0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &field_name, &field_name_length, &field_value, &field_value_length) == FAILURE) { RETURN_FALSE; } if (solr_document_set_field(getThis(), field_name, field_name_length, field_value, field_value_length TSRMLS_CC) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto SolrDocumentField SolrDocument::__get(string fieldname) Magic method for getting a field. */ PHP_METHOD(SolrDocument, __get) { solr_char_t *field_name = NULL; int field_name_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_get_field(getThis(), return_value, field_name, field_name_length TSRMLS_CC) == FAILURE) { RETURN_NULL(); } } /* }}} */ /* {{{ proto bool SolrDocument::__isset(string field_name) Checks if a field exists */ PHP_METHOD(SolrDocument, __isset) { solr_char_t *field_name = NULL; int field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_field_exists(getThis(), field_name, field_name_length TSRMLS_CC) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrDocument::__unset(string fieldname) Removes a field from the document. */ PHP_METHOD(SolrDocument, __unset) { solr_char_t *field_name = NULL; int field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_remove_field(getThis(), field_name, field_name_length TSRMLS_CC) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto void SolrDocument::offsetSet(string field_name, string field_value) Sets the specified field in the document */ PHP_METHOD(SolrDocument, offsetSet) { solr_char_t *field_name = NULL; int field_name_length = 0; solr_char_t *field_value = NULL; int field_value_length = 0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &field_name, &field_name_length, &field_value, &field_value_length) == FAILURE) { return; } if (solr_document_set_field(getThis(), field_name, field_name_length, field_value, field_value_length TSRMLS_CC) == SUCCESS) { return; } } /* }}} */ /* {{{ proto SolrDocumentField SolrDocument::offsetGet(string field_name) Returns the request field. */ PHP_METHOD(SolrDocument, offsetGet) { solr_char_t *field_name = NULL; int field_name_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_get_field(getThis(), return_value, field_name, field_name_length TSRMLS_CC) == FAILURE) { RETURN_NULL(); } } /* }}} */ /* {{{ proto bool SolrDocument::offsetExists(string fieldname) Checks if the request field exists in the document */ PHP_METHOD(SolrDocument, offsetExists) { solr_char_t *field_name = NULL; int field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_field_exists(getThis(), field_name, field_name_length TSRMLS_CC) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto void SolrDocument::offsetUnset(string fieldname) Removes the specified field from the document */ PHP_METHOD(SolrDocument, offsetUnset) { solr_char_t *field_name = NULL; int field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { return; } if (solr_document_remove_field(getThis(), field_name, field_name_length TSRMLS_CC) == SUCCESS) { return; } } /* }}} */ /* {{{ proto void SolrDocument::rewind(void) Resets the internal pointer. */ PHP_METHOD(SolrDocument, rewind) { solr_document_t *doc_entry = NULL; HashTable *doc_fields = NULL; if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == FAILURE) { return; } doc_fields = doc_entry->fields; zend_hash_internal_pointer_reset(doc_fields); } /* }}} */ /* {{{ proto SolrDocumentField SolrDocument::current(void) Retrieves the current field. */ PHP_METHOD(SolrDocument, current) { solr_document_t *doc_entry = NULL; HashTable *doc_fields = NULL; solr_field_list_t **field_values = NULL; if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == FAILURE) { return; } doc_fields = doc_entry->fields; zend_hash_get_current_data_ex(doc_fields, (void **) &field_values, NULL); if(field_values && *field_values ) { solr_create_document_field_object(*field_values, &return_value TSRMLS_CC); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrDocument::key(void) Retrieves the current key. */ PHP_METHOD(SolrDocument, key) { solr_document_t *doc_entry = NULL; char *fieldname = NULL; uint fieldname_length = 0U; ulong num_index = 0L; HashTable *doc_fields = NULL; register zend_bool duplicate = 0; if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == FAILURE) { return; } doc_fields = doc_entry->fields; zend_hash_get_current_key_ex(doc_fields, &fieldname, &fieldname_length, &num_index, duplicate, NULL); RETURN_STRINGL(fieldname, fieldname_length, 1); } /* }}} */ /* {{{ proto void SolrDocument::next(void) Moves the internal pointer to the next field. */ PHP_METHOD(SolrDocument, next) { solr_document_t *doc_entry = NULL; HashTable *doc_fields = NULL; if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == FAILURE) { return; } doc_fields = doc_entry->fields; zend_hash_move_forward(doc_fields); } /* }}} */ /* {{{ proto bool SolrDocument::valid(void) Checks if the current internal pointer position is still valid. */ PHP_METHOD(SolrDocument, valid) { solr_document_t *doc_entry = NULL; HashTable *doc_fields = NULL; zend_bool is_valid = 0; if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == FAILURE) { return; } doc_fields = doc_entry->fields; is_valid = (zend_bool) ( SUCCESS == zend_hash_has_more_elements(doc_fields) ); RETURN_BOOL(is_valid); } /* }}} */ /* {{{ proto string SolrDocument::serialize(void) Custom SolrDocument serializer. Returns an XML document string representing the object. */ PHP_METHOD(SolrDocument, serialize) { solr_document_t *doc_entry = NULL; HashTable *doc_fields = NULL; char *serialized = NULL; int size = 0; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == FAILURE) { RETURN_NULL(); } doc_fields = doc_entry->fields; solr_serialize_document_object(doc_fields, (xmlChar **) &serialized, &size TSRMLS_CC); if (size) { RETVAL_STRINGL(serialized, size, 1); xmlFree(serialized); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto void SolrDocument::unserialize(string serialized_xml) Custom SolrDocument unserializer. Brings the object back to life. */ PHP_METHOD(SolrDocument, unserialize) { solr_char_t *serialized = NULL; int serialized_length = 0; zval *objptr = getThis(); ulong document_index = SOLR_UNIQUE_DOCUMENT_INDEX(); uint nSize = SOLR_INITIAL_HASH_TABLE_SIZE; solr_document_t solr_doc; solr_document_t *doc_entry = NULL, *doc_ptr = NULL; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &serialized, &serialized_length) == FAILURE) { RETURN_FALSE; } memset(&solr_doc, 0, sizeof(solr_document_t)); doc_entry = &solr_doc; doc_entry->document_index = document_index; doc_entry->field_count = 0L; doc_entry->document_boost = 0; /* Allocated memory for the fields HashTable using fast cache for HashTables */ ALLOC_HASHTABLE(doc_entry->fields); ALLOC_HASHTABLE(doc_entry->children); /* Initializing the hash table used for storing fields in this SolrDocument */ zend_hash_init(doc_entry->fields, nSize, NULL, (dtor_func_t) solr_destroy_field_list, SOLR_DOCUMENT_FIELD_PERSISTENT); zend_hash_init(doc_entry->children, nSize, NULL, ZVAL_PTR_DTOR, SOLR_DOCUMENT_FIELD_PERSISTENT); /* Let's check one more time before insert into the HashTable */ if (zend_hash_index_exists(SOLR_GLOBAL(documents), document_index)) { pefree(doc_entry->fields, SOLR_DOCUMENT_FIELD_PERSISTENT); return; } /* Add the document entry to the directory of documents */ zend_hash_index_update(SOLR_GLOBAL(documents), document_index, (void *) doc_entry, sizeof(solr_document_t), (void **) &doc_ptr); /* Set the value of the internal id property */ zend_update_property_long(solr_ce_SolrDocument, objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, document_index TSRMLS_CC); /* Keep track of how many SolrDocument instances we currently have */ SOLR_GLOBAL(document_count)++; /* Overriding the default object handlers */ Z_OBJ_HT_P(objptr) = &solr_input_document_object_handlers; if (solr_unserialize_document_object(doc_ptr, serialized, serialized_length TSRMLS_CC) == FAILURE) { return; } doc_ptr->field_count = zend_hash_num_elements(doc_ptr->fields); } /* }}} */ /* {{{ proto bool SolrDocument::clear(void) Resets the current object. Discards all the fields and resets the document boost to zero. */ PHP_METHOD(SolrDocument, clear) { solr_document_t *doc_entry = NULL; if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { doc_entry->document_boost = 0.0; doc_entry->field_count = 0L; zend_hash_clean(doc_entry->fields); RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrDocument::addField(string fieldname, string value) Adds a field to the document */ PHP_METHOD(SolrDocument, addField) { solr_char_t *field_name = NULL; int field_name_length = 0; solr_char_t *field_value = NULL; int field_value_length = 0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &field_name, &field_name_length, &field_value, &field_value_length) == FAILURE) { RETURN_FALSE; } if (solr_document_set_field(getThis(), field_name, field_name_length, field_value, field_value_length TSRMLS_CC) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto array SolrDocument::getFieldNames(void) Returns an array of fields names in the document. */ PHP_METHOD(SolrDocument, getFieldNames) { solr_document_t *doc_entry = NULL; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { HashTable *fields_ht = NULL; register zend_bool duplicate = 0; array_init(return_value); fields_ht = doc_entry->fields; SOLR_HASHTABLE_FOR_LOOP(fields_ht) { char *fieldname = NULL; uint fieldname_length = 0U; ulong num_index = 0L; solr_field_list_t **field = NULL; zend_bool duplicate_field_name = 1; zend_hash_get_current_key_ex(fields_ht, &fieldname, &fieldname_length, &num_index, duplicate, NULL); zend_hash_get_current_data_ex(fields_ht, (void **) &field, NULL); add_next_index_stringl(return_value, (*field)->field_name, fieldname_length, duplicate_field_name); } /* We are done */ return; } RETURN_FALSE; } /* }}} */ /* {{{ proto int SolrDocument::getFieldCount(void) Returns the number of fields in this document. Multi-value fields are only counted once. */ PHP_METHOD(SolrDocument, getFieldCount) { solr_document_t *doc_entry = NULL; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { RETURN_LONG(zend_hash_num_elements(doc_entry->fields)); } RETURN_FALSE; } /* }}} */ /* {{{ proto SolrDocumentField SolrDocument::getField(string fieldname) Retrieves the requested field */ PHP_METHOD(SolrDocument, getField) { solr_char_t *field_name = NULL; int field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_get_field(getThis(), return_value, field_name, field_name_length TSRMLS_CC) == FAILURE) { RETURN_FALSE; } } /* }}} */ /* {{{ proto array SolrDocument::toArray(void) Returns an array representation of the SolrDocument object. */ PHP_METHOD(SolrDocument, toArray) { solr_document_t *doc_entry = NULL; zval *fields_array = NULL; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { HashTable *fields_ht; register zend_bool duplicate = 0; MAKE_STD_ZVAL(fields_array); array_init(return_value); array_init(fields_array); add_assoc_double(return_value, "document_boost", doc_entry->document_boost); add_assoc_long(return_value, "field_count", doc_entry->field_count); add_assoc_zval(return_value, "fields", fields_array); fields_ht = doc_entry->fields; SOLR_HASHTABLE_FOR_LOOP(fields_ht) { solr_char_t *fieldname = NULL; uint fieldname_length = 0U; ulong num_index = 0L; solr_field_list_t **field = NULL; zval *current_field = NULL; MAKE_STD_ZVAL(current_field); zend_hash_get_current_key_ex(fields_ht, (char **) &fieldname, &fieldname_length, &num_index, duplicate, NULL); zend_hash_get_current_data_ex(fields_ht, (void **) &field, NULL); solr_create_document_field_object(*field, ¤t_field TSRMLS_CC); add_next_index_zval(fields_array, current_field); } /* We are done */ return; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrDocument::fieldExists(string fieldname) Checks if the field exists. */ PHP_METHOD(SolrDocument, fieldExists) { solr_char_t *field_name = NULL; int field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_field_exists(getThis(), field_name, field_name_length TSRMLS_CC) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrDocument::deleteField(string field_name) Removes the requested field. */ PHP_METHOD(SolrDocument, deleteField) { solr_char_t *field_name = NULL; int field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_remove_field(getThis(), field_name, field_name_length TSRMLS_CC) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrDocument::sort(int sort_criterion [, int sort_direction]) Sorts the fields in the document */ PHP_METHOD(SolrDocument, sort) { long int order_by = 0L; long int sort_direction = SOLR_SORT_ASC; solr_document_t *doc_entry = NULL; int renumber = 0; /* The pointer to the comparison function used by zend_qsort */ compare_func_t comparison_function = (compare_func_t) NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &order_by, &sort_direction) == FAILURE) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == FAILURE) { RETURN_FALSE; } /* {{{ Select the appropriate comparison function */ switch(order_by) { case SOLR_SORT_FIELD_NAME : /* Sorting by field name */ { switch(sort_direction) { case SOLR_SORT_ASC : comparison_function = solr_compare_field_name; break; case SOLR_SORT_DESC : comparison_function = solr_rcompare_field_name; break; } } break; /* case SOLR_SORT_FIELD_NAME */ case SOLR_SORT_FIELD_VALUE_COUNT : /* Sorting by number of values per field */ { switch(sort_direction) { case SOLR_SORT_ASC : comparison_function = solr_compare_field_value_count; break; case SOLR_SORT_DESC : comparison_function = solr_rcompare_field_value_count; break; } } break; /* case SOLR_SORT_FIELD_VALUE_COUNT */ case SOLR_SORT_FIELD_BOOST_VALUE : /* Sorting by field boost values */ { switch(sort_direction) { case SOLR_SORT_ASC : comparison_function = solr_compare_field_boost_value; break; case SOLR_SORT_DESC : comparison_function = solr_rcompare_field_boost_value; break; } } break; /* case SOLR_SORT_FIELD_BOOST_VALUE */ default : /* Undefined sort criteria */ RETURN_FALSE; break; } /* }}} switch(order_by) */ /* Undefined sort direction. It was not ASC or DESC */ if (!comparison_function) { RETURN_FALSE; } if (zend_hash_sort(doc_entry->fields, zend_qsort, comparison_function, renumber TSRMLS_CC) == FAILURE) { RETURN_FALSE; } RETURN_TRUE; } /* }}} */ /* {{{ proto bool SolrDocument::merge(SolrDocument source [, bool override]) Merges source to the current SolrDocument. */ PHP_METHOD(SolrDocument, merge) { solr_document_t *destination_document = NULL; solr_document_t *source_document = NULL; copy_ctor_func_t p_copy_ctor = (copy_ctor_func_t) field_copy_constructor; /* The destination SolrDocument instance */ zval *destination_document_zval = getThis(); /* The source SolrDocument instance */ zval *source_document_zval = NULL; /* Should we skip fields that already exist in destination */ zend_bool overwrite = (zend_bool) 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &source_document_zval, solr_ce_SolrDocument, &overwrite) == FAILURE) { RETURN_FALSE; } if (solr_fetch_document_entry(source_document_zval, &source_document TSRMLS_CC) == FAILURE) { RETURN_FALSE; } if (solr_fetch_document_entry(destination_document_zval, &destination_document TSRMLS_CC) == FAILURE) { RETURN_FALSE; } if (zend_hash_num_elements(source_document->fields) == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Source SolrDocument has no fields. Source"); RETURN_FALSE; } /* Copy the fields in the source HashTable to the destination HashTable */ zend_hash_merge(destination_document->fields, source_document->fields, p_copy_ctor, NULL, sizeof(solr_field_list_t *), (int) overwrite); /* Update the field count */ destination_document->field_count = (uint) zend_hash_num_elements(destination_document->fields); RETURN_TRUE; } /* }}} */ static void solr_add_child_input_documents_from_documents(HashTable * children, solr_document_t *new_doc_entry TSRMLS_DC) { SOLR_HASHTABLE_FOR_LOOP(children) { zval *solr_input_doc = NULL; zval **solr_doc = NULL; zend_hash_get_current_data_ex(children, (void **)&solr_doc, (HashPosition *) 0); zend_call_method_with_0_params(solr_doc, Z_OBJCE_PP(solr_doc), NULL, "getinputdocument", &solr_input_doc); if (zend_hash_next_index_insert(new_doc_entry->children, &solr_input_doc, sizeof (zval *), NULL) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to convert child SolrDocument to SolrInputDocument"); } } } /* {{{ proto SolrInputDocument SolrDocument::getInputDocument(void) Returns a SolrInputDocument equivalent of the object. */ PHP_METHOD(SolrDocument, getInputDocument) { zval *objptr = getThis(); zval *input_objptr = (*return_value_ptr); solr_document_t new_solr_doc; solr_document_t *new_doc_entry = NULL, *old_doc_entry = NULL; ulong document_index = SOLR_UNIQUE_DOCUMENT_INDEX(); if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "SolrInputDocument object requested without processing output."); return; } memset(&new_solr_doc, 0, sizeof(solr_document_t)); new_doc_entry = &new_solr_doc; /* Retrieve the document entry for the original SolrDocument */ if (solr_fetch_document_entry(objptr, &old_doc_entry TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "SolrDocument could not be fetched."); return; } object_init_ex(input_objptr, solr_ce_SolrInputDocument); /* Duplicate the doc_entry contents */ memcpy(new_doc_entry, old_doc_entry, sizeof(solr_document_t)); /* Override the document index with a new one and create a new HashTable */ new_doc_entry->document_index = document_index; /* Allocate new memory for the fields HashTable, using fast cache for HashTables */ ALLOC_HASHTABLE(new_doc_entry->fields); ALLOC_HASHTABLE(new_doc_entry->children); /* Initializing the hash table used for storing fields in this SolrDocument */ zend_hash_init(new_doc_entry->fields, old_doc_entry->fields->nTableSize, NULL, (dtor_func_t) solr_destroy_field_list, SOLR_DOCUMENT_FIELD_PERSISTENT); zend_hash_init(new_doc_entry->children, old_doc_entry->children->nTableSize, NULL, ZVAL_PTR_DTOR, SOLR_DOCUMENT_FIELD_PERSISTENT); /* Copy the contents of the old fields HashTable to the new SolrDocument */ zend_hash_copy(new_doc_entry->fields, old_doc_entry->fields, (copy_ctor_func_t) field_copy_constructor, NULL, sizeof(solr_field_list_t *)); /* call getInputDocument on each child SolrDocument and store children */ if (zend_hash_num_elements(old_doc_entry->children) > 0) { solr_add_child_input_documents_from_documents(old_doc_entry->children, new_doc_entry TSRMLS_CC); } /* Add the document entry to the directory of documents */ zend_hash_index_update(SOLR_GLOBAL(documents), document_index, (void *) new_doc_entry, sizeof(solr_document_t), NULL); /* Set the value of the internal id property */ zend_update_property_long(solr_ce_SolrInputDocument, input_objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, document_index TSRMLS_CC); /* Keep track of how many SolrDocument instances we currently have */ SOLR_GLOBAL(document_count)++; } /* }}} */ /* {{{ proto array SolrInputDocument::getChildDocuments( void ) Returns child documents or null if none */ PHP_METHOD(SolrDocument, getChildDocuments) { solr_document_t *solr_doc = NULL; if (solr_fetch_document_entry(getThis(), &solr_doc TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to fetch document entry for current object"); return; } if (zend_hash_num_elements(solr_doc->children) > 0) { array_init(return_value); zend_hash_init(Z_ARRVAL_P(return_value), zend_hash_num_elements(solr_doc->children), NULL, ZVAL_PTR_DTOR, 0); zend_hash_copy(Z_ARRVAL_P(return_value), solr_doc->children, (copy_ctor_func_t)zval_add_ref, NULL, sizeof(zval *)); } } /* }}} */ /* {{{ proto bool SolrInputDocument::hasChildDocuments( void ) Checks whether this document has child documents */ PHP_METHOD(SolrDocument, hasChildDocuments) { solr_document_t *solr_doc = NULL; if (solr_fetch_document_entry(getThis(), &solr_doc TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to fetch document entry for current object"); return; } if (zend_hash_num_elements(solr_doc->children) > 0) { RETURN_TRUE; } else { RETURN_FALSE; } } /* }}} */ /* {{{ proto int SolrInputDocument::getChildDocumentsCount( void ) Returns the number of child documents */ PHP_METHOD(SolrDocument, getChildDocumentsCount) { solr_document_t *solr_doc = NULL; if (solr_fetch_document_entry(getThis(), &solr_doc TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to fetch document entry for current object"); return; } Z_TYPE_P(return_value) = IS_LONG; Z_LVAL_P(return_value) = zend_hash_num_elements(solr_doc->children); } /* }}} */ /* {{{ proto SolrDocumentField::__construct(void) Constructor */ PHP_METHOD(SolrDocumentField, __construct) { Z_OBJ_HT_P(getThis()) = &solr_document_field_handlers; } /* }}} */ /* {{{ proto SolrDocumentField::__destruct(void) Destructor */ PHP_METHOD(SolrDocumentField, __destruct) { } /* }}} */ /* {{{ PHP_SOLR_API void solr_document_field_write_property(zval *object, zval *member, zval *value TSRMLS_DC) */ #if PHP_VERSION_ID < 50399 PHP_SOLR_API void solr_document_field_write_property(zval *object, zval *member, zval *value TSRMLS_DC) #else PHP_SOLR_API void solr_document_field_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC) #endif { solr_throw_exception(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1007_MSG, SOLR_ERROR_1007 TSRMLS_CC, SOLR_FILE_LINE_FUNC); /* if (Z_TYPE_P(member) == IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempting to set value for [%s] property in a SolrDocumentField instance", Z_STRVAL_P(member)); } */ } /* }}} */ /* {{{ PHP_SOLR_API void solr_document_field_unset_property(zval *object, zval *member TSRMLS_DC) */ #if PHP_VERSION_ID < 50399 PHP_SOLR_API void solr_document_field_unset_property(zval *object, zval *member TSRMLS_DC) #else PHP_SOLR_API void solr_document_field_unset_property(zval *object, zval *member, const zend_literal *key TSRMLS_DC) #endif { solr_throw_exception(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1007_MSG, SOLR_ERROR_1007 TSRMLS_CC, SOLR_FILE_LINE_FUNC); /* if (Z_TYPE_P(member) == IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempting to remove [%s] property in a SolrDocumentField instance", Z_STRVAL_P(member)); } */ } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/php_solr_exception.c000066400000000000000000000157151374041537100230670ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ static void solr_prepare_internal_info(zval *objptr, zval *return_value TSRMLS_DC) */ static void solr_prepare_internal_info(zval *objptr, zval *return_value TSRMLS_DC) { zval *line_no = zend_read_property(Z_OBJCE_P(objptr), objptr, SOLR_SOURCELINE_NO_PROPERTY_NAME, sizeof(SOLR_SOURCELINE_NO_PROPERTY_NAME)-1, 0 TSRMLS_CC); zval *solr_file = zend_read_property(Z_OBJCE_P(objptr), objptr, SOLR_SOURCEFILE_PROPERTY_NAME, sizeof(SOLR_SOURCEFILE_PROPERTY_NAME)-1, 0 TSRMLS_CC); zval *solr_zif_name = zend_read_property(Z_OBJCE_P(objptr), objptr, SOLR_ZIFNAME_PROPERTY_NAME, sizeof(SOLR_ZIFNAME_PROPERTY_NAME)-1, 0 TSRMLS_CC); long int source_line = Z_LVAL_P(line_no); char *solr_source_file = Z_STRVAL_P(solr_file); char *solr_zifname = Z_STRVAL_P(solr_zif_name); array_init(return_value); add_assoc_long(return_value, SOLR_SOURCELINE_NO_PROPERTY_NAME, source_line); add_assoc_string(return_value, SOLR_SOURCEFILE_PROPERTY_NAME, solr_source_file, 1); add_assoc_string(return_value, SOLR_ZIFNAME_PROPERTY_NAME, solr_zifname, 1); } /* }}} */ /* {{{ void solr_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *filename, int file_line, const char *function_name, char *format, ...) */ PHP_SOLR_API void solr_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *filename, int file_line, const char *function_name, char *format, ...) { char *message = NULL; #ifdef SOLR_ZEND_ENGINE_2_2 size_t max_buffer_len = 2048; /* This should be sufficient to hold the buffer */ #endif zval *objptr = NULL; va_list args; va_start(args,format); /* If this is PHP 5.2.x, since ap_php_vasprintf is only present in 5.3 */ #ifdef SOLR_ZEND_ENGINE_2_2 /* Allocate max_buffer_len bytes to hold the buffer */ message = (char *) malloc( sizeof(char) * max_buffer_len); memset(message, 0, sizeof(char) * max_buffer_len); ap_php_vslprintf(message, max_buffer_len, format, args); #else /* Preparing the message string from the format and variable argument list, if any. */ ap_php_vasprintf(&message, format, args); #endif va_end(args); /* Retrieves the thrown object and updates the properties */ objptr = zend_throw_exception(exception_ce, message, code TSRMLS_CC); /* This is the line number in the source file where it was thrown */ zend_update_property_long(exception_ce, objptr, SOLR_SOURCELINE_NO_PROPERTY_NAME, sizeof(SOLR_SOURCELINE_NO_PROPERTY_NAME)-1, file_line TSRMLS_CC); /* This is the line source file where it was thrown */ zend_update_property_string(exception_ce, objptr, SOLR_SOURCEFILE_PROPERTY_NAME, sizeof(SOLR_SOURCEFILE_PROPERTY_NAME)-1, (char *) filename TSRMLS_CC); /* This is the C function where it was thrown */ zend_update_property_string(exception_ce, objptr, SOLR_ZIFNAME_PROPERTY_NAME, sizeof(SOLR_ZIFNAME_PROPERTY_NAME)-1, (char *) function_name TSRMLS_CC); /* message must be freed */ if (message != NULL) { free(message); } } /* }}} */ /* {{{ void solr_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC, const char *filename, int file_line, const char *function_name) */ PHP_SOLR_API void solr_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC, const char *filename, int file_line, const char *function_name) { /* Retrieves the thrown object and updates the properties */ zval *objptr = zend_throw_exception(exception_ce, message, code TSRMLS_CC); /* This is the line number in the source file where it was thrown */ zend_update_property_long(exception_ce, objptr, SOLR_SOURCELINE_NO_PROPERTY_NAME, sizeof(SOLR_SOURCELINE_NO_PROPERTY_NAME)-1, file_line TSRMLS_CC); /* This is the line source file where it was thrown */ zend_update_property_string(exception_ce, objptr, SOLR_SOURCEFILE_PROPERTY_NAME, sizeof(SOLR_SOURCEFILE_PROPERTY_NAME)-1, (char *) filename TSRMLS_CC); /* This is the C function where it was thrown */ zend_update_property_string(exception_ce, objptr, SOLR_ZIFNAME_PROPERTY_NAME, sizeof(SOLR_ZIFNAME_PROPERTY_NAME)-1, (char *) function_name TSRMLS_CC); } /* }}} */ /* Macro for preparing the return value array */ #define solr_exception_return_internal_info() { \ if (return_value_used) { \ solr_prepare_internal_info(getThis(), return_value TSRMLS_CC); \ } else { \ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Return value requested but output not processed."); \ } \ } /* {{{ proto array SolrException::getInternalInfo(void) Returns the internal API information where the exception was generated */ PHP_METHOD(SolrException, getInternalInfo) { solr_exception_return_internal_info() } /* }}} */ /* {{{ proto array SolrClientException::getInternalInfo(void) Returns the internal API information where the exception was generated */ PHP_METHOD(SolrClientException, getInternalInfo) { solr_exception_return_internal_info() } /* }}} */ /* {{{ proto array SolrIllegalOperationException::getInternalInfo(void) Returns the internal API information where the exception was generated */ PHP_METHOD(SolrIllegalOperationException, getInternalInfo) { solr_exception_return_internal_info() } /* }}} */ /* {{{ proto array SolrIllegalArgumentException::getInternalInfo(void) Returns the internal API information where the exception was generated */ PHP_METHOD(SolrIllegalArgumentException, getInternalInfo) { solr_exception_return_internal_info() } /* }}} */ /* {{{ proto array SolrServerException::getInternalInfo(void) Returns the internal API information where the exception was generated */ PHP_METHOD(SolrServerException, getInternalInfo) { solr_exception_return_internal_info() } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/php_solr_input_document.c000066400000000000000000000705401374041537100241230ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /** ************************************************************************ **/ /** DEFINITIONS FOR SOLR INPUT DOCUMENT METHODS **/ /** ************************************************************************ **/ /* {{{ proto void SolrInputDocument::__construct() SolrInputDocument constructor */ PHP_METHOD(SolrInputDocument, __construct) { zval *objptr = getThis(); uint nSize = SOLR_INITIAL_HASH_TABLE_SIZE; ulong document_index = SOLR_UNIQUE_DOCUMENT_INDEX(); auto solr_document_t solr_doc; solr_document_t *doc_entry = NULL, *doc_ptr = NULL; memset(&solr_doc, 0, sizeof(solr_document_t)); doc_entry = &solr_doc; doc_entry->document_index = document_index; doc_entry->field_count = 0L; doc_entry->document_boost = 0.0f; /* Allocated memory for the fields HashTable using fast cache for HashTables */ ALLOC_HASHTABLE(doc_entry->fields); ALLOC_HASHTABLE(doc_entry->children); /* Initializing the hash table used for storing fields in this SolrDocument */ zend_hash_init(doc_entry->fields, nSize, NULL, (dtor_func_t) solr_destroy_field_list, SOLR_DOCUMENT_FIELD_PERSISTENT); zend_hash_init(doc_entry->children, nSize, NULL, ZVAL_PTR_DTOR, SOLR_DOCUMENT_FIELD_PERSISTENT); /* Let's check one more time before insert into the HashTable */ if (zend_hash_index_exists(SOLR_GLOBAL(documents), document_index)) { pefree(doc_entry->fields, SOLR_DOCUMENT_FIELD_PERSISTENT); pefree(doc_entry->children, SOLR_DOCUMENT_FIELD_PERSISTENT); return; } /* Add the document entry to the directory of documents */ zend_hash_index_update(SOLR_GLOBAL(documents), document_index, (void *) doc_entry, sizeof(solr_document_t), (void **) &doc_ptr); /* Set the value of the internal id property */ zend_update_property_long(solr_ce_SolrInputDocument, objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, document_index TSRMLS_CC); /* Keep track of how many SolrDocument instances we currently have */ SOLR_GLOBAL(document_count)++; /* Overriding the default object handlers */ Z_OBJ_HT_P(objptr) = &solr_input_document_object_handlers; } /* }}} */ /* {{{ proto void SolrInputDocument::__destruct(void) Destructor for SolrInputDocument */ PHP_METHOD(SolrInputDocument, __destruct) { solr_document_t *doc_entry = NULL; /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { zend_hash_index_del(SOLR_GLOBAL(documents), doc_entry->document_index); /* Keep track of how many SolrDocument instances we currently have */ SOLR_GLOBAL(document_count)--; return ; } } /* }}} */ /* {{{ proto void SolrInputDocument::__clone(void) Clones the current object. Not to be called directly. */ PHP_METHOD(SolrInputDocument, __clone) { zval *objptr = getThis(); solr_document_t new_solr_doc; solr_document_t *new_doc_entry = NULL, *old_doc_entry = NULL; ulong document_index = SOLR_UNIQUE_DOCUMENT_INDEX(); memset(&new_solr_doc, 0, sizeof(solr_document_t)); new_doc_entry = &new_solr_doc; /* Retrieve the document entry for the original SolrDocument */ if (solr_fetch_document_entry(objptr, &old_doc_entry TSRMLS_CC) == FAILURE) { return ; } /* Duplicate the doc_entry contents */ memcpy(new_doc_entry, old_doc_entry, sizeof(solr_document_t)); /* Override the document index with a new one and create a new HashTable */ new_doc_entry->document_index = document_index; /* Allocate new memory for the fields HashTable, using fast cache for HashTables */ ALLOC_HASHTABLE(new_doc_entry->fields); ALLOC_HASHTABLE(new_doc_entry->children); /* Initializing the hash table used for storing fields in this SolrDocument */ zend_hash_init(new_doc_entry->fields, old_doc_entry->fields->nTableSize, NULL, (dtor_func_t) solr_destroy_field_list, SOLR_DOCUMENT_FIELD_PERSISTENT); zend_hash_init(new_doc_entry->children, old_doc_entry->children->nTableSize, NULL, ZVAL_PTR_DTOR, SOLR_DOCUMENT_FIELD_PERSISTENT); /* Copy the contents of the old fields HashTable to the new SolrDocument */ zend_hash_copy(new_doc_entry->fields, old_doc_entry->fields, (copy_ctor_func_t) field_copy_constructor, NULL, sizeof(solr_field_list_t *)); zend_hash_copy(new_doc_entry->children, old_doc_entry->children, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *)); /* Add the document entry to the directory of documents */ zend_hash_index_update(SOLR_GLOBAL(documents), document_index, (void *) new_doc_entry, sizeof(solr_document_t), NULL); /* Set the value of the internal id property */ zend_update_property_long(solr_ce_SolrInputDocument, objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, document_index TSRMLS_CC); /* Keep track of how many SolrDocument instances we currently have */ SOLR_GLOBAL(document_count)++; } /* }}} */ /* {{{ proto void SolrInputDocument::__sleep(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrInputDocument, __sleep) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1005 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1005_MSG); } /* }}} */ /* {{{ proto void SolrInputDocument::__wakeup(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrInputDocument, __wakeup) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1005 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1005_MSG); } /* }}} */ /* {{{ proto bool SolrInputDocument::setBoost(float document_boost) Sets the boost for the document. */ PHP_METHOD(SolrInputDocument, setBoost) { double boost_value = 0.0f; solr_document_t *doc_entry = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &boost_value) == FAILURE) { RETURN_FALSE; } /* If the submitted boost_value is negative. */ if (boost_value < 0.0) { RETURN_FALSE; } /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { doc_entry->document_boost = boost_value; RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto float SolrInputDocument::getBoost(void) Retrieves the boost for the document. */ PHP_METHOD(SolrInputDocument, getBoost) { solr_document_t *doc_entry = NULL; if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { RETURN_DOUBLE(doc_entry->document_boost); } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrInputDocument::clear(void) Discards all the fields and resets the document boost to zero. */ PHP_METHOD(SolrInputDocument, clear) { solr_document_t *doc_entry = NULL; if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { doc_entry->document_boost = 0.0; doc_entry->field_count = 0L; zend_hash_clean(doc_entry->fields); RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrInputDocument::addField(string field_name, field_value [, float field_boost]) Adds a field to the document. Can be called multiple times. */ PHP_METHOD(SolrInputDocument, addField) { solr_char_t *field_name = NULL; int field_name_length = 0; solr_char_t *field_value = NULL; int field_value_length = 0; double field_boost = 0.0f; solr_document_t *doc_entry = NULL; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|d", &field_name, &field_name_length, &field_value, &field_value_length, &field_boost) == FAILURE) { RETURN_FALSE; } if (!field_name_length) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { solr_field_list_t **field_values_ptr = NULL; solr_field_list_t *field_values = NULL; /* If the field already exists in the SolrDocument instance append the value to the field list queue */ if (zend_hash_find(doc_entry->fields, field_name, field_name_length, (void **) &field_values_ptr) == SUCCESS) { if (solr_document_insert_field_value(*field_values_ptr, field_value, field_boost) == FAILURE) { RETURN_FALSE; } } else { /* Otherwise, create a new one and add it to the hash table */ field_values = (solr_field_list_t *) pemalloc(sizeof(solr_field_list_t), SOLR_DOCUMENT_FIELD_PERSISTENT); memset(field_values, 0, sizeof(solr_field_list_t)); field_values_ptr = &field_values; field_values->count = 0L; field_values->field_boost = 0.0; field_values->field_name = (solr_char_t *) pestrdup(field_name,SOLR_DOCUMENT_FIELD_PERSISTENT); field_values->head = NULL; field_values->last = NULL; if (solr_document_insert_field_value(field_values, field_value, field_boost) == FAILURE) { solr_destroy_field_list(&field_values); RETURN_FALSE; } if (zend_hash_add(doc_entry->fields, field_name, field_name_length, (void *) field_values_ptr, sizeof(solr_field_list_t *), (void **) NULL) == FAILURE) { solr_destroy_field_list(&field_values); RETURN_FALSE; } /* Increment field count only when HEAD is added */ doc_entry->field_count++; } RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrInputDocument::setFieldBoost(string fieldname, float boost_value) Sets the boost for the specified field. */ PHP_METHOD(SolrInputDocument, setFieldBoost) { solr_char_t *field_name = NULL; int field_name_length = 0; double field_boost = 0.0; solr_document_t *doc_entry = NULL; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sd", &field_name, &field_name_length, &field_boost) == FAILURE) { RETURN_FALSE; } if (!field_name_length) { RETURN_FALSE; } if (field_boost < 0.0) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { solr_field_list_t **field_values = NULL; /* If the field already exists in the SolrDocument instance append the value to the field list queue */ if (zend_hash_find(doc_entry->fields, (char *) field_name, field_name_length, (void **) &field_values) == SUCCESS) { (*field_values)->field_boost = field_boost; RETURN_TRUE; } RETURN_FALSE; } RETURN_FALSE; } /* }}} */ /* {{{ proto float SolrInputDocument::getFieldBoost(string fieldname) Returns the boost value for the specified field. */ PHP_METHOD(SolrInputDocument, getFieldBoost) { solr_char_t *field_name = NULL; int field_name_length = 0; solr_document_t *doc_entry = NULL; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (!field_name_length) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { solr_field_list_t **field_values = NULL; if (zend_hash_find(doc_entry->fields, (char *) field_name, field_name_length, (void **) &field_values) == SUCCESS) { RETURN_DOUBLE((*field_values)->field_boost); } RETURN_FALSE; } RETURN_FALSE; } /* }}} */ /* {{{ proto array SolrInputDocument::getFieldNames(void) Returns an array of all the field names in the document. */ PHP_METHOD(SolrInputDocument, getFieldNames) { solr_document_t *doc_entry = NULL; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { HashTable *fields_ht = doc_entry->fields; register zend_bool duplicate = 0; array_init(return_value); SOLR_HASHTABLE_FOR_LOOP(fields_ht) { char *fieldname = NULL; uint fieldname_length = 0U; ulong num_index = 0L; solr_field_list_t **field = NULL; zend_bool duplicate_field_name = 1; zend_hash_get_current_key_ex(fields_ht, &fieldname, &fieldname_length, &num_index, duplicate, NULL); zend_hash_get_current_data_ex(fields_ht, (void **) &field, NULL); add_next_index_string(return_value, (char *) (*field)->field_name, duplicate_field_name); } /* We are done */ return; } RETURN_FALSE; } /* }}} */ /* {{{ proto int SolrInputDocument::getFieldCount(void) Returns the number of fields in document. Multivalued fields are only counted once. */ PHP_METHOD(SolrInputDocument, getFieldCount) { solr_document_t *doc_entry = NULL; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { RETURN_LONG(zend_hash_num_elements(doc_entry->fields)); } RETURN_FALSE; } /* }}} */ /* {{{ proto SolrDocumentField SolrInputDocument::getField(string fieldname) Returns the requested field. */ PHP_METHOD(SolrInputDocument, getField) { solr_char_t *field_name = NULL; int field_name_length = 0; solr_document_t *doc_entry = NULL; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (!field_name_length) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { solr_field_list_t **field_values = NULL; if (zend_hash_find(doc_entry->fields, (char *)field_name, field_name_length, (void **) &field_values) == SUCCESS) { solr_create_document_field_object(*field_values, &return_value TSRMLS_CC); /* The field was retrieved, so we're done here */ return ; } RETURN_FALSE; } RETURN_FALSE; } /* }}} */ /* {{{ proto array SolrInputDocument::toArray(void) Returns an array representation of the object. */ PHP_METHOD(SolrInputDocument, toArray) { solr_document_t *doc_entry = NULL; zval *fields_array = NULL; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { register zend_bool duplicate = 0; HashTable *fields_ht; MAKE_STD_ZVAL(fields_array); array_init(return_value); array_init(fields_array); add_assoc_double(return_value, "document_boost", doc_entry->document_boost); add_assoc_long(return_value, "field_count", doc_entry->field_count); add_assoc_zval(return_value, "fields", fields_array); fields_ht = doc_entry->fields; SOLR_HASHTABLE_FOR_LOOP(fields_ht) { solr_char_t *fieldname = NULL; uint fieldname_length = 0U; ulong num_index = 0L; solr_field_list_t **field = NULL; zval *current_field = NULL; MAKE_STD_ZVAL(current_field); zend_hash_get_current_key_ex(fields_ht, (char **) &fieldname, &fieldname_length, &num_index, duplicate, NULL); zend_hash_get_current_data_ex(fields_ht, (void **) &field, NULL); solr_create_document_field_object(*field, ¤t_field TSRMLS_CC); add_next_index_zval(fields_array, current_field); } /* We are done */ return; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrInputDocument::fieldExists(string field_name) Checks if the field name exists in the document. */ PHP_METHOD(SolrInputDocument, fieldExists) { solr_char_t *field_name = NULL; int field_name_length = 0; solr_document_t *doc_entry = NULL; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (!field_name_length) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { if (zend_hash_exists(doc_entry->fields, (char *) field_name, field_name_length)) { RETURN_TRUE; } else { RETURN_FALSE; } } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrInputDocument::deleteField(string field_name) Removes the request field from the document. */ PHP_METHOD(SolrInputDocument, deleteField) { solr_char_t *field_name = NULL; int field_name_length = 0; solr_document_t *doc_entry = NULL; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (!field_name_length) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { if (zend_hash_del(doc_entry->fields, (char *) field_name, field_name_length) == SUCCESS) { doc_entry->field_count--; RETURN_TRUE; } RETURN_FALSE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrInputDocument::sort(int sort_criterion [, int sort_direction]) Sorts the document fields by the specified criterion. */ PHP_METHOD(SolrInputDocument, sort) { long int order_by = 0L; long int sort_direction = SOLR_SORT_ASC; solr_document_t *doc_entry = NULL; int renumber = 0; /* The pointer to the comparison function used by zend_qsort */ compare_func_t comparison_function = (compare_func_t) NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &order_by, &sort_direction) == FAILURE) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == FAILURE) { RETURN_FALSE; } /* {{{ Select the appropriate comparison function */ switch(order_by) { case SOLR_SORT_FIELD_NAME : /* Sorting by field name */ { switch(sort_direction) { case SOLR_SORT_ASC : comparison_function = solr_compare_field_name; break; case SOLR_SORT_DESC : comparison_function = solr_rcompare_field_name; break; } } break; /* case SOLR_SORT_FIELD_NAME */ case SOLR_SORT_FIELD_VALUE_COUNT : /* Sorting by number of values per field */ { switch(sort_direction) { case SOLR_SORT_ASC : comparison_function = solr_compare_field_value_count; break; case SOLR_SORT_DESC : comparison_function = solr_rcompare_field_value_count; break; } } break; /* case SOLR_SORT_FIELD_VALUE_COUNT */ case SOLR_SORT_FIELD_BOOST_VALUE : /* Sorting by field boost values */ { switch(sort_direction) { case SOLR_SORT_ASC : comparison_function = solr_compare_field_boost_value; break; case SOLR_SORT_DESC : comparison_function = solr_rcompare_field_boost_value; break; } } break; /* case SOLR_SORT_FIELD_BOOST_VALUE */ default : /* Undefined sort criteria */ RETURN_FALSE; break; } /* }}} switch(order_by) */ /* Undefined sort direction. It was not ASC or DESC */ if (!comparison_function) { RETURN_FALSE; } if (zend_hash_sort(doc_entry->fields, zend_qsort, comparison_function, renumber TSRMLS_CC) == FAILURE) { RETURN_FALSE; } RETURN_TRUE; } /* }}} */ /* {{{ proto bool SolrInputDocument::merge(SolrInputDocument source [, bool override]) Merges the source document to the current object. */ PHP_METHOD(SolrInputDocument, merge) { solr_document_t *destination_document = NULL; solr_document_t *source_document = NULL; /* The destination SolrDocument instance */ zval * destination_document_zval = getThis(); /* The source SolrDocument instance */ zval *source_document_zval = NULL; /* Should we skip fields that already exist in destination */ zend_bool overwrite = (zend_bool) 0; copy_ctor_func_t p_copy_ctor = (copy_ctor_func_t) field_copy_constructor; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &source_document_zval, solr_ce_SolrInputDocument, &overwrite) == FAILURE) { RETURN_FALSE; } if (solr_fetch_document_entry(source_document_zval, &source_document TSRMLS_CC) == FAILURE) { RETURN_FALSE; } if (solr_fetch_document_entry(destination_document_zval, &destination_document TSRMLS_CC) == FAILURE) { RETURN_FALSE; } if (zend_hash_num_elements(source_document->fields) == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Source SolrInputDocument has no fields. Source documentId"); RETURN_FALSE; } /* Copy the fields in the source HashTable to the destination HashTable */ zend_hash_merge(destination_document->fields, source_document->fields, p_copy_ctor, NULL, sizeof(solr_field_list_t *), (int) overwrite); /* Update the field count */ destination_document->field_count = (uint) zend_hash_num_elements(destination_document->fields); RETURN_TRUE; } /* }}} */ /* {{{ proto void SolrInputDocument::addChildDocument(SolrInputDocument child) Adds a child document */ PHP_METHOD(SolrInputDocument, addChildDocument) { zval *child_obj = NULL; solr_document_t *solr_doc = NULL, *child_doc_entry = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &child_obj, solr_ce_SolrInputDocument) == FAILURE) { RETURN_FALSE; } if (solr_fetch_document_entry(getThis(), &solr_doc TSRMLS_CC) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1008 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Internal Error: Unable to fetch document_entry."); return; } if (solr_fetch_document_entry(child_obj, &child_doc_entry TSRMLS_CC) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1008 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Internal Error: Unable to fetch document_entry for child document."); return; } /* SolrInputDocument must contain at least one field */ if (0 == zend_hash_num_elements(child_doc_entry->fields)) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Child document has no fields"); return; } if (zend_hash_next_index_insert(solr_doc->children, &child_obj, sizeof(zval *), NULL) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Internal Error: Unable to add child to the hashtable."); } else { Z_ADDREF_P(child_obj); } } /* }}} */ /* {{{ proto void SolrInputDocument::addChildDocuments(array) Adds a child documents */ PHP_METHOD(SolrInputDocument, addChildDocuments) { HashTable *solr_input_docs; solr_document_t *solr_doc = NULL; zval *docs_array = NULL; int num_input_docs = 0, curr_pos = 0; size_t pos = 0U; zval **input_docs = NULL, *current_input_doc = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &docs_array) == FAILURE) { return; } if (solr_fetch_document_entry(getThis(), &solr_doc TSRMLS_CC) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1008 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Internal Error: Unable to fetch document_entry."); } solr_input_docs = Z_ARRVAL_P(docs_array); num_input_docs = zend_hash_num_elements(solr_input_docs); if(!num_input_docs) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "The array parameter passed is empty"); return; } /* This should be released if there is an error */ input_docs = (zval **) pemalloc((sizeof(zval *) * (num_input_docs + 1)), SOLR_DOCUMENT_PERSISTENT); memset(input_docs, 0, sizeof(zval *) * (num_input_docs + 1)); /* Please check all the SolrInputDocument instances passed via the array */ SOLR_HASHTABLE_FOR_LOOP(solr_input_docs) { zval **solr_input_doc = NULL; solr_document_t *doc_entry = NULL; HashTable *document_fields; zend_hash_get_current_data_ex(solr_input_docs, (void **) &solr_input_doc, ((HashPosition *)0)); if (Z_TYPE_PP(solr_input_doc) != IS_OBJECT || !instanceof_function(Z_OBJCE_PP(solr_input_doc), solr_ce_SolrInputDocument TSRMLS_CC)) { SOLR_FREE_DOC_ENTRIES(input_docs); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u is not a valid SolrInputDocument instance", (curr_pos + 1U)); return; } if (solr_fetch_document_entry((*solr_input_doc), &doc_entry TSRMLS_CC) == FAILURE) { SOLR_FREE_DOC_ENTRIES(input_docs); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u is not valid. Object not present in HashTable", (curr_pos + 1U)); return; } document_fields = doc_entry->fields; /* SolrInputDocument must contain at least one field */ if (0 == zend_hash_num_elements(document_fields)) { SOLR_FREE_DOC_ENTRIES(input_docs); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u has no fields", (curr_pos + 1U)); return; } input_docs[curr_pos] = *solr_input_doc; curr_pos++; } /* Grab the first (solr_document_t *) pointer */ current_input_doc = input_docs[pos]; while(current_input_doc != NULL) { if (zend_hash_next_index_insert(solr_doc->children, ¤t_input_doc, sizeof(zval *), NULL) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u has no fields", (pos + 1U)); SOLR_FREE_DOC_ENTRIES(input_docs); return; } Z_ADDREF_P(current_input_doc); pos++; current_input_doc = input_docs[pos]; } SOLR_FREE_DOC_ENTRIES(input_docs); } /* }}} */ /* {{{ proto array SolrInputDocument::getChildDocuments( void ) Returns child documents or null if none */ PHP_METHOD(SolrInputDocument, getChildDocuments) { solr_document_t *solr_doc = NULL; if (solr_fetch_document_entry(getThis(), &solr_doc TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to fetch document entry for current object"); } if (zend_hash_num_elements(solr_doc->children) > 0) { array_init(return_value); zend_hash_init(Z_ARRVAL_P(return_value), zend_hash_num_elements(solr_doc->children), NULL, ZVAL_PTR_DTOR, 0); zend_hash_copy(Z_ARRVAL_P(return_value), solr_doc->children, (copy_ctor_func_t)zval_add_ref, NULL, sizeof(zval *)); } } /* }}} */ /* {{{ proto bool SolrInputDocument::hasChildDocuments (void) Checks whether this document has got child documents */ PHP_METHOD(SolrInputDocument, hasChildDocuments) { solr_document_t *solr_doc = NULL; if (solr_fetch_document_entry(getThis(), &solr_doc TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to fetch document entry for current object"); } if (zend_hash_num_elements(solr_doc->children) > 0) { RETURN_TRUE; } else { RETURN_FALSE; } } /* }}} */ /* {{{ proto int SolrInputDocument::getChildDocumentsCount (void) Returns the number of child documents */ PHP_METHOD(SolrInputDocument, getChildDocumentsCount) { solr_document_t *solr_doc = NULL; if (solr_fetch_document_entry(getThis(), &solr_doc TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to fetch document entry for current object"); } Z_LVAL_P(return_value) = zend_hash_num_elements(solr_doc->children); Z_TYPE_P(return_value) = IS_LONG; } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/php_solr_object.c000066400000000000000000000254341374041537100223360ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ PHP_SOLR_API void solr_object_write_property(zval *object, zval *member, zval *value TSRMLS_DC) */ #if PHP_VERSION_ID < 50399 PHP_SOLR_API void solr_object_write_property(zval *object, zval *member, zval *value TSRMLS_DC) #else PHP_SOLR_API void solr_object_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC) #endif { solr_throw_exception(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1006_MSG, SOLR_ERROR_1006 TSRMLS_CC, SOLR_FILE_LINE_FUNC); if (Z_TYPE_P(member) == IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempting to set value for [%s] property in a SolrObject instance", Z_STRVAL_P(member)); } } /* }}} */ /* {{{ PHP_SOLR_API void solr_object_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC) */ PHP_SOLR_API void solr_object_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC) { solr_throw_exception(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1006_MSG, SOLR_ERROR_1006 TSRMLS_CC, SOLR_FILE_LINE_FUNC); if (Z_TYPE_P(offset) == IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempting to set value for [%s] property in a SolrObject instance", Z_STRVAL_P(offset)); } } /* }}} */ /* {{{ PHP_SOLR_API void solr_object_unset_property(zval *object, zval *member TSRMLS_DC) */ #if PHP_VERSION_ID < 50399 PHP_SOLR_API void solr_object_unset_property(zval *object, zval *member TSRMLS_DC) #else PHP_SOLR_API void solr_object_unset_property(zval *object, zval *member, const zend_literal *key TSRMLS_DC) #endif { solr_throw_exception(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1006_MSG, SOLR_ERROR_1006 TSRMLS_CC, SOLR_FILE_LINE_FUNC); if (Z_TYPE_P(member) == IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempting to remove [%s] property in a SolrObject instance", Z_STRVAL_P(member)); } } /* }}} */ /* {{{ PHP_SOLR_API void solr_object_unset_dimension(zval *object, zval *offset TSRMLS_DC) */ PHP_SOLR_API void solr_object_unset_dimension(zval *object, zval *offset TSRMLS_DC) { solr_throw_exception(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1006_MSG, SOLR_ERROR_1006 TSRMLS_CC, SOLR_FILE_LINE_FUNC); if (Z_TYPE_P(offset) == IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempting to remove [%s] property in a SolrObject instance", Z_STRVAL_P(offset)); } } /* }}} */ /* {{{ PHP_SOLR_API zval *solr_object_read_property(zval *object, zval *member, int type TSRMLS_DC) */ #if PHP_VERSION_ID < 50399 PHP_SOLR_API zval *solr_object_read_property(zval *object, zval *member, int type TSRMLS_DC) #else PHP_SOLR_API zval *solr_object_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) #endif { zval **value = &EG(uninitialized_zval_ptr); char *name = NULL; HashTable *properties = NULL; /* zend_object *zobject = NULL; */ if (Z_TYPE_P(member) != IS_STRING) { return (*value); } SOLR_HASHTABLE_FOR_LOOP(properties) { char *property_name = NULL; uint property_name_len = 0U; ulong num_index = 0L; zend_hash_get_current_key_ex(properties, &property_name, &property_name_len, &num_index, 0, NULL); /* If the property name is in the HashTable */ if (property_name && !strcmp(property_name, name)) { zend_hash_get_current_data_ex(properties, (void **) &value, NULL); } } return (*value); } /* }}} */ /* {{{ proto SolrObject::__construct(void) Constructor for SolrObject */ PHP_METHOD(SolrObject, __construct) { Z_OBJ_HT_P(getThis()) = &solr_object_handlers; } /* }}} */ /* {{{ proto SolrObject::__destruct(void) Destructor for SolrObject. */ PHP_METHOD(SolrObject, __destruct) { } /* }}} */ /* {{{ proto void SolrObject::__set(string property_name, mixed value) Magic method for setting/updating property values. */ PHP_METHOD(SolrObject, __set) { } /* }}} */ /* {{{ proto mixed SolrObject::__get(string property_name) Magic method for retrieving properties. */ PHP_METHOD(SolrObject, __get) { solr_char_t *name = NULL; int name_len = 0; zval *property = NULL; zend_bool copy_value = 1; void *dtor = NULL; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { RETURN_FALSE; } property = zend_read_property(solr_ce_SolrObject, getThis(), name, name_len, 0 TSRMLS_CC); if (property) { RETURN_ZVAL(property, copy_value, dtor); } } /* }}} */ /* {{{ proto bool SolrObject::__isset(string property_name) Magic method for checking if a property exists in the object. */ PHP_METHOD(SolrObject, __isset) { solr_char_t *name = NULL; int name_len = 0; zend_object *zobject = NULL; void **value = NULL; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { RETURN_FALSE; } zobject = zend_objects_get_address(getThis() TSRMLS_CC); zend_hash_find(zobject->properties, name, name_len, (void **) &value); if (value) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto void SolrObject::__unset(string property_name) Magic method for removing the specified property. */ PHP_METHOD(SolrObject, __unset) { solr_char_t *name = NULL; int name_len = 0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { return; } solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1002 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1002_MSG, name); RETURN_FALSE; } /* }}} */ /* {{{ proto void SolrObject::offsetSet(string key, mixed value) Sets the specified key to value. */ PHP_METHOD(SolrObject, offsetSet) { solr_char_t *name = NULL; int name_len = 0; zval *prop = NULL; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &name, &name_len, &prop) == FAILURE) { RETURN_FALSE; } if (prop && prop->type == IS_NULL) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1002 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1002_MSG, name); return ; } zend_update_property(Z_OBJCE_P(getThis()), getThis(), name, name_len, prop TSRMLS_CC); } /* }}} */ /* {{{ proto mixed SolrObject::offsetGet(string key) Retrieves the requested key. */ PHP_METHOD(SolrObject, offsetGet) { solr_char_t *name = NULL; int name_len = 0; zend_object *zobject = zend_objects_get_address(getThis() TSRMLS_CC); HashTable *properties = zobject->properties; zval **property_value = NULL; zend_bool copy_value = 1; void *dtor = NULL; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { RETURN_FALSE; } SOLR_HASHTABLE_FOR_LOOP(properties) { char *property_name = NULL; uint property_name_len = 0U; ulong num_index = 0L; zend_hash_get_current_key_ex(properties, &property_name, &property_name_len, &num_index, 0, NULL); /* If the property name is in the HashTable */ if (property_name && !strcmp(property_name, name)) { zend_hash_get_current_data_ex(properties, (void **) &property_value, NULL); goto job_complete; } } job_complete : zend_hash_internal_pointer_reset(properties); if (property_value && (*property_value)) { RETURN_ZVAL((*property_value), copy_value, dtor); } } /* }}} */ /* {{{ proto bool SolrObject::offsetExists(string key) Checks if the key exists. */ PHP_METHOD(SolrObject, offsetExists) { solr_char_t *name = NULL; int name_len = 0; zend_object *zobject = zend_objects_get_address(getThis() TSRMLS_CC); HashTable *properties = zobject->properties; zend_bool property_exists = 0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { RETURN_FALSE; } SOLR_HASHTABLE_FOR_LOOP(properties) { char *property_name = NULL; uint property_name_len = 0U; ulong num_index = 0L; zend_hash_get_current_key_ex(properties, &property_name, &property_name_len, &num_index, 0, NULL); /* If the property name is in the HashTable */ if (property_name && !strcmp(property_name, name)) { property_exists = 1; goto job_complete; } } job_complete : if (properties) { zend_hash_internal_pointer_reset(properties); } RETURN_BOOL(property_exists); } /* }}} */ /* {{{ proto void SolrObject::offsetUnset(string key) Removes the specified key. */ PHP_METHOD(SolrObject, offsetUnset) { solr_char_t *name = NULL; int name_len = 0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { return; } solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1002 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1002_MSG, name); RETURN_FALSE; } /* }}} */ /* {{{ proto array SolrObject::getPropertyNames(void) Returns an array of all the properties/keys in the object. */ PHP_METHOD(SolrObject, getPropertyNames) { zend_object *zobject = zend_objects_get_address(getThis() TSRMLS_CC); HashTable *properties = zobject->properties; array_init(return_value); SOLR_HASHTABLE_FOR_LOOP(properties) { char *property_name = NULL; uint property_name_length = 0U; ulong num_index = 0L; zend_hash_get_current_key_ex(properties, &property_name, &property_name_length, &num_index, 0, NULL); add_next_index_stringl(return_value, property_name, property_name_length-1, 1); } } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/php_solr_params.c000066400000000000000000000744471374041537100223630ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ static void solr_serialize_xml_set_param_props(xmlNode *xml_param_node, solr_param_t *param) */ static void solr_serialize_xml_set_param_props(xmlNode *xml_param_node, solr_param_t *param) { char tmp_buffer[32]; /* This should be enough to hold any value */ memset(tmp_buffer, 0, sizeof(tmp_buffer)); /* Set the name attribute on the param node */ xmlNewProp(xml_param_node, (xmlChar *) "name", (xmlChar *) param->param_name); php_sprintf(tmp_buffer, "%d", param->type); /* Set the type attribute on the param node */ xmlNewProp(xml_param_node, (xmlChar *) "type", (xmlChar *) tmp_buffer); php_sprintf(tmp_buffer, "%d", param->allow_multiple); /* Set the allow_multiple attribute on the param node */ xmlNewProp(xml_param_node, (xmlChar *) "allow_multiple", (xmlChar *) tmp_buffer); php_sprintf(tmp_buffer, "%u", param->count); /* Set the count attribute on the param node */ xmlNewProp(xml_param_node, (xmlChar *) "count", (xmlChar *) tmp_buffer); php_sprintf(tmp_buffer, "%d", param->delimiter); /* Set the delimiter attribute on the param node */ xmlNewProp(xml_param_node, (xmlChar *) "delimiter", (xmlChar *) tmp_buffer); php_sprintf(tmp_buffer, "%d", param->arg_separator); /* Set the arg_separator attribute on the param node */ xmlNewProp(xml_param_node, (xmlChar *) "arg_separator", (xmlChar *) tmp_buffer); } /* }}} */ /* {{{ static void solr_serialize_normal_param_value(xmlNode *xml_params_node, solr_param_t *param) */ static void solr_serialize_normal_param_value(xmlNode *xml_params_node, solr_param_t *param) { xmlNode *xml_param_node = xmlNewChild(xml_params_node, NULL, (xmlChar *) "param", NULL); solr_param_value_t *curr_value = param->head; solr_serialize_xml_set_param_props(xml_param_node, param); while(curr_value != NULL) { xmlChar *param_value_txt = xmlEncodeEntitiesReentrant(xml_params_node->doc, (xmlChar *) curr_value->contents.normal.str); xmlNewChild(xml_param_node, NULL, (xmlChar *) "param_value", param_value_txt); xmlFree(param_value_txt); curr_value = curr_value->next; /* Go to the next value in the list */ } } /* }}} */ /* {{{ static void solr_serialize_simple_list_param_value(xmlNode *xml_params_node, solr_param_t *param) */ static void solr_serialize_simple_list_param_value(xmlNode *xml_params_node, solr_param_t *param) { xmlNode *xml_param_node = xmlNewChild(xml_params_node, NULL, (xmlChar *) "param", NULL); solr_param_value_t *curr_value = param->head; solr_serialize_xml_set_param_props(xml_param_node, param); while(curr_value != NULL) { xmlChar *param_value_txt = xmlEncodeEntitiesReentrant(xml_params_node->doc, (xmlChar *) curr_value->contents.simple_list.str); xmlNewChild(xml_param_node, NULL, (xmlChar *) "param_value", param_value_txt); xmlFree(param_value_txt); curr_value = curr_value->next; /* Go to the next value in the list */ } } /* }}} */ /* {{{ static void solr_serialize_arg_list_param_value(xmlNode *xml_params_node, solr_param_t *param) */ static void solr_serialize_arg_list_param_value(xmlNode *xml_params_node, solr_param_t *param) { xmlNode *xml_param_node = xmlNewChild(xml_params_node, NULL, (xmlChar *) "param", NULL); solr_param_value_t *curr_value = param->head; solr_serialize_xml_set_param_props(xml_param_node, param); while(curr_value != NULL) { xmlChar *param_value_txt = xmlEncodeEntitiesReentrant(xml_params_node->doc, (xmlChar *) curr_value->contents.arg_list.value.str); xmlChar *arg_value_txt = xmlEncodeEntitiesReentrant(xml_params_node->doc, (xmlChar *) curr_value->contents.arg_list.arg.str); xmlNode *xml_param_value = xmlNewChild(xml_param_node, NULL, (xmlChar *) "param_value", param_value_txt); xmlNewProp(xml_param_value, (xmlChar *) "argument", arg_value_txt); xmlFree(param_value_txt); xmlFree(arg_value_txt); curr_value = curr_value->next; /* Go to the next value in the list */ } } /* }}} */ /* {{{ static int solr_serialize_solr_params_object(xmlChar **serialized, int *size, zval *objptr TSRMLS_DC) */ static int solr_serialize_solr_params_object(xmlChar **serialized, int *size, zval *objptr TSRMLS_DC) { solr_params_t *solr_params = NULL; xmlNode *xml_solr_params = NULL, *xml_params = NULL; xmlDoc *doc_ptr = NULL; HashTable *params = NULL; int format = 1; if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { return FAILURE; } if (!serialized || !size || !objptr) { return FAILURE; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "solr_params", &xml_solr_params); xml_params = xmlNewChild(xml_solr_params, NULL, (xmlChar *) "params", NULL); params = solr_params->params; SOLR_HASHTABLE_FOR_LOOP(params) { solr_param_t **solr_param_ptr = NULL; zend_hash_get_current_data_ex(params, (void **) &solr_param_ptr, ((HashPosition *)0)); switch((*solr_param_ptr)->type) { case SOLR_PARAM_TYPE_NORMAL : { solr_serialize_normal_param_value(xml_params, (*solr_param_ptr)); } break; case SOLR_PARAM_TYPE_SIMPLE_LIST : { solr_serialize_simple_list_param_value(xml_params, (*solr_param_ptr)); } break; case SOLR_PARAM_TYPE_ARG_LIST : { solr_serialize_arg_list_param_value(xml_params, (*solr_param_ptr)); } break; default : { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Solr Param Type %d", (*solr_param_ptr)->type); } } } xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, serialized, size, "UTF-8", format); xmlFreeDoc(doc_ptr); return SUCCESS; } /* }}} */ /* {{{ static void solr_unserialize_get_param_normal(xmlNode *normal_param, HashTable *params_ht TSRMLS_DC) */ static void solr_unserialize_get_param_normal(xmlNode *normal_param, HashTable *params_ht TSRMLS_DC) { solr_char_t *param_name = NULL; size_t param_name_len = 0U; solr_bool allow_multiple = 0; solr_param_type_t param_type = SOLR_PARAM_TYPE_NORMAL; xmlAttr *currAttr = normal_param->properties; solr_param_t *param = NULL; xmlNode *currNode = normal_param->children; solr_param_value_equal_func_t equal_func = solr_normal_param_value_equal; solr_param_fetch_func_t fetch_func = (solr_param_fetch_func_t) solr_normal_param_value_fetch; solr_param_value_free_func_t free_func = solr_normal_param_value_free; /* Grab the name and setting for this parameter */ while(currAttr != NULL) { if (solr_xml_match_node(currAttr, "name")) { param_name = (solr_char_t *) solr_xml_get_node_contents(currAttr); param_name_len = solr_strlen(param_name); } if (solr_xml_match_node(currAttr, "allow_multiple")) { allow_multiple = solr_xml_get_node_contents_int(currAttr); } currAttr = currAttr->next; } param = solr_create_new_param(param_name, param_name_len, param_type, allow_multiple, equal_func, fetch_func, free_func, '&', 0 TSRMLS_CC); /* Retrieve all the values for this parameter */ while(currNode != NULL) { if (solr_xml_match_node(currNode, "param_value")) { xmlChar *pvalue = solr_xml_get_node_contents(currNode); size_t pvalue_length = solr_strlen((char *)pvalue); solr_param_value_t *parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.normal), (solr_char_t *) pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); } currNode = currNode->next; } /* Add this parameter to the hash table */ if (zend_hash_add(params_ht, (char *) param_name, param_name_len, (void *) ¶m, sizeof(solr_param_t *), (void **) NULL) == FAILURE) { /* Release all the memory allocated to this paramter */ solr_destroy_param(¶m); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error from %s %s", __func__, (char *) param_name); return; } } /* }}} */ /* {{{ static void solr_unserialize_get_param_simple_list(xmlNode *list_param, HashTable *params_ht TSRMLS_DC) */ static void solr_unserialize_get_param_simple_list(xmlNode *list_param, HashTable *params_ht TSRMLS_DC) { solr_char_t *param_name = NULL; size_t param_name_len = 0U; solr_bool allow_multiple = 0; solr_param_type_t param_type = SOLR_PARAM_TYPE_SIMPLE_LIST; solr_param_t *param = NULL; xmlNode *currNode = list_param->children; xmlAttr *currAttr = list_param->properties; solr_param_value_equal_func_t equal_func = solr_simple_list_param_value_equal; solr_param_fetch_func_t fetch_func = (solr_param_fetch_func_t) solr_simple_list_param_value_fetch; solr_param_value_free_func_t free_func = solr_simple_list_param_value_free; /* Grab the name and setting for this parameter */ while(currAttr != NULL) { if (solr_xml_match_node(currAttr, "name")) { param_name = (solr_char_t *) solr_xml_get_node_contents(currAttr); param_name_len = solr_strlen(param_name); } if (solr_xml_match_node(currAttr, "allow_multiple")) { allow_multiple = solr_xml_get_node_contents_int(currAttr); } currAttr = currAttr->next; } param = solr_create_new_param(param_name, param_name_len, param_type, allow_multiple, equal_func, fetch_func, free_func, ',', 0 TSRMLS_CC); /* Retrieve all the values for this parameter */ while(currNode != NULL) { if (solr_xml_match_node(currNode, "param_value")) { solr_char_t *pvalue = (solr_char_t *) solr_xml_get_node_contents(currNode); size_t pvalue_length = solr_strlen(pvalue); solr_param_value_t *parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.simple_list), pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); } currNode = currNode->next; } /* Add this parameter to the hash table */ if (zend_hash_add(params_ht, (char *) param_name, param_name_len, (void *) ¶m, sizeof(solr_param_t *), (void **) NULL) == FAILURE) { /* Release all the memory allocated to this paramter */ solr_destroy_param(¶m); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error from %s %s", __func__, (char *) param_name); return; } } /* }}} */ /* {{{ static void solr_unserialize_get_param_arg_list(xmlNode *sort_param, HashTable *params_ht TSRMLS_DC) */ static void solr_unserialize_get_param_arg_list(xmlNode *sort_param, HashTable *params_ht TSRMLS_DC) { solr_char_t *param_name = NULL; size_t param_name_len = 0U; solr_bool allow_multiple = 0; solr_char_t delimiter = 0; solr_char_t separator = 0; xmlAttr *currAttr = sort_param->properties; solr_param_type_t param_type = SOLR_PARAM_TYPE_ARG_LIST; solr_param_t *param = NULL; xmlNode *currNode = sort_param->children; solr_param_value_equal_func_t equal_func = solr_arg_list_param_value_equal; solr_param_fetch_func_t fetch_func = (solr_param_fetch_func_t) solr_arg_list_param_value_fetch; solr_param_value_free_func_t free_func = solr_arg_list_param_value_free; /* Grab the name and setting for this parameter */ while(currAttr != NULL) { if (solr_xml_match_node(currAttr, "name")) { param_name = (solr_char_t *) solr_xml_get_node_contents(currAttr); param_name_len = solr_strlen(param_name); } if (solr_xml_match_node(currAttr, "allow_multiple")) { allow_multiple = solr_xml_get_node_contents_int(currAttr); } if (solr_xml_match_node(currAttr, "delimiter")) { delimiter = solr_xml_get_node_contents_int(currAttr); } if (solr_xml_match_node(currAttr, "arg_separator")) { separator = solr_xml_get_node_contents_int(currAttr); } currAttr = currAttr->next; } param = solr_create_new_param(param_name, param_name_len, param_type, allow_multiple, equal_func, fetch_func, free_func, delimiter, separator TSRMLS_CC); /* Retrieve all the values for this parameter */ while(currNode != NULL) { if (solr_xml_match_node(currNode, "param_value")) { solr_char_t *pvalue = (solr_char_t *) solr_xml_get_node_contents(currNode); xmlAttr *argument = currNode->properties; /* the argument is the only property */ solr_char_t *avalue = (solr_char_t *) solr_xml_get_node_contents(argument); size_t pvalue_length = solr_strlen(pvalue); size_t avalue_length = solr_strlen(avalue); solr_param_value_t *parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.arg_list.value), pvalue, pvalue_length); solr_string_appends(&(parameter_value->contents.arg_list.arg), avalue, avalue_length); solr_params_insert_param_value(param, parameter_value); } currNode = currNode->next; } /* Add this parameter to the hash table */ if (zend_hash_add(params_ht, (char *) param_name, param_name_len, (void *) ¶m, sizeof(solr_param_t *), (void **) NULL) == FAILURE) { /* Release all the memory allocated to this paramter */ solr_destroy_param(¶m); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error from %s %s", __func__, (char *) param_name); return; } } /* }}} */ /* {{{ static int solr_unserialize_solr_params_object(const char *serialized, int size, zval *objptr TSRMLS_DC) */ static int solr_unserialize_solr_params_object(const char *serialized, int size, zval *objptr TSRMLS_DC) { solr_params_t *solr_params = NULL; long int params_index = SOLR_UNIQUE_PARAMS_INDEX(); solr_params_t tmp_solr_params; uint nSize = SOLR_INITIAL_HASH_TABLE_SIZE; HashTable *params_ht = NULL; xmlDoc *doc = NULL; xmlXPathContext *xpathctxt; const xmlChar *xpath_expression = (xmlChar *) "/solr_params/params/param/@type"; xmlXPathObject *xpathObj; xmlNodeSet *result = NULL; register size_t num_nodes; register size_t i = 0U; int return_status = SUCCESS; zend_update_property_long(Z_OBJCE_P(objptr), objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, params_index TSRMLS_CC); memset(&tmp_solr_params, 0, sizeof(solr_params_t)); if (zend_hash_index_update(SOLR_GLOBAL(params), params_index, (void *) &tmp_solr_params, sizeof(solr_params_t), (void **) &solr_params) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while registering SolrParam object in HashTable"); return FAILURE; } solr_params->params_index = params_index; /* Allocate memory for the parameters HashTable using fast cache for HashTables */ ALLOC_HASHTABLE(solr_params->params); zend_hash_init(solr_params->params, nSize, NULL, (dtor_func_t) solr_destroy_param, SOLR_PARAMS_PERSISTENT); params_ht = solr_params->params; doc = xmlReadMemory(serialized, size, NULL, "UTF-8", 0); if (doc == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while parsing serialized XML string"); return FAILURE; } xpathctxt = xmlXPathNewContext(doc); if (xpathctxt == NULL) { xmlFreeDoc(doc); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while creating XML Xpath context"); return FAILURE; } xpathObj = xmlXPathEval(xpath_expression, xpathctxt); if (xpathObj == NULL) { xmlXPathFreeContext(xpathctxt); xmlFreeDoc(doc); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while evaluation XML Xpath expression"); return FAILURE; } result = xpathObj->nodesetval; if (result == NULL) { xmlXPathFreeObject(xpathObj); xmlXPathFreeContext(xpathctxt); xmlFreeDoc(doc); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while extracting result from XML xpath object during unserialization"); return FAILURE; } num_nodes = result->nodeNr; /* Number of parameter nodes matches in the xmlDocument */ /* Loop through all the parameter nodes and create an entry in the HashTable for each one */ for (i = 0U; i < num_nodes; i++) { xmlNode *currNode = result->nodeTab[i]; /* Absolutely No assumptions. I have to make sure that this is an attribute node */ if (currNode->type == XML_ATTRIBUTE_NODE) { /* Find out what type of parameter this is */ const solr_param_type_t param_type = solr_xml_get_node_contents_int(currNode); /* Get the /solr_params/params/param node */ xmlNode *param_xml_node = currNode->parent; /* Handle each parameter type separately */ switch(param_type) { case SOLR_PARAM_TYPE_NORMAL : { solr_unserialize_get_param_normal(param_xml_node, params_ht TSRMLS_CC); } break; case SOLR_PARAM_TYPE_SIMPLE_LIST : { solr_unserialize_get_param_simple_list(param_xml_node, params_ht TSRMLS_CC); } break; case SOLR_PARAM_TYPE_ARG_LIST : { solr_unserialize_get_param_arg_list(param_xml_node, params_ht TSRMLS_CC); } break; default : { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter type"); return_status = FAILURE; goto loop_complete; } } /* End switch */ } /* End if (currNode->type == XML_ATTRIBUTE_NODE) */ } /* End for */ loop_complete: xmlXPathFreeObject(xpathObj); xmlXPathFreeContext(xpathctxt); xmlFreeDoc(doc); return return_status; } /* }}} */ /* {{{ proto SolrParams::__clone(void) Should never be called directly. Throws exceptions whenever there is an attempt to clone a SolrParams instance */ PHP_METHOD(SolrParams, __clone) { long int params_index = SOLR_UNIQUE_PARAMS_INDEX(); solr_params_t *solr_params_dest = NULL; zend_update_property_long(solr_ce_SolrModifiableParams, getThis(), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, params_index TSRMLS_CC); solr_init_params(&solr_params_dest, params_index TSRMLS_CC); solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_4001 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Cloning of SolrParams object instances is currently not supported"); } /* }}} */ /* {{{ proto SolrParams::setParam(string param_name, string param_value) Sets the parameter to the specified value */ PHP_METHOD(SolrParams, setParam) { solr_char_t *param_name = NULL; int param_name_length = 0; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", ¶m_name, ¶m_name_length, ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrParams::addParam(string param_name, string param_value) Adds another param_name to the object. */ PHP_METHOD(SolrParams, addParam) { solr_char_t *param_name = NULL; int param_name_length = 0; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", ¶m_name, ¶m_name_length, ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrParams::getParam(string param_name) Retrieves a parameter value */ PHP_METHOD(SolrParams, getParam) { solr_char_t *param_name = NULL; int param_name_length = 0; solr_param_t *solr_param = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", ¶m_name, ¶m_name_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_FALSE; } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "return value requested without processing output."); return; } if (!param_name_length) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter name"); RETURN_NULL(); } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } if (!solr_param) { /* This should never happen unless there is a logic error in solr_param_find() */ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Very severe internal error while fetching (solr_param_t **) from solr_param_find() %s", __func__); return; } switch(solr_param->type) { case SOLR_PARAM_TYPE_NORMAL : { if (solr_param->allow_multiple) { array_init(return_value); solr_normal_param_value_display(solr_param, return_value); return; } else { solr_normal_param_value_display_string(solr_param, return_value); return; } } break; case SOLR_PARAM_TYPE_SIMPLE_LIST : { array_init(return_value); solr_simple_list_param_value_display(solr_param, return_value); return; } break; case SOLR_PARAM_TYPE_ARG_LIST : { array_init(return_value); solr_arg_list_param_value_display(solr_param, return_value); return; } break; default : { /* This should never happen. However, never say never! */ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter type in switch case %s", __func__); } } /* END switch(solr_param->type) */ } /* }}} */ /* {{{ proto array SolrParams::getPreparedParams(void) Returns an array of all the parameters (url-encoded) as they will be sent in the name-value pair POST request. */ PHP_METHOD(SolrParams, getPreparedParams) { solr_params_t *solr_params = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Return value requested but output not processed."); return; } array_init(return_value); /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_params_entry(getThis(), &solr_params TSRMLS_CC) == SUCCESS) { HashTable *params = solr_params->params; SOLR_HASHTABLE_FOR_LOOP(params) { solr_param_t **solr_param_ptr = NULL; solr_param_t *solr_param; solr_string_t tmp_buffer; zend_hash_get_current_data_ex(params, (void **) &solr_param_ptr, NULL); solr_param = (*solr_param_ptr); memset(&tmp_buffer, 0, sizeof(solr_string_t)); solr_param->fetch_func(solr_param, &tmp_buffer); add_assoc_stringl(return_value, (*solr_param_ptr)->param_name, tmp_buffer.str, tmp_buffer.len, 1); solr_string_free(&tmp_buffer); } return; } php_error_docref(NULL TSRMLS_CC, E_WARNING, "SolrParams instance could not be retrieved from HashTable"); RETURN_NULL(); } /* }}} */ /* {{{ proto array SolrParams::getParams(void) Returns an array of the parameters in the object. The values are not url-encoded. */ PHP_METHOD(SolrParams, getParams) { solr_params_t *solr_params = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Return value requested but output not processed."); return; } array_init(return_value); /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_params_entry(getThis(), &solr_params TSRMLS_CC) == SUCCESS) { HashTable *params = solr_params->params; SOLR_HASHTABLE_FOR_LOOP(params) { solr_param_t **solr_param_ptr = NULL; solr_param_display_func_t display_func = NULL; zval *current_param = NULL; zend_hash_get_current_data_ex(params, (void **) &solr_param_ptr, NULL); switch((*solr_param_ptr)->type) { case SOLR_PARAM_TYPE_NORMAL : { display_func = solr_normal_param_value_display; } break; case SOLR_PARAM_TYPE_SIMPLE_LIST : { display_func = solr_simple_list_param_value_display; } break; case SOLR_PARAM_TYPE_ARG_LIST : { display_func = solr_arg_list_param_value_display; } break; default : { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter type"); } } MAKE_STD_ZVAL(current_param); array_init(current_param); add_assoc_zval(return_value, (*solr_param_ptr)->param_name, current_param); display_func((*solr_param_ptr), current_param); } return; } php_error_docref(NULL TSRMLS_CC, E_WARNING, "SolrParams instance could not be retrieved from HashTable"); RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrParams::__toString(void) Returns a string representation of the object */ PHP_METHOD(SolrParams, __toString) { solr_params_t *solr_params = NULL; register zend_bool url_encode = 0; /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_params_entry(getThis(), &solr_params TSRMLS_CC) == SUCCESS) { HashTable *params = solr_params->params; solr_string_t tmp_buffer; memset(&tmp_buffer, 0, sizeof(solr_string_t)); SOLR_HASHTABLE_FOR_LOOP(params) { solr_param_t **solr_param_ptr = NULL; solr_param_tostring_func_t tostring_func = NULL; zend_hash_get_current_data_ex(params, (void **) &solr_param_ptr, NULL); switch((*solr_param_ptr)->type) { case SOLR_PARAM_TYPE_NORMAL : { tostring_func = solr_normal_param_value_tostring; } break; case SOLR_PARAM_TYPE_SIMPLE_LIST : { tostring_func = solr_simple_list_param_value_tostring; } break; case SOLR_PARAM_TYPE_ARG_LIST : { tostring_func = solr_arg_list_param_value_tostring; } break; default : { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter type"); } } tostring_func((*solr_param_ptr), &(tmp_buffer), url_encode); solr_string_appendc(&(tmp_buffer), '&'); } if (tmp_buffer.str && tmp_buffer.len) { solr_string_remove_last_char(&(tmp_buffer)); RETVAL_STRINGL((char *) tmp_buffer.str, tmp_buffer.len, 1); solr_string_free(&(tmp_buffer)); return; } } RETVAL_STRINGL(SOLR_SPACE_STRING, sizeof(SOLR_SPACE_STRING)-1, 1); } /* }}} */ /* {{{ proto string SolrParams::toString(void) Returns a string representation of the object */ PHP_METHOD(SolrParams, toString) { solr_params_t *solr_params = NULL; zend_bool url_encode = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &url_encode) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); return; } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Return value requested but output not processed."); return; } /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_params_entry(getThis(), &solr_params TSRMLS_CC) == SUCCESS) { HashTable *params = solr_params->params; solr_string_t tmp_buffer; memset(&tmp_buffer, 0, sizeof(solr_string_t)); SOLR_HASHTABLE_FOR_LOOP(params) { solr_param_t **solr_param_ptr = NULL; solr_param_tostring_func_t tostring_func = NULL; zend_hash_get_current_data_ex(params, (void **) &solr_param_ptr, NULL); switch((*solr_param_ptr)->type) { case SOLR_PARAM_TYPE_NORMAL : { tostring_func = solr_normal_param_value_tostring; } break; case SOLR_PARAM_TYPE_SIMPLE_LIST : { tostring_func = solr_simple_list_param_value_tostring; } break; case SOLR_PARAM_TYPE_ARG_LIST : { tostring_func = solr_arg_list_param_value_tostring; } break; default : { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter type"); } } tostring_func((*solr_param_ptr), &(tmp_buffer), url_encode); solr_string_appendc(&(tmp_buffer), '&'); } if (tmp_buffer.str && tmp_buffer.len) { solr_string_remove_last_char(&(tmp_buffer)); RETVAL_STRINGL((char *) tmp_buffer.str, tmp_buffer.len, 1); solr_string_free(&(tmp_buffer)); return; } } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrParams::serialize(void) Returns a string representation of the object. Used for custom serialization. */ PHP_METHOD(SolrParams, serialize) { xmlChar *serialized = NULL; int size = 0; if (solr_serialize_solr_params_object(&serialized, &size, getThis() TSRMLS_CC) == FAILURE || !serialized || !size) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to serialize object"); RETURN_NULL(); } RETVAL_STRINGL((char *) serialized, size, 1); xmlFree(serialized); } /* }}} */ /* {{{ proto void SolrParams::unserialize(string serialized) Brings the serialized object back to life. */ PHP_METHOD(SolrParams, unserialize) { char *serialized_object = NULL; int serialized_object_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &serialized_object, &serialized_object_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if(serialized_object_len == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_unserialize_solr_params_object(serialized_object, serialized_object_len, getThis() TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error during unserialization"); } } /* }}} */ /* {{{ proto void SolrModifiableParams::__construct(void) Constructor. */ PHP_METHOD(SolrModifiableParams, __construct) { long int params_index = SOLR_UNIQUE_PARAMS_INDEX(); solr_params_t *solr_params_dest = NULL; zend_update_property_long(solr_ce_SolrModifiableParams, getThis(), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, params_index TSRMLS_CC); solr_init_params(&solr_params_dest, params_index TSRMLS_CC); } /* }}} */ /* {{{ proto void SolrModifiableParams::__destruct(void) Destructor. */ PHP_METHOD(SolrModifiableParams, __destruct) { solr_params_t *solr_params = NULL; /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_params_entry(getThis(), &solr_params TSRMLS_CC) == SUCCESS) { zend_hash_index_del(SOLR_GLOBAL(params), solr_params->params_index); return ; } } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/php_solr_query.c000066400000000000000000005114511374041537100222340ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* Outstanding Work/Changes */ /* TODO: Change SolrQuery::getTermsSort() to return integer */ /* TODO: Change SolrQuery::getFacetSort() to return integer */ /** * Note about methods implementation: * * One reason why each SolrQuery has custom code is because each method * could require separate tweaking. * * At this point in time, even though most of the SolrQuery methods share * basic features, I still believe that is a better idea to write separate code * for each method implementation. * * This will make the methods easier to maintain because * * from time to time, Solr modifies the way some of the request parameters are * submitted or processed. * * Hence, it is currently more logical to make each method an independent entity. */ /* {{{ proto SolrQuery::__construct([string q]) Constructor for SolrQuery */ PHP_METHOD(SolrQuery, __construct) { solr_char_t *q = NULL; int query_length = 0; solr_params_t *solr_params_dest = NULL; solr_params_t solr_params; long int params_index = SOLR_UNIQUE_PARAMS_INDEX(); uint nSize = SOLR_INITIAL_HASH_TABLE_SIZE; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, solr_ce_SolrIllegalArgumentException, &error_handling TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &q, &query_length) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } zend_restore_error_handling(&error_handling TSRMLS_CC); zend_update_property_long(solr_ce_SolrQuery, getThis(), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, params_index TSRMLS_CC); memset(&solr_params, 0, sizeof(solr_params_t)); if (zend_hash_index_update(SOLR_GLOBAL(params), params_index, (void *) &solr_params, sizeof(solr_params_t), (void **) &solr_params_dest) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error while registering query parameters in HashTable"); return ; } solr_params_dest->params_index = params_index; solr_params_dest->params_count = 0U; /* Allocated memory for the parameters HashTable using fast cache for HashTables */ ALLOC_HASHTABLE(solr_params_dest->params); zend_hash_init(solr_params_dest->params, nSize, NULL, (dtor_func_t) solr_destroy_param, SOLR_PARAMS_PERSISTENT); if (query_length) { if (solr_set_normal_param(getThis(), (solr_char_t *) "q", sizeof("q")-1, q, query_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while setting query parameter"); return; } } } /* }}} */ /* {{{ proto SolrQuery::__destruct() Destructor for SolrQuery */ PHP_METHOD(SolrQuery, __destruct) { solr_params_t *solr_params = NULL; /* Retrieve the entry for this SolrParams instance */ if (solr_fetch_params_entry(getThis(), &solr_params TSRMLS_CC) == SUCCESS) { zend_hash_index_del(SOLR_GLOBAL(params), solr_params->params_index); return ; } /* This would only happen if user attempted an illegal operation */ php_error_docref(NULL TSRMLS_CC, E_ERROR, SOLR_ERROR_1008_MSG, SOLR_FILE_LINE_FUNC); } /* }}} */ /* {{{ CommonQueryParameters */ /* {{{ proto SolrQuery SolrQuery::setQuery(string q) Sets the q parameter */ PHP_METHOD(SolrQuery, setQuery) { solr_char_t *param_name = (solr_char_t *) "q"; int param_name_length = sizeof("q")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setStart(int start) Sets the start parameter */ PHP_METHOD(SolrQuery, setStart) { solr_char_t *param_name = (solr_char_t *) "start"; int param_name_length = sizeof("start")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setRows(int rows) Sets the rows parameter */ PHP_METHOD(SolrQuery, setRows) { solr_char_t *param_name = (solr_char_t *) "rows"; int param_name_length = sizeof("rows")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addField(string fl) Adds another fl parameter */ PHP_METHOD(SolrQuery, addField) { solr_char_t *param_name = (solr_char_t *) "fl"; int param_name_length = sizeof("fl")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_simple_list_param(getThis(), param_name, param_name_length, param_value, param_value_length TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addSortField(string fl [, int sort_direction]) Adds another sort parameter */ PHP_METHOD(SolrQuery, addSortField) { solr_char_t *param_name = (solr_char_t *) "sort"; int param_name_length = sizeof("sort")-1; solr_char_t *param_value = NULL; int param_value_length = 0; long int sort_direction = 1L; solr_sort_dir_t sort_order = SOLR_SORT_DIR_DESC; solr_char_t *avalue = NULL; int avalue_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", ¶m_value, ¶m_value_length, &sort_direction) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } sort_order = (sort_direction < 0L || sort_direction > 1L) ? SOLR_SORT_DIR_DESC : (solr_sort_dir_t) sort_direction; avalue = (sort_order) ? "desc" : "asc"; avalue_length = solr_strlen(avalue); if (solr_add_arg_list_param(getThis(), param_name, param_name_length, param_value, param_value_length, avalue, avalue_length, ',', ' ' TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addFiterQuery(string fq) Adds another fq parameter */ PHP_METHOD(SolrQuery, addFilterQuery) { solr_char_t *param_name = (solr_char_t *) "fq"; int param_name_length = sizeof("fq")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setShowDebugInfo(bool flag) Sets the debugQuery parameter */ PHP_METHOD(SolrQuery, setShowDebugInfo) { solr_char_t *param_name = (solr_char_t *) "debugQuery"; int param_name_length = sizeof("debugQuery")-1; zend_bool show_debug_info = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &show_debug_info) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!show_debug_info) { solr_delete_solr_parameter(getThis(), param_name, param_name_length TSRMLS_CC); solr_return_solr_params_object(); return; } if (solr_set_normal_param(getThis(), param_name, param_name_length, "true", sizeof("true")-1) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error adding debugging info "); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setExplainOther(string explainOther) Sets the explainOther parameter */ PHP_METHOD(SolrQuery, setExplainOther) { solr_char_t *param_name = (solr_char_t *) "explainOther"; int param_name_length = sizeof("explainOther")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTimeAllowed(int milliseconds) Sets the maximum time in milliseconds allowed for the query */ PHP_METHOD(SolrQuery, setTimeAllowed) { solr_char_t *param_name = (solr_char_t *) "timeAllowed"; int param_name_length = sizeof("timeAllowed")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setOmitHeader(bool flag) Sets the omitHeader parameter */ PHP_METHOD(SolrQuery, setOmitHeader) { solr_char_t *param_name = (solr_char_t *) "omitHeader"; int param_name_length = sizeof("omitHeader")-1; int param_value_length = 0; zend_bool omit_header = 0; solr_char_t *omit_header_str = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &omit_header) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } omit_header_str = (omit_header)? "true" : "false"; param_value_length = solr_strlen(omit_header_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, omit_header_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, omit_header_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* }}} END OF CommonQueryParameters */ /* {{{ CoreQueryParameters */ /* {{{ proto SolrQuery SolrQuery::setEchoHandler(bool flag) Sets the echoHandler parameter */ PHP_METHOD(SolrQuery, setEchoHandler) { solr_char_t *param_name = (solr_char_t *) "echoHandler"; int param_name_length = sizeof("echoHandler")-1; int param_value_length = 0; zend_bool echo_handler = 0; solr_char_t *echo_handler_str = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &echo_handler) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } echo_handler_str = (echo_handler)? "true" : "false"; param_value_length = solr_strlen(echo_handler_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, echo_handler_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, echo_handler_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setEchoParams(string value) Sets the echoParams parameter */ PHP_METHOD(SolrQuery, setEchoParams) { solr_char_t *param_name = (solr_char_t *) "echoParams"; int param_name_length = sizeof("echoParams")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* }}} END OF CoreQueryParameters */ /* {{{ SimpleFacetParameters */ /* {{{ proto SolrQuery SolrQuery::setFacet(bool value) Sets the facet parameter */ PHP_METHOD(SolrQuery, setFacet) { solr_char_t *param_name = (solr_char_t *) "facet"; int param_name_length = sizeof("facet")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_length = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, bool_flag_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addFacetField(string value) Sets the facet.field parameter */ PHP_METHOD(SolrQuery, addFacetField) { solr_char_t *param_name = (solr_char_t *) "facet.field"; int param_name_len = sizeof("facet.field")-1; solr_char_t *param_value = NULL; int param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addFacetQuery(string value) Adds another facet.query parameter */ PHP_METHOD(SolrQuery, addFacetQuery) { solr_char_t *param_name = (solr_char_t *) "facet.query"; int param_name_length = sizeof("facet.query")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetPrefix(string value [, string field_override]) Sets the facet.prefix parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetPrefix) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.prefix"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetSort(int value [, string field_override]) Sets the facet.sort parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetSort) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; long int sort_type = 0L; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|s", &sort_type, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.sort"); param_value = ((sort_type)? "count" : "index"); param_value_len = solr_strlen(param_value); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetLimit(string value [, string field_override]) Sets the facet.limit parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetLimit) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.limit"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetOffset(string value [, string field_override]) Sets the facet.offset parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetOffset) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.offset"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetMinCount(string value [, string field_override]) Sets the facet.mincount parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetMinCount) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.mincount"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetMissing(bool value [, string field_override]) Sets the facet.missing parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetMissing) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; zend_bool bool_flag = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b|s", &bool_flag, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.missing"); param_value = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(param_value); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetMethod(string value [, string field_override]) Sets the facet.method parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetMethod) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.method"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetEnumCacheMinDefaultFrequency(string value [, string field_override]) Sets the facet.enum.cache.minDf parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetEnumCacheMinDefaultFrequency) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.enum.cache.minDf"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ Date facet parameters */ /* {{{ proto SolrQuery SolrQuery::addFacetDateField(string value) Adds another facet.date parameter. */ PHP_METHOD(SolrQuery, addFacetDateField) { solr_char_t *param_name = (solr_char_t *) "facet.date"; int param_name_length = sizeof("facet.date")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetDateStart(string value [, string field_override]) Sets the facet.date.start parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetDateStart) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.date.start"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetDateEnd(string value [, string field_override]) Sets the facet.date.end parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetDateEnd) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.date.end"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetDateGap(string value [, string field_override]) Sets the facet.date.gap parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetDateGap) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.date.gap"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetDateHardEnd(bool value [, string field_override]) Sets the facet.date.hardend parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetDateHardEnd) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; zend_bool bool_flag = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b|s", &bool_flag, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.date.hardend"); param_value = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(param_value); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addFacetDateOther(string value [, string field_override]) Sets the facet.date.other parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, addFacetDateOther) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.date.other"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* }}} End of date facet parameters */ /* }}} End of SimpleFacetParameters */ /* {{{ SimpleGroupParameters */ /* {{{ proto SolrQuery SolrQuery::setGroup(bool value) Enable result grouping (group parameter) */ PHP_METHOD(SolrQuery, setGroup) { solr_char_t *param_name = (solr_char_t *) "group"; int param_name_length = sizeof("group")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_length = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, bool_flag_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto bool SolrQuery::getGroup() Returns true if grouping is enabled */ PHP_METHOD(SolrQuery, getGroup) { solr_char_t *param_name = (solr_char_t *) "group"; int param_name_length = sizeof("group")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addGroupField(string value) Adds a group.field parameter */ PHP_METHOD(SolrQuery, addGroupField) { solr_char_t *param_name = (solr_char_t *) "group.field"; int param_name_len = sizeof("group.field")-1; solr_char_t *param_value = NULL; int param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto string SolrQuery::getGroupFields() Returns all the group fields (group.field parameter values) */ PHP_METHOD(SolrQuery, getGroupFields) { solr_char_t *param_name = (solr_char_t *) "group.field"; int param_name_length = sizeof("group.field")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addGroupFunction(string value) Adds a group function (group.func parameter) */ PHP_METHOD(SolrQuery, addGroupFunction) { solr_char_t *param_name = (solr_char_t *) "group.func"; int param_name_len = sizeof("group.func")-1; solr_char_t *param_value = NULL; int param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto string SolrQuery::getGroupFunctions() Returns all the group functions (group.func parameters) */ PHP_METHOD(SolrQuery, getGroupFunctions) { solr_char_t *param_name = (solr_char_t *) "group.func"; int param_name_length = sizeof("group.func")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addGroupQuery(string value) Sets the group.query parameter */ PHP_METHOD(SolrQuery, addGroupQuery) { solr_char_t *param_name = (solr_char_t *) "group.query"; int param_name_len = sizeof("group.query")-1; solr_char_t *param_value = NULL; int param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto string SolrQuery::getGroupQueries() Returns all the group.query parameter values */ PHP_METHOD(SolrQuery, getGroupQueries) { solr_char_t *param_name = (solr_char_t *) "group.query"; int param_name_length = sizeof("group.query")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupLimit(string value) Sets the group.limit parameter. */ PHP_METHOD(SolrQuery, setGroupLimit) { solr_char_t *param_name = (solr_char_t *) "group.limit"; int param_name_len = sizeof("group.limit")-1; solr_char_t *param_value = NULL; int param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto int SolrQuery::getGroupLimit() Returns the group.limit value */ PHP_METHOD(SolrQuery, getGroupLimit) { solr_char_t *param_name = (solr_char_t *) "group.limit"; int param_name_length = sizeof("group.limit")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupOffset(int offset) Sets the group.offset parameter. */ PHP_METHOD(SolrQuery, setGroupOffset) { solr_char_t *param_name = (solr_char_t *) "group.offset"; int param_name_len = sizeof("group.offset")-1; solr_char_t *param_value = NULL; int param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto int SolrQuery::getGroupOffset() Returns the group.offset value */ PHP_METHOD(SolrQuery, getGroupOffset) { solr_char_t *param_name = (solr_char_t *) "group.offset"; int param_name_length = sizeof("group.offset")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addGroupSortField(string sort[, integer direction]) Add a group sort field (group.sort parameter). */ PHP_METHOD(SolrQuery, addGroupSortField) { solr_char_t *param_name = (solr_char_t *) "group.sort"; int param_name_length = sizeof("group.sort")-1; solr_char_t *param_value = NULL; int param_value_length = 0; long int sort_direction = 1L; solr_sort_dir_t sort_order = SOLR_SORT_DIR_DESC; solr_char_t *avalue = NULL; int avalue_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", ¶m_value, ¶m_value_length, &sort_direction) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } sort_order = (sort_direction < 0L || sort_direction > 1L) ? SOLR_SORT_DIR_DESC : (solr_sort_dir_t) sort_direction; avalue = (sort_order) ? "desc" : "asc"; avalue_length = solr_strlen(avalue); if (solr_add_arg_list_param(getThis(), param_name, param_name_length, param_value, param_value_length, avalue, avalue_length, ',', ' ' TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto array SolrQuery::getGroupSortFields() Returns the group.sort value */ PHP_METHOD(SolrQuery, getGroupSortFields) { solr_char_t *param_name = (solr_char_t *) "group.sort"; int param_name_length = sizeof("group.sort")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_arg_list_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupFormat(string value) Sets the group.format parameter. */ PHP_METHOD(SolrQuery, setGroupFormat) { solr_char_t *param_name = (solr_char_t *) "group.format"; int param_name_len = sizeof("group.format")-1; solr_char_t *param_value = NULL; int param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto string SolrQuery::getGroupFormat() Returns the group.format value */ PHP_METHOD(SolrQuery, getGroupFormat) { solr_char_t *param_name = (solr_char_t *) "group.format"; int param_name_length = sizeof("group.format")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupMain(bool value) Sets the group.main parameter */ PHP_METHOD(SolrQuery, setGroupMain) { solr_char_t *param_name = (solr_char_t *) "group.main"; int param_name_length = sizeof("group.main")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_length = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, bool_flag_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto bool SolrQuery::getGroupMain() Returns the group.main value */ PHP_METHOD(SolrQuery, getGroupMain) { solr_char_t *param_name = (solr_char_t *) "group.main"; int param_name_length = sizeof("group.main")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupNGroups(bool value) Sets the group.ngroups parameter */ PHP_METHOD(SolrQuery, setGroupNGroups) { solr_char_t *param_name = (solr_char_t *) "group.ngroups"; int param_name_length = sizeof("group.ngroups")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_length = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, bool_flag_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto bool SolrQuery::getGroupNGroups() Returns the group.ngroups value */ PHP_METHOD(SolrQuery, getGroupNGroups) { solr_char_t *param_name = (solr_char_t *) "group.ngroups"; int param_name_length = sizeof("group.ngroups")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupTruncate(bool value) Sets the group.truncate parameter */ PHP_METHOD(SolrQuery, setGroupTruncate) { solr_char_t *param_name = (solr_char_t *) "group.truncate"; int param_name_length = sizeof("group.truncate")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_length = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, bool_flag_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto bool SolrQuery::getGroupTruncate() Returns the group.truncate value */ PHP_METHOD(SolrQuery, getGroupTruncate) { solr_char_t *param_name = (solr_char_t *) "group.truncate"; int param_name_length = sizeof("group.truncate")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupFacet(bool value) Sets the group.facet parameter */ PHP_METHOD(SolrQuery, setGroupFacet) { solr_char_t *param_name = (solr_char_t *) "group.facet"; int param_name_length = sizeof("group.facet")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_length = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, bool_flag_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto bool SolrQuery::getGroupFacet() Returns the group.facet value */ PHP_METHOD(SolrQuery, getGroupFacet) { solr_char_t *param_name = (solr_char_t *) "group.facet"; int param_name_length = sizeof("group.facet")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupCachePercent(int value) sets the group cache percent group.cache.percent value */ PHP_METHOD(SolrQuery, setGroupCachePercent) { solr_char_t *param_name = (solr_char_t *) "group.cache.percent"; int param_name_length = sizeof ("group.cache.percent")-1; long cache_pct = 0; solr_char_t pval[4]; int pval_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &cache_pct)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } if (cache_pct < 0 || cache_pct > 100) { solr_throw_exception(solr_ce_SolrIllegalArgumentException, "Group cache percent must be between 0 and 100", SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC); RETURN_NULL(); } snprintf (pval, sizeof(pval), "%ld", cache_pct); pval_len = strlen(pval); if (solr_add_or_set_normal_param(getThis(), param_name, param_name_length, pval, pval_len, 0 TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, pval); efree(pval); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto int SolrQuery::getGroupCachePercent() Gets the group cache percent group.cache.percent value */ PHP_METHOD(SolrQuery, getGroupCachePercent) { solr_char_t *param_name = (solr_char_t *) "group.cache.percent"; int param_name_length = sizeof("group.cache.percent")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* }}} End of SimpleGroupParameters */ /* {{{ proto SolrQuery SolrQuery::collapse(SolrCollapseFunction collapseFunction) Collapse a Solr Query */ PHP_METHOD(SolrQuery, collapse) { solr_char_t *param_name = (solr_char_t *) "fq"; int param_name_len = sizeof("fq")-1; zval *collapse_func_obj; solr_function_t *collapse_func; solr_string_t *buffer = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &collapse_func_obj) == FAILURE) { RETURN_NULL(); } if(solr_fetch_function_entry(collapse_func_obj, &collapse_func TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Internal Error Unable to fetch function from functions global"); RETURN_NULL(); } /* validate */ if (!zend_hash_exists(collapse_func->params, "field", sizeof("field"))) { solr_throw_exception_ex(solr_ce_SolrMissingMandatoryParameterException,SOLR_ERROR_4100 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_4100_MSG, "field"); } buffer = (solr_string_t *)pemalloc(sizeof(solr_string_t), SOLR_STRING_PERSISTENT); memset(buffer, 0, sizeof(solr_string_t)); solr_solrfunc_to_string(collapse_func, &buffer); if (solr_add_or_set_normal_param(getThis(), param_name, param_name_len, buffer->str, buffer->len, 1 TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, buffer->str); } solr_string_free(buffer); pefree(buffer, SOLR_STRING_PERSISTENT); solr_return_solr_params_object(); } /* }}} */ /* {{{ Expand Parameters */ /* {{{ proto SolrQuery SolrQuery::setExpand(bool value) Sets the expand parameter. This enables or disables group expanding. */ PHP_METHOD(SolrQuery, setExpand) { solr_char_t *param_name = (solr_char_t *) "expand"; int param_name_length = sizeof("expand")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_length = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, bool_flag_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto bool SolrQuery::getExpand() Returns true if group expanding is enabled */ PHP_METHOD(SolrQuery, getExpand) { solr_char_t *param_name = (solr_char_t *) "expand"; int param_name_length = sizeof("expand")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addExpandSortField(string sort[, integer direction]) Orders the documents within the expanded groups (expand.sort parameter). */ PHP_METHOD(SolrQuery, addExpandSortField) { solr_char_t *param_name = (solr_char_t *) "expand.sort"; int param_name_length = sizeof("expand.sort")-1; solr_char_t *param_value = NULL; int param_value_length = 0; long int sort_direction = 1L; solr_sort_dir_t sort_order = SOLR_SORT_DIR_DESC; solr_char_t *avalue = NULL; int avalue_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", ¶m_value, ¶m_value_length, &sort_direction) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } sort_order = (sort_direction < 0L || sort_direction > 1L) ? SOLR_SORT_DIR_DESC : (solr_sort_dir_t) sort_direction; avalue = (sort_order) ? "desc" : "asc"; avalue_length = solr_strlen(avalue); if (solr_add_arg_list_param(getThis(), param_name, param_name_length, param_value, param_value_length, avalue, avalue_length, ',', ' ' TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeExpandSortField(string field) Removes an expand sort field from the expand.sort parameter. */ PHP_METHOD(SolrQuery, removeExpandSortField) { solr_char_t *pname = (solr_char_t *) "expand.sort"; int pname_length = sizeof("expand.sort")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value(getThis(), pname, pname_length, param_value, param_value_length TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto string SolrQuery::getExpandSortFields() returns an array of fields */ PHP_METHOD(SolrQuery, getExpandSortFields) { solr_char_t *param_name = (solr_char_t *) "expand.sort"; int param_name_length = sizeof("expand.sort")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setExpandRows(int rows) Sets the number of rows to display in each group (expand.rows). Server Default 5 */ PHP_METHOD(SolrQuery, setExpandRows) { solr_char_t *param_name = (solr_char_t *) "expand.rows"; int param_name_length = sizeof("expand.rows")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto int SolrQuery::getExpandRows() Returns The number of rows to display in each group (expand.rows) */ PHP_METHOD(SolrQuery, getExpandRows) { solr_char_t *param_name = (solr_char_t *) "expand.rows"; int param_name_length = sizeof("expand.rows")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setExpandQuery(string q) Sets the expand.q parameter. Overrides the main q parameter, determines which documents to include in the main group. */ PHP_METHOD(SolrQuery, setExpandQuery) { solr_char_t *param_name = (solr_char_t *) "expand.q"; int param_name_length = sizeof("expand.q")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto string SolrQuery::getExpandQuery() Returns the expand query expand.q parameter */ PHP_METHOD(SolrQuery, getExpandQuery) { solr_char_t *param_name = (solr_char_t *) "expand.q"; int param_name_length = sizeof("expand.q")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addExpandFilterQuery(string fq) Overrides main fq's, determines which documents to include in the main group. */ PHP_METHOD(SolrQuery, addExpandFilterQuery) { solr_char_t *param_name = (solr_char_t *) "expand.fq"; int param_name_length = sizeof("expand.fq")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeExpandFilterQuery(string fq) Removes an expand filter query. */ PHP_METHOD(SolrQuery, removeExpandFilterQuery) { solr_char_t *pname = (solr_char_t *) "expand.fq"; int pname_length = sizeof("expand.fq")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_length TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto array SolrQuery::getExpandFilterQueries() Returns the expand filter queries */ PHP_METHOD(SolrQuery, getExpandFilterQueries) { solr_char_t *param_name = (solr_char_t *) "expand.fq"; int param_name_length = sizeof("expand.fq")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* }}} */ /* {{{ HighlightingParameters */ /* {{{ proto SolrQuery SolrQuery::setHighlight(bool value) Sets the hl parameter. This enables or disables highlighting. */ PHP_METHOD(SolrQuery, setHighlight) { solr_char_t *param_name = (solr_char_t *) "hl"; int param_name_length = sizeof("hl")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_length = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, bool_flag_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addHighlightField(string value) Adds another hl.fl parameter. */ PHP_METHOD(SolrQuery, addHighlightField) { solr_char_t *list_param_name = (solr_char_t *) "hl.fl"; int list_param_name_len = sizeof("hl.fl")-1; solr_char_t *list_param_value = NULL; int list_param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &list_param_value, &list_param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_simple_list_param(getThis(), list_param_name, list_param_name_len, list_param_value, list_param_value_len TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add param value %s to %s list ", list_param_value, list_param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightSnippets(string value [, string field_override]) Sets the hl.snippets parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightSnippets) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.snippets"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightFragsize(string value [, string field_override]) Sets the hl.fragsize parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightFragsize) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.fragsize"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightMergeContiguous(bool flag [, string field_override]) Sets the hl.mergeContiguous parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightMergeContiguous) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; zend_bool bool_flag = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b|s", &bool_flag, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.mergeContiguous"); param_value = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(param_value); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightRequireFieldMatch(bool flag) Sets the hl.requireFieldMatch. */ PHP_METHOD(SolrQuery, setHighlightRequireFieldMatch) { solr_char_t *param_name = (solr_char_t *) "hl.requireFieldMatch"; int param_name_length = sizeof("hl.requireFieldMatch")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_length = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, bool_flag_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightMaxAnalyzedChars(string value) Sets the hl.maxAnalyzedChars parameter */ PHP_METHOD(SolrQuery, setHighlightMaxAnalyzedChars) { solr_char_t *param_name = (solr_char_t *) "hl.maxAnalyzedChars"; int param_name_length = sizeof("hl.maxAnalyzedChars")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightAlternateField(string value [, string field_override]) Sets the hl.alternateField parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightAlternateField) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.alternateField"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightMaxAlternateFieldLength(string value [, string field_override]) Sets the hl.maxAlternateFieldLength parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightMaxAlternateFieldLength) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.maxAlternateFieldLength"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightFormatter(string value [, string field_override]) Sets the hl.formatter parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightFormatter) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = "simple"; int param_value_len = sizeof("simple")-1; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.formatter"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightSimplePre(string value [, string field_override]) Sets the hl.simple.pre parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightSimplePre) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = ""; int param_value_len = sizeof("")-1; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.simple.pre"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightSimplePost(string value [, string field_override]) Sets the hl.simple.post parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightSimplePost) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = ""; int param_value_len = sizeof("")-1; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.simple.post"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightFragmenter(string value [, string field_override]) Sets the hl.fragmenter parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightFragmenter) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.fragmenter"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightUsePhraseHighlighter(bool flag) Sets the hl.usePhraseHighlighter parameter. */ PHP_METHOD(SolrQuery, setHighlightUsePhraseHighlighter) { solr_char_t *param_name = (solr_char_t *) "hl.usePhraseHighlighter"; int param_name_length = sizeof("hl.usePhraseHighlighter")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_length = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, bool_flag_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightHighlightMultiTerm(bool flag) Sets the hl.highlightMultiTerm parameter. */ PHP_METHOD(SolrQuery, setHighlightHighlightMultiTerm) { solr_char_t *param_name = (solr_char_t *) "hl.highlightMultiTerm"; int param_name_length = sizeof("hl.highlightMultiTerm")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_length = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, bool_flag_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightRegexSlop(string value) Sets the hl.regex.slop parameter. */ PHP_METHOD(SolrQuery, setHighlightRegexSlop) { solr_char_t *param_name = (solr_char_t *) "hl.regex.slop"; int param_name_length = sizeof("hl.regex.slop")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightRegexPattern(string value) Sets the hl.regex.pattern parameter. */ PHP_METHOD(SolrQuery, setHighlightRegexPattern) { solr_char_t *param_name = (solr_char_t *) "hl.regex.pattern"; int param_name_length = sizeof("hl.regex.pattern")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightRegexMaxAnalyzedChars(string value) Sets the hl.regex.maxAnalyzedChars parameter. */ PHP_METHOD(SolrQuery, setHighlightRegexMaxAnalyzedChars) { solr_char_t *param_name = (solr_char_t *) "hl.regex.maxAnalyzedChars"; int param_name_length = sizeof("hl.regex.maxAnalyzedChars")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* }}} End of HighlightingParameters */ /* {{{ StatsComponent */ /* {{{ proto SolrQuery SolrQuery::setStats(bool flag) Sets the stats parameter. Enables or disables stats */ PHP_METHOD(SolrQuery, setStats) { solr_char_t *param_name = (solr_char_t *) "stats"; int param_name_length = sizeof("stats")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_length = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, bool_flag_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addStatsField(string value) Adds another stats.field parameter. */ PHP_METHOD(SolrQuery, addStatsField) { solr_char_t *param_name = (solr_char_t *) "stats.field"; int param_name_length = sizeof("stats.field")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error adding parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addStatsFacet(string value) Adds another stats.facet parameter. */ PHP_METHOD(SolrQuery, addStatsFacet) { solr_char_t *param_name = (solr_char_t *) "stats.facet"; int param_name_length = sizeof("stats.facet")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error adding parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* }}} End of StatsComponent */ /* {{{ MoreLikeThis */ /* {{{ proto SolrQuery SolrQuery::setMlt(bool flag) Sets the mlt parameter. Enables or disables the moreLikeThis component */ PHP_METHOD(SolrQuery, setMlt) { solr_char_t *param_name = (solr_char_t *) "mlt"; int param_name_length = sizeof("mlt")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_length = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, bool_flag_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltCount(string value) Sets the mlt.count parameter. */ PHP_METHOD(SolrQuery, setMltCount) { solr_char_t *param_name = (solr_char_t *) "mlt.count"; int param_name_length = sizeof("mlt.count")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addMltField(string field) Adds another field name to the mlt.fl parameter. */ PHP_METHOD(SolrQuery, addMltField) { solr_char_t *list_param_name = (solr_char_t *) "mlt.fl"; int list_param_name_len = sizeof("mlt.fl")-1; solr_char_t *list_param_value = NULL; int list_param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &list_param_value, &list_param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_simple_list_param(getThis(), list_param_name, list_param_name_len, list_param_value, list_param_value_len TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add param value %s to %s list ", list_param_value, list_param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addMltQueryField(string value, string boost) Adds another query field and boost value to the mlt.qf parameter. */ PHP_METHOD(SolrQuery, addMltQueryField) { solr_char_t *param_name = (solr_char_t *) "mlt.qf"; int param_name_length = sizeof("mlt.qf")-1; solr_char_t *query_field = NULL; int query_field_length = 0; solr_char_t *boost_value = "1.0"; int boost_value_length = sizeof("1.0"); /* TODO: make boost optional parameter. */ /* If boost is not sent, then the index time boost is used */ /* This will involve re-doing all the arg_list functions to allow optional args. */ /* Temporary solution is to use SolrQuery::add("mlt.qf", "value"). This should be documented. */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &query_field, &query_field_length, &boost_value, &boost_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_arg_list_param(getThis(), param_name, param_name_length, query_field, query_field_length, boost_value, boost_value_length, ' ', '^' TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltMinTermFrequency(string value) Sets the mlt.mintf parameter. */ PHP_METHOD(SolrQuery, setMltMinTermFrequency) { solr_char_t *param_name = (solr_char_t *) "mlt.mintf"; int param_name_length = sizeof("mlt.mintf")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltMinDocFrequency(string value) Sets the mlt.mindf parameter. */ PHP_METHOD(SolrQuery, setMltMinDocFrequency) { solr_char_t *param_name = (solr_char_t *) "mlt.mindf"; int param_name_length = sizeof("mlt.mindf")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltMinWordLength(string value) Sets the mlt.minwl parameter. */ PHP_METHOD(SolrQuery, setMltMinWordLength) { solr_char_t *param_name = (solr_char_t *) "mlt.minwl"; int param_name_length = sizeof("mlt.minwl")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltMaxWordLength(string value) Sets the mlt.maxwl parameter. */ PHP_METHOD(SolrQuery, setMltMaxWordLength) { solr_char_t *param_name = (solr_char_t *) "mlt.maxwl"; int param_name_length = sizeof("mlt.maxwl")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltMaxNumTokens(string value) Sets the mlt.maxntp parameter. */ PHP_METHOD(SolrQuery, setMltMaxNumTokens) { solr_char_t *param_name = (solr_char_t *) "mlt.maxntp"; int param_name_length = sizeof("mlt.maxntp")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltMaxNumQueryTerms(string value) Sets the mlt.maxqt parameter. */ PHP_METHOD(SolrQuery, setMltMaxNumQueryTerms) { solr_char_t *param_name = (solr_char_t *) "mlt.maxqt"; int param_name_length = sizeof("mlt.maxqt")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltBoost(bool flag) Sets the mlt.boost parameter. */ PHP_METHOD(SolrQuery, setMltBoost) { solr_char_t *param_name = (solr_char_t *) "mlt.boost"; int param_name_length = sizeof("mlt.boost")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_length = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, bool_flag_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* }}} End of MoreLikeThis */ /* {{{ TermsComponent */ /* {{{ proto SolrQuery SolrQuery::setTerms(bool flag) Sets the terms parameter. This flag enables or disables the TermsComponent */ PHP_METHOD(SolrQuery, setTerms) { solr_char_t *param_name = (solr_char_t *) "terms"; int param_name_length = sizeof("terms")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_length = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, bool_flag_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsField(string field) Sets the terms.fl parameter. */ PHP_METHOD(SolrQuery, setTermsField) { solr_char_t *param_name = (solr_char_t *) "terms.fl"; int param_name_length = sizeof("terms.fl")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsLowerBound(string value) Sets the terms.lower parameter. */ PHP_METHOD(SolrQuery, setTermsLowerBound) { solr_char_t *param_name = (solr_char_t *) "terms.lower"; int param_name_length = sizeof("terms.lower")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsUpperBound(string value) Sets the terms.upper parameter. */ PHP_METHOD(SolrQuery, setTermsUpperBound) { solr_char_t *param_name = (solr_char_t *) "terms.upper"; int param_name_length = sizeof("terms.upper")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsIncludeLowerBound(string value) Sets the terms.lower.incl parameter. */ PHP_METHOD(SolrQuery, setTermsIncludeLowerBound) { solr_char_t *param_name = (solr_char_t *) "terms.lower.incl"; int param_name_length = sizeof("terms.lower.incl")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_length = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, bool_flag_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsIncludeUpperBound(string value) Sets the terms.upper.incl parameter. */ PHP_METHOD(SolrQuery, setTermsIncludeUpperBound) { solr_char_t *param_name = (solr_char_t *) "terms.upper.incl"; int param_name_length = sizeof("terms.upper.incl")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_length = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, bool_flag_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsMinCount(string value) Sets the terms.mincount parameter. */ PHP_METHOD(SolrQuery, setTermsMinCount) { solr_char_t *param_name = (solr_char_t *) "terms.mincount"; int param_name_length = sizeof("terms.mincount")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsMaxCount(string value) Sets the terms.maxcount parameter. */ PHP_METHOD(SolrQuery, setTermsMaxCount) { solr_char_t *param_name = (solr_char_t *) "terms.maxcount"; int param_name_length = sizeof("terms.maxcount")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsPrefix(string value) Sets the terms.prefix parameter. */ PHP_METHOD(SolrQuery, setTermsPrefix) { solr_char_t *param_name = (solr_char_t *) "terms.prefix"; int param_name_length = sizeof("terms.prefix")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsLimit(string value) Sets the terms.limit parameter. */ PHP_METHOD(SolrQuery, setTermsLimit) { solr_char_t *param_name = (solr_char_t *) "terms.limit"; int param_name_length = sizeof("terms.limit")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsReturnRaw(bool flag) Sets the terms.raw parameter. */ PHP_METHOD(SolrQuery, setTermsReturnRaw) { solr_char_t *param_name = (solr_char_t *) "terms.raw"; int param_name_length = sizeof("terms.raw")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_length = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, bool_flag_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsSort(int sort) Sets the terms.sort parameter. */ PHP_METHOD(SolrQuery, setTermsSort) { solr_char_t *param_name = (solr_char_t *) "terms.sort"; int param_name_length = sizeof("terms.sort")-1; long int sort_type = 0L; solr_char_t *sort_type_str = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &sort_type) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } sort_type_str = ((sort_type)? "count" : "index"); param_value_length = solr_strlen(sort_type_str); if (solr_set_normal_param(getThis(), param_name, param_name_length, sort_type_str, param_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, sort_type_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* }}} End of TermsComponent */ /* {{{ Value removal methods */ /* {{{ proto SolrQuery SolrQuery::removeField(string fl) Removes a field from the fl parameter */ PHP_METHOD(SolrQuery, removeField) { solr_char_t *pname = (solr_char_t *) "fl"; int pname_length = sizeof("fl")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_simple_list_param_value(getThis(), pname, pname_length, param_value, param_value_length TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeSortField(string fl) Removes a sort field from the sort parameter. */ PHP_METHOD(SolrQuery, removeSortField) { solr_char_t *pname = (solr_char_t *) "sort"; int pname_length = sizeof("sort")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value(getThis(), pname, pname_length, param_value, param_value_length TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeFilterQuery(string fq) Removes one of the fq parameter. */ PHP_METHOD(SolrQuery, removeFilterQuery) { solr_char_t *pname = (solr_char_t *) "fq"; int pname_length = sizeof("fq")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_length TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeFacetField(string field) Removes one of fields from the facet.field parameter. */ PHP_METHOD(SolrQuery, removeFacetField) { solr_char_t *pname = (solr_char_t *) "facet.field"; int pname_length = sizeof("facet.field")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_length TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeFacetQuery(string facet_query) Removes one of the facet.query parameters. */ PHP_METHOD(SolrQuery, removeFacetQuery) { solr_char_t *pname = (solr_char_t *) "facet.query"; int pname_length = sizeof("facet.query")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_length TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeFacetDateField(string date_field) Removes one of the facet.date parameters. */ PHP_METHOD(SolrQuery, removeFacetDateField) { solr_char_t *pname = (solr_char_t *) "facet.date"; int pname_length = sizeof("facet.date")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_length TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeFacetDateOther(string value [, string field_override]) Removes one of the facet.date.other parameters. Also accepts an optional field override. */ PHP_METHOD(SolrQuery, removeFacetDateOther) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; int param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; int field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.date.other"); solr_delete_normal_param_value(getThis(), fbuf.str, fbuf.len, param_value, param_value_len TSRMLS_CC); solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeHighlightField(string field) Removes one of the fields from the hl.fl parameter. */ PHP_METHOD(SolrQuery, removeHighlightField) { solr_char_t *pname = (solr_char_t *) "hl.fl"; int pname_length = sizeof("hl.fl")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_simple_list_param_value(getThis(), pname, pname_length, param_value, param_value_length TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeStatsField(string field) Removes one of the stats.field parameters. */ PHP_METHOD(SolrQuery, removeStatsField) { solr_char_t *pname = (solr_char_t *) "stats.field"; int pname_length = sizeof("stats.field")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_length TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeStatsFacet(string value) Removes one of the stats.facet parameters. */ PHP_METHOD(SolrQuery, removeStatsFacet) { solr_char_t *pname = (solr_char_t *) "stats.facet"; int pname_length = sizeof("stats.facet")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_length TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeMltField(string field) Removes one of the fields from the mlt.fl parameter. */ PHP_METHOD(SolrQuery, removeMltField) { solr_char_t *pname = (solr_char_t *) "mlt.fl"; int pname_length = sizeof("mlt.fl")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_simple_list_param_value(getThis(), pname, pname_length, param_value, param_value_length TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeMltQueryField(string field) Removes one of the values from the mlt.qf parameter. */ PHP_METHOD(SolrQuery, removeMltQueryField) { solr_char_t *pname = (solr_char_t *) "mlt.qf"; int pname_length = sizeof("mlt.qf")-1; solr_char_t *param_value = NULL; int param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value(getThis(), pname, pname_length, param_value, param_value_length TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* }}} End of Value removal methods */ /* {{{ Begin getter methods */ /* {{{ proto string SolrQuery::getQuery() Returns the query */ PHP_METHOD(SolrQuery, getQuery) { solr_char_t *param_name = (solr_char_t *) "q"; int param_name_length = sizeof("q")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getStart() Returns the start parameter */ PHP_METHOD(SolrQuery, getStart) { solr_char_t *param_name = (solr_char_t *) "start"; int param_name_length = sizeof("start")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getRows() Returns the rows parameter */ PHP_METHOD(SolrQuery, getRows) { solr_char_t *param_name = (solr_char_t *) "rows"; int param_name_length = sizeof("rows")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto array SolrQuery::getFields() Returns the fields */ PHP_METHOD(SolrQuery, getFields) { solr_char_t *param_name = (solr_char_t *) "fl"; int param_name_length = sizeof("fl")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_simple_list_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto array SolrQuery::getSortFields() Returns all the sort fields */ PHP_METHOD(SolrQuery, getSortFields) { solr_char_t *param_name = (solr_char_t *) "sort"; int param_name_length = sizeof("sort")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_arg_list_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getFilterQueries() Returns all the filter queries */ PHP_METHOD(SolrQuery, getFilterQueries) { solr_char_t *param_name = (solr_char_t *) "fq"; int param_name_length = sizeof("fq")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getTimeAllowed() Returns the maximum time in milliseconds allowed for the search query */ PHP_METHOD(SolrQuery, getTimeAllowed) { solr_char_t *param_name = (solr_char_t *) "timeAllowed"; int param_name_length = sizeof("timeAllowed")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getFacet() Returns true is faceting is enabled */ PHP_METHOD(SolrQuery, getFacet) { solr_char_t *param_name = (solr_char_t *) "facet"; int param_name_length = sizeof("facet")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getFacetFields() Returns all the facet fields */ PHP_METHOD(SolrQuery, getFacetFields) { solr_char_t *param_name = (solr_char_t *) "facet.field"; int param_name_length = sizeof("facet.field")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getFacetQueries() Returns all the facet queries */ PHP_METHOD(SolrQuery, getFacetQueries) { solr_char_t *param_name = (solr_char_t *) "facet.query"; int param_name_length = sizeof("facet.query")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getFacetPrefix([string field_override]) Returns the prefix for the facet */ PHP_METHOD(SolrQuery, getFacetPrefix) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.prefix"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto int SolrQuery::getFacetSort([string field_override]) Returns the facet sort state (for the field, if it was overridden) */ PHP_METHOD(SolrQuery, getFacetSort) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.sort"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_sort_type(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto int SolrQuery::getFacetLimit([string field_override]) Returns the maximum number of items for the facet */ PHP_METHOD(SolrQuery, getFacetLimit) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.limit"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_integer(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto int SolrQuery::getFacetOffset([string field_override]) Returns the offset into the list of constraints */ PHP_METHOD(SolrQuery, getFacetOffset) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.offset"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_integer(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto int SolrQuery::getFacetMinCount([string field_override]) Returns the minimum count for the facet */ PHP_METHOD(SolrQuery, getFacetMinCount) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.mincount"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_integer(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto bool SolrQuery::getFacetMissing([string field_override]) Returns the facet.missing parameter */ PHP_METHOD(SolrQuery, getFacetMissing) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.missing"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_boolean(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getFacetMethod([string field_override]) Returns the facet.method parameter */ PHP_METHOD(SolrQuery, getFacetMethod) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.method"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto array SolrQuery::getFacetDateFields() Returns all the facet.date fields */ PHP_METHOD(SolrQuery, getFacetDateFields) { solr_char_t *param_name = (solr_char_t *) "facet.date"; int param_name_length = sizeof("facet.date")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getFacetDateStart([string field_override]) Returns the facet.date.start parameter */ PHP_METHOD(SolrQuery, getFacetDateStart) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.date.start"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getFacetDateEnd([string field_override]) Returns the facet.date.end parameter */ PHP_METHOD(SolrQuery, getFacetDateEnd) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.date.end"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getFacetDateGap([string field_override]) Returns the facet.date.gap */ PHP_METHOD(SolrQuery, getFacetDateGap) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.date.gap"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto bool SolrQuery::getFacetDateHardEnd([string field_override]) Returns the facet.date.hardend parameter */ PHP_METHOD(SolrQuery, getFacetDateHardEnd) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.date.hardend"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_boolean(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getFacetDateOther([string field_override]) Returns the facet.date.other parameter */ PHP_METHOD(SolrQuery, getFacetDateOther) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.date.other"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { array_init(return_value); solr_normal_param_value_display(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto bool SolrQuery::getHighlight() Returns the state of the hl parameter */ PHP_METHOD(SolrQuery, getHighlight) { solr_char_t *param_name = (solr_char_t *) "hl"; int param_name_length = sizeof("hl")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto array SolrQuery::getHighlightFields() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightFields) { solr_char_t *param_name = (solr_char_t *) "hl.fl"; int param_name_length = sizeof("hl.fl")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_simple_list_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getHighlightSnippets([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightSnippets) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.snippets"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_integer(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto int SolrQuery::getHighlightFragsize([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightFragsize) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.fragsize"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_integer(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto bool SolrQuery::getHighlightMergeContiguous([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightMergeContiguous) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.mergeContiguous"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_boolean(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto bool SolrQuery::getHighlightRequireFieldMatch() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightRequireFieldMatch) { solr_char_t *param_name = (solr_char_t *) "hl.requireFieldMatch"; int param_name_length = sizeof("hl.requireFieldMatch")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getHighlightMaxAnalyzedChars() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightMaxAnalyzedChars) { solr_char_t *param_name = (solr_char_t *) "hl.maxAnalyzedChars"; int param_name_length = sizeof("hl.maxAnalyzedChars")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getHighlightAlternateField([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightAlternateField) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.alternateField"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto int SolrQuery::getHighlightMaxAlternateFieldLength([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightMaxAlternateFieldLength) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.maxAlternateFieldLength"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_integer(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getHighlightFormatter([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightFormatter) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.formatter"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getHighlightSimplePre([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightSimplePre) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.simple.pre"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getHighlightSimplePost([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightSimplePost) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.simple.post"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getHighlightFragmenter([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightFragmenter) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; int field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.fragmenter"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto bool SolrQuery::getHighlightUsePhraseHighlighter() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightUsePhraseHighlighter) { solr_char_t *param_name = (solr_char_t *) "hl.usePhraseHighlighter"; int param_name_length = sizeof("hl.usePhraseHighlighter")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getHighlightHighlightMultiTerm() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightHighlightMultiTerm) { solr_char_t *param_name = (solr_char_t *) "hl.highlightMultiTerm"; int param_name_length = sizeof("hl.highlightMultiTerm")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto float SolrQuery::getHighlightRegexSlop() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightRegexSlop) { solr_char_t *param_name = (solr_char_t *) "hl.regex.slop"; int param_name_length = sizeof("hl.regex.slop")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_double(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getHighlightRegexPattern() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightRegexPattern) { solr_char_t *param_name = (solr_char_t *) "hl.regex.pattern"; int param_name_length = sizeof("hl.regex.pattern")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getHighlightRegexMaxAnalyzedChars() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightRegexMaxAnalyzedChars) { solr_char_t *param_name = (solr_char_t *) "hl.regex.maxAnalyzedChars"; int param_name_length = sizeof("hl.regex.maxAnalyzedChars")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getStats() Returns the status of the stats parameter */ PHP_METHOD(SolrQuery, getStats) { solr_char_t *param_name = (solr_char_t *) "stats"; int param_name_length = sizeof("stats")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto array SolrQuery::getStatsFields() Returns the stats.field parameters */ PHP_METHOD(SolrQuery, getStatsFields) { solr_char_t *param_name = (solr_char_t *) "stats.field"; int param_name_length = sizeof("stats.field")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getStatsFacets() Returns all the stats facets */ PHP_METHOD(SolrQuery, getStatsFacets) { solr_char_t *param_name = (solr_char_t *) "stats.facet"; int param_name_length = sizeof("stats.facet")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getMlt() Returns the parameter */ PHP_METHOD(SolrQuery, getMlt) { solr_char_t *param_name = (solr_char_t *) "mlt"; int param_name_length = sizeof("mlt")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltCount() Returns the parameter */ PHP_METHOD(SolrQuery, getMltCount) { solr_char_t *param_name = (solr_char_t *) "mlt.count"; int param_name_length = sizeof("mlt.count")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto array SolrQuery::getMltFields() Returns the parameter */ PHP_METHOD(SolrQuery, getMltFields) { solr_char_t *param_name = (solr_char_t *) "mlt.fl"; int param_name_length = sizeof("mlt.fl")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_simple_list_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto array SolrQuery::getMltQueryFields() Returns the parameter */ PHP_METHOD(SolrQuery, getMltQueryFields) { solr_char_t *param_name = (solr_char_t *) "mlt.qf"; int param_name_length = sizeof("mlt.qf")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_arg_list_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltMinTermFrequency() Returns the parameter */ PHP_METHOD(SolrQuery, getMltMinTermFrequency) { solr_char_t *param_name = (solr_char_t *) "mlt.mintf"; int param_name_length = sizeof("mlt.mintf")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltMinDocFrequency() Returns the parameter */ PHP_METHOD(SolrQuery, getMltMinDocFrequency) { solr_char_t *param_name = (solr_char_t *) "mlt.mindf"; int param_name_length = sizeof("mlt.mindf")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltMinWordLength() Returns the parameter */ PHP_METHOD(SolrQuery, getMltMinWordLength) { solr_char_t *param_name = (solr_char_t *) "mlt.minwl"; int param_name_length = sizeof("mlt.minwl")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltMaxWordLength() Returns the parameter */ PHP_METHOD(SolrQuery, getMltMaxWordLength) { solr_char_t *param_name = (solr_char_t *) "mlt.maxwl"; int param_name_length = sizeof("mlt.maxwl")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltMaxNumTokens() Returns the parameter */ PHP_METHOD(SolrQuery, getMltMaxNumTokens) { solr_char_t *param_name = (solr_char_t *) "mlt.maxntp"; int param_name_length = sizeof("mlt.maxntp")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltMaxNumQueryTerms() Returns the parameter */ PHP_METHOD(SolrQuery, getMltMaxNumQueryTerms) { solr_char_t *param_name = (solr_char_t *) "mlt.maxqt"; int param_name_length = sizeof("mlt.maxqt")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getMltBoost() Returns the parameter */ PHP_METHOD(SolrQuery, getMltBoost) { solr_char_t *param_name = (solr_char_t *) "mlt.boost"; int param_name_length = sizeof("mlt.boost")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getTerms() Returns the parameter */ PHP_METHOD(SolrQuery, getTerms) { solr_char_t *param_name = (solr_char_t *) "terms"; int param_name_length = sizeof("terms")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getTermsField() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsField) { solr_char_t *param_name = (solr_char_t *) "terms.fl"; int param_name_length = sizeof("terms.fl")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getTermsLowerBound() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsLowerBound) { solr_char_t *param_name = (solr_char_t *) "terms.lower"; int param_name_length = sizeof("terms.lower")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getTermsUpperBound() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsUpperBound) { solr_char_t *param_name = (solr_char_t *) "terms.upper"; int param_name_length = sizeof("terms.upper")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getTermsIncludeLowerBound() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsIncludeLowerBound) { solr_char_t *param_name = (solr_char_t *) "terms.lower.incl"; int param_name_length = sizeof("terms.lower.incl")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getTermsIncludeUpperBound() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsIncludeUpperBound) { solr_char_t *param_name = (solr_char_t *) "terms.upper.incl"; int param_name_length = sizeof("terms.upper.incl")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getTermsMinCount() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsMinCount) { solr_char_t *param_name = (solr_char_t *) "terms.mincount"; int param_name_length = sizeof("terms.mincount")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getTermsMaxCount() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsMaxCount) { solr_char_t *param_name = (solr_char_t *) "terms.maxcount"; int param_name_length = sizeof("terms.maxcount")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getTermsPrefix() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsPrefix) { solr_char_t *param_name = (solr_char_t *) "terms.prefix"; int param_name_length = sizeof("terms.prefix")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getTermsLimit() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsLimit) { solr_char_t *param_name = (solr_char_t *) "terms.limit"; int param_name_length = sizeof("terms.limit")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getTermsReturnRaw() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsReturnRaw) { solr_char_t *param_name = (solr_char_t *) "terms.raw"; int param_name_length = sizeof("terms.raw")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getTermsSort() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsSort) { solr_char_t *param_name = (solr_char_t *) "terms.sort"; int param_name_length = sizeof("terms.sort")-1; solr_param_t *solr_param = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_sort_type(solr_param, return_value); } /* }}} */ /* }}} End of getter methods */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/php_solr_response.c000066400000000000000000000314521374041537100227230ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ Macro for extracting property values using string constants */ #define solr_read_response_object_property(objptr, name, silent) zend_read_property(Z_OBJCE_P(objptr), objptr, name, sizeof(name)-1, silent TSRMLS_CC) /* }}} */ /* {{{ proto int SolrResponse::getHttpStatus(void) Returns the value of the http_status property. */ PHP_METHOD(SolrResponse, getHttpStatus) { zend_bool silent = 1; zval *objptr = getThis(); zval *http_status = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } http_status = solr_read_response_object_property(objptr, "http_status", silent); RETURN_LONG(Z_LVAL_P(http_status)); } /* }}} */ /* {{{ proto string SolrResponse::getHttpStatusMessage(void) Returns the http_status_message property. */ PHP_METHOD(SolrResponse, getHttpStatusMessage) { zend_bool silent = 1; zval *objptr = getThis(); zval *http_status_message = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } http_status_message = solr_read_response_object_property(objptr, "http_status_message", silent); RETURN_STRINGL(Z_STRVAL_P(http_status_message), Z_STRLEN_P(http_status_message), 1); } /* }}} */ /* {{{ proto bool SolrResponse::success(void) Returns whether the request was successful or not. */ PHP_METHOD(SolrResponse, success) { zend_bool silent = 1; zval *objptr = getThis(); zval *success = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } success = solr_read_response_object_property(objptr, "success", silent); RETURN_BOOL(Z_BVAL_P(success)); } /* }}} */ /* {{{ proto string SolrResponse::getRequestUrl(void) Returns the URL used for the request. */ PHP_METHOD(SolrResponse, getRequestUrl) { zend_bool silent = 1; zval *objptr = getThis(); zval *prop = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } prop = solr_read_response_object_property(objptr, "http_request_url", silent); RETURN_STRINGL(Z_STRVAL_P(prop), Z_STRLEN_P(prop), 1); } /* }}} */ /* {{{ proto string SolrResponse::getRawRequestHeaders(void) Returns the raw http request headers sent to the server. */ PHP_METHOD(SolrResponse, getRawRequestHeaders) { zend_bool silent = 1; zval *objptr = getThis(); zval *prop = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } prop = solr_read_response_object_property(objptr, "http_raw_request_headers", silent); RETURN_STRINGL(Z_STRVAL_P(prop), Z_STRLEN_P(prop), 1); } /* }}} */ /* {{{ proto string SolrResponse::getRawRequest(void) Returns the raw http request sent to the server. */ PHP_METHOD(SolrResponse, getRawRequest) { zend_bool silent = 1; zval *objptr = getThis(); zval *prop = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } prop = solr_read_response_object_property(objptr, "http_raw_request", silent); RETURN_STRINGL(Z_STRVAL_P(prop), Z_STRLEN_P(prop), 1); } /* }}} */ /* {{{ proto string SolrResponse::getRawResponseHeaders(void) Returns the raw http response headers from the server. */ PHP_METHOD(SolrResponse, getRawResponseHeaders) { zend_bool silent = 1; zval *objptr = getThis(); zval *prop = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } prop = solr_read_response_object_property(objptr, "http_raw_response_headers", silent); RETURN_STRINGL(Z_STRVAL_P(prop), Z_STRLEN_P(prop), 1); } /* }}} */ /* {{{ proto string SolrResponse::getRawResponse(void) Returns the raw http response from the server. */ PHP_METHOD(SolrResponse, getRawResponse) { zend_bool silent = 1; zval *objptr = getThis(); zval *prop = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } prop = solr_read_response_object_property(objptr, "http_raw_response", silent); if (Z_STRLEN_P(prop)) { RETURN_STRINGL(Z_STRVAL_P(prop), Z_STRLEN_P(prop), 1); } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrResponse::getDigestedResponse(void) Returns the serialized object string derived from the XML response. */ PHP_METHOD(SolrResponse, getDigestedResponse) { zend_bool silent = 0; zval *objptr = getThis(); zval *prop = NULL; if (!return_value_used) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); return; } prop = solr_read_response_object_property(objptr, "http_digested_response", silent); if (Z_STRLEN_P(prop)) { RETURN_STRINGL(Z_STRVAL_P(prop), Z_STRLEN_P(prop), 1); } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrReponse::setParseMode([bool parse_mode]) Sets the parsing mode. This determines whether documents will be parsed as SolrObjects or SolrDocuments. */ PHP_METHOD(SolrResponse, setParseMode) { long int parse_mode = 0L; zval *objptr = getThis(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &parse_mode) == FAILURE) { RETURN_FALSE; } parse_mode = ((parse_mode < 0L) ? 0L : ((parse_mode > 1L) ? 1L : parse_mode)); zend_update_property_long(Z_OBJCE_P(objptr), objptr, "parser_mode", sizeof("parser_mode")-1, parse_mode TSRMLS_CC); RETURN_TRUE; } /* }}} */ /* {{{ proto SolrObject SolrResponse::getResponse(void) Returns the response object from the server. */ PHP_METHOD(SolrResponse, getResponse) { solr_response_get_response_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU,0); } /* }}} */ /* {{{ proto array SolrResponse::getArrayResponse(void) Returns the response array from the server. */ PHP_METHOD(SolrResponse, getArrayResponse) { solr_response_get_response_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU,1); } /* }}} */ /** * Digest solr server raw response * and return SolrObject or array */ PHP_SOLR_API void solr_response_get_response_impl( INTERNAL_FUNCTION_PARAMETERS, int return_array) { zend_bool silent = 0; zval *objptr = getThis(); if (return_value_used) { zval *response_writer = solr_read_response_object_property(objptr, "response_writer", silent); zval *raw_response = solr_read_response_object_property(objptr, "http_raw_response", silent); zval *success = solr_read_response_object_property(objptr, "success", silent); zval *parser_mode = solr_read_response_object_property(objptr, "parser_mode", silent); if (Z_BVAL_P(success) && Z_STRLEN_P(raw_response)) { solr_string_t buffer; php_unserialize_data_t var_hash; const unsigned char *raw_resp; size_t raw_res_length; const unsigned char *str_end; int successful = 1; memset(&buffer, 0, sizeof(solr_string_t)); if (Z_STRLEN_P(response_writer)) { if (0 == strcmp(Z_STRVAL_P(response_writer), SOLR_XML_RESPONSE_WRITER)) { /* SOLR_XML_RESPONSE_WRITER */ /* Convert from XML serialization to PHP serialization format */ solr_encode_generic_xml_response(&buffer, Z_STRVAL_P(raw_response), Z_STRLEN_P(raw_response), Z_LVAL_P(parser_mode) TSRMLS_CC); if(return_array) { solr_sobject_to_sarray(&buffer TSRMLS_CC); } } else if (0 == strcmp(Z_STRVAL_P(response_writer), SOLR_PHP_NATIVE_RESPONSE_WRITER) || 0 == strcmp(Z_STRVAL_P(response_writer), SOLR_PHP_SERIALIZED_RESPONSE_WRITER)) { /* SOLR_PHP_NATIVE_RESPONSE_WRITER */ /* Response string is already in Native PHP serialization format */ solr_string_set(&buffer, Z_STRVAL_P(raw_response), Z_STRLEN_P(raw_response)); if(!return_array) { solr_sarray_to_sobject(&buffer TSRMLS_CC); } } else if (0 == strcmp(Z_STRVAL_P(response_writer), SOLR_JSON_RESPONSE_WRITER)) { int json_translation_result = solr_json_to_php_native(&buffer, Z_STRVAL_P(raw_response), Z_STRLEN_P(raw_response) TSRMLS_CC); /* SOLR_JSON_RESPONSE_WRITER */ /* Convert from JSON serialization to PHP serialization format */ if (json_translation_result > 0) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, solr_get_json_error_msg(json_translation_result)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error in JSON->PHP conversion. JSON Error Code %d", json_translation_result); } if(!return_array) { solr_sarray_to_sobject(&buffer TSRMLS_CC); } } } if (buffer.len) { zend_update_property_stringl(Z_OBJCE_P(objptr), objptr, "http_digested_response", sizeof("http_digested_response")-1, buffer.str, buffer.len TSRMLS_CC); } memset(&var_hash, 0, sizeof(php_unserialize_data_t)); PHP_VAR_UNSERIALIZE_INIT(var_hash); raw_resp = (unsigned char *) buffer.str; raw_res_length = buffer.len; str_end = (unsigned char *) (raw_resp + raw_res_length); if (!php_var_unserialize(&return_value, &raw_resp, str_end, &var_hash TSRMLS_CC)) { successful = 0; solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1000_MSG); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error unserializing raw response."); } PHP_VAR_UNSERIALIZE_DESTROY(var_hash); solr_string_free(&buffer); if (successful) { /* Overriding the default object handlers */ Z_OBJ_HT_P(return_value) = &solr_object_handlers; } return ; } RETURN_NULL(); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, SOLR_ERROR_4002_MSG); } } /* {{{ proto string SolrPingResponse::getResponse(void) Ping responses are always empty. Returns null. */ PHP_METHOD(SolrPingResponse, getResponse) { /* Ping responses are not serialized */ if (return_value_used) { RETURN_NULL(); } } /* }}} */ /* {{{ proto SolrPingResponse::__construct(void) Constructor */ PHP_METHOD(SolrPingResponse, __construct) { } /* }}} */ /* {{{ proto SolrPingResponse::__destruct(void) Destructor */ PHP_METHOD(SolrPingResponse, __destruct) { } /* }}} */ /* {{{ proto SolrQueryResponse::__construct(void) Constructor */ PHP_METHOD(SolrQueryResponse, __construct) { } /* }}} */ /* {{{ proto SolrQueryResponse::__destruct(void) Destructor */ PHP_METHOD(SolrQueryResponse, __destruct) { } /* }}} */ /* {{{ proto SolrUpdateResponse::__construct(void) Constructor */ PHP_METHOD(SolrUpdateResponse, __construct) { } /* }}} */ /* {{{ proto SolrUpdateResponse::__destruct(void) Destructor */ PHP_METHOD(SolrUpdateResponse, __destruct) { } /* }}} */ /* {{{ proto SolrGenericResponse::__construct(void) Constructor */ PHP_METHOD(SolrGenericResponse, __construct) { } /* }}} */ /* {{{ proto SolrGenericResponse::__destruct(void) Destructor */ PHP_METHOD(SolrGenericResponse, __destruct) { } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/php_solr_utils.c000066400000000000000000000174041374041537100222260ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ proto string SolrUtils::escapeQueryChars(string unescaped) Escapes the lucene string */ PHP_METHOD(SolrUtils, escapeQueryChars) { solr_char_t *unescaped = NULL; solr_string_t sbuilder; int unescaped_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &unescaped, &unescaped_length) == FAILURE) { RETURN_FALSE; } if (!unescaped_length) { RETURN_NULL(); } memset(&sbuilder, 0, sizeof(solr_string_t)); solr_escape_query_chars(&sbuilder, unescaped, unescaped_length); RETVAL_STRINGL(sbuilder.str, sbuilder.len, 1); solr_string_free(&sbuilder); } /* }}} */ /* {{{ proto string SolrUtils::queryPhrase(string unescaped) Prepares a phrase from an unescaped lucene string. */ PHP_METHOD(SolrUtils, queryPhrase) { solr_char_t *unescaped = NULL; solr_string_t sbuilder; int unescaped_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &unescaped, &unescaped_length) == FAILURE) { RETURN_FALSE; } if (!unescaped_length) { RETURN_NULL(); } memset(&sbuilder, 0, sizeof(solr_string_t)); solr_string_appendc(&sbuilder, '"'); solr_escape_query_chars(&sbuilder, unescaped, unescaped_length); solr_string_appendc(&sbuilder, '"'); RETVAL_STRINGL(sbuilder.str, sbuilder.len, 1); solr_string_free(&sbuilder); } /* }}} */ /* {{{ proto string SolrUtils::digestXMLResponse(string xml_response [, int parse_mode]) Digests the xml response into a php serialize string. */ PHP_METHOD(SolrUtils, digestXmlResponse) { solr_char_t *xmlresponse = NULL; int xmlresponse_len = 0; long int parse_mode = 0L; solr_string_t sbuilder; unsigned char *raw_resp = NULL, *str_end = NULL; size_t raw_res_length = 0; php_unserialize_data_t var_hash; int successful = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &xmlresponse, &xmlresponse_len, &parse_mode) == FAILURE) { RETURN_FALSE; } if (!xmlresponse_len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Raw response is empty"); RETURN_NULL(); } parse_mode = ((parse_mode < 0L) ? 0L : ((parse_mode > 1L) ? 1L : parse_mode)); memset(&sbuilder, 0, sizeof(solr_string_t)); solr_encode_generic_xml_response(&sbuilder, xmlresponse, xmlresponse_len, parse_mode TSRMLS_CC); if (sbuilder.str == NULL || sbuilder.len == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Raw response was not valid"); RETURN_NULL(); } memset(&var_hash, 0, sizeof(php_unserialize_data_t)); PHP_VAR_UNSERIALIZE_INIT(var_hash); raw_resp = (unsigned char *) sbuilder.str; raw_res_length = sbuilder.len; str_end = (unsigned char *) (raw_resp + raw_res_length); if (!php_var_unserialize(&return_value, (const unsigned char **) &raw_resp, str_end, &var_hash TSRMLS_CC)) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1000_MSG); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error unserializing raw response."); successful = 0; } PHP_VAR_UNSERIALIZE_DESTROY(var_hash); solr_string_free(&sbuilder); if (successful) { /* Overriding the default object handlers */ Z_OBJ_HT_P(return_value) = &solr_object_handlers; } } /* }}} */ /* {{{ proto string SolrUtils::digestJsonResponse(string jsonResponse) Digests the json response into a php serialize string. */ PHP_METHOD(SolrUtils, digestJsonResponse) { solr_char_t *jsonResponse = NULL; int jsonResponse_len = 0; unsigned char *raw_resp = NULL, *str_end = NULL; solr_string_t buffer; php_unserialize_data_t var_hash; size_t raw_res_length; int successful = 1; int json_translation_result; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &jsonResponse, &jsonResponse_len) == FAILURE) { RETURN_FALSE; } memset(&buffer, 0, sizeof(solr_string_t)); json_translation_result = solr_json_to_php_native(&buffer, jsonResponse, jsonResponse_len TSRMLS_CC); if (json_translation_result > 0) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, solr_get_json_error_msg(json_translation_result)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error in JSON->PHP conversion. JSON Error Code %d", json_translation_result); }else{ solr_sarray_to_sobject(&buffer TSRMLS_CC); } memset(&var_hash, 0, sizeof(php_unserialize_data_t)); PHP_VAR_UNSERIALIZE_INIT(var_hash); raw_resp = (unsigned char *) buffer.str; raw_res_length = buffer.len; str_end = (unsigned char *) (raw_resp + raw_res_length); if (!php_var_unserialize( &return_value, (const unsigned char **)&raw_resp, str_end, &var_hash TSRMLS_CC) ) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1000_MSG); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error unserializing raw response."); successful = 0; } solr_string_free(&buffer); PHP_VAR_UNSERIALIZE_DESTROY(var_hash); if (successful) { /* Overriding the default object handlers */ Z_OBJ_HT_P(return_value) = &solr_object_handlers; } } /* }}} */ /* {{{ proto string SolrUtils::getSolrVersion(void) Returns the current extension version */ PHP_METHOD(SolrUtils, getSolrVersion) { #ifdef SOLR_DEBUG char * version; asprintf(&version,"%s (DEBUG)", PHP_SOLR_DOTTED_VERSION); ZVAL_STRING(return_value, version, 1); #else RETURN_STRING(PHP_SOLR_DOTTED_VERSION, 1); #endif } /* }}} */ /* {{{ proto array SolrUtils::getSolrStats(void) Returns the number of active documents, clients and SolrParam objects in the current thread. */ PHP_METHOD(SolrUtils, getSolrStats) { int document_count = zend_hash_num_elements(SOLR_GLOBAL(documents)); int client_count = zend_hash_num_elements(SOLR_GLOBAL(clients)); int params_count = zend_hash_num_elements(SOLR_GLOBAL(params)); array_init(return_value); add_assoc_long(return_value, "document_count", document_count); add_assoc_long(return_value, "client_count", client_count); add_assoc_long(return_value, "params_count", params_count); } /* }}} */ /* {{{ proto string solr_get_version(void) Returns the current extension version */ PHP_FUNCTION(solr_get_version) { #ifdef SOLR_DEBUG char * version; asprintf(&version,"%s (DEBUG)", PHP_SOLR_DOTTED_VERSION); ZVAL_STRING(return_value, version, 1); #else RETURN_STRING(PHP_SOLR_DOTTED_VERSION, 1); #endif } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/php_solr_version.h000066400000000000000000000050751374041537100225610ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_version.h" #ifndef PHP_SOLR_VERSION_H #define PHP_SOLR_VERSION_H #define PHP_SOLR_MAJOR_VERSION 2 #define PHP_SOLR_MINOR_VERSION 4 #define PHP_SOLR_PATCH_VERSION 0 #define PHP_SOLR_RELEASE_VERSION PHP_SOLR_PATCH_VERSION #define PHP_SOLR_VERSION "2.4.0" #define PHP_SOLR_DOTTED_VERSION PHP_SOLR_VERSION /** * Extension version numbers using hexadecimal numbers * * This is the numeric version of the extension, meant for easier * parsing and comparisons by programs. The PHP_SOLR_VERSION_ID define will * always follow this syntax: * * 0xXXYYZZ * * Where XX, YY and ZZ are the main version, minor version and patch numbers in * hexadecimal (using 8 bits each). All three numbers are always represented * using two digits. 1.2 would appear as "0x010200" while version 9.11.7 * appears as "0x090b07". * * This 6-digit (24 bits) hexadecimal number does not show pre-release number, * and it is always a greater number in a more recent release. It makes * comparisons with greater than and less than work. */ #define PHP_SOLR_VERSION_ID 0x020400 #define SOLR_CLIENT_USER_AGENT "PHP Solr Client 2.4.0" #endif /* PHP_SOLR_VERSION_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/solr_constants.h000066400000000000000000000175701374041537100222440ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #ifndef SOLR_CONSTANTS_H #define SOLR_CONSTANTS_H #include "php_solr_version.h" #define SOLR_SPACE_STRING " " /* {{{ Constants for the SolrClient with*/ #define SOLR_DEFAULT_UPDATE_SERVLET "update" #define SOLR_DEFAULT_SEARCH_SERVLET "select" #define SOLR_DEFAULT_THREADS_SERVLET "admin/threads" #define SOLR_DEFAULT_PING_SERVLET "admin/ping" #define SOLR_DEFAULT_TERMS_SERVLET "terms" #define SOLR_DEFAULT_SYSTEM_SERVLET "admin/system" #define SOLR_DEFAULT_GET_SERVLET "get" #define SOLR_PHP_SERIALIZED_RESPONSE_WRITER "phps" #define SOLR_PHP_NATIVE_RESPONSE_WRITER "phpnative" #define SOLR_XML_RESPONSE_WRITER "xml" #define SOLR_JSON_RESPONSE_WRITER "json" #define SOLR_REQUEST_DEFAULT_HOST "localhost" #define SOLR_REQUEST_DEFAULT_PATH "solr" #define SOLR_REQUEST_DEFAULT_QS_DELIMITER "&" #define SOLR_REQUEST_DEFAULT_PORT 8983L #define SOLR_CURL_MAX_WRITE_SIZE CURL_MAX_WRITE_SIZE #define SOLR_CURL_OPTIONS_LENGTH 512 /* }}} */ /* {{{ Names of Objects */ #define PHP_SOLR_OBJECT_CLASSNAME "SolrObject" #define PHP_SOLR_DOCUMENT_CLASSNAME "SolrDocument" #define PHP_SOLR_DOCUMENT_FIELD_CLASSNAME "SolrDocumentField" #define PHP_SOLR_INPUT_DOCUMENT_CLASSNAME "SolrInputDocument" #define PHP_SOLR_CLIENT_CLASSNAME "SolrClient" #define PHP_SOLR_PARAMS_CLASSNAME "SolrParams" #define PHP_SOLR_QUERY_CLASSNAME "SolrQuery" #define PHP_SOLR_COLLAPSE_FUNCTION_CLASSNAME "SolrCollapseFunction" #define PHP_SOLR_MODIFIABLE_PARAMS_CLASSNAME "SolrModifiableParams" #define PHP_SOLR_RESPONSE_CLASSNAME "SolrResponse" #define PHP_SOLR_QUERY_RESPONSE_CLASSNAME "SolrQueryResponse" #define PHP_SOLR_UPDATE_RESPONSE_CLASSNAME "SolrUpdateResponse" #define PHP_SOLR_PING_RESPONSE_CLASSNAME "SolrPingResponse" #define PHP_SOLR_GENERIC_RESPONSE_CLASSNAME "SolrGenericResponse" #define PHP_SOLR_UTILS_CLASSNAME "SolrUtils" #define PHP_SOLR_EXCEPTION_CLASSNAME "SolrException" #define PHP_SOLR_ILLEGAL_OPERATION_EXCEPTION_CLASSNAME "SolrIllegalOperationException" #define PHP_SOLR_ILLEGAL_ARGUMENT_EXCEPTION_CLASSNAME "SolrIllegalArgumentException" #define PHP_SOLR_CLIENT_EXCEPTION_CLASSNAME "SolrClientException" #define PHP_SOLR_SERVER_EXCEPTION_CLASSNAME "SolrServerException" #define PHP_SOLR_MISSING_MANDATORY_PARAMETER_EXCEPTION_CLASSNAME "SolrMissingMandatoryParameterException" /* }}} */ /* {{{ Informational constants */ #define PHP_SOLR_EXTENSION_NAME "solr" #define PHP_CURL_EXTENSION_NAME "curl" #define PHP_LIBXML_EXTENSION_NAME "libxml" #define PHP_JSON_EXTENSION_NAME "json" /* }}} */ /* {{{ Property names */ #define SOLR_INDEX_PROPERTY_NAME "_hashtable_index" #define SOLR_FIELD_NAME_PROPERTY_NAME "name" #define SOLR_FIELD_BOOST_PROPERTY_NAME "boost" #define SOLR_FIELD_VALUES_PROPERTY_NAME "values" #define SOLR_SOURCELINE_NO_PROPERTY_NAME "sourceline" #define SOLR_SOURCEFILE_PROPERTY_NAME "sourcefile" #define SOLR_ZIFNAME_PROPERTY_NAME "zif_name" #define SOLR_DISMAX_DEFAULT_PARSER "edismax" #ifdef PHP_WIN32 #define __func__ __FUNCTION__ #endif #define SOLR_FILE_LINE_FUNC __FILE__, __LINE__, __func__ /* }}} */ /* {{{ Constants for Method/Function arguments and return styles */ #define SOLR_ARG_PASS_BY_REF_FALSE 0 #define SOLR_ARG_PASS_BY_REF_TRUE 1 #define SOLR_ARG_PASS_REMAINING_BY_REF_FALSE 0 #define SOLR_ARG_PASS_REMAINING_BY_REF_TRUE 1 #define SOLR_ARG_ALLOW_NULL_FALSE 0 #define SOLR_ARG_ALLOW_NULL_TRUE 1 #define SOLR_METHOD_RETURN_REFERENCE_FALSE 0 #define SOLR_METHOD_RETURN_REFERENCE_TRUE 1 /* }}} */ /* {{{ Constants for Sorting SolrDocument Fields */ #define SOLR_SORT_ASC 1 #define SOLR_SORT_DESC 2 #define SOLR_SORT_FIELD_NAME 1 #define SOLR_SORT_FIELD_VALUE_COUNT 2 #define SOLR_SORT_FIELD_BOOST_VALUE 4 /* }}} */ /* {{{ Constants for document encoding formats */ #define SOLR_XML_ENCODE_OBJ 0L #define SOLR_XML_ENCODE_DOC 1L /* }}} */ /** * Setting this to 8 gets rid of the extra while loops in _zend_hash_init() * * _zend_hash_init loops 3 times to increase the value of the size to 8 */ #define SOLR_INITIAL_HASH_TABLE_SIZE (1<<3) /* {{{ Memory Allocation Related Constants */ #define SOLR_HASHTABLE_PERSISTENT 0 #define SOLR_DOCUMENT_PERSISTENT 0 #define SOLR_DOCUMENT_FIELD_PERSISTENT 0 #define SOLR_CLIENT_PERSISTENT 0 #define SOLR_PARAMS_PERSISTENT 0 #define SOLR_FUNCTIONS_PERSISTENT 0 /* }}} */ /* {{{ SolrException Codes : Internal and UserSpace */ /* {{{ Error codes and messages */ #define SOLR_ERROR_1000 1000L #define SOLR_ERROR_1000_MSG "Error un-serializing response" #define SOLR_ERROR_1001 1001L #define SOLR_ERROR_1001_MSG "SolrClient objects cannot be serialized or unserialized" #define SOLR_ERROR_1002 1002L #define SOLR_ERROR_1002_MSG "The '%s' property cannot be removed or set to NULL. SolrObject properties cannot be unset or set to NULL." #define SOLR_ERROR_1003 1003L #define SOLR_ERROR_1003_MSG "Error building HTTP query from parameters" #define SOLR_ERROR_1004 1004L #define SOLR_ERROR_1004_MSG "Unsuccessful HTTP request" #define SOLR_ERROR_1005 1005L #define SOLR_ERROR_1005_MSG "SolrInputDocument objects cannot be serialized or unserialized" #define SOLR_ERROR_1006 1006L #define SOLR_ERROR_1006_MSG "SolrObject instances are read-only. Properties cannot be added, updated or removed." #define SOLR_ERROR_1007 1007L #define SOLR_ERROR_1007_MSG "SolrDocumentField instances are read-only. Properties cannot be updated or removed." #define SOLR_ERROR_1008 1008L #define SOLR_ERROR_1008_MSG "Internal Error 1008 generated from %s %d %s. The observed error is a possible side-effect of an illegal/unsupported operation in userspace. Please check the documentation and try again later." #define SOLR_ERROR_1009 1009L #define SOLR_ERROR_1009_MSG "The observed error is a possible side-effect of an illegal/unsupported operation in userspace. This object cannot be cloned. Cloning of this object type is not yet supported." #define SOLR_ERROR_1010 1010L #define SOLR_ERROR_1010_MSG "Unsuccessful %s request : Response Code %ld. %s" #define SOLR_ERROR_4000 4000L #define SOLR_ERROR_4000_MSG "Invalid argument" #define SOLR_ERROR_4001 4001L #define SOLR_ERROR_4001_MSG "Illegal Operation" #define SOLR_ERROR_4002 4002L #define SOLR_ERROR_4002_MSG "Return value requested without processing output" /* }}} */ /* {{{ UserSpace Errors */ #define SOLR_ERROR_4100 4100L #define SOLR_ERROR_4100_MSG "Mandatory parameter Missing: %s" /* }}} */ /* {{{ Compile time errors */ /* }}} */ /* }}} */ #endif /* SOLR_CONSTANTS_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/solr_functions_client.c000066400000000000000000000714711374041537100235710ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ PHP_SOLR_API int solr_init_options(solr_client_options_t *options TSRMLS_DC) */ PHP_SOLR_API int solr_init_options(solr_client_options_t *options TSRMLS_DC) { solr_string_init(&(options->hostname)); solr_string_init(&(options->path)); solr_string_init(&(options->http_auth_credentials)); solr_string_init(&(options->proxy_hostname)); solr_string_init(&(options->proxy_auth_credentials)); solr_string_init(&(options->ssl_cert)); solr_string_init(&(options->ssl_key)); solr_string_init(&(options->ssl_keypassword)); solr_string_init(&(options->ssl_cainfo)); solr_string_init(&(options->ssl_capath)); solr_string_init(&(options->qs_delimiter)); solr_string_init(&(options->response_writer)); solr_string_init(&(options->update_url)); solr_string_init(&(options->search_url)); solr_string_init(&(options->thread_url)); solr_string_init(&(options->ping_url)); solr_string_init(&(options->terms_url)); solr_string_init(&(options->system_url)); solr_string_init(&(options->get_url)); solr_string_init(&(options->update_servlet)); solr_string_init(&(options->search_servlet)); solr_string_init(&(options->thread_servlet)); solr_string_init(&(options->ping_servlet)); solr_string_init(&(options->terms_servlet)); solr_string_init(&(options->system_servlet)); solr_string_init(&(options->get_servlet)); return SUCCESS; } /* }}} */ /* {{{ static void solr_set_initial_handle_options(solr_curl_t **sch, solr_client_options_t *options TSRMLS_DC) */ static void solr_set_initial_curl_handle_options(solr_curl_t **sch_ptr, solr_client_options_t *options TSRMLS_DC) { solr_curl_t * sch = *sch_ptr; /** Setup all the required CURL options here **/ curl_easy_setopt(sch->curl_handle, CURLOPT_NOPROGRESS, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_VERBOSE, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_ERRORBUFFER, sch->err.str); curl_easy_setopt(sch->curl_handle, CURLOPT_WRITEFUNCTION, solr_curl_write); curl_easy_setopt(sch->curl_handle, CURLOPT_WRITEDATA, (void *) sch); curl_easy_setopt(sch->curl_handle, CURLOPT_HEADERFUNCTION, solr_curl_write_header); curl_easy_setopt(sch->curl_handle, CURLOPT_HEADERDATA, (void *) sch); curl_easy_setopt(sch->curl_handle, CURLOPT_DEBUGFUNCTION, solr_curl_debug_callback); curl_easy_setopt(sch->curl_handle, CURLOPT_DEBUGDATA, (void *) sch); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); /** #if LIBCURL_VERSION_NUM >= 0x071304 curl_easy_setopt(sch->curl_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP); #endif */ curl_easy_setopt(sch->curl_handle, CURLOPT_DNS_CACHE_TIMEOUT, 120L); curl_easy_setopt(sch->curl_handle, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_MAXREDIRS, 16L); /* prevent infinite redirects */ curl_easy_setopt(sch->curl_handle, CURLOPT_UNRESTRICTED_AUTH, 0L); #ifdef ZTS curl_easy_setopt(sch->curl_handle, CURLOPT_NOSIGNAL, 1L); /** Needed in multi-threaded environments **/ #endif curl_easy_setopt(sch->curl_handle, CURLOPT_TIMEOUT, options->timeout); curl_easy_setopt(sch->curl_handle, CURLOPT_USERAGENT, SOLR_CLIENT_USER_AGENT); /* If the login and password options are passed, send the authentication headers */ if (options->http_auth_credentials.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_easy_setopt(sch->curl_handle, CURLOPT_USERPWD, options->http_auth_credentials.str); } /* If there is proxy info, send it too */ if (options->proxy_hostname.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_PROXY, options->proxy_hostname.str); if (options->proxy_port) { curl_easy_setopt(sch->curl_handle, CURLOPT_PROXYPORT, options->proxy_port); } if (options->proxy_auth_credentials.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_PROXYUSERPWD, options->proxy_auth_credentials.str); } } /* * When negotiating an SSL connection, the server sends a certificate indicating its identity. * cURL verifies whether the certificate is authentic */ if (options->secure) { /* The name of the PEM-formatted private key and private certificate concatenated */ if (options->ssl_cert.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_SSLCERT, options->ssl_cert.str); curl_easy_setopt(sch->curl_handle, CURLOPT_SSLCERTTYPE, "PEM"); } /* The name of the PEM-formatted private key, if certificate and private key are separate */ if (options->ssl_key.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_SSLKEY, options->ssl_key.str); curl_easy_setopt(sch->curl_handle, CURLOPT_SSLKEYTYPE, "PEM"); } /* Password for the PEM-formatted private key */ if (options->ssl_keypassword.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_KEYPASSWD, options->ssl_keypassword.str); } /* The file holding one or more CA certificates to verify the peer with */ if (options->ssl_cainfo.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_CAINFO, options->ssl_cainfo.str); } /* The directory holding multiple CA certificates to verify the peer with */ if (options->ssl_capath.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_CAPATH , options->ssl_capath.str); } /* * Whether curl verifies the authenticity of the host name of server * Based on the Common name section of the certificate */ if (options->ssl_verify_peer && options->ssl_verify_host) { curl_easy_setopt(sch->curl_handle, CURLOPT_SSL_VERIFYHOST, options->ssl_verify_host); } /* * Verify the authenticity of the peer's certificate * This authentication is based on a chain of digital signatures, * rooted in certification authority (CA) certificates. * * If something is not right, the connection will not be valid */ curl_easy_setopt(sch->curl_handle, CURLOPT_SSL_VERIFYPEER, options->ssl_verify_peer); } } /* }}} */ /* {{{ PHP_SOLR_API int solr_init_handle(solr_curl_t *sch, solr_client_options_t *options TSRMLS_DC) */ PHP_SOLR_API int solr_init_handle(solr_curl_t *sch, solr_client_options_t *options TSRMLS_DC) { sch->response_header.response_code = 0L; memset(sch->err.str, 0, sizeof(sch->err.str)); sch->curl_handle = curl_easy_init(); if (NULL == sch->curl_handle) { return FAILURE; } sch->result_code = CURLE_OK; sch->handle_status = 1; #ifdef ZTS sch->tsrm_ls = TSRMLS_C; #endif solr_string_init(&(sch->request_header.buffer)); solr_string_init(&(sch->request_body.buffer)); solr_string_init(&(sch->request_body_debug.buffer)); solr_string_init(&(sch->response_header.buffer)); solr_string_init(&(sch->response_body.buffer)); solr_string_init(&(sch->debug_data_buffer)); solr_set_initial_curl_handle_options(&(sch), options TSRMLS_CC); return SUCCESS; } /* }}} */ /** * solr_curl_write * * Called by libcurl as soon as there is response body data received that needs to be saved. * * The size of the data pointed to by *data is size multiplied with nmemb, it will not be zero terminated * * The *ctx parameter is the solr_curl pointer */ /* {{{ size_t solr_curl_write(solr_char_t *data, size_t size, size_t nmemb, void *ctx) */ size_t solr_curl_write(solr_char_t *data, size_t size, size_t nmemb, void *ctx) { size_t length = (size * nmemb); solr_curl_t *sch = (solr_curl_t *) ctx; solr_string_appends(&(sch->response_body.buffer), data, length); return length; } /* }}} */ /** * solr_curl_write_header * * Called by libcurl as soon as it has received header data * * It will be called once for each header and only complete header lines are passed on to the callback. * * Note: header lines may not be null-terminated so beware. * * The *ctx parameter is the solr_curl pointer */ /* {{{ size_t solr_curl_write_header(solr_char_t *data, size_t size, size_t nmemb, void *ctx) */ size_t solr_curl_write_header(solr_char_t *data, size_t size, size_t nmemb, void *ctx) { size_t length = (size * nmemb); solr_curl_t *sch = (solr_curl_t *) ctx; solr_string_appends(&(sch->response_header.buffer), data, length); return length; } /* }}} */ /** * solr_curl_debug_callback * * The infotype parameter is one of : * * 0 = CURLINFO_TEXT * 1 = CURLINFO_HEADER_IN (Response Headers) * 2 = CURLINFO_HEADER_OUT (Request Headers) * 3 = CURLINFO_DATA_IN (Response Body) * 4 = CURLINFO_DATA_OUT (Request Body) * 5 = CURLINFO_SSL_DATA_IN * 6 = CURLINFO_SSL_DATA_OUT * * The debug_data parameter is not null-terminated but is exactly size characters * * The ctx parameter is a solr_curl * pointer */ /* {{{ int solr_curl_debug_callback(CURL *curl_handle, curl_infotype infotype, solr_char_t *debug_data, size_t size, void *ctx) */ int solr_curl_debug_callback(CURL *curl_handle, curl_infotype infotype, solr_char_t *debug_data, size_t size, void *ctx) { solr_curl_t *sch = (solr_curl_t *) ctx; /* TODO : Check why this function is still called after destructor has been called */ if (!sch->handle_status) { return 0; } switch(infotype) { case CURLINFO_HEADER_OUT : /* Capture the Actual Request Headers Sent to Server */ { solr_string_appends(&(sch->request_header.buffer), debug_data, size); } break; case CURLINFO_DATA_OUT : /* Capture the Actual Request Body Sent to Server */ { solr_string_appends(&(sch->request_body_debug.buffer), debug_data, size); } break; default : { /* do nothing */ } break; } /* Captures ALL debug information */ solr_string_appends(&(sch->debug_data_buffer), debug_data, size); return 0; } /* }}} */ /* {{{ PHP_SOLR_API int solr_make_request(solr_client_t *client, solr_request_type_t request_type TSRMLS_DC) */ PHP_SOLR_API int solr_make_request(solr_client_t *client, solr_request_type_t request_type TSRMLS_DC) { solr_curl_t *sch = &(client->handle); solr_client_options_t *options = &(client->options); solr_http_header_list_t *header_list = NULL; int return_status = SUCCESS; CURLcode info_status = CURLE_OK; header_list = curl_slist_append(header_list, "Accept-Charset: utf-8"); header_list = curl_slist_append(header_list, "Keep-Alive: 300"); header_list = curl_slist_append(header_list, "Connection: keep-alive"); /* Disable the Expect: 100-continue header. Jetty gets confused with this header */ header_list = curl_slist_append(header_list, "Expect:"); /* Reset the buffers */ solr_string_free(&sch->request_header.buffer); solr_string_free(&sch->request_body_debug.buffer); solr_string_free(&sch->response_body.buffer); solr_string_free(&sch->response_header.buffer); solr_string_free(&sch->debug_data_buffer); curl_easy_reset(sch->curl_handle); solr_set_initial_curl_handle_options(&(sch), options TSRMLS_CC); /* Reset the CURL options if the handle is reused */ curl_easy_setopt(sch->curl_handle, CURLOPT_HEADER, 0L); curl_easy_setopt(sch->curl_handle, CURLOPT_POST, 0L); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPGET, 0L); curl_easy_setopt(sch->curl_handle, CURLOPT_NOBODY, 0L); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDSIZE, 0L); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDS, NULL); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, NULL); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, NULL); switch(request_type) { case SOLR_REQUEST_SEARCH : /* HTTP FORM POST */ { header_list = curl_slist_append(header_list, "Content-Type: application/x-www-form-urlencoded;charset=UTF-8"); curl_easy_setopt(sch->curl_handle, CURLOPT_POST, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->search_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDSIZE, sch->request_body.buffer.len); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDS, sch->request_body.buffer.str); } break; case SOLR_REQUEST_TERMS : /* HTTP FORM POST */ { header_list = curl_slist_append(header_list, "Content-Type: application/x-www-form-urlencoded;charset=UTF-8"); curl_easy_setopt(sch->curl_handle, CURLOPT_POST, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->terms_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDSIZE, sch->request_body.buffer.len); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDS, sch->request_body.buffer.str); } break; case SOLR_REQUEST_UPDATE : /* HTTP XML POST */ { header_list = curl_slist_append(header_list, "Content-Type: text/xml;charset=UTF-8"); curl_easy_setopt(sch->curl_handle, CURLOPT_POST, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->update_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDSIZE, sch->request_body.buffer.len); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDS, sch->request_body.buffer.str); } break; case SOLR_REQUEST_THREADS : /* HTTP GET */ { curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPGET, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->thread_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); } break; case SOLR_REQUEST_PING : /* HTTP HEAD REQUEST. */ { curl_easy_setopt(sch->curl_handle, CURLOPT_HEADER, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_NOBODY, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->ping_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); } break; case SOLR_REQUEST_SYSTEM: /* HTTP GET to fetch system info */ { curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPGET, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->system_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); } break; case SOLR_REQUEST_GET: solr_string_appendc(&(options->get_url), '&'); solr_string_append_solr_string(&(options->get_url), &(sch->request_body.buffer)); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPGET, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->get_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); break; default : { return_status = FAILURE; } break; } sch->result_code = curl_easy_perform(sch->curl_handle); info_status = curl_easy_getinfo(sch->curl_handle, CURLINFO_RESPONSE_CODE, &(sch->response_header.response_code)); if (info_status != CURLE_OK) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "HTTP Transfer status could not be retrieved successfully"); return_status = FAILURE; } if (sch->result_code != CURLE_OK) { /* commented by: Omar Shaban */ /* php_error_docref(NULL TSRMLS_CC, E_WARNING, "Solr HTTP Error : '%s' ", curl_easy_strerror(sch->result_code)); */ solr_throw_exception_ex(solr_ce_SolrClientException, SOLR_ERROR_1004 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Solr HTTP Error %d: '%s' ",sch->result_code, curl_easy_strerror(sch->result_code)); return_status = FAILURE; } if (sch->response_header.response_code != 200L) { return_status = FAILURE; } curl_slist_free_all(header_list); return return_status; } /* }}} */ /** Deallocates memory associated with the Solr CURL Handle. **/ /* {{{ PHP_SOLR_API void solr_free_handle(solr_curl_t *sch) */ PHP_SOLR_API void solr_free_handle(solr_curl_t *sch) { solr_string_free(&((sch)->request_header.buffer)); solr_string_free(&((sch)->request_body.buffer)); solr_string_free(&((sch)->request_body_debug.buffer)); solr_string_free(&((sch)->response_header.buffer)); solr_string_free(&((sch)->response_body.buffer)); solr_string_free(&((sch)->debug_data_buffer)); sch->handle_status = 0; curl_easy_cleanup((sch)->curl_handle); sch->curl_handle = NULL; } /* }}} */ /* {{{ PHP_SOLR_API void solr_free_options(solr_client_options_t *options) */ PHP_SOLR_API void solr_free_options(solr_client_options_t *options) { solr_string_free(&((options)->hostname)); solr_string_free(&((options)->http_auth_credentials)); solr_string_free(&((options)->path)); solr_string_free(&((options)->proxy_auth_credentials)); solr_string_free(&((options)->ssl_cert)); solr_string_free(&((options)->ssl_key)); solr_string_free(&((options)->ssl_keypassword)); solr_string_free(&((options)->ssl_cainfo)); solr_string_free(&((options)->ssl_capath)); solr_string_free(&((options)->proxy_hostname)); solr_string_free(&((options)->qs_delimiter)); solr_string_free(&((options)->response_writer)); solr_string_free(&((options)->update_url)); solr_string_free(&((options)->search_url)); solr_string_free(&((options)->thread_url)); solr_string_free(&((options)->ping_url)); solr_string_free(&((options)->terms_url)); solr_string_free(&((options)->system_url)); solr_string_free(&((options)->get_url)); solr_string_free(&((options)->update_servlet)); solr_string_free(&((options)->search_servlet)); solr_string_free(&((options)->thread_servlet)); solr_string_free(&((options)->ping_servlet)); solr_string_free(&((options)->terms_servlet)); solr_string_free(&((options)->system_servlet)); solr_string_free(&((options)->get_servlet)); } /* }}} */ /* {{{ PHP_SOLR_API void solr_destroy_client(void *client) */ PHP_SOLR_API void solr_destroy_client(void *client) { solr_client_t *solr_client = (solr_client_t *) client; if (solr_client) { solr_free_options(&(solr_client->options)); solr_free_handle(&(solr_client->handle)); solr_client = NULL; } } /* }}} */ /* {{{ PHP_SOLR_API int solr_get_xml_error(solr_string_t buffer, solr_exception_t *exceptionData TSRMLS_DC) */ PHP_SOLR_API int solr_get_xml_error(solr_string_t buffer, solr_exception_t *exceptionData TSRMLS_DC) { xmlDoc *doc = xmlReadMemory((const char *)buffer.str, buffer.len, NULL, "UTF-8", XML_PARSE_RECOVER); xmlXPathContext *xpathContext = NULL; xmlXPathObject *xpathObject = NULL; xmlChar *xpathExpression = (unsigned char *)"/response/lst[@name='error']"; xmlNode * nodeCurser; const unsigned char * nodePropName = (const unsigned char *)"name"; if (!doc) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error loading XML document"); return 1; } /* Create xpath evaluation context */ xpathContext = xmlXPathNewContext(doc); if(xpathContext == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error creating xml xpath context"); xmlFreeDoc(doc); return 1; } /* Evaluate xpath expression */ xpathObject = xmlXPathEvalExpression(xpathExpression, xpathContext); if(xpathObject == NULL){ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error evaluating xml xpath expression"); xmlFreeDoc(doc); return 1; } if(!xpathObject->nodesetval){ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Xpath Error: no elements found"); xmlXPathFreeObject(xpathObject); xmlFreeDoc(doc); return 1; } nodeCurser = xpathObject->nodesetval->nodeTab[0]->children; while (nodeCurser != NULL) { if (xmlHasProp(nodeCurser, nodePropName)) { if (strcmp((const char *)xmlGetProp(nodeCurser,nodePropName), (const char *)"msg") == 0) { exceptionData->message = (solr_char_t *)estrdup((const char *)nodeCurser->children->content); } else if(strcmp((const char *)xmlGetProp(nodeCurser,nodePropName),"code") == 0) { exceptionData->code = atoi((const char *)nodeCurser->children->content); } else if(strcmp( (const char *)xmlGetProp(nodeCurser, nodePropName), (const char *) "trace") == 0) { exceptionData->message = (solr_char_t *)estrdup((const char *)nodeCurser->children->content); } } nodeCurser = nodeCurser->next; } xmlXPathFreeObject(xpathObject); xmlXPathFreeContext(xpathContext); xmlFreeDoc(doc); return 0; } /* }}} */ /* {{{ PHP_SOLR_API int hydrate_error_zval(zval *response, solr_exception_t *exceptionData TSRMLS_DC) */ PHP_SOLR_API int hydrate_error_zval(zval *response, solr_exception_t *exceptionData TSRMLS_DC) { char * key = "error"; int keyLen = 5; zval **errorPP = (zval **) NULL, *errorP; zval **msgZvalPP=(zval **) NULL, **codeZval = (zval **) NULL; if ( zend_hash_find( Z_ARRVAL_P(response), key, keyLen+1, (void **) &errorPP) == SUCCESS) { errorP = *errorPP; if (zend_hash_exists(HASH_OF(errorP), "msg", sizeof("msg"))) { if (zend_hash_find(Z_ARRVAL_P(errorP), "msg", sizeof("msg"), (void **) &msgZvalPP) == SUCCESS) { exceptionData->message = (solr_char_t *)estrdup(Z_STRVAL(**msgZvalPP)); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Undefined variable: %s", "msg"); return 1; } } else if (zend_hash_exists(HASH_OF(errorP), "trace", sizeof("trace"))) { if (zend_hash_find(Z_ARRVAL_P(errorP), "trace", sizeof("trace"), (void **) &msgZvalPP) == SUCCESS) { exceptionData->message = (solr_char_t *)estrdup(Z_STRVAL(**msgZvalPP)); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Undefined variable: %s", "trace"); return 1; } } else{ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unable to find %s in error response zval", "message or trace" ); return 1; } if (zend_hash_find(Z_ARRVAL_P(errorP), "code", sizeof("code"), (void **) &codeZval) == SUCCESS) { exceptionData->code = (int)Z_LVAL_PP(codeZval); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unable to find element with key %s in error response zval","code" ); return 1; } } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unable to find %s in error response", "error element" ); return 1; } return 0; } /* }}} */ /* {{{ PHP_SOLR_API int solr_get_json_error(solr_string_t buffer, solr_exception_t *exceptionData TSRMLS_DC) */ PHP_SOLR_API int solr_get_json_error(solr_string_t buffer, solr_exception_t *exceptionData TSRMLS_DC) { zval *jsonResponse; zval *errorP; zval **errorPP=(zval **)NULL,**msgZvalPP=(zval **)NULL,**codeZval=(zval **)NULL; HashTable *errorHashTable; char * key = "error"; int keyLen = 5; long nSize = 1000; MAKE_STD_ZVAL(jsonResponse); php_json_decode(jsonResponse, (char *) buffer.str, buffer.len, 1, 1024L TSRMLS_CC); if (Z_TYPE_P(jsonResponse) == IS_NULL) { zval_ptr_dtor(&jsonResponse); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to parse Solr Server Error Response. JSON serialization error"); return 1; } ALLOC_HASHTABLE(errorHashTable); zend_hash_init(errorHashTable, nSize, NULL, NULL, 0); if( zend_hash_find( Z_ARRVAL_P(jsonResponse), key, keyLen+1, (void **) &errorPP) == SUCCESS) { errorP = *errorPP; if (zend_hash_find(Z_ARRVAL_P(errorP), "code", sizeof("code"), (void **) &codeZval) == SUCCESS) { exceptionData->code = (int)Z_LVAL_PP(codeZval); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unable to find %s in json error response","code" ); } if(zend_hash_exists(HASH_OF(errorP), "msg", sizeof("msg"))) { if(zend_hash_find(Z_ARRVAL_P(errorP), "msg", sizeof("msg"), (void **) &msgZvalPP) == SUCCESS) { exceptionData->message = (solr_char_t *)estrdup(Z_STRVAL(**msgZvalPP)); } } else if (!exceptionData->message && zend_hash_exists(HASH_OF(errorP), "trace", sizeof("trace"))) { if(zend_hash_find(Z_ARRVAL_P(errorP), "trace", sizeof("trace"), (void **) &msgZvalPP) == SUCCESS) { exceptionData->message = (solr_char_t *)estrdup(Z_STRVAL(**msgZvalPP)); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Undefined variable: %s","trace" ); } } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unable to find %s in error response zval","message" ); return 1; } }else{ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Undefined variable: %s",key ); } zval_ptr_dtor(&jsonResponse); zend_hash_destroy(errorHashTable); FREE_HASHTABLE(errorHashTable); return 0; } /* }}} */ /* {{{ PHP_SOLR_API int solr_get_phpnative_error(solr_string_t buffer, solr_exception_t *exceptionData TSRMLS_DC) */ PHP_SOLR_API int solr_get_phpnative_error(solr_string_t buffer, solr_exception_t *exceptionData TSRMLS_DC) { zval * response_obj; php_unserialize_data_t var_hash; const unsigned char * raw_resp = (const unsigned char *) buffer.str; const unsigned char * str_end = (const unsigned char *) (buffer.str + buffer.len); ALLOC_INIT_ZVAL(response_obj); PHP_VAR_UNSERIALIZE_INIT(var_hash); if(!php_var_unserialize(&response_obj, &raw_resp, str_end, &var_hash TSRMLS_CC)) { /* There is a known issue, that solr responses will not always be * with the dictated response format, as jetty or tomcat may return errors in their format */ PHP_VAR_UNSERIALIZE_DESTROY(var_hash); zval_ptr_dtor(&response_obj); return 1; } hydrate_error_zval(response_obj, exceptionData TSRMLS_CC); PHP_VAR_UNSERIALIZE_DESTROY(var_hash); zval_ptr_dtor(&response_obj); return 0; } /* }}} */ /* {{{ PHP_SOLR_API void solr_throw_solr_server_exception(solr_client_t *client,const char * requestType TSRMLS_DC) parse the solr server response and throw a SolrServerException */ PHP_SOLR_API void solr_throw_solr_server_exception(solr_client_t *client,const char * requestType TSRMLS_DC) { const char * response_writer = (char *) client->options.response_writer.str; solr_exception_t *exceptionData; exceptionData = (solr_exception_t*) emalloc(sizeof(solr_exception_t )); exceptionData->code = 0; memset(exceptionData, 0, sizeof(solr_exception_t)); if( 0 == strcmp(response_writer, SOLR_XML_RESPONSE_WRITER)){ if(solr_get_xml_error(client->handle.response_body.buffer, exceptionData TSRMLS_CC) != SUCCESS) { /* fallback to normal exception */ solr_throw_exception_ex(solr_ce_SolrClientException, SOLR_ERROR_1010 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1010_MSG, requestType, SOLR_RESPONSE_CODE_BODY); return; } } if( 0 == strcmp(response_writer, SOLR_JSON_RESPONSE_WRITER)) { if(solr_get_json_error(client->handle.response_body.buffer, exceptionData TSRMLS_CC) != SUCCESS) { solr_throw_exception_ex(solr_ce_SolrClientException, SOLR_ERROR_1010 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1010_MSG, requestType, SOLR_RESPONSE_CODE_BODY); } } if( 0 == strcmp(response_writer, SOLR_PHP_NATIVE_RESPONSE_WRITER) || 0 == strcmp(response_writer, SOLR_PHP_SERIALIZED_RESPONSE_WRITER)) { if(solr_get_phpnative_error(client->handle.response_body.buffer,exceptionData TSRMLS_CC) != SUCCESS) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unable to parse serialized php response" ); } } if(exceptionData->code == 0){ solr_throw_exception_ex(solr_ce_SolrClientException, SOLR_ERROR_1010 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1010_MSG, requestType, SOLR_RESPONSE_CODE_BODY); }else if (exceptionData->code > 0 && exceptionData->message){ solr_throw_exception_ex(solr_ce_SolrServerException, exceptionData->code TSRMLS_CC, SOLR_FILE_LINE_FUNC, exceptionData->message); } else { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to parse solr exception message, Internal Error" ); } if(exceptionData->message != NULL) { efree(exceptionData->message); } efree(exceptionData); } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/solr_functions_debug.c000066400000000000000000000110641374041537100233710ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Omar Shaban | | Israel Ekpo | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ void solr_debug_printf(const char *format, ...) */ PHP_SOLR_API void solr_debug_printf(const char *format, ...) { #ifdef SOLR_DEBUG va_list args; va_start(args,format); vprintf(format,args); va_end(args); #endif } /* }}} */ /* {{{ void solr_debug_print_fields(const solr_field_list_t *field_list) */ PHP_SOLR_API void solr_debug_print_fields(const solr_field_list_t *field_list) { /* Used to debug field inserted */ } /* }}} */ /** * print_xpath_nodes: * @nodes: the nodes set. * @output: the output file handle. * * Prints the @nodes content to @output. */ /* {{{ void print_xpath_nodes(xmlNodeSetPtr nodes, FILE* output) */ PHP_SOLR_API void print_xpath_nodes(xmlNodeSetPtr nodes, FILE* output) { xmlNodePtr cur; int size; int i; assert(output); size = (nodes) ? nodes->nodeNr : 0; fprintf(output, "Result (%d nodes):\n", size); for(i = 0; i < size; ++i) { assert(nodes->nodeTab[i]); if(nodes->nodeTab[i]->type == XML_NAMESPACE_DECL) { xmlNsPtr ns; ns = (xmlNsPtr)nodes->nodeTab[i]; cur = (xmlNodePtr)ns->next; if(cur->ns) { fprintf(output, "= namespace \"%s\"=\"%s\" for node %s:%s\n", ns->prefix, ns->href, cur->ns->href, cur->name); } else { fprintf(output, "= namespace \"%s\"=\"%s\" for node %s\n", ns->prefix, ns->href, cur->name); } } else if(nodes->nodeTab[i]->type == XML_ELEMENT_NODE) { cur = nodes->nodeTab[i]; if(cur->ns) { fprintf(output, "= element node \"%s:%s\"\n", cur->ns->href, cur->name); } else { fprintf(output, "= element node \"%s\"\n", cur->name); } } else { cur = nodes->nodeTab[i]; fprintf(output, "= node \"%s\": type %d\n", cur->name, cur->type); } } } /* }}} */ /* {{{ void print_children (xmlNode * node) */ PHP_SOLR_API void print_children (xmlNode * node) { fprintf(stdout,"\n================- start print children -=================\n"); while (node != NULL) { if(node->ns) { fprintf(stdout, "= element node \"%s:%s\"\n", node->ns->href,node->name); } else { fprintf(stdout, "= element node \"%s\"\n", node->name); } if(node->type == XML_ELEMENT_NODE){ xmlNode * cur2 = node->children; while (cur2 != NULL) { if(strcmp((const char *)cur2->name,"text")==0) { fprintf(stdout, "= element node \"%s\", text: %s\n",cur2->name,cur2->content); }else{ fprintf(stdout, "= element node \"%s\"\n", cur2->name); } cur2 = cur2->next; } } if(node->children != NULL) { print_children(node->children); } node = node->next; } fprintf(stdout,"\n======================- end -=====================\n"); } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/solr_functions_document.c000066400000000000000000000330721374041537100241240ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Israel Ekpo | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ void field_copy_constructor(solr_field_list_t **original_field_queue) */ PHP_SOLR_API void field_copy_constructor(solr_field_list_t **original_field_queue) { solr_field_list_t *new_field_queue = NULL; solr_field_value_t *ptr = (*original_field_queue)->head; if (ptr == NULL) { return; } new_field_queue = (solr_field_list_t *) pemalloc(sizeof(solr_field_list_t), SOLR_DOCUMENT_FIELD_PERSISTENT); new_field_queue->count = 0L; new_field_queue->field_name = (solr_char_t *) pestrdup((char *) (*original_field_queue)->field_name, SOLR_DOCUMENT_FIELD_PERSISTENT); new_field_queue->head = NULL; new_field_queue->last = NULL; new_field_queue->field_boost = (*original_field_queue)->field_boost; while(ptr != NULL) { solr_document_insert_field_value(new_field_queue, ptr->field_value, 0); ptr = ptr->next; } *original_field_queue = new_field_queue; } /* }}} */ /* {{{ PHP_SOLR_API solr_document_t *solr_init_document(long int document_index) * create and allocate a solr_document_t with the specified index */ PHP_SOLR_API solr_document_t *solr_init_document(long int document_index TSRMLS_DC) { solr_document_t *doc_entry = NULL, *doc_ptr = NULL; solr_document_t solr_doc; uint nSize = SOLR_INITIAL_HASH_TABLE_SIZE; memset(&solr_doc, 0, sizeof(solr_document_t)); doc_entry = &solr_doc; doc_entry->document_index = document_index; doc_entry->field_count = 0L; doc_entry->document_boost = 0.0f; /* Allocated memory for the fields HashTable using fast cache for HashTables */ ALLOC_HASHTABLE(doc_entry->fields); ALLOC_HASHTABLE(doc_entry->children); /* Initializing the hash table used for storing fields in this SolrDocument */ zend_hash_init(doc_entry->fields, nSize, NULL, (dtor_func_t) solr_destroy_field_list, SOLR_DOCUMENT_FIELD_PERSISTENT); zend_hash_init(doc_entry->children, nSize, NULL, ZVAL_PTR_DTOR, SOLR_DOCUMENT_FIELD_PERSISTENT); /* Let's check one more time before insert into the HashTable */ if (zend_hash_index_exists(SOLR_GLOBAL(documents), document_index)) { pefree(doc_entry->fields, SOLR_DOCUMENT_FIELD_PERSISTENT); zend_hash_destroy(doc_entry->children); pefree(doc_entry->fields, SOLR_DOCUMENT_FIELD_PERSISTENT); return NULL; } /* Add the document entry to the directory of documents */ zend_hash_index_update(SOLR_GLOBAL(documents), document_index, (void *) doc_entry, sizeof(solr_document_t), (void **) &doc_ptr); /* Keep track of how many SolrDocument instances we currently have */ SOLR_GLOBAL(document_count)++; return doc_ptr; } /* }}} */ /* {{{ PHP_SOLR_API int solr_document_insert_field_value(solr_field_list_t *queue, const solr_char_t *field_value, double field_boost) */ PHP_SOLR_API int solr_document_insert_field_value(solr_field_list_t *queue, const solr_char_t *field_value, double field_boost) { solr_field_value_t *new_entry = (solr_field_value_t *) pemalloc(sizeof(solr_field_value_t), SOLR_DOCUMENT_FIELD_PERSISTENT); if (new_entry == NULL) { return FAILURE; } new_entry->field_value = (solr_char_t *) pestrdup((char *) field_value, SOLR_DOCUMENT_FIELD_PERSISTENT); if (new_entry->field_value == NULL) { return FAILURE; } new_entry->next = NULL; if (queue->head == NULL) { /* This is the first and only item in the field list */ queue->head = new_entry; queue->last = new_entry; /* Update the field boost value */ if (field_boost > 0.0) { queue->field_boost = field_boost; } } else { /* There are already entries in the list. */ /* Append to the end of the queue */ queue->last->next = new_entry; /* Set the last item in the queue to the latest entry */ queue->last = new_entry; /* Update the field boost value */ if (field_boost > 0.0) { if (queue->field_boost > 0.0) { queue->field_boost *= field_boost; } else { queue->field_boost = field_boost; } } } queue->count++; return SUCCESS; } /* }}} */ /* {{{ void solr_destroy_document(void *document) */ PHP_SOLR_API void solr_destroy_document(void *document) { solr_document_t *doc_entry = (solr_document_t *) document; /* Release all the field_lists one at a time with solr_destroy_field_list */ zend_hash_destroy(doc_entry->fields); /* Deallocate memory for the fields HashTable */ pefree(doc_entry->fields, SOLR_DOCUMENT_FIELD_PERSISTENT); if (doc_entry->children) { zend_hash_destroy(doc_entry->children); pefree(doc_entry->children, SOLR_DOCUMENT_FIELD_PERSISTENT); } } /* }}} */ /* {{{ void solr_destroy_field_list(solr_field_list_t **field_entry_ptr) */ PHP_SOLR_API void solr_destroy_field_list(solr_field_list_t **field_entry_ptr) { solr_field_list_t *field_entry = *field_entry_ptr; solr_field_value_t *tmp = NULL; solr_field_value_t *current_field_value = field_entry->head; /* Go through the list and free all the values */ while(current_field_value != NULL) { tmp = current_field_value->next; pefree(current_field_value->field_value, SOLR_DOCUMENT_FIELD_PERSISTENT); pefree(current_field_value, SOLR_DOCUMENT_FIELD_PERSISTENT); current_field_value = tmp; } field_entry->head = NULL; field_entry->last = NULL; pefree(field_entry->field_name, SOLR_DOCUMENT_FIELD_PERSISTENT); pefree(field_entry, SOLR_DOCUMENT_FIELD_PERSISTENT); } /* }}} */ /* Comparison functions for field entries */ /* {{{ int solr_compare_field_name(const void *a, const void *b TSRMLS_DC) */ PHP_SOLR_API int solr_compare_field_name(const void *a, const void *b TSRMLS_DC) { const Bucket *x = *((Bucket **) a); const Bucket *y = *((Bucket **) b); const solr_field_list_t *first = *((solr_field_list_t **) x->pData); const solr_field_list_t *second = *((solr_field_list_t **) y->pData); const int diff = strcmp((char *) first->field_name, (char *) second->field_name); const int result = ((diff > 0) ? 1 : ((diff < 0) ? -1 : 0)); return result; } /* }}} */ /* {{{ int solr_rcompare_field_name(const void *a, const void *b TSRMLS_DC) */ PHP_SOLR_API int solr_rcompare_field_name(const void *a, const void *b TSRMLS_DC) { return (solr_compare_field_name(a, b TSRMLS_CC) * -1); } /* }}} */ /* {{{ int solr_compare_field_value_count(const void *a, const void *b TSRMLS_DC) */ PHP_SOLR_API int solr_compare_field_value_count(const void *a, const void *b TSRMLS_DC) { const Bucket *x = *((Bucket **) a); const Bucket *y = *((Bucket **) b); const solr_field_list_t *first = *((solr_field_list_t **) x->pData); const solr_field_list_t *second = *((solr_field_list_t **) y->pData); const int diff = first->count - second->count; const int result = ((diff > 0) ? 1 : ((diff < 0) ? -1 : 0)); return result; } /* }}} */ /* {{{ int solr_rcompare_field_value_count(const void *a, const void *b TSRMLS_DC) */ PHP_SOLR_API int solr_rcompare_field_value_count(const void *a, const void *b TSRMLS_DC) { return (solr_compare_field_value_count(a, b TSRMLS_CC) * -1); } /* }}} */ /* {{{ int solr_compare_field_boost_value(const void *a, const void *b TSRMLS_DC) */ PHP_SOLR_API int solr_compare_field_boost_value(const void *a, const void *b TSRMLS_DC) { const Bucket *x = *((Bucket **) a); const Bucket *y = *((Bucket **) b); const solr_field_list_t *first = *((solr_field_list_t **) x->pData); const solr_field_list_t *second = *((solr_field_list_t **) y->pData); const double diff = first->field_boost - second->field_boost; const int result = ((diff > 0.0) ? 1 : ((diff < 0.0) ? -1 : 0)); return result; } /* }}} */ /* {{{ int solr_rcompare_field_boost_value(const void *a, const void *b TSRMLS_DC) */ PHP_SOLR_API int solr_rcompare_field_boost_value(const void *a, const void *b TSRMLS_DC) { return (solr_compare_field_boost_value(a, b TSRMLS_CC) * -1); } /* }}} */ /* {{{ PHP_SOLR_API void solr_create_document_field_object(solr_field_list_t *field_values, zval **field_obj TSRMLS_DC) */ PHP_SOLR_API void solr_create_document_field_object(solr_field_list_t *field_values, zval **field_obj TSRMLS_DC) { zval *doc_field = *field_obj; zval *field_values_array = NULL; solr_field_value_t *curr_ptr = NULL; MAKE_STD_ZVAL(field_values_array); array_init(field_values_array); curr_ptr = field_values->head; while(curr_ptr != NULL) { solr_char_t *current_value = curr_ptr->field_value; add_next_index_string(field_values_array, current_value, 1); curr_ptr = curr_ptr->next; } object_init_ex(doc_field, solr_ce_SolrDocumentField); zend_update_property_string(solr_ce_SolrDocumentField, doc_field, SOLR_FIELD_NAME_PROPERTY_NAME, sizeof(SOLR_FIELD_NAME_PROPERTY_NAME)-1, field_values->field_name TSRMLS_CC); zend_update_property_double(solr_ce_SolrDocumentField, doc_field, SOLR_FIELD_BOOST_PROPERTY_NAME, sizeof(SOLR_FIELD_BOOST_PROPERTY_NAME)-1, field_values->field_boost TSRMLS_CC); zend_update_property(solr_ce_SolrDocumentField, doc_field, SOLR_FIELD_VALUES_PROPERTY_NAME, sizeof(SOLR_FIELD_VALUES_PROPERTY_NAME)-1, field_values_array TSRMLS_CC); zval_ptr_dtor(&field_values_array); Z_OBJ_HT_P(doc_field) = &solr_document_field_handlers; } /* }}} */ /* {{{ PHP_SOLR_API void solr_create_document_field_object(solr_field_list_t *field_values, zval **field_obj TSRMLS_DC) constructs the element when adding a document to the index */ PHP_SOLR_API void solr_add_doc_node(xmlNode *root_node, solr_document_t *doc_entry TSRMLS_DC) { HashTable *document_fields = NULL; xmlNode *solr_doc_node = NULL; document_fields = doc_entry->fields; solr_doc_node = xmlNewChild(root_node, NULL, (xmlChar *) "doc", NULL); if (doc_entry->document_boost > 0.0f) { auto char tmp_buffer[256]; /* Scratch pad for converting numeric values to strings */ memset(tmp_buffer, 0, sizeof(tmp_buffer)); php_gcvt(doc_entry->document_boost, EG(precision), '.', 'e' , (char *)tmp_buffer); xmlNewProp(solr_doc_node, (xmlChar *) "boost", (xmlChar *) tmp_buffer); } solr_generate_document_xml_from_fields(solr_doc_node, document_fields TSRMLS_CC); if (zend_hash_num_elements(doc_entry->children) > 0) { SOLR_HASHTABLE_FOR_LOOP(doc_entry->children) { zval **doc_obj = NULL; solr_document_t *child_doc_entry = NULL; zend_hash_get_current_data_ex(doc_entry->children, (void **)&doc_obj, ((HashPosition *)0)); if (solr_fetch_document_entry(*doc_obj, &child_doc_entry TSRMLS_CC) == SUCCESS) { solr_add_doc_node(solr_doc_node, child_doc_entry TSRMLS_CC); } } } } /* }}} */ /* {{{ static void solr_generate_document_xml_from_fields(xmlNode *solr_doc_node, HashTable *document_fields) */ PHP_SOLR_API void solr_generate_document_xml_from_fields(xmlNode *solr_doc_node, HashTable *document_fields TSRMLS_DC) { xmlDoc *doc_ptr = solr_doc_node->doc; SOLR_HASHTABLE_FOR_LOOP(document_fields) { solr_char_t *doc_field_name; solr_field_value_t *doc_field_value; solr_field_list_t **field = NULL; zend_bool is_first_value = 1; /* Turn on first value flag */ zend_hash_get_current_data_ex(document_fields, (void **) &field, ((HashPosition *)0)); doc_field_name = (*field)->field_name; doc_field_value = (*field)->head; /* Loop through all the values for this field */ while(doc_field_value != NULL) { xmlChar *escaped_field_value = xmlEncodeEntitiesReentrant(doc_ptr, (xmlChar *) doc_field_value->field_value); xmlNode *solr_field_node = xmlNewChild(solr_doc_node, NULL, (xmlChar *) "field", escaped_field_value); xmlNewProp(solr_field_node, (xmlChar *) "name", (xmlChar *) doc_field_name); /* Set the boost attribute if this is the first value */ if (is_first_value && (*field)->field_boost > 0.0f) { auto char tmp_boost_value_buffer[256]; memset(tmp_boost_value_buffer, 0, sizeof(tmp_boost_value_buffer)); php_gcvt((*field)->field_boost, EG(precision), '.', 'e' , tmp_boost_value_buffer); xmlNewProp(solr_field_node, (xmlChar *) "boost", (xmlChar *) tmp_boost_value_buffer); is_first_value = 0; /* Turn off the flag */ } /* Release the memory allocated by xmlEncodeEntitiesReentrant */ xmlFree(escaped_field_value); /* Grab the next value for this field if any */ doc_field_value = doc_field_value->next; } /* while(doc_field_value != NULL) */ } /* SOLR_HASHTABLE_FOR_LOOP(document_fields) */ } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/solr_functions_helpers.c000066400000000000000000001515631374041537100237560ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" #if !(PHP_MAJOR_VERSION==5 && PHP_MINOR_VERSION==2) ZEND_EXTERN_MODULE_GLOBALS(json) #endif /** ************************************************************************ **/ /** FUNCTIONS FOR DECLARING CONSTANTS **/ /** ************************************************************************ **/ /* {{{ void solr_extension_register_constants(int type, int module_number TSRMLS_DC) */ PHP_SOLR_API void solr_extension_register_constants(int type, int module_number TSRMLS_DC) { REGISTER_LONG_CONSTANT("SOLR_MAJOR_VERSION", PHP_SOLR_MAJOR_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SOLR_MINOR_VERSION", PHP_SOLR_MINOR_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SOLR_PATCH_VERSION", PHP_SOLR_PATCH_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("SOLR_EXTENSION_VERSION", PHP_SOLR_DOTTED_VERSION, CONST_CS | CONST_PERSISTENT); } /* }}} */ /* {{{ void solr_document_register_class_constants(zend_class_entry * ce TSRMLS_DC) */ PHP_SOLR_API void solr_document_register_class_constants(zend_class_entry *ce TSRMLS_DC) { zend_declare_class_constant_long(ce, "SORT_DEFAULT", sizeof("SORT_DEFAULT")-1, SOLR_SORT_ASC TSRMLS_CC); zend_declare_class_constant_long(ce, "SORT_ASC", sizeof("SORT_ASC")-1, SOLR_SORT_ASC TSRMLS_CC); zend_declare_class_constant_long(ce, "SORT_DESC", sizeof("SORT_DESC")-1, SOLR_SORT_DESC TSRMLS_CC); zend_declare_class_constant_long(ce, "SORT_FIELD_NAME", sizeof("SORT_FIELD_NAME")-1, SOLR_SORT_FIELD_NAME TSRMLS_CC); zend_declare_class_constant_long(ce, "SORT_FIELD_VALUE_COUNT", sizeof("SORT_FIELD_VALUE_COUNT")-1, SOLR_SORT_FIELD_VALUE_COUNT TSRMLS_CC); zend_declare_class_constant_long(ce, "SORT_FIELD_BOOST_VALUE", sizeof("SORT_FIELD_BOOST_VALUE")-1, SOLR_SORT_FIELD_BOOST_VALUE TSRMLS_CC); } /* }}} */ /* {{{ void solr_collapse_function_register_class_constants(zend_class_entry * ce TSRMLS_DC) */ PHP_SOLR_API void solr_collapse_function_register_class_constants(zend_class_entry *ce TSRMLS_DC) { zend_declare_class_constant_string(ce, "NULLPOLICY_IGNORE", sizeof("NULLPOLICY_IGNORE")-1, "ignore" TSRMLS_CC); zend_declare_class_constant_string(ce, "NULLPOLICY_EXPAND", sizeof("NULLPOLICY_EXPAND")-1, "expand" TSRMLS_CC); zend_declare_class_constant_string(ce, "NULLPOLICY_COLLAPSE", sizeof("NULLPOLICY_COLLAPSE")-1, "collapse" TSRMLS_CC); } /* }}} */ /* {{{ void solr_client_register_class_constants(zend_class_entry *ce TSRMLS_DC) */ PHP_SOLR_API void solr_client_register_class_constants(zend_class_entry *ce TSRMLS_DC) { zend_declare_class_constant_long(ce, "SEARCH_SERVLET_TYPE", sizeof("SEARCH_SERVLET_TYPE")-1, SOLR_SERVLET_TYPE_SEARCH TSRMLS_CC); zend_declare_class_constant_long(ce, "UPDATE_SERVLET_TYPE", sizeof("UPDATE_SERVLET_TYPE")-1, SOLR_SERVLET_TYPE_UPDATE TSRMLS_CC); zend_declare_class_constant_long(ce, "THREADS_SERVLET_TYPE", sizeof("THREADS_SERVLET_TYPE")-1, SOLR_SERVLET_TYPE_THREADS TSRMLS_CC); zend_declare_class_constant_long(ce, "PING_SERVLET_TYPE", sizeof("PING_SERVLET_TYPE")-1, SOLR_SERVLET_TYPE_PING TSRMLS_CC); zend_declare_class_constant_long(ce, "TERMS_SERVLET_TYPE", sizeof("TERMS_SERVLET_TYPE")-1, SOLR_SERVLET_TYPE_TERMS TSRMLS_CC); zend_declare_class_constant_long(ce, "SYSTEM_SERVLET_TYPE", sizeof("SYSTEM_SERVLET_TYPE")-1, SOLR_SERVLET_TYPE_SYSTEM TSRMLS_CC); zend_declare_class_constant_string(ce, "DEFAULT_SEARCH_SERVLET", sizeof("DEFAULT_SEARCH_SERVLET")-1, SOLR_DEFAULT_SEARCH_SERVLET TSRMLS_CC); zend_declare_class_constant_string(ce, "DEFAULT_UPDATE_SERVLET", sizeof("DEFAULT_UPDATE_SERVLET")-1, SOLR_DEFAULT_UPDATE_SERVLET TSRMLS_CC); zend_declare_class_constant_string(ce, "DEFAULT_THREADS_SERVLET", sizeof("DEFAULT_THREADS_SERVLET")-1, SOLR_DEFAULT_THREADS_SERVLET TSRMLS_CC); zend_declare_class_constant_string(ce, "DEFAULT_PING_SERVLET", sizeof("DEFAULT_PING_SERVLET")-1, SOLR_DEFAULT_PING_SERVLET TSRMLS_CC); zend_declare_class_constant_string(ce, "DEFAULT_TERMS_SERVLET", sizeof("DEFAULT_TERMS_SERVLET")-1, SOLR_DEFAULT_TERMS_SERVLET TSRMLS_CC); zend_declare_class_constant_string(ce, "DEFAULT_SYSTEM_SERVLET", sizeof("DEFAULT_SYSTEM_SERVLET")-1, SOLR_DEFAULT_SYSTEM_SERVLET TSRMLS_CC); } /* }}} */ /* {{{ void solr_response_register_class_properties(zend_class_entry *ce TSRMLS_DC) */ PHP_SOLR_API void solr_response_register_class_properties(zend_class_entry *ce TSRMLS_DC) { zend_declare_property_long(ce, "http_status", sizeof("http_status")-1, 0L, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_long(ce, "parser_mode", sizeof("parser_mode")-1, 0L, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_bool(ce, "success", sizeof("success")-1, 0L, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, "response_writer", sizeof("response_writer")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, "http_status_message", sizeof("http_status_message")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, "http_request_url", sizeof("http_request_url")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, "http_raw_request_headers", sizeof("http_raw_request_headers")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, "http_raw_request", sizeof("http_raw_request")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, "http_raw_response_headers", sizeof("http_raw_response_headers")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, "http_raw_response", sizeof("http_raw_response")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, "http_digested_response", sizeof("http_digested_response")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED TSRMLS_CC); } /* }}} */ /* {{{ void solr_exception_register_class_properties(zend_class_entry *ce TSRMLS_DC) */ PHP_SOLR_API void solr_exception_register_class_properties(zend_class_entry *ce TSRMLS_DC) { zend_declare_property_long(ce, SOLR_SOURCELINE_NO_PROPERTY_NAME, sizeof(SOLR_SOURCELINE_NO_PROPERTY_NAME)-1, __LINE__, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, SOLR_SOURCEFILE_PROPERTY_NAME, sizeof(SOLR_SOURCEFILE_PROPERTY_NAME)-1, __FILE__, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, SOLR_ZIFNAME_PROPERTY_NAME, sizeof(SOLR_ZIFNAME_PROPERTY_NAME)-1, (char *) __func__, ZEND_ACC_PROTECTED TSRMLS_CC); } /* }}} */ /* {{{ void solr_response_register_class_constants(zend_class_entry *ce TSRMLS_DC) */ PHP_SOLR_API void solr_response_register_class_constants(zend_class_entry *ce TSRMLS_DC) { zend_declare_class_constant_long(ce, "PARSE_SOLR_OBJ", sizeof("PARSE_SOLR_OBJ")-1, 0L TSRMLS_CC); zend_declare_class_constant_long(ce, "PARSE_SOLR_DOC", sizeof("PARSE_SOLR_DOC")-1, 1L TSRMLS_CC); } /* }}} */ /* {{{ void solr_query_register_class_constants(zend_class_entry *ce TSRMLS_DC) */ PHP_SOLR_API void solr_query_register_class_constants(zend_class_entry *ce TSRMLS_DC) { zend_declare_class_constant_long(ce, "ORDER_ASC", sizeof("ORDER_ASC")-1, SOLR_SORT_DIR_ASC TSRMLS_CC); zend_declare_class_constant_long(ce, "ORDER_DESC", sizeof("ORDER_DESC")-1, SOLR_SORT_DIR_DESC TSRMLS_CC); zend_declare_class_constant_long(ce, "FACET_SORT_INDEX", sizeof("FACET_SORT_INDEX")-1, 0L TSRMLS_CC); zend_declare_class_constant_long(ce, "FACET_SORT_COUNT", sizeof("FACET_SORT_COUNT")-1, 1L TSRMLS_CC); zend_declare_class_constant_long(ce, "TERMS_SORT_INDEX", sizeof("TERMS_SORT_INDEX")-1, 0L TSRMLS_CC); zend_declare_class_constant_long(ce, "TERMS_SORT_COUNT", sizeof("TERMS_SORT_COUNT")-1, 1L TSRMLS_CC); } /* }}} */ /** ************************************************************************ **/ /** FUNCTIONS FOR REFERENCE COUNT MANAGEMENT **/ /** ************************************************************************ **/ /** {{{ void solr_zval_add_ref(zval **p) */ PHP_SOLR_API void solr_zval_add_ref(zval **p) { Z_ADDREF_PP(p); } /* }}} */ /** {{{ void solr_zval_minus_ref(zval **p) */ PHP_SOLR_API void solr_zval_minus_ref(zval **p) { Z_DELREF_PP(p); } /* }}} */ /** ************************************************************************ **/ /** UTILITY FUNCTIONS **/ /** ************************************************************************ **/ /* {{{ int solr_hashtable_get_new_index(HashTable *ht TSRMLS_DC) Retrieves a unique index for this HashTable */ PHP_SOLR_API int solr_hashtable_get_new_index(HashTable *ht TSRMLS_DC) { int new_index = SOLR_GET_RANDOM_NUMBER(); /* If the key already exists in the HashTable, create another one. */ while(zend_hash_index_exists(ht, new_index)) { new_index = SOLR_GET_RANDOM_NUMBER(); } return new_index; } /* }}} */ /* {{{ static inline int solr_fetch_document_entry(zval *objptr, solr_document_t **doc_entry TSRMLS_DC) Retrieves a Document from the HashTable */ PHP_SOLR_API int solr_fetch_document_entry(zval *objptr, solr_document_t **doc_entry TSRMLS_DC) { zval *id = zend_read_property(Z_OBJCE_P(objptr), objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, 1 TSRMLS_CC); /* Retrieving the value of the document index from the zval */ long int document_index = Z_LVAL_P(id); *doc_entry = NULL; /* Retrieve the doc_entry from the HashTable */ if (zend_hash_index_find(SOLR_GLOBAL(documents), document_index, (void **) doc_entry) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Document Index %ld. HashTable index does not exist.", document_index); php_error_docref(NULL TSRMLS_CC, E_WARNING, SOLR_ERROR_1008_MSG, SOLR_FILE_LINE_FUNC); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_fetch_client_entry(zval *objptr, solr_client_t **solr_client TSRMLS_DC) */ PHP_SOLR_API int solr_fetch_client_entry(zval *objptr, solr_client_t **solr_client TSRMLS_DC) { zval *id = zend_read_property(solr_ce_SolrClient, objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, 1 TSRMLS_CC); /* Retrieving the value of the client index from the zval */ long int client_index = Z_LVAL_P(id); *solr_client = NULL; /* Retrieve the doc_entry from the HashTable */ if (zend_hash_index_find(SOLR_GLOBAL(clients), client_index, (void **) solr_client) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid SolrClient Index %ld. HashTable index does not exist.", client_index); php_error_docref(NULL TSRMLS_CC, E_WARNING, SOLR_ERROR_1008_MSG, SOLR_FILE_LINE_FUNC); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_fetch_params_entry(zval *objptr, solr_params_t **solr_params TSRMLS_DC) */ PHP_SOLR_API int solr_fetch_params_entry(zval *objptr, solr_params_t **solr_params TSRMLS_DC) { zval *id = zend_read_property(Z_OBJCE_P(objptr), objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, 1 TSRMLS_CC); long int params_index = Z_LVAL_P(id); *solr_params = NULL; if (zend_hash_index_find(SOLR_GLOBAL(params), params_index, (void **) solr_params) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid SolrParams Index %ld. HashTable index does not exist.", params_index); php_error_docref(NULL TSRMLS_CC, E_WARNING, SOLR_ERROR_1008_MSG, SOLR_FILE_LINE_FUNC); return FAILURE; } return SUCCESS; } /* }}} */ PHP_SOLR_API int solr_fetch_function_entry(zval *objptr, solr_function_t **solr_function TSRMLS_DC) { zval *id = zend_read_property(Z_OBJCE_P(objptr), objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, 1 TSRMLS_CC); long int params_index = Z_LVAL_P(id); *solr_function = NULL; if (zend_hash_index_find(SOLR_GLOBAL(functions), params_index, (void **) solr_function) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid solr_function Index %ld. HashTable index does not exist.", params_index); php_error_docref(NULL TSRMLS_CC, E_WARNING, SOLR_ERROR_1008_MSG, SOLR_FILE_LINE_FUNC); return FAILURE; } return SUCCESS; } /* {{{ PHP_SOLR_API void solr_destroy_function(void *solr_function) */ PHP_SOLR_API void solr_destroy_function(void *solr_function) { solr_function_t *function = (solr_function_t *) solr_function; zend_hash_destroy(function->params); pefree(function->params, SOLR_FUNCTIONS_PERSISTENT); } /* }}} */ /* {{{ PHP_SOLR_API xmlDocPtr solr_xml_create_xml_doc(const xmlChar *root_node_name, xmlNode **root_node_ptr) */ PHP_SOLR_API xmlDocPtr solr_xml_create_xml_doc(const xmlChar *root_node_name, xmlNode **root_node_ptr) { xmlNs *ns = NULL; xmlDoc *doc_ptr = xmlNewDoc((xmlChar *) "1.0"); xmlNode *root_node = xmlNewNode(ns, root_node_name); xmlDocSetRootElement(doc_ptr, root_node); if (root_node_ptr) { *root_node_ptr = root_node; } return doc_ptr; } /* }}} */ /** * escapes strings with characters that are part of the Lucene query syntax * * @sbuilder is a solr_string_t pointer used to store the escape char sequence * @unescaped is the unescaped string. It must be null terminated * @unescaped_length is the original length of the unescaped_string */ /* {{{ PHP_SOLR_API void solr_escape_query_chars(solr_string_t *sbuilder, solr_char_t *unescaped, long int unescaped_length) */ PHP_SOLR_API void solr_escape_query_chars(solr_string_t *sbuilder, solr_char_t *unescaped, long int unescaped_length) { register int i = 0; /** * Lucene supports escaping special characters that are part of the query syntax. * * The current list special characters are * + - && || ! ( ) { } [ ] ^ " ~ * ? : \ / * * These characters are part of the query syntax and must be escaped */ for (i = 0; i < unescaped_length; i++) { enter_switchboard : switch(unescaped[i]) { case '\\' : case '+' : case '-' : case '!' : case '(' : case ')' : case ':' : case '/' : case '^' : case '[' : case ']' : case '"' : case '{' : case '}' : case '~' : case '*' : case '?' : case ';' : { solr_string_appendc(sbuilder, '\\'); } break; case '|' : /* || */ { if ('|' == unescaped[i+1]) { solr_string_appendc(sbuilder, '\\'); solr_string_append_const(sbuilder, "||"); i += 2; goto enter_switchboard; } } break; case '&' : /* && */ { if ('&' == unescaped[i+1]) { solr_string_appendc(sbuilder, '\\'); solr_string_append_const(sbuilder, "&&"); i += 2; goto enter_switchboard; } } break; default : /* The current character is not a special character */ { /* Do nothing. Just append the character as is */ } } /* END switch(unescaped[i]) */ solr_string_appendc(sbuilder, unescaped[i]); } /* END for (i = 0; i < unescaped_length; i++) { */ } /* }}} */ /******************************************************************************/ /* SOLR XML RESPONSE DIGEST DATA TYPES AND FUNCTIONS */ /******************************************************************************/ /* {{{ solr_doc_encode_t, solr_php_encode_t, solr_encoding_type_t, solr_php_encode_func_t, solr_document_field_encode_func_t */ typedef enum { SOLR_DOC_ENCODE_START = 0, SOLR_DOC_ENCODE_FIELDS = 1, SOLR_DOC_ENCODE_FIELD = 2, SOLR_DOC_ENCODE_END } solr_doc_encode_t; typedef enum { SOLR_ENCODE_START = 0, SOLR_ENCODE_NULL = 1, SOLR_ENCODE_BOOL = 2, SOLR_ENCODE_INT = 3, SOLR_ENCODE_FLOAT = 4, SOLR_ENCODE_STRING = 5, SOLR_ENCODE_ARRAY = 6, SOLR_ENCODE_OBJECT = 7, SOLR_ENCODE_DOC = 8, SOLR_ENCODE_RESULT = 9, SOLR_ENCODE_END } solr_php_encode_t; typedef enum { SOLR_ENCODE_STANDALONE = 0, SOLR_ENCODE_OBJECT_PROPERTY = 1, SOLR_ENCODE_ARRAY_KEY = 2, SOLR_ENCODE_ARRAY_INDEX = 3 } solr_encoding_type_t; typedef void (*solr_php_encode_func_t)(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); typedef void (*solr_document_field_encode_func_t)(const xmlNode *node, xmlNode *field); /* }}} */ /* {{{ Macros for XML transcoding */ /* Serializes the current XML node */ #define solr_encode_xml_node(__node, __buf, __enc_type, __arr_idx, __mode) solr_encoder_functions[solr_get_xml_type((__node))]((__node),(__buf), (__enc_type), (__arr_idx), (__mode)) #define solr_write_object_closer(__buf) solr_string_append_const((__buf), "}") #define solr_write_array_closer(__buf) solr_string_append_const((__buf), "}") #define solr_write_root_object_closer(__buf) solr_string_append_const((__buf), "}") /* }}} */ /* {{{ static void solr_encode_* prototypes */ static void solr_encode_null(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_bool(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_int(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_float(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_string(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_array(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_object(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_document(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_result(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_document_field_simple(const xmlNode *fieldNode, xmlNode *field); static void solr_encode_document_field_complex(const xmlNode *fieldNode, xmlNode *field); /* }}} */ /* {{{ global variables solr_encoder_functions[], solr_document_field_encoders[] */ static solr_php_encode_func_t solr_encoder_functions[] = { solr_encode_string, solr_encode_null, solr_encode_bool, solr_encode_int, solr_encode_float, solr_encode_string, solr_encode_array, solr_encode_object, solr_encode_document, solr_encode_result, NULL }; static solr_document_field_encode_func_t solr_document_field_encoders[] = { solr_encode_document_field_simple, /* maps to SOLR_SIMPLE_FIELD */ solr_encode_document_field_complex, /* maps to SOLR_COMPLEX_FIELD */ NULL }; /* }}} */ /* {{{ Constants and Macros for handling node types */ #define SOLR_SIMPLE_FIELD 0 #define SOLR_COMPLEX_FIELD 1 #define solr_xml_field_node_type(node) (xmlStrEqual((node)->name, (xmlChar *)"arr")? SOLR_COMPLEX_FIELD : SOLR_SIMPLE_FIELD) #define solr_encode_document_field(field_in, field_out) solr_document_field_encoders[solr_xml_field_node_type((field_in))]((field_in), (field_out)) /* }}} */ /* Used to figure out now many properties or elements there are in an object or an array */ /* {{{ static inline int solr_get_node_size(const xmlNode *data_node) */ static inline int solr_get_node_size(const xmlNode *data_node) { register int size = 0; xmlNode *curr_node = data_node->children; while(curr_node != NULL) { if (XML_ELEMENT_NODE == curr_node->type) { size++; } curr_node = curr_node->next; } return size; } /* }}} */ /* {{{ static inline int solr_get_xml_type(xmlNode *node) */ static inline int solr_get_xml_type(xmlNode *node) { solr_char_t *node_name = (solr_char_t *) node->name; if (!node_name) { return SOLR_ENCODE_STRING; } if (!strcmp(node_name, "str")) { return SOLR_ENCODE_STRING; } else if (!strcmp(node_name, "int") || !strcmp(node_name, "long") || !strcmp(node_name, "short") || !strcmp(node_name, "byte")) { return SOLR_ENCODE_INT; } else if (!strcmp(node_name, "double") || !strcmp(node_name, "float")) { return SOLR_ENCODE_FLOAT; } else if (!strcmp(node_name, "lst")) { return SOLR_ENCODE_OBJECT; } else if (!strcmp(node_name, "arr")) { return SOLR_ENCODE_ARRAY; } else if (!strcmp(node_name, "bool")) { return SOLR_ENCODE_BOOL; } else if (!strcmp(node_name, "null")) { return SOLR_ENCODE_NULL; } else if (!strcmp(node_name, "result")) { return SOLR_ENCODE_RESULT; }else if (!strcmp(node_name, "doc")) { return SOLR_ENCODE_OBJECT; } else { return SOLR_ENCODE_STRING; } } /* }}} */ /* {{{ static inline void solr_write_variable_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) */ static inline void solr_write_variable_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) { switch(enc_type) { case SOLR_ENCODE_OBJECT_PROPERTY : /* fall through */ case SOLR_ENCODE_ARRAY_KEY : { solr_char_t *object_name = "_undefined_property_name"; xmlAttr *name_attr = node->properties; /* get the contents of the name attribute */ if (name_attr) { object_name = (solr_char_t *) solr_xml_get_node_contents(name_attr); } solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, strlen(object_name)); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, object_name, strlen(object_name)); solr_string_append_const(buffer, "\";"); } break; case SOLR_ENCODE_ARRAY_INDEX : { solr_string_append_const(buffer, "i:"); solr_string_append_long(buffer, array_index); solr_string_appendc(buffer, ';'); } break; default : { /* do nothing */ } break; } } /* }}} */ /* {{{ static void solr_write_object_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) */ static void solr_write_object_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) { int size = solr_get_node_size(node); solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "O:10:\"SolrObject\":"); solr_string_append_long(buffer, size); solr_string_append_const(buffer, ":{"); } /* }}} */ /* {{{ static void solr_write_solr_document_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, int size) */ static void solr_write_solr_document_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, int size) { solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "C:12:\"SolrDocument\":"); solr_string_append_long(buffer, size); solr_string_append_const(buffer, ":{"); } /* }}} */ /* {{{ static void solr_write_array_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) */ static void solr_write_array_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) { int size = solr_get_node_size(node); solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "a:"); solr_string_append_long(buffer, size); solr_string_append_const(buffer, ":{"); } /* }}} */ static void solr_serialize_solr_document(const xmlNode *node, solr_string_t *dest); static void solr_encode_solr_document_children(const xmlNode *node, xmlNode* builder_node, int child_docs_found); static void solr_encode_solr_document(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_serialize_solr_document(const xmlNode *node, solr_string_t *dest) { xmlChar *doc_txt_buffer = NULL; int doc_txt_len = 0; xmlNode *solr_document_node = NULL; xmlDoc *doc_ptr = solr_xml_create_xml_doc((xmlChar *) "solr_document", &solr_document_node); xmlNode *fields_node = xmlNewChild(solr_document_node, NULL, (xmlChar *) "fields", NULL); xmlNode *curr_node = node->children; int format = 1; int child_docs_found = 0; while(curr_node != NULL) { if (XML_ELEMENT_NODE == curr_node->type) { if (strcmp((const char *)curr_node->name, "doc") == 0) { child_docs_found++; } else { xmlNode *field = xmlNewChild(fields_node, NULL, (xmlChar *)"field", NULL); solr_encode_document_field(curr_node, field); } } curr_node = curr_node->next; } if (child_docs_found > 0) { solr_encode_solr_document_children(node, solr_document_node, child_docs_found); } /* We have written all the fields to the document */ /* Dumping the document from memory to the buffer */ xmlDocDumpFormatMemoryEnc(doc_ptr, &doc_txt_buffer, &doc_txt_len, "UTF-8", format); solr_string_appends_ex(dest, (solr_char_t *)doc_txt_buffer, doc_txt_len); xmlFreeDoc(doc_ptr); xmlFree(doc_txt_buffer); } /* {{{ static void solr_encode_document_children(const xmlNode *node, solr_string_t* buffer, int child_docs_found, long int parse_mode) encodes the doc/doc child/nested documents */ static void solr_encode_solr_document_children(const xmlNode *node, xmlNode* builder_node, int child_docs_found) { int current_index = 0; xmlXPathContext *xpathctxt = NULL; const xmlChar *xpath_expression = (xmlChar *) "child::doc"; xmlXPathObject *xpathObj = NULL; xmlNodeSet *result = NULL; xmlNode *child_docs_node = NULL; xpathctxt = xmlXPathNewContext(node->doc); xpathctxt->node = (xmlNodePtr) node; xpathObj = xmlXPathEval(xpath_expression, xpathctxt); result = xpathObj->nodesetval; child_docs_found = result->nodeNr; child_docs_node = xmlNewChild(builder_node, NULL, (xmlChar *)"child_docs", NULL); for (current_index=0; current_index < child_docs_found; current_index++) { int encoded_len; char *encoded; solr_string_t tmp_buffer; solr_string_t tmp_s_buffer; memset(&tmp_buffer, 0, sizeof(solr_string_t)); memset(&tmp_s_buffer, 0, sizeof(solr_string_t)); solr_serialize_solr_document(result->nodeTab[current_index], &tmp_buffer); solr_string_append_const(&tmp_s_buffer, "C:12:\"SolrDocument\":"); solr_string_append_long(&tmp_s_buffer, tmp_buffer.len); solr_string_append_const(&tmp_s_buffer, ":{"); solr_string_appends_ex(&tmp_s_buffer, tmp_buffer.str, tmp_buffer.len); solr_write_object_closer(&tmp_s_buffer); encoded = (char *)php_base64_encode((unsigned char*)tmp_s_buffer.str, tmp_s_buffer.len, &encoded_len); xmlNewChild(child_docs_node, NULL, (const xmlChar *) "dochash", (xmlChar *)encoded); solr_string_free_ex(&tmp_buffer); solr_string_free_ex(&tmp_s_buffer); if (encoded) { efree(encoded); } } } /* }}} */ /** * * The @enc_type parameter must be SOLR_ENCODE_ARRAY_INDEX */ /* {{{ static void solr_encode_solr_document(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_solr_document(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { solr_string_t doc_serialized_buffer; memset(&doc_serialized_buffer, 0, sizeof(solr_string_t)); solr_serialize_solr_document(node, &doc_serialized_buffer); solr_write_solr_document_opener(NULL, buffer, enc_type, array_index, doc_serialized_buffer.len); solr_string_appends(buffer, (char *) doc_serialized_buffer.str, doc_serialized_buffer.len); solr_write_object_closer(buffer); solr_string_free(&doc_serialized_buffer); } /* }}} */ /* {{{ static void solr_write_object_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) */ static void solr_write_object_opener_child_doc(const xmlNode *node, int num_child_docs ,solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) { int size = solr_get_node_size(node) - num_child_docs + 1; solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "O:10:\"SolrObject\":"); solr_string_append_long(buffer, size); solr_string_append_const(buffer, ":{"); } /* }}} */ /* {{{ static void solr_encode_document_children(const xmlNode *node, solr_string_t* buffer, int child_docs_found, long int parse_mode) encodes the doc/doc child/nested documents ONLY FOR SolrObject */ static void solr_encode_document_children(const xmlNode *node, solr_string_t* buffer, int child_docs_found, long int parse_mode) { int current_index = 0; xmlXPathContext *xpathctxt = NULL; const xmlChar *xpath_expression = (xmlChar *) "child::doc"; xmlXPathObject *xpathObj = NULL; xmlNodeSet *result = NULL; solr_php_encode_func_t document_encoder_functions[] = { solr_encode_document, solr_encode_solr_document, NULL }; solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, sizeof("_childDocuments_")-1); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, "_childDocuments_", sizeof("_childDocuments_")-1); solr_string_append_const(buffer, "\";"); solr_string_append_const(buffer, "a:"); solr_string_append_long(buffer, child_docs_found); solr_string_append_const(buffer, ":{"); xpathctxt = xmlXPathNewContext(node->doc); xpathctxt->node = (xmlNodePtr) node; xpathObj = xmlXPathEval(xpath_expression, xpathctxt); result = xpathObj->nodesetval; child_docs_found = result->nodeNr; for (current_index=0; current_index < child_docs_found; current_index++) { document_encoder_functions[parse_mode](result->nodeTab[current_index], buffer, SOLR_ENCODE_ARRAY_INDEX, current_index, parse_mode); } solr_write_array_closer(buffer); } /* }}} */ /* {{{ static void solr_encode_document(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) encodes/serializes the element result/doc */ static void solr_encode_document(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { xmlNode *curr_node = NULL; int child_docs_found = 0; solr_string_t inner_buffer; memset(&inner_buffer, 0, sizeof(solr_string_t)); curr_node = node->children; while(curr_node != NULL) { if (XML_ELEMENT_NODE == curr_node->type) { if (strcmp((const char*) curr_node->name, "doc") == 0) { /* skip doc/doc elements to be processed later */ child_docs_found++; } else { solr_encode_xml_node(curr_node, &inner_buffer, SOLR_ENCODE_OBJECT_PROPERTY, 0L, parse_mode); } } curr_node = curr_node->next; } if (child_docs_found > 0){ solr_encode_document_children(node, &inner_buffer, child_docs_found, parse_mode); /** * write and calculate proper object opener * because the object number of properties depends on whether there are child documents involved */ solr_write_object_opener_child_doc(node, child_docs_found, buffer, enc_type, array_index); } else { solr_write_object_opener(node, buffer, enc_type, array_index); } solr_string_appends_ex(buffer, inner_buffer.str, inner_buffer.len); solr_write_object_closer(buffer); solr_string_free_ex(&inner_buffer); } /* }}} */ /** * Handles simple data types like strings, integers, booleans etc. */ /* {{{ static void solr_encode_document_field_simple(const xmlNode *fieldNode, xmlNode *field) */ static void solr_encode_document_field_simple(const xmlNode *fieldNode, xmlNode *field) { xmlChar *fieldname = NULL; xmlChar *field_value = NULL; fieldname = solr_xml_get_node_contents(fieldNode->properties); if (strcmp((const char *)fieldname, "") == 0) { /** todo throw an IllegalOperationException */ return; } field_value = xmlEncodeEntitiesReentrant(fieldNode->doc, solr_xml_get_node_contents(fieldNode)); xmlNewChild(field, NULL, (xmlChar *) "field_value", field_value); xmlNewProp(field, (xmlChar *) "name", fieldname); xmlFree(field_value); } /* }}} */ /* Handles complex data types like arrays */ /* {{{ static void solr_encode_document_field_complex(const xmlNode *fieldNode, xmlNode *field) */ static void solr_encode_document_field_complex(const xmlNode *fieldNode, xmlNode *field) { xmlChar *fieldname = solr_xml_get_node_contents(fieldNode->properties); xmlNode *current_value = fieldNode->children; while(current_value != NULL) { if (current_value->type == XML_ELEMENT_NODE) { xmlChar *field_value = xmlEncodeEntitiesReentrant(fieldNode->doc, solr_xml_get_node_contents(current_value)); xmlNewChild(field, NULL, (xmlChar *) "field_value", field_value); xmlFree(field_value); } current_value = current_value->next; } xmlNewProp(field, (xmlChar *) "name", fieldname); } /* }}} */ /* {{{ static void solr_encode_result(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_result(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { xmlAttr *properties = node->properties; solr_char_t *object_name = (solr_char_t *) node->name; solr_char_t *num_found = NULL; solr_char_t *start = NULL; solr_char_t *max_score = NULL; solr_php_encode_func_t document_encoder_functions[] = { solr_encode_document, solr_encode_solr_document, NULL }; xmlAttr *curr_prop = properties; xmlXPathContext *xpathctxt = NULL; const xmlChar *xpath_expression = (xmlChar *) "child::doc"; xmlXPathObject *xpathObj = NULL; xmlNodeSet *result = NULL; long int document_count = 0; while(curr_prop != NULL) { if (solr_xml_match_node(curr_prop, "numFound")) { num_found = (solr_char_t *) solr_xml_get_node_contents(curr_prop); } if (solr_xml_match_node(curr_prop, "start")) { start = (solr_char_t *) solr_xml_get_node_contents(curr_prop); } if (solr_xml_match_node(curr_prop, "name")) { object_name = (solr_char_t *) solr_xml_get_node_contents(curr_prop); } if (solr_xml_match_node(curr_prop, "maxScore")) { max_score = (solr_char_t *) solr_xml_get_node_contents(curr_prop); } curr_prop = curr_prop->next; } xpathctxt = xmlXPathNewContext(node->doc); xpathctxt->node = (xmlNodePtr) node; xpathObj = xmlXPathEval(xpath_expression, xpathctxt); result = xpathObj->nodesetval; document_count = result->nodeNr; solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, strlen(object_name)); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, object_name, strlen(object_name)); solr_string_append_const(buffer, "\";"); solr_string_append_const(buffer, "O:10:\"SolrObject\":"); if (max_score) { solr_string_append_long(buffer, 4); /* numFound, start, docs, maxScore properties */ } else { solr_string_append_long(buffer, 3); /* numFound, start, docs properties */ } solr_string_append_const(buffer, ":{"); /* Object Opener for response */ /* Writing the numFound property */ solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, sizeof("numFound")-1); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, "numFound", sizeof("numFound")-1); solr_string_append_const(buffer, "\";"); solr_string_append_const(buffer, "i:"); solr_string_appends(buffer, num_found, solr_strlen(num_found)); solr_string_appendc(buffer, ';'); /* Writing the start property */ solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, sizeof("start")-1); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, "start", sizeof("start")-1); solr_string_append_const(buffer, "\";"); solr_string_append_const(buffer, "i:"); solr_string_appends(buffer, start, solr_strlen(start)); solr_string_appendc(buffer, ';'); /* writing max score property */ if (max_score) { solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, sizeof("maxScore")-1); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, "maxScore", sizeof("maxScore")-1); solr_string_append_const(buffer, "\";"); solr_string_append_const(buffer, "d:"); solr_string_appends(buffer, max_score, solr_strlen(max_score)); solr_string_appendc(buffer, ';'); } /* Writing the docs property */ solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, sizeof("docs")-1); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, "docs", sizeof("docs")-1); solr_string_append_const(buffer, "\";"); if (document_count) { /* Grab all the first /response/result/doc node */ xmlNode *curr_doc = node->children; long int curr_doc_index = 0L; /* Array opener */ solr_string_append_const(buffer, "a:"); solr_string_append_long(buffer, document_count); solr_string_append_const(buffer, ":{"); while(curr_doc != NULL) { /* Absolutely no assumptions. At least for now. */ if (XML_ELEMENT_NODE == curr_doc->type && solr_xml_match_node(curr_doc, "doc")) { /* This is where you decided whether to use SolrDocument or StdClass */ /* parse_mode value of 0 creates SolrObject; 1 creates SolrDocument */ document_encoder_functions[parse_mode](curr_doc, buffer, SOLR_ENCODE_ARRAY_INDEX, curr_doc_index, parse_mode); curr_doc_index++; } curr_doc = curr_doc->next; } solr_write_array_closer(buffer); /* Array closer */ } else { solr_string_append_const(buffer, "b:0;"); /* This means there are no docs */ } solr_write_object_closer(buffer); /* Object closer */ xmlXPathFreeContext(xpathctxt); xmlXPathFreeObject(xpathObj); } /* }}} */ /* {{{ static void solr_encode_null(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_null(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { /* SolrObject should not contain nulls because of how magic functionality is implemented */ solr_write_variable_opener(node, buffer, enc_type, array_index); /* Setting nulls to boolean false */ solr_string_append_const(buffer, "b:0;"); } /* }}} */ /* {{{ static void solr_encode_bool(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_bool(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { solr_char_t *data_value = (solr_char_t *) solr_xml_get_node_contents(node); long int boolean_value = (!strcmp("true", data_value))? 1 : 0; solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "b:"); solr_string_append_long(buffer, boolean_value); solr_string_appendc(buffer, ';'); } /* }}} */ /* {{{ static void solr_encode_int(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_int(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { solr_char_t *data_value = (solr_char_t *) solr_xml_get_node_contents(node); size_t data_value_len = solr_strlen(data_value); solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "i:"); solr_string_appends(buffer, data_value, data_value_len); solr_string_appendc(buffer, ';'); } /* }}} */ /* {{{ static void solr_encode_float(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_float(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { solr_char_t *data_value = (solr_char_t *) solr_xml_get_node_contents(node); size_t data_value_len = solr_strlen(data_value); solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "d:"); if (strcmp(data_value, "NaN" ) == 0) { data_value = (solr_char_t *)"NAN"; } solr_string_appends(buffer, data_value, data_value_len); solr_string_appendc(buffer, ';'); } /* }}} */ /* {{{ static void solr_encode_string(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_string(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { solr_char_t *data_value = (solr_char_t *) solr_xml_get_node_contents(node); size_t data_value_len = solr_strlen(data_value); solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, data_value_len); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, data_value, data_value_len); solr_string_append_const(buffer, "\";"); } /* }}} */ /* {{{ static void solr_encode_array(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_array(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { xmlNode *curr_node = NULL; long int current_index = 0L; solr_write_array_opener(node, buffer, enc_type, array_index); curr_node = node->children; while(curr_node != NULL) { if (XML_ELEMENT_NODE == curr_node->type) { solr_encode_xml_node(curr_node, buffer, SOLR_ENCODE_ARRAY_INDEX, current_index, parse_mode); current_index++; } curr_node = curr_node->next; } solr_write_array_closer(buffer); } /* }}} */ /* {{{ static void solr_encode_object(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_object(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { xmlNode *curr_node = NULL; solr_write_object_opener(node, buffer, enc_type, array_index); curr_node = node->children; while(curr_node != NULL) { if (XML_ELEMENT_NODE == curr_node->type) { solr_encode_xml_node(curr_node, buffer, SOLR_ENCODE_OBJECT_PROPERTY, 0L, parse_mode); } curr_node = curr_node->next; } solr_write_object_closer(buffer); } /* }}} */ /** * Used to digest Xml response messages from Solr * */ /* {{{ PHP_SOLR_API void solr_encode_generic_xml_response(solr_string_t *buffer, const solr_char_t *serialized, int size, long int parse_mode TSRMLS_DC) */ PHP_SOLR_API void solr_encode_generic_xml_response(solr_string_t *buffer, const solr_char_t *serialized, int size, long int parse_mode TSRMLS_DC) { xmlDoc *doc = xmlReadMemory(serialized, size, NULL, "UTF-8", XML_PARSE_RECOVER); xmlNode *root = NULL; if (!doc) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error loading XML document"); return; } root = xmlDocGetRootElement(doc); if (!root) { xmlFreeDoc(doc); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error loading root of XML document"); return; } parse_mode = ((parse_mode < 0L) ? 0L : ((parse_mode > 1L) ? 1L : parse_mode)); solr_encode_object(root, buffer, SOLR_ENCODE_STANDALONE, 0L, parse_mode); if (buffer->len == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error parsing XML document"); } xmlFreeDoc(doc); } /* }}} */ /* {{{ PHP_SOLR_API int solr_is_supported_response_writer(const solr_char_t * response_writer, int length) */ PHP_SOLR_API int solr_is_supported_response_writer(const solr_char_t * response_writer, int length) { if (length < 1) { return 0; } if (0 == strcmp(response_writer, SOLR_PHP_SERIALIZED_RESPONSE_WRITER)) { return 1; } if (0 == strcmp(response_writer, SOLR_XML_RESPONSE_WRITER)) { return 1; } if (0 == strcmp(response_writer, SOLR_JSON_RESPONSE_WRITER)) { return 1; } return 0; } /* }}} */ /* {{{ PHP_SOLR_API solr_char_t *solr_get_json_error_msg(solr_json_error_codes_t error_code) */ PHP_SOLR_API solr_char_t *solr_get_json_error_msg(solr_json_error_codes_t error_code) { switch(error_code) { case SOLR_JSON_ERROR_DEPTH: return "JSON maximum recursion depth was exceeded"; break; case SOLR_JSON_ERROR_STATE_MISMATCH: return "JSON error state mismatch"; break; case SOLR_JSON_ERROR_CTRL_CHAR: return "JSON control character was encountered"; break; case SOLR_JSON_ERROR_SYNTAX: return "JSON syntax error"; break; case SOLR_JSON_ERROR_UTF8: return "JSON UTF8 error"; break; default : return "JSON unknown error"; break; } } /* }}} */ /* {{{ PHP_SOLR_API int solr_json_to_php_native(solr_string_t *buffer, const solr_char_t *json_string, int json_string_length TSRMLS_DC) */ PHP_SOLR_API int solr_json_to_php_native(solr_string_t *buffer, const solr_char_t *json_string, int json_string_length TSRMLS_DC) { /* JSON recursion depth. default is 512 */ long recursion_depth = 1024L; long json_error = 0L; php_serialize_data_t var_hash; smart_str serialize_buffer = {0}; /* return value for the function */ zval json_decode_ret_val, *json_decode_ret_val_ptr; zend_uchar json_decode_ret_val_type = IS_NULL; json_decode_ret_val_ptr = &json_decode_ret_val; php_json_decode(&json_decode_ret_val, (char *) json_string, json_string_length, 1, recursion_depth TSRMLS_CC); json_error = solr_get_json_last_error(TSRMLS_C); /* Why ? todo investigate */ /* solr_string_set(buffer, "i:99;", sizeof("i:99;")); */ if (json_error > 0) { zval_dtor(&json_decode_ret_val); php_error_docref(NULL TSRMLS_CC, E_WARNING, "JSON error. JSON->PHP serialization error"); return (int) json_error; } memset(&var_hash, 0, sizeof(php_serialize_data_t)); PHP_VAR_SERIALIZE_INIT(var_hash); php_var_serialize(&serialize_buffer, &json_decode_ret_val_ptr, &var_hash TSRMLS_CC); json_decode_ret_val_type = Z_TYPE_P(json_decode_ret_val_ptr); zval_dtor(&json_decode_ret_val); solr_string_set(buffer, serialize_buffer.c, serialize_buffer.len); PHP_VAR_SERIALIZE_DESTROY(var_hash); smart_str_free(&serialize_buffer); /* return value should not be of NULL type. NULL means an error has occurred */ if (json_decode_ret_val_type == IS_NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "JSON error. Error occurred in php_json_decode(). Raw JSON string is \n %s \n", (char *) json_string); /* json_error always fails to detect an error. * todo investigate */ return (int) SOLR_JSON_ERROR_SERIALIZATION; } return (int) json_error; } /* }}} */ PHP_SOLR_API long solr_get_json_last_error(TSRMLS_D) { long json_error; zval json_last_error_ret_val, **object_pp; zval *json_last_error_params[] = {NULL}; zval json_last_error_function_name; ZVAL_STRINGL(&json_last_error_function_name, "json_last_error", sizeof("json_last_error"), 0); /* object instance to perform the method call */ object_pp = (zval **) NULL; call_user_function(EG(function_table), object_pp, &json_last_error_function_name, &json_last_error_ret_val, 0, json_last_error_params TSRMLS_CC); json_error = Z_LVAL(json_last_error_ret_val); zval_dtor(&json_last_error_ret_val); return json_error; } PHP_SOLR_API int solr_sarray_to_sobject(solr_string_t *buffer TSRMLS_DC) { char * regex = "/a\\:([0-9]+):{s/i", *result; int regex_len = sizeof(regex); zval * replace_val; int * result_len = (int *)emalloc(sizeof(int)); int limit = -1; int replace_count = -1; MAKE_STD_ZVAL(replace_val); ZVAL_STRING(replace_val,"O:10:\"SolrObject\":\\1:{s",1); result = php_pcre_replace( regex, regex_len, (*buffer).str, (*buffer).len, replace_val, 0, result_len, limit, &replace_count TSRMLS_CC ); solr_string_set_ex(buffer, (solr_char_t *)result, (size_t)*result_len); /* fprintf(stdout, "%s", buffer->str); */ efree(result_len); efree(result); zval_ptr_dtor(&replace_val); return SUCCESS; } PHP_SOLR_API int solr_sobject_to_sarray(solr_string_t *buffer TSRMLS_DC) { char * regex = "/O:10:\"SolrObject\":([0-9]+):{s/i", *result; int regex_len = sizeof(regex); zval * replace_val; int * result_len = (int *)emalloc(sizeof(int)); int limit = -1; int replace_count = -1; MAKE_STD_ZVAL(replace_val); ZVAL_STRING(replace_val,"a:\\1:{s",1); result = php_pcre_replace( regex, regex_len, (*buffer).str, (*buffer).len, replace_val, 0, result_len, limit, &replace_count TSRMLS_CC ); solr_string_set_ex(buffer, (solr_char_t *)result, (size_t)*result_len); efree(result_len); efree(result); zval_ptr_dtor(&replace_val); return SUCCESS; } /* }}} */ /* todo document and block this */ PHP_SOLR_API int solr_solrfunc_update_string(zval *obj, solr_char_t *key, int key_len, solr_char_t *value, int value_len TSRMLS_DC) { solr_function_t *function; solr_string_t string; memset(&string, 0, sizeof(solr_string_t)); if (solr_fetch_function_entry(obj, &function TSRMLS_CC) == FAILURE) { return FAILURE; } solr_string_set(&string, (solr_char_t *)value, value_len); if (zend_hash_update(function->params, key, key_len, (void **)&string, sizeof(solr_string_t), NULL) == FAILURE ) { solr_string_free(&string); return FAILURE; } return SUCCESS; } PHP_SOLR_API int solr_solrfunc_fetch_string(zval *obj, solr_char_t *key, int key_len, solr_string_t **string TSRMLS_DC) { solr_function_t *function; if (solr_fetch_function_entry(obj, &function TSRMLS_CC) == FAILURE) { return FAILURE; } if (zend_hash_find(function->params, key, key_len, (void **)string) == FAILURE ) { return FAILURE; } return SUCCESS; } PHP_SOLR_API int solr_solrfunc_display_string(zval *obj, solr_char_t *key, int key_len, zval **return_value TSRMLS_DC) { solr_string_t *field_string_ptr = NULL; memset(&field_string_ptr, 0, sizeof(solr_string_t *)); if (solr_solrfunc_fetch_string(obj, key, key_len, &field_string_ptr TSRMLS_CC) == SUCCESS) { ZVAL_STRINGL(*return_value, field_string_ptr->str, field_string_ptr->len, 1); return SUCCESS; } else { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to fetch string"); return FAILURE; } } PHP_SOLR_API void solr_solrfunc_to_string(solr_function_t *function, solr_string_t **dest) { zend_bool duplicate = 0; solr_string_t *buffer = *dest; solr_string_appends(buffer, (solr_char_t *)"{!", sizeof("{!")-1); solr_string_appends(buffer, function->name, function->name_length); solr_string_appendc(buffer, ' '); SOLR_HASHTABLE_FOR_LOOP(function->params) { solr_string_t *value; solr_char_t *key; uint key_len; ulong num_idx; zend_hash_get_current_key_ex(function->params, &key, &key_len, &num_idx, duplicate, (HashPosition *) 0); zend_hash_get_current_data_ex(function->params, (void **) &value, (HashPosition *) 0); /* key is always maintained internally */ solr_string_appends(buffer, key, key_len-1); solr_string_appendc(buffer, '='); if (strstr(value->str, " ") && !strstr(value->str,"'")) { solr_string_appendc(buffer, '\''); solr_string_append_solr_string (buffer, value); solr_string_appendc(buffer, '\''); } else { solr_string_append_solr_string (buffer, value); } solr_string_appendc(buffer, ' '); } solr_string_remove_last_char(buffer); solr_string_appendc(buffer, '}'); /* todo handle localParams argument */ } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/solr_functions_params.c000066400000000000000000001314501374041537100235700ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ PHP_SOLR_API void solr_destroy_params(void *solr_params) */ PHP_SOLR_API void solr_destroy_params(void *solr_params) { solr_params_t *params = (solr_params_t *) solr_params; zend_hash_destroy(params->params); pefree(params->params, SOLR_PARAMS_PERSISTENT); } /* }}} */ /* {{{ PHP_SOLR_API void solr_destroy_param(solr_param_t **param) */ PHP_SOLR_API void solr_destroy_param(solr_param_t **param) { solr_param_value_t *temp_ptr = NULL; solr_param_value_t *current_ptr = (*param)->head; while(current_ptr != NULL) { temp_ptr = current_ptr->next; (*param)->value_free_func(current_ptr); current_ptr = temp_ptr; } (*param)->head = NULL; (*param)->last = NULL; pefree((*param)->param_name, SOLR_PARAMS_PERSISTENT); (*param)->param_name = NULL; pefree((*param), SOLR_PARAMS_PERSISTENT); (*param) = NULL; } /* }}} */ /* {{{ PHP_SOLR_API int solr_params_delete_param_value(solr_param_t *param, const solr_param_value_t *target_value TSRMLS_DC) */ PHP_SOLR_API int solr_params_delete_param_value(solr_param_t *param, const solr_param_value_t *target_value TSRMLS_DC) { solr_param_value_t *curr_value = param->head; int match_found = 0; if (!target_value) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid pointer. Submitted target cannot be used for the delete search\n"); return FAILURE; } while(!match_found && curr_value != NULL) { match_found = param->value_equal_func(curr_value, target_value); /* If the target was found */ if (match_found) { /* If the target is not the head */ if (curr_value->prev) { curr_value->prev->next = curr_value->next; } else { param->head = curr_value->next; } /* If the target is not the tail */ if (curr_value->next) { curr_value->next->prev = curr_value->prev; } else { param->last = curr_value->prev; } /* Destroy target value */ param->value_free_func(curr_value); goto dpv_end; } curr_value = curr_value->next; } dpv_end : if (!match_found) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Target parameter value could not be found in '%s'. No value was deleted ", param->param_name); return FAILURE; } param->count--; /* Reduce the value count by one */ return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_params_insert_param_value(solr_param_t *param, solr_param_value_t *param_value) */ PHP_SOLR_API int solr_params_insert_param_value(solr_param_t *param, solr_param_value_t *param_value) { if (!param_value) { return FAILURE; } param_value->next = param_value->prev = NULL; if (!param->allow_multiple) { param->value_free_func(param->head); param->head = param_value; param->last = param_value; param->count = 1U; return SUCCESS; } if (param->head == NULL) { param->head = param_value; param->last = param_value; } else { param_value->prev = param->last; param->last->next = param_value; param->last = param_value; } param->count++; return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API solr_param_t *solr_create_new_param(const solr_char_t *param_name, size_t param_name_len, solr_param_type_t param_type, solr_bool allow_multiple, solr_param_value_equal_func_t value_equal_func, solr_param_fetch_func_t param_fetch_func, solr_param_value_free_func_t value_free_func, solr_char_t delimiter, solr_char_t arg_separator TSRMLS_DC) */ PHP_SOLR_API solr_param_t *solr_create_new_param(const solr_char_t *param_name, size_t param_name_len, solr_param_type_t param_type, solr_bool allow_multiple, solr_param_value_equal_func_t value_equal_func, solr_param_fetch_func_t param_fetch_func, solr_param_value_free_func_t value_free_func, solr_char_t delimiter, solr_char_t arg_separator TSRMLS_DC) { solr_param_t *query_param = (solr_param_t *) pemalloc(sizeof(solr_param_t), SOLR_PARAMS_PERSISTENT); /* Always initialize linked list containers to NULL. */ /* Member pointers may contain unallocated addresses */ /* This notice applies to all solr_param_t member pointers here */ memset(query_param, 0, sizeof(solr_param_t)); query_param->type = param_type; query_param->count = 0L; query_param->param_name = solr_strndup(param_name, param_name_len); query_param->param_name_length = param_name_len; query_param->allow_multiple = allow_multiple; query_param->head = query_param->last = NULL; query_param->value_equal_func = value_equal_func; query_param->fetch_func = param_fetch_func; query_param->value_free_func = value_free_func; query_param->delimiter = delimiter; query_param->arg_separator = arg_separator; return query_param; } /* }}} */ /* {{{ PHP_SOLR_API int solr_add_or_set_normal_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, zend_bool allow_multiple TSRMLS_DC) parameter value addition functions */ PHP_SOLR_API int solr_add_or_set_normal_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, zend_bool allow_multiple TSRMLS_DC) { solr_params_t *solr_params = NULL; solr_param_t **param_ptr = NULL; HashTable *params = NULL; solr_param_type_t param_type = SOLR_PARAM_TYPE_NORMAL; solr_param_t *param = NULL; solr_param_value_t *parameter_value = NULL; if (!pname_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter name"); /* php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter name"); */ return FAILURE; } if (!pvalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter value"); /* php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter value"); */ return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params = solr_params->params; if (zend_hash_find(params, (char *) pname, pname_length, (void **) ¶m_ptr) == SUCCESS) { parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.normal), pvalue, pvalue_length); solr_params_insert_param_value((*param_ptr), parameter_value); return SUCCESS; } param = solr_create_new_param(pname, pname_length, param_type, allow_multiple, solr_normal_param_value_equal, (solr_param_fetch_func_t) solr_normal_param_value_fetch, solr_normal_param_value_free, '&', 0 TSRMLS_CC); parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.normal), pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); if (zend_hash_add(params, pname, pname_length, (void *) ¶m, sizeof(solr_param_t *), (void **) NULL) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error from %s %s=%s", __func__, (char *) pname, pvalue); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_add_simple_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC) */ PHP_SOLR_API int solr_add_simple_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC) { zend_bool allow_multiple = 1; /* This value type by definition allows multiple. add parameters can be added more than once */ solr_params_t *solr_params = NULL; solr_param_t **param_ptr = NULL; HashTable *params = NULL; solr_param_type_t param_type = SOLR_PARAM_TYPE_SIMPLE_LIST; solr_param_t *param = NULL; solr_param_value_t *parameter_value = NULL; if (!pname_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter value"); return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params = solr_params->params; if (zend_hash_find(params, pname, pname_length, (void **) ¶m_ptr) == SUCCESS) { parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.simple_list), pvalue, pvalue_length); solr_params_insert_param_value((*param_ptr), parameter_value); return SUCCESS; } param = solr_create_new_param(pname, pname_length, param_type, allow_multiple, solr_simple_list_param_value_equal, (solr_param_fetch_func_t) solr_simple_list_param_value_fetch, solr_simple_list_param_value_free, ',', 0 TSRMLS_CC); parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.simple_list), pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); if (zend_hash_add(params, pname, pname_length, (void *) ¶m, sizeof(solr_param_t *), (void **) NULL) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error from %s %s=%s", __func__, (char *) pname, pvalue); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_add_simple_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC) */ PHP_SOLR_API int solr_add_simple_list_param_ex(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length,solr_char_t *separator TSRMLS_DC) { zend_bool allow_multiple = 1; /* This value type by definition allows multiple. add parameters can be added more than once */ solr_params_t *solr_params = NULL; solr_param_t **param_ptr = NULL; HashTable *params = NULL; solr_param_type_t param_type = SOLR_PARAM_TYPE_SIMPLE_LIST; solr_param_t *param = NULL; solr_param_value_t *parameter_value = NULL; if (!pname_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter value"); return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params = solr_params->params; if (zend_hash_find(params, pname, pname_length, (void **) ¶m_ptr) == SUCCESS) { parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.simple_list), pvalue, pvalue_length); solr_params_insert_param_value((*param_ptr), parameter_value); return SUCCESS; } param = solr_create_new_param(pname, pname_length, param_type, allow_multiple, solr_simple_list_param_value_equal, (solr_param_fetch_func_t) solr_simple_list_param_value_fetch, solr_simple_list_param_value_free, *separator, 0 TSRMLS_CC); parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.simple_list), pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); if (zend_hash_add(params, pname, pname_length, (void *) ¶m, sizeof(solr_param_t *), (void **) NULL) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error from %s %s=%s", __func__, (char *) pname, pvalue); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_add_arg_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t delimiter, solr_char_t arg_separator TSRMLS_DC) */ PHP_SOLR_API int solr_add_arg_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t delimiter, solr_char_t arg_separator TSRMLS_DC) { zend_bool allow_multiple = 1; /* This value type by definition allows multiple */ solr_params_t *solr_params = NULL; solr_param_type_t param_type = SOLR_PARAM_TYPE_ARG_LIST; solr_param_t *param = NULL; solr_param_value_t *parameter_value = NULL; HashTable *params = NULL; solr_param_t **param_ptr = NULL; /* holds a pointer to the param structure e.g. sort */ if (!pname_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter value"); return FAILURE; } /* if (!avalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid argument value"); return FAILURE; } */ if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params = solr_params->params; /* if parameter exists add the new value argument(param_value) */ if (zend_hash_find(params, pname, pname_length, (void **) ¶m_ptr) == SUCCESS) { parameter_value = create_parameter_value_arg_list(pvalue, pvalue_length, avalue, avalue_length, "", 0 TSRMLS_CC); solr_params_insert_param_value((*param_ptr), parameter_value); return SUCCESS; } param = solr_create_new_param(pname, pname_length, param_type, allow_multiple, solr_arg_list_param_value_equal, (solr_param_fetch_func_t) solr_arg_list_param_value_fetch, solr_arg_list_param_value_free, delimiter, arg_separator TSRMLS_CC); parameter_value = create_parameter_value_arg_list(pvalue, pvalue_length, avalue, avalue_length, (solr_char_t*)"", 0 TSRMLS_CC); solr_params_insert_param_value(param, parameter_value); if (zend_hash_add(params, pname, pname_length, (void *) ¶m, sizeof(solr_param_t *), (void **) NULL) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error from %s %s=%s", __func__, (char *) pname, pvalue); return FAILURE; } return SUCCESS; } /* }}} */ PHP_SOLR_API solr_param_value_t* create_parameter_value_arg_list(solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t *delimiter_override, solr_bool delimiter_overriden TSRMLS_DC) { solr_param_value_t *parameter_value = NULL; parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.arg_list.value), pvalue, pvalue_length); solr_string_appends(&(parameter_value->contents.arg_list.arg), avalue, avalue_length); if(delimiter_overriden){ parameter_value->contents.arg_list.delimiter_override = solr_strndup(delimiter_override, sizeof(delimiter_override)); parameter_value->contents.arg_list.delimiter_overriden = delimiter_overriden; } return parameter_value; } PHP_SOLR_API int solr_add_arg_list_param_ex(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t delimiter, solr_char_t arg_separator, solr_char_t delimiter_override TSRMLS_DC) { zend_bool allow_multiple = 1; /* This value type by definition allows multiple */ solr_params_t *solr_params = NULL; solr_param_type_t param_type = SOLR_PARAM_TYPE_ARG_LIST; solr_param_t *param = NULL; solr_param_value_t *parameter_value = NULL; HashTable *params = NULL; solr_param_t **param_ptr = NULL; /* holds a pointer to the param structure e.g. sort */ if (!pname_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter value"); return FAILURE; } /* * commented for the favor of having empty value if (!avalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid argument value"); return FAILURE; } */ if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params = solr_params->params; /* if parameter exists add the new value argument(param_value) */ if (zend_hash_find(params, pname, pname_length, (void **) ¶m_ptr) == SUCCESS) { parameter_value = create_parameter_value_arg_list(pvalue, pvalue_length, avalue, avalue_length, &delimiter_override, 1 TSRMLS_CC); solr_params_insert_param_value((*param_ptr), parameter_value); return SUCCESS; } param = solr_create_new_param(pname, pname_length, param_type, allow_multiple, solr_arg_list_param_value_equal, (solr_param_fetch_func_t) solr_arg_list_param_value_fetch, solr_arg_list_param_value_free, delimiter, arg_separator TSRMLS_CC); parameter_value = create_parameter_value_arg_list(pvalue, pvalue_length, avalue, avalue_length, &delimiter_override, 1 TSRMLS_CC); solr_params_insert_param_value(param, parameter_value); if (zend_hash_add(params, pname, pname_length, (void *) ¶m, sizeof(solr_param_t *), (void **) NULL) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error from %s %s=%s", __func__, (char *) pname, pvalue); return FAILURE; } return SUCCESS; } /* {{{ Parameter value EQUALITY FUNCTIONS */ /* {{{ PHP_SOLR_API int solr_normal_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b) */ PHP_SOLR_API int solr_normal_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b) { return solr_string_equal(&(a->contents.normal), &(b->contents.normal)); } /* }}} */ /* {{{ PHP_SOLR_API int solr_simple_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b) */ PHP_SOLR_API int solr_simple_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b) { return solr_string_equal(&(a->contents.simple_list), &(b->contents.simple_list)); } /* }}} */ /* {{{ PHP_SOLR_API int solr_arg_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b) */ PHP_SOLR_API int solr_arg_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b) { return solr_string_equal(&(a->contents.arg_list.value), &(b->contents.arg_list.value)); } /* }}} */ /* }}} */ /* {{{ Parameter values retrieval functions */ /* {{{ PHP_SOLR_API void solr_normal_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer) */ PHP_SOLR_API void solr_normal_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer) { solr_param_value_t *current_ptr = solr_param->head; solr_char_t glue = '&'; if (!solr_param->allow_multiple) { auto int new_pv_length = 0; solr_char_t *url_encoded_param_value = (solr_char_t *) php_raw_url_encode((char *) current_ptr->contents.normal.str, current_ptr->contents.normal.len, &new_pv_length); solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); solr_string_appends(buffer, url_encoded_param_value, new_pv_length); efree(url_encoded_param_value); } else { ulong n_loops = solr_param->count - 1; auto int new_pv_length = 0; solr_char_t *url_encoded_param_value = NULL; while(n_loops) { new_pv_length = 0; url_encoded_param_value = php_raw_url_encode(current_ptr->contents.normal.str, current_ptr->contents.normal.len, &new_pv_length); solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); solr_string_appends(buffer, url_encoded_param_value, new_pv_length); efree(url_encoded_param_value); url_encoded_param_value = NULL; solr_string_appendc(buffer, glue); n_loops--; current_ptr = current_ptr->next; } url_encoded_param_value = php_raw_url_encode(current_ptr->contents.normal.str, current_ptr->contents.normal.len, &new_pv_length); solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); solr_string_appends(buffer, url_encoded_param_value, new_pv_length); efree(url_encoded_param_value); url_encoded_param_value = NULL; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_simple_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer) */ PHP_SOLR_API void solr_simple_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer) { solr_param_value_t *current_ptr = solr_param->head; solr_char_t list_delimiter = ','; /* Comma 0x2C */ ulong n_loops = solr_param->count - 1; auto solr_string_t tmp_buffer; auto int new_pv_length = 0; solr_char_t *url_encoded_list = NULL; solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); memset(&tmp_buffer, 0, sizeof(solr_string_t)); while(n_loops) { solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.simple_list)); solr_string_appendc(&tmp_buffer, list_delimiter); n_loops--; current_ptr = current_ptr->next; } solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.simple_list)); url_encoded_list = php_raw_url_encode(tmp_buffer.str, tmp_buffer.len, &new_pv_length); solr_string_appends(buffer, url_encoded_list, new_pv_length); efree(url_encoded_list); url_encoded_list = NULL; solr_string_free(&tmp_buffer); } /* }}} */ /* {{{ PHP_SOLR_API void solr_arg_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer) */ PHP_SOLR_API void solr_arg_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer) { solr_param_value_t *current_ptr = solr_param->head; solr_char_t list_delimiter = solr_param->delimiter; solr_char_t separator = solr_param->arg_separator; ulong n_loops = solr_param->count - 1; solr_string_t tmp_buffer; int new_pv_length = 0; solr_char_t *url_encoded_list = NULL; solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); memset(&tmp_buffer, 0, sizeof(solr_string_t)); while(n_loops) { solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.value)); solr_string_appendc(&tmp_buffer, separator); solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.arg)); solr_string_appendc(&tmp_buffer, list_delimiter); n_loops--; current_ptr = current_ptr->next; } solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.value)); solr_string_appendc(&tmp_buffer, separator); solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.arg)); url_encoded_list = php_raw_url_encode(tmp_buffer.str, tmp_buffer.len, &new_pv_length); solr_string_appends(buffer, url_encoded_list, new_pv_length); efree(url_encoded_list); url_encoded_list = NULL; solr_string_free(&tmp_buffer); } /* }}} */ /* }}} */ /* {{{ Parameter retrieval functions. Only used for display. */ /* {{{ PHP_SOLR_API void solr_normal_param_value_display_string(solr_param_t *solr_param, zval *param_value) */ PHP_SOLR_API void solr_normal_param_value_display_string(solr_param_t *solr_param, zval *param_value) { solr_param_value_t *current_ptr = solr_param->head; ZVAL_STRINGL(param_value, current_ptr->contents.normal.str, current_ptr->contents.normal.len, 1); } /* }}} */ /* {{{ PHP_SOLR_API void solr_normal_param_value_display_integer(solr_param_t *solr_param, zval *param_value) */ PHP_SOLR_API void solr_normal_param_value_display_integer(solr_param_t *solr_param, zval *param_value) { solr_param_value_t *current_ptr = solr_param->head; long int return_value = atol(current_ptr->contents.normal.str); ZVAL_LONG(param_value, return_value); } /* }}} */ /* {{{ PHP_SOLR_API void solr_normal_param_value_display_double(solr_param_t *solr_param, zval *param_value) */ PHP_SOLR_API void solr_normal_param_value_display_double(solr_param_t *solr_param, zval *param_value) { solr_param_value_t *current_ptr = solr_param->head; double return_value = atof(current_ptr->contents.normal.str); ZVAL_DOUBLE(param_value, return_value); } /* }}} */ /* Checks if current_ptr->contents.normal.str matches str_const */ #define solr_npvdb_strcmp(str_const) (0 == strcmp(str_const, current_ptr->contents.normal.str)) /* {{{ PHP_SOLR_API void solr_normal_param_value_display_boolean(solr_param_t *solr_param, zval *param_value) */ PHP_SOLR_API void solr_normal_param_value_display_boolean(solr_param_t *solr_param, zval *param_value) { solr_param_value_t *current_ptr = solr_param->head; zend_bool return_value = (zend_bool) (solr_npvdb_strcmp("true") || solr_npvdb_strcmp("on") ); ZVAL_BOOL(param_value, return_value); } /* }}} */ /* {{{ PHP_SOLR_API void solr_normal_param_value_display_sort_type(solr_param_t *solr_param, zval *param_value) */ PHP_SOLR_API void solr_normal_param_value_display_sort_type(solr_param_t *solr_param, zval *param_value) { solr_param_value_t *current_ptr = solr_param->head; long int return_value = (long int) (solr_npvdb_strcmp("count")); ZVAL_LONG(param_value, return_value); } /* }}} */ /* {{{ PHP_SOLR_API void solr_normal_param_value_display(solr_param_t *solr_param, zval *param_value_array) */ PHP_SOLR_API void solr_normal_param_value_display(solr_param_t *solr_param, zval *param_value_array) { solr_param_value_t *current_ptr = solr_param->head; register int duplicate = 1; while (current_ptr != NULL) { add_next_index_stringl(param_value_array, current_ptr->contents.normal.str, current_ptr->contents.normal.len, duplicate); current_ptr = current_ptr->next; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_simple_list_param_value_display(solr_param_t *solr_param, zval *param_value_array) */ PHP_SOLR_API void solr_simple_list_param_value_display(solr_param_t *solr_param, zval *param_value_array) { solr_param_value_t *current_ptr = solr_param->head; register int duplicate = 1; while (current_ptr != NULL) { add_next_index_stringl(param_value_array, current_ptr->contents.simple_list.str, current_ptr->contents.simple_list.len, duplicate); current_ptr = current_ptr->next; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_arg_list_param_value_display(solr_param_t *solr_param, zval *param_value_array) */ PHP_SOLR_API void solr_arg_list_param_value_display(solr_param_t *solr_param, zval *param_value_array) { solr_param_value_t *current_ptr = solr_param->head; register int duplicate = 1; while (current_ptr != NULL) { solr_string_t tmp_buffer; memset(&tmp_buffer, 0, sizeof(solr_string_t)); solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.value)); solr_string_appendc(&tmp_buffer, solr_param->arg_separator); solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.arg)); add_next_index_stringl(param_value_array, tmp_buffer.str, tmp_buffer.len, duplicate); solr_string_free(&tmp_buffer); current_ptr = current_ptr->next; } } /* }}} */ /* }}} */ /* {{{ Parameter retrieval functions. Only used for toString() */ /* {{{ PHP_SOLR_API void solr_normal_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode) */ PHP_SOLR_API void solr_normal_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode) { solr_param_value_t *current_ptr = solr_param->head; solr_char_t glue = '&'; if (!solr_param->allow_multiple) { auto int new_pv_length = 0; solr_char_t *url_encoded_param_value = NULL; if (url_encode) { url_encoded_param_value = (solr_char_t *) php_raw_url_encode((char *) current_ptr->contents.normal.str, current_ptr->contents.normal.len, &new_pv_length); } else { new_pv_length = current_ptr->contents.normal.len; url_encoded_param_value = solr_strndup(current_ptr->contents.normal.str, current_ptr->contents.normal.len); } solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); solr_string_appends(buffer, url_encoded_param_value, new_pv_length); efree(url_encoded_param_value); } else { ulong n_loops = solr_param->count - 1; auto int new_pv_length = 0; solr_char_t *url_encoded_param_value = NULL; while(n_loops) { new_pv_length = 0; if (url_encode) { url_encoded_param_value = php_raw_url_encode(current_ptr->contents.normal.str, current_ptr->contents.normal.len, &new_pv_length); } else { new_pv_length = current_ptr->contents.normal.len; url_encoded_param_value = solr_strndup(current_ptr->contents.normal.str, current_ptr->contents.normal.len); } solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); solr_string_appends(buffer, url_encoded_param_value, new_pv_length); efree(url_encoded_param_value); url_encoded_param_value = NULL; solr_string_appendc(buffer, glue); n_loops--; current_ptr = current_ptr->next; } if (url_encode) { url_encoded_param_value = php_raw_url_encode(current_ptr->contents.normal.str, current_ptr->contents.normal.len, &new_pv_length); } else { new_pv_length = current_ptr->contents.normal.len; url_encoded_param_value = solr_strndup(current_ptr->contents.normal.str, current_ptr->contents.normal.len); } solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); solr_string_appends(buffer, url_encoded_param_value, new_pv_length); efree(url_encoded_param_value); url_encoded_param_value = NULL; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_simple_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode) */ PHP_SOLR_API void solr_simple_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode) { solr_param_value_t *current_ptr = solr_param->head; solr_char_t list_delimiter = solr_param->delimiter; /* Comma 0x2C */ ulong n_loops = solr_param->count - 1; auto solr_string_t tmp_buffer; auto int new_pv_length = 0; solr_char_t *url_encoded_list = NULL; solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); memset(&tmp_buffer, 0, sizeof(solr_string_t)); while(n_loops) { solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.simple_list)); solr_string_appendc(&tmp_buffer, list_delimiter); n_loops--; current_ptr = current_ptr->next; } solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.simple_list)); if (url_encode) { url_encoded_list = php_raw_url_encode(tmp_buffer.str, tmp_buffer.len, &new_pv_length); } else { new_pv_length = tmp_buffer.len; url_encoded_list = solr_strndup(tmp_buffer.str, tmp_buffer.len); } solr_string_appends(buffer, url_encoded_list, new_pv_length); efree(url_encoded_list); url_encoded_list = NULL; solr_string_free(&tmp_buffer); } /* }}} */ /* {{{ PHP_SOLR_API void solr_arg_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode) */ PHP_SOLR_API void solr_arg_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode) { solr_param_value_t *current_ptr = solr_param->head; solr_char_t list_delimiter = solr_param->delimiter; solr_char_t separator = solr_param->arg_separator; ulong n_loops = solr_param->count - 1; solr_string_t tmp_buffer; int new_pv_length = 0; solr_char_t *url_encoded_list = NULL; solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); memset(&tmp_buffer, 0, sizeof(solr_string_t)); while(n_loops) { solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.value)); if(current_ptr->contents.arg_list.delimiter_overriden) { if(strlen(current_ptr->contents.arg_list.delimiter_override) > 0) { solr_string_appendc(&tmp_buffer, (*current_ptr->contents.arg_list.delimiter_override)); } }else{ solr_string_appendc(&tmp_buffer, separator); } solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.arg)); solr_string_appendc(&tmp_buffer, list_delimiter); n_loops--; current_ptr = current_ptr->next; } /* process last parameter value */ solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.value)); /* check for separator override */ if(current_ptr->contents.arg_list.delimiter_overriden) { if(strlen(current_ptr->contents.arg_list.delimiter_override) > 0) { solr_string_appendc(&tmp_buffer, (*current_ptr->contents.arg_list.delimiter_override)); } }else{ solr_string_appendc(&tmp_buffer, separator); } solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.arg)); if (url_encode) { url_encoded_list = php_raw_url_encode(tmp_buffer.str, tmp_buffer.len, &new_pv_length); } else { new_pv_length = tmp_buffer.len; url_encoded_list = solr_strndup(tmp_buffer.str, tmp_buffer.len); } solr_string_appends(buffer, url_encoded_list, new_pv_length); efree(url_encoded_list); url_encoded_list = NULL; solr_string_free(&tmp_buffer); } /* }}} */ /* }}} */ /* {{{ Memory deallocation functions for parameter values */ /* {{{ PHP_SOLR_API void solr_normal_param_value_free(solr_param_value_t *param_value) */ PHP_SOLR_API void solr_normal_param_value_free(solr_param_value_t *param_value) { if (param_value) { solr_string_free(&(param_value->contents.normal)); pefree(param_value, SOLR_PARAMS_PERSISTENT); param_value = NULL; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_simple_list_param_value_free(solr_param_value_t *param_value) */ PHP_SOLR_API void solr_simple_list_param_value_free(solr_param_value_t *param_value) { if (param_value) { solr_string_free(&(param_value->contents.simple_list)); pefree(param_value, SOLR_PARAMS_PERSISTENT); param_value = NULL; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_arg_list_param_value_free(solr_param_value_t *param_value) */ PHP_SOLR_API void solr_arg_list_param_value_free(solr_param_value_t *param_value) { if (param_value) { solr_string_free(&(param_value->contents.arg_list.value)); solr_string_free(&(param_value->contents.arg_list.arg)); if(param_value->contents.arg_list.delimiter_override != NULL){ efree(param_value->contents.arg_list.delimiter_override); } pefree(param_value, SOLR_PARAMS_PERSISTENT); param_value = NULL; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_set_return_solr_params_object(zval **return_value_ptr, zval *current_objptr TSRMLS_DC) */ PHP_SOLR_API void solr_set_return_solr_params_object(zval **return_value_ptr, zval *current_objptr TSRMLS_DC) { zval_ptr_dtor(return_value_ptr); Z_SET_ISREF_P(current_objptr); Z_ADDREF_P(current_objptr); *return_value_ptr = current_objptr; } /* }}} */ /* {{{ PHP_SOLR_API int solr_delete_solr_parameter(zval *objptr, solr_char_t *name, int name_length TSRMLS_DC) */ PHP_SOLR_API int solr_delete_solr_parameter(zval *objptr, solr_char_t *name, int name_length TSRMLS_DC) { solr_params_t *solr_params = NULL; HashTable *params_ht = NULL; if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params_ht = solr_params->params; if (zend_hash_del(params_ht, name, name_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "parameter '%s' was not set. Attempting to remove an undefined parameter.", name); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_delete_normal_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC) */ PHP_SOLR_API int solr_delete_normal_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC) { solr_params_t *solr_params = NULL; HashTable *params_ht = NULL; solr_param_t **param_ptr = NULL; solr_param_value_t *target_value = NULL; if (!pname_length) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter value"); return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params_ht = solr_params->params; if (zend_hash_find(params_ht, pname, pname_length, (void **) ¶m_ptr) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "parameter could not be retrieved from HashTable"); return FAILURE; } target_value = (solr_param_value_t *) pecalloc(1, sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); solr_string_appends(&(target_value->contents.normal), pvalue, pvalue_length); solr_params_delete_param_value((*param_ptr), target_value TSRMLS_CC); /* We are done with target_value. */ (*param_ptr)->value_free_func(target_value); if ((*param_ptr)->count < 1U) { zend_hash_del(params_ht, pname, pname_length); #if SOLR_DEBUG php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Deleted last value from parameter. Removing parameter '%s' from object instance.", pname); #endif } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_delete_simple_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC) */ PHP_SOLR_API int solr_delete_simple_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC) { solr_params_t *solr_params = NULL; solr_param_t **param_ptr = NULL; HashTable *params_ht = NULL; solr_param_value_t *target_value = NULL; if (!pname_length) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter value"); return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params_ht = solr_params->params; if (zend_hash_find(params_ht, pname, pname_length, (void **) ¶m_ptr) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "parameter could not be retrieved from HashTable"); return FAILURE; } target_value = (solr_param_value_t *) pecalloc(1, sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); solr_string_appends(&(target_value->contents.simple_list), pvalue, pvalue_length); solr_params_delete_param_value((*param_ptr), target_value TSRMLS_CC); /* We are done with target_value. */ (*param_ptr)->value_free_func(target_value); if ((*param_ptr)->count < 1U) { zend_hash_del(params_ht, pname, pname_length); #if SOLR_DEBUG php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Deleted last value from parameter. Removing parameter '%s' from object instance.", pname); #endif } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_delete_arg_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC) */ PHP_SOLR_API int solr_delete_arg_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC) { solr_params_t *solr_params = NULL; HashTable *params_ht = NULL; solr_param_t **param_ptr = NULL; solr_param_value_t *target_value = NULL; if (!pname_length) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter value"); return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params_ht = solr_params->params; if (zend_hash_find(params_ht, pname, pname_length, (void **) ¶m_ptr) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "parameter could not be retrieved from HashTable"); return FAILURE; } target_value = (solr_param_value_t *) pecalloc(1, sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); solr_string_appends(&(target_value->contents.arg_list.value), pvalue, pvalue_length); solr_params_delete_param_value((*param_ptr), target_value TSRMLS_CC); /* We are done with target_value. */ (*param_ptr)->value_free_func(target_value); if ((*param_ptr)->count < 1U) { zend_hash_del(params_ht, pname, pname_length); #if SOLR_DEBUG php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Deleted last value from parameter. Removing parameter '%s' from object instance.", pname); #endif } return SUCCESS; } /* }}} */ /* }}} */ /* {{{ PHP_SOLR_API int solr_param_find(zval *objptr, solr_char_t *pname, int pname_length, solr_param_t **solr_param TSRMLS_DC) */ PHP_SOLR_API int solr_param_find(zval *objptr, solr_char_t *pname, int pname_length, solr_param_t **solr_param TSRMLS_DC) { solr_params_t *solr_params = NULL; HashTable *params_ht = NULL; solr_param_t **solr_param_tmp = NULL; if (!pname_length) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter name"); return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params_ht = solr_params->params; if (zend_hash_find(params_ht, pname, pname_length, (void **) &solr_param_tmp) == FAILURE) { return FAILURE; } (*solr_param) = (*solr_param_tmp); return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_init_params(solr_params_t **solr_params, long int index TSRMLS_DC) Initialize solr_params_t structure */ PHP_SOLR_API int solr_init_params(solr_params_t **solr_params, long int index TSRMLS_DC) { uint nSize = SOLR_INITIAL_HASH_TABLE_SIZE; solr_params_t solr_params_tmp; if (zend_hash_index_update(SOLR_GLOBAL(params), index, (void *) &solr_params_tmp, sizeof(solr_params_t), (void **) solr_params) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error while registering query parameters in HashTable"); return FAILURE; } (*solr_params)->params_index = index; (*solr_params)->params_count = 0U; /* Allocated memory for the parameters HashTable using fast cache for HashTables */ ALLOC_HASHTABLE((*solr_params)->params); zend_hash_init((*solr_params)->params, nSize, NULL, (dtor_func_t) solr_destroy_param, SOLR_PARAMS_PERSISTENT); return SUCCESS; } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/solr_functions_response.c000066400000000000000000000073001374041537100241370ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Israel Ekpo | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* Used to set the properties of the SolrResponse instance after a call to the server */ /* {{{ PHP_SOLR_API void solr_set_response_object_properties(zend_class_entry *scope, zval *response_object, const solr_client_t *client, const solr_string_t *request_url, zend_bool success TSRMLS_DC) */ PHP_SOLR_API void solr_set_response_object_properties(zend_class_entry *scope, zval *response_object, const solr_client_t *client, const solr_string_t *request_url, zend_bool success TSRMLS_DC) { const solr_curl_t *handle = &(client->handle); const solr_string_t *raw_request_headers = &(handle->request_header.buffer); const solr_string_t *raw_request = &(handle->request_body_debug.buffer); const solr_string_t *raw_response_headers = &(handle->response_header.buffer); const solr_string_t *raw_response = &(handle->response_body.buffer); const solr_string_t *response_writer = &(client->options.response_writer); long int http_status = handle->response_header.response_code; zend_update_property_long(scope, response_object, "http_status", sizeof("http_status")-1, http_status TSRMLS_CC); zend_update_property_bool(scope, response_object, "success", sizeof("success")-1, success TSRMLS_CC); if (response_writer->str) { zend_update_property_stringl(scope, response_object, "response_writer", sizeof("response_writer")-1, (char *)response_writer->str, response_writer->len TSRMLS_CC); } if (request_url->str) { zend_update_property_stringl(scope, response_object, "http_request_url", sizeof("http_request_url")-1, (char *)request_url->str, request_url->len TSRMLS_CC); } if (raw_request_headers->str) { zend_update_property_stringl(scope, response_object, "http_raw_request_headers", sizeof("http_raw_request_headers")-1, (char *)raw_request_headers->str, raw_request_headers->len TSRMLS_CC); } if (raw_request->str) { zend_update_property_stringl(scope, response_object, "http_raw_request", sizeof("http_raw_request")-1, (char *)raw_request->str, raw_request->len TSRMLS_CC); } if (raw_response_headers->str) { zend_update_property_stringl(scope, response_object, "http_raw_response_headers", sizeof("http_raw_response_headers")-1, (char *)raw_response_headers->str, raw_response_headers->len TSRMLS_CC); } if (raw_response->str) { zend_update_property_stringl(scope, response_object, "http_raw_response", sizeof("http_raw_response")-1, (char *)raw_response->str, raw_response->len TSRMLS_CC); } } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/solr_macros.h000066400000000000000000000153321374041537100215060ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #ifndef SOLR_MACROS_H #define SOLR_MACROS_H #include /* Macros for Object constructors and destructors declaration */ #define SOLR_CTOR(class_name, func_name, arginfo) PHP_ME(class_name, func_name, arginfo, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) #define SOLR_DTOR(class_name, func_name, arginfo) PHP_ME(class_name, func_name, arginfo, ZEND_ACC_PUBLIC | ZEND_ACC_DTOR) /* Retrieve a unique hash index for this SolrDocument. Unique for this thread */ #define SOLR_UNIQUE_DOCUMENT_INDEX() solr_hashtable_get_new_index(SOLR_GLOBAL(documents) TSRMLS_CC) /* Retrieve a unique hash index for this SolrClient. Unique for this thread */ #define SOLR_UNIQUE_CLIENT_INDEX() solr_hashtable_get_new_index(SOLR_GLOBAL(clients) TSRMLS_CC) /* Retrieve a unique hash index for this SolrParams instance. Unique for this thread */ #define SOLR_UNIQUE_PARAMS_INDEX() solr_hashtable_get_new_index(SOLR_GLOBAL(params) TSRMLS_CC) /* Retrieve a unique hash index for this SolrFunction instance. Unique for this thread */ #define SOLR_UNIQUE_FUNCTION_INDEX() solr_hashtable_get_new_index(SOLR_GLOBAL(functions) TSRMLS_CC) /* Iterates through the HashTable pointer */ #define SOLR_HASHTABLE_FOR_LOOP(HashTablePtr) \ if (HashTablePtr) for ( zend_hash_internal_pointer_reset((HashTablePtr)); \ SUCCESS == zend_hash_has_more_elements((HashTablePtr)); \ zend_hash_move_forward((HashTablePtr)) ) /* Gets a random number between 1 and SHRT_MAX */ #define SOLR_GET_RANDOM_NUMBER() abs(rand() % SHRT_MAX + 1) /* {{{ Memory Allocation Macros */ /* Used only to release truly persistent allocations */ #define SOLR_FREE_PTR(ptr) { if (ptr != NULL) { pefree(ptr,SOLR_HASHTABLE_PERSISTENT); ptr = NULL; } else { printf("\nSOLR_FREE_PTR double free() from function %s() called in %s on line %d\n", __func__, __FILE__, __LINE__); } } /* }}} */ /** * Used to retrieve xmlAttr and xmlNode values * * At this time, I am not sure if the next and previous sibling links * are guaranteed to be document order 100% of the time. * This is why I am requiring matches for the attribute and element names before * copying values from the attributes or element nodes. * Since I am not 100%, I believe it is better to be safe than sorry. * There may be a slight performance hit but at least correctness is guaranteed. */ #define solr_xml_match_node(solrXmlNode, solrXmlNodeName) ( \ xmlStrEqual(solrXmlNode->name, (xmlChar *) solrXmlNodeName) && \ solrXmlNode->children && solrXmlNode->children->content ) /* Checks if children is a valid struct */ #define solr_xml_child_content_is_valid(solrXmlNode) (solrXmlNode && solrXmlNode->children) /* Checks to prevent segmentation fault. Ensures that children is a valid struct before attempting to get content */ #define solr_xml_get_node_contents(solrXmlNode) (solr_xml_child_content_is_valid(solrXmlNode)? (solrXmlNode->children->content) : ((xmlChar *) "")) #define solr_xml_get_node_contents_int(solrXmlNode) atoi((char *)solr_xml_get_node_contents(solrXmlNode)) #define solr_xml_get_node_contents_double(solrXmlNode) xmlXPathCastStringToNumber(solr_xml_get_node_contents(solrXmlNode)) /** * Used to manage SolrQuery parameters that allow overrides by field name. * * Many parameters may be overridden on a per-field basis with the following syntax * * f..= * f..= * * @buf pointer to a solr_string_t object * @fname field name * @fname_len length of the field name * @pname a string constant representing the name of the parameter. */ #define solr_query_field_override(buf, fname, fname_len, pname) { \ if ((fname_len)) { \ solr_string_append_const((buf), "f."); \ solr_string_appends((buf), (fname), (fname_len)); \ solr_string_appendc((buf), '.'); \ } \ solr_string_append_const((buf), (pname)); \ } /* Macro for returning SolrParams objects if requested */ #define solr_return_solr_params_object() { \ if(return_value_used) { \ solr_set_return_solr_params_object((return_value_ptr), getThis() TSRMLS_CC); \ } \ } /* client macros */ #define SOLR_RESPONSE_CODE_BODY (client->handle.response_header.response_code), (client->handle.response_body.buffer.str) #define SOLR_SHOW_CURL_WARNING { \ if (client->handle.err.str) \ { \ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ((solr_char_t *) client->handle.err.str)); \ } \ } /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception */ #define HANDLE_SOLR_SERVER_ERROR(clientPtr,requestType){ \ if(clientPtr->handle.result_code == CURLE_OK){ \ solr_throw_solr_server_exception(clientPtr, (const char *)requestType TSRMLS_CC);\ } \ } /* solr_throw_exception_ex(solr_ce_SolrClientException, SOLR_ERROR_1010 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1010_MSG, requestType, SOLR_RESPONSE_CODE_BODY); \ */ #define SOLR_RETURN_THIS() { \ if(return_value_used) \ { \ RETURN_ZVAL(getThis(), 1, 0); \ } \ } /* Used to release the (solr_document_t **) pointers */ #define SOLR_FREE_DOC_ENTRIES(ptr) { \ if ((ptr) != NULL)\ { \ pefree(ptr, SOLR_DOCUMENT_PERSISTENT); \ ptr = NULL; \ } \ } /* }}} */ /* For php < 5.3.7 */ #ifndef PHP_FE_END #define PHP_FE_END {NULL,NULL,NULL} #endif #ifndef ZEND_MOD_END #define ZEND_MOD_END {NULL, NULL, NULL} #endif #endif /* SOLR_MACROS_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/solr_string.c000066400000000000000000000160401374041537100215200ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Israel Ekpo | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ static inline void solr_string_alloc(solr_string_t *dest, size_t length, size_t *new_length SOLR_MEM_DEBUG_DC) */ static inline void solr_string_alloc(solr_string_t *dest, size_t length, size_t *new_length SOLR_MEM_DEBUG_DC) { /* If buffer is empty */ if (!dest->str) { (*new_length) = length; dest->cap = ((*new_length) < SOLR_STRING_START_SIZE) ? SOLR_STRING_START_SIZE : (length + SOLR_STRING_INCREMENT_SIZE); dest->str = (solr_char_t *) perealloc(dest->str, dest->cap * sizeof(solr_char_t), SOLR_STRING_PERSISTENT); } else { (*new_length) = dest->len + length; /* If the buffer full, get more space */ if ((*new_length) >= dest->cap) { dest->cap = (*new_length) + SOLR_STRING_INCREMENT_SIZE; dest->str = (solr_char_t *) perealloc(dest->str, dest->cap * sizeof(solr_char_t), SOLR_STRING_PERSISTENT); } } #ifdef SOLR_MEM_DEBUG php_printf("solr_string_alloc() [Re]allocated %u bytes at %p in %s(), %s Line %d \n", dest->cap, dest->str SOLR_MEM_DEBUG_CC); #endif } /* }}} */ /* {{{ PHP_SOLR_API void solr_string_appends(solr_string_t *dest, const solr_char_t *src, size_t length SOLR_MEM_DEBUG_DC) */ PHP_SOLR_API void solr_string_appends_ex(solr_string_t *dest, const solr_char_t *src, size_t length SOLR_MEM_DEBUG_DC) { auto size_t __new_length = 0U; /* (Re)allocates memory and increases the capacity if necessary */ solr_string_alloc(dest, length, &__new_length SOLR_MEM_DEBUG_CC); /* Copy the data from the source to the destination */ memcpy(dest->str + dest->len, src, length); /* Reset the length of the solr_string to the new value */ dest->len = __new_length; /* Always make it a null-terminated string */ dest->str[__new_length] = (solr_char_t) 0x00; } /* }}} */ /* {{{ PHP_SOLR_API void solr_string_appendc(solr_string_t *dest, solr_char_t ch SOLR_MEM_DEBUG_DC) */ PHP_SOLR_API void solr_string_appendc_ex(solr_string_t *dest, solr_char_t ch SOLR_MEM_DEBUG_DC) { auto size_t __new_length = 0U; /* (Re)allocates memory and increases the capacity if necessary */ solr_string_alloc(dest, 1, &__new_length SOLR_MEM_DEBUG_CC); dest->str[dest->len] = ch; /* Reset the length of the solr_string to the new value (dest->len + 1) */ dest->len = __new_length; /* Always make it a null-terminated string */ dest->str[__new_length] = (solr_char_t) 0x00; } /* }}} */ /* {{{ PHP_SOLR_API void solr_string_remove_last_char(solr_string_t *dest) */ PHP_SOLR_API void solr_string_remove_last_char(solr_string_t *dest) { if (dest->str && dest->len) { dest->str[dest->len - 1] = (solr_char_t) 0x00; dest->len--; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_string_append_long(solr_string_t *dest, long int long_val) */ PHP_SOLR_API void solr_string_append_long_ex(solr_string_t *dest, long int long_val SOLR_MEM_DEBUG_DC) { auto size_t __new_length = 0U; auto char tmp_buffer[SOLR_STRING_LONG_BUFFER_SIZE]; size_t length = 0; /* Write the formated long to the buffer */ php_sprintf(tmp_buffer, "%ld", long_val); length = strlen(tmp_buffer); /* (Re)allocates memory and increases the capacity if necessary */ solr_string_alloc(dest, length, &__new_length SOLR_MEM_DEBUG_CC); /* Copy the data from the source to the destination */ memcpy(dest->str + dest->len, tmp_buffer, length); /* Reset the length of the solr_string to the new value */ dest->len = __new_length; /* Always make it a null-terminated string */ dest->str[__new_length] = (solr_char_t) 0x00; } /* }}} */ /* {{{ PHP_SOLR_API void solr_string_append_unsigned_long(solr_string_t *dest, unsigned long int long_val) */ PHP_SOLR_API void solr_string_append_unsigned_long_ex(solr_string_t *dest, unsigned long int long_val SOLR_MEM_DEBUG_DC) { auto size_t __new_length = 0U; auto char tmp_buffer[SOLR_STRING_UNSIGNED_LONG_BUFFER_SIZE]; size_t length = 0; /* Write the formated unsigned long to the buffer */ php_sprintf(tmp_buffer, "%lu", long_val); length = strlen(tmp_buffer); /* (Re)allocates memory and increases the capacity if necessary */ solr_string_alloc(dest, length, &__new_length SOLR_MEM_DEBUG_CC); /* Copy the data from the source to the destination */ memcpy(dest->str + dest->len, tmp_buffer, length); /* Reset the length of the solr_string to the new value */ dest->len = __new_length; /* Always make it a null-terminated string */ dest->str[__new_length] = (solr_char_t) 0x00; } /* }}} */ /** * Checks if both strings are equal OR have same exact content. * * Returns 1 if they are equal, 0 if they are different. */ /* {{{ PHP_SOLR_API int solr_string_equal(const solr_string_t *a, const solr_string_t *b) */ PHP_SOLR_API int solr_string_equal(const solr_string_t *a, const solr_string_t *b) { const solr_char_t *str1 = a->str; const solr_char_t *str2 = b->str; if (str1 == str2) return 1; if (str1 == NULL) return 0; if (str2 == NULL) return 0; do { if (*str1++ != *str2) return(0); } while (*str2++); return 1; } /* }}} */ /* Deallocates memory for the buffer */ /* {{{ PHP_SOLR_API void solr_string_free(solr_string_t *dest SOLR_MEM_DEBUG_DC) */ PHP_SOLR_API void solr_string_free_ex(solr_string_t *dest SOLR_MEM_DEBUG_DC) { /* Only attempt this if the buffer is still valid */ if (dest->str) { #ifdef SOLR_MEM_DEBUG php_printf("solr_string_free_ex() Releasing %u bytes at %p in %s(), %s Line %d \n", dest->cap, dest->str SOLR_MEM_DEBUG_CC); #endif pefree(dest->str, SOLR_STRING_PERSISTENT); dest->str = (solr_char_t *) 0x00; dest->cap = dest->len = 0U; } } /* }}} */ /* Update the contents of the dest solr_string */ /* {{{ PHP_SOLR_API void solr_string_set(solr_string_t *dest, const solr_char_t *value, size_t length SOLR_MEM_DEBUG_DC) */ PHP_SOLR_API void solr_string_set_ex(solr_string_t *dest, const solr_char_t *value, size_t length SOLR_MEM_DEBUG_DC) { solr_string_free(dest); solr_string_appends(dest, value, length); } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/solr_string.h000066400000000000000000000115761374041537100215360ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Israel Ekpo | +----------------------------------------------------------------------+ */ /* $Id$ */ #ifndef SOLR_STRING_H #define SOLR_STRING_H #include
#include #define SOLR_STRING_PERSISTENT 0 #define SOLR_STRING_START_SIZE 64 #define SOLR_STRING_INCREMENT_SIZE 128 #define SOLR_STRING_LONG_BUFFER_SIZE 16 #define SOLR_STRING_UNSIGNED_LONG_BUFFER_SIZE 32 #include "php_solr_api.h" #ifdef SOLR_DEBUG /* #define SOLR_MEM_DEBUG 1 Uncomment if you need memdebug enabled */ #endif #ifdef SOLR_MEM_DEBUG #define SOLR_MEM_DEBUG_DC , const char * mm_function, char * mm_filename, int mm_line #define SOLR_MEM_DEBUG_CC , mm_function, mm_filename, mm_line #define SOLR_MEM_DEBUG_RC , __func__, __FILE__, __LINE__ #else #define SOLR_MEM_DEBUG_DC #define SOLR_MEM_DEBUG_CC #define SOLR_MEM_DEBUG_RC #endif /** * solr_char_t * * iekpo 2009/08/28 * * Decided to create this type just in case there is a special need in the * future to use unsigned char instead of plain char to transport character * arrays within the library. * * Having this typedef will allow us to toggle easily between plain char and * unsigned char, without having to do a massive search and replace. * * There may be a few cases where casting may be needed to handle cases where * the sign of the variable is now the opposite. */ typedef char solr_char_t; /* Structure to store solr strings */ typedef struct _solr_string { solr_char_t *str; /* The buffer to store the character array. */ size_t len; /* The current length of the solr_string_t object */ size_t cap; /* The current capacity of the solr_string_t object */ } solr_string_t; #define SOLR_STRING_INITIALIZER {.str = ((solr_char_t *)0), .len = 0U, .cap = 0U} /* Appends a string constant to a solr_string_t */ #define solr_string_append_const(dest, str) solr_string_appends((dest), (solr_char_t *) str, sizeof(str)-1) /* Appends one solr_string_t to another */ #define solr_string_append_solr_string(dest, src) solr_string_appends((dest), (src)->str, (src)->len) /* Initializes the solr_string_t structure to empty values */ #define solr_string_init(dest) \ { \ (dest)->str = (solr_char_t *) 0x00; \ (dest)->len = 0U; \ (dest)->cap = 0U; \ } #define solr_strndup estrndup #define solr_strdup estrdup #define solr_strlen strlen #define solr_string_appends(dest, src, len) solr_string_appends_ex((dest), (src), (len) SOLR_MEM_DEBUG_RC) #define solr_string_appendc(dest, ch) solr_string_appendc_ex((dest), (ch) SOLR_MEM_DEBUG_RC) #define solr_string_append_long(dest, long_val) solr_string_append_long_ex((dest), (long_val) SOLR_MEM_DEBUG_RC) #define solr_string_append_unsigned_long(dest, long_val) solr_string_append_unsigned_long((dest), (long_val) SOLR_MEM_DEBUG_RC) #define solr_string_set(dest, value, length) solr_string_set_ex((dest), (value), (length) SOLR_MEM_DEBUG_RC) #define solr_string_free(dest) solr_string_free_ex((dest) SOLR_MEM_DEBUG_RC) PHP_SOLR_API void solr_string_appends_ex(solr_string_t *dest, const solr_char_t *src, size_t length SOLR_MEM_DEBUG_DC); PHP_SOLR_API void solr_string_appendc_ex(solr_string_t *dest, solr_char_t ch SOLR_MEM_DEBUG_DC); PHP_SOLR_API void solr_string_append_long_ex(solr_string_t *dest, long int long_val SOLR_MEM_DEBUG_DC); PHP_SOLR_API void solr_string_append_unsigned_long_ex(solr_string_t *dest, unsigned long int long_val SOLR_MEM_DEBUG_DC); PHP_SOLR_API void solr_string_remove_last_char(solr_string_t *dest); PHP_SOLR_API int solr_string_equal(const solr_string_t *a, const solr_string_t *b); PHP_SOLR_API void solr_string_free_ex(solr_string_t *dest SOLR_MEM_DEBUG_DC); PHP_SOLR_API void solr_string_set_ex(solr_string_t *dest, const solr_char_t *value, size_t length SOLR_MEM_DEBUG_DC); #endif /* SOLR_STRING_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php5/solr_types.h000066400000000000000000000315341374041537100213700ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #ifndef SOLR_TYPES_H #define SOLR_TYPES_H #include
#include #include #include #include /* Declaring workarounds for SSL private key constants */ #if LIBCURL_VERSION_NUM >= 0x071700 /* Use CURLOPT_KEYPASSWD as is */ #elif LIBCURL_VERSION_NUM >= 0x070903 #define CURLOPT_KEYPASSWD CURLOPT_SSLKEYPASSWD #else #define CURLOPT_KEYPASSWD CURLOPT_SSLCERTPASSWD #endif #include #include #include #include #include #include typedef unsigned char solr_bool; #include "solr_string.h" /* {{{ types for the http client */ typedef enum { SOLR_REQUEST_BEGIN = 0, SOLR_REQUEST_SEARCH = 1, /** 1 **/ SOLR_REQUEST_UPDATE = 2, /** 2 **/ SOLR_REQUEST_THREADS = 3, /** 3 **/ SOLR_REQUEST_PING = 4, /** 4 **/ SOLR_REQUEST_TERMS = 5, /** 5 **/ SOLR_REQUEST_SYSTEM = 6, /** 6 **/ SOLR_REQUEST_GET = 7, SOLR_REQUEST_END } solr_request_type_t; typedef enum { SOLR_SERVLET_TYPE_BEGIN = 0, SOLR_SERVLET_TYPE_SEARCH = 1, SOLR_SERVLET_TYPE_UPDATE = 2, SOLR_SERVLET_TYPE_THREADS = 4, SOLR_SERVLET_TYPE_PING = 8, SOLR_SERVLET_TYPE_TERMS = 16, SOLR_SERVLET_TYPE_SYSTEM = 32, SOLR_SERVLET_TYPE_GET = 64, SOLR_SERVLET_TYPE_END } solr_servlet_type_t; typedef enum { SOLR_PARAM_TYPE_BEGIN = 0, SOLR_PARAM_TYPE_NORMAL = 1, SOLR_PARAM_TYPE_SIMPLE_LIST = 2, SOLR_PARAM_TYPE_ARG_LIST = 4, SOLR_PARAM_TYPE_END } solr_param_type_t; typedef enum { SOLR_SORT_DIR_ASC = 0, SOLR_SORT_DIR_DESC = 1 } solr_sort_dir_t; typedef enum { SOLR_JSON_ERROR_NONE = 0, SOLR_JSON_ERROR_DEPTH, SOLR_JSON_ERROR_STATE_MISMATCH, SOLR_JSON_ERROR_CTRL_CHAR, SOLR_JSON_ERROR_SYNTAX, SOLR_JSON_ERROR_UTF8, SOLR_JSON_ERROR_SERIALIZATION } solr_json_error_codes_t; typedef struct curl_slist solr_http_header_list_t; typedef struct { solr_string_t buffer; /* Stores the HTTP request headers */ } solr_curl_send_headers_t; typedef struct _solr_curl_send_data { solr_string_t buffer; /* Stores the HTTP request data */ } solr_curl_send_data_t; typedef struct { solr_string_t buffer; /* Stores the HTTP response headers */ long int response_code; /* Stores the HTTP response code */ } solr_curl_response_headers_t; typedef struct { solr_string_t buffer; /* Stores the HTTP response data */ } solr_curl_response_data_t; typedef struct { char str[CURL_ERROR_SIZE + 1]; /* Stores the error message */ uint number; /* Stores the error number */ } solr_curl_error_t; typedef struct { solr_curl_send_headers_t request_header; solr_curl_send_data_t request_body; solr_curl_send_data_t request_body_debug; solr_curl_response_headers_t response_header; solr_curl_response_data_t response_body; solr_curl_error_t err; solr_string_t debug_data_buffer; /* Stores all the debug data */ size_t handle_status; /* Whether or not the handle is still usable */ CURLcode result_code; CURL *curl_handle; #ifdef ZTS TSRMLS_D; #endif } solr_curl_t; typedef struct { long int host_port; /* HTTP port for Solr server */ long int proxy_port; /* Proxy port for Solr server */ long int timeout; /* maximum time in seconds allowed for the http data transfer operation */ long int secure; /* Whether to connect to Solr Server using SSL/HTTPS */ long int ssl_verify_peer; /* Determines whether libcurl verifies the peer certificate */ long int ssl_verify_host; /* Determines how libcurl verifies the server certificate */ solr_string_t hostname; /* IP address or domain name */ solr_string_t path; /* Path to solr */ solr_string_t http_auth_credentials; /* HTTP Auth username:password */ solr_string_t proxy_hostname; /* IP address of domain name for the proxy server */ solr_string_t proxy_auth_credentials; /* Proxy Auth username:password */ solr_string_t ssl_cert; /* File name to a PEM-formatted private key + private certificate (concatenated in that order) */ solr_string_t ssl_key; /* File name to a PEM-formatted private key */ solr_string_t ssl_keypassword; /* The pass phrase/password for the private ssl_key */ solr_string_t ssl_cainfo; /* Name of file holding one or more certificates to verify peer with */ solr_string_t ssl_capath; /* Name of directory holding multiple CA certificates to verify peer with */ solr_string_t qs_delimiter; /* The query string delimiter */ solr_string_t response_writer; /* The response writer type (wt parameter) */ solr_string_t update_url; /* URL used for updates */ solr_string_t search_url; /* URL used for queries */ solr_string_t thread_url; /* URL used for thread monitoring */ solr_string_t ping_url; /* URL for sending ping requests */ solr_string_t terms_url; /* URL for sending terms requests */ solr_string_t system_url; /* URL for sending system requests */ solr_string_t get_url; /* URL for sending realtime get requests */ solr_string_t update_servlet; /* The update servlet */ solr_string_t search_servlet; /* The search servlet */ solr_string_t thread_servlet; /* The thread servlet */ solr_string_t ping_servlet; /* The ping servlet */ solr_string_t terms_servlet; /* The terms servlet */ solr_string_t system_servlet; /* The system info servlet */ solr_string_t get_servlet; /* The realtime get servlet */ } solr_client_options_t; typedef struct { ulong client_index; /* Unique for the SolrClient instance. Used as index in HashTables */ uint request_count; /* The number of requests made from this client */ solr_client_options_t options; /* The connection options for this client */ solr_curl_t handle; /* The Solr handle for this client */ } solr_client_t; /* }}} */ /* Types for documents and collections */ /* {{{ Types for documents and collections */ /* {{{ Types for SolrDocument fields */ typedef struct _solr_field_value_t { solr_char_t *field_value; /* The value for this field */ struct _solr_field_value_t *next; /* The next entry in the queue */ } solr_field_value_t; /** * List of Fields in a Solr Document * * @field_boost stores the boost value * @count stores how many fields there are in the list * @field_name stores the name of the field * @head the first entry in the list (if any) * @last the last entry in the list (if any) */ typedef struct { double field_boost; /* The boost value for this field */ uint count; /* The number of values in this field */ solr_char_t *field_name; /* The name of the field */ solr_field_value_t *head; /* The first value in the queue */ solr_field_value_t *last; /* The last value in the queue */ } solr_field_list_t; /* }}} */ /* {{{ Types for Documents and Document Collections */ typedef struct { ulong document_index; /* Unique for the SolrInputDocument instance. Used as index in HashTables */ uint field_count; /* Number of fields in this document */ double document_boost; /* The boost value for this document */ HashTable *fields; /* HashTable for storing all the solr_field_list_t fields */ HashTable *children; /* Hashtable for storing child documents(zval *) */ } solr_document_t; /* }}} */ /* {{{ Types for Solr Query Parameters */ typedef struct { solr_string_t value; /* The value for this parameter */ solr_string_t arg; /* The argument for this value*/ solr_char_t *delimiter_override; /* overrides the arg_list delimiter for this particular argument */ solr_bool delimiter_overriden; /* is delimiter overriden */ } solr_arg_list_value_t; typedef union { solr_string_t normal; /* Stores normal parameters */ solr_string_t simple_list; /* Stores delimited list parameters */ solr_arg_list_value_t arg_list; /* Stores parameters that have arguments */ } solr_pvc_t; typedef struct _solr_param_value_t { solr_pvc_t contents; /* A union for the contents of this value */ struct _solr_param_value_t *prev; /* The previous value in the list */ struct _solr_param_value_t *next; /* The next value in the list */ } solr_param_value_t; /* Checks if two parameter values are equal */ typedef int (*solr_param_value_equal_func_t)(const solr_param_value_t *a, const solr_param_value_t *b); /* Used to retrieve all the values for this parameter as a single solr string */ typedef void (*solr_param_fetch_func_t)(void *solr_param, solr_string_t *buffer); /* Frees the parameter value and its contents. */ typedef void (*solr_param_value_free_func_t)(solr_param_value_t *param_value); typedef struct { solr_param_type_t type; /* What type of query parameter this is */ uint count; /* The number of values for this parameter */ solr_char_t *param_name; /* The name of the parameter */ size_t param_name_length; /* The length of name of the parameter */ solr_bool allow_multiple; /* Whether this parameter should store more than one value */ solr_param_value_t *head; /* The first value in the list */ solr_param_value_t *last; /* The last value in the list */ solr_param_fetch_func_t fetch_func; /* Retrieves all the value contents as a single solr_string_t */ solr_param_value_free_func_t value_free_func; /* Frees the value and its contents */ solr_param_value_equal_func_t value_equal_func; /* Checks if two values are equal */ solr_char_t delimiter; /* Default is "," Used to separate list parameter values */ solr_char_t arg_separator; /* Used only be arg_lists to separate arguments from values */ } solr_param_t; /* Used to retrieve parameter values just for display purposes */ typedef void (*solr_param_display_func_t)(solr_param_t *solr_param, zval *param_value_array); /* Used to retrieve parameter values just for the toString() method */ /* The url_encode parameter will be ignored for now */ typedef void (*solr_param_tostring_func_t)(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode); typedef struct { ulong params_index; /* The index for this object in the HashTable */ uint params_count; /* The number of parameters for the query object */ HashTable *params; /* The HashTable for storing query parameters */ } solr_params_t; /* }}} */ /* {{{ solr function/localparams type */ typedef struct { ulong function_index; /* The index for this object in the HashTable */ solr_char_t *name; size_t name_length; solr_char_t *argument; size_t argument_length; HashTable *params; /* The HashTable for storing function key-val parameters */ } solr_function_t; /* }}} */ /* }}} */ /* {{{ Extension Global : This should be the last data type declared. More members may be added later. */ ZEND_BEGIN_MODULE_GLOBALS(solr) uint request_count; /* The number of times PHP_RINIT has been called */ uint document_count; /* The number of active SolrDocuments in this request */ uint client_count; /* The number of active SolrClients in this request */ uint functions_count; /* The number of active Functions in this request */ HashTable *documents; /* HashTable for storing solr_document_t documents */ HashTable *clients; /* HashTable for storing solr_client_t clients */ HashTable *params; /* HashTable for storing solr_params_t parameter containers */ HashTable *functions; /* HashTable for storing solr_function_t */ ZEND_END_MODULE_GLOBALS(solr) /* }}} */ typedef struct { int code; solr_char_t *message; } solr_exception_t; #endif /* SOLR_TYPES_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/000077500000000000000000000000001374041537100170105ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/php_solr.c000066400000000000000000002001661374041537100210070ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" #ifdef HAVE_SOLR /* PHP versions lower than 5.2.3 are not compatible or are causing tests to FAIL */ #if ((PHP_MAJOR_VERSION < 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 2) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 2 && PHP_RELEASE_VERSION < 3)) #error PHP 5.2.3 or newer is required. Please upgrade your php version. #endif #if LIBCURL_VERSION_NUM < 0x070F00 #error libcurl 7.15.0 or later is required. Please upgrade your libcurl version. #endif #if LIBXML_VERSION < 20616 #error libxml2 2.6.16 or later is required. Please upgrade your libxml2 version. #endif /******************************************************************************/ /** GLOBAL VARIABLE FOR THE EXTENSION **/ /******************************************************************************/ /* {{{ ZEND_DECLARE_MODULE_GLOBALS(solr) */ ZEND_DECLARE_MODULE_GLOBALS(solr) /* }}} */ /******************************************************************************/ /** OBJECT HANDLERS AND DECLARATIONS FOR CLASS ENTRIES **/ /******************************************************************************/ /* {{{ zend_class_entry declarations of the classes */ zend_class_entry *solr_ce_SolrObject; zend_class_entry *solr_ce_SolrInputDocument; zend_class_entry *solr_ce_SolrDocument; zend_class_entry *solr_ce_SolrDocumentField; zend_class_entry *solr_ce_SolrClient; zend_class_entry *solr_ce_SolrParams; zend_class_entry *solr_ce_SolrModifiableParams; zend_class_entry *solr_ce_SolrCollapseFunction; zend_class_entry *solr_ce_SolrQuery; zend_class_entry *solr_ce_SolrResponse; zend_class_entry *solr_ce_SolrQueryResponse; zend_class_entry *solr_ce_SolrUpdateResponse; zend_class_entry *solr_ce_SolrPingResponse; zend_class_entry *solr_ce_SolrGenericResponse; zend_class_entry *solr_ce_SolrUtils; zend_class_entry *solr_ce_SolrException; zend_class_entry *solr_ce_SolrIllegalOperationException; zend_class_entry *solr_ce_SolrIllegalArgumentException; zend_class_entry *solr_ce_SolrClientException; zend_class_entry *solr_ce_SolrServerException; zend_class_entry *solr_ce_SolrMissingMandatoryParameterException; /* }}} */ /* {{{ zend_object_handlers */ zend_object_handlers solr_object_handlers; zend_object_handlers solr_document_field_handlers; zend_object_handlers solr_input_document_object_handlers; zend_object_handlers solr_client_object_handlers; zend_object_handlers solr_response_object_handlers; zend_object_handlers solr_collapse_function_object_handlers; /* }}} */ /* {{{ static void php_solr_globals_ctor(zend_solr_globals *solr_globals_arg TSRMLS_DC) Global variable initializer. In ZTS mode, called once for each thread spawned. */ static void php_solr_globals_ctor(zend_solr_globals *solr_globals_arg TSRMLS_DC) { /* Initializing the counters to Zero */ solr_globals_arg->request_count = 0U; solr_globals_arg->document_count = 0U; solr_globals_arg->client_count = 0U; solr_globals_arg->functions_count = 0U; solr_globals_arg->documents = NULL; solr_globals_arg->clients = NULL; solr_globals_arg->params = NULL; solr_globals_arg->functions = NULL; } /* }}} */ /******************************************************************************/ /** DECLARING STRUCTURES FOR METHOD ARGUMENTS TYPE HINTING **/ /******************************************************************************/ /* {{{ arg_info vectors for functions and methods */ ZEND_BEGIN_ARG_INFO_EX(SolrObject__get_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, property_name) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrObject__set_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, property_name) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, property_value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrObject_one_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, property_name) ZEND_END_ARG_INFO() /* {{{ SolrDocument arguments */ ZEND_BEGIN_ARG_INFO_EX(SolrDocument__construct_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_addField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldValue) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_getField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_fieldExists_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_deleteField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_sort_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, sortOrderBy) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, sortDirection) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_merge_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, sourceDoc, SolrDocument, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, overwrite) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_current_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_getInputDocument_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(SolrDocument_unserialize_args, 0) ZEND_ARG_INFO(0, serialized) ZEND_END_ARG_INFO() /* }}} */ /* {{{ SolrInputDocument arguments */ ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument__construct_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_setBoost_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, documentBoostValue) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_addField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldValue) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldBoostValue) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_getFieldBoost_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_getField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_setFieldBoost_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldBoostValue) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_fieldExists_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_deleteField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_sort_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, sortOrderBy) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, sortDirection) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_merge_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, sourceDoc, SolrInputDocument, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, overwrite) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_addChildDocument_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, child, SolrInputDocument, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_addChildDocuments_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_ARRAY_INFO(SOLR_ARG_PASS_BY_REF_TRUE, docs, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() /* }}} */ /* {{{ SolrClient arguments */ ZEND_BEGIN_ARG_INFO_EX(SolrClient_constructor_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_ARRAY_INFO(SOLR_ARG_PASS_BY_REF_FALSE, clientOptions, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_query_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, query, SolrParams, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_addDocument_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, doc, SolrInputDocument, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, overwrite) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, commitWithin) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_addDocuments_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_ARRAY_INFO(SOLR_ARG_PASS_BY_REF_TRUE, docs, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, overwrite) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, commitWithin) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_request_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, raw_request) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_setResponseWriter_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, responseWriter) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_commit_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, softCommit) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, waitSearcher) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, expungeDeletes) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_optimize_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, maxSegments) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, softCommit) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, waitSearcher) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_rollback_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_deleteById_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, id) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_deleteByIds_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_ARRAY_INFO(SOLR_ARG_PASS_BY_REF_FALSE, ids, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_deleteByQuery_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, query) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_deleteByQueries_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_ARRAY_INFO(SOLR_ARG_PASS_BY_REF_FALSE, queries, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_ping_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_threads_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_info_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_setServlet_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, type) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() /* }}} */ /* {{{ SolrParams arguments */ ZEND_BEGIN_ARG_INFO_EX(SolrParams_setParam_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, name) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrParams_addParam_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, name) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrParams_toString_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, url_encode) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrParams_getParam_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, param_name) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(SolrParams_unserialize_args, 0) ZEND_ARG_INFO(0, serialized) ZEND_END_ARG_INFO() /* }}} */ /* {{{ SolrQuery arguments */ ZEND_BEGIN_ARG_INFO_EX(SolrQuery_constructor_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, q) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setQuery_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, q) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setStart_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, start) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setRows_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, rows) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_addField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_addSortField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, order) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_addFilterQuery_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fq) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setShowDebugInfo_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, flag) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setExplainOther_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, flag) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setTimeAllowed_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, timeAllowed) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setOmitHeader_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, flag) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setEchoHandler_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, flag) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setEchoParams_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, type) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_facet_get_1_0_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field_override) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_facet_1_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_facet_2_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field_override) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_group_1_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_hl_get_1_0_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field_override) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_hl_1_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_hl_2_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field_override) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_stats_1_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_mlt_1_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_mlt_2_2_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, boost) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_terms_1_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setGroupCachePct_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, percent) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_collapse_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_TRUE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, collapseFunction, SolrCollapseFunction, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() /* }}} */ /* {{{ Solr Generic arguments */ ZEND_BEGIN_ARG_INFO_EX(Solr_no_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_END_ARG_INFO() /* }}} */ /* {{{ */ ZEND_BEGIN_ARG_INFO_EX(SolrResponse_setParseMode_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, parser_mode) ZEND_END_ARG_INFO() /* }}} */ /* {{{ SolrUtils */ ZEND_BEGIN_ARG_INFO_EX(SolrUtils_escapeQueryChars_arg, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, str) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrUtils_digestXML_arg, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, xmlresponse) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, parse_mode) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrUtils_digestJson_arg, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, jsonResponse) ZEND_END_ARG_INFO() /* }}} */ ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_construct_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_set_size_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, size) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_set_hint_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, hint) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_set_max_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, max) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_set_min_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, min) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_set_field_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_set_null_policy_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, policy) ZEND_END_ARG_INFO() /* }}} */ /* {{{ solr_functions[] */ static zend_function_entry solr_functions[] = { PHP_FE(solr_get_version, Solr_no_args) PHP_FE_END }; /* }}} */ /* {{{ solr_object_methods */ static zend_function_entry solr_object_methods[] = { SOLR_CTOR(SolrObject, __construct, Solr_no_args) SOLR_DTOR(SolrObject, __destruct, Solr_no_args) /** Temporarily disconnected for now. May be brought back in the future. PHP_ME(SolrObject, __set, SolrObject__set_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, __get, SolrObject__get_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, __isset, SolrObject_one_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, __unset, SolrObject_one_args, ZEND_ACC_PUBLIC) */ PHP_ME(SolrObject, offsetSet, SolrObject__set_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, offsetGet, SolrObject__get_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, offsetExists, SolrObject_one_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, offsetUnset, SolrObject_one_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, getPropertyNames, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_document_methods */ static zend_function_entry solr_document_field_methods[] = { SOLR_CTOR(SolrDocumentField, __construct, Solr_no_args) SOLR_DTOR(SolrDocumentField, __destruct, Solr_no_args) PHP_FE_END }; /* }}} */ /* {{{ solr_collapse_function_methods for the SolrCollapseFunction ce */ static zend_function_entry solr_collapse_function_methods[] = { SOLR_CTOR(SolrCollapseFunction, __construct, SolrCollapseFunction_construct_args) SOLR_DTOR(SolrCollapseFunction, __destruct, Solr_no_args) PHP_ME(SolrCollapseFunction, setField, SolrCollapseFunction_set_field_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, getField, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, setMax, SolrCollapseFunction_set_max_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, getMax, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, setMin, SolrCollapseFunction_set_min_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, getMin, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, setSize, SolrCollapseFunction_set_size_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, getSize, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, setHint, SolrCollapseFunction_set_hint_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, getHint, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, setNullPolicy, SolrCollapseFunction_set_null_policy_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, getNullPolicy, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, __toString, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, __sleep, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, __wakeup, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_document_methods */ static zend_function_entry solr_document_methods[] = { SOLR_CTOR(SolrDocument, __construct, SolrDocument__construct_args) SOLR_DTOR(SolrDocument, __destruct, Solr_no_args) PHP_ME(SolrDocument, __clone, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CLONE) PHP_ME(SolrDocument, __set, SolrDocument_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, __get, SolrDocument_getField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, __isset, SolrDocument_fieldExists_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, __unset, SolrDocument_deleteField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, offsetSet, SolrDocument_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, offsetGet, SolrDocument_getField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, offsetExists, SolrDocument_fieldExists_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, offsetUnset, SolrDocument_deleteField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, current, SolrDocument_current_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, key, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, next, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, rewind, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, valid, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, serialize, NULL, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, unserialize, SolrDocument_unserialize_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, clear, Solr_no_args, ZEND_ACC_PUBLIC) PHP_MALIAS(SolrDocument, reset, clear, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, addField, SolrDocument_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, getFieldNames, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, getFieldCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, getField, SolrDocument_getField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, toArray, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, fieldExists, SolrDocument_fieldExists_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, deleteField, SolrDocument_deleteField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, sort, SolrDocument_sort_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, merge, SolrDocument_merge_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, getInputDocument, SolrDocument_getInputDocument_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, getChildDocumentsCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, hasChildDocuments, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, getChildDocuments, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_input_document_methods */ static zend_function_entry solr_input_document_methods[] = { SOLR_CTOR(SolrInputDocument, __construct, SolrInputDocument__construct_args) SOLR_DTOR(SolrInputDocument, __destruct, Solr_no_args) PHP_ME(SolrInputDocument, __clone, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CLONE) PHP_ME(SolrInputDocument, __sleep, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, __wakeup, NULL, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, setBoost, SolrInputDocument_setBoost_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getBoost, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, clear, Solr_no_args, ZEND_ACC_PUBLIC) PHP_MALIAS(SolrInputDocument, reset, clear, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, addField, SolrInputDocument_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getFieldBoost, SolrInputDocument_getFieldBoost_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, setFieldBoost, SolrInputDocument_setFieldBoost_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getFieldNames, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getFieldCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getField, SolrInputDocument_getField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, toArray, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, fieldExists, SolrInputDocument_fieldExists_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, deleteField, SolrInputDocument_deleteField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, sort, SolrInputDocument_sort_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, merge, SolrInputDocument_merge_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, addChildDocument, SolrInputDocument_addChildDocument_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getChildDocuments, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, hasChildDocuments, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getChildDocumentsCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, addChildDocuments, SolrInputDocument_addChildDocuments_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_client_methods */ static zend_function_entry solr_client_methods[] = { SOLR_CTOR(SolrClient, __construct, SolrClient_constructor_args) SOLR_DTOR(SolrClient, __destruct, Solr_no_args) PHP_ME(SolrClient, __sleep, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, __wakeup, NULL, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, __clone, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CLONE) PHP_ME(SolrClient, getOptions, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, getDebug, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, setServlet, SolrClient_setServlet_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, query, SolrClient_query_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, addDocument, SolrClient_addDocument_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, addDocuments, SolrClient_addDocuments_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, request, SolrClient_request_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, setResponseWriter, SolrClient_setResponseWriter_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, deleteById, SolrClient_deleteById_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, deleteByIds, SolrClient_deleteByIds_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, deleteByQuery, SolrClient_deleteByQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, deleteByQueries, SolrClient_deleteByQueries_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, getById, SolrClient_deleteById_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, getByIds, SolrClient_deleteByIds_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, commit, SolrClient_commit_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, optimize, SolrClient_optimize_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, rollback, SolrClient_rollback_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, ping, SolrClient_ping_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, system, SolrClient_info_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, threads, SolrClient_threads_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_exception_methods. None. */ static zend_function_entry solr_exception_methods[] = { PHP_ME(SolrException, getInternalInfo, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_exception_methods. None. */ static zend_function_entry solr_client_exception_methods[] = { PHP_ME(SolrClientException, getInternalInfo, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_exception_methods. None. */ static zend_function_entry solr_server_exception_methods[] = { PHP_ME(SolrServerException, getInternalInfo, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_exception_methods. None. */ static zend_function_entry solr_illegal_operation_exception_methods[] = { PHP_ME(SolrIllegalOperationException, getInternalInfo, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_exception_methods. None. */ static zend_function_entry solr_illegal_argument_exception_methods[] = { PHP_ME(SolrIllegalArgumentException, getInternalInfo, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* PHP_MALIAS(SolrInputDocument, reset, clear, Solr_no_args, ZEND_ACC_PUBLIC) */ /* {{{ solr_params_methods. */ static zend_function_entry solr_params_methods[] = { PHP_ME(SolrParams, setParam, SolrParams_setParam_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, addParam, SolrParams_addParam_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, __toString, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, toString, SolrParams_toString_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, getParams, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, getParam, SolrParams_getParam_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, getPreparedParams, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, __clone, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CLONE) PHP_ME(SolrParams, serialize, NULL, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, unserialize, SolrParams_unserialize_args, ZEND_ACC_PUBLIC) PHP_MALIAS(SolrParams, add, addParam, SolrParams_addParam_args, ZEND_ACC_PUBLIC) PHP_MALIAS(SolrParams, set, setParam, SolrParams_setParam_args, ZEND_ACC_PUBLIC) PHP_MALIAS(SolrParams, get, getParam, SolrParams_getParam_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_modifiable_params_methods. */ static zend_function_entry solr_modifiable_params_methods[] = { SOLR_CTOR(SolrModifiableParams, __construct, Solr_no_args) SOLR_DTOR(SolrModifiableParams, __destruct, Solr_no_args) PHP_FE_END }; /* }}} */ /* {{{ solr_query_methods. */ static zend_function_entry solr_query_methods[] = { SOLR_CTOR(SolrQuery, __construct, SolrQuery_constructor_args) SOLR_DTOR(SolrQuery, __destruct, Solr_no_args) /* CommonQueryParameters */ PHP_ME(SolrQuery, setQuery, SolrQuery_setQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getQuery, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setStart, SolrQuery_setStart_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getStart, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setRows, SolrQuery_setRows_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getRows, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addField, SolrQuery_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeField, SolrQuery_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addSortField, SolrQuery_addSortField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeSortField, SolrQuery_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getSortFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addFilterQuery, SolrQuery_addFilterQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeFilterQuery, SolrQuery_addFilterQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFilterQueries, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setShowDebugInfo, SolrQuery_setShowDebugInfo_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setExplainOther, SolrQuery_setExplainOther_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTimeAllowed, SolrQuery_setTimeAllowed_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTimeAllowed, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setOmitHeader, SolrQuery_setOmitHeader_args, ZEND_ACC_PUBLIC) /* CoreQueryParameters */ PHP_ME(SolrQuery, setEchoHandler, SolrQuery_setEchoHandler_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setEchoParams, SolrQuery_setEchoParams_args, ZEND_ACC_PUBLIC) /* SimpleFacetParameters */ PHP_ME(SolrQuery, setFacet, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacet, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addFacetField, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeFacetField, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addFacetQuery, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeFacetQuery, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetQueries, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetPrefix, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetPrefix, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetSort, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetSort, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetLimit, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetLimit, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetOffset, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetOffset, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetMinCount, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetMinCount, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetMissing, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetMissing, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetMethod, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetMethod, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetEnumCacheMinDefaultFrequency, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) /* Date Faceting Parameters */ PHP_ME(SolrQuery, addFacetDateField, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeFacetDateField, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetDateFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetDateStart, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetDateStart, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetDateEnd, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetDateEnd, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetDateGap, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetDateGap, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetDateHardEnd, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetDateHardEnd, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addFacetDateOther, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeFacetDateOther, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetDateOther, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) /* SimpleGroupParameters */ PHP_ME(SolrQuery, setGroup, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroup, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addGroupField, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addGroupFunction, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupFunctions, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addGroupQuery, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupQueries, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupLimit, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupLimit, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupOffset, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupOffset, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addGroupSortField, SolrQuery_addSortField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupSortFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupFormat, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupFormat, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupMain, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupMain, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupNGroups, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupNGroups, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupTruncate, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupTruncate, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupFacet, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupFacet, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupCachePercent, SolrQuery_setGroupCachePct_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupCachePercent, Solr_no_args, ZEND_ACC_PUBLIC) /* Collapse Function */ PHP_ME(SolrQuery, collapse, SolrQuery_collapse_args, ZEND_ACC_PUBLIC) /* Expand Componenet */ PHP_ME(SolrQuery, setExpand, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getExpand, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addExpandSortField, SolrQuery_addSortField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeExpandSortField, SolrQuery_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getExpandSortFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setExpandRows, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getExpandRows, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setExpandQuery, SolrQuery_setQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getExpandQuery, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addExpandFilterQuery, SolrQuery_addFilterQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeExpandFilterQuery, SolrQuery_addFilterQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getExpandFilterQueries, Solr_no_args, ZEND_ACC_PUBLIC) /* HighlightingParameters */ PHP_ME(SolrQuery, setHighlight, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlight, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addHighlightField, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeHighlightField, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightSnippets, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightSnippets, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightFragsize, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightFragsize, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightMergeContiguous, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightMergeContiguous, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightRequireFieldMatch, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightRequireFieldMatch, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightMaxAnalyzedChars, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightMaxAnalyzedChars, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightAlternateField, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightAlternateField, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightMaxAlternateFieldLength, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightMaxAlternateFieldLength, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightFormatter, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightFormatter, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightSimplePre, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightSimplePre, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightSimplePost, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightSimplePost, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightFragmenter, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightFragmenter, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightUsePhraseHighlighter, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightUsePhraseHighlighter, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightHighlightMultiTerm, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightHighlightMultiTerm, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightRegexSlop, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightRegexSlop, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightRegexPattern, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightRegexPattern, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightRegexMaxAnalyzedChars, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightRegexMaxAnalyzedChars, Solr_no_args, ZEND_ACC_PUBLIC) /* StatsComponent */ PHP_ME(SolrQuery, setStats, SolrQuery_stats_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getStats, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addStatsField, SolrQuery_stats_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeStatsField, SolrQuery_stats_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getStatsFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addStatsFacet, SolrQuery_stats_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeStatsFacet, SolrQuery_stats_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getStatsFacets, Solr_no_args, ZEND_ACC_PUBLIC) /* MoreLikeThis */ PHP_ME(SolrQuery, setMlt, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMlt, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltCount, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addMltField, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeMltField, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addMltQueryField, SolrQuery_mlt_2_2_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeMltQueryField, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltQueryFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltMinTermFrequency, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltMinTermFrequency, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltMinDocFrequency, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltMinDocFrequency, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltMinWordLength, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltMinWordLength, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltMaxWordLength, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltMaxWordLength, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltMaxNumTokens, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltMaxNumTokens, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltMaxNumQueryTerms, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltMaxNumQueryTerms, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltBoost, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltBoost, Solr_no_args, ZEND_ACC_PUBLIC) /* TermsComponent */ PHP_ME(SolrQuery, setTerms, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTerms, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsField, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsField, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsLowerBound, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsLowerBound, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsUpperBound, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsUpperBound, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsIncludeLowerBound, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsIncludeLowerBound, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsIncludeUpperBound, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsIncludeUpperBound, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsMinCount, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsMinCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsMaxCount, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsMaxCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsPrefix, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsPrefix, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsLimit, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsLimit, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsReturnRaw, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsReturnRaw, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsSort, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsSort, Solr_no_args, ZEND_ACC_PUBLIC) /* TODO : TermVectorComponent */ PHP_FE_END }; /* }}} */ /* {{{ solr_response_methods. */ static zend_function_entry solr_response_methods[] = { PHP_ME(SolrResponse, getHttpStatus, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getHttpStatusMessage, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, success, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getRequestUrl, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getRawRequestHeaders, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getRawRequest, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getRawResponseHeaders, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getRawResponse, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getDigestedResponse, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, setParseMode, SolrResponse_setParseMode_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getResponse, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getArrayResponse, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_query_response_methods. */ static zend_function_entry solr_query_response_methods[] = { SOLR_CTOR(SolrQueryResponse, __construct, Solr_no_args) SOLR_DTOR(SolrQueryResponse, __destruct, Solr_no_args) PHP_FE_END }; /* }}} */ /* {{{ solr_update_response_methods. */ static zend_function_entry solr_update_response_methods[] = { SOLR_CTOR(SolrUpdateResponse, __construct, Solr_no_args) SOLR_DTOR(SolrUpdateResponse, __destruct, Solr_no_args) PHP_FE_END }; /* }}} */ /* {{{ solr_ping_response_methods. */ static zend_function_entry solr_ping_response_methods[] = { SOLR_CTOR(SolrPingResponse, __construct, Solr_no_args) SOLR_DTOR(SolrPingResponse, __destruct, Solr_no_args) PHP_ME(SolrPingResponse, getResponse, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_generic_response_methods. */ static zend_function_entry solr_generic_response_methods[] = { SOLR_CTOR(SolrGenericResponse, __construct, Solr_no_args) SOLR_DTOR(SolrGenericResponse, __destruct, Solr_no_args) PHP_FE_END }; /* }}} */ /* {{{ solr_utils_methods. */ static zend_function_entry solr_utils_methods[] = { PHP_ME(SolrUtils, escapeQueryChars, SolrUtils_escapeQueryChars_arg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(SolrUtils, queryPhrase, SolrUtils_escapeQueryChars_arg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(SolrUtils, digestXmlResponse, SolrUtils_digestXML_arg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(SolrUtils, digestJsonResponse, SolrUtils_digestJson_arg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(SolrUtils, getSolrVersion, Solr_no_args, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(SolrUtils, getSolrStats, Solr_no_args, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_FE_END }; /* }}} */ /* {{{ solr_module_deps */ static zend_module_dep solr_module_deps[] = { ZEND_MOD_REQUIRED(PHP_LIBXML_EXTENSION_NAME) ZEND_MOD_REQUIRED(PHP_JSON_EXTENSION_NAME) ZEND_MOD_END }; /* }}} */ /* {{{ solr_module_entry */ zend_module_entry solr_module_entry = { STANDARD_MODULE_HEADER_EX, NULL, solr_module_deps, PHP_SOLR_EXTENSION_NAME, solr_functions, PHP_MINIT(solr), PHP_MSHUTDOWN(solr), PHP_RINIT(solr), PHP_RSHUTDOWN(solr), PHP_MINFO(solr), PHP_SOLR_DOTTED_VERSION, /* The current extension version number. */ STANDARD_MODULE_PROPERTIES }; /* }}} */ #ifdef COMPILE_DL_SOLR ZEND_GET_MODULE(solr) #endif /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(solr) { #ifdef ZTS /* As of ZE 2.2.0, this has to be NULL. */ /* It causes a segmentation fault, if it points to an actual function */ /* Probably a bug in the Zend Engine API */ ts_allocate_dtor php_solr_globals_dtor = NULL; #endif zend_class_entry ce; memcpy(&solr_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); memcpy(&solr_document_field_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); memcpy(&solr_input_document_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); memcpy(&solr_client_object_handlers, &solr_input_document_object_handlers, sizeof(zend_object_handlers)); memcpy(&solr_collapse_function_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); solr_collapse_function_object_handlers.clone_obj = solr_collapse_function_object_handler_clone; solr_input_document_object_handlers.clone_obj = solr_document_object_handler_clone; /* solr_object_handlers.read_property = solr_object_read_property; */ solr_object_handlers.write_property = solr_object_write_property; solr_object_handlers.write_dimension = solr_object_write_dimension; solr_object_handlers.unset_property = solr_object_unset_property; solr_object_handlers.unset_dimension = solr_object_unset_dimension; solr_document_field_handlers.write_property = solr_document_field_write_property; solr_document_field_handlers.unset_property = solr_document_field_unset_property; #ifdef ZTS ZEND_INIT_MODULE_GLOBALS(solr, php_solr_globals_ctor, php_solr_globals_dtor); #else php_solr_globals_ctor(&solr_globals TSRMLS_CC); #endif /* Register extension constants */ solr_extension_register_constants(type, module_number TSRMLS_CC); /* Register the SolrObject class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_OBJECT_CLASSNAME, solr_object_methods); solr_ce_SolrObject = zend_register_internal_class(&ce TSRMLS_CC); solr_ce_SolrObject->ce_flags |= ZEND_ACC_FINAL; /* SolrObject implements ArrayAccess */ zend_class_implements(solr_ce_SolrObject TSRMLS_CC, 1, solr_ce_ArrayAccess); /* Register the SolrDocument class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_DOCUMENT_CLASSNAME, solr_document_methods); solr_ce_SolrDocument = zend_register_internal_class(&ce TSRMLS_CC); solr_ce_SolrDocument->ce_flags |= ZEND_ACC_FINAL; /* This internal property will be used to map to this SolrDocument instance */ zend_declare_property_long(solr_ce_SolrDocument, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) -1, 0L, ZEND_ACC_PRIVATE TSRMLS_CC); /* Register SolrDocument class constants */ solr_document_register_class_constants(solr_ce_SolrDocument TSRMLS_CC); /* SolrDocument implements ArrayAccess, Iterator, Serializable */ zend_class_implements(solr_ce_SolrDocument TSRMLS_CC, 3, solr_ce_ArrayAccess, solr_ce_Iterator, solr_ce_Serializable); /* Register the SolrDocumentField class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_DOCUMENT_FIELD_CLASSNAME, solr_document_field_methods); solr_ce_SolrDocumentField = zend_register_internal_class(&ce TSRMLS_CC); solr_ce_SolrDocumentField->ce_flags |= ZEND_ACC_FINAL; /* Register the name, boost and values properties */ zend_declare_property_stringl(solr_ce_SolrDocumentField, SOLR_FIELD_NAME_PROPERTY_NAME, sizeof(SOLR_FIELD_NAME_PROPERTY_NAME)-1, SOLR_SPACE_STRING, sizeof(SOLR_SPACE_STRING)-1, ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_double(solr_ce_SolrDocumentField, SOLR_FIELD_BOOST_PROPERTY_NAME, sizeof(SOLR_FIELD_BOOST_PROPERTY_NAME)-1, 0.0f, ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_null(solr_ce_SolrDocumentField, SOLR_FIELD_VALUES_PROPERTY_NAME, sizeof(SOLR_FIELD_VALUES_PROPERTY_NAME)-1, ZEND_ACC_PUBLIC TSRMLS_CC); /* Register the SolrInputDocument class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_INPUT_DOCUMENT_CLASSNAME, solr_input_document_methods); solr_ce_SolrInputDocument = zend_register_internal_class(&ce TSRMLS_CC); solr_ce_SolrInputDocument->ce_flags |= ZEND_ACC_FINAL; /* This internal property will be used to map to this SolrDocument instance */ zend_declare_property_long(solr_ce_SolrInputDocument, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) -1, 0L, ZEND_ACC_PRIVATE TSRMLS_CC); /* Register SolrInputDocument class constants */ solr_document_register_class_constants(solr_ce_SolrInputDocument TSRMLS_CC); /* Register SolrClient Class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_CLIENT_CLASSNAME, solr_client_methods); solr_ce_SolrClient = zend_register_internal_class(&ce TSRMLS_CC); /* solr_ce_SolrClient->ce_flags |= ZEND_ACC_FINAL; */ /* This internal property will be used to map to this SolrClient instance */ zend_declare_property_long(solr_ce_SolrClient, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) -1, 0L, ZEND_ACC_PRIVATE TSRMLS_CC); /* Register SolrClient class constants */ solr_client_register_class_constants(solr_ce_SolrClient TSRMLS_CC); /* Register the SolrParams class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_PARAMS_CLASSNAME, solr_params_methods); solr_ce_SolrParams = zend_register_internal_class(&ce TSRMLS_CC); solr_ce_SolrParams->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; zend_class_implements(solr_ce_SolrParams TSRMLS_CC, 1, solr_ce_Serializable); /* This internal property will be used to map to this SolrParams instance */ zend_declare_property_long(solr_ce_SolrParams, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) -1, 0L, ZEND_ACC_PROTECTED TSRMLS_CC); /* Register the SolrModifiableParams class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_MODIFIABLE_PARAMS_CLASSNAME, solr_modifiable_params_methods); solr_ce_SolrModifiableParams = zend_register_internal_class_ex(&ce, solr_ce_SolrParams); /* Register the SolrQuery class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_QUERY_CLASSNAME, solr_query_methods); solr_ce_SolrQuery = zend_register_internal_class_ex(&ce, solr_ce_SolrModifiableParams); init_solr_dismax_query(TSRMLS_C); solr_query_register_class_constants(solr_ce_SolrQuery TSRMLS_CC); /* Register the SolrCollapseFunction class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_COLLAPSE_FUNCTION_CLASSNAME, solr_collapse_function_methods); solr_ce_SolrCollapseFunction = zend_register_internal_class_ex(&ce, solr_ce_SolrCollapseFunction); zend_declare_property_long(solr_ce_SolrCollapseFunction, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME)-1, 0l, ZEND_ACC_PROTECTED TSRMLS_CC); solr_collapse_function_register_class_constants(solr_ce_SolrCollapseFunction TSRMLS_CC); /* Register the SolrResponse base class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_RESPONSE_CLASSNAME, solr_response_methods); solr_ce_SolrResponse = zend_register_internal_class(&ce TSRMLS_CC); solr_ce_SolrResponse->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; /* Register all the properties for the SolrResponse object */ solr_response_register_class_properties(solr_ce_SolrResponse TSRMLS_CC); /* Register all the constants for the SolrResponse object */ solr_response_register_class_constants(solr_ce_SolrResponse TSRMLS_CC); /* Register the SolrQueryResponse class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_QUERY_RESPONSE_CLASSNAME, solr_query_response_methods); solr_ce_SolrQueryResponse = zend_register_internal_class_ex(&ce, solr_ce_SolrResponse); solr_ce_SolrQueryResponse->ce_flags |= ZEND_ACC_FINAL; /* Register the SolrUpdateResponse class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_UPDATE_RESPONSE_CLASSNAME, solr_update_response_methods); solr_ce_SolrUpdateResponse = zend_register_internal_class_ex(&ce, solr_ce_SolrResponse); solr_ce_SolrUpdateResponse->ce_flags |= ZEND_ACC_FINAL; /* Register the SolrPingResponse class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_PING_RESPONSE_CLASSNAME, solr_ping_response_methods); solr_ce_SolrPingResponse = zend_register_internal_class_ex(&ce, solr_ce_SolrResponse); solr_ce_SolrPingResponse->ce_flags |= ZEND_ACC_FINAL; /* Register the SolrGenericResponse class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_GENERIC_RESPONSE_CLASSNAME, solr_generic_response_methods); solr_ce_SolrGenericResponse = zend_register_internal_class_ex(&ce, solr_ce_SolrResponse); solr_ce_SolrGenericResponse->ce_flags |= ZEND_ACC_FINAL; /* Register the SolrUtils class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_UTILS_CLASSNAME, solr_utils_methods); solr_ce_SolrUtils = zend_register_internal_class(&ce TSRMLS_CC); solr_ce_SolrUtils->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; /* Register the SolrException class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_EXCEPTION_CLASSNAME, solr_exception_methods); solr_ce_SolrException = zend_register_internal_class_ex(&ce, solr_ce_Exception); solr_exception_register_class_properties(solr_ce_SolrException TSRMLS_CC); INIT_CLASS_ENTRY(ce, PHP_SOLR_ILLEGAL_OPERATION_EXCEPTION_CLASSNAME, solr_illegal_operation_exception_methods); solr_ce_SolrIllegalOperationException = zend_register_internal_class_ex(&ce, solr_ce_SolrException); INIT_CLASS_ENTRY(ce, PHP_SOLR_ILLEGAL_ARGUMENT_EXCEPTION_CLASSNAME, solr_illegal_argument_exception_methods); solr_ce_SolrIllegalArgumentException = zend_register_internal_class_ex(&ce, solr_ce_SolrException); INIT_CLASS_ENTRY(ce, PHP_SOLR_CLIENT_EXCEPTION_CLASSNAME, solr_client_exception_methods); solr_ce_SolrClientException = zend_register_internal_class_ex(&ce, solr_ce_SolrException); INIT_CLASS_ENTRY(ce, PHP_SOLR_SERVER_EXCEPTION_CLASSNAME, solr_server_exception_methods); solr_ce_SolrServerException = zend_register_internal_class_ex(&ce, solr_ce_SolrException); INIT_CLASS_ENTRY(ce, PHP_SOLR_MISSING_MANDATORY_PARAMETER_EXCEPTION_CLASSNAME, NULL); solr_ce_SolrMissingMandatoryParameterException = zend_register_internal_class_ex(&ce, solr_ce_SolrException); return SUCCESS; } /* }}} */ /* {{{ PHP_RINIT_FUNCTION */ PHP_RINIT_FUNCTION(solr) { zend_bool persistent = SOLR_HASHTABLE_PERSISTENT; /* Initial size of the HashTable */ uint nSize = SOLR_INITIAL_HASH_TABLE_SIZE; ALLOC_HASHTABLE(SOLR_GLOBAL(documents)); ALLOC_HASHTABLE(SOLR_GLOBAL(clients)); ALLOC_HASHTABLE(SOLR_GLOBAL(params)); ALLOC_HASHTABLE(SOLR_GLOBAL(functions)); /* Initialize the HashTable for directory for SolrInputDocuments */ zend_hash_init(SOLR_GLOBAL(documents), nSize, NULL, solr_destroy_document, persistent); zend_hash_init(SOLR_GLOBAL(clients), nSize, NULL, solr_destroy_client, persistent); /* Initialize the HashTable for directory of SolrParams */ zend_hash_init(SOLR_GLOBAL(params), nSize, NULL, solr_destroy_params, persistent); zend_hash_init(SOLR_GLOBAL(functions), nSize, NULL, solr_destroy_function, persistent); return SUCCESS; } /* }}} */ /* {{{ PHP_RSHUTDOWN_FUNCTION */ PHP_RSHUTDOWN_FUNCTION(solr) { zend_hash_destroy(SOLR_GLOBAL(documents)); zend_hash_destroy(SOLR_GLOBAL(clients)); zend_hash_destroy(SOLR_GLOBAL(params)); zend_hash_destroy(SOLR_GLOBAL(functions)); FREE_HASHTABLE(SOLR_GLOBAL(documents)); FREE_HASHTABLE(SOLR_GLOBAL(clients)); FREE_HASHTABLE(SOLR_GLOBAL(params)); FREE_HASHTABLE(SOLR_GLOBAL(functions)); return SUCCESS; } /* }}} */ /* {{{ PHP_MSHUTDOWN_FUNCTION */ PHP_MSHUTDOWN_FUNCTION(solr) { return SUCCESS; } /* }}} */ /* {{{ PHP_MINFO_FUNCTION */ PHP_MINFO_FUNCTION(solr) { php_info_print_table_start(); php_info_print_table_header(2, "Solr Support", "enabled"); php_info_print_table_row(2, "Version", PHP_SOLR_DOTTED_VERSION); php_info_print_table_row(2, "Last Build Date", __DATE__); php_info_print_table_row(2, "Last Build Time", __TIME__); php_info_print_table_end(); } /* }}} */ #endif /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/php_solr.h000066400000000000000000001117751374041537100210230ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #ifndef SOLRCLIENT_H #define SOLRCLIENT_H /* #define SOLR_MEM_DEBUG 1 */ #include
#ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_SOLR #include #include #include
#include
#include
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern zend_module_entry solr_module_entry; #define phpext_solr_ptr &solr_module_entry /* {{{ Startup, Shutdown, Activation, Deactivation and Info functions */ PHP_MINIT_FUNCTION(solr); /* Module Startup Function */ PHP_MSHUTDOWN_FUNCTION(solr); /* Module Shutdown Function */ PHP_RINIT_FUNCTION(solr); /* Request Activation Function */ PHP_RSHUTDOWN_FUNCTION(solr); /* Request Deactivation Function */ PHP_MINFO_FUNCTION(solr); /* Module Information Display Function */ /* }}} */ #ifdef ZTS #include #endif #if ((PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 2)) #define SOLR_ZEND_ENGINE_2_2 1 #endif /* List of constants */ #include "solr_constants.h" /* List of types */ #include "solr_types.h" #ifdef ZTS # define SOLR_GLOBAL(v) TSRMG(solr_globals_id, zend_solr_globals *, v) #else # define SOLR_GLOBAL(v) (solr_globals.v) #endif #include #include "php_solr_api.h" #include "php_solr_bc_macros.h" /* {{{ Variables declared elsewhere */ ZEND_EXTERN_MODULE_GLOBALS(solr) /* ZEND_EXTERN_MODULE_GLOBALS(json) */ extern zend_class_entry *solr_ce_SolrObject; extern zend_class_entry *solr_ce_SolrInputDocument; extern zend_class_entry *solr_ce_SolrDocument; extern zend_class_entry *solr_ce_SolrDocumentField; extern zend_class_entry *solr_ce_SolrClient; extern zend_class_entry *solr_ce_SolrParams; extern zend_class_entry *solr_ce_SolrModifiableParams; extern zend_class_entry *solr_ce_SolrCollapseFunction; extern zend_class_entry *solr_ce_SolrQuery; extern zend_class_entry *solr_ce_SolrResponse; extern zend_class_entry *solr_ce_SolrQueryResponse; extern zend_class_entry *solr_ce_SolrUpdateResponse; extern zend_class_entry *solr_ce_SolrPingResponse; extern zend_class_entry *solr_ce_SolrGenericResponse; extern zend_class_entry *solr_ce_SolrUtils; extern zend_class_entry *solr_ce_SolrException; extern zend_class_entry *solr_ce_SolrIllegalOperationException; extern zend_class_entry *solr_ce_SolrIllegalArgumentException; extern zend_class_entry *solr_ce_SolrClientException; extern zend_class_entry *solr_ce_SolrServerException; extern zend_class_entry *solr_ce_SolrMissingMandatoryParameterException; extern ZEND_API zend_class_entry *zend_ce_serializable; extern ZEND_API zend_class_entry *zend_ce_arrayaccess; extern ZEND_API zend_class_entry *zend_ce_iterator; /* {{{ Aliases for external class entries */ #define solr_ce_Serializable zend_ce_serializable #define solr_ce_ArrayAccess zend_ce_arrayaccess #define solr_ce_Iterator zend_ce_iterator #define solr_ce_Exception zend_exception_get_default(TSRMLS_C) /* }}} */ extern zend_object_handlers solr_object_handlers; extern zend_object_handlers solr_document_field_handlers; extern zend_object_handlers solr_input_document_object_handlers; extern zend_object_handlers solr_client_object_handlers; extern zend_object_handlers solr_response_object_handlers; extern zend_object_handlers solr_collapse_function_object_handlers; /* }}} */ /******************************************************************************/ /** DECLARATIONS FOR EXTENSION METHODS AND FUNCTIONS **/ /******************************************************************************/ /* {{{ Extension functions */ PHP_FUNCTION(solr_get_version); /* }}} */ /* {{{ SolrObject methods */ PHP_METHOD(SolrObject, __construct); PHP_METHOD(SolrObject, __destruct); PHP_METHOD(SolrObject, __set); PHP_METHOD(SolrObject, __get); PHP_METHOD(SolrObject, __isset); PHP_METHOD(SolrObject, __unset); PHP_METHOD(SolrObject, offsetSet); PHP_METHOD(SolrObject, offsetGet); PHP_METHOD(SolrObject, offsetExists); PHP_METHOD(SolrObject, offsetUnset); PHP_METHOD(SolrObject, getPropertyNames); /* }}} */ /* {{{ SolException object methods */ PHP_METHOD(SolrException, getInternalInfo); PHP_METHOD(SolrClientException, getInternalInfo); PHP_METHOD(SolrIllegalOperationException, getInternalInfo); PHP_METHOD(SolrIllegalArgumentException, getInternalInfo); PHP_METHOD(SolrServerException, getInternalInfo); /* }}} */ /* {{{ SolrDocument methods declarations */ PHP_METHOD(SolrDocument, __construct); PHP_METHOD(SolrDocument, __destruct); PHP_METHOD(SolrDocument, __clone); PHP_METHOD(SolrDocument, __get); PHP_METHOD(SolrDocument, __set); PHP_METHOD(SolrDocument, __isset); PHP_METHOD(SolrDocument, __unset); /* Methods from Serializable */ PHP_METHOD(SolrDocument, serialize); PHP_METHOD(SolrDocument, unserialize); /* Methods from ArrayAccess */ PHP_METHOD(SolrDocument, offsetExists); PHP_METHOD(SolrDocument, offsetGet); PHP_METHOD(SolrDocument, offsetSet); PHP_METHOD(SolrDocument, offsetUnset); /* Methods from Iterator */ PHP_METHOD(SolrDocument, current); PHP_METHOD(SolrDocument, key); PHP_METHOD(SolrDocument, next); PHP_METHOD(SolrDocument, rewind); PHP_METHOD(SolrDocument, valid); PHP_METHOD(SolrDocument, clear); PHP_METHOD(SolrDocument, addField); PHP_METHOD(SolrDocument, getFieldNames); PHP_METHOD(SolrDocument, getFieldCount); PHP_METHOD(SolrDocument, getField); PHP_METHOD(SolrDocument, toArray); PHP_METHOD(SolrDocument, fieldExists); PHP_METHOD(SolrDocument, deleteField); PHP_METHOD(SolrDocument, sort); PHP_METHOD(SolrDocument, merge); PHP_METHOD(SolrDocument, getInputDocument); PHP_METHOD(SolrDocument, hasChildDocuments); PHP_METHOD(SolrDocument, getChildDocuments); PHP_METHOD(SolrDocument, getChildDocumentsCount); /* }}} */ /* {{{ SolrDocumentField methods */ PHP_METHOD(SolrDocumentField, __construct); PHP_METHOD(SolrDocumentField, __destruct); /* }}} */ /* {{{ SolrInputDocument methods declarations */ PHP_METHOD(SolrInputDocument, __construct); PHP_METHOD(SolrInputDocument, __destruct); PHP_METHOD(SolrInputDocument, __clone); PHP_METHOD(SolrInputDocument, __sleep); PHP_METHOD(SolrInputDocument, __wakeup); PHP_METHOD(SolrInputDocument, setBoost); PHP_METHOD(SolrInputDocument, getBoost); PHP_METHOD(SolrInputDocument, clear); PHP_METHOD(SolrInputDocument, addField); PHP_METHOD(SolrInputDocument, setFieldBoost); PHP_METHOD(SolrInputDocument, getFieldBoost); PHP_METHOD(SolrInputDocument, getFieldNames); PHP_METHOD(SolrInputDocument, getFieldCount); PHP_METHOD(SolrInputDocument, getField); PHP_METHOD(SolrInputDocument, toArray); PHP_METHOD(SolrInputDocument, fieldExists); PHP_METHOD(SolrInputDocument, deleteField); PHP_METHOD(SolrInputDocument, sort); PHP_METHOD(SolrInputDocument, merge); PHP_METHOD(SolrInputDocument, addChildDocument); PHP_METHOD(SolrInputDocument, getChildDocuments); PHP_METHOD(SolrInputDocument, hasChildDocuments); PHP_METHOD(SolrInputDocument, getChildDocumentsCount); PHP_METHOD(SolrInputDocument, addChildDocuments); /* }}} */ /* {{{ SolrClient methods declarations */ PHP_METHOD(SolrClient, __construct); PHP_METHOD(SolrClient, __destruct); PHP_METHOD(SolrClient, __sleep); PHP_METHOD(SolrClient, __wakeup); PHP_METHOD(SolrClient, __clone); PHP_METHOD(SolrClient, query); PHP_METHOD(SolrClient, getOptions); PHP_METHOD(SolrClient, getDebug); PHP_METHOD(SolrClient, addDocument); PHP_METHOD(SolrClient, addDocuments); PHP_METHOD(SolrClient, setServlet); PHP_METHOD(SolrClient, setResponseWriter); PHP_METHOD(SolrClient, request); PHP_METHOD(SolrClient, ping); PHP_METHOD(SolrClient, system); PHP_METHOD(SolrClient, threads); PHP_METHOD(SolrClient, deleteById); PHP_METHOD(SolrClient, deleteByIds); PHP_METHOD(SolrClient, deleteByQuery); PHP_METHOD(SolrClient, deleteByQueries); PHP_METHOD(SolrClient, getById); PHP_METHOD(SolrClient, getByIds); PHP_METHOD(SolrClient, optimize); PHP_METHOD(SolrClient, commit); PHP_METHOD(SolrClient, rollback); /* }}} */ /* {{{ SolrParams methods declarations */ PHP_METHOD(SolrParams, setParam); /* Parameter can only accept one value */ PHP_METHOD(SolrParams, addParam); /* Parameter can accept more than one value */ PHP_METHOD(SolrParams, getParams); /* Retrieves the parameters and their values */ PHP_METHOD(SolrParams, getParam); /* Retrieves a parameter value */ PHP_METHOD(SolrParams, __toString); /* Returns a string representation of the object */ PHP_METHOD(SolrParams, toString); /* Returns a string representation of the object */ PHP_METHOD(SolrParams, getPreparedParams); /* Returns the prepared parameters */ PHP_METHOD(SolrParams, serialize); /* used by serialize() */ PHP_METHOD(SolrParams, unserialize); /* used by unserialize() */ PHP_METHOD(SolrParams, __clone); /* Used to enforce the cloning of SolrParams is currently unsupported */ /* }}} */ /* {{{ SolrModifiableParams methods declarations */ PHP_METHOD(SolrModifiableParams, __construct); PHP_METHOD(SolrModifiableParams, __destruct); /* }}} */ /* {{{ SolrQuery methods declarations */ /* Constructor and Destructor */ PHP_METHOD(SolrQuery, __construct); PHP_METHOD(SolrQuery, __destruct); /* CommonQueryParameters */ PHP_METHOD(SolrQuery, setQuery); PHP_METHOD(SolrQuery, getQuery); PHP_METHOD(SolrQuery, setStart); PHP_METHOD(SolrQuery, getStart); PHP_METHOD(SolrQuery, setRows); PHP_METHOD(SolrQuery, getRows); PHP_METHOD(SolrQuery, addField); PHP_METHOD(SolrQuery, removeField); PHP_METHOD(SolrQuery, getFields); PHP_METHOD(SolrQuery, addSortField); PHP_METHOD(SolrQuery, removeSortField); PHP_METHOD(SolrQuery, getSortFields); PHP_METHOD(SolrQuery, addFilterQuery); PHP_METHOD(SolrQuery, removeFilterQuery); PHP_METHOD(SolrQuery, getFilterQueries); PHP_METHOD(SolrQuery, setShowDebugInfo); PHP_METHOD(SolrQuery, setExplainOther); PHP_METHOD(SolrQuery, setTimeAllowed); PHP_METHOD(SolrQuery, getTimeAllowed); PHP_METHOD(SolrQuery, setOmitHeader); /* CoreQueryParameters */ PHP_METHOD(SolrQuery, setEchoHandler); PHP_METHOD(SolrQuery, setEchoParams); /* SimpleFacetParameters */ PHP_METHOD(SolrQuery, setFacet); PHP_METHOD(SolrQuery, getFacet); PHP_METHOD(SolrQuery, addFacetField); PHP_METHOD(SolrQuery, removeFacetField); PHP_METHOD(SolrQuery, getFacetFields); PHP_METHOD(SolrQuery, addFacetQuery); PHP_METHOD(SolrQuery, removeFacetQuery); PHP_METHOD(SolrQuery, getFacetQueries); PHP_METHOD(SolrQuery, setFacetPrefix); PHP_METHOD(SolrQuery, getFacetPrefix); PHP_METHOD(SolrQuery, setFacetSort); PHP_METHOD(SolrQuery, getFacetSort); PHP_METHOD(SolrQuery, setFacetLimit); PHP_METHOD(SolrQuery, getFacetLimit); PHP_METHOD(SolrQuery, setFacetOffset); PHP_METHOD(SolrQuery, getFacetOffset); PHP_METHOD(SolrQuery, setFacetMinCount); PHP_METHOD(SolrQuery, getFacetMinCount); PHP_METHOD(SolrQuery, setFacetMissing); PHP_METHOD(SolrQuery, getFacetMissing); PHP_METHOD(SolrQuery, setFacetMethod); PHP_METHOD(SolrQuery, getFacetMethod); PHP_METHOD(SolrQuery, setFacetEnumCacheMinDefaultFrequency); /* Date facet parameters */ PHP_METHOD(SolrQuery, addFacetDateField); PHP_METHOD(SolrQuery, removeFacetDateField); PHP_METHOD(SolrQuery, getFacetDateFields); PHP_METHOD(SolrQuery, setFacetDateStart); PHP_METHOD(SolrQuery, getFacetDateStart); PHP_METHOD(SolrQuery, setFacetDateEnd); PHP_METHOD(SolrQuery, getFacetDateEnd); PHP_METHOD(SolrQuery, setFacetDateGap); PHP_METHOD(SolrQuery, getFacetDateGap); PHP_METHOD(SolrQuery, setFacetDateHardEnd); PHP_METHOD(SolrQuery, getFacetDateHardEnd); PHP_METHOD(SolrQuery, addFacetDateOther); PHP_METHOD(SolrQuery, removeFacetDateOther); PHP_METHOD(SolrQuery, getFacetDateOther); /* GroupParameters */ PHP_METHOD(SolrQuery, setGroup); PHP_METHOD(SolrQuery, getGroup); PHP_METHOD(SolrQuery, addGroupField); PHP_METHOD(SolrQuery, getGroupFields); PHP_METHOD(SolrQuery, addGroupFunction); PHP_METHOD(SolrQuery, getGroupFunctions); PHP_METHOD(SolrQuery, addGroupQuery); PHP_METHOD(SolrQuery, getGroupQueries); PHP_METHOD(SolrQuery, setGroupLimit); PHP_METHOD(SolrQuery, getGroupLimit); PHP_METHOD(SolrQuery, setGroupOffset); PHP_METHOD(SolrQuery, getGroupOffset); PHP_METHOD(SolrQuery, addGroupSortField); PHP_METHOD(SolrQuery, getGroupSortFields); PHP_METHOD(SolrQuery, setGroupFormat); PHP_METHOD(SolrQuery, getGroupFormat); PHP_METHOD(SolrQuery, setGroupMain); PHP_METHOD(SolrQuery, getGroupMain); PHP_METHOD(SolrQuery, setGroupNGroups); PHP_METHOD(SolrQuery, getGroupNGroups); PHP_METHOD(SolrQuery, setGroupTruncate); PHP_METHOD(SolrQuery, getGroupTruncate); PHP_METHOD(SolrQuery, setGroupFacet); PHP_METHOD(SolrQuery, getGroupFacet); PHP_METHOD(SolrQuery, setGroupCachePercent); PHP_METHOD(SolrQuery, getGroupCachePercent); /* Collapse */ PHP_METHOD(SolrQuery, collapse); /* Expand Parameters */ PHP_METHOD(SolrQuery, setExpand); PHP_METHOD(SolrQuery, getExpand); PHP_METHOD(SolrQuery, addExpandSortField); PHP_METHOD(SolrQuery, removeExpandSortField); PHP_METHOD(SolrQuery, getExpandSortFields); PHP_METHOD(SolrQuery, setExpandRows); PHP_METHOD(SolrQuery, getExpandRows); PHP_METHOD(SolrQuery, setExpandQuery); PHP_METHOD(SolrQuery, getExpandQuery); PHP_METHOD(SolrQuery, addExpandFilterQuery); PHP_METHOD(SolrQuery, removeExpandFilterQuery); PHP_METHOD(SolrQuery, getExpandFilterQueries); /* HighlightingParameters */ PHP_METHOD(SolrQuery, setHighlight); PHP_METHOD(SolrQuery, getHighlight); PHP_METHOD(SolrQuery, addHighlightField); PHP_METHOD(SolrQuery, removeHighlightField); PHP_METHOD(SolrQuery, getHighlightFields); PHP_METHOD(SolrQuery, setHighlightSnippets); PHP_METHOD(SolrQuery, getHighlightSnippets); PHP_METHOD(SolrQuery, setHighlightFragsize); PHP_METHOD(SolrQuery, getHighlightFragsize); PHP_METHOD(SolrQuery, setHighlightMergeContiguous); PHP_METHOD(SolrQuery, getHighlightMergeContiguous); PHP_METHOD(SolrQuery, setHighlightRequireFieldMatch); PHP_METHOD(SolrQuery, getHighlightRequireFieldMatch); PHP_METHOD(SolrQuery, setHighlightMaxAnalyzedChars); PHP_METHOD(SolrQuery, getHighlightMaxAnalyzedChars); PHP_METHOD(SolrQuery, setHighlightAlternateField); PHP_METHOD(SolrQuery, getHighlightAlternateField); PHP_METHOD(SolrQuery, setHighlightMaxAlternateFieldLength); PHP_METHOD(SolrQuery, getHighlightMaxAlternateFieldLength); PHP_METHOD(SolrQuery, setHighlightFormatter); PHP_METHOD(SolrQuery, getHighlightFormatter); PHP_METHOD(SolrQuery, setHighlightSimplePre); PHP_METHOD(SolrQuery, getHighlightSimplePre); PHP_METHOD(SolrQuery, setHighlightSimplePost); PHP_METHOD(SolrQuery, getHighlightSimplePost); PHP_METHOD(SolrQuery, setHighlightFragmenter); PHP_METHOD(SolrQuery, getHighlightFragmenter); PHP_METHOD(SolrQuery, setHighlightUsePhraseHighlighter); PHP_METHOD(SolrQuery, getHighlightUsePhraseHighlighter); PHP_METHOD(SolrQuery, setHighlightHighlightMultiTerm); PHP_METHOD(SolrQuery, getHighlightHighlightMultiTerm); PHP_METHOD(SolrQuery, setHighlightRegexSlop); PHP_METHOD(SolrQuery, getHighlightRegexSlop); PHP_METHOD(SolrQuery, setHighlightRegexPattern); PHP_METHOD(SolrQuery, getHighlightRegexPattern); PHP_METHOD(SolrQuery, setHighlightRegexMaxAnalyzedChars); PHP_METHOD(SolrQuery, getHighlightRegexMaxAnalyzedChars); /* StatsComponent */ PHP_METHOD(SolrQuery, setStats); PHP_METHOD(SolrQuery, getStats); PHP_METHOD(SolrQuery, addStatsField); PHP_METHOD(SolrQuery, removeStatsField); PHP_METHOD(SolrQuery, getStatsFields); PHP_METHOD(SolrQuery, addStatsFacet); PHP_METHOD(SolrQuery, removeStatsFacet); PHP_METHOD(SolrQuery, getStatsFacets); /* MoreLikeThis */ PHP_METHOD(SolrQuery, setMlt); PHP_METHOD(SolrQuery, getMlt); PHP_METHOD(SolrQuery, setMltCount); PHP_METHOD(SolrQuery, getMltCount); PHP_METHOD(SolrQuery, addMltField); PHP_METHOD(SolrQuery, removeMltField); PHP_METHOD(SolrQuery, getMltFields); PHP_METHOD(SolrQuery, addMltQueryField); PHP_METHOD(SolrQuery, removeMltQueryField); PHP_METHOD(SolrQuery, getMltQueryFields); PHP_METHOD(SolrQuery, setMltMinTermFrequency); PHP_METHOD(SolrQuery, getMltMinTermFrequency); PHP_METHOD(SolrQuery, setMltMinDocFrequency); PHP_METHOD(SolrQuery, getMltMinDocFrequency); PHP_METHOD(SolrQuery, setMltMinWordLength); PHP_METHOD(SolrQuery, getMltMinWordLength); PHP_METHOD(SolrQuery, setMltMaxWordLength); PHP_METHOD(SolrQuery, getMltMaxWordLength); PHP_METHOD(SolrQuery, setMltMaxNumTokens); PHP_METHOD(SolrQuery, getMltMaxNumTokens); PHP_METHOD(SolrQuery, setMltMaxNumQueryTerms); PHP_METHOD(SolrQuery, getMltMaxNumQueryTerms); PHP_METHOD(SolrQuery, setMltBoost); PHP_METHOD(SolrQuery, getMltBoost); /* TermsComponent */ PHP_METHOD(SolrQuery, setTerms); PHP_METHOD(SolrQuery, getTerms); PHP_METHOD(SolrQuery, setTermsField); PHP_METHOD(SolrQuery, getTermsField); PHP_METHOD(SolrQuery, setTermsLowerBound); PHP_METHOD(SolrQuery, getTermsLowerBound); PHP_METHOD(SolrQuery, setTermsUpperBound); PHP_METHOD(SolrQuery, getTermsUpperBound); PHP_METHOD(SolrQuery, setTermsIncludeLowerBound); PHP_METHOD(SolrQuery, getTermsIncludeLowerBound); PHP_METHOD(SolrQuery, setTermsIncludeUpperBound); PHP_METHOD(SolrQuery, getTermsIncludeUpperBound); PHP_METHOD(SolrQuery, setTermsMinCount); PHP_METHOD(SolrQuery, getTermsMinCount); PHP_METHOD(SolrQuery, setTermsMaxCount); PHP_METHOD(SolrQuery, getTermsMaxCount); PHP_METHOD(SolrQuery, setTermsPrefix); PHP_METHOD(SolrQuery, getTermsPrefix); PHP_METHOD(SolrQuery, setTermsLimit); PHP_METHOD(SolrQuery, getTermsLimit); PHP_METHOD(SolrQuery, setTermsReturnRaw); PHP_METHOD(SolrQuery, getTermsReturnRaw); PHP_METHOD(SolrQuery, setTermsSort); PHP_METHOD(SolrQuery, getTermsSort); /* TODO : TermVectorComponent */ /* {{{ TermVectorComponent methods not yet defined */ PHP_METHOD(SolrQuery, setTermVector); PHP_METHOD(SolrQuery, setTermVectorTermFrequency); PHP_METHOD(SolrQuery, setTermVectorDocFrequency); PHP_METHOD(SolrQuery, setTermVectorPositions); PHP_METHOD(SolrQuery, setTermVectorOffsets); PHP_METHOD(SolrQuery, setTermVectorTfIdfProduct); PHP_METHOD(SolrQuery, setTermVectorAll); PHP_METHOD(SolrQuery, addTermVectorField); PHP_METHOD(SolrQuery, addTermVectorLuceneDocId); /* }}} */ /* }}} */ /* {{{ SolrResponse methods declarations */ PHP_METHOD(SolrResponse, getHttpStatus); PHP_METHOD(SolrResponse, getHttpStatusMessage); PHP_METHOD(SolrResponse, success); PHP_METHOD(SolrResponse, getRequestUrl); PHP_METHOD(SolrResponse, getRawRequestHeaders); PHP_METHOD(SolrResponse, getRawRequest); PHP_METHOD(SolrResponse, getRawResponseHeaders); PHP_METHOD(SolrResponse, getRawResponse); PHP_METHOD(SolrResponse, getDigestedResponse); PHP_METHOD(SolrResponse, setParseMode); PHP_METHOD(SolrResponse, getArrayResponse); PHP_METHOD(SolrResponse, getResponse); /* }}} */ /* {{{ SolrQueryResponse methods */ PHP_METHOD(SolrQueryResponse, __construct); PHP_METHOD(SolrQueryResponse, __destruct); /* }}} */ /* {{{ SolrUpdateResponse methods */ PHP_METHOD(SolrUpdateResponse, __construct); PHP_METHOD(SolrUpdateResponse, __destruct); /* }}} */ /* {{{ SolrPingResponse methods declarations */ PHP_METHOD(SolrPingResponse, __construct); PHP_METHOD(SolrPingResponse, __destruct); PHP_METHOD(SolrPingResponse, getResponse); /* }}} */ /* {{{ SolrGenericResponse methods */ PHP_METHOD(SolrGenericResponse, __construct); PHP_METHOD(SolrGenericResponse, __destruct); /* }}} */ /* {{{ SolrCollapseFunction methods */ PHP_METHOD(SolrCollapseFunction, __construct); PHP_METHOD(SolrCollapseFunction, __destruct); PHP_METHOD(SolrCollapseFunction, setField); PHP_METHOD(SolrCollapseFunction, getField); PHP_METHOD(SolrCollapseFunction, setMin); PHP_METHOD(SolrCollapseFunction, getMin); PHP_METHOD(SolrCollapseFunction, setMax); PHP_METHOD(SolrCollapseFunction, getMax); PHP_METHOD(SolrCollapseFunction, setNullPolicy); PHP_METHOD(SolrCollapseFunction, getNullPolicy); PHP_METHOD(SolrCollapseFunction, setHint); PHP_METHOD(SolrCollapseFunction, getHint); PHP_METHOD(SolrCollapseFunction, setSize); PHP_METHOD(SolrCollapseFunction, getSize); PHP_METHOD(SolrCollapseFunction, __toString); PHP_METHOD(SolrCollapseFunction, __sleep); PHP_METHOD(SolrCollapseFunction, __wakeup); /* }}} */ /* {{{ SolrUtils methods declarations */ PHP_METHOD(SolrUtils, escapeQueryChars); PHP_METHOD(SolrUtils, queryPhrase); PHP_METHOD(SolrUtils, digestXmlResponse); PHP_METHOD(SolrUtils, digestJsonResponse); PHP_METHOD(SolrUtils, getSolrVersion); PHP_METHOD(SolrUtils, getSolrStats); /* }}} */ /******************************************************************************/ /** DECLARATIONS FOR HELPERS AND EXTENSION-SPECIFIC FUNCTIONS **/ /******************************************************************************/ /* {{{ HTTP request function declarations */ size_t solr_curl_write(solr_char_t *data, size_t size, size_t nmemb, void *ctx); size_t solr_curl_write_header(solr_char_t *data, size_t size, size_t nmemb, void *ctx); int solr_curl_debug_callback(CURL *curl_handle, curl_infotype infotype, solr_char_t *debug_data, size_t size, void *ctx); PHP_SOLR_API int solr_init_options(solr_client_options_t *options TSRMLS_DC); PHP_SOLR_API int solr_init_handle(solr_curl_t *sch, solr_client_options_t *options TSRMLS_DC); PHP_SOLR_API int solr_make_request(solr_client_t *client, solr_request_type_t request_type TSRMLS_DC); PHP_SOLR_API void solr_free_handle(solr_curl_t *sch); PHP_SOLR_API void solr_free_option(solr_client_options_t *options); /* }}} */ PHP_SOLR_API void solr_extension_register_constants(int type, int module_number TSRMLS_DC); PHP_SOLR_API void solr_document_register_class_constants(zend_class_entry *ce TSRMLS_DC); PHP_SOLR_API void solr_client_register_class_constants(zend_class_entry *ce TSRMLS_DC); PHP_SOLR_API void solr_query_register_class_constants(zend_class_entry *ce TSRMLS_DC); PHP_SOLR_API void solr_collapse_function_register_class_constants(zend_class_entry *ce TSRMLS_DC); PHP_SOLR_API void solr_response_register_class_properties(zend_class_entry *ce TSRMLS_DC); PHP_SOLR_API void solr_response_register_class_constants(zend_class_entry *ce TSRMLS_DC); PHP_SOLR_API void solr_exception_register_class_properties(zend_class_entry *ce TSRMLS_DC); PHP_SOLR_API void solr_set_response_object_properties(zend_class_entry *scope, zval *response_object, const solr_client_t *client, const solr_string_t *request_url, zend_bool success TSRMLS_DC); PHP_SOLR_API void solr_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *filename, int file_line, const char *function_name, char *format, ...); PHP_SOLR_API void solr_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC, const char *filename, int file_line, const char *function_name); PHP_SOLR_API void solr_throw_solr_server_exception(solr_client_t *client,const char *requestType TSRMLS_DC); /* {{{ init functions called in constructors - allocate/initialize params_t */ PHP_SOLR_API int solr_init_params(solr_params_t *solr_params, long int index); /* }}} */ /* {{{ solr_document_t based objects methods*/ PHP_SOLR_API solr_document_t *solr_init_document(long int document_index); PHP_SOLR_API solr_document_t *solr_input_doc_ctor(zval *objptr); PHP_SOLR_API zend_object *solr_document_object_handler_clone(zval *zobject TSRMLS_DC); /* }}} */ /* {{{ zend_hash_free functions */ PHP_SOLR_API void solr_destroy_field_list_ht_dtor(zval *zv_field_entry); PHP_SOLR_API void solr_destroy_field_list(solr_field_list_t *field_entry); PHP_SOLR_API void solr_destroy_client(zval *client); PHP_SOLR_API void solr_destroy_document_zv(zval *document); PHP_SOLR_API void solr_destroy_document_ex(solr_document_t *document); #ifdef PHP_7 #define solr_destroy_document solr_destroy_document_zv #else #define solr_destroy_document solr_destroy_document_ex #endif PHP_SOLR_API void solr_destroy_params(zval *solr_params); PHP_SOLR_API void solr_destroy_function(zval *solr_function); PHP_SOLR_API void solr_destory_param_ht_dtor(zval *param_zv); PHP_SOLR_API void solr_destroy_param(solr_param_t **param); /* dead */ PHP_SOLR_API void solr_destroy_param_value(solr_param_t *param, solr_param_value_t *param_value); /* }}} */ #ifdef PHP_7 #define field_copy_constructor field_copy_constructor_zv #else #define field_copy_constructor field_copy_constructor_ex #endif /* {{{ used for SolrDocument field manipulations */ PHP_SOLR_API int solr_document_insert_field_value(solr_field_list_t *queue, const solr_char_t *field_value, double field_boost); PHP_SOLR_API void field_copy_constructor_ex(solr_field_list_t **original_field_queue); PHP_SOLR_API void field_copy_constructor_zv(zval *field_queue_zv); /* }}} */ /* {{{ Used for comparison of document fields */ PHP_SOLR_API int solr_compare_field_name (const void *a, const void *b TSRMLS_DC); PHP_SOLR_API int solr_rcompare_field_name(const void *a, const void *b TSRMLS_DC); PHP_SOLR_API int solr_compare_field_value_count (const void *a, const void *b TSRMLS_DC); PHP_SOLR_API int solr_rcompare_field_value_count(const void *a, const void *b TSRMLS_DC); PHP_SOLR_API int solr_compare_field_boost_value (const void *a, const void *b TSRMLS_DC); PHP_SOLR_API int solr_rcompare_field_boost_value(const void *a, const void *b TSRMLS_DC); /* }}} */ /* {{{ Functions for SolrParams Parameters */ PHP_SOLR_API solr_param_t *solr_create_new_param(const solr_char_t *param_name, size_t param_name_len, solr_param_type_t param_type, solr_bool allow_multiple, solr_param_value_equal_func_t value_equal_func, solr_param_fetch_func_t param_fetch_func, solr_param_value_free_func_t value_free_func, solr_char_t delimiter, solr_char_t arg_separator TSRMLS_DC); PHP_SOLR_API int solr_params_insert_param_value(solr_param_t *param, solr_param_value_t *param_value); PHP_SOLR_API int solr_params_delete_param_value(solr_param_t *param, const solr_param_value_t *target_value TSRMLS_DC); PHP_SOLR_API int solr_delete_solr_parameter(zval *objptr, solr_char_t *name, int name_length TSRMLS_DC); PHP_SOLR_API int solr_add_or_set_normal_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_bool allow_multiple TSRMLS_DC); PHP_SOLR_API int solr_add_simple_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC); PHP_SOLR_API int solr_add_simple_list_param_ex(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *separator TSRMLS_DC); PHP_SOLR_API int solr_add_arg_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t delimiter, solr_char_t arg_separator TSRMLS_DC); PHP_SOLR_API int solr_add_arg_list_param_ex(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t delimiter, solr_char_t arg_separator, solr_char_t delimiter_override TSRMLS_DC); PHP_SOLR_API solr_param_value_t* create_parameter_value_arg_list(solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t *delimiter_override, solr_bool delimiter_overriden TSRMLS_DC); #define solr_set_normal_param(objptr, pname, pname_length, pvalue, pvalue_length) solr_add_or_set_normal_param((objptr), (pname), (pname_length), (pvalue), (pvalue_length), 0 TSRMLS_CC) #define solr_add_normal_param(objptr, pname, pname_length, pvalue, pvalue_length) solr_add_or_set_normal_param((objptr), (pname), (pname_length), (pvalue), (pvalue_length), 1 TSRMLS_CC) PHP_SOLR_API int solr_normal_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b); PHP_SOLR_API int solr_simple_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b); PHP_SOLR_API int solr_arg_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b); PHP_SOLR_API void solr_normal_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer); PHP_SOLR_API void solr_simple_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer); PHP_SOLR_API void solr_arg_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer); PHP_SOLR_API void solr_normal_param_value_display(solr_param_t *solr_param, zval *param_value_array); PHP_SOLR_API void solr_simple_list_param_value_display(solr_param_t *solr_param, zval *param_value_array); PHP_SOLR_API void solr_arg_list_param_value_display(solr_param_t *solr_param, zval *param_value_array); /* Used to display values where allow_multiple is false */ PHP_SOLR_API void solr_normal_param_value_display_string(solr_param_t *solr_param, zval *param_value); PHP_SOLR_API void solr_normal_param_value_display_integer(solr_param_t *solr_param, zval *param_value); PHP_SOLR_API void solr_normal_param_value_display_double(solr_param_t *solr_param, zval *param_value); PHP_SOLR_API void solr_normal_param_value_display_boolean(solr_param_t *solr_param, zval *param_value); PHP_SOLR_API void solr_normal_param_value_display_sort_type(solr_param_t *solr_param, zval *param_value); PHP_SOLR_API int solr_param_find(zval *objptr, solr_char_t *pname, int pname_length, solr_param_t **solr_param TSRMLS_DC); PHP_SOLR_API void solr_normal_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode); PHP_SOLR_API void solr_simple_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode); PHP_SOLR_API void solr_arg_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode); PHP_SOLR_API void solr_normal_param_value_free(solr_param_value_t *param_value); PHP_SOLR_API void solr_simple_list_param_value_free(solr_param_value_t *param_value); PHP_SOLR_API void solr_arg_list_param_value_free(solr_param_value_t *param_value); /* Used for removing parameter values from the list of values for that param */ PHP_SOLR_API int solr_delete_normal_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC); PHP_SOLR_API int solr_delete_simple_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC); PHP_SOLR_API int solr_delete_arg_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC); /* }}} */ /* {{{ Debugging functions */ /* Debug function used to print field values in the field queue */ PHP_SOLR_API void solr_debug_print_fields(const solr_field_list_t *queue); /* Used when debugging is enabled to run in verbose mode */ PHP_SOLR_API void solr_debug_printf(const char *format, ...); /* }}} */ /* {{{ Document utility functions */ PHP_SOLR_API void solr_generate_document_xml_from_fields(xmlNode *solr_doc_node, HashTable *document_fields TSRMLS_DC); PHP_SOLR_API void solr_create_document_field_object(solr_field_list_t *field_values, zval **field_obj TSRMLS_DC); PHP_SOLR_API void solr_add_doc_node(xmlNode *root_node, solr_document_t *doc_entry TSRMLS_DC); PHP_SOLR_API xmlDocPtr solr_xml_create_xml_doc(const xmlChar *root_node_name, xmlNode **root_node_ptr); /* }}} */ /* {{{ identical functions used on both SolrDocument and SolrInputDocument */ PHP_SOLR_API void solr_document_get_field_names(INTERNAL_FUNCTION_PARAMETERS); /* }}} */ /* {{{ Utility functions */ PHP_SOLR_API long solr_get_json_last_error(TSRMLS_D); PHP_SOLR_API solr_char_t *solr_get_json_error_msg(solr_json_error_codes_t error_code); PHP_SOLR_API int solr_json_to_php_native(solr_string_t *buffer, const solr_char_t *json_string, int json_string_length TSRMLS_DC); PHP_SOLR_API int solr_is_supported_response_writer(const solr_char_t * response_writer, int length); PHP_SOLR_API int solr_hashtable_get_new_index(HashTable *ht TSRMLS_DC); PHP_SOLR_API int solr_fetch_document_entry(zval *objptr, solr_document_t **doc_entry TSRMLS_DC); PHP_SOLR_API int solr_fetch_client_entry(zval *objptr, solr_client_t **solr_client TSRMLS_DC); PHP_SOLR_API int solr_fetch_params_entry(zval *objptr, solr_params_t **solr_params TSRMLS_DC); PHP_SOLR_API int solr_fetch_function_entry(zval *objptr, solr_function_t **solr_params TSRMLS_DC); PHP_SOLR_API void solr_encode_generic_xml_response(solr_string_t *buffer, const solr_char_t *serialized, int size, long int parse_mode TSRMLS_DC); PHP_SOLR_API void solr_set_return_solr_params_object(zval *return_value_ptr, zval *current_objptr TSRMLS_DC); PHP_SOLR_API void solr_escape_query_chars(solr_string_t *sbuilder, solr_char_t *unescaped, long int unescaped_length); /* serialized array to serialized SolrObject */ PHP_SOLR_API int solr_sarray_to_sobject(solr_string_t *buffer TSRMLS_DC); PHP_SOLR_API int solr_sobject_to_sarray(solr_string_t *buffer TSRMLS_DC); PHP_SOLR_API void solr_response_get_response_impl(INTERNAL_FUNCTION_PARAMETERS, int return_array); /* }}} */ /* {{{ SolrFunction Helpers (solrfunc to avoid confusion with solr_function) */ PHP_SOLR_API int solr_solrfunc_update_string(zval *obj, solr_char_t *key, int key_len, solr_char_t *value, int value_len TSRMLS_DC); PHP_SOLR_API int solr_solrfunc_fetch_string(zval *obj, solr_char_t *key, int key_len, solr_string_t **string TSRMLS_DC); PHP_SOLR_API int solr_solrfunc_return_string(zval *obj, solr_char_t *key, int key_len, zval **return_value TSRMLS_DC); PHP_SOLR_API void solr_solrfunc_to_string(solr_function_t *function, solr_string_t **dest); PHP_SOLR_API int solr_solrfunc_display_string(zval *obj, solr_char_t *key, int key_len, zval **return_value TSRMLS_DC); zend_object *solr_collapse_function_object_handler_clone(zval *object TSRMLS_DC); /* }}} */ /* {{{ Solr Server Exception Handling */ PHP_SOLR_API int solr_get_xml_error(solr_string_t buffer, solr_exception_t *exceptionData TSRMLS_DC); PHP_SOLR_API int solr_get_json_error(solr_string_t buffer, solr_exception_t *exceptionData TSRMLS_DC); PHP_SOLR_API int solr_get_phpnative_error(solr_string_t buffer, solr_exception_t *exceptionData TSRMLS_DC); PHP_SOLR_API int hydrate_error_zval(zval *response, solr_exception_t *exceptionData TSRMLS_DC); /* }}} */ /* {{{ Solr Object Handlers */ #if PHP_VERSION_ID < 50399 PHP_SOLR_API void solr_object_write_property(zval *object, zval *member, zval *value TSRMLS_DC); PHP_SOLR_API zval *solr_object_read_property(zval *object, zval *member, int type TSRMLS_DC); PHP_SOLR_API void solr_object_unset_property(zval *object, zval *member TSRMLS_DC); #elif PHP_VERSION_ID < 70000 PHP_SOLR_API void solr_object_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC); PHP_SOLR_API zval *solr_object_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC); PHP_SOLR_API void solr_object_unset_property(zval *object, zval *member, const zend_literal *key TSRMLS_DC); #else PHP_SOLR_API void solr_object_write_property(zval *object, zval *member, zval *value, void **cache_slot); PHP_SOLR_API zval *solr_object_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv); PHP_SOLR_API void solr_object_unset_property(zval *object, zval *member, void **cache_slot); #endif PHP_SOLR_API void solr_object_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC); PHP_SOLR_API void solr_object_unset_dimension(zval *object, zval *offset TSRMLS_DC); #if PHP_VERSION_ID < 50399 PHP_SOLR_API void solr_document_field_write_property(zval *object, zval *member, zval *value TSRMLS_DC); PHP_SOLR_API void solr_document_field_unset_property(zval *object, zval *member TSRMLS_DC); #elif PHP_VERSION_ID < 70000 PHP_SOLR_API void solr_document_field_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC); PHP_SOLR_API void solr_document_field_unset_property(zval *object, zval *member, const zend_literal *key TSRMLS_DC); #else PHP_SOLR_API void solr_document_field_write_property(zval *object, zval *member, zval *value, void **cache_slot); PHP_SOLR_API void solr_document_field_unset_property(zval *object, zval *member, void **cache_slot); #endif /* }}} */ int add_phrase_field(zval *obj, solr_char_t *pname, zval *boost, zval *slop, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_len TSRMLS_DC); #include "solr_macros.h" #include "php_solr_dismax_query.h" #endif /* HAVE_SOLR */ #endif /* SOLRCLIENT_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/php_solr_api.h000066400000000000000000000035721374041537100216470ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Israel Ekpo | +----------------------------------------------------------------------+ */ /* $Id$ */ /** * Declaring Macro for function attributes * * This is for functions on GNU systems and Win32 systems * * On Win32 systems __declspec(dllexport) adds the export directive to the * object file so you do not need to use a .def file * * Using __declspec(dllexport) in addition to using a .def file should * not cause build errors. */ #ifndef PHP_SOLR_API_H #define PHP_SOLR_API_H #ifdef PHP_WIN32 #define PHP_SOLR_API __declspec(dllexport) #elif defined(__GNUC__) && __GNUC__ >= 4 #define PHP_SOLR_API __attribute__ ((visibility("default"))) #else #define PHP_SOLR_API #endif #endif /* PHP_SOLR_API_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/php_solr_bc_macros.h000066400000000000000000000061111374041537100230160ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Israel Ekpo | +----------------------------------------------------------------------+ */ /* $Id$ */ /** * PHP 5 backward compatibility macros * * With the arrival of ZE 2.3.0, some of the member structures of the zval struct * were renamed. These macros will allow us to still be able to use the * new macros introduced since php 5.3.0 to compile code in the PHP 5.2.x series. * * We should allow up to php version 5.2.11. The latest stable release as of the * time of the initial release of this extension. */ #ifndef PHP_SOLR_BC_MACROS_H #define PHP_SOLR_BC_MACROS_H /* Retrieves the refcount */ #ifndef Z_REFCOUNT_P #define Z_REFCOUNT_P(pz) (pz)->refcount; #define Z_REFCOUNT_PP(ppz) Z_REFCOUNT_P(*(ppz)) #endif /* Sets the refcount to the specified value. */ #ifndef Z_SET_REFCOUNT_P #define Z_SET_REFCOUNT_P(pz, rc) (pz)->refcount = rc; #define Z_SET_REFCOUNT_PP(ppz) Z_SET_REFCOUNT_P((*ppz), rc) #endif /* Increases the recount by 1 */ #ifndef Z_ADDREF_P #define Z_ADDREF_P(pz) (pz)->refcount++; #define Z_ADDREF_PP(ppz) Z_ADDREF_P(*(ppz)) #endif /* Reduces the refcount by 1 */ #ifndef Z_DELREF_P #define Z_DELREF_P(pz) (pz)->refcount--; #define Z_DELREF_PP(ppz) Z_DELREF_P(*(ppz)) #endif /* Sets the isref member on the zval */ #ifndef Z_SET_ISREF_P #define Z_SET_ISREF_P(pz) (pz)->is_ref = 1; #define Z_SET_ISREF_PP(ppz) Z_SET_ISREF_P(*(ppz)) #endif /* Unsets the isref member on the zval */ #ifndef Z_UNSET_ISREF_P #define Z_UNSET_ISREF_P(pz) (pz)->is_ref = 0; #define Z_UNSET_ISREF_PP(ppz ) Z_UNSET_ISREF_P(*(ppz)) #endif /* Checks if is_ref is set on the zval */ #ifndef Z_ISREF_P #define Z_ISREF_P(pz) ((pz)->is_ref) #define Z_ISREF_PP(ppz) Z_ISREF_P(*(ppz)) #endif /* Sets the is_ref member to the specified value */ #ifndef Z_SET_ISREF_TO_P #define Z_SET_ISREF_TO_P(pz, isref) (pz)->is_ref = is_ref; #define Z_SET_ISREF_TO_PP(ppz, isref) Z_SET_ISREF_TO_P(*(ppz), isref) #endif #endif /* PHP_SOLR_BC_MACROS_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/php_solr_client.c000066400000000000000000001703371374041537100223530ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ Macros */ /* resets the key_str with key and tries to find the zv */ static inline int solr_opt_check(HashTable *options_ht, const char * key, zend_string * key_str, zval ** zv) { int result = 0; key_str = zend_string_init(key, strlen (key), 0); result = (*zv = zend_hash_find(options_ht, key_str)) != NULL; zend_string_release(key_str); return result; } /* {{{ static void solr_client_init_urls(solr_client_t *solr_client) */ static void solr_client_init_urls(solr_client_t *solr_client) { solr_string_t url_prefix; solr_client_options_t *options = &(solr_client->options); memset(&url_prefix, 0, sizeof(solr_string_t)); /* Release all previously allocated URL values, if any */ solr_string_free(&(options->update_url)); solr_string_free(&(options->search_url)); solr_string_free(&(options->thread_url)); solr_string_free(&(options->ping_url)); solr_string_free(&(options->terms_url)); solr_string_free(&(options->system_url)); solr_string_free(&(options->get_url)); /* Making http://hostname:host_port/path/ */ if (options->secure) { solr_string_append_const(&url_prefix, "https://"); } else { solr_string_append_const(&url_prefix, "http://"); } solr_string_append_solr_string(&url_prefix, &(options->hostname)); solr_string_appendc(&url_prefix, ':'); solr_string_append_long(&url_prefix, options->host_port); solr_string_appendc(&url_prefix, '/'); solr_string_append_solr_string(&url_prefix, &(options->path)); solr_string_appendc(&url_prefix, '/'); /* Copying over the prefixes */ solr_string_append_solr_string(&(options->update_url), &url_prefix); solr_string_append_solr_string(&(options->search_url), &url_prefix); solr_string_append_solr_string(&(options->thread_url), &url_prefix); solr_string_append_solr_string(&(options->ping_url), &url_prefix); solr_string_append_solr_string(&(options->terms_url), &url_prefix); solr_string_append_solr_string(&(options->system_url), &url_prefix); solr_string_append_solr_string(&(options->get_url), &url_prefix); /* Making http://hostname:host_port/path/servlet/ */ solr_string_append_solr_string(&(options->update_url), &(options->update_servlet)); solr_string_append_solr_string(&(options->search_url), &(options->search_servlet)); solr_string_append_solr_string(&(options->thread_url), &(options->thread_servlet)); solr_string_append_solr_string(&(options->ping_url), &(options->ping_servlet)); solr_string_append_solr_string(&(options->terms_url), &(options->terms_servlet)); solr_string_append_solr_string(&(options->system_url), &(options->system_servlet)); solr_string_append_solr_string(&(options->get_url), &(options->get_servlet)); solr_string_append_const(&(options->update_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->search_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->thread_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->ping_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->terms_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->system_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->get_url), "/?version=2.2&indent=on&wt="); solr_string_append_solr_string(&(options->update_url), &(options->response_writer)); solr_string_append_solr_string(&(options->search_url), &(options->response_writer)); solr_string_append_solr_string(&(options->thread_url), &(options->response_writer)); solr_string_append_solr_string(&(options->ping_url), &(options->response_writer)); solr_string_append_solr_string(&(options->terms_url), &(options->response_writer)); solr_string_append_solr_string(&(options->system_url), &(options->response_writer)); solr_string_append_solr_string(&(options->get_url), &(options->response_writer)); solr_string_free(&url_prefix); } /* }}} */ /* {{{ static int solr_http_build_query(solr_string_t *buffer, zval *params_objptr, const solr_char_t *delimiter, int delimiter_length TSRMLS_DC) */ static int solr_http_build_query(solr_string_t *buffer, zval *params_objptr, const solr_char_t *delimiter, int delimiter_length TSRMLS_DC) { solr_params_t *solr_params = NULL; HashTable *params = NULL; solr_param_t *solr_param = NULL; if (solr_fetch_params_entry(params_objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve solr_params_t"); return FAILURE; } params = solr_params->params; ZEND_HASH_FOREACH_PTR(params, solr_param) { solr_string_t tmp_values_buffer; memset(&tmp_values_buffer, 0, sizeof(solr_string_t)); solr_param->fetch_func(solr_param, &tmp_values_buffer); solr_string_append_solr_string(buffer, &tmp_values_buffer); solr_string_appends(buffer, delimiter, delimiter_length); solr_string_free(&tmp_values_buffer); } ZEND_HASH_FOREACH_END(); solr_string_remove_last_char(buffer); return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API solr_client_t* solr_init_client(zval * objptr TSRMLS_DC) inititialize solr_client_t and update zval's index */ PHP_SOLR_API solr_client_t *solr_init_client(zval *objptr TSRMLS_DC) { long int client_index = SOLR_UNIQUE_CLIENT_INDEX(); solr_client_t *solr_client = NULL; zend_update_property_long(solr_ce_SolrClient, objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, client_index TSRMLS_CC); solr_client = (solr_client_t *) pemalloc(sizeof(solr_client_t), SOLR_CLIENT_PERSISTENT); memset(solr_client, 0, sizeof(solr_client_t)); solr_client->client_index = client_index; if ((solr_client = zend_hash_index_update_ptr(SOLR_GLOBAL(clients), client_index, (void *)solr_client)) == NULL) { pefree(solr_client, SOLR_CLIENT_PERSISTENT); php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error while registering client in HashTable"); return NULL; } return solr_client; } /* }}} */ /******************************************************************************/ /** DEFINITIONS FOR SOLR CLIENT METHODS **/ /******************************************************************************/ /* {{{ proto SolrClient::__construct(array options ) Constructor for SolrClient */ PHP_METHOD(SolrClient, __construct) { zval *options = NULL; zval *objptr = getThis(); HashTable *options_ht = NULL; zval *tmp1 = NULL, *tmp2 = NULL; solr_client_t *solr_client_dest = NULL; solr_client_options_t *client_options = NULL; solr_curl_t *handle = NULL; zend_string *key_str; /* tmp storage to use with zend_hash_find */ key_str = zend_string_init("", 0, 0); size_t num_options = 0; long int secure = 0L; long int verify_peer = 0L; long int verify_host = 2L; long int timeout = 30L; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &options) == FAILURE) { zend_string_release(key_str); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter. The client options array is required for a SolrClient instance. It must also be passed as the only parameter"); return; } options_ht = Z_ARRVAL_P(options); num_options = zend_hash_num_elements(options_ht); if (!num_options) { zend_string_release(key_str); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "The SolrClient options cannot be an empty array"); return; } solr_client_dest = solr_init_client(objptr TSRMLS_CC); if (!solr_client_dest) { zend_string_release(key_str); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Unable to initialize solr_client_t "); return; } /* Release the original pointer */ client_options = &(solr_client_dest->options); handle = &(solr_client_dest->handle); solr_init_options(client_options TSRMLS_CC); solr_string_append_const(&(client_options->response_writer), SOLR_XML_RESPONSE_WRITER); solr_string_append_const(&(client_options->update_servlet), SOLR_DEFAULT_UPDATE_SERVLET); solr_string_append_const(&(client_options->search_servlet), SOLR_DEFAULT_SEARCH_SERVLET); solr_string_append_const(&(client_options->thread_servlet), SOLR_DEFAULT_THREADS_SERVLET); solr_string_append_const(&(client_options->ping_servlet), SOLR_DEFAULT_PING_SERVLET); solr_string_append_const(&(client_options->terms_servlet), SOLR_DEFAULT_TERMS_SERVLET); solr_string_append_const(&(client_options->system_servlet), SOLR_DEFAULT_SYSTEM_SERVLET); solr_string_append_const(&(client_options->get_servlet), SOLR_DEFAULT_GET_SERVLET); if ( solr_opt_check(options_ht, "wt", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { if (solr_is_supported_response_writer((solr_char_t *)Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1))) { solr_string_set(&(client_options->response_writer), (const solr_char_t *) Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported response writer %s. This value will be ignored", Z_STRVAL_P(tmp1)); } } if (solr_opt_check(options_ht, "secure", key_str, &tmp1)) { if (Z_TYPE_P(tmp1) == IS_TRUE) { secure = (long int) 1L; } else if (Z_TYPE_P(tmp1) == IS_LONG) { secure = Z_LVAL_P(tmp1); } } client_options->secure = secure; /** * FOR NOW LET'S LEAVE IT AT 2 : This will force and require a match on the common name * if (secure && zend_hash_find(options_ht, "ssl_verifyhost", sizeof("ssl_verifyhost"), (void**) &tmp1) == SUCCESS && Z_TYPE_P(tmp1) == IS_LONG) { verify_host = ((Z_LVAL_P(tmp1) > 0L && Z_LVAL_P(tmp1) < 3L) ? Z_LVAL_P(tmp1) : verify_host); } */ client_options->ssl_verify_host = verify_host; if (secure && solr_opt_check(options_ht, "ssl_cert", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { verify_peer = 1L; solr_string_appends(&(client_options->ssl_cert), Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); } if (secure && solr_opt_check(options_ht, "ssl_key", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { verify_peer = 1L; solr_string_appends(&(client_options->ssl_key), (solr_char_t *) Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); } if (secure && solr_opt_check(options_ht, "ssl_keypassword", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { verify_peer = 1L; solr_string_appends(&(client_options->ssl_keypassword), (solr_char_t *) Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); } // ssl_cainfo if (secure && solr_opt_check(options_ht, "ssl_cainfo", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { verify_peer = 1L; solr_string_appends(&(client_options->ssl_cainfo), (solr_char_t *) Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); } // ssl_capath if (secure && solr_opt_check(options_ht, "ssl_capath", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { verify_peer = 1L; solr_string_appends(&(client_options->ssl_capath), (solr_char_t *) Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); } client_options->ssl_verify_peer = verify_peer; // hostname if (solr_opt_check(options_ht, "hostname", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { solr_string_appends(&(client_options->hostname), (solr_char_t *) Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); } else { solr_string_append_const(&(client_options->hostname), SOLR_REQUEST_DEFAULT_HOST); } // port if (solr_opt_check(options_ht, "port", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_LONG) { client_options->host_port = Z_LVAL_P(tmp1); } else if (solr_opt_check(options_ht, "port", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { long int host_port = atol(Z_STRVAL_P(tmp1)); if (host_port) { client_options->host_port = host_port; } else { client_options->host_port = SOLR_REQUEST_DEFAULT_PORT; } } else { client_options->host_port = SOLR_REQUEST_DEFAULT_PORT; } if (solr_opt_check(options_ht, "timeout", key_str, &tmp1)) { long int timeout_value = 30L; if (Z_TYPE_P(tmp1) == IS_LONG) { timeout_value = Z_LVAL_P(tmp1); } else if (Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { timeout_value = atol(Z_STRVAL_P(tmp1)); } timeout = ((timeout_value > 0L) ? timeout_value : timeout); } client_options->timeout = timeout; if (solr_opt_check(options_ht, "path", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { char *path_to_solr = Z_STRVAL_P(tmp1); size_t path_to_solr_start = 0; size_t length_adjustment = 0; if (path_to_solr[0] == '/') { path_to_solr_start = length_adjustment = 1; } if (path_to_solr[Z_STRLEN_P(tmp1)] == '/') { length_adjustment++; } solr_string_appends(&(client_options->path), Z_STRVAL_P(tmp1) + path_to_solr_start, Z_STRLEN_P(tmp1) - length_adjustment); } else { solr_string_append_const(&(client_options->path), SOLR_REQUEST_DEFAULT_PATH); } if ( solr_opt_check(options_ht, "query_string_delimiter", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING) { solr_string_appends(&(client_options->qs_delimiter), Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); } else { solr_string_append_const(&(client_options->qs_delimiter), SOLR_REQUEST_DEFAULT_QS_DELIMITER); } if ( solr_opt_check(options_ht, "login", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && solr_opt_check(options_ht, "password", key_str, &tmp2) && Z_TYPE_P(tmp2) == IS_STRING) { solr_string_appends(&(client_options->http_auth_credentials), Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); solr_string_appendc(&(client_options->http_auth_credentials), ':'); solr_string_appends(&(client_options->http_auth_credentials), Z_STRVAL_P(tmp2), Z_STRLEN_P(tmp2)); } if (solr_opt_check(options_ht, "proxy_host", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING) { solr_string_appends(&(client_options->proxy_hostname), Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); } if (solr_opt_check(options_ht, "proxy_port", key_str, &tmp1)) { long int proxy_port_value = 0L; if (Z_TYPE_P(tmp1) == IS_LONG) { proxy_port_value = Z_LVAL_P(tmp1); } else if (Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { proxy_port_value = atol(Z_STRVAL_P(tmp1)); } if (proxy_port_value > 0L) { client_options->proxy_port = proxy_port_value; } } if (solr_opt_check(options_ht, "proxy_login", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && solr_opt_check(options_ht, "proxy_password", key_str, &tmp2) && Z_TYPE_P(tmp2) == IS_STRING) { solr_string_appends(&(client_options->proxy_auth_credentials), Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); solr_string_appendc(&(client_options->proxy_auth_credentials), ':'); solr_string_appends(&(client_options->proxy_auth_credentials), Z_STRVAL_P(tmp2), Z_STRLEN_P(tmp2)); } solr_init_handle(handle, client_options TSRMLS_CC); zend_string_free(key_str); SOLR_GLOBAL(client_count)++; } /* }}} */ /* {{{ proto SolrClient::__destruct(void) Destructor for SolrClient */ PHP_METHOD(SolrClient, __destruct) { solr_client_t *solr_client = NULL; if (solr_fetch_client_entry(getThis(), &solr_client TSRMLS_CC) == SUCCESS) { zend_hash_index_del(SOLR_GLOBAL(clients), solr_client->client_index); /* Keep track of how many SolrClient instances we have. */ SOLR_GLOBAL(client_count)--; return ; } } /* }}} */ /* {{{ proto SolrClient::__sleep(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrClient, __sleep) { solr_init_client(getThis() TSRMLS_CC); solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1001 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1001_MSG); } /* }}} */ /* {{{ proto SolrClient::__wakeup(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrClient, __wakeup) { solr_init_client(getThis() TSRMLS_CC); solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1001 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1001_MSG); } /* }}} */ /* {{{ proto SolrClient::__clone(void) Should not be called directly. Cloning is not supported. */ PHP_METHOD(SolrClient, __clone) { solr_init_client(getThis() TSRMLS_CC); solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_4001 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Cloning of SolrClient objects is currently not supported"); } /* }}} */ /* {{{ proto bool SolrClient::setServelet(int servlet_type, string new_value) Changes the specified servlet type to a new value */ PHP_METHOD(SolrClient, setServlet) { long int servlet_type_value = 0L; solr_char_t *new_servlet_value = NULL; COMPAT_ARG_SIZE_T new_servlet_value_length = 0; solr_client_t *client = NULL; solr_servlet_type_t servlet_type = SOLR_SERVLET_TYPE_BEGIN; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &servlet_type_value, &new_servlet_value, &new_servlet_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter."); RETURN_FALSE; } if (!new_servlet_value_length) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid servlet value."); RETURN_FALSE; } /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client"); RETURN_FALSE; } servlet_type = (solr_servlet_type_t) servlet_type_value; switch(servlet_type) { case SOLR_SERVLET_TYPE_SEARCH : { solr_string_set(&(client->options.search_servlet), new_servlet_value, new_servlet_value_length); } break; case SOLR_SERVLET_TYPE_TERMS : { solr_string_set(&(client->options.terms_servlet), new_servlet_value, new_servlet_value_length); } break; case SOLR_SERVLET_TYPE_UPDATE : { solr_string_set(&(client->options.update_servlet), new_servlet_value, new_servlet_value_length); } break; case SOLR_SERVLET_TYPE_THREADS : { solr_string_set(&(client->options.thread_servlet), new_servlet_value, new_servlet_value_length); } break; case SOLR_SERVLET_TYPE_PING : { solr_string_set(&(client->options.ping_servlet), new_servlet_value, new_servlet_value_length); } break; case SOLR_SERVLET_TYPE_SYSTEM : { solr_string_set(&(client->options.system_servlet), new_servlet_value, new_servlet_value_length); } break; default : { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid Servlet type %ld specified. Value discarded.", servlet_type_value); RETURN_FALSE; } } RETURN_TRUE; } /* }}} */ // client->handle.err.str client->handle.request_body_debug.buffer.str /* {{{ proto SolrQueryResponse SolrClient::query(SolrParams query) Sends a name-value pair request to the Solr server. */ PHP_METHOD(SolrClient, query) { zval *solr_params_obj = NULL; solr_client_t *client = NULL; solr_params_t *solr_params = NULL; solr_string_t *buffer = NULL; solr_char_t *delimiter = NULL; COMPAT_ARG_SIZE_T delimiter_length = 0; zend_bool success = 1; solr_request_type_t solr_request_type = SOLR_REQUEST_SEARCH; solr_string_t *request_url = NULL; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &solr_params_obj, solr_ce_SolrParams) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_4000_MSG); return; } /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client"); return; } /* Make sure the SolrParams object passed is a valid one */ if (solr_fetch_params_entry(solr_params_obj, &solr_params TSRMLS_CC) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "SolrParams parameter passed is not a valid one."); return ; } /* The SolrParams instance must contain at least one parameter */ if (zend_hash_num_elements(solr_params->params) < 1) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "SolrParams parameter passed contains no parameters."); return ; } buffer = &(client->handle.request_body.buffer); /* Get rid of all the data from the previous request */ solr_string_free(buffer); delimiter = client->options.qs_delimiter.str; delimiter_length = client->options.qs_delimiter.len; /* Remove wt if any */ zend_hash_str_del(solr_params->params, "wt", sizeof("wt")-1); if (solr_http_build_query(buffer, solr_params_obj, delimiter, delimiter_length TSRMLS_CC) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1003 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Error building HTTP query from parameters"); return; } /* Always reset the URLs before making any request */ solr_client_init_urls(client); request_url = &(client->options.search_url); /* terms.fl is a required parameter for the TermsComponent */ if (zend_hash_str_exists(solr_params->params, "terms.fl", sizeof("terms.fl")-1)) { /* Change the request type to a TermsComponent request */ solr_request_type = SOLR_REQUEST_TERMS; request_url =&(client->options.terms_url); } /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, solr_request_type TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"query"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrQueryResponse); solr_set_response_object_properties(solr_ce_SolrQueryResponse, return_value, client, request_url, success TSRMLS_CC); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::addDocument(SolrInputDocument doc [, bool overwrite [, int commitWithin]]) Adds a document to the Solr server. */ PHP_METHOD(SolrClient, addDocument) { zval *solr_input_doc = NULL; zend_bool overwrite = 1; long int commitWithin = 0L; solr_document_t *doc_entry = NULL; solr_client_t *client = NULL; HashTable *document_fields; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; char *overwriteValue = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|bl", &solr_input_doc, solr_ce_SolrInputDocument, &overwrite, &commitWithin) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter."); return; } if (solr_fetch_document_entry(solr_input_doc, &doc_entry TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "SolrInputDocument is not valid. Object not present in HashTable"); return; } document_fields = doc_entry->fields; /* Document must contain at least one field */ if (0 == zend_hash_num_elements(document_fields)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "SolrInputDocument has no fields"); return; } /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client"); return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "add", &root_node); overwriteValue = (overwrite)? "true" : "false"; xmlNewProp(root_node, (xmlChar *) "overwrite", (xmlChar *) overwriteValue); if (commitWithin > 0L) { auto char commitWithinBuffer[32]; memset(commitWithinBuffer, 0, sizeof(commitWithinBuffer)); php_sprintf(commitWithinBuffer, "%ld", commitWithin); xmlNewProp(root_node, (xmlChar *) "commitWithin", (xmlChar *) commitWithinBuffer); } solr_add_doc_node(root_node, doc_entry TSRMLS_CC); xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::addDocuments(array docs [, bool overwrite [, int commitWithin]]) Adds an array of SolrInputDocuments to the Solr server. */ PHP_METHOD(SolrClient, addDocuments) { zval *docs_array = NULL; zend_bool overwrite = 1; long int commitWithin = 0L; HashTable *solr_input_docs; size_t num_input_docs = 0; solr_client_t *client = NULL; solr_document_t **doc_entries = NULL; size_t curr_pos = 0U; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; xmlChar *overwriteValue = NULL; size_t pos = 0U; solr_document_t *current_doc_entry = NULL; int format = 1; int size = 0; zend_bool success = 1; xmlChar *request_string = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a|bl", &docs_array, &overwrite, &commitWithin) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } solr_input_docs = Z_ARRVAL_P(docs_array); num_input_docs = zend_hash_num_elements(solr_input_docs); if(!num_input_docs) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The array parameter passed is empty"); return; } /* This should be released if there is an error */ doc_entries = (solr_document_t **) pemalloc((sizeof(solr_document_t *) * (num_input_docs + 1)), SOLR_DOCUMENT_PERSISTENT); memset(doc_entries, 0, sizeof(solr_document_t *) * (num_input_docs + 1)); /* Please check all the SolrInputDocument instances passed via the array */ SOLR_HASHTABLE_FOR_LOOP(solr_input_docs) { zval *solr_input_doc = NULL; solr_document_t *doc_entry = NULL; HashTable *document_fields; solr_input_doc = zend_hash_get_current_data(solr_input_docs); if (Z_TYPE_P(solr_input_doc) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(solr_input_doc), solr_ce_SolrInputDocument TSRMLS_CC)) { SOLR_FREE_DOC_ENTRIES(doc_entries); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u is not a valid SolrInputDocument instance", (curr_pos + 1U)); return; } if (solr_fetch_document_entry((solr_input_doc), &doc_entry TSRMLS_CC) == FAILURE) { SOLR_FREE_DOC_ENTRIES(doc_entries); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u is not valid. Object not present in HashTable", (curr_pos + 1U)); return; } document_fields = doc_entry->fields; /* SolrInputDocument must contain at least one field */ if (0 == zend_hash_num_elements(document_fields)) { SOLR_FREE_DOC_ENTRIES(doc_entries); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u has no fields", (curr_pos + 1U)); return; } doc_entries[curr_pos] = doc_entry; curr_pos++; } /* Mark the end of the list */ doc_entries[curr_pos] = NULL; /* All the input documents have been validated. We can now retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { SOLR_FREE_DOC_ENTRIES(doc_entries); php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "add", &root_node); overwriteValue = (overwrite) ? (xmlChar *) "true" : (xmlChar *) "false"; xmlNewProp(root_node, (xmlChar *) "overwrite", overwriteValue); if (commitWithin > 0L) { auto char commitWithinBuffer[32]; memset(commitWithinBuffer, 0, sizeof(commitWithinBuffer)); php_sprintf(commitWithinBuffer, "%ld", commitWithin); xmlNewProp(root_node, (xmlChar *) "commitWithin", (xmlChar *) commitWithinBuffer); } /* Grab the first (solr_document_t *) pointer */ current_doc_entry = doc_entries[pos]; while(current_doc_entry != NULL) { solr_add_doc_node(root_node, current_doc_entry TSRMLS_CC); pos++; /* Grab the next (solr_document_t *) pointer */ current_doc_entry = doc_entries[pos]; } /* We are done with the doc_entries pointer */ SOLR_FREE_DOC_ENTRIES(doc_entries); xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::request(string request_string) Allows the user to send a manual XML update request */ PHP_METHOD(SolrClient, request) { solr_char_t *request_string = NULL; COMPAT_ARG_SIZE_T request_length = 0; solr_client_t *client = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &request_string, &request_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } if (!request_length) { solr_throw_exception(solr_ce_SolrIllegalArgumentException, "Invalid request length. Request string is empty.", SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC); return; } if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } /* The update request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), request_string, request_length); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::deleteById(string id) Allows the user to delete a document by id */ PHP_METHOD(SolrClient, deleteById) { solr_char_t *id = NULL; COMPAT_ARG_SIZE_T id_length = 0L; solr_client_t *client = NULL; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; xmlChar *escaped_id_value = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &id, &id_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } if (!id_length) { solr_throw_exception(solr_ce_SolrIllegalArgumentException, "Invalid id parameter", SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC); return; } if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "delete", &root_node); escaped_id_value = xmlEncodeEntitiesReentrant(doc_ptr, (xmlChar *) id); xmlNewChild(root_node, NULL, (xmlChar *) "id", escaped_id_value); xmlFree(escaped_id_value); xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::request(array ids) Allows the user to delete a set of documents by ids. This should be an array of strings */ PHP_METHOD(SolrClient, deleteByIds) { zval *ids_array = NULL; HashTable *doc_ids = NULL; size_t num_ids = 0; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; zend_bool invalid_param = 0; size_t error_pos = 1, current_position = 1; solr_client_t *client = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &ids_array) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } doc_ids = Z_ARRVAL_P(ids_array); num_ids = zend_hash_num_elements(doc_ids); if(!num_ids) { solr_throw_exception(solr_ce_SolrIllegalArgumentException, "The array parameter passed is empty", SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC); return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "delete", &root_node); SOLR_HASHTABLE_FOR_LOOP(doc_ids) { zval *id_zval = NULL; id_zval = zend_hash_get_current_data(doc_ids); if (Z_TYPE_P(id_zval) == IS_STRING && Z_STRLEN_P(id_zval)) { xmlChar *escaped_id_value = xmlEncodeEntitiesReentrant(doc_ptr, (xmlChar *) Z_STRVAL_P(id_zval)); xmlNewChild(root_node, NULL, (xmlChar *) "id", escaped_id_value); xmlFree(escaped_id_value); } else { invalid_param = 1; /* This id is not a valid string */ error_pos = current_position; goto end_doc_ids_loop; } current_position++; } end_doc_ids_loop : if (invalid_param) { xmlFreeDoc(doc_ptr); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Id number %u is not a valid string", error_pos); return; } if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::deleteByQuery(string query) Allows the user to delete a set of documents matching the query */ PHP_METHOD(SolrClient, deleteByQuery) { solr_char_t *query = NULL; COMPAT_ARG_SIZE_T query_length = 0L; solr_client_t *client = NULL; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; xmlChar *escaped_query_value = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &query, &query_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } if (!query_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "The query parameter is not a valid id"); return; } if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "delete", &root_node); escaped_query_value = xmlEncodeEntitiesReentrant(doc_ptr, (xmlChar *) query); xmlNewChild(root_node, NULL, (xmlChar *) "query", escaped_query_value); xmlFree(escaped_query_value); xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } /* }}} */ /* {{{ proto SolrQueryResponse SolrClient::getById(string id) Get Document By Id. Utilizes Solr Realtime Get (RTG) */ PHP_METHOD(SolrClient, getById) { solr_client_t *client; solr_char_t *id; COMPAT_ARG_SIZE_T id_len = 0; solr_string_t query_string; int success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &id, &id_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } /* Always reset the URLs before making any request */ solr_client_init_urls(client); solr_string_init(&query_string); solr_string_appends(&query_string, "id=", sizeof("id=")-1); solr_string_appends(&query_string, id, id_len); solr_string_append_solr_string(&(client->handle.request_body.buffer), &query_string); if (solr_make_request(client, SOLR_REQUEST_GET TSRMLS_CC) == FAILURE) { /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"get"); success = 0; } object_init_ex(return_value, solr_ce_SolrQueryResponse); solr_set_response_object_properties(solr_ce_SolrQueryResponse, return_value, client, &(client->options.get_url), success TSRMLS_CC); solr_string_free(&query_string); } /* }}} */ /* {{{ proto SolrQueryResponse SolrClient::getByIds(array ids) Get Documents by their Ids. Utilizes Solr Realtime Get (RTG) */ PHP_METHOD(SolrClient, getByIds) { solr_client_t *client; HashTable *ids = NULL; zval *ids_z = NULL; zend_bool invalid_param = 0; solr_string_t query_string; size_t current_position = 0; int success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &ids_z) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Internal Error: Cannot fetch client object"); return; } ids = Z_ARRVAL_P(ids_z); if (ids->nNumOfElements < 1) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, 4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter: at least 1 ID is required. Passed an empty array.", current_position); } /* Always reset the URLs before making any request */ solr_client_init_urls(client); solr_string_init(&query_string); solr_string_appends(&query_string, "ids=", sizeof("ids=")-1); SOLR_HASHTABLE_FOR_LOOP(ids) { zval *id_zv = NULL; id_zv = zend_hash_get_current_data(ids); if (Z_TYPE_P(id_zv) == IS_STRING && Z_STRLEN_P(id_zv)) { solr_string_appends(&query_string, Z_STRVAL_P(id_zv), Z_STRLEN_P(id_zv)); solr_string_appendc(&query_string, ','); } else { invalid_param = 1; goto solr_getbyids_exit; } current_position++; } solr_getbyids_exit: if (invalid_param) { solr_string_free(&query_string); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, 4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid id at position %ld", current_position); return; } solr_string_remove_last_char(&query_string); solr_string_append_solr_string(&(client->handle.request_body.buffer), &query_string); if (solr_make_request(client, SOLR_REQUEST_GET TSRMLS_CC) == FAILURE) { /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"get"); success = 0; } object_init_ex(return_value, solr_ce_SolrQueryResponse); solr_set_response_object_properties(solr_ce_SolrQueryResponse, return_value, client, &(client->options.get_url), success TSRMLS_CC); solr_string_set_ex(&(client->handle.request_body.buffer),(solr_char_t *)0x00, 0); solr_string_free(&query_string); } /* }}} */ /* {{{ proto void SolrClient::setResponseWriter(string responseWriter) Allows the user to specify which response writer to use */ PHP_METHOD(SolrClient, setResponseWriter) { solr_char_t *wt = NULL; COMPAT_ARG_SIZE_T wt_length = 0L; solr_client_t *client = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &wt, &wt_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } if (!wt_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "The response writer is not a valid string"); return; } if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } if (solr_is_supported_response_writer((const solr_char_t *) wt, wt_length)) { /* The response writer used to present the response from Solr */ solr_string_set(&(client->options.response_writer), (solr_char_t *) wt, wt_length); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported response writer %s. This value will be ignored", wt); } } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::deleteByQueries(array queries) Allows the user to delete a set of documents matching the queries specified */ PHP_METHOD(SolrClient, deleteByQueries) { zval *queries_array = NULL; HashTable *doc_queries = NULL; size_t num_queries = 0; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; zend_bool invalid_param = 0; size_t error_pos, current_position = 1; solr_client_t *client = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &queries_array) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } doc_queries = Z_ARRVAL_P(queries_array); num_queries = zend_hash_num_elements(doc_queries); if(!num_queries) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The array parameter passed is empty"); return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "delete", &root_node); SOLR_HASHTABLE_FOR_LOOP(doc_queries) { zval *query_zval = NULL; query_zval = zend_hash_get_current_data(doc_queries); if (Z_TYPE_P(query_zval) == IS_STRING && Z_STRLEN_P(query_zval)) { xmlChar *escaped_query_value = xmlEncodeEntitiesReentrant(doc_ptr, (xmlChar *) Z_STRVAL_P(query_zval)); xmlNewChild(root_node, NULL, (xmlChar *) "query", escaped_query_value); xmlFree(escaped_query_value); } else { invalid_param = 1; /* This query is not a valid string */ error_pos = current_position; goto end_doc_queries_loop; } current_position++; } end_doc_queries_loop : if (invalid_param) { xmlFreeDoc(doc_ptr); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Query number %u is not a valid query string", error_pos); return; } if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::optimize([string maxSegments [, bool softCommit [, bool waitSearcher]]) Sends an optimize XML request to the server. */ PHP_METHOD(SolrClient, optimize) { zend_bool softCommit = 0, waitSearcher = 1; char *maxSegments = "1"; int maxSegmentsLen = sizeof("1")-1; char *softCommitValue, *waitSearcherValue; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; solr_client_t *client = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sbb", &maxSegments, &maxSegmentsLen, &softCommit, &waitSearcher) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } softCommitValue = (softCommit)? "true" : "false"; waitSearcherValue = (waitSearcher)? "true" : "false"; doc_ptr = solr_xml_create_xml_doc((xmlChar *) "optimize", &root_node); xmlNewProp(root_node, (xmlChar *) "maxSegments", (xmlChar *) maxSegments); xmlNewProp(root_node, (xmlChar *) "softCommit", (xmlChar *) softCommitValue); xmlNewProp(root_node, (xmlChar *) "waitSearcher", (xmlChar *) waitSearcherValue); if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::commit( [bool softCommit [, bool waitSearcher [, bool expungeDeletes]]]) Sends a commit XML request to the server. */ PHP_METHOD(SolrClient, commit) { zend_bool softCommit = 0, waitSearcher = 1, expungeDeletes = 0; char *softCommitValue, *waitSearcherValue, *expungeDeletesValue; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; solr_client_t *client = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|bbb", &softCommit, &waitSearcher, &expungeDeletes) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); return; } softCommitValue = (softCommit)? "true" : "false"; waitSearcherValue = (waitSearcher)? "true" : "false"; expungeDeletesValue = (expungeDeletes)? "true": "false"; doc_ptr = solr_xml_create_xml_doc((xmlChar *) "commit", &root_node); xmlNewProp(root_node, (xmlChar *) "softCommit", (xmlChar *) softCommitValue); xmlNewProp(root_node, (xmlChar *) "waitSearcher", (xmlChar *) waitSearcherValue); xmlNewProp(root_node, (xmlChar *) "expungeDeletes", (xmlChar *) expungeDeletesValue); if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::rollback(void) Sends a rollback XML request to the server. */ PHP_METHOD(SolrClient, rollback) { xmlNode *root_node = NULL; zend_bool success = 1; xmlDoc *doc_ptr = NULL; solr_client_t *client = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; doc_ptr = solr_xml_create_xml_doc((xmlChar *) "rollback", &root_node); if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client from HashTable"); return; } xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success TSRMLS_CC); } /* }}} */ /* {{{ proto SolrPingResponse SolrClient::ping() Sends a HEAD request to check if the server is still up and running. */ PHP_METHOD(SolrClient, ping) { solr_client_t *client = NULL; zend_bool success = 1; /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client"); return; } /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_PING TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"ping"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrPingResponse); solr_set_response_object_properties(solr_ce_SolrPingResponse, return_value, client, &(client->options.ping_url), success TSRMLS_CC); } /* }}} */ /* {{{ proto SolrGenericResponse SolrClient::threads() Sends a request to get info about threads. */ PHP_METHOD(SolrClient, threads) { zend_bool success = 1; solr_client_t *client = NULL; /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client"); return; } /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_THREADS TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"threads"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrGenericResponse); solr_set_response_object_properties(solr_ce_SolrGenericResponse, return_value, client, &(client->options.thread_url), success TSRMLS_CC); } /* }}} */ /* {{{ proto SolrGenericResponse SolrClient::info() Sends a request to get system info. */ PHP_METHOD(SolrClient, system) { zend_bool success = 1; solr_client_t *client = NULL; /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client"); return; } /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_SYSTEM TSRMLS_CC) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"system"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrGenericResponse); solr_set_response_object_properties(solr_ce_SolrGenericResponse, return_value, client, &(client->options.system_url), success TSRMLS_CC); } /* }}} */ /* {{{ proto array SolrClient::getOptions() Returns all the options for this client. */ PHP_METHOD(SolrClient, getOptions) { solr_client_t *client = NULL; solr_client_options_t *options = NULL; /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client"); return; } options = &(client->options); array_init(return_value); add_assoc_long(return_value, "timeout", options->timeout); add_assoc_bool(return_value, "secure", (int) options->secure); add_assoc_stringl(return_value, "hostname", options->hostname.str, options->hostname.len); add_assoc_stringl(return_value, "wt", options->response_writer.str, options->response_writer.len); add_assoc_long(return_value, "port", options->host_port); add_assoc_stringl(return_value, "proxy_host", options->proxy_hostname.str, options->proxy_hostname.len); add_assoc_long(return_value, "proxy_port", options->proxy_port); add_assoc_stringl(return_value, "path", options->path.str, options->path.len); add_assoc_stringl(return_value, "http_auth", options->http_auth_credentials.str, options->http_auth_credentials.len); add_assoc_stringl(return_value, "proxy_auth", options->proxy_auth_credentials.str, options->proxy_auth_credentials.len); add_assoc_bool(return_value, "ssl_verify_peer", (int) options->ssl_verify_peer); add_assoc_long(return_value, "ssl_verify_host", options->ssl_verify_host); add_assoc_stringl(return_value, "ssl_cert", options->ssl_cert.str, options->ssl_cert.len); add_assoc_stringl(return_value, "ssl_key", options->ssl_key.str, options->ssl_key.len); add_assoc_stringl(return_value, "ssl_keypassword", options->ssl_keypassword.str, options->ssl_keypassword.len); add_assoc_stringl(return_value, "ssl_cainfo", options->ssl_cainfo.str, options->ssl_cainfo.len); add_assoc_stringl(return_value, "ssl_capath", options->ssl_capath.str, options->ssl_capath.len); } /* }}} */ /* {{{ proto string SolrClient::getDebug() Returns all debug data captured in the process of making the request. */ PHP_METHOD(SolrClient, getDebug) { solr_client_t *client = NULL; solr_curl_t *handle = NULL; /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to retrieve client"); return; } handle = &(client->handle); if (!handle->debug_data_buffer.len) { RETURN_NULL(); } RETVAL_STRINGL(handle->debug_data_buffer.str, handle->debug_data_buffer.len); } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/php_solr_collapse_function.c000066400000000000000000000254351374041537100246020ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: | | Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_solr.h" /* {{{ proto void SolrFunction::__construct([string field]) Constructor. */ PHP_METHOD(SolrCollapseFunction, __construct) { long int index = SOLR_UNIQUE_FUNCTION_INDEX(); uint nSize = SOLR_INITIAL_HASH_TABLE_SIZE; solr_function_t *solr_function_dest = NULL; zval *objptr = getThis(); #ifdef PHP_7 solr_function_dest = pemalloc(sizeof(solr_function_t), SOLR_FUNCTIONS_PERSISTENT); #endif solr_char_t *param_name = (solr_char_t *)"field"; COMPAT_ARG_SIZE_T param_name_len = sizeof("field"); solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; if ((solr_function_dest = zend_hash_index_update_ptr(SOLR_GLOBAL(functions),index,(void *) solr_function_dest)) == NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error while registering query parameters in HashTable"); return ; } zend_update_property_long(solr_ce_SolrCollapseFunction, objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, index TSRMLS_CC); solr_function_dest->function_index = index; solr_function_dest->name_length = strlen("collapse"); solr_function_dest->name = (solr_char_t *)"collapse"; /* Allocated memory for the params HashTable using fast cache for HashTables */ ALLOC_HASHTABLE(solr_function_dest->params); zend_hash_init(solr_function_dest->params, nSize, NULL, (dtor_func_t) solr_destroy_solr_string, SOLR_FUNCTIONS_PERSISTENT); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error Parsing Parameters"); return; } if (field_name_len > 0 ) { solr_solrfunc_update_string(getThis(), param_name, param_name_len, field_name, field_name_len); } Z_OBJ_HT_P(getThis()) = &solr_collapse_function_object_handlers; } /* }}} */ /* {{{ proto void SolrFunction::__destruct(void) Destructor. */ PHP_METHOD(SolrCollapseFunction, __destruct) { solr_function_t *function = NULL; /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_function_entry(getThis(), &function TSRMLS_CC) == SUCCESS ) { zend_hash_index_del(SOLR_GLOBAL(functions), function->function_index); } return; } /* {{{ proto string SolrFunction::setField(string field) Set the field that is being collapsed on. The field must be a single valued String, Int or Float. */ PHP_METHOD(SolrCollapseFunction, setField) { solr_char_t *key = "field", *arg; COMPAT_ARG_SIZE_T key_len = sizeof("field"), arg_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) { RETURN_NULL(); } if (solr_solrfunc_update_string(getThis(), key, key_len, (solr_char_t *)arg, arg_len TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error assigning field"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto string SolrFunction::getField(void) Get Collapse Field */ PHP_METHOD(SolrCollapseFunction, getField) { solr_char_t *key = "field"; COMPAT_ARG_SIZE_T key_len = sizeof("field"); solr_solrfunc_display_string(getThis(), key, key_len, &return_value TSRMLS_CC); } /* }}} */ /* {{{ proto string SolrFunction::setMin(string value) Selects the group heads by the min value of a numeric field or function query. */ PHP_METHOD(SolrCollapseFunction, setMin) { solr_char_t *key = "min", *arg; COMPAT_ARG_SIZE_T key_len = sizeof("min"), arg_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) { RETURN_NULL(); } if (solr_solrfunc_update_string(getThis(), key, key_len, (solr_char_t *)arg, arg_len TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error assigning field"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto string SolrFunction::setMax(string value) Selects the group heads by the max value of a numeric field or function query. */ PHP_METHOD(SolrCollapseFunction, setMax) { solr_char_t *key = "max", *arg; COMPAT_ARG_SIZE_T key_len = sizeof("max"), arg_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) { RETURN_NULL(); } if (solr_solrfunc_update_string(getThis(), key, key_len, (solr_char_t *)arg, arg_len TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error assigning field"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto string SolrFunction::getMin(void) Get min parameter */ PHP_METHOD(SolrCollapseFunction, getMin) { solr_char_t *key = "min"; COMPAT_ARG_SIZE_T key_len = sizeof("min"); solr_solrfunc_display_string(getThis(), key, key_len, &return_value TSRMLS_CC); } /* }}} */ /* {{{ proto string SolrFunction::getMax(void) Get max parameter */ PHP_METHOD(SolrCollapseFunction, getMax) { solr_char_t *key = "max"; COMPAT_ARG_SIZE_T key_len = sizeof("max"); solr_solrfunc_display_string(getThis(), key, key_len, &return_value TSRMLS_CC); } /* }}} */ /* {{{ proto string SolrFunction::setSize(void) Sets the initial size of the collapse data structures when collapsing on a numeric field only */ PHP_METHOD(SolrCollapseFunction, setSize) { solr_char_t *key = "size", *arg; COMPAT_ARG_SIZE_T key_len = sizeof("size"), arg_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) { RETURN_NULL(); } if (solr_solrfunc_update_string(getThis(), key, key_len, (solr_char_t *)arg, arg_len TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error assigning field"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto string SolrFunction::getSize(void) Get size parameter */ PHP_METHOD(SolrCollapseFunction, getSize) { solr_char_t *key = "size"; COMPAT_ARG_SIZE_T key_len = sizeof("size"); solr_solrfunc_display_string(getThis(), key, key_len, &return_value TSRMLS_CC); } /* }}} */ /* {{{ proto string SolrFunction::setHint(void) Set collapse hint Currently there is only one hint available "top_fc", which stands for top level FieldCache */ PHP_METHOD(SolrCollapseFunction, setHint) { solr_char_t *key = "hint", *arg; COMPAT_ARG_SIZE_T key_len = sizeof("hint"), arg_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) { RETURN_NULL(); } if (solr_solrfunc_update_string(getThis(), key, key_len, (solr_char_t *)arg, arg_len TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error assigning field"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto string SolrFunction::getHint(void) Get Hint */ PHP_METHOD(SolrCollapseFunction, getHint) { solr_char_t *key = "hint"; COMPAT_ARG_SIZE_T key_len = sizeof("hint"); solr_solrfunc_display_string(getThis(), key, key_len, &return_value TSRMLS_CC); } /* }}} */ /* {{{ proto string SolrFunction::setNullPolicy(void) Sets the NULL Policy. Accepts ignore, expand, or collapse */ PHP_METHOD(SolrCollapseFunction, setNullPolicy) { solr_char_t *key = "nullPolicy", *arg; COMPAT_ARG_SIZE_T key_len = sizeof("nullPolicy"), arg_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) { RETURN_NULL(); } if (solr_solrfunc_update_string(getThis(), key, key_len, (solr_char_t *)arg, arg_len TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error assigning field"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto string SolrFunction::getNullPolicy(void) Get NullPolicy */ PHP_METHOD(SolrCollapseFunction, getNullPolicy) { solr_char_t *key = "nullPolicy"; COMPAT_ARG_SIZE_T key_len = sizeof("nullPolicy"); solr_solrfunc_display_string(getThis(), key, key_len, &return_value TSRMLS_CC); } /* }}} */ /* {{{ proto string SolrFunction::__toString(void) String value of the function object */ PHP_METHOD(SolrCollapseFunction, __toString) { solr_function_t *collapse_func; solr_string_t *buffer = NULL; if(solr_fetch_function_entry(getThis(), &collapse_func TSRMLS_CC) == FAILURE) { RETURN_NULL(); } buffer = (solr_string_t *)emalloc(sizeof(solr_string_t)); memset(buffer, 0, sizeof(solr_string_t)); solr_solrfunc_to_string(collapse_func, &buffer); ZVAL_STRINGL(return_value, buffer->str, buffer->len); solr_string_free(buffer); efree(buffer); } /* }}} */ /* {{{ proto SolrClient::__sleep(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrCollapseFunction, __sleep) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1001 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Serialization of SolrCollapseFunction objects is currently not supported"); } /* }}} */ /* {{{ proto SolrClient::__wakeup(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrCollapseFunction, __wakeup) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1001 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Unserialization of SolrCollapseFunction objects is currently not supported"); } /* }}} */ /* {{{ throw exception on cloning (clone handler) */ zend_object* solr_collapse_function_object_handler_clone(zval *object TSRMLS_DC) { zend_object *fake; fake = zend_objects_new(zend_standard_class_def); solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_4001 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Cloning of SolrCollapseFunction objects is currently not supported"); return fake; } /* }}} */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/php_solr_dismax_query.c000066400000000000000000001056061374041537100236040ustar00rootroot00000000000000#include "php_solr.h" /* extern function_entry; */ zend_class_entry *solr_ce_SolrDixMaxQuery; ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_zero_arg_info, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_addQueryField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, field) ZEND_ARG_INFO(0, boost) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery__construct_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(0, q) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery__queryAlt_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, q) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_remove_field_arg, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, field) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_addPhraseField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(0, field) ZEND_ARG_INFO(0, boost) ZEND_ARG_INFO(0, slop) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_addBoostQuery_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(0, field) ZEND_ARG_INFO(0, value) ZEND_ARG_INFO(0, boost) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_setPhraseSlop_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, slop) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_setBoostFunction_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, function) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_setMinimumMatch_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_setTieBreaker_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, tieBreaker) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_setFields_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, fields) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_uf_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, field) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_setufs_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, fields) ZEND_END_ARG_INFO() static zend_function_entry solr_dismax_query_methods[] = { PHP_ME(SolrDisMaxQuery, __construct, SolrDisMaxQuery__construct_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setQueryAlt, SolrDisMaxQuery__queryAlt_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, addQueryField, SolrDisMaxQuery_addQueryField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, removeQueryField, SolrDisMaxQuery_remove_field_arg, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, addPhraseField, SolrDisMaxQuery_addPhraseField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, removePhraseField, SolrDisMaxQuery_remove_field_arg, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setPhraseFields, SolrDisMaxQuery_setFields_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setPhraseSlop, SolrDisMaxQuery_setPhraseSlop_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setQueryPhraseSlop, SolrDisMaxQuery_setPhraseSlop_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setBoostQuery, SolrDisMaxQuery__queryAlt_args , ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, addBoostQuery, SolrDisMaxQuery_addBoostQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, removeBoostQuery, SolrDisMaxQuery_remove_field_arg, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setBoostFunction, SolrDisMaxQuery_setBoostFunction_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setMinimumMatch, SolrDisMaxQuery_setMinimumMatch_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setTieBreaker, SolrDisMaxQuery_setTieBreaker_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, useDisMaxQueryParser, SolrDisMaxQuery_zero_arg_info, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, useEDisMaxQueryParser, SolrDisMaxQuery_zero_arg_info, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setBigramPhraseFields, SolrDisMaxQuery_setFields_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, addBigramPhraseField, SolrDisMaxQuery_addPhraseField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, removeBigramPhraseField, SolrDisMaxQuery_remove_field_arg, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setBigramPhraseSlop, SolrDisMaxQuery_setPhraseSlop_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setTrigramPhraseFields, SolrDisMaxQuery_setFields_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, addTrigramPhraseField, SolrDisMaxQuery_addPhraseField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, removeTrigramPhraseField, SolrDisMaxQuery_remove_field_arg, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setTrigramPhraseSlop, SolrDisMaxQuery_setPhraseSlop_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, addUserField, SolrDisMaxQuery_uf_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, removeUserField, SolrDisMaxQuery_uf_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setUserFields, SolrDisMaxQuery_setufs_args, ZEND_ACC_PUBLIC) PHP_FE_END }; void init_solr_dismax_query(TSRMLS_D){ zend_class_entry ce; INIT_CLASS_ENTRY(ce, "SolrDisMaxQuery", solr_dismax_query_methods); solr_ce_SolrDixMaxQuery = zend_register_internal_class_ex( &ce, solr_ce_SolrQuery ); } /* {{{ proto SolrQuery::__construct([string q]) Constructor for SolrDisMaxQuery */ PHP_METHOD(SolrDisMaxQuery, __construct) { zval *param_value = NULL; solr_char_t *deftype_param_name = "defType", *deftype_param_value = SOLR_DISMAX_DEFAULT_PARSER; COMPAT_ARG_SIZE_T deftype_param_name_len = strlen("defType"), deftype_param_value_len = strlen(SOLR_DISMAX_DEFAULT_PARSER); if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", ¶m_value) == FAILURE){ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters"); RETURN_NULL(); } if(param_value == NULL){ zend_call_method_with_0_params(getThis(), solr_ce_SolrDixMaxQuery, &solr_ce_SolrDixMaxQuery->parent->constructor, "__construct", NULL); }else{ zend_call_method_with_1_params(getThis(), solr_ce_SolrDixMaxQuery, &solr_ce_SolrDixMaxQuery->parent->constructor, "__construct", NULL, param_value); } solr_add_or_set_normal_param( getThis(), deftype_param_name, deftype_param_name_len, deftype_param_value, deftype_param_value_len, 0 TSRMLS_CC ); } /* }}} */ /* {{{ proto SolrQuery::useDisMaxQueryParser() Switch Query Parser to dismax */ PHP_METHOD(SolrDisMaxQuery, useDisMaxQueryParser) { solr_char_t *param_name = "defType", *param_value = "dismax"; COMPAT_ARG_SIZE_T param_name_len = strlen("defType"), param_value_len = strlen("dismax"), result=1; result = solr_add_or_set_normal_param( getThis(), param_name, param_name_len, param_value, param_value_len, 0 TSRMLS_CC ); if(result != SUCCESS) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrQuery::useDisMaxQueryParser() Switch Query Parser to edismax */ PHP_METHOD(SolrDisMaxQuery, useEDisMaxQueryParser) { solr_char_t *pname = "defType", *param_value = "edismax"; COMPAT_ARG_SIZE_T pname_len = strlen("defType"), param_value_len = strlen("edismax"), result=1; result = solr_add_or_set_normal_param( getThis(), pname, pname_len, param_value, param_value_len, 0 TSRMLS_CC ); if(result != SUCCESS) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrQuery::setQueryAlt(string q) SetQueryAlt uses q.alt if the q param is not defined */ PHP_METHOD(SolrDisMaxQuery, setQueryAlt) { solr_char_t *pname = "q.alt"; COMPAT_ARG_SIZE_T pname_len = sizeof("q.alt")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0, set_param_return = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE){ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters"); RETURN_NULL(); } set_param_return = solr_add_or_set_normal_param(getThis(), pname, pname_len, param_value, param_value_len, 0 TSRMLS_CC); if(set_param_return == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrQuery::addQueryField(string field[, bool boost]) SetQueryAlt uses q.alt if the q param is not defined */ PHP_METHOD(SolrDisMaxQuery, addQueryField) { solr_char_t *pname = "qf"; COMPAT_ARG_SIZE_T pname_len = sizeof("qf")-1; solr_char_t *boost_str = NULL; solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; int add_result = 0; solr_char_t *delimiter = " "; solr_char_t *separator = "^"; solr_char_t *separator_override=""; zval * boost = NULL; int boost_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &field_name, &field_name_len, &boost) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters"); RETURN_NULL(); } if(boost != NULL) { convert_to_string(boost); boost_str = Z_STRVAL_P(boost); boost_len = Z_STRLEN_P(boost); add_result = solr_add_arg_list_param( getThis(), pname, pname_len, field_name, field_name_len, boost_str, boost_len, *delimiter, *separator TSRMLS_CC ); }else{ boost_str = ""; add_result = solr_add_arg_list_param_ex( getThis(), pname, pname_len, field_name, field_name_len, boost_str, boost_len, *delimiter, *separator, *separator_override TSRMLS_CC ); } if(add_result == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::removeQueryField(string field) Removes a sort field from the sort parameter. */ PHP_METHOD(SolrDisMaxQuery, removeQueryField) { solr_char_t *pname = (solr_char_t*) "qf"; COMPAT_ARG_SIZE_T pname_len = sizeof("qf")-1; solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value( getThis(), pname, pname_len, field_name, field_name_len TSRMLS_CC ); SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::addPhraseField(string field, float boost [, float slop]) * Adds a new phrase field */ PHP_METHOD(SolrDisMaxQuery, addPhraseField) { solr_char_t *pname = (solr_char_t*) "pf"; COMPAT_ARG_SIZE_T pname_len = sizeof("pf")-1; solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; zval *boost = NULL; zval *slop = NULL; solr_char_t *boost_str = NULL; solr_char_t *slop_str = NULL; int add_result = 0; char * separator = "^"; solr_char_t * delimiter_override = ""; solr_string_t boost_slop_buffer; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|z", &field_name, &field_name_len, &boost, &slop) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if(boost != NULL) { convert_to_string(boost); boost_str = Z_STRVAL_P(boost); } if (slop != NULL) { convert_to_string(slop); slop_str = Z_STRVAL_P(slop); } if (slop != NULL && boost !=NULL) { delimiter_override = "~"; memset(&boost_slop_buffer, 0, sizeof(solr_string_t)); solr_string_appends(&boost_slop_buffer, (solr_char_t *)slop_str , Z_STRLEN_P(slop)); solr_string_appendc(&boost_slop_buffer, '^'); solr_string_appends(&boost_slop_buffer, boost_str , Z_STRLEN_P(boost)); add_result = solr_add_arg_list_param_ex( getThis(), pname, pname_len, field_name, field_name_len, boost_slop_buffer.str, boost_slop_buffer.len, ' ', *separator, *delimiter_override TSRMLS_CC ); solr_string_free(&boost_slop_buffer); } else { add_result = solr_add_arg_list_param( getThis(), pname, pname_len, field_name, field_name_len, boost_str, Z_STRLEN_P(boost),' ',*separator TSRMLS_CC ); } if(add_result == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::removeQueryField(string field) Removes a phrase field from pf. */ PHP_METHOD(SolrDisMaxQuery, removePhraseField) { solr_char_t *pname = (solr_char_t*) "pf"; COMPAT_ARG_SIZE_T pname_len = sizeof("pf")-1; solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value( getThis(), pname, pname_len, field_name, field_name_len TSRMLS_CC ); SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrQuery::setPhraseFields(string fields) setPhraseFields uses pf parameter */ PHP_METHOD(SolrDisMaxQuery, setPhraseFields) { solr_char_t *pname = "pf"; COMPAT_ARG_SIZE_T pname_len = sizeof("pf")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; solr_param_t *param = NULL; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } /* if the parameter is registered with a different type, remove it first */ if(solr_param_find(getThis(), pname, pname_len, ¶m TSRMLS_CC) == SUCCESS && param->type != SOLR_PARAM_TYPE_NORMAL) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Parameter %s value(s) was overwritten by this call", pname); solr_delete_solr_parameter(getThis(), pname, pname_len TSRMLS_CC); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0 TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add parameter %s", pname); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setPhraseSlop(integer slop) sets Phrase Slop ps argument. */ PHP_METHOD(SolrDisMaxQuery, setPhraseSlop) { solr_char_t *pname = (solr_char_t*) "ps"; COMPAT_ARG_SIZE_T pname_len = sizeof("ps")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0 TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter value"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setQueryPhraseSlop(integer slop) sets QueryPhrase Slop qs argument. */ PHP_METHOD(SolrDisMaxQuery, setQueryPhraseSlop) { solr_char_t *pname = (solr_char_t*) "qs"; COMPAT_ARG_SIZE_T pname_len = sizeof("qs")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0 TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter value"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setBoostQuery(string q) sets Boost Query bq parameter. */ PHP_METHOD(SolrDisMaxQuery, setBoostQuery) { solr_char_t *pname = (solr_char_t*) "bq"; COMPAT_ARG_SIZE_T pname_len = sizeof("bq")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; solr_param_t *param = NULL; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } /* if the parameter is registered with a different type, remove it first */ if(solr_param_find(getThis(), pname, pname_len, ¶m TSRMLS_CC) == SUCCESS && param->type != SOLR_PARAM_TYPE_NORMAL) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Parameter %s value(s) was overwritten by this call", pname); solr_delete_solr_parameter(getThis(), pname, pname_len TSRMLS_CC); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0 TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add parameter %s", pname); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::addBoostQueryField(string field, string value [, float boost]) * Adds a new boost query field using the bq parameter */ PHP_METHOD(SolrDisMaxQuery, addBoostQuery) { solr_char_t *pname = (solr_char_t*) "bq"; COMPAT_ARG_SIZE_T pname_len = sizeof("bq")-1; solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; zval *boost = NULL; solr_char_t *field_value = NULL; COMPAT_ARG_SIZE_T field_value_len = 0; solr_char_t *boost_str = NULL; int add_result = 0; char * separator = ":"; solr_char_t *boost_separator = "^"; solr_string_t *value_boost_str = NULL; solr_param_t *param = NULL; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|z", &field_name, &field_name_len, &field_value, &field_value_len, &boost) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } /* if the parameter is registered with a different type, remove it first */ if(solr_param_find(getThis(), pname, pname_len, ¶m TSRMLS_CC) == SUCCESS && param->type != SOLR_PARAM_TYPE_ARG_LIST) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Parameter %s value(s) was overwritten by this call", pname); solr_delete_solr_parameter(getThis(), pname, pname_len TSRMLS_CC); } if(boost != NULL) { convert_to_string(boost); boost_str = Z_STRVAL_P(boost); } if(boost !=NULL) { value_boost_str = emalloc(sizeof(solr_string_t)); memset(value_boost_str, 0, sizeof(solr_string_t)); solr_string_appends(value_boost_str, field_value, field_value_len); solr_string_appendc(value_boost_str, *boost_separator); solr_string_appends(value_boost_str, boost_str, Z_STRLEN_P(boost)); add_result = solr_add_arg_list_param( getThis(),pname, pname_len, field_name, field_name_len, value_boost_str->str, value_boost_str->len,' ',*separator TSRMLS_CC ); solr_string_free(value_boost_str); efree(value_boost_str); }else{ add_result = solr_add_arg_list_param( getThis(),pname, pname_len, field_name, field_name_len, field_value, field_value_len,' ',*separator TSRMLS_CC ); } if(add_result == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::removeBoostQuery(string field) Removes a sort field from the sort parameter. */ PHP_METHOD(SolrDisMaxQuery, removeBoostQuery) { solr_char_t *pname = (solr_char_t*) "bq"; COMPAT_ARG_SIZE_T pname_len = sizeof("bq")-1; solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value( getThis(), pname, pname_len, field_name, field_name_len TSRMLS_CC ); SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setBoostFunction(string function) sets Boost Query bf parameter. */ PHP_METHOD(SolrDisMaxQuery, setBoostFunction) { solr_char_t *pname = (solr_char_t*) "bf"; COMPAT_ARG_SIZE_T pname_len = sizeof("bf")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0 TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add parameter %s", pname); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setMinimumMatch(string value) sets Minimum Match (mm) parameter. */ PHP_METHOD(SolrDisMaxQuery, setMinimumMatch) { solr_char_t *pname = (solr_char_t*) "mm"; COMPAT_ARG_SIZE_T pname_len = sizeof("mm")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0 TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add parameter %s", pname); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setTieBreaker(float tieBreaker) sets Tie Breaker (tie) parameter. */ PHP_METHOD(SolrDisMaxQuery, setTieBreaker) { solr_char_t *pname = (solr_char_t*) "tie"; COMPAT_ARG_SIZE_T pname_len = sizeof("tie")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0 TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add parameter %s", pname); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setBigramPhraseFields(string bigramFields) setBigramPhraseFields uses pf2 parameter */ PHP_METHOD(SolrDisMaxQuery, setBigramPhraseFields) { solr_char_t *pname = "pf2"; COMPAT_ARG_SIZE_T pname_len = sizeof("pf2")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; int set_param_return = 0; solr_param_t *param = NULL; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE){ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters"); RETURN_NULL(); } /* if the parameter is registered with a different type, remove it first */ if(solr_param_find(getThis(), pname, pname_len, ¶m TSRMLS_CC) == SUCCESS && param->type != SOLR_PARAM_TYPE_NORMAL) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Parameter %s value(s) was overwritten by this call", pname); solr_delete_solr_parameter(getThis(), pname, pname_len TSRMLS_CC); } set_param_return = solr_add_or_set_normal_param(getThis(), pname, pname_len, param_value, param_value_len, 0 TSRMLS_CC); if(set_param_return == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::addBigramPhraseField(string field, float boost [, float slop]) * Adds a new bigram phrase field (pf2) to the list of fields */ PHP_METHOD(SolrDisMaxQuery, addBigramPhraseField) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; zval *boost = NULL; zval *slop = NULL; int add_result = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|z", &field_name, &field_name_len, &boost, &slop) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = add_phrase_field(getThis(), "pf2", boost, slop, field_name, field_name_len TSRMLS_CC); if(add_result == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::removeQueryField(string field) Removes a bigram phrase field. */ PHP_METHOD(SolrDisMaxQuery, removeBigramPhraseField) { solr_char_t *pname = (solr_char_t*) "pf2"; COMPAT_ARG_SIZE_T pname_len = sizeof("pf2")-1; solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value( getThis(), pname, pname_len, field_name, field_name_len TSRMLS_CC ); SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setBigramPhraseSlop(integer slop) sets Bigram Phrase Slop ps argument. */ PHP_METHOD(SolrDisMaxQuery, setBigramPhraseSlop) { solr_char_t *pname = (solr_char_t*) "ps2"; COMPAT_ARG_SIZE_T pname_len = sizeof("ps2")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0 TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter value"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setTrigramPhraseFields(string fields) setTrigramPhraseFields uses pf3 parameter */ PHP_METHOD(SolrDisMaxQuery, setTrigramPhraseFields) { solr_char_t *pname = "pf3"; COMPAT_ARG_SIZE_T pname_len = sizeof("pf3")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; int set_param_return = 0; solr_param_t *param = NULL; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE){ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters"); RETURN_NULL(); } /* if the parameter is registered with a different type, remove it first */ if(solr_param_find(getThis(), pname, pname_len, ¶m TSRMLS_CC) == SUCCESS && param->type != SOLR_PARAM_TYPE_NORMAL) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Parameter %s value(s) was overwritten by this call", pname); solr_delete_solr_parameter(getThis(), pname, pname_len TSRMLS_CC); } set_param_return = solr_add_or_set_normal_param(getThis(), pname, pname_len, param_value, param_value_len, 0 TSRMLS_CC); if(set_param_return == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::addTrigramPhraseField(string field, float boost [, float slop]) * Adds a new trigram phrase field (pf3) to the list of fields */ PHP_METHOD(SolrDisMaxQuery, addTrigramPhraseField) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; zval *boost = NULL; zval *slop = NULL; int add_result = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|z", &field_name, &field_name_len, &boost, &slop) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = add_phrase_field(getThis(), "pf3", boost, slop, field_name, field_name_len TSRMLS_CC); if(add_result == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::removeQueryField(string field) Removes a trigram phrase field. */ PHP_METHOD(SolrDisMaxQuery, removeTrigramPhraseField) { solr_char_t *pname = (solr_char_t*) "pf3"; COMPAT_ARG_SIZE_T pname_len = sizeof("pf3")-1; solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value( getThis(), pname, pname_len, field_name, field_name_len TSRMLS_CC ); SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setTrigramPhraseSlop(integer slop) sets Trigram Phrase Slop ps3 argument. */ PHP_METHOD(SolrDisMaxQuery, setTrigramPhraseSlop) { solr_char_t *pname = (solr_char_t*) "ps3"; COMPAT_ARG_SIZE_T pname_len = sizeof("ps3")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0 TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter value"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::addUserField(string field) Adds a userfield rule to uf parameter. */ PHP_METHOD(SolrDisMaxQuery, addUserField) { solr_char_t *pname = (solr_char_t*) "uf"; COMPAT_ARG_SIZE_T pname_len = sizeof("uf")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_simple_list_param_ex(getThis(), pname, pname_len, pvalue, pvalue_len, " " TSRMLS_CC); if(add_result == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add user field: Invalid parameter value"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::removeUserField(string field) Removes a userfield rule from uf parameter. */ PHP_METHOD(SolrDisMaxQuery, removeUserField) { solr_char_t *pname = (solr_char_t*) "uf"; COMPAT_ARG_SIZE_T pname_len = sizeof("uf")-1; solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_simple_list_param_value(getThis(), pname, pname_len, field_name, field_name_len TSRMLS_CC); SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setUserFields(string fields) Sets user fields (uf parameter) */ PHP_METHOD(SolrDisMaxQuery, setUserFields) { solr_char_t *pname = "uf"; COMPAT_ARG_SIZE_T pname_len = sizeof("uf")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; int set_param_return = 0; solr_param_t *param = NULL; if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE){ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters"); RETURN_NULL(); } /* if the parameter is registered with a different type, remove it first */ if(solr_param_find(getThis(), pname, pname_len, ¶m TSRMLS_CC) == SUCCESS && param->type != SOLR_PARAM_TYPE_NORMAL) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Parameter %s value(s) was overwritten by this call", pname); solr_delete_solr_parameter(getThis(), pname, pname_len TSRMLS_CC); } set_param_return = solr_add_or_set_normal_param(getThis(), pname, pname_len, param_value, param_value_len, 0 TSRMLS_CC); if(set_param_return == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ int add_phrase_field(zval *obj, solr_char_t *pname, zval *boost, zval *slop, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_len TSRMLS_DC) { COMPAT_ARG_SIZE_T pname_len = strlen(pname); int add_result = 0; solr_char_t *boost_str = NULL; solr_char_t *slop_str = NULL; char * separator = "^"; solr_char_t * delimiter_override = ""; solr_string_t boost_slop_buffer; if(boost != NULL) { convert_to_string(boost); boost_str = Z_STRVAL_P(boost); } if (slop != NULL) { convert_to_string(slop); slop_str = Z_STRVAL_P(slop); } if (slop != NULL && boost !=NULL) { delimiter_override = "~"; memset(&boost_slop_buffer, 0, sizeof(solr_string_t)); solr_string_appends(&boost_slop_buffer, (solr_char_t *)slop_str , Z_STRLEN_P(slop)); solr_string_appendc(&boost_slop_buffer, '^'); solr_string_appends(&boost_slop_buffer, boost_str , Z_STRLEN_P(boost)); add_result = solr_add_arg_list_param_ex( obj, pname, pname_len, field_name, field_name_len, boost_slop_buffer.str, boost_slop_buffer.len, ' ', *separator, *delimiter_override TSRMLS_CC ); solr_string_free(&boost_slop_buffer); } else { add_result = solr_add_arg_list_param( obj, pname, pname_len, field_name, field_name_len, boost_str, Z_STRLEN_P(boost),' ',*separator TSRMLS_CC ); } return add_result; } php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/php_solr_dismax_query.h000066400000000000000000000050751374041537100236100ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Omar Shaban | +----------------------------------------------------------------------+ */ #ifndef SOLR_DISMAX_QUERY_H_ #define SOLR_DISMAX_QUERY_H_ void init_solr_dismax_query(TSRMLS_D); PHP_METHOD(SolrDisMaxQuery, __construct); PHP_METHOD(SolrDisMaxQuery, setQueryAlt); PHP_METHOD(SolrDisMaxQuery, addQueryField); PHP_METHOD(SolrDisMaxQuery, removeQueryField); PHP_METHOD(SolrDisMaxQuery, addPhraseField); PHP_METHOD(SolrDisMaxQuery, removePhraseField); PHP_METHOD(SolrDisMaxQuery, setPhraseFields); PHP_METHOD(SolrDisMaxQuery, setPhraseSlop); PHP_METHOD(SolrDisMaxQuery, setQueryPhraseSlop); PHP_METHOD(SolrDisMaxQuery, setBoostQuery); PHP_METHOD(SolrDisMaxQuery, addBoostQuery); PHP_METHOD(SolrDisMaxQuery, removeBoostQuery); PHP_METHOD(SolrDisMaxQuery, setBoostFunction); PHP_METHOD(SolrDisMaxQuery, setMinimumMatch); PHP_METHOD(SolrDisMaxQuery, setTieBreaker); PHP_METHOD(SolrDisMaxQuery, useDisMaxQueryParser); PHP_METHOD(SolrDisMaxQuery, useEDisMaxQueryParser); PHP_METHOD(SolrDisMaxQuery, setBigramPhraseFields); PHP_METHOD(SolrDisMaxQuery, addBigramPhraseField); PHP_METHOD(SolrDisMaxQuery, removeBigramPhraseField); PHP_METHOD(SolrDisMaxQuery, setBigramPhraseSlop); PHP_METHOD(SolrDisMaxQuery, setTrigramPhraseFields); PHP_METHOD(SolrDisMaxQuery, addTrigramPhraseField); PHP_METHOD(SolrDisMaxQuery, removeTrigramPhraseField); PHP_METHOD(SolrDisMaxQuery, setTrigramPhraseSlop); PHP_METHOD(SolrDisMaxQuery, addUserField); PHP_METHOD(SolrDisMaxQuery, removeUserField); PHP_METHOD(SolrDisMaxQuery, setUserFields); #endif /* SOLR_DISMAX_QUERY_H_ */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/php_solr_document.c000066400000000000000000001151121374041537100227010ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /** ************************************************************************ **/ /** DEFINITIONS FOR SOLR DOCUMENT METHODS **/ /** ************************************************************************ **/ /* {{{ static int solr_document_set_field(zval *objptr, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_length, solr_char_t *field_value, COMPAT_ARG_SIZE_T field_value_length TSRMLS_DC) */ static int solr_document_set_field(zval *objptr, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_length, solr_char_t *field_value, COMPAT_ARG_SIZE_T field_value_length TSRMLS_DC) { double field_boost = 0.0f; solr_document_t *doc_entry = NULL; if (!field_name_length) { return FAILURE; } if (!field_value_length) { return FAILURE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(objptr, &doc_entry TSRMLS_CC) == SUCCESS) { solr_field_list_t *field_values = NULL; zval *tmp; /* If the field already exists in the SolrDocument instance append the value to the field list queue */ if ((field_values = zend_hash_str_find_ptr(doc_entry->fields, field_name, field_name_length)) != NULL) { if (solr_document_insert_field_value(field_values, field_value, field_boost) == FAILURE) { return FAILURE; } } else { /* Otherwise, create a new one and add it to the hash table */ field_values = (solr_field_list_t *) pemalloc(sizeof(solr_field_list_t), SOLR_DOCUMENT_FIELD_PERSISTENT); memset(field_values, 0, sizeof(solr_field_list_t)); field_values->count = 0L; field_values->field_boost = 0.0; field_values->field_name = (solr_char_t *) pestrdup(field_name,SOLR_DOCUMENT_FIELD_PERSISTENT); field_values->head = NULL; field_values->last = NULL; if (solr_document_insert_field_value(field_values, field_value, field_boost) == FAILURE) { solr_destroy_field_list(field_values); return FAILURE; } if ((tmp = zend_hash_str_add_ptr(doc_entry->fields, field_name, field_name_length, field_values)) == NULL) { solr_destroy_field_list(field_values); return FAILURE; } /* Increment field count only when HEAD is added */ doc_entry->field_count++; } return SUCCESS; } return FAILURE; } /* }}} */ /* {{{ static int solr_document_get_field(zval *objptr, zval *return_value, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_length TSRMLS_DC) */ static int solr_document_get_field(zval *objptr, zval *return_value, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_length TSRMLS_DC) { solr_document_t *doc_entry = NULL; if (!field_name_length) { return FAILURE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(objptr, &doc_entry TSRMLS_CC) == SUCCESS) { solr_field_list_t *field_values = NULL; if ((field_values = zend_hash_str_find_ptr(doc_entry->fields, (char *)field_name, field_name_length)) != NULL) { solr_create_document_field_object(field_values, &return_value TSRMLS_CC); /* The field was retrieved, so we're done here */ return SUCCESS; } return FAILURE; } return FAILURE; } /* }}} */ /* {{{ static int solr_document_remove_field(zval *objptr, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_length TSRMLS_DC) */ static int solr_document_remove_field(zval *objptr, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_length TSRMLS_DC) { solr_document_t *doc_entry = NULL; if (!field_name_length) { return FAILURE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(objptr, &doc_entry TSRMLS_CC) == SUCCESS) { if (zend_hash_str_del(doc_entry->fields, field_name, field_name_length) == SUCCESS) { doc_entry->field_count--; return SUCCESS; } return FAILURE; } return FAILURE; } /* }}} */ /* {{{ static int solr_document_field_exists(zval *objptr, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_length TSRMLS_DC) */ static int solr_document_field_exists(zval *objptr, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_length TSRMLS_DC) { solr_document_t *doc_entry = NULL; if (!field_name_length) { return FAILURE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(objptr, &doc_entry TSRMLS_CC) == SUCCESS) { if (zend_hash_str_exists(doc_entry->fields, field_name, field_name_length)) { return SUCCESS; } else { return FAILURE; } } return FAILURE; } /* }}} */ /* {{{ static void solr_serialize_document_object(HashTable *document_fields, xmlChar **buffer, int *size TSRMLS_DC) */ static void solr_serialize_document_object(HashTable *document_fields, xmlChar **buffer, int *size TSRMLS_DC) { xmlNode *root_node = NULL, *fields_node = NULL; xmlDoc *doc_ptr = NULL; int format = 1; if(!buffer) { return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "solr_document", &root_node); fields_node = xmlNewChild(root_node, NULL, (xmlChar *) "fields", NULL); SOLR_HASHTABLE_FOR_LOOP(document_fields) { solr_field_list_t *field = NULL; solr_char_t *doc_field_name = NULL; solr_field_value_t *doc_field_value = NULL; xmlNode *field_node = NULL; field = zend_hash_get_current_data_ptr(document_fields); doc_field_name = field->field_name; doc_field_value = field->head; field_node = xmlNewChild(fields_node, NULL, (xmlChar *) "field", NULL); xmlNewProp(field_node, (xmlChar *) "name", (xmlChar *) doc_field_name); /* Loop through all the values for this field */ while(doc_field_value != NULL) { xmlChar *escaped_field_value = xmlEncodeEntitiesReentrant(doc_ptr, (xmlChar *) doc_field_value->field_value); xmlNewChild(field_node, NULL, (xmlChar *) "field_value", escaped_field_value); /* Release the memory allocated by xmlEncodeEntitiesReentrant */ xmlFree(escaped_field_value); /* Grab the next value for this field if any */ doc_field_value = doc_field_value->next; } /* while(doc_field_value != NULL) */ } /* SOLR_HASHTABLE_FOR_LOOP(document_fields) */ xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, buffer, size, "UTF-8", format); xmlFreeDoc(doc_ptr); } /* }}} */ /* {{{ static void solr_unserialize_document_field(HashTable *document_fields, xmlNode *field_node TSRMLS_DC) */ static void solr_unserialize_document_field(HashTable *document_fields, xmlNode *field_node TSRMLS_DC) { solr_char_t *field_name = NULL; xmlNode *xml_curr_value = NULL; solr_field_list_t *field_values = (solr_field_list_t *) pemalloc(sizeof(solr_field_list_t), SOLR_DOCUMENT_FIELD_PERSISTENT); zend_string *field_str; memset(field_values, 0, sizeof(solr_field_list_t)); field_name = (solr_char_t *) solr_xml_get_node_contents(field_node->properties); field_values->count = 0L; field_values->field_boost = 0.0f; field_values->field_name = (solr_char_t *) pestrdup(field_name, SOLR_DOCUMENT_FIELD_PERSISTENT); field_values->head = NULL; field_values->last = NULL; /* Grab the first field node */ xml_curr_value = field_node->children; /* Looping through all the field_value nodes */ while(xml_curr_value != NULL) { /* No assumptions. It must be the field value nodes */ if (xml_curr_value->type == XML_ELEMENT_NODE && solr_xml_match_node(xml_curr_value, "field_value")) { solr_char_t *field_value = (solr_char_t *) solr_xml_get_node_contents(xml_curr_value); /* Add this value to the list of values */ if (solr_document_insert_field_value(field_values, field_value, 0.0f) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error adding field value during SolrDocument unserialization"); } } /* Move to the next field_value */ xml_curr_value = xml_curr_value->next; } field_str = zend_string_init(field_name, strlen(field_name), SOLR_DOCUMENT_FIELD_PERSISTENT); /* All the values have been retrieved for this field. Now let's drop the field in the HashTable */ if ((field_values = zend_hash_add_new_ptr(document_fields, field_str, (void *) field_values)) == NULL) { zend_string_release(field_str); solr_destroy_field_list(field_values); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error adding field values to HashTable during SolrDocument unserialization"); return; } zend_string_release(field_str); } /* }}} */ /* {{{ static int solr_unserialize_child_documents(xmlDoc *doc, solr_document_t *doc_entry TSRMLS_DC) * 1. retrieve doc hashes * 2. base64_decode * 3. unserialize (call php method) * 4. add child to solr_doc_t.children */ static int solr_unserialize_child_documents(xmlDoc *doc, solr_document_t *doc_entry TSRMLS_DC) { xmlXPathContext *xp_ctx = NULL; xmlXPathObject *xp_obj = NULL; xmlNodeSet *result = NULL; xmlChar *hash, *xp_expression; int num_nodes = 0, idx = 0; /* unserialize vars */ php_unserialize_data_t var_hash; zval solr_doc_zv; xp_expression = (xmlChar *)"/solr_document/child_docs/dochash"; xp_ctx = xmlXPathNewContext(doc); xp_obj = xmlXPathEvalExpression(xp_expression, xp_ctx); result = xp_obj->nodesetval; num_nodes = result->nodeNr; if (num_nodes > 0) { for (;idx < num_nodes; idx++) { zend_string *sdoc_str; /* serialized document string */ unsigned char *sdoc_copy, *str_end; hash = result->nodeTab[idx]->children->content; sdoc_str = (zend_string *)php_base64_decode((const unsigned char*)hash, strlen((char *)hash)); memset(&var_hash, 0, sizeof(php_unserialize_data_t)); PHP_VAR_UNSERIALIZE_INIT(var_hash); sdoc_copy = (unsigned char *)sdoc_str->val; str_end = (unsigned char *) (sdoc_copy + strlen((const char *)sdoc_copy)); if (!php_var_unserialize(&solr_doc_zv, (const unsigned char **)&sdoc_copy, str_end, &var_hash TSRMLS_CC)){ PHP_VAR_UNSERIALIZE_DESTROY(var_hash); php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to unserialize child document"); xmlXPathFreeContext(xp_ctx); xmlXPathFreeObject(xp_obj); zend_string_release(sdoc_str); return FAILURE; } zend_string_release(sdoc_str); if (zend_hash_next_index_insert(doc_entry->children, &solr_doc_zv) == NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to add child document to parent document post-unserialize"); } PHP_VAR_UNSERIALIZE_DESTROY(var_hash); } } xmlXPathFreeContext(xp_ctx); xmlXPathFreeObject(xp_obj); return SUCCESS; } /* }}} */ static int solr_unserialize_document_fields(xmlDoc *doc, HashTable *document_fields TSRMLS_DC) { xmlXPathContext *xpathctxt = NULL; xmlChar *xpath_expression = NULL; xmlXPathObject *xpathObj = NULL; xmlNodeSet *result = NULL; register size_t num_nodes = 0U; register size_t i = 0U; xpathctxt = xmlXPathNewContext(doc); if (!xpathctxt) { xmlFreeDoc(doc); php_error_docref(NULL TSRMLS_CC, E_WARNING, "A valid XML xpath context could not be created"); return FAILURE; } xpath_expression = (xmlChar *) "/solr_document/fields/field/@name"; xpathObj = xmlXPathEval(xpath_expression, xpathctxt); if (!xpathObj) { xmlXPathFreeContext(xpathctxt); xmlFreeDoc(doc); php_error_docref(NULL TSRMLS_CC, E_WARNING, "A valid XML xpath object could not be created from the expression"); return FAILURE; } result = xpathObj->nodesetval; if (!result) { xmlXPathFreeContext(xpathctxt); xmlXPathFreeObject(xpathObj); xmlFreeDoc(doc); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Document has no fields"); return FAILURE; } num_nodes = result->nodeNr; i = 0U; if (!num_nodes) { xmlXPathFreeContext(xpathctxt); xmlXPathFreeObject(xpathObj); xmlFreeDoc(doc); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Document has no fields"); return FAILURE; } for (i = 0U; i < num_nodes; i++) { xmlNode *currNode = result->nodeTab[i]; /* Absolutely No assumptions. I have to make sure that this is the name attribute */ if (currNode->type == XML_ATTRIBUTE_NODE && solr_xml_match_node(currNode, "name")) { /* Get the field node */ xmlNode *field_xml_node = currNode->parent; /* Retrieve all the values for this field and put them in the HashTable */ solr_unserialize_document_field(document_fields, field_xml_node TSRMLS_CC); } } xmlXPathFreeContext(xpathctxt); xmlXPathFreeObject(xpathObj); return SUCCESS; } /* {{{ static int solr_unserialize_document_object(HashTable *document_fields, char *serialized, int size TSRMLS_DC) */ static int solr_unserialize_document_object(solr_document_t *doc_entry, char *serialized, int size TSRMLS_DC) { xmlDoc *doc = NULL; doc = xmlReadMemory(serialized, size, NULL, "UTF-8", 0); if (!doc) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The serialized document string is invalid"); return FAILURE; } if (solr_unserialize_document_fields(doc, doc_entry->fields TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to unserialize document fields"); return FAILURE; } if (solr_unserialize_child_documents(doc, doc_entry TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to unserialize document fields"); return FAILURE; } xmlFreeDoc(doc); return SUCCESS; } /* }}} */ /* {{{ proto void SolrDocument::__construct(void) SolrDocument constructor */ PHP_METHOD(SolrDocument, __construct) { zval *objptr = getThis(); ulong document_index = SOLR_UNIQUE_DOCUMENT_INDEX(); if (solr_init_document(document_index) == NULL) { return; } /* Set the value of the internal id property */ zend_update_property_long(solr_ce_SolrDocument, objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, document_index TSRMLS_CC); /* Overriding the default object handlers */ Z_OBJ_HT_P(objptr) = &solr_input_document_object_handlers; } /* }}} */ /* {{{ proto void SolrDocument::__destruct(void) Destructor for SolrDocument */ PHP_METHOD(SolrDocument, __destruct) { solr_document_t *doc_entry = NULL; /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { zend_hash_index_del(SOLR_GLOBAL(documents), doc_entry->document_index); /* Keep track of how many SolrDocument instances we currently have */ SOLR_GLOBAL(document_count)--; return ; } } /* }}} */ /* {{{ proto SolrDocument::__clone(void) Clone method for SolrDocument */ PHP_METHOD(SolrDocument, __clone) { RETURN_NULL(); } /* }}} */ /* {{{ proto SolrDocument::__set(string fieldname, string field_value) Magic method for setting field names. */ PHP_METHOD(SolrDocument, __set) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; solr_char_t *field_value = NULL; COMPAT_ARG_SIZE_T field_value_length = 0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &field_name, &field_name_length, &field_value, &field_value_length) == FAILURE) { RETURN_FALSE; } if (solr_document_set_field(getThis(), field_name, field_name_length, field_value, field_value_length TSRMLS_CC) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto SolrDocumentField SolrDocument::__get(string fieldname) Magic method for getting a field. */ PHP_METHOD(SolrDocument, __get) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_get_field(getThis(), return_value, field_name, field_name_length TSRMLS_CC) == FAILURE) { RETURN_NULL(); } } /* }}} */ /* {{{ proto bool SolrDocument::__isset(string field_name) Checks if a field exists */ PHP_METHOD(SolrDocument, __isset) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_field_exists(getThis(), field_name, field_name_length TSRMLS_CC) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrDocument::__unset(string fieldname) Removes a field from the document. */ PHP_METHOD(SolrDocument, __unset) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_remove_field(getThis(), field_name, field_name_length TSRMLS_CC) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto void SolrDocument::offsetSet(string field_name, string field_value) Sets the specified field in the document */ PHP_METHOD(SolrDocument, offsetSet) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; solr_char_t *field_value = NULL; COMPAT_ARG_SIZE_T field_value_length = 0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &field_name, &field_name_length, &field_value, &field_value_length) == FAILURE) { return; } if (solr_document_set_field(getThis(), field_name, field_name_length, field_value, field_value_length TSRMLS_CC) == SUCCESS) { return; } } /* }}} */ /* {{{ proto SolrDocumentField SolrDocument::offsetGet(string field_name) Returns the request field. */ PHP_METHOD(SolrDocument, offsetGet) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_get_field(getThis(), return_value, field_name, field_name_length TSRMLS_CC) == FAILURE) { RETURN_NULL(); } } /* }}} */ /* {{{ proto bool SolrDocument::offsetExists(string fieldname) Checks if the request field exists in the document */ PHP_METHOD(SolrDocument, offsetExists) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_field_exists(getThis(), field_name, field_name_length TSRMLS_CC) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto void SolrDocument::offsetUnset(string fieldname) Removes the specified field from the document */ PHP_METHOD(SolrDocument, offsetUnset) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { return; } if (solr_document_remove_field(getThis(), field_name, field_name_length TSRMLS_CC) == SUCCESS) { return; } } /* }}} */ /* {{{ proto void SolrDocument::rewind(void) Resets the internal pointer. */ PHP_METHOD(SolrDocument, rewind) { solr_document_t *doc_entry = NULL; HashTable *doc_fields = NULL; if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == FAILURE) { return; } doc_fields = doc_entry->fields; zend_hash_internal_pointer_reset(doc_fields); } /* }}} */ /* {{{ proto SolrDocumentField SolrDocument::current(void) Retrieves the current field. */ PHP_METHOD(SolrDocument, current) { solr_document_t *doc_entry = NULL; HashTable *doc_fields = NULL; solr_field_list_t *field_values = NULL; if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == FAILURE) { return; } doc_fields = doc_entry->fields; field_values = zend_hash_get_current_data_ptr(doc_fields); if(field_values && field_values ) { solr_create_document_field_object(field_values, &return_value TSRMLS_CC); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrDocument::key(void) Retrieves the current key. */ PHP_METHOD(SolrDocument, key) { solr_document_t *doc_entry = NULL; ulong num_index = 0L; HashTable *doc_fields = NULL; zend_string *field_name_str; if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == FAILURE) { return; } doc_fields = doc_entry->fields; if (zend_hash_get_current_key(doc_fields, &field_name_str, &num_index)) { RETURN_STR_COPY(field_name_str); } } /* }}} */ /* {{{ proto void SolrDocument::next(void) Moves the internal pointer to the next field. */ PHP_METHOD(SolrDocument, next) { solr_document_t *doc_entry = NULL; HashTable *doc_fields = NULL; if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == FAILURE) { return; } doc_fields = doc_entry->fields; zend_hash_move_forward(doc_fields); } /* }}} */ /* {{{ proto bool SolrDocument::valid(void) Checks if the current internal pointer position is still valid. */ PHP_METHOD(SolrDocument, valid) { solr_document_t *doc_entry = NULL; HashTable *doc_fields = NULL; zend_bool is_valid = 0; if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == FAILURE) { return; } doc_fields = doc_entry->fields; is_valid = (zend_bool) ( SUCCESS == zend_hash_has_more_elements(doc_fields) ); RETURN_BOOL(is_valid); } /* }}} */ /* {{{ proto string SolrDocument::serialize(void) Custom SolrDocument serializer. Returns an XML document string representing the object. */ PHP_METHOD(SolrDocument, serialize) { solr_document_t *doc_entry = NULL; HashTable *doc_fields = NULL; char *serialized = NULL; int size = 0; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == FAILURE) { /* todo error here */ RETURN_NULL(); } doc_fields = doc_entry->fields; solr_serialize_document_object(doc_fields, (xmlChar **) &serialized, &size TSRMLS_CC); if (size) { RETVAL_STRINGL(serialized, size); xmlFree(serialized); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto void SolrDocument::unserialize(string serialized_xml) Custom SolrDocument unserializer. Brings the object back to life. */ PHP_METHOD(SolrDocument, unserialize) { solr_char_t *serialized = NULL; COMPAT_ARG_SIZE_T serialized_length = 0; zval *objptr = getThis(); ulong document_index = SOLR_UNIQUE_DOCUMENT_INDEX(); solr_document_t *doc_entry = NULL; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &serialized, &serialized_length) == FAILURE) { RETURN_FALSE; } doc_entry = solr_init_document(document_index); /* Set the value of the internal id property */ zend_update_property_long(solr_ce_SolrDocument, objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, document_index TSRMLS_CC); /* Overriding the default object handlers */ Z_OBJ_HT_P(objptr) = &solr_input_document_object_handlers; if (solr_unserialize_document_object(doc_entry, serialized, serialized_length TSRMLS_CC) == FAILURE) { return; } doc_entry->field_count = zend_hash_num_elements(doc_entry->fields); } /* }}} */ /* {{{ proto bool SolrDocument::clear(void) Resets the current object. Discards all the fields and resets the document boost to zero. */ PHP_METHOD(SolrDocument, clear) { solr_document_t *doc_entry = NULL; if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { doc_entry->document_boost = 0.0; doc_entry->field_count = 0L; zend_hash_clean(doc_entry->fields); RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrDocument::addField(string fieldname, string value) Adds a field to the document */ PHP_METHOD(SolrDocument, addField) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; solr_char_t *field_value = NULL; COMPAT_ARG_SIZE_T field_value_length = 0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &field_name, &field_name_length, &field_value, &field_value_length) == FAILURE) { RETURN_FALSE; } if (solr_document_set_field(getThis(), field_name, field_name_length, field_value, field_value_length TSRMLS_CC) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto array SolrDocument::getFieldNames(void) Returns an array of fields names in the document. */ PHP_METHOD(SolrDocument, getFieldNames) { solr_document_get_field_names(INTERNAL_FUNCTION_PARAM_PASSTHRU); } /* }}} */ /* {{{ proto int SolrDocument::getFieldCount(void) Returns the number of fields in this document. Multi-value fields are only counted once. */ PHP_METHOD(SolrDocument, getFieldCount) { solr_document_t *doc_entry = NULL; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { RETURN_LONG(zend_hash_num_elements(doc_entry->fields)); } RETURN_FALSE; } /* }}} */ /* {{{ proto SolrDocumentField SolrDocument::getField(string fieldname) Retrieves the requested field */ PHP_METHOD(SolrDocument, getField) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_get_field(getThis(), return_value, field_name, field_name_length TSRMLS_CC) == FAILURE) { RETURN_FALSE; } } /* }}} */ /* {{{ proto array SolrDocument::toArray(void) Returns an array representation of the SolrDocument object. */ PHP_METHOD(SolrDocument, toArray) { solr_document_t *doc_entry = NULL; zval arr_tmp; zval *fields_array = &arr_tmp; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { HashTable *fields_ht; #ifndef PHP_7 MAKE_STD_ZVAL(fields_array); #endif array_init(return_value); array_init(fields_array); add_assoc_double(return_value, "document_boost", doc_entry->document_boost); add_assoc_long(return_value, "field_count", doc_entry->field_count); add_assoc_zval(return_value, "fields", fields_array); fields_ht = doc_entry->fields; SOLR_HASHTABLE_FOR_LOOP(fields_ht) { solr_field_list_t *field = NULL; zval current_field_tmp; zval *current_field = ¤t_field_tmp; #ifndef PHP_7 MAKE_STD_ZVAL(current_field); #endif field = zend_hash_get_current_data_ptr(fields_ht); solr_create_document_field_object(field, ¤t_field TSRMLS_CC); add_next_index_zval(fields_array, current_field); } /* We are done */ return; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrDocument::fieldExists(string fieldname) Checks if the field exists. */ PHP_METHOD(SolrDocument, fieldExists) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_field_exists(getThis(), field_name, field_name_length TSRMLS_CC) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrDocument::deleteField(string field_name) Removes the requested field. */ PHP_METHOD(SolrDocument, deleteField) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_remove_field(getThis(), field_name, field_name_length TSRMLS_CC) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrDocument::sort(int sort_criterion [, int sort_direction]) Sorts the fields in the document */ PHP_METHOD(SolrDocument, sort) { long int order_by = 0L; long int sort_direction = SOLR_SORT_ASC; solr_document_t *doc_entry = NULL; int renumber = 0; /* The pointer to the comparison function used by zend_qsort */ compare_func_t comparison_function = (compare_func_t) NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &order_by, &sort_direction) == FAILURE) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == FAILURE) { RETURN_FALSE; } /* {{{ Select the appropriate comparison function */ switch(order_by) { case SOLR_SORT_FIELD_NAME : /* Sorting by field name */ { switch(sort_direction) { case SOLR_SORT_ASC : comparison_function = solr_compare_field_name; break; case SOLR_SORT_DESC : comparison_function = solr_rcompare_field_name; break; } } break; /* case SOLR_SORT_FIELD_NAME */ case SOLR_SORT_FIELD_VALUE_COUNT : /* Sorting by number of values per field */ { switch(sort_direction) { case SOLR_SORT_ASC : comparison_function = solr_compare_field_value_count; break; case SOLR_SORT_DESC : comparison_function = solr_rcompare_field_value_count; break; } } break; /* case SOLR_SORT_FIELD_VALUE_COUNT */ case SOLR_SORT_FIELD_BOOST_VALUE : /* Sorting by field boost values */ { switch(sort_direction) { case SOLR_SORT_ASC : comparison_function = solr_compare_field_boost_value; break; case SOLR_SORT_DESC : comparison_function = solr_rcompare_field_boost_value; break; } } break; /* case SOLR_SORT_FIELD_BOOST_VALUE */ default : /* Undefined sort criteria */ RETURN_FALSE; break; } /* }}} switch(order_by) */ /* Undefined sort direction. It was not ASC or DESC */ if (!comparison_function) { RETURN_FALSE; } if (zend_hash_sort_ex(doc_entry->fields, zend_qsort, comparison_function, renumber TSRMLS_CC) == FAILURE) { RETURN_FALSE; } RETURN_TRUE; } /* }}} */ /* {{{ proto bool SolrDocument::merge(SolrDocument source [, bool override]) Merges source to the current SolrDocument. */ PHP_METHOD(SolrDocument, merge) { solr_document_t *destination_document = NULL; solr_document_t *source_document = NULL; copy_ctor_func_t p_copy_ctor = (copy_ctor_func_t) field_copy_constructor; /* The destination SolrDocument instance */ zval *destination_document_zval = getThis(); /* The source SolrDocument instance */ zval *source_document_zval = NULL; /* Should we skip fields that already exist in destination */ zend_bool overwrite = (zend_bool) 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &source_document_zval, solr_ce_SolrDocument, &overwrite) == FAILURE) { RETURN_FALSE; } if (solr_fetch_document_entry(source_document_zval, &source_document TSRMLS_CC) == FAILURE) { RETURN_FALSE; } if (solr_fetch_document_entry(destination_document_zval, &destination_document TSRMLS_CC) == FAILURE) { RETURN_FALSE; } if (zend_hash_num_elements(source_document->fields) == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Source SolrDocument has no fields. Source"); RETURN_FALSE; } /* TODO child documents */ /* Copy the fields in the source HashTable to the destination HashTable */ zend_hash_merge(destination_document->fields, source_document->fields, p_copy_ctor, (int) overwrite); /* Update the field count */ destination_document->field_count = (uint) zend_hash_num_elements(destination_document->fields); RETURN_TRUE; } /* }}} */ static void solr_add_child_input_documents_from_documents(HashTable * children, solr_document_t *new_doc_entry TSRMLS_DC) { SOLR_HASHTABLE_FOR_LOOP(children) { zval solr_input_doc; zval *solr_doc = zend_hash_get_current_data(children); zend_call_method_with_0_params(solr_doc, Z_OBJCE_P(solr_doc), NULL, "getinputdocument", &solr_input_doc); if (zend_hash_next_index_insert(new_doc_entry->children, &solr_input_doc) == NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to convert child SolrDocument to SolrInputDocument"); } } } /* {{{ proto SolrInputDocument SolrDocument::getInputDocument(void) Returns a SolrInputDocument equivalent of the object. */ PHP_METHOD(SolrDocument, getInputDocument) { zval *objptr = getThis(); solr_document_t new_solr_doc; solr_document_t *new_doc_entry = NULL, *old_doc_entry = NULL; memset(&new_solr_doc, 0, sizeof(solr_document_t)); new_doc_entry = &new_solr_doc; /* Retrieve the document entry for the original SolrDocument */ if (solr_fetch_document_entry(objptr, &old_doc_entry TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "SolrDocument could not be fetched."); return; } object_init_ex(return_value, solr_ce_SolrInputDocument); if ((new_doc_entry = solr_input_doc_ctor(return_value))== NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "SolrInputDocument could not be created."); } /* Duplicate the doc_entry contents */ new_doc_entry->field_count = old_doc_entry->field_count; new_doc_entry->document_boost = old_doc_entry->document_boost; /* Initializing the hash table used for storing fields in this SolrDocument */ /* Copy the contents of the old fields HashTable to the new SolrDocument */ zend_hash_copy(new_doc_entry->fields, old_doc_entry->fields, (copy_ctor_func_t) field_copy_constructor); /* call getInputDocument on each child SolrDocument and store children */ if (zend_hash_num_elements(old_doc_entry->children) > 0) { solr_add_child_input_documents_from_documents(old_doc_entry->children, new_doc_entry TSRMLS_CC); } } /* }}} */ /* {{{ proto array SolrInputDocument::getChildDocuments( void ) Returns child documents or null if none */ PHP_METHOD(SolrDocument, getChildDocuments) { solr_document_t *solr_doc = NULL; if (solr_fetch_document_entry(getThis(), &solr_doc TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to fetch document entry for current object"); return; } if (zend_hash_num_elements(solr_doc->children) > 0) { array_init(return_value); zend_hash_init(Z_ARRVAL_P(return_value), zend_hash_num_elements(solr_doc->children), NULL, ZVAL_PTR_DTOR, 0); zend_hash_copy(Z_ARRVAL_P(return_value), solr_doc->children, (copy_ctor_func_t)zval_add_ref); } } /* }}} */ /* {{{ proto bool SolrInputDocument::hasChildDocuments( void ) Checks whether this document has child documents */ PHP_METHOD(SolrDocument, hasChildDocuments) { solr_document_t *solr_doc = NULL; if (solr_fetch_document_entry(getThis(), &solr_doc TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to fetch document entry for current object"); return; } if (zend_hash_num_elements(solr_doc->children) > 0) { RETURN_TRUE; } else { RETURN_FALSE; } } /* }}} */ /* {{{ proto int SolrInputDocument::getChildDocumentsCount( void ) Returns the number of child documents */ PHP_METHOD(SolrDocument, getChildDocumentsCount) { solr_document_t *solr_doc = NULL; if (solr_fetch_document_entry(getThis(), &solr_doc TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to fetch document entry for current object"); return; } ZVAL_LONG(return_value, zend_hash_num_elements(solr_doc->children)); } /* }}} */ /* {{{ proto SolrDocumentField::__construct(void) Constructor */ PHP_METHOD(SolrDocumentField, __construct) { Z_OBJ_HT_P(getThis()) = &solr_document_field_handlers; } /* }}} */ /* {{{ proto SolrDocumentField::__destruct(void) Destructor */ PHP_METHOD(SolrDocumentField, __destruct) { } /* }}} */ /* {{{ PHP_SOLR_API void solr_document_field_write_property(zval *object, zval *member, zval *value TSRMLS_DC) */ #if PHP_VERSION_ID < 50399 PHP_SOLR_API void solr_document_field_write_property(zval *object, zval *member, zval *value TSRMLS_DC) #elif PHP_VERSION_ID < 70000 PHP_SOLR_API void solr_document_field_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC) #else PHP_SOLR_API void solr_document_field_write_property(zval *object, zval *member, zval *value, void **cache_slot) #endif { solr_throw_exception(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1007_MSG, SOLR_ERROR_1007 TSRMLS_CC, SOLR_FILE_LINE_FUNC); /* if (Z_TYPE_P(member) == IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempting to set value for [%s] property in a SolrDocumentField instance", Z_STRVAL_P(member)); } */ } /* }}} */ /* {{{ PHP_SOLR_API void solr_document_field_unset_property(zval *object, zval *member TSRMLS_DC) */ #if PHP_VERSION_ID < 50399 PHP_SOLR_API void solr_document_field_unset_property(zval *object, zval *member TSRMLS_DC) #elif PHP_VERSION_ID < 70000 PHP_SOLR_API void solr_document_field_unset_property(zval *object, zval *member, const zend_literal *key TSRMLS_DC) #else PHP_SOLR_API void solr_document_field_unset_property(zval *object, zval *member, void ** cache_slot) #endif { solr_throw_exception(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1007_MSG, SOLR_ERROR_1007 TSRMLS_CC, SOLR_FILE_LINE_FUNC); /* if (Z_TYPE_P(member) == IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempting to remove [%s] property in a SolrDocumentField instance", Z_STRVAL_P(member)); } */ } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/php_solr_exception.c000066400000000000000000000147501374041537100230670ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ static void solr_prepare_internal_info(zval *object, zval *return_value TSRMLS_DC) */ static void solr_prepare_internal_info(zval *object, zval *return_value TSRMLS_DC) { zval *rv = NULL; zval *line_no = zend_read_property(Z_OBJCE_P(object), object, SOLR_SOURCELINE_NO_PROPERTY_NAME, sizeof(SOLR_SOURCELINE_NO_PROPERTY_NAME)-1, 0, rv); zval *solr_file = zend_read_property(Z_OBJCE_P(object), object, SOLR_SOURCEFILE_PROPERTY_NAME, sizeof(SOLR_SOURCEFILE_PROPERTY_NAME)-1, 0, rv); zval *solr_zif_name = zend_read_property(Z_OBJCE_P(object), object, SOLR_ZIFNAME_PROPERTY_NAME, sizeof(SOLR_ZIFNAME_PROPERTY_NAME)-1, 0, rv); long int source_line = Z_LVAL_P(line_no); char *solr_source_file = Z_STRVAL_P(solr_file); char *solr_zifname = Z_STRVAL_P(solr_zif_name); array_init(return_value); add_assoc_long(return_value, SOLR_SOURCELINE_NO_PROPERTY_NAME, source_line); add_assoc_string(return_value, SOLR_SOURCEFILE_PROPERTY_NAME, solr_source_file); add_assoc_string(return_value, SOLR_ZIFNAME_PROPERTY_NAME, solr_zifname); } /* }}} */ /* {{{ void solr_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *filename, int file_line, const char *function_name, char *format, ...) */ PHP_SOLR_API void solr_throw_exception_ex(zend_class_entry *exception_ce, long code TSRMLS_DC, const char *filename, int file_line, const char *function_name, char *format, ...) { char *message = NULL; zval object; zend_object *object_val = NULL; va_list args; va_start(args,format); /* Preparing the message string from the format and variable argument list, if any. */ ap_php_vasprintf(&message, format, args); va_end(args); /* Retrieves the thrown object and updates the properties */ object_val = zend_throw_exception(exception_ce, message, code TSRMLS_CC); ZVAL_OBJ(&object, object_val); /* This is the line number in the source file where it was thrown */ zend_update_property_long(exception_ce, &object, SOLR_SOURCELINE_NO_PROPERTY_NAME, sizeof(SOLR_SOURCELINE_NO_PROPERTY_NAME)-1, file_line TSRMLS_CC); /* This is the line source file where it was thrown */ zend_update_property_string(exception_ce, &object, SOLR_SOURCEFILE_PROPERTY_NAME, sizeof(SOLR_SOURCEFILE_PROPERTY_NAME)-1, (char *) filename TSRMLS_CC); /* This is the C function where it was thrown */ zend_update_property_string(exception_ce, &object, SOLR_ZIFNAME_PROPERTY_NAME, sizeof(SOLR_ZIFNAME_PROPERTY_NAME)-1, (char *) function_name TSRMLS_CC); /* message must be freed */ if (message != NULL) { free(message); } } /* }}} */ /* {{{ void solr_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC, const char *filename, int file_line, const char *function_name) */ PHP_SOLR_API void solr_throw_exception(zend_class_entry *exception_ce, char *message, long code TSRMLS_DC, const char *filename, int file_line, const char *function_name) { /* Retrieves the thrown object and updates the properties */ zend_object *object_val = NULL; zval object; object_val = zend_throw_exception(exception_ce, message, code); ZVAL_OBJ(&object, object_val); /* This is the line number in the source file where it was thrown */ zend_update_property_long(exception_ce, &object, SOLR_SOURCELINE_NO_PROPERTY_NAME, sizeof(SOLR_SOURCELINE_NO_PROPERTY_NAME)-1, file_line); /* This is the line source file where it was thrown */ zend_update_property_string(exception_ce, &object, SOLR_SOURCEFILE_PROPERTY_NAME, sizeof(SOLR_SOURCEFILE_PROPERTY_NAME)-1, (char *) filename); /* This is the C function where it was thrown */ zend_update_property_string(exception_ce, &object, SOLR_ZIFNAME_PROPERTY_NAME, sizeof(SOLR_ZIFNAME_PROPERTY_NAME)-1, (char *) function_name); } /* }}} */ /* Macro for preparing the return value array */ #define solr_exception_return_internal_info() { \ solr_prepare_internal_info(getThis(), return_value TSRMLS_CC); \ } /* {{{ proto array SolrException::getInternalInfo(void) Returns the internal API information where the exception was generated */ PHP_METHOD(SolrException, getInternalInfo) { solr_exception_return_internal_info() } /* }}} */ /* {{{ proto array SolrClientException::getInternalInfo(void) Returns the internal API information where the exception was generated */ PHP_METHOD(SolrClientException, getInternalInfo) { solr_exception_return_internal_info() } /* }}} */ /* {{{ proto array SolrIllegalOperationException::getInternalInfo(void) Returns the internal API information where the exception was generated */ PHP_METHOD(SolrIllegalOperationException, getInternalInfo) { solr_exception_return_internal_info() } /* }}} */ /* {{{ proto array SolrIllegalArgumentException::getInternalInfo(void) Returns the internal API information where the exception was generated */ PHP_METHOD(SolrIllegalArgumentException, getInternalInfo) { solr_exception_return_internal_info() } /* }}} */ /* {{{ proto array SolrServerException::getInternalInfo(void) Returns the internal API information where the exception was generated */ PHP_METHOD(SolrServerException, getInternalInfo) { solr_exception_return_internal_info() } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/php_solr_input_document.c000066400000000000000000000575401374041537100241320ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /** ************************************************************************ **/ /** DEFINITIONS FOR SOLR INPUT DOCUMENT METHODS **/ /** ************************************************************************ **/ /* {{{ proto void SolrInputDocument::__construct() SolrInputDocument constructor */ PHP_METHOD(SolrInputDocument, __construct) { zval *objptr = getThis(); if (solr_input_doc_ctor(objptr) == NULL) { return; } } /* }}} */ /* {{{ proto void SolrInputDocument::__destruct(void) Destructor for SolrInputDocument */ PHP_METHOD(SolrInputDocument, __destruct) { solr_document_t *doc_entry = NULL; /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { zend_hash_index_del(SOLR_GLOBAL(documents), doc_entry->document_index); /* Keep track of how many SolrDocument instances we currently have */ SOLR_GLOBAL(document_count)--; return ; } } /* }}} */ /* {{{ proto void SolrInputDocument::__clone(void) Clones the current object. Not to be called directly. */ PHP_METHOD(SolrInputDocument, __clone) { RETURN_NULL(); } /* }}} */ /* {{{ proto void SolrInputDocument::__sleep(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrInputDocument, __sleep) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1005 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1005_MSG); } /* }}} */ /* {{{ proto void SolrInputDocument::__wakeup(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrInputDocument, __wakeup) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1005 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1005_MSG); } /* }}} */ /* {{{ proto bool SolrInputDocument::setBoost(float document_boost) Sets the boost for the document. */ PHP_METHOD(SolrInputDocument, setBoost) { double boost_value = 0.0f; solr_document_t *doc_entry = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &boost_value) == FAILURE) { RETURN_FALSE; } /* If the submitted boost_value is negative. */ if (boost_value < 0.0) { RETURN_FALSE; } /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { doc_entry->document_boost = boost_value; RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto float SolrInputDocument::getBoost(void) Retrieves the boost for the document. */ PHP_METHOD(SolrInputDocument, getBoost) { solr_document_t *doc_entry = NULL; if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { RETURN_DOUBLE(doc_entry->document_boost); } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrInputDocument::clear(void) Discards all the fields and resets the document boost to zero. */ PHP_METHOD(SolrInputDocument, clear) { solr_document_t *doc_entry = NULL; if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { doc_entry->document_boost = 0.0; doc_entry->field_count = 0L; zend_hash_clean(doc_entry->fields); RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrInputDocument::addField(string field_name, field_value [, float field_boost]) Adds a field to the document. Can be called multiple times. */ PHP_METHOD(SolrInputDocument, addField) { solr_char_t *field_name = NULL, *field_value = NULL; COMPAT_ARG_SIZE_T field_name_length = 0, field_value_length = 0; solr_document_t *doc_entry = NULL; double field_boost = 0.0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|d", &field_name, &field_name_length, &field_value, &field_value_length, &field_boost) == FAILURE) { RETURN_FALSE; } if (!field_name_length) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { solr_field_list_t *field_values = NULL; /* If the field already exists in the SolrDocument instance append the value to the field list queue */ if ((field_values = (solr_field_list_t *)zend_hash_str_find_ptr(doc_entry->fields, field_name, field_name_length)) != NULL) { if (solr_document_insert_field_value(field_values, (solr_char_t *)field_value, field_boost) == FAILURE) { RETURN_FALSE; } } else { /* Otherwise, create a new one and add it to the hash table */ field_values = (solr_field_list_t *) pemalloc(sizeof(solr_field_list_t), SOLR_DOCUMENT_FIELD_PERSISTENT); memset(field_values, 0, sizeof(solr_field_list_t)); field_values->count = 0L; field_values->field_boost = 0.0; field_values->field_name = (solr_char_t *) pestrdup((char *)field_name, SOLR_DOCUMENT_FIELD_PERSISTENT); field_values->head = NULL; field_values->last = NULL; if (solr_document_insert_field_value(field_values, field_value, field_boost) == FAILURE) { solr_destroy_field_list(field_values); RETURN_FALSE; } if (zend_hash_str_add_ptr(doc_entry->fields, field_name, field_name_length,(void *) field_values) == NULL) { solr_destroy_field_list(field_values); RETURN_FALSE; } /* Increment field count only when HEAD is added */ doc_entry->field_count++; } RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrInputDocument::setFieldBoost(string fieldname, float boost_value) Sets the boost for the specified field. */ PHP_METHOD(SolrInputDocument, setFieldBoost) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; double field_boost = 0.0; solr_document_t *doc_entry = NULL; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sd", &field_name, &field_name_length, &field_boost) == FAILURE) { RETURN_FALSE; } if (!field_name_length) { RETURN_FALSE; } if (field_boost < 0.0) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { solr_field_list_t *field_values = NULL; /* If the field already exists in the SolrDocument instance append the value to the field list queue */ if ((field_values = zend_hash_str_find_ptr(doc_entry->fields, field_name, field_name_length)) != NULL) { field_values->field_boost = field_boost; RETURN_TRUE; } RETURN_FALSE; } RETURN_FALSE; } /* }}} */ /* {{{ proto float SolrInputDocument::getFieldBoost(string fieldname) Returns the boost value for the specified field. */ PHP_METHOD(SolrInputDocument, getFieldBoost) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; solr_document_t *doc_entry = NULL; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (!field_name_length) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { solr_field_list_t *field_values = NULL; if ((field_values = zend_hash_str_find_ptr(doc_entry->fields, field_name, field_name_length)) != NULL) { RETURN_DOUBLE(field_values->field_boost); } RETURN_FALSE; } RETURN_FALSE; } /* }}} */ /* {{{ proto array SolrInputDocument::getFieldNames(void) Returns an array of all the field names in the document. */ PHP_METHOD(SolrInputDocument, getFieldNames) { solr_document_get_field_names(INTERNAL_FUNCTION_PARAM_PASSTHRU); } /* }}} */ /* {{{ proto int SolrInputDocument::getFieldCount(void) Returns the number of fields in document. Multivalued fields are only counted once. */ PHP_METHOD(SolrInputDocument, getFieldCount) { solr_document_t *doc_entry = NULL; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { RETURN_LONG(zend_hash_num_elements(doc_entry->fields)); } RETURN_FALSE; } /* }}} */ /* {{{ proto SolrDocumentField SolrInputDocument::getField(string fieldname) Returns the requested field. */ PHP_METHOD(SolrInputDocument, getField) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; solr_document_t *doc_entry = NULL; zend_string *field_str = NULL; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (!field_name_length) { RETURN_FALSE; } field_str = zend_string_init(field_name, field_name_length, SOLR_DOCUMENT_FIELD_PERSISTENT); /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { solr_field_list_t *field_values = NULL; if ((field_values = zend_hash_find_ptr(doc_entry->fields, field_str)) != NULL) { solr_create_document_field_object(field_values, &return_value TSRMLS_CC); /* The field was retrieved, so we're done here */ zend_string_release(field_str); return ; } goto return_false; } return_false: zend_string_release(field_str); RETURN_FALSE; } /* }}} */ /* {{{ proto array SolrInputDocument::toArray(void) Returns an array representation of the object. */ PHP_METHOD(SolrInputDocument, toArray) { solr_document_t *doc_entry = NULL; zval fields_array; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { HashTable *fields_ht; array_init(return_value); array_init(&fields_array); zend_hash_init(Z_ARRVAL(fields_array), zend_hash_num_elements(doc_entry->fields), NULL, ZVAL_PTR_DTOR, 0); add_assoc_double(return_value, "document_boost", doc_entry->document_boost); add_assoc_long(return_value, "field_count", doc_entry->field_count); add_assoc_zval(return_value, "fields", &fields_array); fields_ht = doc_entry->fields; SOLR_HASHTABLE_FOR_LOOP(fields_ht) { solr_field_list_t *field = NULL; zval current_field; zval *current_field_ptr = ¤t_field; field = zend_hash_get_current_data_ptr(fields_ht); /* create SolrDocumentField */ solr_create_document_field_object(field, ¤t_field_ptr TSRMLS_CC); /* create SolrDocumentField to the fields HT */ add_next_index_zval(&fields_array, current_field_ptr); } /* We are done */ return; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrInputDocument::fieldExists(string field_name) Checks if the field name exists in the document. */ PHP_METHOD(SolrInputDocument, fieldExists) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; solr_document_t *doc_entry = NULL; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (!field_name_length) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { if (zend_hash_str_exists(doc_entry->fields, field_name, field_name_length)) { RETURN_TRUE; } else { RETURN_FALSE; } } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrInputDocument::deleteField(string field_name) Removes the request field from the document. */ PHP_METHOD(SolrInputDocument, deleteField) { solr_document_t *doc_entry = NULL; char *field_name; COMPAT_ARG_SIZE_T field_name_len = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &field_name, &field_name_len) == FAILURE) { RETURN_FALSE; } if (!field_name_len) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { if (zend_hash_str_del(doc_entry->fields, field_name, field_name_len) == SUCCESS) { doc_entry->field_count--; RETURN_TRUE; } RETURN_FALSE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrInputDocument::sort(int sort_criterion [, int sort_direction]) Sorts the document fields by the specified criterion. */ PHP_METHOD(SolrInputDocument, sort) { long int order_by = 0L; long int sort_direction = SOLR_SORT_ASC; solr_document_t *doc_entry = NULL; int renumber = 0; /* The pointer to the comparison function used by zend_qsort */ compare_func_t comparison_function = (compare_func_t) NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &order_by, &sort_direction) == FAILURE) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == FAILURE) { RETURN_FALSE; } /* {{{ Select the appropriate comparison function */ switch(order_by) { case SOLR_SORT_FIELD_NAME : /* Sorting by field name */ { switch(sort_direction) { case SOLR_SORT_ASC : comparison_function = solr_compare_field_name; break; case SOLR_SORT_DESC : comparison_function = solr_rcompare_field_name; break; } } break; /* case SOLR_SORT_FIELD_NAME */ case SOLR_SORT_FIELD_VALUE_COUNT : /* Sorting by number of values per field */ { switch(sort_direction) { case SOLR_SORT_ASC : comparison_function = solr_compare_field_value_count; break; case SOLR_SORT_DESC : comparison_function = solr_rcompare_field_value_count; break; } } break; /* case SOLR_SORT_FIELD_VALUE_COUNT */ case SOLR_SORT_FIELD_BOOST_VALUE : /* Sorting by field boost values */ { switch(sort_direction) { case SOLR_SORT_ASC : comparison_function = solr_compare_field_boost_value; break; case SOLR_SORT_DESC : comparison_function = solr_rcompare_field_boost_value; break; } } break; /* case SOLR_SORT_FIELD_BOOST_VALUE */ default : /* Undefined sort criteria */ RETURN_FALSE; break; } /* }}} switch(order_by) */ /* Undefined sort direction. It was not ASC or DESC */ if (!comparison_function) { RETURN_FALSE; } if (zend_hash_sort_ex(doc_entry->fields, zend_qsort, comparison_function, renumber TSRMLS_CC) == FAILURE) { RETURN_FALSE; } RETURN_TRUE; } /* }}} */ /* {{{ proto bool SolrInputDocument::merge(SolrInputDocument source [, bool override]) Merges the source document to the current object. */ PHP_METHOD(SolrInputDocument, merge) { solr_document_t *destination_document = NULL; solr_document_t *source_document = NULL; /* The destination SolrDocument instance */ zval * destination_document_zval = getThis(); /* The source SolrDocument instance */ zval *source_document_zval = NULL; /* Should we skip fields that already exist in destination */ zend_bool overwrite = (zend_bool) 0; copy_ctor_func_t p_copy_ctor = (copy_ctor_func_t) field_copy_constructor; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|b", &source_document_zval, solr_ce_SolrInputDocument, &overwrite) == FAILURE) { RETURN_FALSE; } if (solr_fetch_document_entry(source_document_zval, &source_document TSRMLS_CC) == FAILURE) { RETURN_FALSE; } if (solr_fetch_document_entry(destination_document_zval, &destination_document TSRMLS_CC) == FAILURE) { RETURN_FALSE; } if (zend_hash_num_elements(source_document->fields) == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Source SolrInputDocument has no fields. Source documentId"); RETURN_FALSE; } /* Copy the fields in the source HashTable to the destination HashTable */ zend_hash_merge(destination_document->fields, source_document->fields, p_copy_ctor, overwrite); /* Update the field count */ destination_document->field_count = (uint) zend_hash_num_elements(destination_document->fields); RETURN_TRUE; } /* }}} */ /* {{{ proto void SolrInputDocument::addChildDocument(SolrInputDocument child) Adds a child document */ PHP_METHOD(SolrInputDocument, addChildDocument) { zval *child_obj = NULL; solr_document_t *solr_doc = NULL, *child_doc_entry = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &child_obj, solr_ce_SolrInputDocument) == FAILURE) { RETURN_FALSE; } if (solr_fetch_document_entry(getThis(), &solr_doc TSRMLS_CC) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1008 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Internal Error: Unable to fetch document_entry."); return; } if (solr_fetch_document_entry(child_obj, &child_doc_entry TSRMLS_CC) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1008 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Internal Error: Unable to fetch document_entry for child document."); return; } /* SolrInputDocument must contain at least one field */ if (0 == zend_hash_num_elements(child_doc_entry->fields)) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Child document has no fields"); return; } if (zend_hash_next_index_insert(solr_doc->children, child_obj) == NULL) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Internal Error: Unable to add child to the hashtable."); } else { Z_ADDREF_P(child_obj); } } /* }}} */ /* {{{ proto void SolrInputDocument::addChildDocuments(array) Adds a child documents */ PHP_METHOD(SolrInputDocument, addChildDocuments) { HashTable *solr_input_docs; solr_document_t *solr_doc = NULL; zval *docs_array = NULL; int num_input_docs = 0, curr_pos = 0; size_t pos = 0U; zval **input_docs = NULL, *current_input_doc = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &docs_array) == FAILURE) { return; } if (solr_fetch_document_entry(getThis(), &solr_doc TSRMLS_CC) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1008 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Internal Error: Unable to fetch document_entry."); } solr_input_docs = Z_ARRVAL_P(docs_array); num_input_docs = zend_hash_num_elements(solr_input_docs); if(!num_input_docs) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "The array parameter passed is empty"); return; } /* This should be released if there is an error */ input_docs = (zval **) pemalloc((sizeof(zval *) * (num_input_docs + 1)), SOLR_DOCUMENT_PERSISTENT); memset(input_docs, 0, sizeof(zval *) * (num_input_docs + 1)); /* Please check all the SolrInputDocument instances passed via the array */ SOLR_HASHTABLE_FOR_LOOP(solr_input_docs) { zval *solr_input_doc = NULL; solr_document_t *doc_entry = NULL; HashTable *document_fields; solr_input_doc = zend_hash_get_current_data(solr_input_docs); if (Z_TYPE_P(solr_input_doc) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(solr_input_doc), solr_ce_SolrInputDocument TSRMLS_CC)) { SOLR_FREE_DOC_ENTRIES(input_docs); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u is not a valid SolrInputDocument instance", (curr_pos + 1U)); return; } if (solr_fetch_document_entry(solr_input_doc, &doc_entry TSRMLS_CC) == FAILURE) { SOLR_FREE_DOC_ENTRIES(input_docs); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u is not valid. Object not present in HashTable", (curr_pos + 1U)); return; } document_fields = doc_entry->fields; /* SolrInputDocument must contain at least one field */ if (0 == zend_hash_num_elements(document_fields)) { SOLR_FREE_DOC_ENTRIES(input_docs); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u has no fields", (curr_pos + 1U)); return; } input_docs[curr_pos] = solr_input_doc; curr_pos++; } /* Grab the first (solr_document_t *) pointer */ current_input_doc = input_docs[pos]; while(current_input_doc != NULL) { if (zend_hash_next_index_insert(solr_doc->children, current_input_doc) == NULL) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u has no fields", (pos + 1U)); SOLR_FREE_DOC_ENTRIES(input_docs); return; } /* todo possible leak */ Z_ADDREF_P(current_input_doc); pos++; current_input_doc = input_docs[pos]; } SOLR_FREE_DOC_ENTRIES(input_docs); } /* }}} */ /* {{{ proto array SolrInputDocument::getChildDocuments( void ) Returns child documents or null if none */ PHP_METHOD(SolrInputDocument, getChildDocuments) { solr_document_t *solr_doc = NULL; if (solr_fetch_document_entry(getThis(), &solr_doc TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to fetch document entry for current object"); } if (zend_hash_num_elements(solr_doc->children) > 0) { array_init(return_value); zend_hash_init(Z_ARRVAL_P(return_value), zend_hash_num_elements(solr_doc->children), NULL, ZVAL_PTR_DTOR, 0); zend_hash_copy(Z_ARRVAL_P(return_value), solr_doc->children, (copy_ctor_func_t)zval_add_ref); } } /* }}} */ /* {{{ proto bool SolrInputDocument::hasChildDocuments (void) Checks whether this document has got child documents */ PHP_METHOD(SolrInputDocument, hasChildDocuments) { solr_document_t *solr_doc = NULL; if (solr_fetch_document_entry(getThis(), &solr_doc TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to fetch document entry for current object"); } if (zend_hash_num_elements(solr_doc->children) > 0) { RETURN_TRUE; } else { RETURN_FALSE; } } /* }}} */ /* {{{ proto int SolrInputDocument::getChildDocumentsCount (void) Returns the number of child documents */ PHP_METHOD(SolrInputDocument, getChildDocumentsCount) { solr_document_t *solr_doc = NULL; if (solr_fetch_document_entry(getThis(), &solr_doc TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to fetch document entry for current object"); } ZVAL_LONG(return_value, zend_hash_num_elements(solr_doc->children)); } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/php_solr_object.c000066400000000000000000000252331374041537100223350ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ PHP_SOLR_API void solr_object_write_property(zval *object, zval *member, zval *value TSRMLS_DC) */ #if PHP_VERSION_ID < 50399 PHP_SOLR_API void solr_object_write_property(zval *object, zval *member, zval *value TSRMLS_DC) #elif PHP_VERSION_ID < 70000 PHP_SOLR_API void solr_object_write_property(zval *object, zval *member, zval *value, const zend_literal *key TSRMLS_DC) #else PHP_SOLR_API void solr_object_write_property(zval *object, zval *member, zval *value, void **cache_slot) #endif { solr_throw_exception(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1006_MSG, SOLR_ERROR_1006 TSRMLS_CC, SOLR_FILE_LINE_FUNC); if (Z_TYPE_P(member) == IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempting to set value for [%s] property in a SolrObject instance", Z_STRVAL_P(member)); } } /* }}} */ /* {{{ PHP_SOLR_API void solr_object_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC) */ PHP_SOLR_API void solr_object_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC) { solr_throw_exception(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1006_MSG, SOLR_ERROR_1006 TSRMLS_CC, SOLR_FILE_LINE_FUNC); if (Z_TYPE_P(offset) == IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempting to set value for [%s] property in a SolrObject instance", Z_STRVAL_P(offset)); } } /* }}} */ /* {{{ PHP_SOLR_API void solr_object_unset_property(zval *object, zval *member TSRMLS_DC) */ #if PHP_VERSION_ID < 50399 PHP_SOLR_API void solr_object_unset_property(zval *object, zval *member TSRMLS_DC) #elif PHP_VERSION_ID < 70000 PHP_SOLR_API void solr_object_unset_property(zval *object, zval *member, const zend_literal *key TSRMLS_DC) #else PHP_SOLR_API void solr_object_unset_property(zval *object, zval *member, void **cache_slot) #endif { solr_throw_exception(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1006_MSG, SOLR_ERROR_1006 TSRMLS_CC, SOLR_FILE_LINE_FUNC); if (Z_TYPE_P(member) == IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempting to remove [%s] property in a SolrObject instance", Z_STRVAL_P(member)); } } /* }}} */ /* {{{ PHP_SOLR_API void solr_object_unset_dimension(zval *object, zval *offset TSRMLS_DC) */ PHP_SOLR_API void solr_object_unset_dimension(zval *object, zval *offset TSRMLS_DC) { solr_throw_exception(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1006_MSG, SOLR_ERROR_1006 TSRMLS_CC, SOLR_FILE_LINE_FUNC); if (Z_TYPE_P(offset) == IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempting to remove [%s] property in a SolrObject instance", Z_STRVAL_P(offset)); } } /* }}} */ /* {{{ PHP_SOLR_API zval *solr_object_read_property(zval *object, zval *member, int type TSRMLS_DC) */ #if PHP_VERSION_ID < 50399 PHP_SOLR_API zval *solr_object_read_property(zval *object, zval *member, int type TSRMLS_DC) #elif PHP_VERSION_ID < 70000 PHP_SOLR_API zval *solr_object_read_property(zval *object, zval *member, int type, const zend_literal *key TSRMLS_DC) #else PHP_SOLR_API zval *solr_object_read_property(zval *object, zval *member, int type, void **cache_slot, zval* rv) #endif { zval *value = &EG(uninitialized_zval); char *name = NULL; HashTable *properties = NULL; if (Z_TYPE_P(member) != IS_STRING) { return value; } SOLR_HASHTABLE_FOR_LOOP(properties) { char *property_name = NULL; /* If the property name is in the HashTable */ if (property_name && !strcmp(property_name, name)) { value = zend_hash_get_current_data(properties); } } return value; } /* }}} */ /* {{{ proto SolrObject::__construct(void) Constructor for SolrObject */ PHP_METHOD(SolrObject, __construct) { Z_OBJ_HT_P(getThis()) = &solr_object_handlers; } /* }}} */ /* {{{ proto SolrObject::__destruct(void) Destructor for SolrObject. */ PHP_METHOD(SolrObject, __destruct) { } /* }}} */ /* {{{ proto void SolrObject::__set(string property_name, mixed value) Magic method for setting/updating property values. */ PHP_METHOD(SolrObject, __set) { } /* }}} */ /* {{{ proto mixed SolrObject::__get(string property_name) Magic method for retrieving properties. */ PHP_METHOD(SolrObject, __get) { solr_char_t *name = NULL; COMPAT_ARG_SIZE_T name_len = 0; zval *property = NULL, rv; zend_bool copy_value = 1; void *dtor = NULL; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { RETURN_FALSE; } property = zend_read_property(solr_ce_SolrObject, getThis(), name, name_len, 0, &rv); if (property) { RETURN_ZVAL(property, copy_value, dtor); } } /* }}} */ /* {{{ proto bool SolrObject::__isset(string property_name) Magic method for checking if a property exists in the object. */ PHP_METHOD(SolrObject, __isset) { solr_char_t *name = NULL; COMPAT_ARG_SIZE_T name_len = 0; zend_object *zobject = NULL; zval *value = NULL; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { RETURN_FALSE; } zobject = Z_OBJ_P(getThis()); value = zend_hash_str_find(zobject->properties, name, name_len); if (value) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto void SolrObject::__unset(string property_name) Magic method for removing the specified property. */ PHP_METHOD(SolrObject, __unset) { solr_char_t *name = NULL; COMPAT_ARG_SIZE_T name_len = 0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { return; } solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1002 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1002_MSG, name); RETURN_FALSE; } /* }}} */ /* {{{ proto void SolrObject::offsetSet(string key, mixed value) Sets the specified key to value. */ PHP_METHOD(SolrObject, offsetSet) { solr_char_t *name = NULL; COMPAT_ARG_SIZE_T name_len = 0; zval *prop = NULL; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &name, &name_len, &prop) == FAILURE) { RETURN_FALSE; } if (prop && Z_TYPE_P(prop) == IS_NULL) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1002 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1002_MSG, name); return ; } zend_update_property(Z_OBJCE_P(getThis()), getThis(), name, name_len, prop TSRMLS_CC); } /* }}} */ /* {{{ proto mixed SolrObject::offsetGet(string key) Retrieves the requested key. */ PHP_METHOD(SolrObject, offsetGet) { solr_char_t *name = NULL; COMPAT_ARG_SIZE_T name_len = 0; zend_object *zobject = Z_OBJ_P(getThis()); HashTable *properties = zobject->properties; zval *property_value = NULL; zend_bool copy_value = 1; void *dtor = NULL; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { RETURN_FALSE; } if ((property_value = zend_hash_str_find(properties, name, name_len)) != NULL) { goto job_complete; } else { RETURN_NULL(); } job_complete : if (property_value && (property_value)) { RETURN_ZVAL((property_value), copy_value, dtor); } } /* }}} */ /* {{{ proto bool SolrObject::offsetExists(string key) Checks if the key exists. */ PHP_METHOD(SolrObject, offsetExists) { solr_char_t *name = NULL; COMPAT_ARG_SIZE_T name_len = 0; zend_object *zobject = Z_OBJ_P(getThis()); HashTable *properties = zobject->properties; zend_bool property_exists = 0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { RETURN_FALSE; } if (!properties) { RETURN_FALSE; } property_exists = zend_hash_str_exists(properties, name, name_len); zend_hash_internal_pointer_reset(properties); RETURN_BOOL(property_exists); } /* }}} */ /* {{{ proto void SolrObject::offsetUnset(string key) Removes the specified key. */ PHP_METHOD(SolrObject, offsetUnset) { solr_char_t *name = NULL; COMPAT_ARG_SIZE_T name_len = 0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { return; } solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1002 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1002_MSG, name); RETURN_FALSE; } /* }}} */ /* {{{ proto array SolrObject::getPropertyNames(void) Returns an array of all the properties/keys in the object. */ PHP_METHOD(SolrObject, getPropertyNames) { zend_object *zobject = Z_OBJ_P(getThis()); zval new_val; zend_ulong num_idx; zend_string *str_idx; HashTable *properties = zobject->properties; if (! properties || !zend_hash_num_elements(properties)) { array_init_size(return_value, 0); zend_hash_real_init(Z_ARRVAL_P(return_value), 1); return; } array_init_size(return_value, zend_hash_num_elements(properties)); zend_hash_real_init(Z_ARRVAL_P(return_value), 1); ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(return_value)) { /* Go through input array and add keys to the return array */ ZEND_HASH_FOREACH_KEY(properties, num_idx, str_idx) { if (str_idx) { ZVAL_STR_COPY(&new_val, str_idx); } else { ZVAL_LONG(&new_val, num_idx); } ZEND_HASH_FILL_ADD(&new_val); } ZEND_HASH_FOREACH_END(); } ZEND_HASH_FILL_END(); } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/php_solr_params.c000066400000000000000000000731451374041537100223570ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ static void solr_serialize_xml_set_param_props(xmlNode *xml_param_node, solr_param_t *param) */ static void solr_serialize_xml_set_param_props(xmlNode *xml_param_node, solr_param_t *param) { char tmp_buffer[32]; /* This should be enough to hold any value */ memset(tmp_buffer, 0, sizeof(tmp_buffer)); /* Set the name attribute on the param node */ xmlNewProp(xml_param_node, (xmlChar *) "name", (xmlChar *) param->param_name); php_sprintf(tmp_buffer, "%d", param->type); /* Set the type attribute on the param node */ xmlNewProp(xml_param_node, (xmlChar *) "type", (xmlChar *) tmp_buffer); php_sprintf(tmp_buffer, "%d", param->allow_multiple); /* Set the allow_multiple attribute on the param node */ xmlNewProp(xml_param_node, (xmlChar *) "allow_multiple", (xmlChar *) tmp_buffer); php_sprintf(tmp_buffer, "%u", param->count); /* Set the count attribute on the param node */ xmlNewProp(xml_param_node, (xmlChar *) "count", (xmlChar *) tmp_buffer); php_sprintf(tmp_buffer, "%d", param->delimiter); /* Set the delimiter attribute on the param node */ xmlNewProp(xml_param_node, (xmlChar *) "delimiter", (xmlChar *) tmp_buffer); php_sprintf(tmp_buffer, "%d", param->arg_separator); /* Set the arg_separator attribute on the param node */ xmlNewProp(xml_param_node, (xmlChar *) "arg_separator", (xmlChar *) tmp_buffer); } /* }}} */ /* {{{ static void solr_serialize_normal_param_value(xmlNode *xml_params_node, solr_param_t *param) */ static void solr_serialize_normal_param_value(xmlNode *xml_params_node, solr_param_t *param) { xmlNode *xml_param_node = xmlNewChild(xml_params_node, NULL, (xmlChar *) "param", NULL); solr_param_value_t *curr_value = param->head; solr_serialize_xml_set_param_props(xml_param_node, param); while(curr_value != NULL) { xmlChar *param_value_txt = xmlEncodeEntitiesReentrant(xml_params_node->doc, (xmlChar *) curr_value->contents.normal.str); xmlNewChild(xml_param_node, NULL, (xmlChar *) "param_value", param_value_txt); xmlFree(param_value_txt); curr_value = curr_value->next; /* Go to the next value in the list */ } } /* }}} */ /* {{{ static void solr_serialize_simple_list_param_value(xmlNode *xml_params_node, solr_param_t *param) */ static void solr_serialize_simple_list_param_value(xmlNode *xml_params_node, solr_param_t *param) { xmlNode *xml_param_node = xmlNewChild(xml_params_node, NULL, (xmlChar *) "param", NULL); solr_param_value_t *curr_value = param->head; solr_serialize_xml_set_param_props(xml_param_node, param); while(curr_value != NULL) { xmlChar *param_value_txt = xmlEncodeEntitiesReentrant(xml_params_node->doc, (xmlChar *) curr_value->contents.simple_list.str); xmlNewChild(xml_param_node, NULL, (xmlChar *) "param_value", param_value_txt); xmlFree(param_value_txt); curr_value = curr_value->next; /* Go to the next value in the list */ } } /* }}} */ /* {{{ static void solr_serialize_arg_list_param_value(xmlNode *xml_params_node, solr_param_t *param) */ static void solr_serialize_arg_list_param_value(xmlNode *xml_params_node, solr_param_t *param) { xmlNode *xml_param_node = xmlNewChild(xml_params_node, NULL, (xmlChar *) "param", NULL); solr_param_value_t *curr_value = param->head; solr_serialize_xml_set_param_props(xml_param_node, param); while(curr_value != NULL) { xmlChar *param_value_txt = xmlEncodeEntitiesReentrant(xml_params_node->doc, (xmlChar *) curr_value->contents.arg_list.value.str); xmlChar *arg_value_txt = xmlEncodeEntitiesReentrant(xml_params_node->doc, (xmlChar *) curr_value->contents.arg_list.arg.str); xmlNode *xml_param_value = xmlNewChild(xml_param_node, NULL, (xmlChar *) "param_value", param_value_txt); xmlNewProp(xml_param_value, (xmlChar *) "argument", arg_value_txt); xmlFree(param_value_txt); xmlFree(arg_value_txt); curr_value = curr_value->next; /* Go to the next value in the list */ } } /* }}} */ /* {{{ static int solr_serialize_solr_params_object(xmlChar **serialized, int *size, zval *objptr TSRMLS_DC) */ static int solr_serialize_solr_params_object(xmlChar **serialized, int *size, zval *objptr TSRMLS_DC) { solr_params_t *solr_params = NULL; xmlNode *xml_solr_params = NULL, *xml_params = NULL; xmlDoc *doc_ptr = NULL; HashTable *params = NULL; int format = 1; if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { return FAILURE; } if (!serialized || !size || !objptr) { return FAILURE; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "solr_params", &xml_solr_params); xml_params = xmlNewChild(xml_solr_params, NULL, (xmlChar *) "params", NULL); params = solr_params->params; SOLR_HASHTABLE_FOR_LOOP(params) { solr_param_t *solr_param_ptr = NULL; solr_param_ptr = zend_hash_get_current_data_ptr(params); switch(solr_param_ptr->type) { case SOLR_PARAM_TYPE_NORMAL : { solr_serialize_normal_param_value(xml_params, solr_param_ptr); } break; case SOLR_PARAM_TYPE_SIMPLE_LIST : { solr_serialize_simple_list_param_value(xml_params, solr_param_ptr); } break; case SOLR_PARAM_TYPE_ARG_LIST : { solr_serialize_arg_list_param_value(xml_params, solr_param_ptr); } break; default : { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Solr Param Type %d", solr_param_ptr->type); } } } xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, serialized, size, "UTF-8", format); xmlFreeDoc(doc_ptr); return SUCCESS; } /* }}} */ /* {{{ static void solr_unserialize_get_param_normal(xmlNode *normal_param, HashTable *params_ht TSRMLS_DC) */ static void solr_unserialize_get_param_normal(xmlNode *normal_param, HashTable *params_ht TSRMLS_DC) { solr_char_t *param_name = NULL; size_t param_name_len = 0U; solr_bool allow_multiple = 0; solr_param_type_t param_type = SOLR_PARAM_TYPE_NORMAL; xmlAttr *currAttr = normal_param->properties; solr_param_t *param = NULL; xmlNode *currNode = normal_param->children; solr_param_value_equal_func_t equal_func = solr_normal_param_value_equal; solr_param_fetch_func_t fetch_func = (solr_param_fetch_func_t) solr_normal_param_value_fetch; solr_param_value_free_func_t free_func = solr_normal_param_value_free; /* Grab the name and setting for this parameter */ while(currAttr != NULL) { if (solr_xml_match_node(currAttr, "name")) { param_name = (solr_char_t *) solr_xml_get_node_contents(currAttr); param_name_len = solr_strlen(param_name); } if (solr_xml_match_node(currAttr, "allow_multiple")) { allow_multiple = solr_xml_get_node_contents_int(currAttr); } currAttr = currAttr->next; } param = solr_create_new_param(param_name, param_name_len, param_type, allow_multiple, equal_func, fetch_func, free_func, '&', 0 TSRMLS_CC); /* Retrieve all the values for this parameter */ while(currNode != NULL) { if (solr_xml_match_node(currNode, "param_value")) { xmlChar *pvalue = solr_xml_get_node_contents(currNode); size_t pvalue_length = solr_strlen((char *)pvalue); solr_param_value_t *parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.normal), (solr_char_t *) pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); } currNode = currNode->next; } /* Add this parameter to the hash table */ if (zend_hash_str_add_ptr(params_ht, (char *) param_name, param_name_len, (void *) param) == NULL) { /* Release all the memory allocated to this paramter */ solr_destroy_param(¶m); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error from %s %s", __func__, (char *) param_name); return; } } /* }}} */ /* {{{ static void solr_unserialize_get_param_simple_list(xmlNode *list_param, HashTable *params_ht TSRMLS_DC) */ static void solr_unserialize_get_param_simple_list(xmlNode *list_param, HashTable *params_ht TSRMLS_DC) { solr_char_t *param_name = NULL; size_t param_name_len = 0U; solr_bool allow_multiple = 0; solr_param_type_t param_type = SOLR_PARAM_TYPE_SIMPLE_LIST; solr_param_t *param = NULL; xmlNode *currNode = list_param->children; xmlAttr *currAttr = list_param->properties; solr_param_value_equal_func_t equal_func = solr_simple_list_param_value_equal; solr_param_fetch_func_t fetch_func = (solr_param_fetch_func_t) solr_simple_list_param_value_fetch; solr_param_value_free_func_t free_func = solr_simple_list_param_value_free; /* Grab the name and setting for this parameter */ while(currAttr != NULL) { if (solr_xml_match_node(currAttr, "name")) { param_name = (solr_char_t *) solr_xml_get_node_contents(currAttr); param_name_len = solr_strlen(param_name); } if (solr_xml_match_node(currAttr, "allow_multiple")) { allow_multiple = solr_xml_get_node_contents_int(currAttr); } currAttr = currAttr->next; } param = solr_create_new_param(param_name, param_name_len, param_type, allow_multiple, equal_func, fetch_func, free_func, ',', 0 TSRMLS_CC); /* Retrieve all the values for this parameter */ while(currNode != NULL) { if (solr_xml_match_node(currNode, "param_value")) { solr_char_t *pvalue = (solr_char_t *) solr_xml_get_node_contents(currNode); size_t pvalue_length = solr_strlen(pvalue); solr_param_value_t *parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.simple_list), pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); } currNode = currNode->next; } /* Add this parameter to the hash table */ if (zend_hash_str_add_ptr(params_ht, (char *) param_name, param_name_len, (void *) param) == NULL) { /* Release all the memory allocated to this paramter */ solr_destroy_param(¶m); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error from %s %s", __func__, (char *) param_name); return; } } /* }}} */ /* {{{ static void solr_unserialize_get_param_arg_list(xmlNode *sort_param, HashTable *params_ht TSRMLS_DC) */ static void solr_unserialize_get_param_arg_list(xmlNode *sort_param, HashTable *params_ht TSRMLS_DC) { solr_char_t *param_name = NULL; size_t param_name_len = 0U; solr_bool allow_multiple = 0; solr_char_t delimiter = 0; solr_char_t separator = 0; xmlAttr *currAttr = sort_param->properties; solr_param_type_t param_type = SOLR_PARAM_TYPE_ARG_LIST; solr_param_t *param = NULL; xmlNode *currNode = sort_param->children; solr_param_value_equal_func_t equal_func = solr_arg_list_param_value_equal; solr_param_fetch_func_t fetch_func = (solr_param_fetch_func_t) solr_arg_list_param_value_fetch; solr_param_value_free_func_t free_func = solr_arg_list_param_value_free; /* Grab the name and setting for this parameter */ while(currAttr != NULL) { if (solr_xml_match_node(currAttr, "name")) { param_name = (solr_char_t *) solr_xml_get_node_contents(currAttr); param_name_len = solr_strlen(param_name); } if (solr_xml_match_node(currAttr, "allow_multiple")) { allow_multiple = solr_xml_get_node_contents_int(currAttr); } if (solr_xml_match_node(currAttr, "delimiter")) { delimiter = solr_xml_get_node_contents_int(currAttr); } if (solr_xml_match_node(currAttr, "arg_separator")) { separator = solr_xml_get_node_contents_int(currAttr); } currAttr = currAttr->next; } param = solr_create_new_param(param_name, param_name_len, param_type, allow_multiple, equal_func, fetch_func, free_func, delimiter, separator TSRMLS_CC); /* Retrieve all the values for this parameter */ while(currNode != NULL) { if (solr_xml_match_node(currNode, "param_value")) { solr_char_t *pvalue = (solr_char_t *) solr_xml_get_node_contents(currNode); xmlAttr *argument = currNode->properties; /* the argument is the only property */ solr_char_t *avalue = (solr_char_t *) solr_xml_get_node_contents(argument); size_t pvalue_length = solr_strlen(pvalue); size_t avalue_length = solr_strlen(avalue); solr_param_value_t *parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.arg_list.value), pvalue, pvalue_length); solr_string_appends(&(parameter_value->contents.arg_list.arg), avalue, avalue_length); solr_params_insert_param_value(param, parameter_value); } currNode = currNode->next; } /* Add this parameter to the hash table */ if (zend_hash_str_add_ptr(params_ht, (char *) param_name, param_name_len, (void *) param) == NULL) { /* Release all the memory allocated to this paramter */ solr_destroy_param(¶m); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error from %s %s", __func__, (char *) param_name); return; } } /* }}} */ /* {{{ static int solr_unserialize_solr_params_object(const char *serialized, int size, zval *objptr TSRMLS_DC) */ static int solr_unserialize_solr_params_object(const char *serialized, int size, zval *objptr TSRMLS_DC) { solr_params_t *solr_params = NULL; long int params_index = SOLR_UNIQUE_PARAMS_INDEX(); solr_params_t tmp_solr_params; uint nSize = SOLR_INITIAL_HASH_TABLE_SIZE; HashTable *params_ht = NULL; xmlDoc *doc = NULL; xmlXPathContext *xpathctxt; const xmlChar *xpath_expression = (xmlChar *) "/solr_params/params/param/@type"; xmlXPathObject *xpathObj; xmlNodeSet *result = NULL; register size_t num_nodes; register size_t i = 0U; int return_status = SUCCESS; #ifdef PHP_7 solr_params = pemalloc(sizeof(solr_params_t), SOLR_PARAMS_PERSISTENT); #endif zend_update_property_long(Z_OBJCE_P(objptr), objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, params_index TSRMLS_CC); memset(&tmp_solr_params, 0, sizeof(solr_params_t)); if ((solr_params = zend_hash_index_update_ptr(SOLR_GLOBAL(params), params_index, (void *) solr_params)) == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while registering SolrParam object in HashTable"); return FAILURE; } solr_params->params_index = params_index; /* Allocate memory for the parameters HashTable using fast cache for HashTables */ ALLOC_HASHTABLE(solr_params->params); zend_hash_init(solr_params->params, nSize, NULL, (dtor_func_t) solr_destory_param_ht_dtor, SOLR_PARAMS_PERSISTENT); params_ht = solr_params->params; doc = xmlReadMemory(serialized, size, NULL, "UTF-8", 0); if (doc == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while parsing serialized XML string"); return FAILURE; } xpathctxt = xmlXPathNewContext(doc); if (xpathctxt == NULL) { xmlFreeDoc(doc); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while creating XML Xpath context"); return FAILURE; } xpathObj = xmlXPathEval(xpath_expression, xpathctxt); if (xpathObj == NULL) { xmlXPathFreeContext(xpathctxt); xmlFreeDoc(doc); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while evaluation XML Xpath expression"); return FAILURE; } result = xpathObj->nodesetval; if (result == NULL) { xmlXPathFreeObject(xpathObj); xmlXPathFreeContext(xpathctxt); xmlFreeDoc(doc); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while extracting result from XML xpath object during unserialization"); return FAILURE; } num_nodes = result->nodeNr; /* Number of parameter nodes matches in the xmlDocument */ /* Loop through all the parameter nodes and create an entry in the HashTable for each one */ for (i = 0U; i < num_nodes; i++) { xmlNode *currNode = result->nodeTab[i]; /* Absolutely No assumptions. I have to make sure that this is an attribute node */ if (currNode->type == XML_ATTRIBUTE_NODE) { /* Find out what type of parameter this is */ const solr_param_type_t param_type = solr_xml_get_node_contents_int(currNode); /* Get the /solr_params/params/param node */ xmlNode *param_xml_node = currNode->parent; /* Handle each parameter type separately */ switch(param_type) { case SOLR_PARAM_TYPE_NORMAL : { solr_unserialize_get_param_normal(param_xml_node, params_ht TSRMLS_CC); } break; case SOLR_PARAM_TYPE_SIMPLE_LIST : { solr_unserialize_get_param_simple_list(param_xml_node, params_ht TSRMLS_CC); } break; case SOLR_PARAM_TYPE_ARG_LIST : { solr_unserialize_get_param_arg_list(param_xml_node, params_ht TSRMLS_CC); } break; default : { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter type"); return_status = FAILURE; goto loop_complete; } } /* End switch */ } /* End if (currNode->type == XML_ATTRIBUTE_NODE) */ } /* End for */ loop_complete: xmlXPathFreeObject(xpathObj); xmlXPathFreeContext(xpathctxt); xmlFreeDoc(doc); return return_status; } /* }}} */ /* {{{ proto SolrParams::__clone(void) Should never be called directly. Throws exceptions whenever there is an attempt to clone a SolrParams instance */ PHP_METHOD(SolrParams, __clone) { long int params_index = SOLR_UNIQUE_PARAMS_INDEX(); solr_params_t solr_params; if (solr_init_params(&solr_params, params_index) == FAILURE) { return; } zend_update_property_long(solr_ce_SolrQuery, getThis(), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, params_index TSRMLS_CC); solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_4001 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Cloning of SolrParams object instances is currently not supported"); } /* }}} */ /* {{{ proto SolrParams::setParam(string param_name, string param_value) Sets the parameter to the specified value */ PHP_METHOD(SolrParams, setParam) { solr_char_t *param_name = NULL; COMPAT_ARG_SIZE_T param_name_length = 0; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", ¶m_name, ¶m_name_length, ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrParams::addParam(string param_name, string param_value) Adds another param_name to the object. */ PHP_METHOD(SolrParams, addParam) { solr_char_t *param_name = NULL; COMPAT_ARG_SIZE_T param_name_length = 0; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", ¶m_name, ¶m_name_length, ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrParams::getParam(string param_name) Retrieves a parameter value */ PHP_METHOD(SolrParams, getParam) { solr_char_t *param_name = NULL; COMPAT_ARG_SIZE_T param_name_length = 0; solr_param_t *solr_param = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", ¶m_name, ¶m_name_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_FALSE; } if (!param_name_length) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter name"); RETURN_NULL(); } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } if (!solr_param) { /* This should never happen unless there is a logic error in solr_param_find() */ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Very severe internal error while fetching (solr_param_t **) from solr_param_find() %s", __func__); return; } switch(solr_param->type) { case SOLR_PARAM_TYPE_NORMAL : { if (solr_param->allow_multiple) { array_init(return_value); solr_normal_param_value_display(solr_param, return_value); return; } else { solr_normal_param_value_display_string(solr_param, return_value); return; } } break; case SOLR_PARAM_TYPE_SIMPLE_LIST : { array_init(return_value); solr_simple_list_param_value_display(solr_param, return_value); return; } break; case SOLR_PARAM_TYPE_ARG_LIST : { array_init(return_value); solr_arg_list_param_value_display(solr_param, return_value); return; } break; default : { /* This should never happen. However, never say never! */ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter type in switch case %s", __func__); } } /* END switch(solr_param->type) */ } /* }}} */ /* {{{ proto array SolrParams::getPreparedParams(void) Returns an array of all the parameters (url-encoded) as they will be sent in the name-value pair POST request. */ PHP_METHOD(SolrParams, getPreparedParams) { solr_params_t *solr_params = NULL; array_init(return_value); /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_params_entry(getThis(), &solr_params TSRMLS_CC) == SUCCESS) { HashTable *params = solr_params->params; SOLR_HASHTABLE_FOR_LOOP(params) { solr_param_t *solr_param = NULL; solr_string_t tmp_buffer; solr_param = zend_hash_get_current_data_ptr(params); memset(&tmp_buffer, 0, sizeof(solr_string_t)); solr_param->fetch_func(solr_param, &tmp_buffer); add_assoc_stringl(return_value, solr_param->param_name, tmp_buffer.str, tmp_buffer.len); solr_string_free(&tmp_buffer); } return; } php_error_docref(NULL TSRMLS_CC, E_WARNING, "SolrParams instance could not be retrieved from HashTable"); RETURN_NULL(); } /* }}} */ /* {{{ proto array SolrParams::getParams(void) Returns an array of the parameters in the object. The values are not url-encoded. */ PHP_METHOD(SolrParams, getParams) { solr_params_t *solr_params = NULL; array_init(return_value); /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_params_entry(getThis(), &solr_params TSRMLS_CC) == SUCCESS) { HashTable *params = solr_params->params; SOLR_HASHTABLE_FOR_LOOP(params) { solr_param_t *solr_param_ptr = NULL; solr_param_display_func_t display_func = NULL; zval *current_param = NULL; solr_param_ptr = zend_hash_get_current_data_ptr(params); switch(solr_param_ptr->type) { case SOLR_PARAM_TYPE_NORMAL : { display_func = solr_normal_param_value_display; } break; case SOLR_PARAM_TYPE_SIMPLE_LIST : { display_func = solr_simple_list_param_value_display; } break; case SOLR_PARAM_TYPE_ARG_LIST : { display_func = solr_arg_list_param_value_display; } break; default : { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter type"); } } MAKE_STD_ZVAL(current_param); array_init(current_param); add_assoc_zval(return_value, solr_param_ptr->param_name, current_param); display_func(solr_param_ptr, current_param); #ifdef PHP_7 efree(current_param); #endif } return; } php_error_docref(NULL TSRMLS_CC, E_WARNING, "SolrParams instance could not be retrieved from HashTable"); RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrParams::__toString(void) Returns a string representation of the object */ PHP_METHOD(SolrParams, __toString) { solr_params_t *solr_params = NULL; register zend_bool url_encode = 0; /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_params_entry(getThis(), &solr_params TSRMLS_CC) == SUCCESS) { HashTable *params = solr_params->params; solr_string_t tmp_buffer; memset(&tmp_buffer, 0, sizeof(solr_string_t)); SOLR_HASHTABLE_FOR_LOOP(params) { solr_param_t *solr_param_ptr = NULL; solr_param_tostring_func_t tostring_func = NULL; solr_param_ptr = zend_hash_get_current_data_ptr(params); switch(solr_param_ptr->type) { case SOLR_PARAM_TYPE_NORMAL : { tostring_func = solr_normal_param_value_tostring; } break; case SOLR_PARAM_TYPE_SIMPLE_LIST : { tostring_func = solr_simple_list_param_value_tostring; } break; case SOLR_PARAM_TYPE_ARG_LIST : { tostring_func = solr_arg_list_param_value_tostring; } break; default : { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter type"); } } tostring_func(solr_param_ptr, &(tmp_buffer), url_encode); solr_string_appendc(&(tmp_buffer), '&'); } if (tmp_buffer.str && tmp_buffer.len) { solr_string_remove_last_char(&(tmp_buffer)); RETVAL_STRINGL((char *) tmp_buffer.str, tmp_buffer.len); solr_string_free(&(tmp_buffer)); return; } } RETVAL_STRINGL(SOLR_SPACE_STRING, sizeof(SOLR_SPACE_STRING)-1); } /* }}} */ /* {{{ proto string SolrParams::toString(void) Returns a string representation of the object */ PHP_METHOD(SolrParams, toString) { solr_params_t *solr_params = NULL; zend_bool url_encode = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &url_encode) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); return; } /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_params_entry(getThis(), &solr_params TSRMLS_CC) == SUCCESS) { HashTable *params = solr_params->params; solr_string_t tmp_buffer; memset(&tmp_buffer, 0, sizeof(solr_string_t)); SOLR_HASHTABLE_FOR_LOOP(params) { solr_param_t *solr_param_ptr = NULL; solr_param_tostring_func_t tostring_func = NULL; solr_param_ptr = zend_hash_get_current_data_ptr(params); switch(solr_param_ptr->type) { case SOLR_PARAM_TYPE_NORMAL : { tostring_func = solr_normal_param_value_tostring; } break; case SOLR_PARAM_TYPE_SIMPLE_LIST : { tostring_func = solr_simple_list_param_value_tostring; } break; case SOLR_PARAM_TYPE_ARG_LIST : { tostring_func = solr_arg_list_param_value_tostring; } break; default : { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter type"); } } tostring_func(solr_param_ptr, &(tmp_buffer), url_encode); solr_string_appendc(&(tmp_buffer), '&'); } if (tmp_buffer.str && tmp_buffer.len) { solr_string_remove_last_char(&(tmp_buffer)); RETVAL_STRINGL((char *) tmp_buffer.str, tmp_buffer.len); solr_string_free(&(tmp_buffer)); return; } } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrParams::serialize(void) Returns a string representation of the object. Used for custom serialization. */ PHP_METHOD(SolrParams, serialize) { xmlChar *serialized = NULL; int size = 0; if (solr_serialize_solr_params_object(&serialized, &size, getThis() TSRMLS_CC) == FAILURE || !serialized || !size) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to serialize object"); RETURN_NULL(); } RETVAL_STRINGL((char *) serialized, size); xmlFree(serialized); } /* }}} */ /* {{{ proto void SolrParams::unserialize(string serialized) Brings the serialized object back to life. */ PHP_METHOD(SolrParams, unserialize) { char *serialized_object = NULL; COMPAT_ARG_SIZE_T serialized_object_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &serialized_object, &serialized_object_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if(serialized_object_len == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_unserialize_solr_params_object(serialized_object, serialized_object_len, getThis() TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error during unserialization"); } } /* }}} */ /* {{{ proto void SolrModifiableParams::__construct(void) Constructor. */ PHP_METHOD(SolrModifiableParams, __construct) { long int params_index = SOLR_UNIQUE_PARAMS_INDEX(); solr_params_t solr_params; if (solr_init_params(&solr_params, params_index) == FAILURE) { return; } zend_update_property_long(solr_ce_SolrModifiableParams, getThis(), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, params_index TSRMLS_CC); } /* }}} */ /* {{{ proto void SolrModifiableParams::__destruct(void) Destructor. */ PHP_METHOD(SolrModifiableParams, __destruct) { solr_params_t *solr_params = NULL; /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_params_entry(getThis(), &solr_params TSRMLS_CC) == SUCCESS) { zend_hash_index_del(SOLR_GLOBAL(params), solr_params->params_index); return ; } } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/php_solr_query.c000066400000000000000000004734301374041537100222420ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* Outstanding Work/Changes */ /* TODO: Change SolrQuery::getTermsSort() to return integer */ /* TODO: Change SolrQuery::getFacetSort() to return integer */ /** * Note about methods implementation: * * One reason why each SolrQuery has custom code is because each method * could require separate tweaking. * * At this point in time, even though most of the SolrQuery methods share * basic features, I still believe that is a better idea to write separate code * for each method implementation. * * This will make the methods easier to maintain because * * from time to time, Solr modifies the way some of the request parameters are * submitted or processed. * * Hence, it is currently more logical to make each method an independent entity. */ /* {{{ proto SolrQuery::__construct([string q]) Constructor for SolrQuery */ PHP_METHOD(SolrQuery, __construct) { long int params_index = SOLR_UNIQUE_PARAMS_INDEX(); solr_char_t *q = NULL; COMPAT_ARG_SIZE_T query_length = 0; solr_params_t solr_params; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, solr_ce_SolrIllegalArgumentException, &error_handling TSRMLS_CC); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &q, &query_length) == FAILURE) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } zend_restore_error_handling(&error_handling TSRMLS_CC); if (solr_init_params(&solr_params, params_index) == FAILURE) { return; } zend_update_property_long(solr_ce_SolrQuery, getThis(), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, params_index TSRMLS_CC); if (query_length) { if (solr_set_normal_param(getThis(), (solr_char_t *) "q", sizeof("q")-1, q, query_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while setting query parameter"); return; } } } /* }}} */ /* {{{ proto SolrQuery::__destruct() Destructor for SolrQuery */ PHP_METHOD(SolrQuery, __destruct) { solr_params_t *solr_params = NULL; /* Retrieve the entry for this SolrParams instance */ if (solr_fetch_params_entry(getThis(), &solr_params TSRMLS_CC) == SUCCESS) { zend_hash_index_del(SOLR_GLOBAL(params), solr_params->params_index); return ; } /* This would only happen if user attempted an illegal operation */ php_error_docref(NULL TSRMLS_CC, E_ERROR, SOLR_ERROR_1008_MSG, SOLR_FILE_LINE_FUNC); } /* }}} */ /* {{{ CommonQueryParameters */ /* {{{ proto SolrQuery SolrQuery::setQuery(string q) Sets the q parameter */ PHP_METHOD(SolrQuery, setQuery) { solr_char_t *param_name = (solr_char_t *) "q"; COMPAT_ARG_SIZE_T param_name_len = sizeof("q")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setStart(int start) Sets the start parameter */ PHP_METHOD(SolrQuery, setStart) { solr_char_t *param_name = (solr_char_t *) "start"; COMPAT_ARG_SIZE_T param_name_len = sizeof("start")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setRows(int rows) Sets the rows parameter */ PHP_METHOD(SolrQuery, setRows) { solr_char_t *param_name = (solr_char_t *) "rows"; COMPAT_ARG_SIZE_T param_name_len = sizeof("rows")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addField(string fl) Adds another fl parameter */ PHP_METHOD(SolrQuery, addField) { solr_char_t *param_name = (solr_char_t *) "fl"; size_t param_name_len = sizeof("fl")-1; solr_char_t *param_value = NULL; size_t param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_simple_list_param(getThis(), param_name, param_name_len, param_value, param_value_len TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addSortField(string fl [, int sort_direction]) Adds another sort parameter */ PHP_METHOD(SolrQuery, addSortField) { solr_char_t *param_name = (solr_char_t *) "sort"; COMPAT_ARG_SIZE_T param_name_len = sizeof("sort")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; long int sort_direction = 1L; solr_sort_dir_t sort_order = SOLR_SORT_DIR_DESC; solr_char_t *avalue = NULL; COMPAT_ARG_SIZE_T avalue_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", ¶m_value, ¶m_value_len, &sort_direction) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } sort_order = (sort_direction < 0L || sort_direction > 1L) ? SOLR_SORT_DIR_DESC : (solr_sort_dir_t) sort_direction; avalue = (sort_order) ? "desc" : "asc"; avalue_length = solr_strlen(avalue); if (solr_add_arg_list_param(getThis(), param_name, param_name_len, param_value, param_value_len, avalue, avalue_length, ',', ' ' TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addFiterQuery(string fq) Adds another fq parameter */ PHP_METHOD(SolrQuery, addFilterQuery) { solr_char_t *param_name = (solr_char_t *) "fq"; COMPAT_ARG_SIZE_T param_name_len = sizeof("fq")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setShowDebugInfo(bool flag) Sets the debugQuery parameter */ PHP_METHOD(SolrQuery, setShowDebugInfo) { solr_char_t *param_name = (solr_char_t *) "debugQuery"; COMPAT_ARG_SIZE_T param_name_len = sizeof("debugQuery")-1; zend_bool show_debug_info = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &show_debug_info) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!show_debug_info) { solr_delete_solr_parameter(getThis(), param_name, param_name_len TSRMLS_CC); solr_return_solr_params_object(); return; } if (solr_set_normal_param(getThis(), param_name, param_name_len, "true", sizeof("true")-1) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error adding debugging info "); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setExplainOther(string explainOther) Sets the explainOther parameter */ PHP_METHOD(SolrQuery, setExplainOther) { solr_char_t *param_name = (solr_char_t *) "explainOther"; COMPAT_ARG_SIZE_T param_name_len = sizeof("explainOther")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTimeAllowed(int milliseconds) Sets the maximum time in milliseconds allowed for the query */ PHP_METHOD(SolrQuery, setTimeAllowed) { solr_char_t *param_name = (solr_char_t *) "timeAllowed"; COMPAT_ARG_SIZE_T param_name_len = sizeof("timeAllowed")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setOmitHeader(bool flag) Sets the omitHeader parameter */ PHP_METHOD(SolrQuery, setOmitHeader) { solr_char_t *param_name = (solr_char_t *) "omitHeader"; COMPAT_ARG_SIZE_T param_name_len = sizeof("omitHeader")-1; COMPAT_ARG_SIZE_T param_value_len = 0; zend_bool omit_header = 0; solr_char_t *omit_header_str = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &omit_header) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } omit_header_str = (omit_header)? "true" : "false"; param_value_len = solr_strlen(omit_header_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, omit_header_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, omit_header_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* }}} END OF CommonQueryParameters */ /* {{{ CoreQueryParameters */ /* {{{ proto SolrQuery SolrQuery::setEchoHandler(bool flag) Sets the echoHandler parameter */ PHP_METHOD(SolrQuery, setEchoHandler) { solr_char_t *param_name = (solr_char_t *) "echoHandler"; COMPAT_ARG_SIZE_T param_name_len = sizeof("echoHandler")-1; COMPAT_ARG_SIZE_T param_value_len = 0; zend_bool echo_handler = 0; solr_char_t *echo_handler_str = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &echo_handler) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } echo_handler_str = (echo_handler)? "true" : "false"; param_value_len = solr_strlen(echo_handler_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, echo_handler_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, echo_handler_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setEchoParams(string value) Sets the echoParams parameter */ PHP_METHOD(SolrQuery, setEchoParams) { solr_char_t *param_name = (solr_char_t *) "echoParams"; COMPAT_ARG_SIZE_T param_name_len = sizeof("echoParams")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* }}} END OF CoreQueryParameters */ /* {{{ SimpleFacetParameters */ /* {{{ proto SolrQuery SolrQuery::setFacet(bool value) Sets the facet parameter */ PHP_METHOD(SolrQuery, setFacet) { solr_char_t *param_name = (solr_char_t *) "facet"; COMPAT_ARG_SIZE_T param_name_len = sizeof("facet")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addFacetField(string value) Sets the facet.field parameter */ PHP_METHOD(SolrQuery, addFacetField) { solr_char_t *param_name = (solr_char_t *) "facet.field"; COMPAT_ARG_SIZE_T param_name_len = sizeof("facet.field")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addFacetQuery(string value) Adds another facet.query parameter */ PHP_METHOD(SolrQuery, addFacetQuery) { solr_char_t *param_name = (solr_char_t *) "facet.query"; COMPAT_ARG_SIZE_T param_name_len = sizeof("facet.query")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetPrefix(string value [, string field_override]) Sets the facet.prefix parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetPrefix) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.prefix"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetSort(int value [, string field_override]) Sets the facet.sort parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetSort) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; long int sort_type = 0L; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|s", &sort_type, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.sort"); param_value = ((sort_type)? "count" : "index"); param_value_len = solr_strlen(param_value); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetLimit(string value [, string field_override]) Sets the facet.limit parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetLimit) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.limit"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetOffset(string value [, string field_override]) Sets the facet.offset parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetOffset) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.offset"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetMinCount(string value [, string field_override]) Sets the facet.mincount parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetMinCount) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.mincount"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetMissing(bool value [, string field_override]) Sets the facet.missing parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetMissing) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; zend_bool bool_flag = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b|s", &bool_flag, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.missing"); param_value = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(param_value); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetMethod(string value [, string field_override]) Sets the facet.method parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetMethod) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.method"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetEnumCacheMinDefaultFrequency(string value [, string field_override]) Sets the facet.enum.cache.minDf parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetEnumCacheMinDefaultFrequency) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.enum.cache.minDf"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ Date facet parameters */ /* {{{ proto SolrQuery SolrQuery::addFacetDateField(string value) Adds another facet.date parameter. */ PHP_METHOD(SolrQuery, addFacetDateField) { solr_char_t *param_name = (solr_char_t *) "facet.date"; COMPAT_ARG_SIZE_T param_name_len = sizeof("facet.date")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetDateStart(string value [, string field_override]) Sets the facet.date.start parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetDateStart) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.date.start"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetDateEnd(string value [, string field_override]) Sets the facet.date.end parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetDateEnd) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.date.end"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetDateGap(string value [, string field_override]) Sets the facet.date.gap parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetDateGap) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.date.gap"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetDateHardEnd(bool value [, string field_override]) Sets the facet.date.hardend parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetDateHardEnd) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; zend_bool bool_flag = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b|s", &bool_flag, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.date.hardend"); param_value = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(param_value); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addFacetDateOther(string value [, string field_override]) Sets the facet.date.other parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, addFacetDateOther) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.date.other"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* }}} End of date facet parameters */ /* }}} End of SimpleFacetParameters */ /* {{{ SimpleGroupParameters */ /* {{{ proto SolrQuery SolrQuery::setGroup(bool value) Enable result grouping (group parameter) */ PHP_METHOD(SolrQuery, setGroup) { solr_char_t *param_name = (solr_char_t *) "group"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto bool SolrQuery::getGroup() Returns true if grouping is enabled */ PHP_METHOD(SolrQuery, getGroup) { solr_char_t *param_name = (solr_char_t *) "group"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addGroupField(string value) Adds a group.field parameter */ PHP_METHOD(SolrQuery, addGroupField) { solr_char_t *param_name = (solr_char_t *) "group.field"; int param_name_len = sizeof("group.field")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto string SolrQuery::getGroupFields() Returns all the group fields (group.field parameter values) */ PHP_METHOD(SolrQuery, getGroupFields) { solr_char_t *param_name = (solr_char_t *) "group.field"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.field")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addGroupFunction(string value) Adds a group function (group.func parameter) */ PHP_METHOD(SolrQuery, addGroupFunction) { solr_char_t *param_name = (solr_char_t *) "group.func"; int param_name_len = sizeof("group.func")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto string SolrQuery::getGroupFunctions() Returns all the group functions (group.func parameters) */ PHP_METHOD(SolrQuery, getGroupFunctions) { solr_char_t *param_name = (solr_char_t *) "group.func"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.func")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addGroupQuery(string value) Sets the group.query parameter */ PHP_METHOD(SolrQuery, addGroupQuery) { solr_char_t *param_name = (solr_char_t *) "group.query"; int param_name_len = sizeof("group.query")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto string SolrQuery::getGroupQueries() Returns all the group.query parameter values */ PHP_METHOD(SolrQuery, getGroupQueries) { solr_char_t *param_name = (solr_char_t *) "group.query"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.query")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupLimit(string value) Sets the group.limit parameter. */ PHP_METHOD(SolrQuery, setGroupLimit) { solr_char_t *param_name = (solr_char_t *) "group.limit"; int param_name_len = sizeof("group.limit")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto int SolrQuery::getGroupLimit() Returns the group.limit value */ PHP_METHOD(SolrQuery, getGroupLimit) { solr_char_t *param_name = (solr_char_t *) "group.limit"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.limit")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupOffset(int offset) Sets the group.offset parameter. */ PHP_METHOD(SolrQuery, setGroupOffset) { solr_char_t *param_name = (solr_char_t *) "group.offset"; int param_name_len = sizeof("group.offset")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto int SolrQuery::getGroupOffset() Returns the group.offset value */ PHP_METHOD(SolrQuery, getGroupOffset) { solr_char_t *param_name = (solr_char_t *) "group.offset"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.offset")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addGroupSortField(string sort[, integer direction]) Add a group sort field (group.sort parameter). */ PHP_METHOD(SolrQuery, addGroupSortField) { solr_char_t *param_name = (solr_char_t *) "group.sort"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.sort")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; long int sort_direction = 1L; solr_sort_dir_t sort_order = SOLR_SORT_DIR_DESC; solr_char_t *avalue = NULL; COMPAT_ARG_SIZE_T avalue_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", ¶m_value, ¶m_value_len, &sort_direction) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } sort_order = (sort_direction < 0L || sort_direction > 1L) ? SOLR_SORT_DIR_DESC : (solr_sort_dir_t) sort_direction; avalue = (sort_order) ? "desc" : "asc"; avalue_length = solr_strlen(avalue); if (solr_add_arg_list_param(getThis(), param_name, param_name_len, param_value, param_value_len, avalue, avalue_length, ',', ' ' TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto array SolrQuery::getGroupSortFields() Returns the group.sort value */ PHP_METHOD(SolrQuery, getGroupSortFields) { solr_char_t *param_name = (solr_char_t *) "group.sort"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.sort")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_arg_list_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupFormat(string value) Sets the group.format parameter. */ PHP_METHOD(SolrQuery, setGroupFormat) { solr_char_t *param_name = (solr_char_t *) "group.format"; int param_name_len = sizeof("group.format")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto string SolrQuery::getGroupFormat() Returns the group.format value */ PHP_METHOD(SolrQuery, getGroupFormat) { solr_char_t *param_name = (solr_char_t *) "group.format"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.format")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupMain(bool value) Sets the group.main parameter */ PHP_METHOD(SolrQuery, setGroupMain) { solr_char_t *param_name = (solr_char_t *) "group.main"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.main")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto bool SolrQuery::getGroupMain() Returns the group.main value */ PHP_METHOD(SolrQuery, getGroupMain) { solr_char_t *param_name = (solr_char_t *) "group.main"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.main")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupNGroups(bool value) Sets the group.ngroups parameter */ PHP_METHOD(SolrQuery, setGroupNGroups) { solr_char_t *param_name = (solr_char_t *) "group.ngroups"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.ngroups")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto bool SolrQuery::getGroupNGroups() Returns the group.ngroups value */ PHP_METHOD(SolrQuery, getGroupNGroups) { solr_char_t *param_name = (solr_char_t *) "group.ngroups"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.ngroups")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupTruncate(bool value) Sets the group.truncate parameter */ PHP_METHOD(SolrQuery, setGroupTruncate) { solr_char_t *param_name = (solr_char_t *) "group.truncate"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.truncate")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto bool SolrQuery::getGroupTruncate() Returns the group.truncate value */ PHP_METHOD(SolrQuery, getGroupTruncate) { solr_char_t *param_name = (solr_char_t *) "group.truncate"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.truncate")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupFacet(bool value) Sets the group.facet parameter */ PHP_METHOD(SolrQuery, setGroupFacet) { solr_char_t *param_name = (solr_char_t *) "group.facet"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.facet")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto bool SolrQuery::getGroupFacet() Returns the group.facet value */ PHP_METHOD(SolrQuery, getGroupFacet) { solr_char_t *param_name = (solr_char_t *) "group.facet"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.facet")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupCachePercent(int value) sets the group cache percent group.cache.percent value */ PHP_METHOD(SolrQuery, setGroupCachePercent) { solr_char_t *param_name = (solr_char_t *) "group.cache.percent"; COMPAT_ARG_SIZE_T param_name_len = sizeof ("group.cache.percent")-1; long cache_pct = 0; solr_char_t pval[4]; int pval_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &cache_pct)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } if (cache_pct < 0 || cache_pct > 100) { solr_throw_exception(solr_ce_SolrIllegalArgumentException, "Group cache percent must be between 0 and 100", SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC); RETURN_NULL(); } snprintf (pval, sizeof(pval), "%ld", cache_pct); pval_len = strlen(pval); if (solr_add_or_set_normal_param(getThis(), param_name, param_name_len, pval, pval_len, 0 TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, pval); efree(pval); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto int SolrQuery::getGroupCachePercent() Gets the group cache percent group.cache.percent value */ PHP_METHOD(SolrQuery, getGroupCachePercent) { solr_char_t *param_name = (solr_char_t *) "group.cache.percent"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.cache.percent")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* }}} End of SimpleGroupParameters */ /* {{{ proto SolrQuery SolrQuery::collapse(SolrCollapseFunction collapseFunction) Collapse a Solr Query */ PHP_METHOD(SolrQuery, collapse) { solr_char_t *param_name = (solr_char_t *) "fq"; COMPAT_ARG_SIZE_T param_name_len = sizeof("fq")-1; zval *collapse_func_obj, *obj_ref; solr_function_t *collapse_func; solr_string_t *buffer = NULL; zend_string *field_str = zend_string_init("field", sizeof("field"), SOLR_FUNCTIONS_PERSISTENT); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &obj_ref) == FAILURE) { RETURN_NULL(); } if (Z_TYPE_P(obj_ref) == IS_REFERENCE) { collapse_func_obj = Z_REFVAL_P(obj_ref); } else { collapse_func_obj = obj_ref; } if(solr_fetch_function_entry(collapse_func_obj, &collapse_func TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Internal Error Unable to fetch function from functions global"); RETURN_NULL(); } /* validate */ if (!zend_hash_exists(collapse_func->params, field_str)) { solr_throw_exception_ex(solr_ce_SolrMissingMandatoryParameterException,SOLR_ERROR_4100 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_4100_MSG, "field"); } buffer = (solr_string_t *)pemalloc(sizeof(solr_string_t), SOLR_STRING_PERSISTENT); memset(buffer, 0, sizeof(solr_string_t)); solr_solrfunc_to_string(collapse_func, &buffer); if (solr_add_or_set_normal_param(getThis(), param_name, param_name_len, buffer->str, buffer->len, 1 TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, buffer->str); } solr_string_free(buffer); pefree(buffer, SOLR_STRING_PERSISTENT); zend_string_release(field_str); solr_return_solr_params_object(); } /* }}} */ /* {{{ Expand Parameters */ /* {{{ proto SolrQuery SolrQuery::setExpand(bool value) Sets the expand parameter. This enables or disables group expanding. */ PHP_METHOD(SolrQuery, setExpand) { solr_char_t *param_name = (solr_char_t *) "expand"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto bool SolrQuery::getExpand() Returns true if group expanding is enabled */ PHP_METHOD(SolrQuery, getExpand) { solr_char_t *param_name = (solr_char_t *) "expand"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addExpandSortField(string sort[, integer direction]) Orders the documents within the expanded groups (expand.sort parameter). */ PHP_METHOD(SolrQuery, addExpandSortField) { solr_char_t *param_name = (solr_char_t *) "expand.sort"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand.sort")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; long int sort_direction = 1L; solr_sort_dir_t sort_order = SOLR_SORT_DIR_DESC; solr_char_t *avalue = NULL; COMPAT_ARG_SIZE_T avalue_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", ¶m_value, ¶m_value_len, &sort_direction) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } sort_order = (sort_direction < 0L || sort_direction > 1L) ? SOLR_SORT_DIR_DESC : (solr_sort_dir_t) sort_direction; avalue = (sort_order) ? "desc" : "asc"; avalue_length = solr_strlen(avalue); if (solr_add_arg_list_param(getThis(), param_name, param_name_len, param_value, param_value_len, avalue, avalue_length, ',', ' ' TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeExpandSortField(string field) Removes an expand sort field from the expand.sort parameter. */ PHP_METHOD(SolrQuery, removeExpandSortField) { solr_char_t *pname = (solr_char_t *) "expand.sort"; int pname_length = sizeof("expand.sort")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value(getThis(), pname, pname_length, param_value, param_value_len TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto string SolrQuery::getExpandSortFields() returns an array of fields */ PHP_METHOD(SolrQuery, getExpandSortFields) { solr_char_t *param_name = (solr_char_t *) "expand.sort"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand.sort")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setExpandRows(int rows) Sets the number of rows to display in each group (expand.rows). Server Default 5 */ PHP_METHOD(SolrQuery, setExpandRows) { solr_char_t *param_name = (solr_char_t *) "expand.rows"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand.rows")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto int SolrQuery::getExpandRows() Returns The number of rows to display in each group (expand.rows) */ PHP_METHOD(SolrQuery, getExpandRows) { solr_char_t *param_name = (solr_char_t *) "expand.rows"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand.rows")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setExpandQuery(string q) Sets the expand.q parameter. Overrides the main q parameter, determines which documents to include in the main group. */ PHP_METHOD(SolrQuery, setExpandQuery) { solr_char_t *param_name = (solr_char_t *) "expand.q"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand.q")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto string SolrQuery::getExpandQuery() Returns the expand query expand.q parameter */ PHP_METHOD(SolrQuery, getExpandQuery) { solr_char_t *param_name = (solr_char_t *) "expand.q"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand.q")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addExpandFilterQuery(string fq) Overrides main fq's, determines which documents to include in the main group. */ PHP_METHOD(SolrQuery, addExpandFilterQuery) { solr_char_t *param_name = (solr_char_t *) "expand.fq"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand.fq")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeExpandFilterQuery(string fq) Removes an expand filter query. */ PHP_METHOD(SolrQuery, removeExpandFilterQuery) { solr_char_t *pname = (solr_char_t *) "expand.fq"; int pname_length = sizeof("expand.fq")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_len TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto array SolrQuery::getExpandFilterQueries() Returns the expand filter queries */ PHP_METHOD(SolrQuery, getExpandFilterQueries) { solr_char_t *param_name = (solr_char_t *) "expand.fq"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand.fq")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* }}} */ /* {{{ HighlightingParameters */ /* {{{ proto SolrQuery SolrQuery::setHighlight(bool value) Sets the hl parameter. This enables or disables highlighting. */ PHP_METHOD(SolrQuery, setHighlight) { solr_char_t *param_name = (solr_char_t *) "hl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addHighlightField(string value) Adds another hl.fl parameter. */ PHP_METHOD(SolrQuery, addHighlightField) { solr_char_t *list_param_name = (solr_char_t *) "hl.fl"; COMPAT_ARG_SIZE_T list_param_name_len = sizeof("hl.fl")-1; solr_char_t *list_param_value = NULL; COMPAT_ARG_SIZE_T list_param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &list_param_value, &list_param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_simple_list_param(getThis(), list_param_name, list_param_name_len, list_param_value, list_param_value_len TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add param value %s to %s list ", list_param_value, list_param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightSnippets(string value [, string field_override]) Sets the hl.snippets parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightSnippets) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.snippets"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightFragsize(string value [, string field_override]) Sets the hl.fragsize parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightFragsize) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.fragsize"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightMergeContiguous(bool flag [, string field_override]) Sets the hl.mergeContiguous parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightMergeContiguous) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; zend_bool bool_flag = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b|s", &bool_flag, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.mergeContiguous"); param_value = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(param_value); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightRequireFieldMatch(bool flag) Sets the hl.requireFieldMatch. */ PHP_METHOD(SolrQuery, setHighlightRequireFieldMatch) { solr_char_t *param_name = (solr_char_t *) "hl.requireFieldMatch"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.requireFieldMatch")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightMaxAnalyzedChars(string value) Sets the hl.maxAnalyzedChars parameter */ PHP_METHOD(SolrQuery, setHighlightMaxAnalyzedChars) { solr_char_t *param_name = (solr_char_t *) "hl.maxAnalyzedChars"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.maxAnalyzedChars")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightAlternateField(string value [, string field_override]) Sets the hl.alternateField parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightAlternateField) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.alternateField"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightMaxAlternateFieldLength(string value [, string field_override]) Sets the hl.maxAlternateFieldLength parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightMaxAlternateFieldLength) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.maxAlternateFieldLength"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightFormatter(string value [, string field_override]) Sets the hl.formatter parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightFormatter) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = "simple"; COMPAT_ARG_SIZE_T param_value_len = sizeof("simple")-1; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.formatter"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightSimplePre(string value [, string field_override]) Sets the hl.simple.pre parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightSimplePre) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = ""; COMPAT_ARG_SIZE_T param_value_len = sizeof("")-1; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.simple.pre"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightSimplePost(string value [, string field_override]) Sets the hl.simple.post parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightSimplePost) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = ""; COMPAT_ARG_SIZE_T param_value_len = sizeof("")-1; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.simple.post"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightFragmenter(string value [, string field_override]) Sets the hl.fragmenter parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightFragmenter) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.fragmenter"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightUsePhraseHighlighter(bool flag) Sets the hl.usePhraseHighlighter parameter. */ PHP_METHOD(SolrQuery, setHighlightUsePhraseHighlighter) { solr_char_t *param_name = (solr_char_t *) "hl.usePhraseHighlighter"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.usePhraseHighlighter")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightHighlightMultiTerm(bool flag) Sets the hl.highlightMultiTerm parameter. */ PHP_METHOD(SolrQuery, setHighlightHighlightMultiTerm) { solr_char_t *param_name = (solr_char_t *) "hl.highlightMultiTerm"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.highlightMultiTerm")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightRegexSlop(string value) Sets the hl.regex.slop parameter. */ PHP_METHOD(SolrQuery, setHighlightRegexSlop) { solr_char_t *param_name = (solr_char_t *) "hl.regex.slop"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.regex.slop")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightRegexPattern(string value) Sets the hl.regex.pattern parameter. */ PHP_METHOD(SolrQuery, setHighlightRegexPattern) { solr_char_t *param_name = (solr_char_t *) "hl.regex.pattern"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.regex.pattern")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightRegexMaxAnalyzedChars(string value) Sets the hl.regex.maxAnalyzedChars parameter. */ PHP_METHOD(SolrQuery, setHighlightRegexMaxAnalyzedChars) { solr_char_t *param_name = (solr_char_t *) "hl.regex.maxAnalyzedChars"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.regex.maxAnalyzedChars")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* }}} End of HighlightingParameters */ /* {{{ StatsComponent */ /* {{{ proto SolrQuery SolrQuery::setStats(bool flag) Sets the stats parameter. Enables or disables stats */ PHP_METHOD(SolrQuery, setStats) { solr_char_t *param_name = (solr_char_t *) "stats"; COMPAT_ARG_SIZE_T param_name_len = sizeof("stats")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addStatsField(string value) Adds another stats.field parameter. */ PHP_METHOD(SolrQuery, addStatsField) { solr_char_t *param_name = (solr_char_t *) "stats.field"; COMPAT_ARG_SIZE_T param_name_len = sizeof("stats.field")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error adding parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addStatsFacet(string value) Adds another stats.facet parameter. */ PHP_METHOD(SolrQuery, addStatsFacet) { solr_char_t *param_name = (solr_char_t *) "stats.facet"; COMPAT_ARG_SIZE_T param_name_len = sizeof("stats.facet")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error adding parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* }}} End of StatsComponent */ /* {{{ MoreLikeThis */ /* {{{ proto SolrQuery SolrQuery::setMlt(bool flag) Sets the mlt parameter. Enables or disables the moreLikeThis component */ PHP_METHOD(SolrQuery, setMlt) { solr_char_t *param_name = (solr_char_t *) "mlt"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltCount(string value) Sets the mlt.count parameter. */ PHP_METHOD(SolrQuery, setMltCount) { solr_char_t *param_name = (solr_char_t *) "mlt.count"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.count")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addMltField(string field) Adds another field name to the mlt.fl parameter. */ PHP_METHOD(SolrQuery, addMltField) { solr_char_t *list_param_name = (solr_char_t *) "mlt.fl"; COMPAT_ARG_SIZE_T list_param_name_len = sizeof("mlt.fl")-1; solr_char_t *list_param_value = NULL; COMPAT_ARG_SIZE_T list_param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &list_param_value, &list_param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_simple_list_param(getThis(), list_param_name, list_param_name_len, list_param_value, list_param_value_len TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to add param value %s to %s list ", list_param_value, list_param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addMltQueryField(string value, string boost) Adds another query field and boost value to the mlt.qf parameter. */ PHP_METHOD(SolrQuery, addMltQueryField) { solr_char_t *param_name = (solr_char_t *) "mlt.qf"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.qf")-1; solr_char_t *query_field = NULL; COMPAT_ARG_SIZE_T query_field_length = 0; solr_char_t *boost_value = "1.0"; COMPAT_ARG_SIZE_T boost_value_length = sizeof("1.0"); /* TODO: make boost optional parameter. */ /* If boost is not sent, then the index time boost is used */ /* This will involve re-doing all the arg_list functions to allow optional args. */ /* Temporary solution is to use SolrQuery::add("mlt.qf", "value"). This should be documented. */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &query_field, &query_field_length, &boost_value, &boost_value_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_arg_list_param(getThis(), param_name, param_name_len, query_field, query_field_length, boost_value, boost_value_length, ' ', '^' TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltMinTermFrequency(string value) Sets the mlt.mintf parameter. */ PHP_METHOD(SolrQuery, setMltMinTermFrequency) { solr_char_t *param_name = (solr_char_t *) "mlt.mintf"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.mintf")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltMinDocFrequency(string value) Sets the mlt.mindf parameter. */ PHP_METHOD(SolrQuery, setMltMinDocFrequency) { solr_char_t *param_name = (solr_char_t *) "mlt.mindf"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.mindf")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltMinWordLength(string value) Sets the mlt.minwl parameter. */ PHP_METHOD(SolrQuery, setMltMinWordLength) { solr_char_t *param_name = (solr_char_t *) "mlt.minwl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.minwl")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltMaxWordLength(string value) Sets the mlt.maxwl parameter. */ PHP_METHOD(SolrQuery, setMltMaxWordLength) { solr_char_t *param_name = (solr_char_t *) "mlt.maxwl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.maxwl")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltMaxNumTokens(string value) Sets the mlt.maxntp parameter. */ PHP_METHOD(SolrQuery, setMltMaxNumTokens) { solr_char_t *param_name = (solr_char_t *) "mlt.maxntp"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.maxntp")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltMaxNumQueryTerms(string value) Sets the mlt.maxqt parameter. */ PHP_METHOD(SolrQuery, setMltMaxNumQueryTerms) { solr_char_t *param_name = (solr_char_t *) "mlt.maxqt"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.maxqt")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltBoost(bool flag) Sets the mlt.boost parameter. */ PHP_METHOD(SolrQuery, setMltBoost) { solr_char_t *param_name = (solr_char_t *) "mlt.boost"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.boost")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* }}} End of MoreLikeThis */ /* {{{ TermsComponent */ /* {{{ proto SolrQuery SolrQuery::setTerms(bool flag) Sets the terms parameter. This flag enables or disables the TermsComponent */ PHP_METHOD(SolrQuery, setTerms) { solr_char_t *param_name = (solr_char_t *) "terms"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsField(string field) Sets the terms.fl parameter. */ PHP_METHOD(SolrQuery, setTermsField) { solr_char_t *param_name = (solr_char_t *) "terms.fl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.fl")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsLowerBound(string value) Sets the terms.lower parameter. */ PHP_METHOD(SolrQuery, setTermsLowerBound) { solr_char_t *param_name = (solr_char_t *) "terms.lower"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.lower")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsUpperBound(string value) Sets the terms.upper parameter. */ PHP_METHOD(SolrQuery, setTermsUpperBound) { solr_char_t *param_name = (solr_char_t *) "terms.upper"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.upper")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsIncludeLowerBound(string value) Sets the terms.lower.incl parameter. */ PHP_METHOD(SolrQuery, setTermsIncludeLowerBound) { solr_char_t *param_name = (solr_char_t *) "terms.lower.incl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.lower.incl")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsIncludeUpperBound(string value) Sets the terms.upper.incl parameter. */ PHP_METHOD(SolrQuery, setTermsIncludeUpperBound) { solr_char_t *param_name = (solr_char_t *) "terms.upper.incl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.upper.incl")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsMinCount(string value) Sets the terms.mincount parameter. */ PHP_METHOD(SolrQuery, setTermsMinCount) { solr_char_t *param_name = (solr_char_t *) "terms.mincount"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.mincount")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsMaxCount(string value) Sets the terms.maxcount parameter. */ PHP_METHOD(SolrQuery, setTermsMaxCount) { solr_char_t *param_name = (solr_char_t *) "terms.maxcount"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.maxcount")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsPrefix(string value) Sets the terms.prefix parameter. */ PHP_METHOD(SolrQuery, setTermsPrefix) { solr_char_t *param_name = (solr_char_t *) "terms.prefix"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.prefix")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsLimit(string value) Sets the terms.limit parameter. */ PHP_METHOD(SolrQuery, setTermsLimit) { solr_char_t *param_name = (solr_char_t *) "terms.limit"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.limit")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsReturnRaw(bool flag) Sets the terms.raw parameter. */ PHP_METHOD(SolrQuery, setTermsReturnRaw) { solr_char_t *param_name = (solr_char_t *) "terms.raw"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.raw")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &bool_flag) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsSort(int sort) Sets the terms.sort parameter. */ PHP_METHOD(SolrQuery, setTermsSort) { solr_char_t *param_name = (solr_char_t *) "terms.sort"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.sort")-1; long int sort_type = 0L; solr_char_t *sort_type_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &sort_type) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter"); RETURN_NULL(); } sort_type_str = ((sort_type)? "count" : "index"); param_value_len = solr_strlen(sort_type_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, sort_type_str, param_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error setting parameter %s=%s ", param_name, sort_type_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* }}} End of TermsComponent */ /* {{{ Value removal methods */ /* {{{ proto SolrQuery SolrQuery::removeField(string fl) Removes a field from the fl parameter */ PHP_METHOD(SolrQuery, removeField) { solr_char_t *pname = (solr_char_t *) "fl"; int pname_length = sizeof("fl")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_simple_list_param_value(getThis(), pname, pname_length, param_value, param_value_len TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeSortField(string fl) Removes a sort field from the sort parameter. */ PHP_METHOD(SolrQuery, removeSortField) { solr_char_t *pname = (solr_char_t *) "sort"; int pname_length = sizeof("sort")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value(getThis(), pname, pname_length, param_value, param_value_len TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeFilterQuery(string fq) Removes one of the fq parameter. */ PHP_METHOD(SolrQuery, removeFilterQuery) { solr_char_t *pname = (solr_char_t *) "fq"; int pname_length = sizeof("fq")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_len TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeFacetField(string field) Removes one of fields from the facet.field parameter. */ PHP_METHOD(SolrQuery, removeFacetField) { solr_char_t *pname = (solr_char_t *) "facet.field"; int pname_length = sizeof("facet.field")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_len TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeFacetQuery(string facet_query) Removes one of the facet.query parameters. */ PHP_METHOD(SolrQuery, removeFacetQuery) { solr_char_t *pname = (solr_char_t *) "facet.query"; int pname_length = sizeof("facet.query")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_len TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeFacetDateField(string date_field) Removes one of the facet.date parameters. */ PHP_METHOD(SolrQuery, removeFacetDateField) { solr_char_t *pname = (solr_char_t *) "facet.date"; int pname_length = sizeof("facet.date")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_len TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeFacetDateOther(string value [, string field_override]) Removes one of the facet.date.other parameters. Also accepts an optional field override. */ PHP_METHOD(SolrQuery, removeFacetDateOther) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.date.other"); solr_delete_normal_param_value(getThis(), fbuf.str, fbuf.len, param_value, param_value_len TSRMLS_CC); solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeHighlightField(string field) Removes one of the fields from the hl.fl parameter. */ PHP_METHOD(SolrQuery, removeHighlightField) { solr_char_t *pname = (solr_char_t *) "hl.fl"; int pname_length = sizeof("hl.fl")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_simple_list_param_value(getThis(), pname, pname_length, param_value, param_value_len TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeStatsField(string field) Removes one of the stats.field parameters. */ PHP_METHOD(SolrQuery, removeStatsField) { solr_char_t *pname = (solr_char_t *) "stats.field"; int pname_length = sizeof("stats.field")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_len TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeStatsFacet(string value) Removes one of the stats.facet parameters. */ PHP_METHOD(SolrQuery, removeStatsFacet) { solr_char_t *pname = (solr_char_t *) "stats.facet"; int pname_length = sizeof("stats.facet")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_len TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeMltField(string field) Removes one of the fields from the mlt.fl parameter. */ PHP_METHOD(SolrQuery, removeMltField) { solr_char_t *pname = (solr_char_t *) "mlt.fl"; int pname_length = sizeof("mlt.fl")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_simple_list_param_value(getThis(), pname, pname_length, param_value, param_value_len TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeMltQueryField(string field) Removes one of the values from the mlt.qf parameter. */ PHP_METHOD(SolrQuery, removeMltQueryField) { solr_char_t *pname = (solr_char_t *) "mlt.qf"; int pname_length = sizeof("mlt.qf")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value(getThis(), pname, pname_length, param_value, param_value_len TSRMLS_CC); solr_return_solr_params_object(); } /* }}} */ /* }}} End of Value removal methods */ /* {{{ Begin getter methods */ /* {{{ proto string SolrQuery::getQuery() Returns the query */ PHP_METHOD(SolrQuery, getQuery) { solr_char_t *param_name = (solr_char_t *) "q"; COMPAT_ARG_SIZE_T param_name_len = sizeof("q")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getStart() Returns the start parameter */ PHP_METHOD(SolrQuery, getStart) { solr_char_t *param_name = (solr_char_t *) "start"; COMPAT_ARG_SIZE_T param_name_len = sizeof("start")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getRows() Returns the rows parameter */ PHP_METHOD(SolrQuery, getRows) { solr_char_t *param_name = (solr_char_t *) "rows"; COMPAT_ARG_SIZE_T param_name_len = sizeof("rows")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto array SolrQuery::getFields() Returns the fields */ PHP_METHOD(SolrQuery, getFields) { solr_char_t *param_name = (solr_char_t *) "fl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("fl")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_simple_list_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto array SolrQuery::getSortFields() Returns all the sort fields */ PHP_METHOD(SolrQuery, getSortFields) { solr_char_t *param_name = (solr_char_t *) "sort"; COMPAT_ARG_SIZE_T param_name_len = sizeof("sort")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_arg_list_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getFilterQueries() Returns all the filter queries */ PHP_METHOD(SolrQuery, getFilterQueries) { solr_char_t *param_name = (solr_char_t *) "fq"; COMPAT_ARG_SIZE_T param_name_len = sizeof("fq")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getTimeAllowed() Returns the maximum time in milliseconds allowed for the search query */ PHP_METHOD(SolrQuery, getTimeAllowed) { solr_char_t *param_name = (solr_char_t *) "timeAllowed"; COMPAT_ARG_SIZE_T param_name_len = sizeof("timeAllowed")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getFacet() Returns true is faceting is enabled */ PHP_METHOD(SolrQuery, getFacet) { solr_char_t *param_name = (solr_char_t *) "facet"; COMPAT_ARG_SIZE_T param_name_len = sizeof("facet")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getFacetFields() Returns all the facet fields */ PHP_METHOD(SolrQuery, getFacetFields) { solr_char_t *param_name = (solr_char_t *) "facet.field"; COMPAT_ARG_SIZE_T param_name_len = sizeof("facet.field")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getFacetQueries() Returns all the facet queries */ PHP_METHOD(SolrQuery, getFacetQueries) { solr_char_t *param_name = (solr_char_t *) "facet.query"; COMPAT_ARG_SIZE_T param_name_len = sizeof("facet.query")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getFacetPrefix([string field_override]) Returns the prefix for the facet */ PHP_METHOD(SolrQuery, getFacetPrefix) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.prefix"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto int SolrQuery::getFacetSort([string field_override]) Returns the facet sort state (for the field, if it was overridden) */ PHP_METHOD(SolrQuery, getFacetSort) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.sort"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_sort_type(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto int SolrQuery::getFacetLimit([string field_override]) Returns the maximum number of items for the facet */ PHP_METHOD(SolrQuery, getFacetLimit) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.limit"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_integer(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto int SolrQuery::getFacetOffset([string field_override]) Returns the offset into the list of constraints */ PHP_METHOD(SolrQuery, getFacetOffset) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.offset"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_integer(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto int SolrQuery::getFacetMinCount([string field_override]) Returns the minimum count for the facet */ PHP_METHOD(SolrQuery, getFacetMinCount) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.mincount"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_integer(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto bool SolrQuery::getFacetMissing([string field_override]) Returns the facet.missing parameter */ PHP_METHOD(SolrQuery, getFacetMissing) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.missing"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_boolean(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getFacetMethod([string field_override]) Returns the facet.method parameter */ PHP_METHOD(SolrQuery, getFacetMethod) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.method"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto array SolrQuery::getFacetDateFields() Returns all the facet.date fields */ PHP_METHOD(SolrQuery, getFacetDateFields) { solr_char_t *param_name = (solr_char_t *) "facet.date"; COMPAT_ARG_SIZE_T param_name_len = sizeof("facet.date")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getFacetDateStart([string field_override]) Returns the facet.date.start parameter */ PHP_METHOD(SolrQuery, getFacetDateStart) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.date.start"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getFacetDateEnd([string field_override]) Returns the facet.date.end parameter */ PHP_METHOD(SolrQuery, getFacetDateEnd) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.date.end"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getFacetDateGap([string field_override]) Returns the facet.date.gap */ PHP_METHOD(SolrQuery, getFacetDateGap) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.date.gap"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto bool SolrQuery::getFacetDateHardEnd([string field_override]) Returns the facet.date.hardend parameter */ PHP_METHOD(SolrQuery, getFacetDateHardEnd) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.date.hardend"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_boolean(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getFacetDateOther([string field_override]) Returns the facet.date.other parameter */ PHP_METHOD(SolrQuery, getFacetDateOther) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.date.other"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { array_init(return_value); solr_normal_param_value_display(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto bool SolrQuery::getHighlight() Returns the state of the hl parameter */ PHP_METHOD(SolrQuery, getHighlight) { solr_char_t *param_name = (solr_char_t *) "hl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto array SolrQuery::getHighlightFields() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightFields) { solr_char_t *param_name = (solr_char_t *) "hl.fl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.fl")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_simple_list_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getHighlightSnippets([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightSnippets) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.snippets"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_integer(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto int SolrQuery::getHighlightFragsize([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightFragsize) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.fragsize"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_integer(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto bool SolrQuery::getHighlightMergeContiguous([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightMergeContiguous) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.mergeContiguous"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_boolean(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto bool SolrQuery::getHighlightRequireFieldMatch() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightRequireFieldMatch) { solr_char_t *param_name = (solr_char_t *) "hl.requireFieldMatch"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.requireFieldMatch")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getHighlightMaxAnalyzedChars() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightMaxAnalyzedChars) { solr_char_t *param_name = (solr_char_t *) "hl.maxAnalyzedChars"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.maxAnalyzedChars")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getHighlightAlternateField([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightAlternateField) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.alternateField"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto int SolrQuery::getHighlightMaxAlternateFieldLength([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightMaxAlternateFieldLength) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.maxAlternateFieldLength"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_integer(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getHighlightFormatter([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightFormatter) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.formatter"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getHighlightSimplePre([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightSimplePre) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.simple.pre"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getHighlightSimplePost([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightSimplePost) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.simple.post"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getHighlightFragmenter([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightFragmenter) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.fragmenter"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto bool SolrQuery::getHighlightUsePhraseHighlighter() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightUsePhraseHighlighter) { solr_char_t *param_name = (solr_char_t *) "hl.usePhraseHighlighter"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.usePhraseHighlighter")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getHighlightHighlightMultiTerm() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightHighlightMultiTerm) { solr_char_t *param_name = (solr_char_t *) "hl.highlightMultiTerm"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.highlightMultiTerm")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto float SolrQuery::getHighlightRegexSlop() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightRegexSlop) { solr_char_t *param_name = (solr_char_t *) "hl.regex.slop"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.regex.slop")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_double(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getHighlightRegexPattern() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightRegexPattern) { solr_char_t *param_name = (solr_char_t *) "hl.regex.pattern"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.regex.pattern")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getHighlightRegexMaxAnalyzedChars() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightRegexMaxAnalyzedChars) { solr_char_t *param_name = (solr_char_t *) "hl.regex.maxAnalyzedChars"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.regex.maxAnalyzedChars")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getStats() Returns the status of the stats parameter */ PHP_METHOD(SolrQuery, getStats) { solr_char_t *param_name = (solr_char_t *) "stats"; COMPAT_ARG_SIZE_T param_name_len = sizeof("stats")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto array SolrQuery::getStatsFields() Returns the stats.field parameters */ PHP_METHOD(SolrQuery, getStatsFields) { solr_char_t *param_name = (solr_char_t *) "stats.field"; COMPAT_ARG_SIZE_T param_name_len = sizeof("stats.field")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getStatsFacets() Returns all the stats facets */ PHP_METHOD(SolrQuery, getStatsFacets) { solr_char_t *param_name = (solr_char_t *) "stats.facet"; COMPAT_ARG_SIZE_T param_name_len = sizeof("stats.facet")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getMlt() Returns the parameter */ PHP_METHOD(SolrQuery, getMlt) { solr_char_t *param_name = (solr_char_t *) "mlt"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltCount() Returns the parameter */ PHP_METHOD(SolrQuery, getMltCount) { solr_char_t *param_name = (solr_char_t *) "mlt.count"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.count")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto array SolrQuery::getMltFields() Returns the parameter */ PHP_METHOD(SolrQuery, getMltFields) { solr_char_t *param_name = (solr_char_t *) "mlt.fl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.fl")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_simple_list_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto array SolrQuery::getMltQueryFields() Returns the parameter */ PHP_METHOD(SolrQuery, getMltQueryFields) { solr_char_t *param_name = (solr_char_t *) "mlt.qf"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.qf")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_arg_list_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltMinTermFrequency() Returns the parameter */ PHP_METHOD(SolrQuery, getMltMinTermFrequency) { solr_char_t *param_name = (solr_char_t *) "mlt.mintf"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.mintf")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltMinDocFrequency() Returns the parameter */ PHP_METHOD(SolrQuery, getMltMinDocFrequency) { solr_char_t *param_name = (solr_char_t *) "mlt.mindf"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.mindf")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltMinWordLength() Returns the parameter */ PHP_METHOD(SolrQuery, getMltMinWordLength) { solr_char_t *param_name = (solr_char_t *) "mlt.minwl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.minwl")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltMaxWordLength() Returns the parameter */ PHP_METHOD(SolrQuery, getMltMaxWordLength) { solr_char_t *param_name = (solr_char_t *) "mlt.maxwl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.maxwl")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltMaxNumTokens() Returns the parameter */ PHP_METHOD(SolrQuery, getMltMaxNumTokens) { solr_char_t *param_name = (solr_char_t *) "mlt.maxntp"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.maxntp")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltMaxNumQueryTerms() Returns the parameter */ PHP_METHOD(SolrQuery, getMltMaxNumQueryTerms) { solr_char_t *param_name = (solr_char_t *) "mlt.maxqt"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.maxqt")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getMltBoost() Returns the parameter */ PHP_METHOD(SolrQuery, getMltBoost) { solr_char_t *param_name = (solr_char_t *) "mlt.boost"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.boost")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getTerms() Returns the parameter */ PHP_METHOD(SolrQuery, getTerms) { solr_char_t *param_name = (solr_char_t *) "terms"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getTermsField() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsField) { solr_char_t *param_name = (solr_char_t *) "terms.fl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.fl")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getTermsLowerBound() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsLowerBound) { solr_char_t *param_name = (solr_char_t *) "terms.lower"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.lower")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getTermsUpperBound() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsUpperBound) { solr_char_t *param_name = (solr_char_t *) "terms.upper"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.upper")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getTermsIncludeLowerBound() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsIncludeLowerBound) { solr_char_t *param_name = (solr_char_t *) "terms.lower.incl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.lower.incl")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getTermsIncludeUpperBound() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsIncludeUpperBound) { solr_char_t *param_name = (solr_char_t *) "terms.upper.incl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.upper.incl")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getTermsMinCount() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsMinCount) { solr_char_t *param_name = (solr_char_t *) "terms.mincount"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.mincount")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getTermsMaxCount() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsMaxCount) { solr_char_t *param_name = (solr_char_t *) "terms.maxcount"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.maxcount")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getTermsPrefix() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsPrefix) { solr_char_t *param_name = (solr_char_t *) "terms.prefix"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.prefix")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getTermsLimit() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsLimit) { solr_char_t *param_name = (solr_char_t *) "terms.limit"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.limit")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getTermsReturnRaw() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsReturnRaw) { solr_char_t *param_name = (solr_char_t *) "terms.raw"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.raw")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getTermsSort() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsSort) { solr_char_t *param_name = (solr_char_t *) "terms.sort"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.sort")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param TSRMLS_CC) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_sort_type(solr_param, return_value); } /* }}} */ /* }}} End of getter methods */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/php_solr_response.c000066400000000000000000000270641374041537100227310ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ Macro for extracting property values using string constants */ #define solr_read_response_object_property(objptr, name, silent, rv) zend_read_property(Z_OBJCE_P(objptr), objptr, name, sizeof(name)-1, silent, rv) /* }}} */ /* {{{ proto int SolrResponse::getHttpStatus(void) Returns the value of the http_status property. */ PHP_METHOD(SolrResponse, getHttpStatus) { zend_bool silent = 1; zval rv; zval *objptr = getThis(); zval *http_status = NULL; http_status = solr_read_response_object_property(objptr, "http_status", silent, &rv); RETURN_LONG(Z_LVAL_P(http_status)); } /* }}} */ /* {{{ proto string SolrResponse::getHttpStatusMessage(void) Returns the http_status_message property. */ PHP_METHOD(SolrResponse, getHttpStatusMessage) { zend_bool silent = 1; zval rv; zval *objptr = getThis(); zval *http_status_message = NULL; http_status_message = solr_read_response_object_property(objptr, "http_status_message", silent, &rv); RETURN_STRINGL(Z_STRVAL_P(http_status_message), Z_STRLEN_P(http_status_message)); } /* }}} */ /* {{{ proto bool SolrResponse::success(void) Returns whether the request was successful or not. */ PHP_METHOD(SolrResponse, success) { zend_bool silent = 1; zval rv; zval *objptr = getThis(); zval *success = NULL; success = solr_read_response_object_property(objptr, "success", silent, &rv); RETURN_ZVAL(success, 0, 0); } /* }}} */ /* {{{ proto string SolrResponse::getRequestUrl(void) Returns the URL used for the request. */ PHP_METHOD(SolrResponse, getRequestUrl) { zend_bool silent = 1; zval rv; zval *objptr = getThis(); zval *prop = NULL; prop = solr_read_response_object_property(objptr, "http_request_url", silent, &rv); RETURN_STRINGL(Z_STRVAL_P(prop), Z_STRLEN_P(prop)); } /* }}} */ /* {{{ proto string SolrResponse::getRawRequestHeaders(void) Returns the raw http request headers sent to the server. */ PHP_METHOD(SolrResponse, getRawRequestHeaders) { zend_bool silent = 1; zval rv; zval *objptr = getThis(); zval *prop = NULL; prop = solr_read_response_object_property(objptr, "http_raw_request_headers", silent, &rv); RETURN_STRINGL(Z_STRVAL_P(prop), Z_STRLEN_P(prop)); } /* }}} */ /* {{{ proto string SolrResponse::getRawRequest(void) Returns the raw http request sent to the server. */ PHP_METHOD(SolrResponse, getRawRequest) { zend_bool silent = 1; zval rv; zval *objptr = getThis(); zval *prop = NULL; prop = solr_read_response_object_property(objptr, "http_raw_request", silent, &rv); RETURN_STRINGL(Z_STRVAL_P(prop), Z_STRLEN_P(prop)); } /* }}} */ /* {{{ proto string SolrResponse::getRawResponseHeaders(void) Returns the raw http response headers from the server. */ PHP_METHOD(SolrResponse, getRawResponseHeaders) { zend_bool silent = 1; zval rv; zval *objptr = getThis(); zval *prop = NULL; prop = solr_read_response_object_property(objptr, "http_raw_response_headers", silent, &rv); RETURN_STRINGL(Z_STRVAL_P(prop), Z_STRLEN_P(prop)); } /* }}} */ /* {{{ proto string SolrResponse::getRawResponse(void) Returns the raw http response from the server. */ PHP_METHOD(SolrResponse, getRawResponse) { zend_bool silent = 1; zval rv; zval *objptr = getThis(); zval *prop = NULL; prop = solr_read_response_object_property(objptr, "http_raw_response", silent, &rv); if (Z_STRLEN_P(prop)) { RETURN_STRINGL(Z_STRVAL_P(prop), Z_STRLEN_P(prop)); } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrResponse::getDigestedResponse(void) Returns the serialized object string derived from the XML response. */ PHP_METHOD(SolrResponse, getDigestedResponse) { zend_bool silent = 0; zval rv; zval *objptr = getThis(); zval *prop = NULL; prop = solr_read_response_object_property(objptr, "http_digested_response", silent, &rv); if (Z_STRLEN_P(prop)) { RETURN_STRINGL(Z_STRVAL_P(prop), Z_STRLEN_P(prop)); } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrReponse::setParseMode([bool parse_mode]) Sets the parsing mode. This determines whether documents will be parsed as SolrObjects or SolrDocuments. */ PHP_METHOD(SolrResponse, setParseMode) { long int parse_mode = 0L; zval *objptr = getThis(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &parse_mode) == FAILURE) { RETURN_FALSE; } parse_mode = ((parse_mode < 0L) ? 0L : ((parse_mode > 1L) ? 1L : parse_mode)); zend_update_property_long(Z_OBJCE_P(objptr), objptr, "parser_mode", sizeof("parser_mode")-1, parse_mode TSRMLS_CC); RETURN_TRUE; } /* }}} */ /* {{{ proto SolrObject SolrResponse::getResponse(void) Returns the response object from the server. */ PHP_METHOD(SolrResponse, getResponse) { solr_response_get_response_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU,0); } /* }}} */ /* {{{ proto array SolrResponse::getArrayResponse(void) Returns the response array from the server. */ PHP_METHOD(SolrResponse, getArrayResponse) { solr_response_get_response_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU,1); } /* }}} */ /** * Digest solr server raw response * and return SolrObject or array */ PHP_SOLR_API void solr_response_get_response_impl( INTERNAL_FUNCTION_PARAMETERS, int return_array) { zend_bool silent = 0; zval *objptr = getThis(); zval rv; zval *response_writer = solr_read_response_object_property(objptr, "response_writer", silent, &rv); zval *raw_response = solr_read_response_object_property(objptr, "http_raw_response", silent, &rv); zval *success = solr_read_response_object_property(objptr, "success", silent, &rv); zval *parser_mode = solr_read_response_object_property(objptr, "parser_mode", silent, &rv); if (Z_TYPE_P(success) == IS_TRUE && Z_STRLEN_P(raw_response)) { solr_string_t buffer; php_unserialize_data_t var_hash; const unsigned char *raw_resp; size_t raw_res_length; const unsigned char *str_end; int successful = 1; memset(&buffer, 0, sizeof(solr_string_t)); if (Z_STRLEN_P(response_writer)) { if (0 == strcmp(Z_STRVAL_P(response_writer), SOLR_XML_RESPONSE_WRITER)) { /* SOLR_XML_RESPONSE_WRITER */ /* Convert from XML serialization to PHP serialization format */ solr_encode_generic_xml_response(&buffer, Z_STRVAL_P(raw_response), Z_STRLEN_P(raw_response), Z_LVAL_P(parser_mode) TSRMLS_CC); if(return_array) { solr_sobject_to_sarray(&buffer TSRMLS_CC); } } else if (0 == strcmp(Z_STRVAL_P(response_writer), SOLR_PHP_NATIVE_RESPONSE_WRITER) || 0 == strcmp(Z_STRVAL_P(response_writer), SOLR_PHP_SERIALIZED_RESPONSE_WRITER)) { /* SOLR_PHP_NATIVE_RESPONSE_WRITER */ /* Response string is already in Native PHP serialization format */ solr_string_set(&buffer, Z_STRVAL_P(raw_response), Z_STRLEN_P(raw_response)); if(!return_array) { solr_sarray_to_sobject(&buffer TSRMLS_CC); } } else if (0 == strcmp(Z_STRVAL_P(response_writer), SOLR_JSON_RESPONSE_WRITER)) { int json_translation_result = solr_json_to_php_native(&buffer, Z_STRVAL_P(raw_response), Z_STRLEN_P(raw_response) TSRMLS_CC); /* SOLR_JSON_RESPONSE_WRITER */ /* Convert from JSON serialization to PHP serialization format */ if (json_translation_result > 0) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, solr_get_json_error_msg(json_translation_result)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error in JSON->PHP conversion. JSON Error Code %d", json_translation_result); } if(!return_array) { solr_sarray_to_sobject(&buffer TSRMLS_CC); } } } if (buffer.len) { zend_update_property_stringl(Z_OBJCE_P(objptr), objptr, "http_digested_response", sizeof("http_digested_response")-1, buffer.str, buffer.len TSRMLS_CC); } memset(&var_hash, 0, sizeof(php_unserialize_data_t)); PHP_VAR_UNSERIALIZE_INIT(var_hash); raw_resp = (unsigned char *) buffer.str; raw_res_length = buffer.len; str_end = (unsigned char *) (raw_resp + raw_res_length); if (!php_var_unserialize(return_value, &raw_resp, str_end, &var_hash TSRMLS_CC)) { successful = 0; solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1000_MSG); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error unserializing raw response."); } PHP_VAR_UNSERIALIZE_DESTROY(var_hash); solr_string_free(&buffer); if (successful && !return_array) { /* Overriding the default object handlers */ Z_OBJ_HT_P(return_value) = &solr_object_handlers; } return ; } RETURN_NULL(); } /* {{{ proto string SolrPingResponse::getResponse(void) Ping responses are always empty. Returns null. */ PHP_METHOD(SolrPingResponse, getResponse) { /* Ping responses are not serialized */ RETURN_NULL(); } /* }}} */ /* {{{ proto SolrPingResponse::__construct(void) Constructor */ PHP_METHOD(SolrPingResponse, __construct) { } /* }}} */ /* {{{ proto SolrPingResponse::__destruct(void) Destructor */ PHP_METHOD(SolrPingResponse, __destruct) { } /* }}} */ /* {{{ proto SolrQueryResponse::__construct(void) Constructor */ PHP_METHOD(SolrQueryResponse, __construct) { } /* }}} */ /* {{{ proto SolrQueryResponse::__destruct(void) Destructor */ PHP_METHOD(SolrQueryResponse, __destruct) { } /* }}} */ /* {{{ proto SolrUpdateResponse::__construct(void) Constructor */ PHP_METHOD(SolrUpdateResponse, __construct) { } /* }}} */ /* {{{ proto SolrUpdateResponse::__destruct(void) Destructor */ PHP_METHOD(SolrUpdateResponse, __destruct) { } /* }}} */ /* {{{ proto SolrGenericResponse::__construct(void) Constructor */ PHP_METHOD(SolrGenericResponse, __construct) { } /* }}} */ /* {{{ proto SolrGenericResponse::__destruct(void) Destructor */ PHP_METHOD(SolrGenericResponse, __destruct) { } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/php_solr_utils.c000066400000000000000000000174111374041537100222260ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ proto string SolrUtils::escapeQueryChars(string unescaped) Escapes the lucene string */ PHP_METHOD(SolrUtils, escapeQueryChars) { solr_char_t *unescaped = NULL; solr_string_t sbuilder; COMPAT_ARG_SIZE_T unescaped_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &unescaped, &unescaped_length) == FAILURE) { RETURN_FALSE; } if (!unescaped_length) { RETURN_NULL(); } memset(&sbuilder, 0, sizeof(solr_string_t)); solr_escape_query_chars(&sbuilder, unescaped, unescaped_length); RETVAL_STRINGL(sbuilder.str, sbuilder.len); solr_string_free(&sbuilder); } /* }}} */ /* {{{ proto string SolrUtils::queryPhrase(string unescaped) Prepares a phrase from an unescaped lucene string. */ PHP_METHOD(SolrUtils, queryPhrase) { solr_char_t *unescaped = NULL; solr_string_t sbuilder; COMPAT_ARG_SIZE_T unescaped_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &unescaped, &unescaped_length) == FAILURE) { RETURN_FALSE; } if (!unescaped_length) { RETURN_NULL(); } memset(&sbuilder, 0, sizeof(solr_string_t)); solr_string_appendc(&sbuilder, '"'); solr_escape_query_chars(&sbuilder, unescaped, unescaped_length); solr_string_appendc(&sbuilder, '"'); RETVAL_STRINGL(sbuilder.str, sbuilder.len); solr_string_free(&sbuilder); } /* }}} */ /* {{{ proto string SolrUtils::digestXMLResponse(string xml_response [, int parse_mode]) Digests the xml response into a php serialize string. */ PHP_METHOD(SolrUtils, digestXmlResponse) { solr_char_t *xmlresponse = NULL; COMPAT_ARG_SIZE_T xmlresponse_len = 0; long int parse_mode = 0L; solr_string_t sbuilder; unsigned char *raw_resp = NULL, *str_end = NULL; size_t raw_res_length = 0; php_unserialize_data_t var_hash; int successful = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &xmlresponse, &xmlresponse_len, &parse_mode) == FAILURE) { RETURN_FALSE; } if (!xmlresponse_len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Raw response is empty"); RETURN_NULL(); } parse_mode = ((parse_mode < 0L) ? 0L : ((parse_mode > 1L) ? 1L : parse_mode)); memset(&sbuilder, 0, sizeof(solr_string_t)); solr_encode_generic_xml_response(&sbuilder, xmlresponse, xmlresponse_len, parse_mode TSRMLS_CC); if (sbuilder.str == NULL || sbuilder.len == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Raw response was not valid"); RETURN_NULL(); } memset(&var_hash, 0, sizeof(php_unserialize_data_t)); PHP_VAR_UNSERIALIZE_INIT(var_hash); raw_resp = (unsigned char *) sbuilder.str; raw_res_length = sbuilder.len; str_end = (unsigned char *) (raw_resp + raw_res_length); if (!php_var_unserialize(return_value, (const unsigned char **) &raw_resp, str_end, &var_hash TSRMLS_CC)) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1000_MSG); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error unserializing raw response."); successful = 0; } PHP_VAR_UNSERIALIZE_DESTROY(var_hash); solr_string_free(&sbuilder); if (successful) { /* Overriding the default object handlers */ Z_OBJ_HT_P(return_value) = &solr_object_handlers; } } /* }}} */ /* {{{ proto string SolrUtils::digestJsonResponse(string jsonResponse) Digests the json response into a php serialize string. */ PHP_METHOD(SolrUtils, digestJsonResponse) { solr_char_t *jsonResponse = NULL; COMPAT_ARG_SIZE_T jsonResponse_len = 0; unsigned char *raw_resp = NULL, *str_end = NULL; solr_string_t buffer; php_unserialize_data_t var_hash; COMPAT_ARG_SIZE_T raw_res_length; int successful = 1; int json_translation_result; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &jsonResponse, &jsonResponse_len) == FAILURE) { RETURN_FALSE; } memset(&buffer, 0, sizeof(solr_string_t)); json_translation_result = solr_json_to_php_native(&buffer, jsonResponse, jsonResponse_len TSRMLS_CC); if (json_translation_result > 0) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, solr_get_json_error_msg(json_translation_result)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error in JSON->PHP conversion. JSON Error Code %d", json_translation_result); }else{ solr_sarray_to_sobject(&buffer TSRMLS_CC); } memset(&var_hash, 0, sizeof(php_unserialize_data_t)); PHP_VAR_UNSERIALIZE_INIT(var_hash); raw_resp = (unsigned char *) buffer.str; raw_res_length = buffer.len; str_end = (unsigned char *) (raw_resp + raw_res_length); if (!php_var_unserialize(return_value, (const unsigned char **)&raw_resp, str_end, &var_hash TSRMLS_CC)) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1000_MSG); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error unserializing raw response."); successful = 0; } solr_string_free(&buffer); PHP_VAR_UNSERIALIZE_DESTROY(var_hash); if (successful) { /* Overriding the default object handlers */ Z_OBJ_HT_P(return_value) = &solr_object_handlers; } } /* }}} */ /* {{{ proto string SolrUtils::getSolrVersion(void) Returns the current extension version */ PHP_METHOD(SolrUtils, getSolrVersion) { #ifdef SOLR_DEBUG char * version; asprintf(&version,"%s (DEBUG)", PHP_SOLR_DOTTED_VERSION); ZVAL_STRING(return_value, version); #else RETURN_STRING(PHP_SOLR_DOTTED_VERSION); #endif } /* }}} */ /* {{{ proto array SolrUtils::getSolrStats(void) Returns the number of active documents, clients and SolrParam objects in the current thread. */ PHP_METHOD(SolrUtils, getSolrStats) { int document_count = zend_hash_num_elements(SOLR_GLOBAL(documents)); int client_count = zend_hash_num_elements(SOLR_GLOBAL(clients)); int params_count = zend_hash_num_elements(SOLR_GLOBAL(params)); array_init(return_value); add_assoc_long(return_value, "document_count", document_count); add_assoc_long(return_value, "client_count", client_count); add_assoc_long(return_value, "params_count", params_count); } /* }}} */ /* {{{ proto string solr_get_version(void) Returns the current extension version */ PHP_FUNCTION(solr_get_version) { #ifdef SOLR_DEBUG char * version; asprintf(&version,"%s (DEBUG)", PHP_SOLR_DOTTED_VERSION); ZVAL_STRING(return_value, version); #else RETURN_STRING(PHP_SOLR_DOTTED_VERSION); #endif } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/php_solr_version.h000066400000000000000000000050751374041537100225630ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_version.h" #ifndef PHP_SOLR_VERSION_H #define PHP_SOLR_VERSION_H #define PHP_SOLR_MAJOR_VERSION 2 #define PHP_SOLR_MINOR_VERSION 4 #define PHP_SOLR_PATCH_VERSION 0 #define PHP_SOLR_RELEASE_VERSION PHP_SOLR_PATCH_VERSION #define PHP_SOLR_VERSION "2.4.0" #define PHP_SOLR_DOTTED_VERSION PHP_SOLR_VERSION /** * Extension version numbers using hexadecimal numbers * * This is the numeric version of the extension, meant for easier * parsing and comparisons by programs. The PHP_SOLR_VERSION_ID define will * always follow this syntax: * * 0xXXYYZZ * * Where XX, YY and ZZ are the main version, minor version and patch numbers in * hexadecimal (using 8 bits each). All three numbers are always represented * using two digits. 1.2 would appear as "0x010200" while version 9.11.7 * appears as "0x090b07". * * This 6-digit (24 bits) hexadecimal number does not show pre-release number, * and it is always a greater number in a more recent release. It makes * comparisons with greater than and less than work. */ #define PHP_SOLR_VERSION_ID 0x020400 #define SOLR_CLIENT_USER_AGENT "PHP Solr Client 2.4.0" #endif /* PHP_SOLR_VERSION_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/solr_constants.h000066400000000000000000000175701374041537100222460ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #ifndef SOLR_CONSTANTS_H #define SOLR_CONSTANTS_H #include "php_solr_version.h" #define SOLR_SPACE_STRING " " /* {{{ Constants for the SolrClient with*/ #define SOLR_DEFAULT_UPDATE_SERVLET "update" #define SOLR_DEFAULT_SEARCH_SERVLET "select" #define SOLR_DEFAULT_THREADS_SERVLET "admin/threads" #define SOLR_DEFAULT_PING_SERVLET "admin/ping" #define SOLR_DEFAULT_TERMS_SERVLET "terms" #define SOLR_DEFAULT_SYSTEM_SERVLET "admin/system" #define SOLR_DEFAULT_GET_SERVLET "get" #define SOLR_PHP_SERIALIZED_RESPONSE_WRITER "phps" #define SOLR_PHP_NATIVE_RESPONSE_WRITER "phpnative" #define SOLR_XML_RESPONSE_WRITER "xml" #define SOLR_JSON_RESPONSE_WRITER "json" #define SOLR_REQUEST_DEFAULT_HOST "localhost" #define SOLR_REQUEST_DEFAULT_PATH "solr" #define SOLR_REQUEST_DEFAULT_QS_DELIMITER "&" #define SOLR_REQUEST_DEFAULT_PORT 8983L #define SOLR_CURL_MAX_WRITE_SIZE CURL_MAX_WRITE_SIZE #define SOLR_CURL_OPTIONS_LENGTH 512 /* }}} */ /* {{{ Names of Objects */ #define PHP_SOLR_OBJECT_CLASSNAME "SolrObject" #define PHP_SOLR_DOCUMENT_CLASSNAME "SolrDocument" #define PHP_SOLR_DOCUMENT_FIELD_CLASSNAME "SolrDocumentField" #define PHP_SOLR_INPUT_DOCUMENT_CLASSNAME "SolrInputDocument" #define PHP_SOLR_CLIENT_CLASSNAME "SolrClient" #define PHP_SOLR_PARAMS_CLASSNAME "SolrParams" #define PHP_SOLR_QUERY_CLASSNAME "SolrQuery" #define PHP_SOLR_COLLAPSE_FUNCTION_CLASSNAME "SolrCollapseFunction" #define PHP_SOLR_MODIFIABLE_PARAMS_CLASSNAME "SolrModifiableParams" #define PHP_SOLR_RESPONSE_CLASSNAME "SolrResponse" #define PHP_SOLR_QUERY_RESPONSE_CLASSNAME "SolrQueryResponse" #define PHP_SOLR_UPDATE_RESPONSE_CLASSNAME "SolrUpdateResponse" #define PHP_SOLR_PING_RESPONSE_CLASSNAME "SolrPingResponse" #define PHP_SOLR_GENERIC_RESPONSE_CLASSNAME "SolrGenericResponse" #define PHP_SOLR_UTILS_CLASSNAME "SolrUtils" #define PHP_SOLR_EXCEPTION_CLASSNAME "SolrException" #define PHP_SOLR_ILLEGAL_OPERATION_EXCEPTION_CLASSNAME "SolrIllegalOperationException" #define PHP_SOLR_ILLEGAL_ARGUMENT_EXCEPTION_CLASSNAME "SolrIllegalArgumentException" #define PHP_SOLR_CLIENT_EXCEPTION_CLASSNAME "SolrClientException" #define PHP_SOLR_SERVER_EXCEPTION_CLASSNAME "SolrServerException" #define PHP_SOLR_MISSING_MANDATORY_PARAMETER_EXCEPTION_CLASSNAME "SolrMissingMandatoryParameterException" /* }}} */ /* {{{ Informational constants */ #define PHP_SOLR_EXTENSION_NAME "solr" #define PHP_CURL_EXTENSION_NAME "curl" #define PHP_LIBXML_EXTENSION_NAME "libxml" #define PHP_JSON_EXTENSION_NAME "json" /* }}} */ /* {{{ Property names */ #define SOLR_INDEX_PROPERTY_NAME "_hashtable_index" #define SOLR_FIELD_NAME_PROPERTY_NAME "name" #define SOLR_FIELD_BOOST_PROPERTY_NAME "boost" #define SOLR_FIELD_VALUES_PROPERTY_NAME "values" #define SOLR_SOURCELINE_NO_PROPERTY_NAME "sourceline" #define SOLR_SOURCEFILE_PROPERTY_NAME "sourcefile" #define SOLR_ZIFNAME_PROPERTY_NAME "zif_name" #define SOLR_DISMAX_DEFAULT_PARSER "edismax" #ifdef PHP_WIN32 #define __func__ __FUNCTION__ #endif #define SOLR_FILE_LINE_FUNC __FILE__, __LINE__, __func__ /* }}} */ /* {{{ Constants for Method/Function arguments and return styles */ #define SOLR_ARG_PASS_BY_REF_FALSE 0 #define SOLR_ARG_PASS_BY_REF_TRUE 1 #define SOLR_ARG_PASS_REMAINING_BY_REF_FALSE 0 #define SOLR_ARG_PASS_REMAINING_BY_REF_TRUE 1 #define SOLR_ARG_ALLOW_NULL_FALSE 0 #define SOLR_ARG_ALLOW_NULL_TRUE 1 #define SOLR_METHOD_RETURN_REFERENCE_FALSE 0 #define SOLR_METHOD_RETURN_REFERENCE_TRUE 1 /* }}} */ /* {{{ Constants for Sorting SolrDocument Fields */ #define SOLR_SORT_ASC 1 #define SOLR_SORT_DESC 2 #define SOLR_SORT_FIELD_NAME 1 #define SOLR_SORT_FIELD_VALUE_COUNT 2 #define SOLR_SORT_FIELD_BOOST_VALUE 4 /* }}} */ /* {{{ Constants for document encoding formats */ #define SOLR_XML_ENCODE_OBJ 0L #define SOLR_XML_ENCODE_DOC 1L /* }}} */ /** * Setting this to 8 gets rid of the extra while loops in _zend_hash_init() * * _zend_hash_init loops 3 times to increase the value of the size to 8 */ #define SOLR_INITIAL_HASH_TABLE_SIZE (1<<3) /* {{{ Memory Allocation Related Constants */ #define SOLR_HASHTABLE_PERSISTENT 0 #define SOLR_DOCUMENT_PERSISTENT 0 #define SOLR_DOCUMENT_FIELD_PERSISTENT 0 #define SOLR_CLIENT_PERSISTENT 0 #define SOLR_PARAMS_PERSISTENT 0 #define SOLR_FUNCTIONS_PERSISTENT 0 /* }}} */ /* {{{ SolrException Codes : Internal and UserSpace */ /* {{{ Error codes and messages */ #define SOLR_ERROR_1000 1000L #define SOLR_ERROR_1000_MSG "Error un-serializing response" #define SOLR_ERROR_1001 1001L #define SOLR_ERROR_1001_MSG "SolrClient objects cannot be serialized or unserialized" #define SOLR_ERROR_1002 1002L #define SOLR_ERROR_1002_MSG "The '%s' property cannot be removed or set to NULL. SolrObject properties cannot be unset or set to NULL." #define SOLR_ERROR_1003 1003L #define SOLR_ERROR_1003_MSG "Error building HTTP query from parameters" #define SOLR_ERROR_1004 1004L #define SOLR_ERROR_1004_MSG "Unsuccessful HTTP request" #define SOLR_ERROR_1005 1005L #define SOLR_ERROR_1005_MSG "SolrInputDocument objects cannot be serialized or unserialized" #define SOLR_ERROR_1006 1006L #define SOLR_ERROR_1006_MSG "SolrObject instances are read-only. Properties cannot be added, updated or removed." #define SOLR_ERROR_1007 1007L #define SOLR_ERROR_1007_MSG "SolrDocumentField instances are read-only. Properties cannot be updated or removed." #define SOLR_ERROR_1008 1008L #define SOLR_ERROR_1008_MSG "Internal Error 1008 generated from %s %d %s. The observed error is a possible side-effect of an illegal/unsupported operation in userspace. Please check the documentation and try again later." #define SOLR_ERROR_1009 1009L #define SOLR_ERROR_1009_MSG "The observed error is a possible side-effect of an illegal/unsupported operation in userspace. This object cannot be cloned. Cloning of this object type is not yet supported." #define SOLR_ERROR_1010 1010L #define SOLR_ERROR_1010_MSG "Unsuccessful %s request : Response Code %ld. %s" #define SOLR_ERROR_4000 4000L #define SOLR_ERROR_4000_MSG "Invalid argument" #define SOLR_ERROR_4001 4001L #define SOLR_ERROR_4001_MSG "Illegal Operation" #define SOLR_ERROR_4002 4002L #define SOLR_ERROR_4002_MSG "Return value requested without processing output" /* }}} */ /* {{{ UserSpace Errors */ #define SOLR_ERROR_4100 4100L #define SOLR_ERROR_4100_MSG "Mandatory parameter Missing: %s" /* }}} */ /* {{{ Compile time errors */ /* }}} */ /* }}} */ #endif /* SOLR_CONSTANTS_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/solr_functions_client.c000066400000000000000000000737251374041537100235770ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ PHP_SOLR_API int solr_init_options(solr_client_options_t *options TSRMLS_DC) */ PHP_SOLR_API int solr_init_options(solr_client_options_t *options TSRMLS_DC) { solr_string_init(&(options->hostname)); solr_string_init(&(options->path)); solr_string_init(&(options->http_auth_credentials)); solr_string_init(&(options->proxy_hostname)); solr_string_init(&(options->proxy_auth_credentials)); solr_string_init(&(options->ssl_cert)); solr_string_init(&(options->ssl_key)); solr_string_init(&(options->ssl_keypassword)); solr_string_init(&(options->ssl_cainfo)); solr_string_init(&(options->ssl_capath)); solr_string_init(&(options->qs_delimiter)); solr_string_init(&(options->response_writer)); solr_string_init(&(options->update_url)); solr_string_init(&(options->search_url)); solr_string_init(&(options->thread_url)); solr_string_init(&(options->ping_url)); solr_string_init(&(options->terms_url)); solr_string_init(&(options->system_url)); solr_string_init(&(options->get_url)); solr_string_init(&(options->update_servlet)); solr_string_init(&(options->search_servlet)); solr_string_init(&(options->thread_servlet)); solr_string_init(&(options->ping_servlet)); solr_string_init(&(options->terms_servlet)); solr_string_init(&(options->system_servlet)); solr_string_init(&(options->get_servlet)); return SUCCESS; } /* }}} */ /* {{{ static void solr_set_initial_handle_options(solr_curl_t **sch, solr_client_options_t *options TSRMLS_DC) */ static void solr_set_initial_curl_handle_options(solr_curl_t **sch_ptr, solr_client_options_t *options TSRMLS_DC) { solr_curl_t * sch = *sch_ptr; /** Setup all the required CURL options here **/ curl_easy_setopt(sch->curl_handle, CURLOPT_NOPROGRESS, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_VERBOSE, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_ERRORBUFFER, sch->err.str); curl_easy_setopt(sch->curl_handle, CURLOPT_WRITEFUNCTION, solr_curl_write); curl_easy_setopt(sch->curl_handle, CURLOPT_WRITEDATA, (void *) sch); curl_easy_setopt(sch->curl_handle, CURLOPT_HEADERFUNCTION, solr_curl_write_header); curl_easy_setopt(sch->curl_handle, CURLOPT_HEADERDATA, (void *) sch); curl_easy_setopt(sch->curl_handle, CURLOPT_DEBUGFUNCTION, solr_curl_debug_callback); curl_easy_setopt(sch->curl_handle, CURLOPT_DEBUGDATA, (void *) sch); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); /** #if LIBCURL_VERSION_NUM >= 0x071304 curl_easy_setopt(sch->curl_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP); #endif */ curl_easy_setopt(sch->curl_handle, CURLOPT_DNS_CACHE_TIMEOUT, 120L); curl_easy_setopt(sch->curl_handle, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_MAXREDIRS, 16L); /* prevent infinite redirects */ curl_easy_setopt(sch->curl_handle, CURLOPT_UNRESTRICTED_AUTH, 0L); #ifdef ZTS curl_easy_setopt(sch->curl_handle, CURLOPT_NOSIGNAL, 1L); /** Needed in multi-threaded environments **/ #endif curl_easy_setopt(sch->curl_handle, CURLOPT_TIMEOUT, options->timeout); curl_easy_setopt(sch->curl_handle, CURLOPT_USERAGENT, SOLR_CLIENT_USER_AGENT); /* If the login and password options are passed, send the authentication headers */ if (options->http_auth_credentials.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_easy_setopt(sch->curl_handle, CURLOPT_USERPWD, options->http_auth_credentials.str); } /* If there is proxy info, send it too */ if (options->proxy_hostname.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_PROXY, options->proxy_hostname.str); if (options->proxy_port) { curl_easy_setopt(sch->curl_handle, CURLOPT_PROXYPORT, options->proxy_port); } if (options->proxy_auth_credentials.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_PROXYUSERPWD, options->proxy_auth_credentials.str); } } /* * When negotiating an SSL connection, the server sends a certificate indicating its identity. * cURL verifies whether the certificate is authentic */ if (options->secure) { /* The name of the PEM-formatted private key and private certificate concatenated */ if (options->ssl_cert.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_SSLCERT, options->ssl_cert.str); curl_easy_setopt(sch->curl_handle, CURLOPT_SSLCERTTYPE, "PEM"); } /* The name of the PEM-formatted private key, if certificate and private key are separate */ if (options->ssl_key.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_SSLKEY, options->ssl_key.str); curl_easy_setopt(sch->curl_handle, CURLOPT_SSLKEYTYPE, "PEM"); } /* Password for the PEM-formatted private key */ if (options->ssl_keypassword.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_KEYPASSWD, options->ssl_keypassword.str); } /* The file holding one or more CA certificates to verify the peer with */ if (options->ssl_cainfo.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_CAINFO, options->ssl_cainfo.str); } /* The directory holding multiple CA certificates to verify the peer with */ if (options->ssl_capath.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_CAPATH , options->ssl_capath.str); } /* * Whether curl verifies the authenticity of the host name of server * Based on the Common name section of the certificate */ if (options->ssl_verify_peer && options->ssl_verify_host) { curl_easy_setopt(sch->curl_handle, CURLOPT_SSL_VERIFYHOST, options->ssl_verify_host); } /* * Verify the authenticity of the peer's certificate * This authentication is based on a chain of digital signatures, * rooted in certification authority (CA) certificates. * * If something is not right, the connection will not be valid */ curl_easy_setopt(sch->curl_handle, CURLOPT_SSL_VERIFYPEER, options->ssl_verify_peer); } } /* }}} */ /* {{{ PHP_SOLR_API int solr_init_handle(solr_curl_t *sch, solr_client_options_t *options TSRMLS_DC) */ PHP_SOLR_API int solr_init_handle(solr_curl_t *sch, solr_client_options_t *options TSRMLS_DC) { sch->response_header.response_code = 0L; memset(sch->err.str, 0, sizeof(sch->err.str)); sch->curl_handle = curl_easy_init(); if (NULL == sch->curl_handle) { return FAILURE; } sch->result_code = CURLE_OK; sch->handle_status = 1; #if defined(ZTS) && PHP_VERSION_ID < 70000 sch->tsrm_ls = TSRMLS_C; #endif solr_string_init(&(sch->request_header.buffer)); solr_string_init(&(sch->request_body.buffer)); solr_string_init(&(sch->request_body_debug.buffer)); solr_string_init(&(sch->response_header.buffer)); solr_string_init(&(sch->response_body.buffer)); solr_string_init(&(sch->debug_data_buffer)); solr_set_initial_curl_handle_options(&(sch), options TSRMLS_CC); return SUCCESS; } /* }}} */ /** * solr_curl_write * * Called by libcurl as soon as there is response body data received that needs to be saved. * * The size of the data pointed to by *data is size multiplied with nmemb, it will not be zero terminated * * The *ctx parameter is the solr_curl pointer */ /* {{{ size_t solr_curl_write(solr_char_t *data, size_t size, size_t nmemb, void *ctx) */ size_t solr_curl_write(solr_char_t *data, size_t size, size_t nmemb, void *ctx) { size_t length = (size * nmemb); solr_curl_t *sch = (solr_curl_t *) ctx; solr_string_appends(&(sch->response_body.buffer), data, length); return length; } /* }}} */ /** * solr_curl_write_header * * Called by libcurl as soon as it has received header data * * It will be called once for each header and only complete header lines are passed on to the callback. * * Note: header lines may not be null-terminated so beware. * * The *ctx parameter is the solr_curl pointer */ /* {{{ size_t solr_curl_write_header(solr_char_t *data, size_t size, size_t nmemb, void *ctx) */ size_t solr_curl_write_header(solr_char_t *data, size_t size, size_t nmemb, void *ctx) { size_t length = (size * nmemb); solr_curl_t *sch = (solr_curl_t *) ctx; solr_string_appends(&(sch->response_header.buffer), data, length); return length; } /* }}} */ /** * solr_curl_debug_callback * * The infotype parameter is one of : * * 0 = CURLINFO_TEXT * 1 = CURLINFO_HEADER_IN (Response Headers) * 2 = CURLINFO_HEADER_OUT (Request Headers) * 3 = CURLINFO_DATA_IN (Response Body) * 4 = CURLINFO_DATA_OUT (Request Body) * 5 = CURLINFO_SSL_DATA_IN * 6 = CURLINFO_SSL_DATA_OUT * * The debug_data parameter is not null-terminated but is exactly size characters * * The ctx parameter is a solr_curl * pointer */ /* {{{ int solr_curl_debug_callback(CURL *curl_handle, curl_infotype infotype, solr_char_t *debug_data, size_t size, void *ctx) */ int solr_curl_debug_callback(CURL *curl_handle, curl_infotype infotype, solr_char_t *debug_data, size_t size, void *ctx) { solr_curl_t *sch = (solr_curl_t *) ctx; /* TODO : Check why this function is still called after destructor has been called */ if (!sch->handle_status) { return 0; } switch(infotype) { case CURLINFO_HEADER_OUT : /* Capture the Actual Request Headers Sent to Server */ { solr_string_appends(&(sch->request_header.buffer), debug_data, size); } break; case CURLINFO_DATA_OUT : /* Capture the Actual Request Body Sent to Server */ { solr_string_appends(&(sch->request_body_debug.buffer), debug_data, size); } break; default : { /* do nothing */ } break; } /* Captures ALL debug information */ solr_string_appends(&(sch->debug_data_buffer), debug_data, size); return 0; } /* }}} */ /* {{{ PHP_SOLR_API int solr_make_request(solr_client_t *client, solr_request_type_t request_type TSRMLS_DC) */ PHP_SOLR_API int solr_make_request(solr_client_t *client, solr_request_type_t request_type TSRMLS_DC) { solr_curl_t *sch = &(client->handle); solr_client_options_t *options = &(client->options); solr_http_header_list_t *header_list = NULL; int return_status = SUCCESS; CURLcode info_status = CURLE_OK; header_list = curl_slist_append(header_list, "Accept-Charset: utf-8"); header_list = curl_slist_append(header_list, "Keep-Alive: 300"); header_list = curl_slist_append(header_list, "Connection: keep-alive"); /* Disable the Expect: 100-continue header. Jetty gets confused with this header */ header_list = curl_slist_append(header_list, "Expect:"); /* Reset the buffers */ solr_string_free(&sch->request_header.buffer); solr_string_free(&sch->request_body_debug.buffer); solr_string_free(&sch->response_body.buffer); solr_string_free(&sch->response_header.buffer); solr_string_free(&sch->debug_data_buffer); curl_easy_reset(sch->curl_handle); solr_set_initial_curl_handle_options(&(sch), options TSRMLS_CC); /* Reset the CURL options if the handle is reused */ curl_easy_setopt(sch->curl_handle, CURLOPT_HEADER, 0L); curl_easy_setopt(sch->curl_handle, CURLOPT_POST, 0L); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPGET, 0L); curl_easy_setopt(sch->curl_handle, CURLOPT_NOBODY, 0L); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDSIZE, 0L); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDS, NULL); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, NULL); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, NULL); switch(request_type) { case SOLR_REQUEST_SEARCH : /* HTTP FORM POST */ { header_list = curl_slist_append(header_list, "Content-Type: application/x-www-form-urlencoded;charset=UTF-8"); curl_easy_setopt(sch->curl_handle, CURLOPT_POST, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->search_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDSIZE, sch->request_body.buffer.len); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDS, sch->request_body.buffer.str); } break; case SOLR_REQUEST_TERMS : /* HTTP FORM POST */ { header_list = curl_slist_append(header_list, "Content-Type: application/x-www-form-urlencoded;charset=UTF-8"); curl_easy_setopt(sch->curl_handle, CURLOPT_POST, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->terms_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDSIZE, sch->request_body.buffer.len); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDS, sch->request_body.buffer.str); } break; case SOLR_REQUEST_UPDATE : /* HTTP XML POST */ { header_list = curl_slist_append(header_list, "Content-Type: text/xml;charset=UTF-8"); curl_easy_setopt(sch->curl_handle, CURLOPT_POST, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->update_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDSIZE, sch->request_body.buffer.len); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDS, sch->request_body.buffer.str); } break; case SOLR_REQUEST_THREADS : /* HTTP GET */ { curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPGET, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->thread_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); } break; case SOLR_REQUEST_PING : /* HTTP HEAD REQUEST. */ { curl_easy_setopt(sch->curl_handle, CURLOPT_HEADER, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_NOBODY, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->ping_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); } break; case SOLR_REQUEST_SYSTEM: /* HTTP GET to fetch system info */ { curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPGET, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->system_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); } break; case SOLR_REQUEST_GET: solr_string_appendc(&(options->get_url), '&'); solr_string_append_solr_string(&(options->get_url), &(sch->request_body.buffer)); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPGET, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->get_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); break; default : { return_status = FAILURE; } break; } sch->result_code = curl_easy_perform(sch->curl_handle); info_status = curl_easy_getinfo(sch->curl_handle, CURLINFO_RESPONSE_CODE, &(sch->response_header.response_code)); if (info_status != CURLE_OK) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "HTTP Transfer status could not be retrieved successfully"); return_status = FAILURE; } if (sch->result_code != CURLE_OK) { /* commented by: Omar Shaban */ /* php_error_docref(NULL TSRMLS_CC, E_WARNING, "Solr HTTP Error : '%s' ", curl_easy_strerror(sch->result_code)); */ solr_throw_exception_ex(solr_ce_SolrClientException, SOLR_ERROR_1004 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Solr HTTP Error %d: '%s' ",sch->result_code, curl_easy_strerror(sch->result_code)); return_status = FAILURE; } if (sch->response_header.response_code != 200L) { return_status = FAILURE; } curl_slist_free_all(header_list); return return_status; } /* }}} */ /** Deallocates memory associated with the Solr CURL Handle. **/ /* {{{ PHP_SOLR_API void solr_free_handle(solr_curl_t *sch) */ PHP_SOLR_API void solr_free_handle(solr_curl_t *sch) { solr_string_free(&((sch)->request_header.buffer)); solr_string_free(&((sch)->request_body.buffer)); solr_string_free(&((sch)->request_body_debug.buffer)); solr_string_free(&((sch)->response_header.buffer)); solr_string_free(&((sch)->response_body.buffer)); solr_string_free(&((sch)->debug_data_buffer)); sch->handle_status = 0; curl_easy_cleanup((sch)->curl_handle); sch->curl_handle = NULL; } /* }}} */ /* {{{ PHP_SOLR_API void solr_free_options(solr_client_options_t *options) */ PHP_SOLR_API void solr_free_options(solr_client_options_t *options) { solr_string_free(&((options)->hostname)); solr_string_free(&((options)->http_auth_credentials)); solr_string_free(&((options)->path)); solr_string_free(&((options)->proxy_auth_credentials)); solr_string_free(&((options)->ssl_cert)); solr_string_free(&((options)->ssl_key)); solr_string_free(&((options)->ssl_keypassword)); solr_string_free(&((options)->ssl_cainfo)); solr_string_free(&((options)->ssl_capath)); solr_string_free(&((options)->proxy_hostname)); solr_string_free(&((options)->qs_delimiter)); solr_string_free(&((options)->response_writer)); solr_string_free(&((options)->update_url)); solr_string_free(&((options)->search_url)); solr_string_free(&((options)->thread_url)); solr_string_free(&((options)->ping_url)); solr_string_free(&((options)->terms_url)); solr_string_free(&((options)->system_url)); solr_string_free(&((options)->get_url)); solr_string_free(&((options)->update_servlet)); solr_string_free(&((options)->search_servlet)); solr_string_free(&((options)->thread_servlet)); solr_string_free(&((options)->ping_servlet)); solr_string_free(&((options)->terms_servlet)); solr_string_free(&((options)->system_servlet)); solr_string_free(&((options)->get_servlet)); } /* }}} */ /* {{{ PHP_SOLR_API void solr_destroy_client(void *client) */ PHP_SOLR_API void solr_destroy_client(zval *client) { solr_client_t *solr_client = (solr_client_t *) Z_PTR_P(client); if (solr_client) { solr_free_options(&(solr_client->options)); solr_free_handle(&(solr_client->handle)); pefree(solr_client, SOLR_CLIENT_PERSISTENT); solr_client = NULL; } } /* }}} */ /* {{{ PHP_SOLR_API int solr_get_xml_error(solr_string_t buffer, solr_exception_t *exceptionData TSRMLS_DC) */ PHP_SOLR_API int solr_get_xml_error(solr_string_t buffer, solr_exception_t *exceptionData TSRMLS_DC) { xmlDoc *doc = xmlReadMemory((const char *)buffer.str, buffer.len, NULL, "UTF-8", XML_PARSE_RECOVER); xmlXPathContext *xpathContext = NULL; xmlXPathObject *xpathObject = NULL; xmlChar *xpathExpression = (unsigned char *)"/response/lst[@name='error']"; xmlNode * nodeCurser; const unsigned char * nodePropName = (const unsigned char *)"name"; if (!doc) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error loading XML document"); return 1; } /* Create xpath evaluation context */ xpathContext = xmlXPathNewContext(doc); if(xpathContext == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error creating xml xpath context"); xmlFreeDoc(doc); return 1; } /* Evaluate xpath expression */ xpathObject = xmlXPathEvalExpression(xpathExpression, xpathContext); if(xpathObject == NULL){ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error evaluating xml xpath expression"); xmlFreeDoc(doc); return 1; } if(!xpathObject->nodesetval){ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Xpath Error: no elements found"); xmlXPathFreeObject(xpathObject); xmlFreeDoc(doc); return 1; } nodeCurser = xpathObject->nodesetval->nodeTab[0]->children; while (nodeCurser != NULL) { if (xmlHasProp(nodeCurser, nodePropName)) { if (strcmp((const char *)xmlGetProp(nodeCurser,nodePropName), (const char *)"msg") == 0) { exceptionData->message = (solr_char_t *)estrdup((const char *)nodeCurser->children->content); } else if(strcmp((const char *)xmlGetProp(nodeCurser,nodePropName),"code") == 0) { exceptionData->code = atoi((const char *)nodeCurser->children->content); } else if(strcmp( (const char *)xmlGetProp(nodeCurser, nodePropName), (const char *) "trace") == 0) { exceptionData->message = (solr_char_t *)estrdup((const char *)nodeCurser->children->content); } } nodeCurser = nodeCurser->next; } xmlXPathFreeObject(xpathObject); xmlXPathFreeContext(xpathContext); xmlFreeDoc(doc); return 0; } /* }}} */ /* {{{ PHP_SOLR_API int hydrate_error_zval(zval *response, solr_exception_t *exceptionData TSRMLS_DC) */ PHP_SOLR_API int hydrate_error_zval(zval *response, solr_exception_t *exceptionData TSRMLS_DC) { zval *error_p; zval *msg_zv_p=(zval *) NULL, *code_zv_p = (zval *) NULL; zend_string *msg_key_str = zend_string_init("msg", sizeof("msg")-1, 1); zend_string *code_key_str = zend_string_init("code", sizeof("code")-1, 1); zend_string *error_key_str = zend_string_init("error", sizeof("error")-1, 1); zend_string *trace_key_str = zend_string_init("trace", sizeof("trace")-1, 1); int return_code = 0; if ( (error_p = zend_hash_find( Z_ARRVAL_P(response), error_key_str)) != NULL) { if (zend_hash_exists(HASH_OF(error_p), msg_key_str)) { if ((msg_zv_p = zend_hash_find(Z_ARRVAL_P(error_p), msg_key_str)) != NULL) { exceptionData->message = (solr_char_t *)estrdup(Z_STRVAL(*msg_zv_p)); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Undefined variable: %s", "msg"); return_code = 1; goto solr_error_func_return_end; } } else if (zend_hash_exists(HASH_OF(error_p), trace_key_str)) { if ((msg_zv_p = zend_hash_find(Z_ARRVAL_P(error_p), trace_key_str)) != NULL) { exceptionData->message = (solr_char_t *)estrdup(Z_STRVAL(*msg_zv_p)); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Undefined variable: %s", "trace"); return_code = 1; goto solr_error_func_return_end; } } else{ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unable to find %s in error response zval", "message or trace" ); return_code = 1; goto solr_error_func_return_end; } if ((code_zv_p = zend_hash_find(Z_ARRVAL_P(error_p), code_key_str)) != NULL) { exceptionData->code = (int)Z_LVAL_P(code_zv_p); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unable to find element with key %s in error response zval","code" ); return_code = 1; goto solr_error_func_return_end; } } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unable to find %s in error response", "error element" ); return_code = 1; goto solr_error_func_return_end; } solr_error_func_return_end: zend_string_release(msg_key_str); zend_string_release(code_key_str); zend_string_release(error_key_str); zend_string_release(trace_key_str); return return_code; } /* }}} */ /* {{{ PHP_SOLR_API int solr_get_json_error(solr_string_t buffer, solr_exception_t *exceptionData TSRMLS_DC) */ PHP_SOLR_API int solr_get_json_error(solr_string_t buffer, solr_exception_t *exceptionData TSRMLS_DC) { zval json_response; zval *error_p; zval *msg_zv_p=(zval *)NULL,*code_zv_p=(zval *)NULL; HashTable *errorHashTable; char * key = "error"; long nSize = 1000; int return_code = 0; zend_string *msg_key_str = zend_string_init("msg", sizeof("msg")-1, 1); zend_string *code_key_str = zend_string_init("code", sizeof("code")-1, 1); zend_string *error_key_str = zend_string_init("error", sizeof("error")-1, 1); zend_string *trace_key_str = zend_string_init("trace", sizeof("trace")-1, 1); php_json_decode(&json_response, (char *) buffer.str, buffer.len, 1, 1024L TSRMLS_CC); if (Z_TYPE(json_response) == IS_NULL) { zval_ptr_dtor(&json_response); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to parse Solr Server Error Response. JSON serialization error"); return 1; } ALLOC_HASHTABLE(errorHashTable); zend_hash_init(errorHashTable, nSize, NULL, NULL, 0); if ( (error_p = zend_hash_find( Z_ARRVAL(json_response), error_key_str)) != NULL) { if ((code_zv_p = zend_hash_find(Z_ARRVAL_P(error_p), code_key_str)) != NULL) { exceptionData->code = (int)Z_LVAL_P(code_zv_p); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unable to find %s in json error response","code" ); } if (zend_hash_exists(HASH_OF(error_p), msg_key_str)) { if ((msg_zv_p = zend_hash_find(Z_ARRVAL_P(error_p), msg_key_str)) != NULL) { exceptionData->message = (solr_char_t *)estrdup(Z_STRVAL_P(msg_zv_p)); } } else if (!exceptionData->message && zend_hash_exists(HASH_OF(error_p), trace_key_str)) { if ((msg_zv_p = zend_hash_find(Z_ARRVAL_P(error_p), trace_key_str)) != NULL) { exceptionData->message = (solr_char_t *)estrdup(Z_STRVAL_P(msg_zv_p)); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Undefined variable: %s","trace" ); } } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unable to find %s in error response zval","message" ); return_code = 1; goto solr_error_func_return_end; } }else{ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Undefined variable: %s",key ); } solr_error_func_return_end: zend_string_release(msg_key_str); zend_string_release(code_key_str); zend_string_release(error_key_str); zend_string_release(trace_key_str); zval_ptr_dtor(&json_response); zend_hash_destroy(errorHashTable); FREE_HASHTABLE(errorHashTable); return return_code; } /* }}} */ /* {{{ PHP_SOLR_API int solr_get_phpnative_error(solr_string_t buffer, solr_exception_t *exceptionData TSRMLS_DC) */ PHP_SOLR_API int solr_get_phpnative_error(solr_string_t buffer, solr_exception_t *exceptionData TSRMLS_DC) { zval *response_obj; php_unserialize_data_t var_hash; const unsigned char * raw_resp = (const unsigned char *) buffer.str; const unsigned char * str_end = (const unsigned char *) (buffer.str + buffer.len); ALLOC_INIT_ZVAL(response_obj); PHP_VAR_UNSERIALIZE_INIT(var_hash); if(!php_var_unserialize(response_obj, &raw_resp, str_end, &var_hash TSRMLS_CC)) { /* There is a known issue, that solr responses will not always be * with the dictated response format, as jetty or tomcat may return errors in their format */ PHP_VAR_UNSERIALIZE_DESTROY(var_hash); zval_ptr_dtor(response_obj); #ifdef PHP_7 efree(response_obj); #endif return 1; } hydrate_error_zval(response_obj, exceptionData TSRMLS_CC); PHP_VAR_UNSERIALIZE_DESTROY(var_hash); zval_ptr_dtor(response_obj); #ifdef PHP_7 efree(response_obj); #endif return 0; } /* }}} */ /* {{{ PHP_SOLR_API void solr_throw_solr_server_exception(solr_client_t *client,const char * requestType TSRMLS_DC) parse the solr server response and throw a SolrServerException */ PHP_SOLR_API void solr_throw_solr_server_exception(solr_client_t *client,const char * requestType TSRMLS_DC) { const char * response_writer = (char *) client->options.response_writer.str; solr_exception_t *exceptionData; exceptionData = (solr_exception_t*) emalloc(sizeof(solr_exception_t )); exceptionData->code = 0; memset(exceptionData, 0, sizeof(solr_exception_t)); if( 0 == strcmp(response_writer, SOLR_XML_RESPONSE_WRITER)){ if(solr_get_xml_error(client->handle.response_body.buffer, exceptionData TSRMLS_CC) != SUCCESS) { /* fallback to normal exception */ solr_throw_exception_ex(solr_ce_SolrClientException, SOLR_ERROR_1010 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1010_MSG, requestType, SOLR_RESPONSE_CODE_BODY); return; } } if( 0 == strcmp(response_writer, SOLR_JSON_RESPONSE_WRITER)) { if(solr_get_json_error(client->handle.response_body.buffer, exceptionData TSRMLS_CC) != SUCCESS) { solr_throw_exception_ex(solr_ce_SolrClientException, SOLR_ERROR_1010 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1010_MSG, requestType, SOLR_RESPONSE_CODE_BODY); } } if( 0 == strcmp(response_writer, SOLR_PHP_NATIVE_RESPONSE_WRITER) || 0 == strcmp(response_writer, SOLR_PHP_SERIALIZED_RESPONSE_WRITER)) { if(solr_get_phpnative_error(client->handle.response_body.buffer,exceptionData TSRMLS_CC) != SUCCESS) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unable to parse serialized php response" ); } } if(exceptionData->code == 0){ solr_throw_exception_ex(solr_ce_SolrClientException, SOLR_ERROR_1010 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1010_MSG, requestType, SOLR_RESPONSE_CODE_BODY); }else if (exceptionData->code > 0 && exceptionData->message){ solr_throw_exception_ex(solr_ce_SolrServerException, exceptionData->code TSRMLS_CC, SOLR_FILE_LINE_FUNC, exceptionData->message); } else { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to parse solr exception message, Internal Error" ); } if(exceptionData->message != NULL) { efree(exceptionData->message); } efree(exceptionData); } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/solr_functions_debug.c000066400000000000000000000110641374041537100233730ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Omar Shaban | | Israel Ekpo | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ void solr_debug_printf(const char *format, ...) */ PHP_SOLR_API void solr_debug_printf(const char *format, ...) { #ifdef SOLR_DEBUG va_list args; va_start(args,format); vprintf(format,args); va_end(args); #endif } /* }}} */ /* {{{ void solr_debug_print_fields(const solr_field_list_t *field_list) */ PHP_SOLR_API void solr_debug_print_fields(const solr_field_list_t *field_list) { /* Used to debug field inserted */ } /* }}} */ /** * print_xpath_nodes: * @nodes: the nodes set. * @output: the output file handle. * * Prints the @nodes content to @output. */ /* {{{ void print_xpath_nodes(xmlNodeSetPtr nodes, FILE* output) */ PHP_SOLR_API void print_xpath_nodes(xmlNodeSetPtr nodes, FILE* output) { xmlNodePtr cur; int size; int i; assert(output); size = (nodes) ? nodes->nodeNr : 0; fprintf(output, "Result (%d nodes):\n", size); for(i = 0; i < size; ++i) { assert(nodes->nodeTab[i]); if(nodes->nodeTab[i]->type == XML_NAMESPACE_DECL) { xmlNsPtr ns; ns = (xmlNsPtr)nodes->nodeTab[i]; cur = (xmlNodePtr)ns->next; if(cur->ns) { fprintf(output, "= namespace \"%s\"=\"%s\" for node %s:%s\n", ns->prefix, ns->href, cur->ns->href, cur->name); } else { fprintf(output, "= namespace \"%s\"=\"%s\" for node %s\n", ns->prefix, ns->href, cur->name); } } else if(nodes->nodeTab[i]->type == XML_ELEMENT_NODE) { cur = nodes->nodeTab[i]; if(cur->ns) { fprintf(output, "= element node \"%s:%s\"\n", cur->ns->href, cur->name); } else { fprintf(output, "= element node \"%s\"\n", cur->name); } } else { cur = nodes->nodeTab[i]; fprintf(output, "= node \"%s\": type %d\n", cur->name, cur->type); } } } /* }}} */ /* {{{ void print_children (xmlNode * node) */ PHP_SOLR_API void print_children (xmlNode * node) { fprintf(stdout,"\n================- start print children -=================\n"); while (node != NULL) { if(node->ns) { fprintf(stdout, "= element node \"%s:%s\"\n", node->ns->href,node->name); } else { fprintf(stdout, "= element node \"%s\"\n", node->name); } if(node->type == XML_ELEMENT_NODE){ xmlNode * cur2 = node->children; while (cur2 != NULL) { if(strcmp((const char *)cur2->name,"text")==0) { fprintf(stdout, "= element node \"%s\", text: %s\n",cur2->name,cur2->content); }else{ fprintf(stdout, "= element node \"%s\"\n", cur2->name); } cur2 = cur2->next; } } if(node->children != NULL) { print_children(node->children); } node = node->next; } fprintf(stdout,"\n======================- end -=====================\n"); } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/solr_functions_document.c000066400000000000000000000425061374041537100241300ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Israel Ekpo | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" PHP_SOLR_API zend_object *solr_document_object_handler_clone(zval *zobject TSRMLS_DC) { zend_object *old_object; zend_object *new_object; solr_document_t *doc_entry, *old_doc_entry; long document_index = SOLR_UNIQUE_DOCUMENT_INDEX(); old_object = Z_OBJ_P(zobject); new_object = zend_objects_new(old_object->ce); zend_objects_clone_members(new_object, old_object); if (solr_fetch_document_entry(zobject, &old_doc_entry TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Clone Failed: Unable to fetch document entry of the source document"); } doc_entry = solr_init_document(document_index); ZVAL_LONG(&(new_object->properties_table[0]), document_index) /* Add the document entry to the directory of documents */ doc_entry->field_count = old_doc_entry->field_count; doc_entry->document_boost = old_doc_entry->document_boost; zend_hash_copy(doc_entry->fields, old_doc_entry->fields, (copy_ctor_func_t) field_copy_constructor); zend_hash_copy(doc_entry->children, old_doc_entry->children, (copy_ctor_func_t) zval_add_ref); return new_object; } PHP_SOLR_API void field_copy_constructor_ex(solr_field_list_t **original_field_queue_ptr) { solr_field_list_t *original_field_queue = *original_field_queue_ptr; solr_field_value_t *ptr = original_field_queue->head; if (ptr == NULL) { return; } solr_field_list_t *new_field_queue = (solr_field_list_t *) pemalloc(sizeof(solr_field_list_t), SOLR_DOCUMENT_FIELD_PERSISTENT); new_field_queue->count = 0L; new_field_queue->field_name = (solr_char_t *) pestrdup((char *) (original_field_queue)->field_name, SOLR_DOCUMENT_FIELD_PERSISTENT); new_field_queue->head = NULL; new_field_queue->last = NULL; new_field_queue->field_boost = original_field_queue->field_boost; while(ptr != NULL) { if (solr_document_insert_field_value(new_field_queue, ptr->field_value, 0) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to insert field value"); } ptr = ptr->next; } *original_field_queue_ptr = new_field_queue; } /* {{{ void field_copy_constructor_zv(zval *field_queue_zv) */ PHP_SOLR_API void field_copy_constructor_zv(zval *field_queue_zv) { solr_field_list_t *original_field_queue = NULL; original_field_queue = Z_PTR_P(field_queue_zv); field_copy_constructor_ex(&original_field_queue); ZVAL_PTR(field_queue_zv, original_field_queue); } /* }}} */ /* {{{ PHP_SOLR_API int solr_document_insert_field_value(solr_field_list_t *queue, const solr_char_t *field_value, double field_boost) */ PHP_SOLR_API int solr_document_insert_field_value(solr_field_list_t *queue, const solr_char_t *field_value, double field_boost) { solr_field_value_t *new_entry = (solr_field_value_t *) pemalloc(sizeof(solr_field_value_t), SOLR_DOCUMENT_FIELD_PERSISTENT); if (new_entry == NULL) { return FAILURE; } new_entry->field_value = (solr_char_t *) pestrdup((char *) field_value, SOLR_DOCUMENT_FIELD_PERSISTENT); if (new_entry->field_value == NULL) { return FAILURE; } new_entry->next = NULL; if (queue->head == NULL) { /* This is the first and only item in the field list */ queue->head = new_entry; queue->last = new_entry; /* Update the field boost value */ if (field_boost > 0.0) { queue->field_boost = field_boost; } } else { /* There are already entries in the list. */ /* Append to the end of the queue */ queue->last->next = new_entry; /* Set the last item in the queue to the latest entry */ queue->last = new_entry; /* Update the field boost value */ if (field_boost > 0.0) { if (queue->field_boost > 0.0) { queue->field_boost *= field_boost; } else { queue->field_boost = field_boost; } } } queue->count++; return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API solr_document_t *solr_init_document(long int document_index) * create and allocate a solr_document_t with the specified index */ PHP_SOLR_API solr_document_t *solr_init_document(long int document_index) { uint nSize = SOLR_INITIAL_HASH_TABLE_SIZE; solr_document_t *doc_ptr = NULL; solr_document_t *doc_entry; #ifdef PHP_7 doc_entry = pemalloc(sizeof(solr_document_t), SOLR_DOCUMENT_PERSISTENT); #endif doc_entry->document_index = document_index; doc_entry->field_count = 0L; doc_entry->document_boost = 0.0f; /* Allocated memory for the fields HashTable using fast cache for HashTables */ ALLOC_HASHTABLE(doc_entry->fields); ALLOC_HASHTABLE(doc_entry->children); /* Initializing the hash table used for storing fields in this SolrDocument */ zend_hash_init(doc_entry->fields, nSize, NULL, (dtor_func_t) solr_destroy_field_list_ht_dtor, SOLR_DOCUMENT_FIELD_PERSISTENT); zend_hash_init(doc_entry->children, nSize, NULL, ZVAL_PTR_DTOR, SOLR_DOCUMENT_FIELD_PERSISTENT); /* Let's check one more time before insert into the HashTable */ if (zend_hash_index_exists(SOLR_GLOBAL(documents), document_index)) { /* todo call dtor ? */ pefree(doc_entry->fields, SOLR_DOCUMENT_FIELD_PERSISTENT); pefree(doc_entry->children, SOLR_DOCUMENT_FIELD_PERSISTENT); return NULL; } /* Add the document entry to the directory of documents */ doc_ptr = zend_hash_index_update_ptr(SOLR_GLOBAL(documents), document_index, (void *) doc_entry); /* Keep track of how many SolrDocument instances we currently have */ SOLR_GLOBAL(document_count)++; return doc_ptr; } /* }}} */ /* {{{ PHP_SOLR_API solr_document_t *solr_input_doc_ctor(zval *objptr) * constructor populate/allocate the new document after object instantiation * and allocates hashtables for fields and children */ PHP_SOLR_API solr_document_t *solr_input_doc_ctor(zval *objptr) { ulong document_index = SOLR_UNIQUE_DOCUMENT_INDEX(); solr_document_t *solr_doc = NULL; if ((solr_doc = solr_init_document(document_index)) == NULL) { return NULL; } /* Set the value of the internal id property */ zend_update_property_long(solr_ce_SolrInputDocument, objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, document_index TSRMLS_CC); /* Overriding the default object handlers */ Z_OBJ_HT_P(objptr) = &solr_input_document_object_handlers; return solr_doc; } /* }}} */ /* {{{ PHP_SOLR_API void solr_destroy_document_zv(zval *document) * destory a solr_document within a zval (ZE 3) */ PHP_SOLR_API void solr_destroy_document_zv(zval *document) { solr_document_t *doc_entry = (solr_document_t *) Z_PTR_P(document); solr_destroy_document_ex(doc_entry); pefree(doc_entry, SOLR_DOCUMENT_PERSISTENT); } /* }}} */ /* {{{ void solr_destroy_document(void *document) * destory a solr_document_t */ PHP_SOLR_API void solr_destroy_document_ex(solr_document_t *doc_entry) { /* Release all the field_lists one at a time with solr_destroy_field_list */ zend_hash_destroy(doc_entry->fields); /* Deallocate memory for the fields HashTable */ pefree(doc_entry->fields, SOLR_DOCUMENT_FIELD_PERSISTENT); if (doc_entry->children) { zend_hash_destroy(doc_entry->children); pefree(doc_entry->children, SOLR_DOCUMENT_FIELD_PERSISTENT); } } /* }}} */ PHP_SOLR_API void solr_destroy_field_list_ht_dtor(zval *zv_field_entry) { solr_field_list_t *field_entry = Z_PTR_P(zv_field_entry); solr_destroy_field_list(field_entry); } /* {{{ void solr_destroy_field_list(solr_field_list_t **field_entry_ptr) */ PHP_SOLR_API void solr_destroy_field_list(solr_field_list_t *field_entry) { solr_field_value_t *tmp = NULL; solr_field_value_t *current_field_value = field_entry->head; /* Go through the list and free all the values */ while(current_field_value != NULL) { tmp = current_field_value->next; pefree(current_field_value->field_value, SOLR_DOCUMENT_FIELD_PERSISTENT); pefree(current_field_value, SOLR_DOCUMENT_FIELD_PERSISTENT); current_field_value = tmp; } field_entry->head = NULL; field_entry->last = NULL; pefree(field_entry->field_name, SOLR_DOCUMENT_FIELD_PERSISTENT); pefree(field_entry, SOLR_DOCUMENT_FIELD_PERSISTENT); } /* }}} */ /* Comparison functions for field entries */ /* {{{ int solr_compare_field_name(const void *a, const void *b TSRMLS_DC) */ PHP_SOLR_API int solr_compare_field_name(const void *a, const void *b TSRMLS_DC) { #ifdef PHP_7 const Bucket *x = (Bucket *) a; const Bucket *y = (Bucket *) b; #else const Bucket *x = *((Bucket **) a); const Bucket *y = *((Bucket **) b); #endif const solr_field_list_t *first = (solr_field_list_t *) Z_PTR(x->val); const solr_field_list_t *second = (solr_field_list_t *) Z_PTR(y->val); const int diff = strcmp((char *) first->field_name, (char *) second->field_name); const int result = ((diff > 0) ? 1 : ((diff < 0) ? -1 : 0)); return result; } /* }}} */ /* {{{ int solr_rcompare_field_name(const void *a, const void *b TSRMLS_DC) */ PHP_SOLR_API int solr_rcompare_field_name(const void *a, const void *b TSRMLS_DC) { return (solr_compare_field_name(a, b TSRMLS_CC) * -1); } /* }}} */ /* {{{ int solr_compare_field_value_count(const void *a, const void *b TSRMLS_DC) */ PHP_SOLR_API int solr_compare_field_value_count(const void *a, const void *b TSRMLS_DC) { #ifdef PHP_7 const Bucket *x = (Bucket *) a; const Bucket *y = (Bucket *) b; #else const Bucket *x = *((Bucket **) a); const Bucket *y = *((Bucket **) b); #endif const solr_field_list_t *first = (solr_field_list_t *) Z_PTR(x->val); const solr_field_list_t *second = (solr_field_list_t *) Z_PTR(y->val); const int diff = first->count - second->count; const int result = ((diff > 0) ? 1 : ((diff < 0) ? -1 : 0)); return result; } /* }}} */ /* {{{ int solr_rcompare_field_value_count(const void *a, const void *b TSRMLS_DC) */ PHP_SOLR_API int solr_rcompare_field_value_count(const void *a, const void *b TSRMLS_DC) { return (solr_compare_field_value_count(a, b TSRMLS_CC) * -1); } /* }}} */ /* {{{ int solr_compare_field_boost_value(const void *a, const void *b TSRMLS_DC) */ PHP_SOLR_API int solr_compare_field_boost_value(const void *a, const void *b TSRMLS_DC) { #ifdef PHP_7 const Bucket *x = (Bucket *) a; const Bucket *y = (Bucket *) b; #else const Bucket *x = *((Bucket **) a); const Bucket *y = *((Bucket **) b); #endif const solr_field_list_t *first = (solr_field_list_t *) Z_PTR(x->val); const solr_field_list_t *second = (solr_field_list_t *) Z_PTR(y->val); const double diff = first->field_boost - second->field_boost; const int result = ((diff > 0.0) ? 1 : ((diff < 0.0) ? -1 : 0)); return result; } /* }}} */ /* {{{ int solr_rcompare_field_boost_value(const void *a, const void *b TSRMLS_DC) */ PHP_SOLR_API int solr_rcompare_field_boost_value(const void *a, const void *b TSRMLS_DC) { return (solr_compare_field_boost_value(a, b TSRMLS_CC) * -1); } /* }}} */ /* {{{ PHP_SOLR_API void solr_create_document_field_object(solr_field_list_t *field_values, zval **field_obj TSRMLS_DC) */ PHP_SOLR_API void solr_create_document_field_object(solr_field_list_t *field_values, zval **field_obj TSRMLS_DC) { zval *doc_field = *field_obj; solr_field_value_t *curr_ptr = NULL; zval field_values_array_tmp; zval *field_values_array = &field_values_array_tmp; array_init(field_values_array); curr_ptr = field_values->head; while(curr_ptr != NULL) { solr_char_t *current_value = curr_ptr->field_value; add_next_index_string(field_values_array, current_value); curr_ptr = curr_ptr->next; } object_init_ex(doc_field, solr_ce_SolrDocumentField); zend_update_property_string(solr_ce_SolrDocumentField, doc_field, SOLR_FIELD_NAME_PROPERTY_NAME, sizeof(SOLR_FIELD_NAME_PROPERTY_NAME)-1, field_values->field_name TSRMLS_CC); zend_update_property_double(solr_ce_SolrDocumentField, doc_field, SOLR_FIELD_BOOST_PROPERTY_NAME, sizeof(SOLR_FIELD_BOOST_PROPERTY_NAME)-1, field_values->field_boost TSRMLS_CC); zend_update_property(solr_ce_SolrDocumentField, doc_field, SOLR_FIELD_VALUES_PROPERTY_NAME, sizeof(SOLR_FIELD_VALUES_PROPERTY_NAME)-1, field_values_array TSRMLS_CC); zval_ptr_dtor(field_values_array); Z_OBJ_HT_P(doc_field) = &solr_document_field_handlers; } /* }}} */ /* {{{ PHP_SOLR_API void solr_create_document_field_object(solr_field_list_t *field_values, zval **field_obj TSRMLS_DC) constructs the element when adding a document to the index */ PHP_SOLR_API void solr_add_doc_node(xmlNode *root_node, solr_document_t *doc_entry TSRMLS_DC) { HashTable *document_fields = NULL; xmlNode *solr_doc_node = NULL; document_fields = doc_entry->fields; solr_doc_node = xmlNewChild(root_node, NULL, (xmlChar *) "doc", NULL); if (doc_entry->document_boost > 0.0f) { auto char tmp_buffer[256]; /* Scratch pad for converting numeric values to strings */ memset(tmp_buffer, 0, sizeof(tmp_buffer)); php_gcvt(doc_entry->document_boost, EG(precision), '.', 'e' , tmp_buffer); xmlNewProp(solr_doc_node, (xmlChar *) "boost", (xmlChar *) tmp_buffer); } solr_generate_document_xml_from_fields(solr_doc_node, document_fields TSRMLS_CC); if (zend_hash_num_elements(doc_entry->children) > 0) { SOLR_HASHTABLE_FOR_LOOP(doc_entry->children) { zval *doc_obj = NULL; solr_document_t *child_doc_entry = NULL; doc_obj = zend_hash_get_current_data(doc_entry->children); if (solr_fetch_document_entry(doc_obj, &child_doc_entry TSRMLS_CC) == SUCCESS) { solr_add_doc_node(solr_doc_node, child_doc_entry TSRMLS_CC); } } } } /* }}} */ /* {{{ static void solr_generate_document_xml_from_fields(xmlNode *solr_doc_node, HashTable *document_fields) */ PHP_SOLR_API void solr_generate_document_xml_from_fields(xmlNode *solr_doc_node, HashTable *document_fields TSRMLS_DC) { xmlDoc *doc_ptr = solr_doc_node->doc; SOLR_HASHTABLE_FOR_LOOP(document_fields) { solr_char_t *doc_field_name; solr_field_value_t *doc_field_value; solr_field_list_t *field = NULL; zend_bool is_first_value = 1; /* Turn on first value flag */ field = (solr_field_list_t *)zend_hash_get_current_data_ptr(document_fields); doc_field_name = field->field_name; doc_field_value = field->head; /* Loop through all the values for this field */ while(doc_field_value != NULL) { xmlChar *escaped_field_value = xmlEncodeEntitiesReentrant(doc_ptr, (xmlChar *) doc_field_value->field_value); xmlNode *solr_field_node = xmlNewChild(solr_doc_node, NULL, (xmlChar *) "field", escaped_field_value); xmlNewProp(solr_field_node, (xmlChar *) "name", (xmlChar *) doc_field_name); /* Set the boost attribute if this is the first value */ if (is_first_value && field->field_boost > 0.0f) { auto char tmp_boost_value_buffer[256]; memset(tmp_boost_value_buffer, 0, sizeof(tmp_boost_value_buffer)); php_gcvt(field->field_boost, EG(precision), '.', 'e' , tmp_boost_value_buffer); xmlNewProp(solr_field_node, (xmlChar *) "boost", (xmlChar *) tmp_boost_value_buffer); is_first_value = 0; /* Turn off the flag */ } /* Release the memory allocated by xmlEncodeEntitiesReentrant */ xmlFree(escaped_field_value); /* Grab the next value for this field if any */ doc_field_value = doc_field_value->next; } /* while(doc_field_value != NULL) */ } /* SOLR_HASHTABLE_FOR_LOOP(document_fields) */ } /* }}} */ PHP_SOLR_API void solr_document_get_field_names(INTERNAL_FUNCTION_PARAMETERS) { solr_document_t *doc_entry = NULL; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(getThis(), &doc_entry TSRMLS_CC) == SUCCESS) { HashTable *fields_ht = doc_entry->fields; array_init(return_value); SOLR_HASHTABLE_FOR_LOOP(fields_ht) { solr_field_list_t *field = NULL; field = zend_hash_get_current_data_ptr(fields_ht); add_next_index_string(return_value, (char *) field->field_name); } return; } RETURN_FALSE; } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/solr_functions_helpers.c000066400000000000000000001500501374041537100237460ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" #if !(PHP_MAJOR_VERSION==5 && PHP_MINOR_VERSION==2) ZEND_EXTERN_MODULE_GLOBALS(json) #endif /** ************************************************************************ **/ /** FUNCTIONS FOR DECLARING CONSTANTS **/ /** ************************************************************************ **/ /* {{{ void solr_extension_register_constants(int type, int module_number TSRMLS_DC) */ PHP_SOLR_API void solr_extension_register_constants(int type, int module_number TSRMLS_DC) { REGISTER_LONG_CONSTANT("SOLR_MAJOR_VERSION", PHP_SOLR_MAJOR_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SOLR_MINOR_VERSION", PHP_SOLR_MINOR_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SOLR_PATCH_VERSION", PHP_SOLR_PATCH_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("SOLR_EXTENSION_VERSION", PHP_SOLR_DOTTED_VERSION, CONST_CS | CONST_PERSISTENT); } /* }}} */ /* {{{ void solr_document_register_class_constants(zend_class_entry * ce TSRMLS_DC) */ PHP_SOLR_API void solr_document_register_class_constants(zend_class_entry *ce TSRMLS_DC) { zend_declare_class_constant_long(ce, "SORT_DEFAULT", sizeof("SORT_DEFAULT")-1, SOLR_SORT_ASC TSRMLS_CC); zend_declare_class_constant_long(ce, "SORT_ASC", sizeof("SORT_ASC")-1, SOLR_SORT_ASC TSRMLS_CC); zend_declare_class_constant_long(ce, "SORT_DESC", sizeof("SORT_DESC")-1, SOLR_SORT_DESC TSRMLS_CC); zend_declare_class_constant_long(ce, "SORT_FIELD_NAME", sizeof("SORT_FIELD_NAME")-1, SOLR_SORT_FIELD_NAME TSRMLS_CC); zend_declare_class_constant_long(ce, "SORT_FIELD_VALUE_COUNT", sizeof("SORT_FIELD_VALUE_COUNT")-1, SOLR_SORT_FIELD_VALUE_COUNT TSRMLS_CC); zend_declare_class_constant_long(ce, "SORT_FIELD_BOOST_VALUE", sizeof("SORT_FIELD_BOOST_VALUE")-1, SOLR_SORT_FIELD_BOOST_VALUE TSRMLS_CC); } /* }}} */ /* {{{ void solr_collapse_function_register_class_constants(zend_class_entry * ce TSRMLS_DC) */ PHP_SOLR_API void solr_collapse_function_register_class_constants(zend_class_entry *ce TSRMLS_DC) { zend_declare_class_constant_string(ce, "NULLPOLICY_IGNORE", sizeof("NULLPOLICY_IGNORE")-1, "ignore" TSRMLS_CC); zend_declare_class_constant_string(ce, "NULLPOLICY_EXPAND", sizeof("NULLPOLICY_EXPAND")-1, "expand" TSRMLS_CC); zend_declare_class_constant_string(ce, "NULLPOLICY_COLLAPSE", sizeof("NULLPOLICY_COLLAPSE")-1, "collapse" TSRMLS_CC); } /* }}} */ /* {{{ void solr_client_register_class_constants(zend_class_entry *ce TSRMLS_DC) */ PHP_SOLR_API void solr_client_register_class_constants(zend_class_entry *ce TSRMLS_DC) { zend_declare_class_constant_long(ce, "SEARCH_SERVLET_TYPE", sizeof("SEARCH_SERVLET_TYPE")-1, SOLR_SERVLET_TYPE_SEARCH TSRMLS_CC); zend_declare_class_constant_long(ce, "UPDATE_SERVLET_TYPE", sizeof("UPDATE_SERVLET_TYPE")-1, SOLR_SERVLET_TYPE_UPDATE TSRMLS_CC); zend_declare_class_constant_long(ce, "THREADS_SERVLET_TYPE", sizeof("THREADS_SERVLET_TYPE")-1, SOLR_SERVLET_TYPE_THREADS TSRMLS_CC); zend_declare_class_constant_long(ce, "PING_SERVLET_TYPE", sizeof("PING_SERVLET_TYPE")-1, SOLR_SERVLET_TYPE_PING TSRMLS_CC); zend_declare_class_constant_long(ce, "TERMS_SERVLET_TYPE", sizeof("TERMS_SERVLET_TYPE")-1, SOLR_SERVLET_TYPE_TERMS TSRMLS_CC); zend_declare_class_constant_long(ce, "SYSTEM_SERVLET_TYPE", sizeof("SYSTEM_SERVLET_TYPE")-1, SOLR_SERVLET_TYPE_SYSTEM TSRMLS_CC); zend_declare_class_constant_string(ce, "DEFAULT_SEARCH_SERVLET", sizeof("DEFAULT_SEARCH_SERVLET")-1, SOLR_DEFAULT_SEARCH_SERVLET TSRMLS_CC); zend_declare_class_constant_string(ce, "DEFAULT_UPDATE_SERVLET", sizeof("DEFAULT_UPDATE_SERVLET")-1, SOLR_DEFAULT_UPDATE_SERVLET TSRMLS_CC); zend_declare_class_constant_string(ce, "DEFAULT_THREADS_SERVLET", sizeof("DEFAULT_THREADS_SERVLET")-1, SOLR_DEFAULT_THREADS_SERVLET TSRMLS_CC); zend_declare_class_constant_string(ce, "DEFAULT_PING_SERVLET", sizeof("DEFAULT_PING_SERVLET")-1, SOLR_DEFAULT_PING_SERVLET TSRMLS_CC); zend_declare_class_constant_string(ce, "DEFAULT_TERMS_SERVLET", sizeof("DEFAULT_TERMS_SERVLET")-1, SOLR_DEFAULT_TERMS_SERVLET TSRMLS_CC); zend_declare_class_constant_string(ce, "DEFAULT_SYSTEM_SERVLET", sizeof("DEFAULT_SYSTEM_SERVLET")-1, SOLR_DEFAULT_SYSTEM_SERVLET TSRMLS_CC); } /* }}} */ /* {{{ void solr_response_register_class_properties(zend_class_entry *ce TSRMLS_DC) */ PHP_SOLR_API void solr_response_register_class_properties(zend_class_entry *ce TSRMLS_DC) { zend_declare_property_long(ce, "http_status", sizeof("http_status")-1, 0L, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_long(ce, "parser_mode", sizeof("parser_mode")-1, 0L, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_bool(ce, "success", sizeof("success")-1, 0L, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, "response_writer", sizeof("response_writer")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, "http_status_message", sizeof("http_status_message")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, "http_request_url", sizeof("http_request_url")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, "http_raw_request_headers", sizeof("http_raw_request_headers")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, "http_raw_request", sizeof("http_raw_request")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, "http_raw_response_headers", sizeof("http_raw_response_headers")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, "http_raw_response", sizeof("http_raw_response")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, "http_digested_response", sizeof("http_digested_response")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED TSRMLS_CC); } /* }}} */ /* {{{ void solr_exception_register_class_properties(zend_class_entry *ce TSRMLS_DC) */ PHP_SOLR_API void solr_exception_register_class_properties(zend_class_entry *ce TSRMLS_DC) { zend_declare_property_long(ce, SOLR_SOURCELINE_NO_PROPERTY_NAME, sizeof(SOLR_SOURCELINE_NO_PROPERTY_NAME)-1, __LINE__, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, SOLR_SOURCEFILE_PROPERTY_NAME, sizeof(SOLR_SOURCEFILE_PROPERTY_NAME)-1, __FILE__, ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_string(ce, SOLR_ZIFNAME_PROPERTY_NAME, sizeof(SOLR_ZIFNAME_PROPERTY_NAME)-1, (char *) __func__, ZEND_ACC_PROTECTED TSRMLS_CC); } /* }}} */ /* {{{ void solr_response_register_class_constants(zend_class_entry *ce TSRMLS_DC) */ PHP_SOLR_API void solr_response_register_class_constants(zend_class_entry *ce TSRMLS_DC) { zend_declare_class_constant_long(ce, "PARSE_SOLR_OBJ", sizeof("PARSE_SOLR_OBJ")-1, 0L TSRMLS_CC); zend_declare_class_constant_long(ce, "PARSE_SOLR_DOC", sizeof("PARSE_SOLR_DOC")-1, 1L TSRMLS_CC); } /* }}} */ /* {{{ void solr_query_register_class_constants(zend_class_entry *ce TSRMLS_DC) */ PHP_SOLR_API void solr_query_register_class_constants(zend_class_entry *ce TSRMLS_DC) { zend_declare_class_constant_long(ce, "ORDER_ASC", sizeof("ORDER_ASC")-1, SOLR_SORT_DIR_ASC TSRMLS_CC); zend_declare_class_constant_long(ce, "ORDER_DESC", sizeof("ORDER_DESC")-1, SOLR_SORT_DIR_DESC TSRMLS_CC); zend_declare_class_constant_long(ce, "FACET_SORT_INDEX", sizeof("FACET_SORT_INDEX")-1, 0L TSRMLS_CC); zend_declare_class_constant_long(ce, "FACET_SORT_COUNT", sizeof("FACET_SORT_COUNT")-1, 1L TSRMLS_CC); zend_declare_class_constant_long(ce, "TERMS_SORT_INDEX", sizeof("TERMS_SORT_INDEX")-1, 0L TSRMLS_CC); zend_declare_class_constant_long(ce, "TERMS_SORT_COUNT", sizeof("TERMS_SORT_COUNT")-1, 1L TSRMLS_CC); } /* }}} */ /** ************************************************************************ **/ /** UTILITY FUNCTIONS **/ /** ************************************************************************ **/ /* {{{ int solr_hashtable_get_new_index(HashTable *ht TSRMLS_DC) Retrieves a unique index for this HashTable */ PHP_SOLR_API int solr_hashtable_get_new_index(HashTable *ht TSRMLS_DC) { int new_index = SOLR_GET_RANDOM_NUMBER(); /* If the key already exists in the HashTable, create another one. */ while(zend_hash_index_exists(ht, new_index)) { new_index = SOLR_GET_RANDOM_NUMBER(); } return new_index; } /* }}} */ /* {{{ static inline int solr_fetch_document_entry(zval *objptr, solr_document_t **doc_entry TSRMLS_DC) Retrieves a Document from the HashTable */ PHP_SOLR_API int solr_fetch_document_entry(zval *objptr, solr_document_t **doc_entry TSRMLS_DC) { zval *rv = NULL; zval *id = zend_read_property(Z_OBJCE_P(objptr), objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, 1, rv); /* Retrieving the value of the document index from the zval */ long int document_index = Z_LVAL_P(id); *doc_entry = NULL; /* Retrieve the doc_entry from the HashTable */ if ((*doc_entry = (solr_document_t *)zend_hash_index_find_ptr(SOLR_GLOBAL(documents), document_index)) == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Document Index %ld. HashTable index does not exist.", document_index); php_error_docref(NULL TSRMLS_CC, E_WARNING, SOLR_ERROR_1008_MSG, SOLR_FILE_LINE_FUNC); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_fetch_client_entry(zval *objptr, solr_client_t **solr_client TSRMLS_DC) */ PHP_SOLR_API int solr_fetch_client_entry(zval *objptr, solr_client_t **solr_client TSRMLS_DC) { zval rv; zval *id = zend_read_property(solr_ce_SolrClient, objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, 1, &rv); /* Retrieving the value of the client index from the zval */ long int client_index = Z_LVAL_P(id); *solr_client = NULL; /* Retrieve the doc_entry from the HashTable */ if ((*solr_client = zend_hash_index_find_ptr(SOLR_GLOBAL(clients), client_index)) == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid SolrClient Index %ld. HashTable index does not exist.", client_index); php_error_docref(NULL TSRMLS_CC, E_WARNING, SOLR_ERROR_1008_MSG, SOLR_FILE_LINE_FUNC); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_fetch_params_entry(zval *objptr, solr_params_t **solr_params TSRMLS_DC) */ PHP_SOLR_API int solr_fetch_params_entry(zval *objptr, solr_params_t **solr_params TSRMLS_DC) { zval rv; zval *id = zend_read_property(Z_OBJCE_P(objptr), objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, 1, &rv); long int params_index = Z_LVAL_P(id); *solr_params = NULL; if ((*solr_params = zend_hash_index_find_ptr(SOLR_GLOBAL(params), params_index)) == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid SolrParams Index %ld. HashTable index does not exist.", params_index); php_error_docref(NULL TSRMLS_CC, E_WARNING, SOLR_ERROR_1008_MSG, SOLR_FILE_LINE_FUNC); return FAILURE; } return SUCCESS; } /* }}} */ PHP_SOLR_API int solr_fetch_function_entry(zval *objptr, solr_function_t **solr_function TSRMLS_DC) { zval rv; zval *id = zend_read_property(Z_OBJCE_P(objptr), objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, 1, &rv); long int params_index = Z_LVAL_P(id); *solr_function = NULL; if ((*solr_function = zend_hash_index_find_ptr(SOLR_GLOBAL(functions), params_index)) == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid solr_function Index %ld. HashTable index does not exist.", params_index); php_error_docref(NULL TSRMLS_CC, E_WARNING, SOLR_ERROR_1008_MSG, SOLR_FILE_LINE_FUNC); return FAILURE; } return SUCCESS; } /* {{{ PHP_SOLR_API void solr_destroy_function(zval *solr_function) */ PHP_SOLR_API void solr_destroy_function(zval *solr_function) { solr_function_t *function = (solr_function_t *) Z_PTR_P(solr_function); zend_hash_destroy(function->params); pefree(function->params, SOLR_FUNCTIONS_PERSISTENT); #ifdef PHP_7 pefree(function, SOLR_FUNCTIONS_PERSISTENT); #endif } /* }}} */ /* {{{ PHP_SOLR_API xmlDocPtr solr_xml_create_xml_doc(const xmlChar *root_node_name, xmlNode **root_node_ptr) */ PHP_SOLR_API xmlDocPtr solr_xml_create_xml_doc(const xmlChar *root_node_name, xmlNode **root_node_ptr) { xmlNs *ns = NULL; xmlDoc *doc_ptr = xmlNewDoc((xmlChar *) "1.0"); xmlNode *root_node = xmlNewNode(ns, root_node_name); xmlDocSetRootElement(doc_ptr, root_node); if (root_node_ptr) { *root_node_ptr = root_node; } return doc_ptr; } /* }}} */ /** * escapes strings with characters that are part of the Lucene query syntax * * @sbuilder is a solr_string_t pointer used to store the escape char sequence * @unescaped is the unescaped string. It must be null terminated * @unescaped_length is the original length of the unescaped_string */ /* {{{ PHP_SOLR_API void solr_escape_query_chars(solr_string_t *sbuilder, solr_char_t *unescaped, long int unescaped_length) */ PHP_SOLR_API void solr_escape_query_chars(solr_string_t *sbuilder, solr_char_t *unescaped, long int unescaped_length) { register int i = 0; /** * Lucene supports escaping special characters that are part of the query syntax. * * The current list special characters are * + - && || ! ( ) { } [ ] ^ " ~ * ? : \ / * * These characters are part of the query syntax and must be escaped */ for (i = 0; i < unescaped_length; i++) { enter_switchboard : switch(unescaped[i]) { case '\\' : case '+' : case '-' : case '!' : case '(' : case ')' : case ':' : case '/' : case '^' : case '[' : case ']' : case '"' : case '{' : case '}' : case '~' : case '*' : case '?' : case ';' : { solr_string_appendc(sbuilder, '\\'); } break; case '|' : /* || */ { if ('|' == unescaped[i+1]) { solr_string_appendc(sbuilder, '\\'); solr_string_append_const(sbuilder, "||"); i += 2; goto enter_switchboard; } } break; case '&' : /* && */ { if ('&' == unescaped[i+1]) { solr_string_appendc(sbuilder, '\\'); solr_string_append_const(sbuilder, "&&"); i += 2; goto enter_switchboard; } } break; default : /* The current character is not a special character */ { /* Do nothing. Just append the character as is */ } } /* END switch(unescaped[i]) */ solr_string_appendc(sbuilder, unescaped[i]); } /* END for (i = 0; i < unescaped_length; i++) { */ } /* }}} */ /******************************************************************************/ /* SOLR XML RESPONSE DIGEST DATA TYPES AND FUNCTIONS */ /******************************************************************************/ /* {{{ solr_doc_encode_t, solr_php_encode_t, solr_encoding_type_t, solr_php_encode_func_t, solr_document_field_encode_func_t */ typedef enum { SOLR_DOC_ENCODE_START = 0, SOLR_DOC_ENCODE_FIELDS = 1, SOLR_DOC_ENCODE_FIELD = 2, SOLR_DOC_ENCODE_END } solr_doc_encode_t; typedef enum { SOLR_ENCODE_START = 0, SOLR_ENCODE_NULL = 1, SOLR_ENCODE_BOOL = 2, SOLR_ENCODE_INT = 3, SOLR_ENCODE_FLOAT = 4, SOLR_ENCODE_STRING = 5, SOLR_ENCODE_ARRAY = 6, SOLR_ENCODE_OBJECT = 7, SOLR_ENCODE_DOC = 8, SOLR_ENCODE_RESULT = 9, SOLR_ENCODE_END } solr_php_encode_t; typedef enum { SOLR_ENCODE_STANDALONE = 0, SOLR_ENCODE_OBJECT_PROPERTY = 1, SOLR_ENCODE_ARRAY_KEY = 2, SOLR_ENCODE_ARRAY_INDEX = 3 } solr_encoding_type_t; typedef void (*solr_php_encode_func_t)(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); typedef void (*solr_document_field_encode_func_t)(const xmlNode *node, xmlNode *field); /* }}} */ /* {{{ Macros for XML transcoding */ /* Serializes the current XML node */ #define solr_encode_xml_node(__node, __buf, __enc_type, __arr_idx, __mode) solr_encoder_functions[solr_get_xml_type((__node))]((__node),(__buf), (__enc_type), (__arr_idx), (__mode)) #define solr_write_object_closer(__buf) solr_string_append_const((__buf), "}") #define solr_write_array_closer(__buf) solr_string_append_const((__buf), "}") #define solr_write_root_object_closer(__buf) solr_string_append_const((__buf), "}") /* }}} */ /* {{{ static void solr_encode_* prototypes */ static void solr_encode_null(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_bool(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_int(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_float(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_string(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_array(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_object(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_document(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_result(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_document_field_simple(const xmlNode *fieldNode, xmlNode *field); static void solr_encode_document_field_complex(const xmlNode *fieldNode, xmlNode *field); /* }}} */ /* {{{ global variables solr_encoder_functions[], solr_document_field_encoders[] */ static solr_php_encode_func_t solr_encoder_functions[] = { solr_encode_string, solr_encode_null, solr_encode_bool, solr_encode_int, solr_encode_float, solr_encode_string, solr_encode_array, solr_encode_object, solr_encode_document, solr_encode_result, NULL }; static solr_document_field_encode_func_t solr_document_field_encoders[] = { solr_encode_document_field_simple, /* maps to SOLR_SIMPLE_FIELD */ solr_encode_document_field_complex, /* maps to SOLR_COMPLEX_FIELD */ NULL }; /* }}} */ /* {{{ Constants and Macros for handling node types */ #define SOLR_SIMPLE_FIELD 0 #define SOLR_COMPLEX_FIELD 1 #define solr_xml_field_node_type(node) (xmlStrEqual((node)->name, (xmlChar *)"arr")? SOLR_COMPLEX_FIELD : SOLR_SIMPLE_FIELD) #define solr_encode_document_field(field_in, field_out) solr_document_field_encoders[solr_xml_field_node_type((field_in))]((field_in), (field_out)) /* }}} */ /* Used to figure out now many properties or elements there are in an object or an array */ /* {{{ static inline int solr_get_node_size(const xmlNode *data_node) */ static inline int solr_get_node_size(const xmlNode *data_node) { register int size = 0; xmlNode *curr_node = data_node->children; while(curr_node != NULL) { if (XML_ELEMENT_NODE == curr_node->type) { size++; } curr_node = curr_node->next; } return size; } /* }}} */ /* {{{ static inline int solr_get_xml_type(xmlNode *node) */ static inline int solr_get_xml_type(xmlNode *node) { solr_char_t *node_name = (solr_char_t *) node->name; if (!node_name) { return SOLR_ENCODE_STRING; } if (!strcmp(node_name, "str")) { return SOLR_ENCODE_STRING; } else if (!strcmp(node_name, "int") || !strcmp(node_name, "long") || !strcmp(node_name, "short") || !strcmp(node_name, "byte")) { return SOLR_ENCODE_INT; } else if (!strcmp(node_name, "double") || !strcmp(node_name, "float")) { return SOLR_ENCODE_FLOAT; } else if (!strcmp(node_name, "lst")) { return SOLR_ENCODE_OBJECT; } else if (!strcmp(node_name, "arr")) { return SOLR_ENCODE_ARRAY; } else if (!strcmp(node_name, "bool")) { return SOLR_ENCODE_BOOL; } else if (!strcmp(node_name, "null")) { return SOLR_ENCODE_NULL; } else if (!strcmp(node_name, "result")) { return SOLR_ENCODE_RESULT; }else if (!strcmp(node_name, "doc")) { return SOLR_ENCODE_OBJECT; } else { return SOLR_ENCODE_STRING; } } /* }}} */ /* {{{ static inline void solr_write_variable_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) */ static inline void solr_write_variable_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) { switch(enc_type) { case SOLR_ENCODE_OBJECT_PROPERTY : /* fall through */ case SOLR_ENCODE_ARRAY_KEY : { solr_char_t *object_name = "_undefined_property_name"; xmlAttr *name_attr = node->properties; /* get the contents of the name attribute */ if (name_attr) { object_name = (solr_char_t *) solr_xml_get_node_contents(name_attr); } solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, strlen(object_name)); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, object_name, strlen(object_name)); solr_string_append_const(buffer, "\";"); } break; case SOLR_ENCODE_ARRAY_INDEX : { solr_string_append_const(buffer, "i:"); solr_string_append_long(buffer, array_index); solr_string_appendc(buffer, ';'); } break; default : { /* do nothing */ } break; } } /* }}} */ /* {{{ static void solr_write_object_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) */ static void solr_write_object_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) { int size = solr_get_node_size(node); solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "O:10:\"SolrObject\":"); solr_string_append_long(buffer, size); solr_string_append_const(buffer, ":{"); } /* }}} */ /* {{{ static void solr_write_solr_document_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, int size) */ static void solr_write_solr_document_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, int size) { solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "C:12:\"SolrDocument\":"); solr_string_append_long(buffer, size); solr_string_append_const(buffer, ":{"); } /* }}} */ /* {{{ static void solr_write_array_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) */ static void solr_write_array_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) { int size = solr_get_node_size(node); solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "a:"); solr_string_append_long(buffer, size); solr_string_append_const(buffer, ":{"); } /* }}} */ static void solr_serialize_solr_document(const xmlNode *node, solr_string_t *dest); static void solr_encode_solr_document_children(const xmlNode *node, xmlNode* builder_node, int child_docs_found); static void solr_encode_solr_document(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_serialize_solr_document(const xmlNode *node, solr_string_t *dest) { xmlChar *doc_txt_buffer = NULL; int doc_txt_len = 0; xmlNode *solr_document_node = NULL; xmlDoc *doc_ptr = solr_xml_create_xml_doc((xmlChar *) "solr_document", &solr_document_node); xmlNode *fields_node = xmlNewChild(solr_document_node, NULL, (xmlChar *) "fields", NULL); xmlNode *curr_node = node->children; int format = 1; int child_docs_found = 0; while(curr_node != NULL) { if (XML_ELEMENT_NODE == curr_node->type) { if (strcmp((const char *)curr_node->name, "doc") == 0) { child_docs_found++; } else { xmlNode *field = xmlNewChild(fields_node, NULL, (xmlChar *)"field", NULL); solr_encode_document_field(curr_node, field); } } curr_node = curr_node->next; } if (child_docs_found > 0) { solr_encode_solr_document_children(node, solr_document_node, child_docs_found); } /* We have written all the fields to the document */ /* Dumping the document from memory to the buffer */ xmlDocDumpFormatMemoryEnc(doc_ptr, &doc_txt_buffer, &doc_txt_len, "UTF-8", format); solr_string_appends_ex(dest, (solr_char_t *)doc_txt_buffer, doc_txt_len); xmlFreeDoc(doc_ptr); xmlFree(doc_txt_buffer); } /* {{{ static void solr_encode_document_children(const xmlNode *node, solr_string_t* buffer, int child_docs_found, long int parse_mode) encodes the doc/doc child/nested documents */ static void solr_encode_solr_document_children(const xmlNode *node, xmlNode* builder_node, int child_docs_found) { int current_index = 0; xmlXPathContext *xpathctxt = NULL; const xmlChar *xpath_expression = (xmlChar *) "child::doc"; xmlXPathObject *xpathObj = NULL; xmlNodeSet *result = NULL; xmlNode *child_docs_node = NULL; xpathctxt = xmlXPathNewContext(node->doc); xpathctxt->node = (xmlNodePtr) node; xpathObj = xmlXPathEval(xpath_expression, xpathctxt); result = xpathObj->nodesetval; child_docs_found = result->nodeNr; child_docs_node = xmlNewChild(builder_node, NULL, (xmlChar *)"child_docs", NULL); for (current_index=0; current_index < child_docs_found; current_index++) { zend_string *encoded_str = NULL; solr_string_t tmp_buffer; solr_string_t tmp_s_buffer; memset(&tmp_buffer, 0, sizeof(solr_string_t)); memset(&tmp_s_buffer, 0, sizeof(solr_string_t)); solr_serialize_solr_document(result->nodeTab[current_index], &tmp_buffer); solr_string_append_const(&tmp_s_buffer, "C:12:\"SolrDocument\":"); solr_string_append_long(&tmp_s_buffer, tmp_buffer.len); solr_string_append_const(&tmp_s_buffer, ":{"); solr_string_appends_ex(&tmp_s_buffer, tmp_buffer.str, tmp_buffer.len); solr_write_object_closer(&tmp_s_buffer); encoded_str = php_base64_encode((const unsigned char*)tmp_s_buffer.str, tmp_s_buffer.len); xmlNewChild(child_docs_node, NULL, (const xmlChar *) "dochash", (xmlChar *)encoded_str->val); solr_string_free_ex(&tmp_buffer); solr_string_free_ex(&tmp_s_buffer); zend_string_free(encoded_str); } } /* }}} */ /** * * The @enc_type parameter must be SOLR_ENCODE_ARRAY_INDEX */ /* {{{ static void solr_encode_solr_document(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_solr_document(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { solr_string_t doc_serialized_buffer; memset(&doc_serialized_buffer, 0, sizeof(solr_string_t)); solr_serialize_solr_document(node, &doc_serialized_buffer); solr_write_solr_document_opener(NULL, buffer, enc_type, array_index, doc_serialized_buffer.len); solr_string_appends(buffer, (char *) doc_serialized_buffer.str, doc_serialized_buffer.len); solr_write_object_closer(buffer); solr_string_free(&doc_serialized_buffer); } /* }}} */ /* {{{ static void solr_write_object_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) */ static void solr_write_object_opener_child_doc(const xmlNode *node, int num_child_docs ,solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) { int size = solr_get_node_size(node) - num_child_docs + 1; solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "O:10:\"SolrObject\":"); solr_string_append_long(buffer, size); solr_string_append_const(buffer, ":{"); } /* }}} */ /* {{{ static void solr_encode_document_children(const xmlNode *node, solr_string_t* buffer, int child_docs_found, long int parse_mode) encodes the doc/doc child/nested documents ONLY FOR SolrObject */ static void solr_encode_document_children(const xmlNode *node, solr_string_t* buffer, int child_docs_found, long int parse_mode) { int current_index = 0; xmlXPathContext *xpathctxt = NULL; const xmlChar *xpath_expression = (xmlChar *) "child::doc"; xmlXPathObject *xpathObj = NULL; xmlNodeSet *result = NULL; solr_php_encode_func_t document_encoder_functions[] = { solr_encode_document, solr_encode_solr_document, NULL }; solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, sizeof("_childDocuments_")-1); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, "_childDocuments_", sizeof("_childDocuments_")-1); solr_string_append_const(buffer, "\";"); solr_string_append_const(buffer, "a:"); solr_string_append_long(buffer, child_docs_found); solr_string_append_const(buffer, ":{"); xpathctxt = xmlXPathNewContext(node->doc); xpathctxt->node = (xmlNodePtr) node; xpathObj = xmlXPathEval(xpath_expression, xpathctxt); result = xpathObj->nodesetval; child_docs_found = result->nodeNr; for (current_index=0; current_index < child_docs_found; current_index++) { document_encoder_functions[parse_mode](result->nodeTab[current_index], buffer, SOLR_ENCODE_ARRAY_INDEX, current_index, parse_mode); } solr_write_array_closer(buffer); } /* }}} */ /* {{{ static void solr_encode_document(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) encodes/serializes the element result/doc */ static void solr_encode_document(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { xmlNode *curr_node = NULL; int child_docs_found = 0; solr_string_t inner_buffer; memset(&inner_buffer, 0, sizeof(solr_string_t)); curr_node = node->children; while(curr_node != NULL) { if (XML_ELEMENT_NODE == curr_node->type) { if (strcmp((const char*) curr_node->name, "doc") == 0) { /* skip doc/doc elements to be processed later */ child_docs_found++; } else { solr_encode_xml_node(curr_node, &inner_buffer, SOLR_ENCODE_OBJECT_PROPERTY, 0L, parse_mode); } } curr_node = curr_node->next; } if (child_docs_found > 0){ solr_encode_document_children(node, &inner_buffer, child_docs_found, parse_mode); /** * write and calculate proper object opener * because the object number of properties depends on whether there are child documents involved */ solr_write_object_opener_child_doc(node, child_docs_found, buffer, enc_type, array_index); } else { solr_write_object_opener(node, buffer, enc_type, array_index); } solr_string_appends_ex(buffer, inner_buffer.str, inner_buffer.len); solr_write_object_closer(buffer); solr_string_free_ex(&inner_buffer); } /* }}} */ /** * Handles simple data types like strings, integers, booleans etc. */ /* {{{ static void solr_encode_document_field_simple(const xmlNode *fieldNode, xmlNode *field) */ static void solr_encode_document_field_simple(const xmlNode *fieldNode, xmlNode *field) { xmlChar *fieldname = solr_xml_get_node_contents(fieldNode->properties); xmlChar *field_value = xmlEncodeEntitiesReentrant(fieldNode->doc, solr_xml_get_node_contents(fieldNode)); xmlNewChild(field, NULL, (xmlChar *) "field_value", field_value); xmlNewProp(field, (xmlChar *) "name", fieldname); xmlFree(field_value); } /* }}} */ /* Handles complex data types like arrays */ /* {{{ static void solr_encode_document_field_complex(const xmlNode *fieldNode, xmlNode *field) */ static void solr_encode_document_field_complex(const xmlNode *fieldNode, xmlNode *field) { xmlChar *fieldname = solr_xml_get_node_contents(fieldNode->properties); xmlNode *current_value = fieldNode->children; while(current_value != NULL) { if (current_value->type == XML_ELEMENT_NODE) { xmlChar *field_value = xmlEncodeEntitiesReentrant(fieldNode->doc, solr_xml_get_node_contents(current_value)); xmlNewChild(field, NULL, (xmlChar *) "field_value", field_value); xmlFree(field_value); } current_value = current_value->next; } xmlNewProp(field, (xmlChar *) "name", fieldname); } /* }}} */ /* {{{ static void solr_encode_result(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_result(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { xmlAttr *properties = node->properties; solr_char_t *object_name = (solr_char_t *) node->name; solr_char_t *num_found = NULL; solr_char_t *start = NULL; solr_char_t *max_score = NULL; solr_php_encode_func_t document_encoder_functions[] = { solr_encode_document, solr_encode_solr_document, NULL }; xmlAttr *curr_prop = properties; xmlXPathContext *xpathctxt = NULL; const xmlChar *xpath_expression = (xmlChar *) "child::doc"; xmlXPathObject *xpathObj = NULL; xmlNodeSet *result = NULL; long int document_count = 0; while(curr_prop != NULL) { if (solr_xml_match_node(curr_prop, "numFound")) { num_found = (solr_char_t *) solr_xml_get_node_contents(curr_prop); } if (solr_xml_match_node(curr_prop, "start")) { start = (solr_char_t *) solr_xml_get_node_contents(curr_prop); } if (solr_xml_match_node(curr_prop, "name")) { object_name = (solr_char_t *) solr_xml_get_node_contents(curr_prop); } if (solr_xml_match_node(curr_prop, "maxScore")) { max_score = (solr_char_t *) solr_xml_get_node_contents(curr_prop); } curr_prop = curr_prop->next; } xpathctxt = xmlXPathNewContext(node->doc); xpathctxt->node = (xmlNodePtr) node; xpathObj = xmlXPathEval(xpath_expression, xpathctxt); result = xpathObj->nodesetval; document_count = result->nodeNr; solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, strlen(object_name)); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, object_name, strlen(object_name)); solr_string_append_const(buffer, "\";"); solr_string_append_const(buffer, "O:10:\"SolrObject\":"); if (max_score) { solr_string_append_long(buffer, 4); /* numFound, start, docs, maxScore properties */ } else { solr_string_append_long(buffer, 3); /* numFound, start, docs properties */ } solr_string_append_const(buffer, ":{"); /* Object Opener for response */ /* Writing the numFound property */ solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, sizeof("numFound")-1); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, "numFound", sizeof("numFound")-1); solr_string_append_const(buffer, "\";"); solr_string_append_const(buffer, "i:"); solr_string_appends(buffer, num_found, solr_strlen(num_found)); solr_string_appendc(buffer, ';'); /* Writing the start property */ solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, sizeof("start")-1); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, "start", sizeof("start")-1); solr_string_append_const(buffer, "\";"); solr_string_append_const(buffer, "i:"); solr_string_appends(buffer, start, solr_strlen(start)); solr_string_appendc(buffer, ';'); /* writing max score property */ if (max_score) { solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, sizeof("maxScore")-1); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, "maxScore", sizeof("maxScore")-1); solr_string_append_const(buffer, "\";"); solr_string_append_const(buffer, "d:"); solr_string_appends(buffer, max_score, solr_strlen(max_score)); solr_string_appendc(buffer, ';'); } /* Writing the docs property */ solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, sizeof("docs")-1); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, "docs", sizeof("docs")-1); solr_string_append_const(buffer, "\";"); if (document_count) { /* Grab all the first /response/result/doc node */ xmlNode *curr_doc = node->children; long int curr_doc_index = 0L; /* Array opener */ solr_string_append_const(buffer, "a:"); solr_string_append_long(buffer, document_count); solr_string_append_const(buffer, ":{"); while(curr_doc != NULL) { /* Absolutely no assumptions. At least for now. */ if (XML_ELEMENT_NODE == curr_doc->type && solr_xml_match_node(curr_doc, "doc")) { /* This is where you decided whether to use SolrDocument or StdClass */ /* parse_mode value of 0 creates SolrObject; 1 creates SolrDocument */ document_encoder_functions[parse_mode](curr_doc, buffer, SOLR_ENCODE_ARRAY_INDEX, curr_doc_index, parse_mode); curr_doc_index++; } curr_doc = curr_doc->next; } solr_write_array_closer(buffer); /* Array closer */ } else { solr_string_append_const(buffer, "b:0;"); /* This means there are no docs */ } solr_write_object_closer(buffer); /* Object closer */ xmlXPathFreeContext(xpathctxt); xmlXPathFreeObject(xpathObj); } /* }}} */ /* {{{ static void solr_encode_null(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_null(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { /* SolrObject should not contain nulls because of how magic functionality is implemented */ solr_write_variable_opener(node, buffer, enc_type, array_index); /* Setting nulls to boolean false */ solr_string_append_const(buffer, "b:0;"); } /* }}} */ /* {{{ static void solr_encode_bool(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_bool(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { solr_char_t *data_value = (solr_char_t *) solr_xml_get_node_contents(node); long int boolean_value = (!strcmp("true", data_value))? 1 : 0; solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "b:"); solr_string_append_long(buffer, boolean_value); solr_string_appendc(buffer, ';'); } /* }}} */ /* {{{ static void solr_encode_int(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_int(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { solr_char_t *data_value = (solr_char_t *) solr_xml_get_node_contents(node); size_t data_value_len = solr_strlen(data_value); solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "i:"); solr_string_appends(buffer, data_value, data_value_len); solr_string_appendc(buffer, ';'); } /* }}} */ /* {{{ static void solr_encode_float(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_float(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { solr_char_t *data_value = (solr_char_t *) solr_xml_get_node_contents(node); size_t data_value_len = solr_strlen(data_value); solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "d:"); if (strcmp(data_value, "NaN" ) == 0) { data_value = (solr_char_t *)"NAN"; } solr_string_appends(buffer, data_value, data_value_len); solr_string_appendc(buffer, ';'); } /* }}} */ /* {{{ static void solr_encode_string(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_string(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { solr_char_t *data_value = (solr_char_t *) solr_xml_get_node_contents(node); size_t data_value_len = solr_strlen(data_value); solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, data_value_len); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, data_value, data_value_len); solr_string_append_const(buffer, "\";"); } /* }}} */ /* {{{ static void solr_encode_array(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_array(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { xmlNode *curr_node = NULL; long int current_index = 0L; solr_write_array_opener(node, buffer, enc_type, array_index); curr_node = node->children; while(curr_node != NULL) { if (XML_ELEMENT_NODE == curr_node->type) { solr_encode_xml_node(curr_node, buffer, SOLR_ENCODE_ARRAY_INDEX, current_index, parse_mode); current_index++; } curr_node = curr_node->next; } solr_write_array_closer(buffer); } /* }}} */ /* {{{ static void solr_encode_object(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_object(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { xmlNode *curr_node = NULL; solr_write_object_opener(node, buffer, enc_type, array_index); curr_node = node->children; while(curr_node != NULL) { if (XML_ELEMENT_NODE == curr_node->type) { solr_encode_xml_node(curr_node, buffer, SOLR_ENCODE_OBJECT_PROPERTY, 0L, parse_mode); } curr_node = curr_node->next; } solr_write_object_closer(buffer); } /* }}} */ /** * Used to digest Xml response messages from Solr * */ /* {{{ PHP_SOLR_API void solr_encode_generic_xml_response(solr_string_t *buffer, const solr_char_t *serialized, int size, long int parse_mode TSRMLS_DC) */ PHP_SOLR_API void solr_encode_generic_xml_response(solr_string_t *buffer, const solr_char_t *serialized, int size, long int parse_mode TSRMLS_DC) { xmlDoc *doc = xmlReadMemory(serialized, size, NULL, "UTF-8", XML_PARSE_RECOVER); xmlNode *root = NULL; if (!doc) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error loading XML document"); return; } root = xmlDocGetRootElement(doc); if (!root) { xmlFreeDoc(doc); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error loading root of XML document"); return; } parse_mode = ((parse_mode < 0L) ? 0L : ((parse_mode > 1L) ? 1L : parse_mode)); solr_encode_object(root, buffer, SOLR_ENCODE_STANDALONE, 0L, parse_mode); if (buffer->len == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error parsing XML document"); } xmlFreeDoc(doc); } /* }}} */ /* {{{ PHP_SOLR_API int solr_is_supported_response_writer(const solr_char_t * response_writer, int length) */ PHP_SOLR_API int solr_is_supported_response_writer(const solr_char_t * response_writer, int length) { if (length < 1) { return 0; } if (0 == strcmp(response_writer, SOLR_PHP_SERIALIZED_RESPONSE_WRITER)) { return 1; } if (0 == strcmp(response_writer, SOLR_XML_RESPONSE_WRITER)) { return 1; } if (0 == strcmp(response_writer, SOLR_JSON_RESPONSE_WRITER)) { return 1; } return 0; } /* }}} */ /* {{{ PHP_SOLR_API solr_char_t *solr_get_json_error_msg(solr_json_error_codes_t error_code) */ PHP_SOLR_API solr_char_t *solr_get_json_error_msg(solr_json_error_codes_t error_code) { switch(error_code) { case SOLR_JSON_ERROR_DEPTH: return "JSON maximum recursion depth was exceeded"; break; case SOLR_JSON_ERROR_STATE_MISMATCH: return "JSON error state mismatch"; break; case SOLR_JSON_ERROR_CTRL_CHAR: return "JSON control character was encountered"; break; case SOLR_JSON_ERROR_SYNTAX: return "JSON syntax error"; break; case SOLR_JSON_ERROR_UTF8: return "JSON UTF8 error"; break; default : return "JSON unknown error"; break; } } /* }}} */ /* {{{ PHP_SOLR_API int solr_json_to_php_native(solr_string_t *buffer, const solr_char_t *json_string, int json_string_length TSRMLS_DC) */ PHP_SOLR_API int solr_json_to_php_native(solr_string_t *buffer, const solr_char_t *json_string, int json_string_length TSRMLS_DC) { /* todo php7 review if we ever need that indirection with ret_val */ /* JSON recursion depth. default is 512 */ long recursion_depth = 1024L; long json_error = 0L; php_serialize_data_t var_hash; smart_str serialize_buffer = {0}; /* return value for the function */ zval json_decode_ret_val, *json_decode_ret_val_ptr; zend_uchar json_decode_ret_val_type = IS_NULL; json_decode_ret_val_ptr = &json_decode_ret_val; php_json_decode(&json_decode_ret_val, (char *) json_string, json_string_length, 1, recursion_depth TSRMLS_CC); json_error = solr_get_json_last_error(TSRMLS_C); /* Why ? todo investigate */ /* solr_string_set(buffer, "i:99;", sizeof("i:99;")); */ if (json_error > 0) { zval_dtor(&json_decode_ret_val); php_error_docref(NULL TSRMLS_CC, E_WARNING, "JSON error. JSON->PHP serialization error"); return (int) json_error; } memset(&var_hash, 0, sizeof(php_serialize_data_t)); PHP_VAR_SERIALIZE_INIT(var_hash); php_var_serialize(&serialize_buffer, &json_decode_ret_val, &var_hash TSRMLS_CC); json_decode_ret_val_type = Z_TYPE_P(json_decode_ret_val_ptr); zval_dtor(&json_decode_ret_val); solr_string_set(buffer, serialize_buffer.s->val, serialize_buffer.s->len); PHP_VAR_SERIALIZE_DESTROY(var_hash); smart_str_free(&serialize_buffer); /* return value should not be of NULL type. NULL means an error has occurred */ if (json_decode_ret_val_type == IS_NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "JSON error. Error occurred in php_json_decode(). Raw JSON string is \n %s \n", (char *) json_string); /* json_error always fails to detect an error. * todo investigate */ return (int) SOLR_JSON_ERROR_SERIALIZATION; } return (int) json_error; } /* }}} */ PHP_SOLR_API long solr_get_json_last_error(TSRMLS_D) { long json_error; zval json_last_error_ret_val, *object_p; zval *json_last_error_params = NULL; zval json_last_error_function_name; ZVAL_STRING(&json_last_error_function_name, "json_last_error"); /* object instance to perform the method call */ object_p = (zval *) NULL; call_user_function(EG(function_table), object_p, &json_last_error_function_name, &json_last_error_ret_val, 0, json_last_error_params TSRMLS_CC); json_error = Z_LVAL(json_last_error_ret_val); zval_dtor(&json_last_error_ret_val); #ifdef PHP_7 zval_dtor(&json_last_error_function_name); #endif return json_error; } static inline int solr_pcre_replace_into_buffer(solr_string_t *buffer, char * search, char *replace) { zend_string *result; zval replace_val; int limit = -1; int replace_count = -1; zend_string *regex_str = zend_string_init(search, strlen(search), 0); zend_string *subject_str = zend_string_init(buffer->str, buffer->len, 0); ZVAL_STRING(&replace_val, replace); result = php_pcre_replace( regex_str, subject_str, buffer->str, buffer->len, &replace_val, 0, limit, &replace_count ); solr_string_set_ex(buffer, (solr_char_t *)result->val, (size_t)result->len); /* fprintf(stdout, "%s", buffer->str); */ efree(result); zval_ptr_dtor(&replace_val); zend_string_release(regex_str); zend_string_release(subject_str); return SUCCESS; } /* serialized array to serialized object */ PHP_SOLR_API int solr_sarray_to_sobject(solr_string_t *buffer TSRMLS_DC) { return solr_pcre_replace_into_buffer(buffer, "/a\\:([0-9]+):{s/i", "O:10:\"SolrObject\":\\1:{s"); } /* serialized object to serialized array */ PHP_SOLR_API int solr_sobject_to_sarray(solr_string_t *buffer TSRMLS_DC) { return solr_pcre_replace_into_buffer(buffer, "/O:10:\"SolrObject\":([0-9]+):{s/i", "a:\\1:{s"); } /* }}} */ /* todo document and block this */ PHP_SOLR_API int solr_solrfunc_update_string(zval *obj, solr_char_t *key, int key_len, solr_char_t *value, int value_len TSRMLS_DC) { solr_function_t *function; solr_string_t *string; #ifdef PHP_7 string = pemalloc(sizeof(solr_string_t), SOLR_FUNCTIONS_PERSISTENT); #endif memset(string, 0, sizeof(solr_string_t)); if (solr_fetch_function_entry(obj, &function TSRMLS_CC) == FAILURE) { return FAILURE; } solr_string_set(string, (solr_char_t *)value, value_len); if (zend_hash_str_update_ptr(function->params, key, key_len, (void *)string) == NULL ) { solr_string_free(string); return FAILURE; } return SUCCESS; } PHP_SOLR_API int solr_solrfunc_fetch_string(zval *obj, solr_char_t *key, int key_len, solr_string_t **string TSRMLS_DC) { solr_function_t *function; if (solr_fetch_function_entry(obj, &function TSRMLS_CC) == FAILURE) { return FAILURE; } if ((*string = zend_hash_str_find_ptr(function->params, key, key_len)) == NULL) { return FAILURE; } return SUCCESS; } PHP_SOLR_API int solr_solrfunc_display_string(zval *obj, solr_char_t *key, int key_len, zval **return_value TSRMLS_DC) { solr_string_t *field_string_ptr = NULL; memset(&field_string_ptr, 0, sizeof(solr_string_t *)); if (solr_solrfunc_fetch_string(obj, key, key_len, &field_string_ptr TSRMLS_CC) == SUCCESS) { ZVAL_STRINGL(*return_value, field_string_ptr->str, field_string_ptr->len); return SUCCESS; } else { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to fetch string"); return FAILURE; } } PHP_SOLR_API void solr_solrfunc_to_string(solr_function_t *function, solr_string_t **dest) { solr_string_t *buffer = *dest; solr_string_appends(buffer, (solr_char_t *)"{!", sizeof("{!")-1); solr_string_appends(buffer, function->name, function->name_length); solr_string_appendc(buffer, ' '); solr_string_t *value; zend_string *key; ulong num_idx; ZEND_HASH_FOREACH_KEY_PTR(function->params, num_idx, key, value) { (void)num_idx; /* silent -Wunused-but-set-variable */ /* key is only maintained internally */ if (key) { solr_string_appends(buffer, key->val, key->len-1); } solr_string_appendc(buffer, '='); if (strpbrk(value->str, " ") != NULL && strpbrk(value->str,"'") == NULL) { solr_string_appendc(buffer, '\''); solr_string_append_solr_string (buffer, value); solr_string_appendc(buffer, '\''); } else { solr_string_append_solr_string (buffer, value); } solr_string_appendc(buffer, ' '); } ZEND_HASH_FOREACH_END(); solr_string_remove_last_char(buffer); solr_string_appendc(buffer, '}'); /* todo handle localParams argument */ } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/solr_functions_params.c000066400000000000000000001300161374041537100235670ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" PHP_SOLR_API int solr_init_params(solr_params_t *solr_params, long int index) { uint nSize = SOLR_INITIAL_HASH_TABLE_SIZE; solr_params = (solr_params_t *)pemalloc( sizeof(solr_params_t), SOLR_PARAMS_PERSISTENT); memset(solr_params, 0, sizeof(solr_params_t)); if ((solr_params = zend_hash_index_update_ptr(SOLR_GLOBAL(params), index, (void *) solr_params)) == NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error while registering query parameters in HashTable"); return FAILURE; } solr_params->params_index = index; solr_params->params_count = 0U; /* Allocated memory for the parameters HashTable using fast cache for HashTables */ ALLOC_HASHTABLE(solr_params->params); zend_hash_init(solr_params->params, nSize, NULL, (dtor_func_t) solr_destory_param_ht_dtor, SOLR_PARAMS_PERSISTENT); return SUCCESS; } /* {{{ PHP_SOLR_API void solr_destroy_params(zval *solr_params) */ PHP_SOLR_API void solr_destroy_params(zval *solr_params) { solr_params_t *params = (solr_params_t *) Z_PTR_P(solr_params); zend_hash_destroy(params->params); pefree(params->params, SOLR_PARAMS_PERSISTENT); pefree(params, SOLR_PARAMS_PERSISTENT); } /* }}} */ /* {{{ PHP_SOLR_API void solr_destroy_param(solr_param_t **param) */ PHP_SOLR_API void solr_destroy_param(solr_param_t **param) { solr_param_value_t *temp_ptr = NULL; solr_param_value_t *current_ptr = (*param)->head; while(current_ptr != NULL) { temp_ptr = current_ptr->next; (*param)->value_free_func(current_ptr); current_ptr = temp_ptr; } (*param)->head = NULL; (*param)->last = NULL; pefree((*param)->param_name, SOLR_PARAMS_PERSISTENT); (*param)->param_name = NULL; pefree((*param), SOLR_PARAMS_PERSISTENT); (*param) = NULL; } /* }}} */ PHP_SOLR_API void solr_destory_param_ht_dtor(zval *param_zv) { solr_param_t *param = (solr_param_t *) Z_PTR_P(param_zv); solr_destroy_param(¶m); } /* {{{ PHP_SOLR_API int solr_params_delete_param_value(solr_param_t *param, const solr_param_value_t *target_value TSRMLS_DC) */ PHP_SOLR_API int solr_params_delete_param_value(solr_param_t *param, const solr_param_value_t *target_value TSRMLS_DC) { solr_param_value_t *curr_value = param->head; int match_found = 0; if (!target_value) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid pointer. Submitted target cannot be used for the delete search\n"); return FAILURE; } while(!match_found && curr_value != NULL) { match_found = param->value_equal_func(curr_value, target_value); /* If the target was found */ if (match_found) { /* If the target is not the head */ if (curr_value->prev) { curr_value->prev->next = curr_value->next; } else { param->head = curr_value->next; } /* If the target is not the tail */ if (curr_value->next) { curr_value->next->prev = curr_value->prev; } else { param->last = curr_value->prev; } /* Destroy target value */ param->value_free_func(curr_value); goto dpv_end; } curr_value = curr_value->next; } dpv_end : if (!match_found) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Target parameter value could not be found in '%s'. No value was deleted ", param->param_name); return FAILURE; } param->count--; /* Reduce the value count by one */ return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_params_insert_param_value(solr_param_t *param, solr_param_value_t *param_value) */ PHP_SOLR_API int solr_params_insert_param_value(solr_param_t *param, solr_param_value_t *param_value) { if (!param_value) { return FAILURE; } param_value->next = param_value->prev = NULL; if (!param->allow_multiple) { param->value_free_func(param->head); param->head = param_value; param->last = param_value; param->count = 1U; return SUCCESS; } if (param->head == NULL) { param->head = param_value; param->last = param_value; } else { param_value->prev = param->last; param->last->next = param_value; param->last = param_value; } param->count++; return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API solr_param_t *solr_create_new_param(const solr_char_t *param_name, size_t param_name_len, solr_param_type_t param_type, solr_bool allow_multiple, solr_param_value_equal_func_t value_equal_func, solr_param_fetch_func_t param_fetch_func, solr_param_value_free_func_t value_free_func, solr_char_t delimiter, solr_char_t arg_separator TSRMLS_DC) */ PHP_SOLR_API solr_param_t *solr_create_new_param(const solr_char_t *param_name, size_t param_name_len, solr_param_type_t param_type, solr_bool allow_multiple, solr_param_value_equal_func_t value_equal_func, solr_param_fetch_func_t param_fetch_func, solr_param_value_free_func_t value_free_func, solr_char_t delimiter, solr_char_t arg_separator TSRMLS_DC) { solr_param_t *query_param = (solr_param_t *) pemalloc(sizeof(solr_param_t), SOLR_PARAMS_PERSISTENT); /* Always initialize linked list containers to NULL. */ /* Member pointers may contain unallocated addresses */ /* This notice applies to all solr_param_t member pointers here */ memset(query_param, 0, sizeof(solr_param_t)); query_param->type = param_type; query_param->count = 0L; query_param->param_name = solr_strndup(param_name, param_name_len); query_param->param_name_length = param_name_len; query_param->allow_multiple = allow_multiple; query_param->head = query_param->last = NULL; query_param->value_equal_func = value_equal_func; query_param->fetch_func = param_fetch_func; query_param->value_free_func = value_free_func; query_param->delimiter = delimiter; query_param->arg_separator = arg_separator; return query_param; } /* }}} */ /* {{{ PHP_SOLR_API int solr_add_or_set_normal_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, zend_bool allow_multiple TSRMLS_DC) parameter value addition functions */ PHP_SOLR_API int solr_add_or_set_normal_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, zend_bool allow_multiple TSRMLS_DC) { solr_params_t *solr_params = NULL; HashTable *params = NULL; solr_param_type_t param_type = SOLR_PARAM_TYPE_NORMAL; solr_param_t *param = NULL; solr_param_value_t *parameter_value = NULL; if (!pname_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter name"); /* php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter name"); */ return FAILURE; } if (!pvalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter value"); /* php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter value"); */ return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params = solr_params->params; if ((param = zend_hash_str_find_ptr(params, (char *) pname, pname_length)) != NULL) { parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.normal), pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); return SUCCESS; } param = solr_create_new_param(pname, pname_length, param_type, allow_multiple, solr_normal_param_value_equal, (solr_param_fetch_func_t) solr_normal_param_value_fetch, solr_normal_param_value_free, '&', 0 TSRMLS_CC); parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.normal), pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); if (zend_hash_str_add_ptr(params, pname, pname_length, (void *) param) == NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error from %s %s=%s", __func__, (char *) pname, pvalue); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_add_simple_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC) */ PHP_SOLR_API int solr_add_simple_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC) { zend_bool allow_multiple = 1; /* This value type by definition allows multiple. add parameters can be added more than once */ solr_params_t *solr_params = NULL; HashTable *params = NULL; solr_param_type_t param_type = SOLR_PARAM_TYPE_SIMPLE_LIST; solr_param_t *param = NULL; solr_param_value_t *parameter_value = NULL; if (!pname_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter value"); return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params = solr_params->params; if ((param = zend_hash_str_find_ptr(params, pname, pname_length)) != NULL) { parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.simple_list), pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); return SUCCESS; } param = solr_create_new_param(pname, pname_length, param_type, allow_multiple, solr_simple_list_param_value_equal, (solr_param_fetch_func_t) solr_simple_list_param_value_fetch, solr_simple_list_param_value_free, ',', 0 TSRMLS_CC); parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.simple_list), pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); if (zend_hash_str_add_ptr(params, pname, pname_length, (void *) param) == NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error from %s %s=%s", __func__, (char *) pname, pvalue); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_add_simple_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC) */ PHP_SOLR_API int solr_add_simple_list_param_ex(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length,solr_char_t *separator TSRMLS_DC) { zend_bool allow_multiple = 1; /* This value type by definition allows multiple. add parameters can be added more than once */ solr_params_t *solr_params = NULL; HashTable *params = NULL; solr_param_type_t param_type = SOLR_PARAM_TYPE_SIMPLE_LIST; solr_param_t *param = NULL; solr_param_value_t *parameter_value = NULL; if (!pname_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter value"); return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params = solr_params->params; if ((param = zend_hash_str_find_ptr(params, pname, pname_length)) != NULL) { parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.simple_list), pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); return SUCCESS; } param = solr_create_new_param(pname, pname_length, param_type, allow_multiple, solr_simple_list_param_value_equal, (solr_param_fetch_func_t) solr_simple_list_param_value_fetch, solr_simple_list_param_value_free, *separator, 0 TSRMLS_CC); parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.simple_list), pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); if (zend_hash_str_add_ptr(params, pname, pname_length, (void *) param) == NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error from %s %s=%s", __func__, (char *) pname, pvalue); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_add_arg_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t delimiter, solr_char_t arg_separator TSRMLS_DC) */ PHP_SOLR_API int solr_add_arg_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t delimiter, solr_char_t arg_separator TSRMLS_DC) { zend_bool allow_multiple = 1; /* This value type by definition allows multiple */ solr_params_t *solr_params = NULL; solr_param_type_t param_type = SOLR_PARAM_TYPE_ARG_LIST; solr_param_t *param = NULL; /* holds a pointer to the param structure e.g. sort */ solr_param_value_t *parameter_value = NULL; HashTable *params = NULL; if (!pname_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter value"); return FAILURE; } /* if (!avalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid argument value"); return FAILURE; } */ if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params = solr_params->params; /* if parameter exists add the new value argument(param_value) */ if ((param = zend_hash_str_find_ptr(params, pname, pname_length)) != NULL) { parameter_value = create_parameter_value_arg_list(pvalue, pvalue_length, avalue, avalue_length, "", 0 TSRMLS_CC); solr_params_insert_param_value(param, parameter_value); return SUCCESS; } param = solr_create_new_param(pname, pname_length, param_type, allow_multiple, solr_arg_list_param_value_equal, (solr_param_fetch_func_t) solr_arg_list_param_value_fetch, solr_arg_list_param_value_free, delimiter, arg_separator TSRMLS_CC); parameter_value = create_parameter_value_arg_list(pvalue, pvalue_length, avalue, avalue_length, (solr_char_t*)"", 0 TSRMLS_CC); solr_params_insert_param_value(param, parameter_value); if (zend_hash_str_add_ptr(params, pname, pname_length, (void *) param) == NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error from %s %s=%s", __func__, (char *) pname, pvalue); return FAILURE; } return SUCCESS; } /* }}} */ PHP_SOLR_API solr_param_value_t* create_parameter_value_arg_list(solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t *delimiter_override, solr_bool delimiter_overriden TSRMLS_DC) { solr_param_value_t *parameter_value = NULL; parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.arg_list.value), pvalue, pvalue_length); solr_string_appends(&(parameter_value->contents.arg_list.arg), avalue, avalue_length); if(delimiter_overriden){ parameter_value->contents.arg_list.delimiter_override = solr_strndup(delimiter_override, sizeof(delimiter_override)); parameter_value->contents.arg_list.delimiter_overriden = delimiter_overriden; } return parameter_value; } PHP_SOLR_API int solr_add_arg_list_param_ex(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t delimiter, solr_char_t arg_separator, solr_char_t delimiter_override TSRMLS_DC) { zend_bool allow_multiple = 1; /* This value type by definition allows multiple */ solr_params_t *solr_params = NULL; solr_param_type_t param_type = SOLR_PARAM_TYPE_ARG_LIST; solr_param_t *param = NULL; /* holds a pointer to the param structure e.g. sort */ solr_param_value_t *parameter_value = NULL; HashTable *params = NULL; if (!pname_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid parameter value"); return FAILURE; } /* * commented for the favor of having empty value if (!avalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000 TSRMLS_CC, SOLR_FILE_LINE_FUNC, "Invalid argument value"); return FAILURE; } */ if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params = solr_params->params; /* if parameter exists add the new value argument(param_value) */ if ((param = zend_hash_str_find_ptr(params, pname, pname_length)) != NULL) { parameter_value = create_parameter_value_arg_list(pvalue, pvalue_length, avalue, avalue_length, &delimiter_override, 1 TSRMLS_CC); solr_params_insert_param_value(param, parameter_value); return SUCCESS; } param = solr_create_new_param(pname, pname_length, param_type, allow_multiple, solr_arg_list_param_value_equal, (solr_param_fetch_func_t) solr_arg_list_param_value_fetch, solr_arg_list_param_value_free, delimiter, arg_separator TSRMLS_CC); parameter_value = create_parameter_value_arg_list(pvalue, pvalue_length, avalue, avalue_length, &delimiter_override, 1 TSRMLS_CC); solr_params_insert_param_value(param, parameter_value); if (zend_hash_str_add_ptr(params, pname, pname_length, (void *) param) == NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error from %s %s=%s", __func__, (char *) pname, pvalue); return FAILURE; } return SUCCESS; } /* {{{ Parameter value EQUALITY FUNCTIONS */ /* {{{ PHP_SOLR_API int solr_normal_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b) */ PHP_SOLR_API int solr_normal_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b) { return solr_string_equal(&(a->contents.normal), &(b->contents.normal)); } /* }}} */ /* {{{ PHP_SOLR_API int solr_simple_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b) */ PHP_SOLR_API int solr_simple_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b) { return solr_string_equal(&(a->contents.simple_list), &(b->contents.simple_list)); } /* }}} */ /* {{{ PHP_SOLR_API int solr_arg_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b) */ PHP_SOLR_API int solr_arg_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b) { return solr_string_equal(&(a->contents.arg_list.value), &(b->contents.arg_list.value)); } /* }}} */ /* }}} */ /* {{{ Parameter values retrieval functions */ /* {{{ PHP_SOLR_API void solr_normal_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer) */ PHP_SOLR_API void solr_normal_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer) { zend_string *url_encoded_param_value; solr_param_value_t *current_ptr = solr_param->head; solr_char_t glue = '&'; if (!solr_param->allow_multiple) { url_encoded_param_value = php_raw_url_encode((char *) current_ptr->contents.normal.str, current_ptr->contents.normal.len); solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); solr_string_appends(buffer, url_encoded_param_value->val, url_encoded_param_value->len); zend_string_free(url_encoded_param_value); } else { ulong n_loops = solr_param->count - 1; while(n_loops) { url_encoded_param_value = NULL; url_encoded_param_value = php_raw_url_encode(current_ptr->contents.normal.str, current_ptr->contents.normal.len); solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); solr_string_appends(buffer, url_encoded_param_value->val, url_encoded_param_value->len); zend_string_release(url_encoded_param_value); solr_string_appendc(buffer, glue); n_loops--; current_ptr = current_ptr->next; } url_encoded_param_value = NULL; url_encoded_param_value = php_raw_url_encode(current_ptr->contents.normal.str, current_ptr->contents.normal.len); solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); solr_string_appends(buffer, url_encoded_param_value->val, url_encoded_param_value->len); zend_string_free(url_encoded_param_value); } } /* }}} */ /* {{{ PHP_SOLR_API void solr_simple_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer) */ PHP_SOLR_API void solr_simple_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer) { solr_param_value_t *current_ptr = solr_param->head; solr_char_t list_delimiter = ','; /* Comma 0x2C */ ulong n_loops = solr_param->count - 1; auto solr_string_t tmp_buffer; zend_string *url_encoded_list = NULL; solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); memset(&tmp_buffer, 0, sizeof(solr_string_t)); while(n_loops) { solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.simple_list)); solr_string_appendc(&tmp_buffer, list_delimiter); n_loops--; current_ptr = current_ptr->next; } solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.simple_list)); url_encoded_list = php_raw_url_encode(tmp_buffer.str, tmp_buffer.len); solr_string_appends(buffer, url_encoded_list->val, url_encoded_list->len); zend_string_release(url_encoded_list); url_encoded_list = NULL; solr_string_free(&tmp_buffer); } /* }}} */ /* {{{ PHP_SOLR_API void solr_arg_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer) */ PHP_SOLR_API void solr_arg_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer) { solr_param_value_t *current_ptr = solr_param->head; solr_char_t list_delimiter = solr_param->delimiter; solr_char_t separator = solr_param->arg_separator; ulong n_loops = solr_param->count - 1; solr_string_t tmp_buffer; zend_string *url_encoded_list = NULL; solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); memset(&tmp_buffer, 0, sizeof(solr_string_t)); while(n_loops) { solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.value)); solr_string_appendc(&tmp_buffer, separator); solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.arg)); solr_string_appendc(&tmp_buffer, list_delimiter); n_loops--; current_ptr = current_ptr->next; } solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.value)); solr_string_appendc(&tmp_buffer, separator); solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.arg)); url_encoded_list = php_raw_url_encode(tmp_buffer.str, tmp_buffer.len); solr_string_appends(buffer, url_encoded_list->val, url_encoded_list->len); zend_string_release(url_encoded_list); url_encoded_list = NULL; solr_string_free(&tmp_buffer); } /* }}} */ /* }}} */ /* {{{ Parameter retrieval functions. Only used for display. */ /* {{{ PHP_SOLR_API void solr_normal_param_value_display_string(solr_param_t *solr_param, zval *param_value) */ PHP_SOLR_API void solr_normal_param_value_display_string(solr_param_t *solr_param, zval *param_value) { solr_param_value_t *current_ptr = solr_param->head; ZVAL_STRINGL(param_value, current_ptr->contents.normal.str, current_ptr->contents.normal.len); } /* }}} */ /* {{{ PHP_SOLR_API void solr_normal_param_value_display_integer(solr_param_t *solr_param, zval *param_value) */ PHP_SOLR_API void solr_normal_param_value_display_integer(solr_param_t *solr_param, zval *param_value) { solr_param_value_t *current_ptr = solr_param->head; long int return_value = atol(current_ptr->contents.normal.str); ZVAL_LONG(param_value, return_value); } /* }}} */ /* {{{ PHP_SOLR_API void solr_normal_param_value_display_double(solr_param_t *solr_param, zval *param_value) */ PHP_SOLR_API void solr_normal_param_value_display_double(solr_param_t *solr_param, zval *param_value) { solr_param_value_t *current_ptr = solr_param->head; double return_value = atof(current_ptr->contents.normal.str); ZVAL_DOUBLE(param_value, return_value); } /* }}} */ /* Checks if current_ptr->contents.normal.str matches str_const */ #define solr_npvdb_strcmp(str_const) (0 == strcmp(str_const, current_ptr->contents.normal.str)) /* {{{ PHP_SOLR_API void solr_normal_param_value_display_boolean(solr_param_t *solr_param, zval *param_value) */ PHP_SOLR_API void solr_normal_param_value_display_boolean(solr_param_t *solr_param, zval *param_value) { solr_param_value_t *current_ptr = solr_param->head; zend_bool return_value = (zend_bool) (solr_npvdb_strcmp("true") || solr_npvdb_strcmp("on") ); ZVAL_BOOL(param_value, return_value); } /* }}} */ /* {{{ PHP_SOLR_API void solr_normal_param_value_display_sort_type(solr_param_t *solr_param, zval *param_value) */ PHP_SOLR_API void solr_normal_param_value_display_sort_type(solr_param_t *solr_param, zval *param_value) { solr_param_value_t *current_ptr = solr_param->head; long int return_value = (long int) (solr_npvdb_strcmp("count")); ZVAL_LONG(param_value, return_value); } /* }}} */ /* {{{ PHP_SOLR_API void solr_normal_param_value_display(solr_param_t *solr_param, zval *param_value_array) */ PHP_SOLR_API void solr_normal_param_value_display(solr_param_t *solr_param, zval *param_value_array) { solr_param_value_t *current_ptr = solr_param->head; while (current_ptr != NULL) { add_next_index_stringl(param_value_array, current_ptr->contents.normal.str, current_ptr->contents.normal.len); current_ptr = current_ptr->next; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_simple_list_param_value_display(solr_param_t *solr_param, zval *param_value_array) */ PHP_SOLR_API void solr_simple_list_param_value_display(solr_param_t *solr_param, zval *param_value_array) { solr_param_value_t *current_ptr = solr_param->head; while (current_ptr != NULL) { add_next_index_stringl(param_value_array, current_ptr->contents.simple_list.str, current_ptr->contents.simple_list.len); current_ptr = current_ptr->next; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_arg_list_param_value_display(solr_param_t *solr_param, zval *param_value_array) */ PHP_SOLR_API void solr_arg_list_param_value_display(solr_param_t *solr_param, zval *param_value_array) { solr_param_value_t *current_ptr = solr_param->head; while (current_ptr != NULL) { solr_string_t tmp_buffer; memset(&tmp_buffer, 0, sizeof(solr_string_t)); solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.value)); solr_string_appendc(&tmp_buffer, solr_param->arg_separator); solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.arg)); add_next_index_stringl(param_value_array, tmp_buffer.str, tmp_buffer.len); solr_string_free(&tmp_buffer); current_ptr = current_ptr->next; } } /* }}} */ /* }}} */ /* {{{ Parameter retrieval functions. Only used for toString() */ /* {{{ PHP_SOLR_API void solr_normal_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode) */ PHP_SOLR_API void solr_normal_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode) { solr_param_value_t *current_ptr = solr_param->head; solr_char_t glue = '&'; if (!solr_param->allow_multiple) { zend_string *url_encoded_param_value = NULL; if (url_encode) { url_encoded_param_value = php_raw_url_encode((char *) current_ptr->contents.normal.str, current_ptr->contents.normal.len); } else { url_encoded_param_value = zend_string_init(current_ptr->contents.normal.str, current_ptr->contents.normal.len, 0); } solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); solr_string_appends(buffer, url_encoded_param_value->val, url_encoded_param_value->len); zend_string_release(url_encoded_param_value); } else { ulong n_loops = solr_param->count - 1; zend_string *url_encoded_param_value = NULL; while(n_loops) { if (url_encode) { url_encoded_param_value = php_raw_url_encode(current_ptr->contents.normal.str, current_ptr->contents.normal.len); } else { url_encoded_param_value = zend_string_init(current_ptr->contents.normal.str, current_ptr->contents.normal.len, 0); } solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); solr_string_appends(buffer, url_encoded_param_value->val, url_encoded_param_value->len); zend_string_free(url_encoded_param_value); url_encoded_param_value = NULL; solr_string_appendc(buffer, glue); n_loops--; current_ptr = current_ptr->next; } if (url_encode) { url_encoded_param_value = php_raw_url_encode(current_ptr->contents.normal.str, current_ptr->contents.normal.len); } else { url_encoded_param_value = zend_string_init(current_ptr->contents.normal.str, current_ptr->contents.normal.len, 0); } solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); solr_string_appends(buffer, url_encoded_param_value->val, url_encoded_param_value->len); zend_string_free(url_encoded_param_value); url_encoded_param_value = NULL; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_simple_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode) */ PHP_SOLR_API void solr_simple_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode) { solr_param_value_t *current_ptr = solr_param->head; solr_char_t list_delimiter = solr_param->delimiter; /* Comma 0x2C */ ulong n_loops = solr_param->count - 1; auto solr_string_t tmp_buffer; zend_string *url_encoded_list = NULL; solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); memset(&tmp_buffer, 0, sizeof(solr_string_t)); while(n_loops) { solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.simple_list)); solr_string_appendc(&tmp_buffer, list_delimiter); n_loops--; current_ptr = current_ptr->next; } solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.simple_list)); if (url_encode) { url_encoded_list = php_raw_url_encode(tmp_buffer.str, tmp_buffer.len); } else { url_encoded_list = zend_string_init(tmp_buffer.str, tmp_buffer.len, 0); } solr_string_appends(buffer, url_encoded_list->val, url_encoded_list->len); zend_string_free(url_encoded_list); url_encoded_list = NULL; solr_string_free(&tmp_buffer); } /* }}} */ /* {{{ PHP_SOLR_API void solr_arg_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode) */ PHP_SOLR_API void solr_arg_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode) { solr_param_value_t *current_ptr = solr_param->head; solr_char_t list_delimiter = solr_param->delimiter; solr_char_t separator = solr_param->arg_separator; ulong n_loops = solr_param->count - 1; solr_string_t tmp_buffer; zend_string *url_encoded_list = NULL; solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); memset(&tmp_buffer, 0, sizeof(solr_string_t)); while(n_loops) { solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.value)); if(current_ptr->contents.arg_list.delimiter_overriden) { if(strlen(current_ptr->contents.arg_list.delimiter_override) > 0) { solr_string_appendc(&tmp_buffer, (*current_ptr->contents.arg_list.delimiter_override)); } }else{ solr_string_appendc(&tmp_buffer, separator); } solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.arg)); solr_string_appendc(&tmp_buffer, list_delimiter); n_loops--; current_ptr = current_ptr->next; } /* process last parameter value */ solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.value)); /* check for separator override */ if(current_ptr->contents.arg_list.delimiter_overriden) { if(strlen(current_ptr->contents.arg_list.delimiter_override) > 0) { solr_string_appendc(&tmp_buffer, (*current_ptr->contents.arg_list.delimiter_override)); } }else{ solr_string_appendc(&tmp_buffer, separator); } solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.arg)); if (url_encode) { url_encoded_list = php_raw_url_encode(tmp_buffer.str, tmp_buffer.len); } else { url_encoded_list = zend_string_init(tmp_buffer.str, tmp_buffer.len, 0); } solr_string_appends(buffer, url_encoded_list->val, url_encoded_list->len); zend_string_free(url_encoded_list); url_encoded_list = NULL; solr_string_free(&tmp_buffer); } /* }}} */ /* }}} */ /* {{{ Memory deallocation functions for parameter values */ /* {{{ PHP_SOLR_API void solr_normal_param_value_free(solr_param_value_t *param_value) */ PHP_SOLR_API void solr_normal_param_value_free(solr_param_value_t *param_value) { if (param_value) { solr_string_free(&(param_value->contents.normal)); pefree(param_value, SOLR_PARAMS_PERSISTENT); param_value = NULL; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_simple_list_param_value_free(solr_param_value_t *param_value) */ PHP_SOLR_API void solr_simple_list_param_value_free(solr_param_value_t *param_value) { if (param_value) { solr_string_free(&(param_value->contents.simple_list)); pefree(param_value, SOLR_PARAMS_PERSISTENT); param_value = NULL; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_arg_list_param_value_free(solr_param_value_t *param_value) */ PHP_SOLR_API void solr_arg_list_param_value_free(solr_param_value_t *param_value) { if (param_value) { solr_string_free(&(param_value->contents.arg_list.value)); solr_string_free(&(param_value->contents.arg_list.arg)); if(param_value->contents.arg_list.delimiter_override != NULL){ efree(param_value->contents.arg_list.delimiter_override); } pefree(param_value, SOLR_PARAMS_PERSISTENT); param_value = NULL; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_set_return_solr_params_object(zval *return_value_ptr, zval *current_objptr TSRMLS_DC) */ PHP_SOLR_API void solr_set_return_solr_params_object(zval *return_value_ptr, zval *current_objptr TSRMLS_DC) { #ifdef PHP_7 ZVAL_COPY(return_value_ptr, current_objptr); #else zval_ptr_dtor(return_value_ptr); ZVAL_MAKE_REF(current_objptr); Z_ADDREF_P(current_objptr); return_value_ptr = current_objptr; #endif } /* }}} */ /* {{{ PHP_SOLR_API int solr_delete_solr_parameter(zval *objptr, solr_char_t *name, int name_length TSRMLS_DC) */ PHP_SOLR_API int solr_delete_solr_parameter(zval *objptr, solr_char_t *name, int name_length TSRMLS_DC) { solr_params_t *solr_params = NULL; HashTable *params_ht = NULL; if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params_ht = solr_params->params; if (zend_hash_str_del(params_ht, name, name_length) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "parameter '%s' was not set. Attempting to remove an undefined parameter.", name); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_delete_normal_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC) */ PHP_SOLR_API int solr_delete_normal_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC) { solr_params_t *solr_params = NULL; HashTable *params_ht = NULL; solr_param_t *param_ptr = NULL; solr_param_value_t *target_value = NULL; if (!pname_length) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter value"); return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params_ht = solr_params->params; if ((param_ptr = zend_hash_str_find_ptr(params_ht, pname, pname_length)) == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "parameter could not be retrieved from HashTable"); return FAILURE; } target_value = (solr_param_value_t *) pecalloc(1, sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); solr_string_appends(&(target_value->contents.normal), pvalue, pvalue_length); solr_params_delete_param_value(param_ptr, target_value TSRMLS_CC); /* We are done with target_value. */ param_ptr->value_free_func(target_value); if (param_ptr->count < 1U) { zend_hash_str_del(params_ht, pname, pname_length); #if SOLR_DEBUG php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Deleted last value from parameter. Removing parameter '%s' from object instance.", pname); #endif } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_delete_simple_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC) */ PHP_SOLR_API int solr_delete_simple_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC) { solr_params_t *solr_params = NULL; solr_param_t *param_ptr = NULL; HashTable *params_ht = NULL; solr_param_value_t *target_value = NULL; if (!pname_length) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter value"); return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params_ht = solr_params->params; if ((param_ptr = zend_hash_str_find_ptr(params_ht, pname, pname_length)) == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "parameter could not be retrieved from HashTable"); return FAILURE; } target_value = (solr_param_value_t *) pecalloc(1, sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); solr_string_appends(&(target_value->contents.simple_list), pvalue, pvalue_length); solr_params_delete_param_value(param_ptr, target_value TSRMLS_CC); /* We are done with target_value. */ param_ptr->value_free_func(target_value); if (param_ptr->count < 1U) { zend_hash_str_del(params_ht, pname, pname_length); #if SOLR_DEBUG php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Deleted last value from parameter. Removing parameter '%s' from object instance.", pname); #endif } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_delete_arg_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC) */ PHP_SOLR_API int solr_delete_arg_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length TSRMLS_DC) { solr_params_t *solr_params = NULL; HashTable *params_ht = NULL; solr_param_t *param_ptr = NULL; solr_param_value_t *target_value = NULL; if (!pname_length) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter value"); return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params_ht = solr_params->params; if ((param_ptr = zend_hash_str_find_ptr(params_ht, pname, pname_length)) == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "parameter could not be retrieved from HashTable"); return FAILURE; } target_value = (solr_param_value_t *) pecalloc(1, sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); solr_string_appends(&(target_value->contents.arg_list.value), pvalue, pvalue_length); solr_params_delete_param_value(param_ptr, target_value TSRMLS_CC); /* We are done with target_value. */ param_ptr->value_free_func(target_value); if (param_ptr->count < 1U) { zend_hash_str_del(params_ht, pname, pname_length); #if SOLR_DEBUG php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Deleted last value from parameter. Removing parameter '%s' from object instance.", pname); #endif } return SUCCESS; } /* }}} */ /* }}} */ /* {{{ PHP_SOLR_API int solr_param_find(zval *objptr, solr_char_t *pname, int pname_length, solr_param_t **solr_param TSRMLS_DC) */ PHP_SOLR_API int solr_param_find(zval *objptr, solr_char_t *pname, int pname_length, solr_param_t **solr_param TSRMLS_DC) { solr_params_t *solr_params = NULL; HashTable *params_ht = NULL; solr_param_t *solr_param_tmp = NULL; if (!pname_length) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameter name"); return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params_ht = solr_params->params; if ((solr_param_tmp = zend_hash_str_find_ptr(params_ht, pname, pname_length)) == NULL) { return FAILURE; } (*solr_param) = solr_param_tmp; return SUCCESS; } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/solr_functions_response.c000066400000000000000000000073001374041537100241410ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Israel Ekpo | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* Used to set the properties of the SolrResponse instance after a call to the server */ /* {{{ PHP_SOLR_API void solr_set_response_object_properties(zend_class_entry *scope, zval *response_object, const solr_client_t *client, const solr_string_t *request_url, zend_bool success TSRMLS_DC) */ PHP_SOLR_API void solr_set_response_object_properties(zend_class_entry *scope, zval *response_object, const solr_client_t *client, const solr_string_t *request_url, zend_bool success TSRMLS_DC) { const solr_curl_t *handle = &(client->handle); const solr_string_t *raw_request_headers = &(handle->request_header.buffer); const solr_string_t *raw_request = &(handle->request_body_debug.buffer); const solr_string_t *raw_response_headers = &(handle->response_header.buffer); const solr_string_t *raw_response = &(handle->response_body.buffer); const solr_string_t *response_writer = &(client->options.response_writer); long int http_status = handle->response_header.response_code; zend_update_property_long(scope, response_object, "http_status", sizeof("http_status")-1, http_status TSRMLS_CC); zend_update_property_bool(scope, response_object, "success", sizeof("success")-1, success TSRMLS_CC); if (response_writer->str) { zend_update_property_stringl(scope, response_object, "response_writer", sizeof("response_writer")-1, (char *)response_writer->str, response_writer->len TSRMLS_CC); } if (request_url->str) { zend_update_property_stringl(scope, response_object, "http_request_url", sizeof("http_request_url")-1, (char *)request_url->str, request_url->len TSRMLS_CC); } if (raw_request_headers->str) { zend_update_property_stringl(scope, response_object, "http_raw_request_headers", sizeof("http_raw_request_headers")-1, (char *)raw_request_headers->str, raw_request_headers->len TSRMLS_CC); } if (raw_request->str) { zend_update_property_stringl(scope, response_object, "http_raw_request", sizeof("http_raw_request")-1, (char *)raw_request->str, raw_request->len TSRMLS_CC); } if (raw_response_headers->str) { zend_update_property_stringl(scope, response_object, "http_raw_response_headers", sizeof("http_raw_response_headers")-1, (char *)raw_response_headers->str, raw_response_headers->len TSRMLS_CC); } if (raw_response->str) { zend_update_property_stringl(scope, response_object, "http_raw_response", sizeof("http_raw_response")-1, (char *)raw_response->str, raw_response->len TSRMLS_CC); } } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/solr_macros.h000066400000000000000000000155551374041537100215170ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #ifndef SOLR_MACROS_H #define SOLR_MACROS_H #include /* Macros for Object constructors and destructors declaration */ #define SOLR_CTOR(class_name, func_name, arginfo) PHP_ME(class_name, func_name, arginfo, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) #define SOLR_DTOR(class_name, func_name, arginfo) PHP_ME(class_name, func_name, arginfo, ZEND_ACC_PUBLIC | ZEND_ACC_DTOR) /* Retrieve a unique hash index for this SolrDocument. Unique for this thread */ #define SOLR_UNIQUE_DOCUMENT_INDEX() solr_hashtable_get_new_index(SOLR_GLOBAL(documents) TSRMLS_CC) /* Retrieve a unique hash index for this SolrClient. Unique for this thread */ #define SOLR_UNIQUE_CLIENT_INDEX() solr_hashtable_get_new_index(SOLR_GLOBAL(clients) TSRMLS_CC) /* Retrieve a unique hash index for this SolrParams instance. Unique for this thread */ #define SOLR_UNIQUE_PARAMS_INDEX() solr_hashtable_get_new_index(SOLR_GLOBAL(params) TSRMLS_CC) /* Retrieve a unique hash index for this SolrFunction instance. Unique for this thread */ #define SOLR_UNIQUE_FUNCTION_INDEX() solr_hashtable_get_new_index(SOLR_GLOBAL(functions) TSRMLS_CC) /* Iterates through the HashTable pointer */ #define SOLR_HASHTABLE_FOR_LOOP(HashTablePtr) \ if (HashTablePtr) for ( zend_hash_internal_pointer_reset((HashTablePtr)); \ SUCCESS == zend_hash_has_more_elements((HashTablePtr)); \ zend_hash_move_forward((HashTablePtr)) ) #define SOLR_HASH_FOREACH_PTR(HashTablePtr, ptr) \ if (HashTablePtr) ZEND_HASH_FOREACH_PTR(HashTablePtr, ptr) #define SOLR_HASH_FOREACH_END() \ ZEND_HASH_FOREACH_END() /* Gets a random number between 1 and SHRT_MAX */ #define SOLR_GET_RANDOM_NUMBER() abs(rand() % SHRT_MAX + 1) /* {{{ Memory Allocation Macros */ /* Used only to release truly persistent allocations */ #define SOLR_FREE_PTR(ptr) { if (ptr != NULL) { pefree(ptr,SOLR_HASHTABLE_PERSISTENT); ptr = NULL; } else { printf("\nSOLR_FREE_PTR double free() from function %s() called in %s on line %d\n", __func__, __FILE__, __LINE__); } } /* }}} */ /** * Used to retrieve xmlAttr and xmlNode values * * At this time, I am not sure if the next and previous sibling links * are guaranteed to be document order 100% of the time. * This is why I am requiring matches for the attribute and element names before * copying values from the attributes or element nodes. * Since I am not 100%, I believe it is better to be safe than sorry. * There may be a slight performance hit but at least correctness is guaranteed. */ #define solr_xml_match_node(solrXmlNode, solrXmlNodeName) ( \ xmlStrEqual(solrXmlNode->name, (xmlChar *) solrXmlNodeName) && \ solrXmlNode->children && solrXmlNode->children->content ) /* Checks if children is a valid struct */ #define solr_xml_child_content_is_valid(solrXmlNode) (solrXmlNode && solrXmlNode->children) /* Checks to prevent segmentation fault. Ensures that children is a valid struct before attempting to get content */ #define solr_xml_get_node_contents(solrXmlNode) (solr_xml_child_content_is_valid(solrXmlNode)? (solrXmlNode->children->content) : ((xmlChar *) "")) #define solr_xml_get_node_contents_int(solrXmlNode) atoi((char *)solr_xml_get_node_contents(solrXmlNode)) #define solr_xml_get_node_contents_double(solrXmlNode) xmlXPathCastStringToNumber(solr_xml_get_node_contents(solrXmlNode)) /** * Used to manage SolrQuery parameters that allow overrides by field name. * * Many parameters may be overridden on a per-field basis with the following syntax * * f..= * f..= * * @buf pointer to a solr_string_t object * @fname field name * @fname_len length of the field name * @pname a string constant representing the name of the parameter. */ #define solr_query_field_override(buf, fname, fname_len, pname) { \ if ((fname_len)) { \ solr_string_append_const((buf), "f."); \ solr_string_appends((buf), (fname), (fname_len)); \ solr_string_appendc((buf), '.'); \ } \ solr_string_append_const((buf), (pname)); \ } /* Macro for returning SolrParams objects if requested */ #define solr_return_solr_params_object() { \ solr_set_return_solr_params_object(return_value, getThis() TSRMLS_DC); \ } /* client macros */ #define SOLR_RESPONSE_CODE_BODY (client->handle.response_header.response_code), (client->handle.response_body.buffer.str) #define SOLR_SHOW_CURL_WARNING { \ if (client->handle.err.str) \ { \ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ((solr_char_t *) client->handle.err.str)); \ } \ } /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception */ #define HANDLE_SOLR_SERVER_ERROR(clientPtr,requestType){ \ if(clientPtr->handle.result_code == CURLE_OK){ \ solr_throw_solr_server_exception(clientPtr, (const char *)requestType TSRMLS_CC);\ } \ } /* solr_throw_exception_ex(solr_ce_SolrClientException, SOLR_ERROR_1010 TSRMLS_CC, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1010_MSG, requestType, SOLR_RESPONSE_CODE_BODY); \ */ #define SOLR_RETURN_THIS() { \ RETURN_ZVAL(getThis(), 1, 0); \ } /* Used to release the (solr_document_t **) pointers */ #define SOLR_FREE_DOC_ENTRIES(ptr) { \ if ((ptr) != NULL)\ { \ pefree(ptr, SOLR_DOCUMENT_PERSISTENT); \ ptr = NULL; \ } \ } /* }}} */ /* Used to release the (solr_document_t **) pointers */ #define SOLR_FREE_DOC_ENTRIES(ptr) { \ if ((ptr) != NULL)\ { \ pefree(ptr, SOLR_DOCUMENT_PERSISTENT); \ ptr = NULL; \ } \ } /* }}} */ #endif /* SOLR_MACROS_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/solr_string.c000066400000000000000000000163751374041537100215350ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Israel Ekpo | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_solr.h" /* {{{ static inline void solr_string_alloc(solr_string_t *dest, size_t length, size_t *new_length SOLR_MEM_DEBUG_DC) */ static inline void solr_string_alloc(solr_string_t *dest, size_t length, size_t *new_length SOLR_MEM_DEBUG_DC) { /* If buffer is empty */ if (!dest->str) { (*new_length) = length; dest->cap = ((*new_length) < SOLR_STRING_START_SIZE) ? SOLR_STRING_START_SIZE : (length + SOLR_STRING_INCREMENT_SIZE); dest->str = (solr_char_t *) perealloc(dest->str, dest->cap * sizeof(solr_char_t), SOLR_STRING_PERSISTENT); } else { (*new_length) = dest->len + length; /* If the buffer full, get more space */ if ((*new_length) >= dest->cap) { dest->cap = (*new_length) + SOLR_STRING_INCREMENT_SIZE; dest->str = (solr_char_t *) perealloc(dest->str, dest->cap * sizeof(solr_char_t), SOLR_STRING_PERSISTENT); } } #ifdef SOLR_MEM_DEBUG php_printf("solr_string_alloc() [Re]allocated %u bytes at %p in %s(), %s Line %d \n", dest->cap, dest->str SOLR_MEM_DEBUG_CC); #endif } /* }}} */ /* {{{ PHP_SOLR_API void solr_string_appends(solr_string_t *dest, const solr_char_t *src, size_t length SOLR_MEM_DEBUG_DC) */ PHP_SOLR_API void solr_string_appends_ex(solr_string_t *dest, const solr_char_t *src, size_t length SOLR_MEM_DEBUG_DC) { auto size_t __new_length = 0U; /* (Re)allocates memory and increases the capacity if necessary */ solr_string_alloc(dest, length, &__new_length SOLR_MEM_DEBUG_CC); /* Copy the data from the source to the destination */ memcpy(dest->str + dest->len, src, length); /* Reset the length of the solr_string to the new value */ dest->len = __new_length; /* Always make it a null-terminated string */ dest->str[__new_length] = (solr_char_t) 0x00; } /* }}} */ /* {{{ PHP_SOLR_API void solr_string_appendc(solr_string_t *dest, solr_char_t ch SOLR_MEM_DEBUG_DC) */ PHP_SOLR_API void solr_string_appendc_ex(solr_string_t *dest, solr_char_t ch SOLR_MEM_DEBUG_DC) { auto size_t __new_length = 0U; /* (Re)allocates memory and increases the capacity if necessary */ solr_string_alloc(dest, 1, &__new_length SOLR_MEM_DEBUG_CC); dest->str[dest->len] = ch; /* Reset the length of the solr_string to the new value (dest->len + 1) */ dest->len = __new_length; /* Always make it a null-terminated string */ dest->str[__new_length] = (solr_char_t) 0x00; } /* }}} */ /* {{{ PHP_SOLR_API void solr_string_remove_last_char(solr_string_t *dest) */ PHP_SOLR_API void solr_string_remove_last_char(solr_string_t *dest) { if (dest->str && dest->len) { dest->str[dest->len - 1] = (solr_char_t) 0x00; dest->len--; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_string_append_long(solr_string_t *dest, long int long_val) */ PHP_SOLR_API void solr_string_append_long_ex(solr_string_t *dest, long int long_val SOLR_MEM_DEBUG_DC) { auto size_t __new_length = 0U; auto char tmp_buffer[SOLR_STRING_LONG_BUFFER_SIZE]; size_t length = 0; /* Write the formated long to the buffer */ php_sprintf(tmp_buffer, "%ld", long_val); length = strlen(tmp_buffer); /* (Re)allocates memory and increases the capacity if necessary */ solr_string_alloc(dest, length, &__new_length SOLR_MEM_DEBUG_CC); /* Copy the data from the source to the destination */ memcpy(dest->str + dest->len, tmp_buffer, length); /* Reset the length of the solr_string to the new value */ dest->len = __new_length; /* Always make it a null-terminated string */ dest->str[__new_length] = (solr_char_t) 0x00; } /* }}} */ /* {{{ PHP_SOLR_API void solr_string_append_unsigned_long(solr_string_t *dest, unsigned long int long_val) */ PHP_SOLR_API void solr_string_append_unsigned_long_ex(solr_string_t *dest, unsigned long int long_val SOLR_MEM_DEBUG_DC) { auto size_t __new_length = 0U; auto char tmp_buffer[SOLR_STRING_UNSIGNED_LONG_BUFFER_SIZE]; size_t length = 0; /* Write the formated unsigned long to the buffer */ php_sprintf(tmp_buffer, "%lu", long_val); length = strlen(tmp_buffer); /* (Re)allocates memory and increases the capacity if necessary */ solr_string_alloc(dest, length, &__new_length SOLR_MEM_DEBUG_CC); /* Copy the data from the source to the destination */ memcpy(dest->str + dest->len, tmp_buffer, length); /* Reset the length of the solr_string to the new value */ dest->len = __new_length; /* Always make it a null-terminated string */ dest->str[__new_length] = (solr_char_t) 0x00; } /* }}} */ /** * Checks if both strings are equal OR have same exact content. * * Returns 1 if they are equal, 0 if they are different. */ /* {{{ PHP_SOLR_API int solr_string_equal(const solr_string_t *a, const solr_string_t *b) */ PHP_SOLR_API int solr_string_equal(const solr_string_t *a, const solr_string_t *b) { const solr_char_t *str1 = a->str; const solr_char_t *str2 = b->str; if (str1 == str2) return 1; if (str1 == NULL) return 0; if (str2 == NULL) return 0; do { if (*str1++ != *str2) return(0); } while (*str2++); return 1; } /* }}} */ /* Deallocates memory for the buffer */ /* {{{ PHP_SOLR_API void solr_string_free(solr_string_t *dest SOLR_MEM_DEBUG_DC) */ PHP_SOLR_API void solr_string_free_ex(solr_string_t *dest SOLR_MEM_DEBUG_DC) { /* Only attempt this if the buffer is still valid */ if (dest->str) { #ifdef SOLR_MEM_DEBUG php_printf("solr_string_free_ex() Releasing %u bytes at %p in %s(), %s Line %d \n", dest->cap, dest->str SOLR_MEM_DEBUG_CC); #endif pefree(dest->str, SOLR_STRING_PERSISTENT); dest->str = (solr_char_t *) 0x00; dest->cap = dest->len = 0U; } } /* }}} */ PHP_SOLR_API void solr_destory_solr_string_zv(zval *solr_string_zv) { solr_string_t *string = (solr_string_t *) Z_PTR_P(solr_string_zv); solr_string_free_ex(string); pefree(string, SOLR_STRING_PERSISTENT); } /* Update the contents of the dest solr_string */ /* {{{ PHP_SOLR_API void solr_string_set(solr_string_t *dest, const solr_char_t *value, size_t length SOLR_MEM_DEBUG_DC) */ PHP_SOLR_API void solr_string_set_ex(solr_string_t *dest, const solr_char_t *value, size_t length SOLR_MEM_DEBUG_DC) { solr_string_free(dest); solr_string_appends(dest, value, length); } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/solr_string.h000066400000000000000000000122711374041537100215310ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Israel Ekpo | +----------------------------------------------------------------------+ */ /* $Id$ */ #ifndef SOLR_STRING_H #define SOLR_STRING_H #include
#include #define SOLR_STRING_PERSISTENT 0 #define SOLR_STRING_START_SIZE 64 #define SOLR_STRING_INCREMENT_SIZE 128 #define SOLR_STRING_LONG_BUFFER_SIZE 16 #define SOLR_STRING_UNSIGNED_LONG_BUFFER_SIZE 32 #include "php_solr_api.h" #ifdef SOLR_DEBUG /* #define SOLR_MEM_DEBUG 1 Uncomment if you need memdebug enabled */ #endif #ifdef SOLR_MEM_DEBUG #define SOLR_MEM_DEBUG_DC , const char * mm_function, char * mm_filename, int mm_line #define SOLR_MEM_DEBUG_CC , mm_function, mm_filename, mm_line #define SOLR_MEM_DEBUG_RC , __func__, __FILE__, __LINE__ #else #define SOLR_MEM_DEBUG_DC #define SOLR_MEM_DEBUG_CC #define SOLR_MEM_DEBUG_RC #endif /** * solr_char_t * * iekpo 2009/08/28 * * Decided to create this type just in case there is a special need in the * future to use unsigned char instead of plain char to transport character * arrays within the library. * * Having this typedef will allow us to toggle easily between plain char and * unsigned char, without having to do a massive search and replace. * * There may be a few cases where casting may be needed to handle cases where * the sign of the variable is now the opposite. */ typedef char solr_char_t; /* Structure to store solr strings */ typedef struct _solr_string { solr_char_t *str; /* The buffer to store the character array. */ size_t len; /* The current length of the solr_string_t object */ size_t cap; /* The current capacity of the solr_string_t object */ } solr_string_t; #define SOLR_STRING_INITIALIZER {.str = ((solr_char_t *)0), .len = 0U, .cap = 0U} /* Appends a string constant to a solr_string_t */ #define solr_string_append_const(dest, str) solr_string_appends((dest), (solr_char_t *) str, sizeof(str)-1) /* Appends one solr_string_t to another */ #define solr_string_append_solr_string(dest, src) solr_string_appends((dest), (src)->str, (src)->len) /* Initializes the solr_string_t structure to empty values */ #define solr_string_init(dest) \ { \ (dest)->str = (solr_char_t *) 0x00; \ (dest)->len = 0U; \ (dest)->cap = 0U; \ } #define solr_strndup estrndup #define solr_strdup estrdup #define solr_strlen strlen #define solr_string_appends(dest, src, len) solr_string_appends_ex((dest), (src), (len) SOLR_MEM_DEBUG_RC) #define solr_string_appendc(dest, ch) solr_string_appendc_ex((dest), (ch) SOLR_MEM_DEBUG_RC) #define solr_string_append_long(dest, long_val) solr_string_append_long_ex((dest), (long_val) SOLR_MEM_DEBUG_RC) #define solr_string_append_unsigned_long(dest, long_val) solr_string_append_unsigned_long((dest), (long_val) SOLR_MEM_DEBUG_RC) #define solr_string_set(dest, value, length) solr_string_set_ex((dest), (value), (length) SOLR_MEM_DEBUG_RC) #define solr_string_free(dest) solr_string_free_ex((dest) SOLR_MEM_DEBUG_RC) PHP_SOLR_API void solr_string_appends_ex(solr_string_t *dest, const solr_char_t *src, size_t length SOLR_MEM_DEBUG_DC); PHP_SOLR_API void solr_string_appendc_ex(solr_string_t *dest, solr_char_t ch SOLR_MEM_DEBUG_DC); PHP_SOLR_API void solr_string_append_long_ex(solr_string_t *dest, long int long_val SOLR_MEM_DEBUG_DC); PHP_SOLR_API void solr_string_append_unsigned_long_ex(solr_string_t *dest, unsigned long int long_val SOLR_MEM_DEBUG_DC); PHP_SOLR_API void solr_string_remove_last_char(solr_string_t *dest); PHP_SOLR_API int solr_string_equal(const solr_string_t *a, const solr_string_t *b); PHP_SOLR_API void solr_destory_solr_string_zv(zval *solr_string_zv); PHP_SOLR_API void solr_string_free_ex(solr_string_t *dest SOLR_MEM_DEBUG_DC); PHP_SOLR_API void solr_string_set_ex(solr_string_t *dest, const solr_char_t *value, size_t length SOLR_MEM_DEBUG_DC); /* destroy data element of hashtable of solr_string_t */ #ifdef PHP_7 #define solr_destroy_solr_string solr_destory_solr_string_zv /* frees a solr_string_t within a zval */ #else #define solr_destroy_solr_string solr_string_free #endif #endif /* SOLR_STRING_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/src/php7/solr_types.h000066400000000000000000000314761374041537100213770ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ /* $Id$ */ #ifndef SOLR_TYPES_H #define SOLR_TYPES_H #include
#include #include #include #include /* Declaring workarounds for SSL private key constants */ #if LIBCURL_VERSION_NUM >= 0x071700 /* Use CURLOPT_KEYPASSWD as is */ #elif LIBCURL_VERSION_NUM >= 0x070903 #define CURLOPT_KEYPASSWD CURLOPT_SSLKEYPASSWD #else #define CURLOPT_KEYPASSWD CURLOPT_SSLCERTPASSWD #endif #include #include #include #include #include #include typedef unsigned char solr_bool; #include "solr_string.h" /* {{{ types for the http client */ typedef enum { SOLR_REQUEST_BEGIN = 0, SOLR_REQUEST_SEARCH = 1, /** 1 **/ SOLR_REQUEST_UPDATE = 2, /** 2 **/ SOLR_REQUEST_THREADS = 3, /** 3 **/ SOLR_REQUEST_PING = 4, /** 4 **/ SOLR_REQUEST_TERMS = 5, /** 5 **/ SOLR_REQUEST_SYSTEM = 6, /** 6 **/ SOLR_REQUEST_GET = 7, SOLR_REQUEST_END } solr_request_type_t; typedef enum { SOLR_SERVLET_TYPE_BEGIN = 0, SOLR_SERVLET_TYPE_SEARCH = 1, SOLR_SERVLET_TYPE_UPDATE = 2, SOLR_SERVLET_TYPE_THREADS = 4, SOLR_SERVLET_TYPE_PING = 8, SOLR_SERVLET_TYPE_TERMS = 16, SOLR_SERVLET_TYPE_SYSTEM = 32, SOLR_SERVLET_TYPE_GET = 64, SOLR_SERVLET_TYPE_END } solr_servlet_type_t; typedef enum { SOLR_PARAM_TYPE_BEGIN = 0, SOLR_PARAM_TYPE_NORMAL = 1, SOLR_PARAM_TYPE_SIMPLE_LIST = 2, SOLR_PARAM_TYPE_ARG_LIST = 4, SOLR_PARAM_TYPE_END } solr_param_type_t; typedef enum { SOLR_SORT_DIR_ASC = 0, SOLR_SORT_DIR_DESC = 1 } solr_sort_dir_t; typedef enum { SOLR_JSON_ERROR_NONE = 0, SOLR_JSON_ERROR_DEPTH, SOLR_JSON_ERROR_STATE_MISMATCH, SOLR_JSON_ERROR_CTRL_CHAR, SOLR_JSON_ERROR_SYNTAX, SOLR_JSON_ERROR_UTF8, SOLR_JSON_ERROR_SERIALIZATION } solr_json_error_codes_t; typedef struct curl_slist solr_http_header_list_t; typedef struct { solr_string_t buffer; /* Stores the HTTP request headers */ } solr_curl_send_headers_t; typedef struct _solr_curl_send_data { solr_string_t buffer; /* Stores the HTTP request data */ } solr_curl_send_data_t; typedef struct { solr_string_t buffer; /* Stores the HTTP response headers */ long int response_code; /* Stores the HTTP response code */ } solr_curl_response_headers_t; typedef struct { solr_string_t buffer; /* Stores the HTTP response data */ } solr_curl_response_data_t; typedef struct { char str[CURL_ERROR_SIZE + 1]; /* Stores the error message */ uint number; /* Stores the error number */ } solr_curl_error_t; typedef struct { solr_curl_send_headers_t request_header; solr_curl_send_data_t request_body; solr_curl_send_data_t request_body_debug; solr_curl_response_headers_t response_header; solr_curl_response_data_t response_body; solr_curl_error_t err; solr_string_t debug_data_buffer; /* Stores all the debug data */ size_t handle_status; /* Whether or not the handle is still usable */ CURLcode result_code; CURL *curl_handle; } solr_curl_t; typedef struct { long int host_port; /* HTTP port for Solr server */ long int proxy_port; /* Proxy port for Solr server */ long int timeout; /* maximum time in seconds allowed for the http data transfer operation */ long int secure; /* Whether to connect to Solr Server using SSL/HTTPS */ long int ssl_verify_peer; /* Determines whether libcurl verifies the peer certificate */ long int ssl_verify_host; /* Determines how libcurl verifies the server certificate */ solr_string_t hostname; /* IP address or domain name */ solr_string_t path; /* Path to solr */ solr_string_t http_auth_credentials; /* HTTP Auth username:password */ solr_string_t proxy_hostname; /* IP address of domain name for the proxy server */ solr_string_t proxy_auth_credentials; /* Proxy Auth username:password */ solr_string_t ssl_cert; /* File name to a PEM-formatted private key + private certificate (concatenated in that order) */ solr_string_t ssl_key; /* File name to a PEM-formatted private key */ solr_string_t ssl_keypassword; /* The pass phrase/password for the private ssl_key */ solr_string_t ssl_cainfo; /* Name of file holding one or more certificates to verify peer with */ solr_string_t ssl_capath; /* Name of directory holding multiple CA certificates to verify peer with */ solr_string_t qs_delimiter; /* The query string delimiter */ solr_string_t response_writer; /* The response writer type (wt parameter) */ solr_string_t update_url; /* URL used for updates */ solr_string_t search_url; /* URL used for queries */ solr_string_t thread_url; /* URL used for thread monitoring */ solr_string_t ping_url; /* URL for sending ping requests */ solr_string_t terms_url; /* URL for sending terms requests */ solr_string_t system_url; /* URL for sending system requests */ solr_string_t get_url; /* URL for sending realtime get requests */ solr_string_t update_servlet; /* The update servlet */ solr_string_t search_servlet; /* The search servlet */ solr_string_t thread_servlet; /* The thread servlet */ solr_string_t ping_servlet; /* The ping servlet */ solr_string_t terms_servlet; /* The terms servlet */ solr_string_t system_servlet; /* The system info servlet */ solr_string_t get_servlet; /* The realtime get servlet */ } solr_client_options_t; typedef struct { ulong client_index; /* Unique for the SolrClient instance. Used as index in HashTables */ uint request_count; /* The number of requests made from this client */ solr_client_options_t options; /* The connection options for this client */ solr_curl_t handle; /* The Solr handle for this client */ } solr_client_t; /* }}} */ /* Types for documents and collections */ /* {{{ Types for documents and collections */ /* {{{ Types for SolrDocument fields */ typedef struct _solr_field_value_t { solr_char_t *field_value; /* The value for this field */ struct _solr_field_value_t *next; /* The next entry in the queue */ } solr_field_value_t; /** * List of Fields in a Solr Document * * @field_boost stores the boost value * @count stores how many fields there are in the list * @field_name stores the name of the field * @head the first entry in the list (if any) * @last the last entry in the list (if any) */ typedef struct { double field_boost; /* The boost value for this field */ uint count; /* The number of values in this field */ solr_char_t *field_name; /* The name of the field */ solr_field_value_t *head; /* The first value in the queue */ solr_field_value_t *last; /* The last value in the queue */ } solr_field_list_t; /* }}} */ /* {{{ Types for Documents and Document Collections */ typedef struct { ulong document_index; /* Unique for the SolrInputDocument instance. Used as index in HashTables */ uint field_count; /* Number of fields in this document */ double document_boost; /* The boost value for this document */ HashTable *fields; /* HashTable for storing all the solr_field_list_t fields */ HashTable *children; /* Hashtable for storing child documents(zval *) */ } solr_document_t; /* }}} */ /* {{{ Types for Solr Query Parameters */ typedef struct { solr_string_t value; /* The value for this parameter */ solr_string_t arg; /* The argument for this value*/ solr_char_t *delimiter_override; /* overrides the arg_list delimiter for this particular argument */ solr_bool delimiter_overriden; /* is delimiter overriden */ } solr_arg_list_value_t; typedef union { solr_string_t normal; /* Stores normal parameters */ solr_string_t simple_list; /* Stores delimited list parameters */ solr_arg_list_value_t arg_list; /* Stores parameters that have arguments */ } solr_pvc_t; typedef struct _solr_param_value_t { solr_pvc_t contents; /* A union for the contents of this value */ struct _solr_param_value_t *prev; /* The previous value in the list */ struct _solr_param_value_t *next; /* The next value in the list */ } solr_param_value_t; /* Checks if two parameter values are equal */ typedef int (*solr_param_value_equal_func_t)(const solr_param_value_t *a, const solr_param_value_t *b); /* Used to retrieve all the values for this parameter as a single solr string */ typedef void (*solr_param_fetch_func_t)(void *solr_param, solr_string_t *buffer); /* Frees the parameter value and its contents. */ typedef void (*solr_param_value_free_func_t)(solr_param_value_t *param_value); typedef struct { solr_param_type_t type; /* What type of query parameter this is */ uint count; /* The number of values for this parameter */ solr_char_t *param_name; /* The name of the parameter */ size_t param_name_length; /* The length of name of the parameter */ solr_bool allow_multiple; /* Whether this parameter should store more than one value */ solr_param_value_t *head; /* The first value in the list */ solr_param_value_t *last; /* The last value in the list */ solr_param_fetch_func_t fetch_func; /* Retrieves all the value contents as a single solr_string_t */ solr_param_value_free_func_t value_free_func; /* Frees the value and its contents */ solr_param_value_equal_func_t value_equal_func; /* Checks if two values are equal */ solr_char_t delimiter; /* Default is "," Used to separate list parameter values */ solr_char_t arg_separator; /* Used only be arg_lists to separate arguments from values */ } solr_param_t; /* Used to retrieve parameter values just for display purposes */ typedef void (*solr_param_display_func_t)(solr_param_t *solr_param, zval *param_value_array); /* Used to retrieve parameter values just for the toString() method */ /* The url_encode parameter will be ignored for now */ typedef void (*solr_param_tostring_func_t)(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode); typedef struct { ulong params_index; /* The index for this object in the HashTable */ uint params_count; /* The number of parameters for the query object */ HashTable *params; /* The HashTable for storing query parameters */ } solr_params_t; /* }}} */ /* {{{ solr function/localparams type */ typedef struct { ulong function_index; /* The index for this object in the HashTable */ solr_char_t *name; size_t name_length; solr_char_t *argument; size_t argument_length; HashTable *params; /* The HashTable for storing function key-val parameters */ } solr_function_t; /* }}} */ /* }}} */ /* {{{ Extension Global : This should be the last data type declared. More members may be added later. */ ZEND_BEGIN_MODULE_GLOBALS(solr) uint request_count; /* The number of times PHP_RINIT has been called */ uint document_count; /* The number of active SolrDocuments in this request */ uint client_count; /* The number of active SolrClients in this request */ uint functions_count; /* The number of active Functions in this request */ HashTable *documents; /* HashTable for storing solr_document_t documents */ HashTable *clients; /* HashTable for storing solr_client_t clients */ HashTable *params; /* HashTable for storing solr_params_t parameter containers */ HashTable *functions; /* HashTable for storing solr_function_t */ ZEND_END_MODULE_GLOBALS(solr) /* }}} */ typedef struct { int code; solr_char_t *message; } solr_exception_t; #endif /* SOLR_TYPES_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.4.0/tests/000077500000000000000000000000001374041537100165055ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.4.0/tests/000.solr_server_compat.phpt000066400000000000000000000012501374041537100236060ustar00rootroot00000000000000--TEST-- Solr Server 4+ Compatibility Test --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $query_response = $client->system(); $solrVersion = $query_response->getResponse()->lucene['solr-spec-version']; $match = preg_match('#([0-9]+)\.[0-9]+\.[0-9]+#', $solrVersion, $matches); var_dump($matches[1] >=4 ); ?> --EXPECTF-- bool(true)php-solr-2.5.1+2.4.0/solr-2.4.0/tests/000.solrclient_ping.phpt000066400000000000000000000011021374041537100230650ustar00rootroot00000000000000--TEST-- SolrClient::ping() - Ping Solr Server --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $pingResponse = $client->ping(); echo $pingResponse->getRawResponse(); ?> --EXPECT-- HTTP/1.1 200 OK Content-Type: application/xml; charset=UTF-8 Content-Length: 0php-solr-2.5.1+2.4.0/solr-2.4.0/tests/001.solrclient_addDocument.phpt000066400000000000000000000017651374041537100243770ustar00rootroot00000000000000--TEST-- SolrClient::addDocument() - sending document to the Solr server --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 334455); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Lucene'); $doc2 = new SolrInputDocument(); $doc2->addField('id', 12345); $doc->addField('cat', 'Category1'); $doc->addField('cat', 'Category2'); $updateResponse = $client->addDocument($doc, true, 500); $updateResponse = $client->addDocument($doc2, true, 500); print_r($updateResponse->getResponse()); ?> --EXPECTF-- SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => 0 [QTime] => %d ) ) php-solr-2.5.1+2.4.0/solr-2.4.0/tests/002.solrclient_addDocuments.phpt000066400000000000000000000017541374041537100245610ustar00rootroot00000000000000--TEST-- SolrClient::addDocuments() - sending multiple documents to the Solr server --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 334455); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Lucene'); $doc2 = new SolrInputDocument(); $doc2->addField('id', 12345); $doc->addField('cat', 'Category1'); $doc->addField('cat', 'Category2'); $docs = array($doc, $doc2); $updateResponse = $client->addDocuments($docs); $client->commit(); print_r($updateResponse->getResponse()); ?> --EXPECTF-- SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => 0 [QTime] => %d ) ) php-solr-2.5.1+2.4.0/solr-2.4.0/tests/003.solrclient_addDocument_no_overwrite.phpt000066400000000000000000000015611374041537100271750ustar00rootroot00000000000000--TEST-- SolrClient::addDocument() - Overwrite an existing document --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 334455); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Solr'); $updateResponse = $client->addDocument($doc, false); $client->commit(); print $updateResponse->getRawRequest(); ?> --EXPECT-- 334455 Software Solr php-solr-2.5.1+2.4.0/solr-2.4.0/tests/004.solrclient_query_response.phpt000066400000000000000000000020161374041537100252240ustar00rootroot00000000000000--TEST-- SolrClient::query() - Sending a chained query request --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setQuery('lucene'); $query->setStart(0); $query->setRows(50); $query->addField('cat')->addField('features')->addField('id')->addField('timestamp'); $query_response = $client->query($query); $response = $query_response->getResponse(); var_dump(get_class($response->responseHeader->params) == 'SolrObject'); var_dump(property_exists($response->responseHeader->params, 'q')); var_dump(property_exists($response->responseHeader->params, 'wt')); var_dump(property_exists($response->responseHeader->params, 'version')); ?> --EXPECTF-- bool(true) bool(true) bool(true) bool(true)php-solr-2.5.1+2.4.0/solr-2.4.0/tests/005.solrclient_query_error.phpt000066400000000000000000000013341374041537100245220ustar00rootroot00000000000000--TEST-- SolrClient::query() - throw SolrClientException on Solr Server exception --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $query = new SolrQuery("lucene\\"); try { $query_response = $client->query($query); } catch (SolrServerException $e) { echo $e->getMessage(); } ?> --EXPECTF-- %s: Cannot parse 'lucene\': Lexical error at line 1, column 8. Encountered: after : ""php-solr-2.5.1+2.4.0/solr-2.4.0/tests/006.solrclient_system.phpt000066400000000000000000000012061374041537100234670ustar00rootroot00000000000000--TEST-- SolrClient::system() - Retrieve Solr Server/System Info --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $genericResponse = $client->system(); var_dump(get_class($genericResponse->getResponse())) . PHP_EOL; var_dump(get_class($genericResponse->getResponse()->system)); ?> --EXPECTF-- string(10) "SolrObject" string(10) "SolrObject" php-solr-2.5.1+2.4.0/solr-2.4.0/tests/007.solrclient_deleteByIds.phpt000066400000000000000000000021671374041537100243500ustar00rootroot00000000000000--TEST-- SolrClient::deleteByIds() - Test deleting documents by an array of IDS --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $response = $client->deleteByIds(array('334455','334456')); $client->commit(); print_r($response->getResponse()); try { $client->deleteByIds(array(0)); } catch (SolrIllegalArgumentException $e) { echo sprintf("Exception %d: %s", $e->getCode(), $e->getMessage()). PHP_EOL; } try { $client->deleteByIds(array('334455', '')); } catch (SolrIllegalArgumentException $e) { echo sprintf("Exception %d: %s", $e->getCode(), $e->getMessage()). PHP_EOL; } ?> --EXPECTF-- SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => %d [QTime] => %d ) ) Exception 4000: Id number 1 is not a valid string Exception 4000: Id number 2 is not a valid stringphp-solr-2.5.1+2.4.0/solr-2.4.0/tests/008.solrclient_commit.phpt000066400000000000000000000015361374041537100234430ustar00rootroot00000000000000--TEST-- SolrClient::commit() - Testing commit --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $updateResponse = $client->commit(); print $updateResponse->getRawRequest(); $updateResponse = $client->commit(true,false,true); print $updateResponse->getRawRequest(); $updateResponse = $client->commit(true,false,true); ?> --EXPECTF-- php-solr-2.5.1+2.4.0/solr-2.4.0/tests/009.solrclient_optimize.phpt000066400000000000000000000014461374041537100240140ustar00rootroot00000000000000--TEST-- SolrClient::optimize() - Testing optimize --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $updateResponse = $client->optimize(); print $updateResponse->getRawRequest(); $updateResponse = $client->optimize(4,true,false); print $updateResponse->getRawRequest(); ?> --EXPECTF-- php-solr-2.5.1+2.4.0/solr-2.4.0/tests/010.solrclient_getOptions.phpt000066400000000000000000000014061374041537100242730ustar00rootroot00000000000000--TEST-- SolrClient::getOptions - Returning all the default options --FILE-- false); $client = new SolrClient($options); var_dump($client->getOptions()); ?> --EXPECTF-- array(17) { ["timeout"]=> int(30) ["secure"]=> bool(false) ["hostname"]=> string(9) "localhost" ["wt"]=> string(3) "xml" ["port"]=> int(8983) ["proxy_host"]=> string(0) "" ["proxy_port"]=> int(0) ["path"]=> string(4) "solr" ["http_auth"]=> string(0) "" ["proxy_auth"]=> string(0) "" ["ssl_verify_peer"]=> bool(false) ["ssl_verify_host"]=> int(2) ["ssl_cert"]=> string(0) "" ["ssl_key"]=> string(0) "" ["ssl_keypassword"]=> string(0) "" ["ssl_cainfo"]=> string(0) "" ["ssl_capath"]=> string(0) "" } php-solr-2.5.1+2.4.0/solr-2.4.0/tests/011.solrclient_phps_response.phpt000066400000000000000000000007441374041537100250350ustar00rootroot00000000000000--TEST-- SolrClient - PHPS response writer support --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient ( $options ); $client->setResponseWriter('phps'); $options = $client->getOptions(); var_dump($options['wt'] == 'phps'); ?> --EXPECTF-- bool(true)php-solr-2.5.1+2.4.0/solr-2.4.0/tests/012.solrclient_getById.phpt000066400000000000000000000011701374041537100234670ustar00rootroot00000000000000--TEST-- SolrClient::getById() - Testing Real Time Get by id --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $response = $client->getById('GB18030TEST'); var_dump(isset($response->getArrayResponse()['doc'])).PHP_EOL; var_dump($response->getResponse()->doc->id) . PHP_EOL; ?> --EXPECTF-- bool(true) string(11) "GB18030TEST"php-solr-2.5.1+2.4.0/solr-2.4.0/tests/013.solrclient_getByIds.phpt000066400000000000000000000031321374041537100236530ustar00rootroot00000000000000--TEST-- SolrClient::getByIds() - Testing Real Time Get by ids --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $response = $client->getByIds(['GB18030TEST', '6H500F0']); var_dump(isset($response->getArrayResponse()['response']['docs'])) . PHP_EOL; var_dump($response->getResponse()->response->start) . PHP_EOL; try { $response = $client->getByIds(['GB18030TEST', '']); } catch (Exception $e) { printf("Exception %d: %s", $e->getCode(), $e->getMessage()); } echo PHP_EOL.PHP_EOL; // make sure request was reset echo "- Headers start".PHP_EOL; $response = $client->getByIds(['GB18030TEST']); $headers = explode(PHP_EOL, trim($response->getRawRequestHeaders())); sort($headers); print_r(implode(PHP_EOL, $headers).PHP_EOL); echo "- Headers End".PHP_EOL;; echo PHP_EOL; try { $response = $client->getByIds([]); } catch (Exception $e) { printf("Exception %d: %s", $e->getCode(), $e->getMessage()); } ?> --EXPECTF-- bool(true) int(0) Exception 4000: Invalid id at position 1 - Headers start Accept-Charset: utf-8 Accept: */* Authorization: Basic YWRtaW46Y2hhbmdlaXQ= Connection: keep-alive GET /solr/collection1/get/?version=2.2&indent=on&wt=xml&ids=GB18030TEST HTTP/1.1 Host: %s:8983 Keep-Alive: 300 User-Agent: %s - Headers End Exception 4000: Invalid parameter: at least 1 ID is required. Passed an empty array. php-solr-2.5.1+2.4.0/solr-2.4.0/tests/014.solrclient_addDocument_nested_document.phpt000066400000000000000000000040761374041537100276410ustar00rootroot00000000000000--TEST-- SolrClient::addDocument() - Sending a document with child documents --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 'CTEST_1'); $doc->addField('title', 'Solr adds block join support'); $doc->addField('content_type', 'parentDocument'); $doc2 = new SolrInputDocument(); $doc2->addField('id', 'CTEST_2'); $doc2->addField('comment_t', 'SolrCloud supports it too!'); $doc3 = new SolrInputDocument(); $doc3->addField('id', 'CTEST_3'); $doc3->addField('comment_t', 'Lots of features'); $doc->addChildDocument($doc2); $doc->addChildDocument($doc3); $doc4 = new SolrInputDocument(); $doc4->addField('id', 'CTEST_4'); $doc4->addField('comment_t', 'Child Child'); $doc3->addChildDocument($doc4); $docs = $doc->getChildDocuments(); $docs[0]->addField('one_more_field_t', 'testing'); $updateResponse = $client->addDocument($doc); print_r($updateResponse->getRawRequest()); print_r($updateResponse->getResponse()); $client->commit(); ?> --EXPECTF-- CTEST_1 Solr adds block join support parentDocument CTEST_2 SolrCloud supports it too! testing CTEST_3 Lots of features CTEST_4 Child Child SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => %d [QTime] => %d ) )php-solr-2.5.1+2.4.0/solr-2.4.0/tests/015.solrclient_addDocuments_nested_document.phpt000066400000000000000000000040341374041537100300170ustar00rootroot00000000000000--TEST-- SolrClient::addDocuments() - Sending multiple documents with child documents --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 'CTEST_1'); $doc->addField('title', 'Solr adds block join support'); $doc->addField('content_type', 'parentDocument'); $doc2 = new SolrInputDocument(); $doc2->addField('id', 'CTEST_2'); $doc2->addField('comment_t', 'SolrCloud supports it too!'); $doc3 = new SolrInputDocument(); $doc3->addField('id', 'CTEST_3'); $doc3->addField('content_type', 'parentDocument'); $doc3->addField('comment_t', 'Lots of features'); $doc4 = new SolrInputDocument(); $doc4->addField('id', 'CTEST_4'); $doc4->addField('comment_t', 'Cool features'); $doc->addChildDocument($doc2); $doc3->addChildDocument($doc4); $documents = [$doc, $doc3]; $updateResponse = $client->addDocuments($documents); print_r($updateResponse->getRawRequest()); print_r($updateResponse->getResponse()); $client->commit(); ?> --EXPECTF-- CTEST_1 Solr adds block join support parentDocument CTEST_2 SolrCloud supports it too! CTEST_3 parentDocument Lots of features CTEST_4 Cool features SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => %d [QTime] => %d ) )php-solr-2.5.1+2.4.0/solr-2.4.0/tests/020.solrdocument_adding_fields.phpt000066400000000000000000000027541374041537100252640ustar00rootroot00000000000000--TEST-- SolrDocument - checking dimension and magic property sets. --FILE-- addField('id', 1123); $doc->features = "PHP Client Side"; $doc->features = "Fast development cycles"; $doc['cat'] = 'Software'; $doc['cat'] = 'Custom Search'; $doc->cat = 'Information Technology'; print_r($doc->toArray()); ?> --EXPECT-- Array ( [document_boost] => 0 [field_count] => 3 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => 1123 ) ) [1] => SolrDocumentField Object ( [name] => features [boost] => 0 [values] => Array ( [0] => PHP Client Side [1] => Fast development cycles ) ) [2] => SolrDocumentField Object ( [name] => cat [boost] => 0 [values] => Array ( [0] => Software [1] => Custom Search [2] => Information Technology ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.4.0/tests/021.solrdocument_iterator.phpt000066400000000000000000000017661374041537100243440ustar00rootroot00000000000000--TEST-- SolrDocument - checking Iterator interface implementation --FILE-- addField('id', 1123); $doc->features = "PHP Client Side"; $doc->features = "Fast development cycles"; $doc['cat'] = 'Software'; $doc['cat'] = 'Custom Search'; $doc->cat = 'Information Technology'; foreach ($doc as $fieldname => $fieldvalues) { print "$fieldname\n"; print_r($fieldvalues); } ?> --EXPECT-- id SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => 1123 ) ) features SolrDocumentField Object ( [name] => features [boost] => 0 [values] => Array ( [0] => PHP Client Side [1] => Fast development cycles ) ) cat SolrDocumentField Object ( [name] => cat [boost] => 0 [values] => Array ( [0] => Software [1] => Custom Search [2] => Information Technology ) ) php-solr-2.5.1+2.4.0/solr-2.4.0/tests/022.solrdocument_getInputDocument.phpt000066400000000000000000000007541374041537100260060ustar00rootroot00000000000000--TEST-- SolrDocument::getInputDocument() - creating SolrInputDocument from SolrDocument --FILE-- addField('id', 1123); $doc->features = "PHP Client Side"; $doc->features = "Fast development cycles"; $doc['cat'] = 'Software'; $doc['cat'] = 'Custom Search'; $doc->cat = 'Information Technology'; $input_doc = $doc->getInputDocument(); var_dump(get_class($input_doc)); ?> --EXPECT-- string(17) "SolrInputDocument" php-solr-2.5.1+2.4.0/solr-2.4.0/tests/023.solrdocument_merge.phpt000066400000000000000000000031631374041537100236050ustar00rootroot00000000000000--TEST-- SolrDocument::merge() - merging source document into current document --FILE-- addField('id', 1123); $doc->features = "PHP Client Side"; $doc->features = "Fast development cycles"; $doc['cat'] = 'Software'; $doc['cat'] = 'Custom Search'; $doc->cat = 'Information Technology'; $second_doc->addField('cat', 'Lucene Search'); $second_doc->merge($doc, true); print_r($second_doc->toArray()); ?> --EXPECT-- Array ( [document_boost] => 0 [field_count] => 3 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => cat [boost] => 0 [values] => Array ( [0] => Software [1] => Custom Search [2] => Information Technology ) ) [1] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => 1123 ) ) [2] => SolrDocumentField Object ( [name] => features [boost] => 0 [values] => Array ( [0] => PHP Client Side [1] => Fast development cycles ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.4.0/tests/023.solrdocument_merge_no_overwrite.phpt000066400000000000000000000030401374041537100264010ustar00rootroot00000000000000--TEST-- SolrDocument::merge() - merging source document into current document without overwrite --FILE-- addField('id', 1123); $doc->features = "PHP Client Side"; $doc->features = "Fast development cycles"; $doc['cat'] = 'Software'; $doc['cat'] = 'Custom Search'; $doc->cat = 'Information Technology'; $second_doc->addField('cat', 'Lucene Search'); $second_doc->merge($doc, false); print_r($second_doc->toArray()); ?> --EXPECT-- Array ( [document_boost] => 0 [field_count] => 3 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => cat [boost] => 0 [values] => Array ( [0] => Lucene Search ) ) [1] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => 1123 ) ) [2] => SolrDocumentField Object ( [name] => features [boost] => 0 [values] => Array ( [0] => PHP Client Side [1] => Fast development cycles ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.4.0/tests/024.solrdocument_child_fetch.phpt000066400000000000000000000024241374041537100247420ustar00rootroot00000000000000--TEST-- SolrClient::query() - Query child documents SolrObject (Integ) --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_STORE_PATH, 'wt' => 'xml' ); $client = new SolrClient ( $options ); $query = new SolrQuery (); $query->setQuery ( 'id:1 AND {!parent which=$parentFilter}' ); $query->setParam ( 'parentFilter', 'content_type_s:product' ); $query->addFilterQuery('{!parent which=$parentFilter}'); $query->addField ( '*' ); $query->addField ( '[child parentFilter=$parentFilter]' ); $query->setStart ( 0 ); $query->setRows ( 50 ); $queryResponse = $client->query ( $query ); $response = $queryResponse->getResponse (); echo "----XML----" . PHP_EOL; var_dump($response->response->docs[0]->_childDocuments_[0]->id); echo "----JSON----" . PHP_EOL; $options['wt'] = 'json'; $client = new SolrClient ( $options ); $queryResponse = $client->query($query); $response = $queryResponse->getResponse (); var_dump($response->response->docs[0]->_childDocuments_[0]->id); ?> --EXPECT-- ----XML---- string(9) "IMM-HOW-S" ----JSON---- string(9) "IMM-HOW-S"php-solr-2.5.1+2.4.0/solr-2.4.0/tests/025.solrdocument_haschilddocuments.phpt000066400000000000000000000005141374041537100262060ustar00rootroot00000000000000--TEST-- SolrDocument::hasChildDocuments() - Method test --FILE-- response->docs[0]->hasChildDocuments()); ?> --EXPECT-- bool(true)php-solr-2.5.1+2.4.0/solr-2.4.0/tests/026.solrdocument_getchilddocscount.phpt000066400000000000000000000005221374041537100262120ustar00rootroot00000000000000--TEST-- SolrDocument::getChildDocumentsCount() - Method test --FILE-- response->docs[0]->getChildDocumentsCount()); ?> --EXPECT-- int(1)php-solr-2.5.1+2.4.0/solr-2.4.0/tests/027.solrdocument_getinputdocument_children.phpt000066400000000000000000000023611374041537100277570ustar00rootroot00000000000000--TEST-- SolrDocument::getInputDocument() - Where document has child docs --FILE-- response->docs as $doc) { $childrenOfTheInput = $doc->getInputDocument()->getChildDocuments(); if ($childrenOfTheInput) { $firstChild = $childrenOfTheInput[0]; var_dump(get_class($firstChild)); var_dump(current($childrenOfTheInput)->toArray()); } } ?> --EXPECT-- string(17) "SolrInputDocument" array(3) { ["document_boost"]=> float(0) ["field_count"]=> int(1) ["fields"]=> array(1) { [0]=> object(SolrDocumentField)#9 (3) { ["name"]=> string(2) "id" ["boost"]=> float(0) ["values"]=> array(1) { [0]=> string(9) "CHILD_1_1" } } } } string(17) "SolrInputDocument" array(3) { ["document_boost"]=> float(0) ["field_count"]=> int(1) ["fields"]=> array(1) { [0]=> object(SolrDocumentField)#10 (3) { ["name"]=> string(2) "id" ["boost"]=> float(0) ["values"]=> array(1) { [0]=> string(9) "CHILD_2_1" } } } } php-solr-2.5.1+2.4.0/solr-2.4.0/tests/040.solrobject_xmlresponse.phpt000066400000000000000000000050401374041537100245100ustar00rootroot00000000000000--TEST-- SolrObject - checking xml response digest --FILE-- --EXPECT-- SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => 0 [QTime] => 72 ) [system] => SolrObject Object ( [threadCount] => SolrObject Object ( [current] => 15 [peak] => 15 [daemon] => 13 ) [threadDump] => SolrObject Object ( [thread] => SolrObject Object ( [id] => 1 [name] => main [state] => RUNNABLE [native] => 1 [cpuTime] => 3340.0000ms [userTime] => 3180.0000ms [stackTrace] => Array ( [0] => java.net.PlainSocketImpl.socketAccept(Native Method) [1] => java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384) [2] => java.net.ServerSocket.implAccept(ServerSocket.java:450) [3] => java.net.ServerSocket.accept(ServerSocket.java:421) [4] => org.apache.catalina.core.StandardServer.await(StandardServer.java:389) [5] => org.apache.catalina.startup.Catalina.await(Catalina.java:642) [6] => org.apache.catalina.startup.Catalina.start(Catalina.java:602) [7] => sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [8] => sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [9] => sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [10] => java.lang.reflect.Method.invoke(Method.java:585) [11] => org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) [12] => org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) ) ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.4.0/tests/041.solrobject_illegal_operation.phpt000066400000000000000000000036111374041537100256250ustar00rootroot00000000000000--TEST-- SolrObject - checking illegal operation of modifying object --FILE-- email = "iekpo@php.net"; } catch (Exception $e) { var_dump($e->getCode()); var_dump($e->getMessage()); } try { $solrObject['usingOffset'] = 'test'; } catch (SolrIllegalOperationException $e) { echo sprintf("Exception %d: %s", $e->getCode(), $e->getMessage()) . PHP_EOL; } try { $solrObject['newprop2_dimension_access'] = 'test'; } catch (SolrIllegalOperationException $e) { echo sprintf("Exception %d: %s", $e->getCode(), $e->getMessage()) . PHP_EOL; } // unset try { unset($solrObject->responseHeader); } catch (SolrIllegalOperationException $e) { echo sprintf("Exception %d: %s", $e->getCode(), $e->getMessage()) . PHP_EOL; } try { unset($solrObject['responseHeader']); } catch (SolrIllegalOperationException $e) { echo sprintf("Exception %d: %s", $e->getCode(), $e->getMessage()) . PHP_EOL; } ?> --EXPECTF-- int(1006) string(83) "SolrObject instances are read-only. Properties cannot be added, updated or removed." Warning: main(): Attempting to set value for [usingOffset] property in a SolrObject instance in %s on line %d Exception 1006: SolrObject instances are read-only. Properties cannot be added, updated or removed. Warning: main(): Attempting to set value for [newprop2_dimension_access] property in a SolrObject instance in %s on line %d Exception 1006: SolrObject instances are read-only. Properties cannot be added, updated or removed. Warning: main(): Attempting to remove [responseHeader] property in a SolrObject instance in %s on line %d Exception 1006: SolrObject instances are read-only. Properties cannot be added, updated or removed. Warning: main(): Attempting to remove [responseHeader] property in a SolrObject instance in %s on line %d Exception 1006: SolrObject instances are read-only. Properties cannot be added, updated or removed.php-solr-2.5.1+2.4.0/solr-2.4.0/tests/042.solrobject_magic_property.phpt000066400000000000000000000023641374041537100251650ustar00rootroot00000000000000--TEST-- SolrObject - testing the magic property access --FILE-- system->threadDump->thread->stackTrace); ?> --EXPECT-- Array ( [0] => java.net.PlainSocketImpl.socketAccept(Native Method) [1] => java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384) [2] => java.net.ServerSocket.implAccept(ServerSocket.java:450) [3] => java.net.ServerSocket.accept(ServerSocket.java:421) [4] => org.apache.catalina.core.StandardServer.await(StandardServer.java:389) [5] => org.apache.catalina.startup.Catalina.await(Catalina.java:642) [6] => org.apache.catalina.startup.Catalina.start(Catalina.java:602) [7] => sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [8] => sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [9] => sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [10] => java.lang.reflect.Method.invoke(Method.java:585) [11] => org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) [12] => org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) ) php-solr-2.5.1+2.4.0/solr-2.4.0/tests/043.solrobject_magic_properties.phpt000066400000000000000000000006251374041537100254740ustar00rootroot00000000000000--TEST-- SolrObject - test property access --FILE-- responseHeader; $system = $solrObject->system; var_dump(isset($solrObject['system'])); var_dump(property_exists($solrObject, 'system')); ?> --EXPECT-- bool(true) bool(true)php-solr-2.5.1+2.4.0/solr-2.4.0/tests/044.solrobject_dimension_access_properties.phpt000066400000000000000000000044111374041537100277200ustar00rootroot00000000000000--TEST-- SolrObject - checking dimension access on properties. --FILE-- --EXPECT-- SolrObject Object ( [status] => 0 [QTime] => 72 ) SolrObject Object ( [threadCount] => SolrObject Object ( [current] => 15 [peak] => 15 [daemon] => 13 ) [threadDump] => SolrObject Object ( [thread] => SolrObject Object ( [id] => 1 [name] => main [state] => RUNNABLE [native] => 1 [cpuTime] => 3340.0000ms [userTime] => 3180.0000ms [stackTrace] => Array ( [0] => java.net.PlainSocketImpl.socketAccept(Native Method) [1] => java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384) [2] => java.net.ServerSocket.implAccept(ServerSocket.java:450) [3] => java.net.ServerSocket.accept(ServerSocket.java:421) [4] => org.apache.catalina.core.StandardServer.await(StandardServer.java:389) [5] => org.apache.catalina.startup.Catalina.await(Catalina.java:642) [6] => org.apache.catalina.startup.Catalina.start(Catalina.java:602) [7] => sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [8] => sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [9] => sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [10] => java.lang.reflect.Method.invoke(Method.java:585) [11] => org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) [12] => org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.4.0/tests/045.solrobject_array_access.phpt000066400000000000000000000044071374041537100246030ustar00rootroot00000000000000--TEST-- SolrObject - checking dimension access on properties. --FILE-- --EXPECT-- SolrObject Object ( [status] => 0 [QTime] => 72 ) SolrObject Object ( [threadCount] => SolrObject Object ( [current] => 15 [peak] => 15 [daemon] => 13 ) [threadDump] => SolrObject Object ( [thread] => SolrObject Object ( [id] => 1 [name] => main [state] => RUNNABLE [native] => 1 [cpuTime] => 3340.0000ms [userTime] => 3180.0000ms [stackTrace] => Array ( [0] => java.net.PlainSocketImpl.socketAccept(Native Method) [1] => java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384) [2] => java.net.ServerSocket.implAccept(ServerSocket.java:450) [3] => java.net.ServerSocket.accept(ServerSocket.java:421) [4] => org.apache.catalina.core.StandardServer.await(StandardServer.java:389) [5] => org.apache.catalina.startup.Catalina.await(Catalina.java:642) [6] => org.apache.catalina.startup.Catalina.start(Catalina.java:602) [7] => sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [8] => sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [9] => sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [10] => java.lang.reflect.Method.invoke(Method.java:585) [11] => org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) [12] => org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.4.0/tests/046.solrobject_getpropertynames.phpt000066400000000000000000000006751374041537100255600ustar00rootroot00000000000000--TEST-- SolrObject - SolrObject::getPropertyNames() --FILE-- getPropertyNames()); require_once "bootstrap.inc"; $xml_reponse = file_get_contents(EXAMPLE_RESPONSE_XML_1); $solrObject = SolrUtils::digestXMLResponse($xml_reponse); var_dump($solrObject->getPropertyNames()); ?> --EXPECT-- array(0) { } array(2) { [0]=> string(14) "responseHeader" [1]=> string(6) "system" } php-solr-2.5.1+2.4.0/solr-2.4.0/tests/050.solrinputdocument_addchilddocument_01.phpt000066400000000000000000000014411374041537100273560ustar00rootroot00000000000000--TEST-- SolrInputDocument::addChildDocument() - add child document --FILE-- addField('id', 1123); $doc->addField('features', "PHP Client Side"); $doc->addField('features', "Fast development cycles"); $doc->cat = 'Information Technology'; $secondDoc->addField('cat', 'Lucene Search'); $secondDoc->cat = 'Custom Search'; $doc->addChildDocument($secondDoc); var_dump($doc->hasChildDocuments(), $secondDoc->hasChildDocuments()); $childs = $doc->getChildDocuments(); print_r($childs[0]->getField('cat')); ?> --EXPECT-- bool(true) bool(false) SolrDocumentField Object ( [name] => cat [boost] => 0 [values] => Array ( [0] => Lucene Search ) ) php-solr-2.5.1+2.4.0/solr-2.4.0/tests/050.solrinputdocument_addchilddocument_02_error.phpt000066400000000000000000000014511374041537100305710ustar00rootroot00000000000000--TEST-- SolrInputDocument::addChildDocument()/SolrInputDocument::addChildDocuments() - Expected SolrIllegalArgumentException --FILE-- addField('id', 1123); $doc->addField('features', "PHP Client Side"); $doc->addField('features', "Fast development cycles"); $doc->cat = 'Information Technology'; try { $doc->addChildDocument($child1); } catch (SolrIllegalArgumentException $e) { echo $e->getMessage(). PHP_EOL; } $children = array($child1, $child2); try { $doc->addChildDocuments($children); } catch (SolrIllegalArgumentException $e) { echo $e->getMessage(). PHP_EOL; } ?> --EXPECT-- Child document has no fields SolrInputDocument number 1 has no fieldsphp-solr-2.5.1+2.4.0/solr-2.4.0/tests/051.solrinputdocument_getchilddocuments.phpt000066400000000000000000000012651374041537100272750ustar00rootroot00000000000000--TEST-- SolrInputDocument::getChildDocuments() - test --FILE-- addField('id', 1123); $doc->addField('features', "PHP Client Side"); $doc->addField('features', "Fast development cycles"); $doc->cat = 'Information Technology'; $secondDoc->addField('cat', 'Lucene Search'); $secondDoc->cat = 'Custom Search'; $doc->addChildDocument($secondDoc); $childs = $doc->getChildDocuments(); print_r($childs[0]->getField('cat')); ?> --EXPECT-- SolrDocumentField Object ( [name] => cat [boost] => 0 [values] => Array ( [0] => Lucene Search ) )php-solr-2.5.1+2.4.0/solr-2.4.0/tests/052.solrinputdocument_haschilddocuments.phpt000066400000000000000000000011041374041537100272620ustar00rootroot00000000000000--TEST-- SolrInputDocument::hasChildDocuments() - test --FILE-- addField('id', 1123); $doc->addField('features', "PHP Client Side"); $doc->addField('features', "Fast development cycles"); $doc->cat = 'Information Technology'; $secondDoc->addField('cat', 'Lucene Search'); $secondDoc->cat = 'Custom Search'; $doc->addChildDocument($secondDoc); var_dump($doc->hasChildDocuments()); var_dump($secondDoc->hasChildDocuments()); ?> --EXPECT-- bool(true) bool(false)php-solr-2.5.1+2.4.0/solr-2.4.0/tests/053.solrinputdocument_getchilddocumentscount.phpt000066400000000000000000000011121374041537100303370ustar00rootroot00000000000000--TEST-- SolrInputDocument::getChildDocumentsCount() - test --FILE-- addField('id', 1123); $doc->addField('features', "PHP Client Side"); $doc->addField('features', "Fast development cycles"); $doc->cat = 'Information Technology'; $secondDoc->addField('cat', 'Lucene Search'); $secondDoc->cat = 'Custom Search'; $doc->addChildDocument($secondDoc); var_dump($doc->getChildDocumentsCount()); var_dump($secondDoc->getChildDocumentsCount()); ?> --EXPECT-- int(1) int(0)php-solr-2.5.1+2.4.0/solr-2.4.0/tests/054.solrinputdocument_addchilddocuments.phpt000066400000000000000000000013271374041537100272500ustar00rootroot00000000000000--TEST-- SolrInputDocument::addChildDocuments() - add child documents --FILE-- addField('id', 1123); $doc->addField('features', "PHP Client Side"); $doc->addField('features', "Fast development cycles"); $doc->cat = 'Information Technology'; $doc2->addField('cat', 'Lucene Search'); $doc2->cat = 'Custom Search'; $doc2->addField('cat', 'Lucene Search'); $doc2->cat = 'Custom Search'; $doc3->addField('cat', 'Lucene Search'); $doc3->cat = 'Custom Search'; $docs = array($doc2, $doc3); $doc->addChildDocuments($docs); var_dump($doc->getChildDocumentsCount()); ?> --EXPECT-- int(2)php-solr-2.5.1+2.4.0/solr-2.4.0/tests/055.solrinputdocument_serialization.phpt000066400000000000000000000004521374041537100264460ustar00rootroot00000000000000--TEST-- SolrInputDocument - serialize/unserialize Exception --FILE-- getMessage().PHP_EOL; } ?> --EXPECT-- SolrInputDocument objects cannot be serialized or unserializedphp-solr-2.5.1+2.4.0/solr-2.4.0/tests/060.solrquery_comon_query_params.phpt000066400000000000000000000030331374041537100257350ustar00rootroot00000000000000--TEST-- SolrQuery - testing CommonQueryParameters --FILE-- getQuery(), $query->getTimeAllowed(), $query->getStart(), $query->getRows(), $query->getFields(), $query->getFilterQueries(), $query->getSortFields() ); $nullOutput = ob_get_clean(); $query->setParam('a', 1); $query->setParam('b', 2); $query->setParam('c', 3); $query->setStart(4)->setQuery('solr')->setTimeAllowed(500)->setRows(17); $query->addField('israel')->addField('joshua')->addField('june'); $query->addSortField('cat', SolrQuery::ORDER_ASC); $query->addFilterQuery('solr')->addFilterQuery('solr1')->addFilterQuery('solr2'); $query ->setShowDebugInfo(true) ->setExplainOther('id:SOL*') ->setOmitHeader(false) ->setEchoHandler(true) ->setEchoParams('all') ; echo $query . PHP_EOL . PHP_EOL; var_dump( $query->getQuery(), $query->getTimeAllowed(), $query->getStart(), $query->getRows(), $query->getFields(), $query->getFilterQueries(), $query->getSortFields() ); echo $nullOutput; ?> --EXPECT-- a=1&b=2&c=3&start=4&q=solr&timeAllowed=500&rows=17&fl=israel,joshua,june&sort=cat asc&fq=solr&fq=solr1&fq=solr2&debugQuery=true&explainOther=id:SOL*&omitHeader=false&echoHandler=true&echoParams=all string(4) "solr" int(500) int(4) int(17) array(3) { [0]=> string(6) "israel" [1]=> string(6) "joshua" [2]=> string(4) "june" } array(3) { [0]=> string(4) "solr" [1]=> string(5) "solr1" [2]=> string(5) "solr2" } array(1) { [0]=> string(7) "cat asc" } NULL NULL NULL NULL NULL NULL NULLphp-solr-2.5.1+2.4.0/solr-2.4.0/tests/061.solrquery_simpleFacetParameters.phpt000066400000000000000000000036351374041537100263230ustar00rootroot00000000000000--TEST-- SolrQuery - testing SimpleFacetParameters --FILE-- setFacet(0); $query->addFacetField('israel')->addFacetField('israel2'); $query->addFacetQuery('silk')->addFacetQuery('name:june'); $query->setFacetPrefix('A')->setFacetPrefix('C', 'june'); $query->setFacetSort(1)->setFacetSort(0, 'june'); $query->setFacetLimit(98)->setFacetLimit(44, 'june'); $query->setFacetOffset(110)->setFacetOffset(12, 'june'); $query->setFacetMinCount(4)->setFacetMinCount(30, 'june'); $query->setFacetMissing(1)->setFacetMissing(0, 'june'); $query->setFacetMethod('enum')->setFacetMethod('fc', 'june'); $query->setFacetEnumCacheMinDefaultFrequency(25); echo $query . PHP_EOL . PHP_EOL; var_dump( $query->getFacet(), $query->getFacetFields(), $query->getFacetQueries(), $query->getFacetPrefix(), $query->getFacetPrefix('june'), $query->getFacetSort(), $query->getFacetSort('june'), $query->getFacetLimit(), $query->getFacetLimit('june'), $query->getFacetOffset(), $query->getFacetOffset('june'), $query->getFacetMinCount(), $query->getFacetMinCount('june'), $query->getFacetMissing(), $query->getFacetMissing('june'), $query->getFacetMethod(), $query->getFacetMethod('june') ); ?> --EXPECTF-- facet=false&facet.field=israel&facet.field=israel2&facet.query=silk&facet.query=name:june&facet.prefix=A&f.june.facet.prefix=C&facet.sort=count&f.june.facet.sort=index&facet.limit=98&f.june.facet.limit=44&facet.offset=110&f.june.facet.offset=12&facet.mincount=4&f.june.facet.mincount=30&facet.missing=true&f.june.facet.missing=false&facet.method=enum&f.june.facet.method=fc&facet.enum.cache.minDf=25 bool(false) array(2) { [0]=> string(6) "israel" [1]=> string(7) "israel2" } array(2) { [0]=> string(4) "silk" [1]=> string(9) "name:june" } string(1) "A" string(1) "C" int(1) int(0) int(98) int(44) int(110) int(12) int(4) int(30) bool(true) bool(false) string(4) "enum" string(2) "fc" php-solr-2.5.1+2.4.0/solr-2.4.0/tests/062.solrquery_date_facet_parameters.phpt000066400000000000000000000037041374041537100263430ustar00rootroot00000000000000--TEST-- SolrQuery - Testing Date facet parameters --FILE-- getFacetDateFields(), $query->getFacetDateStart(), $query->getFacetDateStart('june'), $query->getFacetDateEnd(), $query->getFacetDateEnd('israel'), $query->getFacetDateGap(), $query->getFacetDateGap('june'), $query->getFacetDateHardEnd(), $query->getFacetDateHardEnd('june'), $query->getFacetDateOther(), $query->getFacetDateOther('june') ); $nullOutput = ob_get_clean(); $query->addFacetDateField('israel') ->addFacetDateField('israel') ->removeFacetDateField('israel') ; $query->setFacetDateStart('January')->setFacetDateStart('Feb', 'june'); $query->setFacetDateEnd('Jan')->setFacetDateEnd('Febr', 'israel'); $query->setFacetDateGap('AOL')->setFacetDateGap('YAHOO', 'june'); $query->setFacetDateHardEnd(1)->setFacetDateHardEnd(0,'june'); $query->addFacetDateOther('Google') ->addFacetDateOther('Yahoos','june') ->addFacetDateOther('removeme') ->removeFacetDateOther('removeme'); echo $query. PHP_EOL . PHP_EOL; var_dump( $query->getFacetDateFields(), $query->getFacetDateStart(), $query->getFacetDateStart('june'), $query->getFacetDateEnd(), $query->getFacetDateEnd('israel'), $query->getFacetDateGap(), $query->getFacetDateGap('june'), $query->getFacetDateHardEnd(), $query->getFacetDateHardEnd('june'), $query->getFacetDateOther(), $query->getFacetDateOther('june') ); echo $nullOutput; ?> --EXPECTF-- facet.date=israel&facet.date.start=January&f.june.facet.date.start=Feb&facet.date.end=Jan&f.israel.facet.date.end=Febr&facet.date.gap=AOL&f.june.facet.date.gap=YAHOO&facet.date.hardend=true&f.june.facet.date.hardend=false&f.june.facet.date.other=Yahoos array(1) { [0]=> string(6) "israel" } string(7) "January" string(3) "Feb" string(3) "Jan" string(4) "Febr" string(3) "AOL" string(5) "YAHOO" bool(true) bool(false) NULL array(1) { [0]=> string(6) "Yahoos" } NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULLphp-solr-2.5.1+2.4.0/solr-2.4.0/tests/063.solrquery_HighlightingParameters.phpt000066400000000000000000000115731374041537100264760ustar00rootroot00000000000000--TEST-- SolrQuery - testing HighlightingParameters --FILE-- getHighlight(), $query->getHighlightFields(), $query->getHighlightSnippets(), $query->getHighlightSnippets('june'), $query->getHighlightFragsize(), $query->getHighlightFragsize('june'), $query->getHighlightMergeContiguous(), $query->getHighlightMergeContiguous('june'), $query->getHighlightRequireFieldMatch(), $query->getHighlightMaxAnalyzedChars(), $query->getHighlightAlternateField(), $query->getHighlightAlternateField('june'), $query->getHighlightMaxAlternateFieldLength(), $query->getHighlightMaxAlternateFieldLength('june'), $query->getHighlightFormatter(), $query->getHighlightFormatter('june'), $query->getHighlightSimplePre(), $query->getHighlightSimplePre('june'), $query->getHighlightSimplePost(), $query->getHighlightSimplePost('june'), $query->getHighlightFragmenter(), $query->getHighlightFragmenter('june'), $query->getHighlightUsePhraseHighlighter(), $query->getHighlightHighlightMultiTerm(), $query->getHighlightRegexSlop(), $query->getHighlightRegexPattern(), $query->getHighlightRegexMaxAnalyzedChars() ); $nullOutput = ob_get_clean(); $query->setHighlight(0); $query->addHighlightField('a')->addHighlightField('a')->addHighlightField('a') ->addHighlightField('b'); $query->removeHighlightField('a')->removeHighlightField('a')->removeHighlightField('a'); $query->setHighlightSnippets(4)->setHighlightSnippets(5, 'june'); $query->setHighlightFragsize(41)->setHighlightFragsize(52, 'june'); $query->setHighlightMergeContiguous(true)->setHighlightMergeContiguous(false, 'june'); $query->setHighlightRequireFieldMatch(true); $query->setHighlightMaxAnalyzedChars(44)->setHighlightMaxAnalyzedChars(53); $query->setHighlightAlternateField('pizza')->setHighlightAlternateField('bread', 'june'); $query->setHighlightAlternateField('blue')->setHighlightAlternateField('red','june'); $query->setHighlightAlternateField('a')->setHighlightAlternateField('b','june'); $query->setHighlightMaxAlternateFieldLength(300)->setHighlightMaxAlternateFieldLength(335, 'june'); $query->setHighlightFormatter('F')->setHighlightFormatter('G', 'june'); $query->setHighlightSimplePre('OO')->setHighlightSimplePre('PP', 'june'); $query->setHighlightSimplePost('ZZ')->setHighlightSimplePost('YY', 'june'); $query->setHighlightFragmenter('gap')->setHighlightFragmenter('space', 'june'); $query->setHighlightUsePhraseHighlighter(false); $query->setHighlightHighlightMultiTerm(1); $query->setHighlightRegexSlop(0.0025); $query->setHighlightRegexPattern("israel")->setHighlightRegexPattern("ekpo"); $query->setHighlightRegexMaxAnalyzedChars(444)->setHighlightRegexMaxAnalyzedChars(5.0); echo $query . PHP_EOL . PHP_EOL; var_dump( $query->getHighlight(), $query->getHighlightFields(), $query->getHighlightSnippets(), $query->getHighlightSnippets('june'), $query->getHighlightFragsize(), $query->getHighlightFragsize('june'), $query->getHighlightMergeContiguous(), $query->getHighlightMergeContiguous('june'), $query->getHighlightRequireFieldMatch(), $query->getHighlightMaxAnalyzedChars(), $query->getHighlightAlternateField(), $query->getHighlightAlternateField('june'), $query->getHighlightMaxAlternateFieldLength(), $query->getHighlightMaxAlternateFieldLength('june'), $query->getHighlightFormatter(), $query->getHighlightFormatter('june'), $query->getHighlightSimplePre(), $query->getHighlightSimplePre('june'), $query->getHighlightSimplePost(), $query->getHighlightSimplePost('june'), $query->getHighlightFragmenter(), $query->getHighlightFragmenter('june'), $query->getHighlightUsePhraseHighlighter(), $query->getHighlightHighlightMultiTerm(), $query->getHighlightRegexSlop(), $query->getHighlightRegexPattern(), $query->getHighlightRegexMaxAnalyzedChars() ); echo PHP_EOL.$nullOutput; ?> --EXPECT-- hl=false&hl.fl=b&hl.snippets=4&f.june.hl.snippets=5&hl.fragsize=41&f.june.hl.fragsize=52&hl.mergeContiguous=true&f.june.hl.mergeContiguous=false&hl.requireFieldMatch=true&hl.maxAnalyzedChars=53&hl.alternateField=a&f.june.hl.alternateField=b&hl.maxAlternateFieldLength=300&f.june.hl.maxAlternateFieldLength=335&hl.formatter=F&f.june.hl.formatter=G&hl.simple.pre=OO&f.june.hl.simple.pre=PP&hl.simple.post=ZZ&f.june.hl.simple.post=YY&hl.fragmenter=gap&f.june.hl.fragmenter=space&hl.usePhraseHighlighter=false&hl.highlightMultiTerm=true&hl.regex.slop=0.0025&hl.regex.pattern=ekpo&hl.regex.maxAnalyzedChars=5 bool(false) array(1) { [0]=> string(1) "b" } int(4) int(5) int(41) int(52) bool(true) bool(false) bool(true) int(53) string(1) "a" string(1) "b" int(300) int(335) string(1) "F" string(1) "G" string(2) "OO" string(2) "PP" string(2) "ZZ" string(2) "YY" string(3) "gap" string(5) "space" bool(false) bool(true) float(0.0025) string(4) "ekpo" int(5) NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL php-solr-2.5.1+2.4.0/solr-2.4.0/tests/064.solrquery_StatsComponent.phpt000066400000000000000000000015401374041537100250200ustar00rootroot00000000000000--TEST-- SolrQuery - testing StatsComponent --FILE-- getStats(), $query->getStatsFields(), $query->getStatsFacets() ); $nullOutput = ob_get_clean(); $query->setStats(0); $query ->addStatsField('hello') ->removeStatsField('hello') ->addStatsField('june') ->addStatsField('july') ; $query ->addStatsFacet('world') ->removeStatsFacet('world') ->addStatsFacet('pear') ->addStatsFacet('pecl') ; echo $query . PHP_EOL . PHP_EOL; var_dump( $query->getStats(), $query->getStatsFields(), $query->getStatsFacets() ); echo $nullOutput; ?> --EXPECTF-- stats=false&stats.field=june&stats.field=july&stats.facet=pear&stats.facet=pecl bool(false) array(2) { [0]=> string(4) "june" [1]=> string(4) "july" } array(2) { [0]=> string(4) "pear" [1]=> string(4) "pecl" } NULL NULL NULLphp-solr-2.5.1+2.4.0/solr-2.4.0/tests/065.solrquery_MoreLikeThis.phpt000066400000000000000000000034641374041537100244060ustar00rootroot00000000000000--TEST-- SolrQuery - testing MoreLikeThis component --FILE-- getMlt(), $query->getMltCount(), $query->getMltFields(), $query->getMltQueryFields(), $query->getMltMinTermFrequency(), $query->getMltMinDocFrequency(), $query->getMltMinWordLength(), $query->getMltMaxWordLength(), $query->getMltMaxNumTokens(), $query->getMltMaxNumQueryTerms(), $query->getMltBoost() ); $nullOutput = ob_get_clean(); $query->setMlt(1); $query->setMltCount(55)->setMltCount(90); $query->addMltField('june')->addMltField('joshua')->addMltField('mom')->removeMltField('joshua'); $query->addMltQueryField('june', 0.0)->addMltQueryField('israel', 9.558) ->addMltQueryField('removeme', 0.0) ->removeMltQueryField('removeme') ; $query->setMltMinTermFrequency(9); $query->setMltMinDocFrequency(5); $query->setMltMinWordLength(8); $query->setMltMaxWordLength(99); $query->setMltMaxNumTokens(6); $query->setMltMaxNumQueryTerms(2); $query->setMltBoost(true); echo $query . PHP_EOL . PHP_EOL; var_dump( $query->getMlt(), $query->getMltCount(), $query->getMltFields(), $query->getMltQueryFields(), $query->getMltMinTermFrequency(), $query->getMltMinDocFrequency(), $query->getMltMinWordLength(), $query->getMltMaxWordLength(), $query->getMltMaxNumTokens(), $query->getMltMaxNumQueryTerms(), $query->getMltBoost() ); echo $nullOutput; ?> --EXPECTF-- mlt=true&mlt.count=90&mlt.fl=june,mom&mlt.qf=june^0 israel^9.558&mlt.mintf=9&mlt.mindf=5&mlt.minwl=8&mlt.maxwl=99&mlt.maxntp=6&mlt.maxqt=2&mlt.boost=true bool(true) int(90) array(2) { [0]=> string(4) "june" [1]=> string(3) "mom" } array(2) { [0]=> string(6) "june^0" [1]=> string(12) "israel^9.558" } int(9) int(5) int(8) int(99) int(6) int(2) bool(true) NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULLphp-solr-2.5.1+2.4.0/solr-2.4.0/tests/066.solrquery_TermsComponent.phpt000066400000000000000000000034571374041537100250270ustar00rootroot00000000000000--TEST-- SolrQuery - testing TermsComponent --FILE-- getTerms(), $query->getTermsField(), $query->getTermsLowerBound(), $query->getTermsUpperBound(), $query->getTermsIncludeLowerBound(), $query->getTermsIncludeUpperBound(), $query->getTermsMinCount(), $query->getTermsMaxCount(), $query->getTermsPrefix(), $query->getTermsLimit(), $query->getTermsReturnRaw(), $query->getTermsSort() ); }; ob_start(); $dumpVars(); $nullOutput = ob_get_clean(); $query->setTerms(true); $query->setTermsField('israel'); $query->setTermsLowerBound('june'); $query->setTermsUpperBound('joshua'); $query->setTermsIncludeLowerBound(false); $query->setTermsIncludeUpperBound(0); $query->setTermsMinCount(50); $query->setTermsMaxCount(200); $query->setTermsPrefix('A'); $query->setTermsLimit(45); $query->setTermsReturnRaw(false); $query->setTermsSort(SolrQuery::TERMS_SORT_INDEX); echo $query . PHP_EOL . PHP_EOL; $dumpVars(); $query->setTermsSort(SolrQuery::TERMS_SORT_COUNT); echo PHP_EOL . $query . PHP_EOL . PHP_EOL; var_dump( $query->getTermsSort() ); echo $nullOutput; ?> --EXPECTF-- terms=true&terms.fl=israel&terms.lower=june&terms.upper=joshua&terms.lower.incl=false&terms.upper.incl=false&terms.mincount=50&terms.maxcount=200&terms.prefix=A&terms.limit=45&terms.raw=false&terms.sort=index bool(true) string(6) "israel" string(4) "june" string(6) "joshua" bool(false) bool(false) int(50) int(200) string(1) "A" int(45) bool(false) int(0) terms=true&terms.fl=israel&terms.lower=june&terms.upper=joshua&terms.lower.incl=false&terms.upper.incl=false&terms.mincount=50&terms.maxcount=200&terms.prefix=A&terms.limit=45&terms.raw=false&terms.sort=count int(1) NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL php-solr-2.5.1+2.4.0/solr-2.4.0/tests/067.solrquery__construct.phpt000066400000000000000000000004401374041537100242230ustar00rootroot00000000000000--TEST-- SolrQuery::_construct - Throws exception on illegal Argument --FILE-- getMessage(); } ?> --EXPECT-- SolrQuery::__construct() expects parameter 1 to be string, object givenphp-solr-2.5.1+2.4.0/solr-2.4.0/tests/068.solrquery_parameters_error.phpt000066400000000000000000000014231374041537100254170ustar00rootroot00000000000000--TEST-- SolrQuery - Invalid Parameters thorws exception Throws exception on illegal Argument --FILE-- setQuery(''); }catch (SolrIllegalArgumentException $e) { echo $e->getMessage().PHP_EOL; try { // simple list $query->addField(''); } catch (SolrIllegalArgumentException $e) { echo $e->getMessage().PHP_EOL; try { // argument list $query->addSortField(''); } catch (SolrIllegalArgumentException $e) { echo $e->getMessage().PHP_EOL; try { $params->addParam('',1); } catch (Exception $e) { echo $e->getMessage().PHP_EOL; } } } } ?> --EXPECT-- Invalid parameter value Invalid parameter value Invalid parameter value Invalid parameter name php-solr-2.5.1+2.4.0/solr-2.4.0/tests/069.solrquery_GroupParameters.phpt000066400000000000000000000044401374041537100251660ustar00rootroot00000000000000--TEST-- SolrQuery - Result Grouping (Group Parameters) --FILE-- setGroup(true); $query->addGroupField('category')->addGroupField('featured'); $query->addGroupFunction('ceil(internalScore)'); $query->addGroupQuery('silk')->addGroupQuery('name:june'); $query->setGroupLimit(98); $query->setGroupOffset(110); $query->addGroupSortField('count', SolrQuery::ORDER_ASC); $query->addGroupSortField('name', SolrQuery::ORDER_DESC); $query->setGroupFormat('simple'); $query->setGroupMain(false); $query->setGroupNGroups(false); $query->setGroupTruncate(true); $query->setGroupFacet(true); $query->setGroupCachePercent(100); echo PHP_EOL . "-- Query String --".PHP_EOL; echo $query.PHP_EOL; echo PHP_EOL . "-- Integer --".PHP_EOL; var_dump($query->getGroupOffset(), $query->getGroupLimit(), $query->getGroupCachePercent(0)); echo PHP_EOL . "-- String --".PHP_EOL; var_dump($query->getGroupFormat()); echo PHP_EOL . "-- Array --".PHP_EOL; var_dump($query->getGroupFields()); var_dump($query->getGroupFunctions()); var_dump($query->getGroupQueries()); var_dump($query->getGroupSortFields()); echo PHP_EOL . "-- BOOL --".PHP_EOL; var_dump($query->getGroup(), $query->getGroupMain(), $query->getGroupNGroups(), $query->getGroupTruncate(), $query->getGroupFacet()); echo PHP_EOL; try { $query->setGroupCachePercent(-1); } catch (SolrIllegalArgumentException $e) { echo sprintf("Exception Caught %d: %s", $e->getCode(), $e->getMessage()).PHP_EOL; } ?> --EXPECTF-- -- Query String -- group=true&group.field=category&group.field=featured&group.func=ceil(internalScore)&group.query=silk&group.query=name:june&group.limit=98&group.offset=110&group.sort=count asc,name desc&group.format=simple&group.main=false&group.ngroups=false&group.truncate=true&group.facet=true&group.cache.percent=100 -- Integer -- int(110) int(98) int(100) -- String -- string(6) "simple" -- Array -- array(2) { [0]=> string(8) "category" [1]=> string(8) "featured" } array(1) { [0]=> string(19) "ceil(internalScore)" } array(2) { [0]=> string(4) "silk" [1]=> string(9) "name:june" } array(2) { [0]=> string(9) "count asc" [1]=> string(9) "name desc" } -- BOOL -- bool(true) bool(false) bool(false) bool(true) bool(true) Exception Caught 4000: Group cache percent must be between 0 and 100php-solr-2.5.1+2.4.0/solr-2.4.0/tests/070.solrquery_collapse.phpt000066400000000000000000000004671374041537100236450ustar00rootroot00000000000000--TEST-- SolrQuery::collapse - Collapse Using a SolrCollapseFunction --FILE-- setMax(5); $query->collapse($collapseFunction); echo $query; ?> --EXPECTF-- q=lucene&fq={!collapse field=ISBN max=5} php-solr-2.5.1+2.4.0/solr-2.4.0/tests/071.solrquery_collapse_exception.phpt000066400000000000000000000006441374041537100257210ustar00rootroot00000000000000--TEST-- SolrQuery::collapse - throws SolrMissingMandatoryParameterException --FILE-- collapse($collapseFunction); } catch (SolrMissingMandatoryParameterException $e) { echo PHP_EOL.sprintf('Exception %d: %s', $e->getCode(), $e->getMessage()); } ?> --EXPECTF-- Exception 4100: Mandatory parameter Missing: field php-solr-2.5.1+2.4.0/solr-2.4.0/tests/072.solrquery_expand.phpt000066400000000000000000000021771374041537100233240ustar00rootroot00000000000000--TEST-- SolrQuery - Expand Component --FILE-- setExpand(true); $query->setExpandRows(50); $query->setExpandQuery('text:product'); $query->addExpandFilterQuery('manu:apple')->addExpandFilterQuery('inStock:true'); $query->addExpandSortField('score', SolrQuery::ORDER_DESC)->addExpandSortField('title', SolrQuery::ORDER_ASC); // removal test $query->addExpandFilterQuery('extra')->removeExpandFilterQuery('extra'); $query->addExpandSortField('extra', SolrQuery::ORDER_ASC)->removeExpandSortField('extra'); echo $query.PHP_EOL; var_dump($query->getExpand()).PHP_EOL; var_dump($query->getExpandRows()).PHP_EOL; var_dump($query->getExpandQuery()).PHP_EOL; var_dump($query->getExpandFilterQueries()).PHP_EOL; var_dump($query->getExpandSortFields()).PHP_EOL; ?> --EXPECTF-- q=lucene&expand=true&expand.rows=50&expand.q=text:product&expand.fq=manu:apple&expand.fq=inStock:true&expand.sort=score desc,title asc bool(true) int(50) string(12) "text:product" array(2) { [0]=> string(10) "manu:apple" [1]=> string(12) "inStock:true" } array(2) { [0]=> string(5) "score" [1]=> string(5) "title" } php-solr-2.5.1+2.4.0/solr-2.4.0/tests/080.solrutils_escapequerychars.phpt000066400000000000000000000005231374041537100253770ustar00rootroot00000000000000--TEST-- SolrUtils::escapeQueryChars() - Testing Lucene Reserved Characters --FILE-- --EXPECTF-- \+a \- q\{ \} \[\^test\] \|| \&& \(\) \^ \" \~ \* \? \: \\ \/php-solr-2.5.1+2.4.0/solr-2.4.0/tests/081.solrutils_digest_json_response.phpt000066400000000000000000000064061374041537100262650ustar00rootroot00000000000000--TEST-- SolrUtils::digestJsonResponse() - Digest JSON Response --FILE-- response->docs[0]->_version_ == 1460602453694087168); ?> --EXPECTF-- bool(true) object(SolrObject)#%d (2) { ["responseHeader"]=> object(SolrObject)#4 (3) { ["status"]=> int(0) ["QTime"]=> int(1) ["params"]=> object(SolrObject)#5 (4) { ["indent"]=> string(2) "on" ["wt"]=> string(4) "json" ["q"]=> string(6) "lucene" ["version"]=> string(3) "2.2" } } ["response"]=> object(SolrObject)#%d (3) { ["numFound"]=> int(1) ["start"]=> int(0) ["docs"]=> array(1) { [0]=> object(SolrObject)#%d (11) { ["id"]=> string(8) "SOLR1000" ["name"]=> string(34) "Solr, the Enterprise Search Server" ["manu"]=> string(26) "Apache Software Foundation" ["cat"]=> array(2) { [0]=> string(8) "software" [1]=> string(6) "search" } ["features"]=> array(7) { [0]=> string(51) "Advanced Full-Text Search Capabilities using Lucene" [1]=> string(37) "Optimized for High Volume Web Traffic" [2]=> string(46) "Standards Based Open Interfaces - XML and HTTP" [3]=> string(44) "Comprehensive HTML Administration Interfaces" [4]=> string(64) "Scalability - Efficient Replication to other Solr Search Servers" [5]=> string(56) "Flexible and Adaptable with XML configuration and Schema" [6]=> string(61) "Good unicode support: hello (hello with an accent over the e)" } ["price"]=> float(0) ["price_c"]=> string(5) "0,USD" ["popularity"]=> int(10) ["inStock"]=> bool(true) ["incubationdate_dt"]=> string(20) "2006-01-17T00:00:00Z" ["_version_"]=> %s } } } } bool(true)php-solr-2.5.1+2.4.0/solr-2.4.0/tests/090.solrserverexception_xml.phpt000066400000000000000000000015151374041537100247200ustar00rootroot00000000000000--TEST-- SolrServerException (xml) - Throw Exception on solr server exception using xml response writer --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, // 'wt' => 'xml' ); $client = new SolrClient ( $options ); $query = new SolrQuery ( "lucene\\" ); try { $response = $client->query ( $query ); } catch ( SolrServerException $e ) { echo sprintf("code: %d", $e->getCode()).PHP_EOL; echo sprintf("message: %s", $e->getMessage()).PHP_EOL; print_r($e->getInternalInfo()); } ?> --EXPECTF-- code: %d message: %s Array ( [sourceline] => %d [sourcefile] => %s [zif_name] => %s ) php-solr-2.5.1+2.4.0/solr-2.4.0/tests/091.solrserverexception_json.phpt000066400000000000000000000013661374041537100250760ustar00rootroot00000000000000--TEST-- SolrServerException (json) - Throw Exception on solr server exception using json response writer --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt' => 'json' ); $client = new SolrClient ( $options ); $query = new SolrQuery ( "lucene\\" ); try { $response = $client->query ( $query ); print_r ( $response ); } catch ( SolrServerException $e ) { echo sprintf("code: %d", $e->getCode()).PHP_EOL; echo sprintf("message: %s", $e->getMessage()).PHP_EOL; } ?> --EXPECTF-- code: %d message: %sphp-solr-2.5.1+2.4.0/solr-2.4.0/tests/092.solrserverexception_php.phpt000066400000000000000000000013661374041537100247150ustar00rootroot00000000000000--TEST-- SolrServerException (phps) - Throw Exception on solr server exception using phps response writer --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt' => 'phps' ); $client = new SolrClient ( $options ); $query = new SolrQuery ( "lucene\\" ); try { $response = $client->query ( $query ); print_r ( $response ); } catch ( SolrServerException $e ) { echo sprintf("code: %d", $e->getCode()).PHP_EOL; echo sprintf("message: %s", $e->getMessage()).PHP_EOL; } ?> --EXPECTF-- code: %d message: %sphp-solr-2.5.1+2.4.0/solr-2.4.0/tests/100.solrresponse_json.phpt000066400000000000000000000011161374041537100234670ustar00rootroot00000000000000--TEST-- SolrResponse::getResponse - JSON response writer --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt' => 'json' ); $client = new SolrClient ( $options ); $query = new SolrQuery ( "lucene" ); $response = $client->query ( $query ); $x = $response->getResponse(); var_dump($x instanceof SolrObject); ?> --EXPECTF-- bool(true)php-solr-2.5.1+2.4.0/solr-2.4.0/tests/101.solrresponse_parseMode.phpt000066400000000000000000000012011374041537100244310ustar00rootroot00000000000000--TEST-- SolrResponse - ParseMode --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt' => 'xml' ); $client = new SolrClient ( $options ); $query = new SolrQuery ( "lucene" ); $response = $client->query ( $query ); $response->setParseMode(SolrResponse::PARSE_SOLR_DOC); $x = $response->getResponse(); var_dump($x->response->docs[0] instanceof SolrDocument); ?> --EXPECTF-- bool(true)php-solr-2.5.1+2.4.0/solr-2.4.0/tests/102.solrresponse_phps.phpt000066400000000000000000000011161374041537100234720ustar00rootroot00000000000000--TEST-- SolrResponse::getResponse - PHPS response writer --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt' => 'phps' ); $client = new SolrClient ( $options ); $query = new SolrQuery ( "lucene" ); $response = $client->query ( $query ); $x = $response->getResponse(); var_dump($x instanceof SolrObject); ?> --EXPECTF-- bool(true)php-solr-2.5.1+2.4.0/solr-2.4.0/tests/103.solrresponse_get_array_response.phpt000066400000000000000000000014641374041537100264220ustar00rootroot00000000000000--TEST-- SolrResponse::getArrayResponse - For All response writers --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient ( $options ); $testArrayResponse = function ($writer) use ($client){ $client->setResponseWriter($writer); $q = new SolrQuery("lucene"); $response = $client->query ( $q ); $arrayResponse = $response->getArrayResponse(); return is_array($arrayResponse); }; var_dump($testArrayResponse('phps')); var_dump($testArrayResponse('xml')); var_dump($testArrayResponse('json')); ?> --EXPECTF-- bool(true) bool(true) bool(true)php-solr-2.5.1+2.4.0/solr-2.4.0/tests/104.solrresponse_get_response_maxscore.phpt000066400000000000000000000024201374041537100271170ustar00rootroot00000000000000--TEST-- SolrResponse::getResponse() - maxScore --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt'=> 'xml' ); $client = new SolrClient ( $options ); $q = new SolrQuery("lucene"); $q->addField('score'); $response = $client->query ( $q ); $arrayResponse = $response->getArrayResponse(); var_dump($arrayResponse['response']['maxScore']); var_dump($response->getResponse()->response->maxScore); var_dump($response->getResponse()->response->start); var_dump($response->getResponse()->response->numFound); var_dump(is_array($response->getResponse()->response->docs)); echo "------ W/O maxScore ------".PHP_EOL; $q->removeField('score'); $response = $client->query ( $q ); var_dump($response->getResponse()->response->start); var_dump($response->getResponse()->response->numFound); var_dump(is_array($response->getResponse()->response->docs)); var_dump(property_exists($response->getResponse()->response, 'maxScore')); ?> --EXPECTF-- float(%f) float(%f) int(%d) int(%d) bool(true) ------ W/O maxScore ------ int(0) int(1) bool(true) bool(false)php-solr-2.5.1+2.4.0/solr-2.4.0/tests/105.solrresponse_child_doc_response.phpt000066400000000000000000000033261374041537100263560ustar00rootroot00000000000000--TEST-- Response - Response with child documents --FILE-- --EXPECT-- SolrObject Object ( [response] => SolrObject Object ( [numFound] => 3 [start] => 0 [docs] => Array ( [0] => SolrObject Object ( [id] => parent_1 [_childDocuments_] => Array ( [0] => SolrObject Object ( [id] => CHILD_1_1 ) ) ) [1] => SolrObject Object ( [id] => parent_2 [_childDocuments_] => Array ( [0] => SolrObject Object ( [id] => CHILD_2_1 ) [1] => SolrObject Object ( [id] => CHILD_2_2 ) ) ) [2] => SolrObject Object ( [id] => not_a_parent_1 ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.4.0/tests/106.solrresponse_child_doc_response_solrdoc.phpt000066400000000000000000000056251374041537100301100ustar00rootroot00000000000000--TEST-- SolrDocument - Response parsed as SolrDocument with child documents --FILE-- response->docs as $doc) { echo '--- doc start ---'.PHP_EOL; print_r($doc->toArray()); if ($doc->hasChildDocuments()) { foreach ($doc->getChildDocuments() as $child) { print_r($child->toArray()); } } echo '--- doc end ---'.PHP_EOL; } ?> --EXPECT-- --- doc start --- Array ( [document_boost] => 0 [field_count] => 1 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => parent_1 ) ) ) ) Array ( [document_boost] => 0 [field_count] => 1 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => CHILD_1_1 ) ) ) ) --- doc end --- --- doc start --- Array ( [document_boost] => 0 [field_count] => 1 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => parent_2 ) ) ) ) Array ( [document_boost] => 0 [field_count] => 1 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => CHILD_2_1 ) ) ) ) Array ( [document_boost] => 0 [field_count] => 1 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => CHILD_2_2 ) ) ) ) --- doc end --- --- doc start --- Array ( [document_boost] => 0 [field_count] => 1 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => not_a_parent_1 ) ) ) ) --- doc end --- php-solr-2.5.1+2.4.0/solr-2.4.0/tests/110.solrdismaxquery.phpt000066400000000000000000000040031374041537100231520ustar00rootroot00000000000000--TEST-- SolrDisMaxQuery - Methods --FILE-- addPhraseField('source', 55) ->addPhraseField('cat', 3, 1) ->addPhraseField('third', 4, 1) ->removePhraseField('third') ->addPhraseField('fourth', 0.5) ->addPhraseField('fifth',5.2, 7.8) ->setQueryAlt('*:*') ->addQueryField("price") ->addQueryField("location", 4) ->setPhraseSlop(2) ->setQueryPhraseSlop(3) ->setTieBreaker(0.5) ->setMinimumMatch(2) ; // reverse echo $dismaxQuery.PHP_EOL; $dismaxQuery = new SolrDisMaxQuery("lucene"); $dismaxQuery ->addQueryField("location", 4) ->addQueryField("price") ->addQueryField("sku") ->addQueryField("title",3.4) ->addPhraseField('cat', 3, 1) ->addPhraseField('third', 4, 1) ->addPhraseField('source', 55) ; echo $dismaxQuery.PHP_EOL; $dismaxQuery->setPhraseFields('source^55 cat~1^3'); echo $dismaxQuery.PHP_EOL; $dismaxQuery = new SolrDisMaxQuery('lucene'); $dismaxQuery->addPhraseField('first', 3, 1) ->addPhraseField('second', 4, 1) ->addPhraseField('cat', 55); echo $dismaxQuery. PHP_EOL; echo $dismaxQuery->removePhraseField('second').PHP_EOL; $dismaxQuery = new SolrDisMaxQuery('lucene'); $dismaxQuery->addQueryField('first', 3) ->addQueryField('second', 0.2) ->addQueryField('cat'); echo $dismaxQuery. PHP_EOL; echo $dismaxQuery->removeQueryField('second').PHP_EOL; $dismaxQuery = new SolrDisMaxQuery('lucene'); $dismaxQuery->setPhraseSlop(4); echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- q=lucene&defType=%s&pf=source^55 cat~1^3 fourth^0.5 fifth~7.8^5.2&q.alt=*:*&qf=price location^4&ps=2&qs=3&tie=0.5&mm=2 q=lucene&defType=%s&qf=location^4 price sku title^3.4&pf=cat~1^3 third~1^4 source^55 Notice: SolrDisMaxQuery::setPhraseFields(): Parameter pf value(s) was overwritten by this call in %s on line %d q=lucene&defType=%s&qf=location^4 price sku title^3.4&pf=source^55 cat~1^3 q=lucene&defType=%s&pf=first~1^3 second~1^4 cat^55 q=lucene&defType=%s&pf=first~1^3 cat^55 q=lucene&defType=%s&qf=first^3 second^0.2 cat q=lucene&defType=%s&qf=first^3 cat q=lucene&defType=%s&ps=4php-solr-2.5.1+2.4.0/solr-2.4.0/tests/111.solrdismaxquery_boostquery.phpt000066400000000000000000000012511374041537100254510ustar00rootroot00000000000000--TEST-- SolrDisMaxQuery - Boost Query --FILE-- addBoostQuery('cat', 'electronics', 5.1) ->addBoostQuery('cat', 'hard drive') ; // reverse echo $dismaxQuery.PHP_EOL; $dismaxQuery ->removeBoostQuery('cat'); echo $dismaxQuery.PHP_EOL; $dismaxQuery->setBoostQuery('cat:electronics manu:local^2'); echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- q=lucene&defType=edismax&bq=cat:electronics^5.1 cat:hard drive q=lucene&defType=edismax&bq=cat:hard drive Notice: SolrDisMaxQuery::setBoostQuery(): Parameter bq value(s) was overwritten by this call in %s on line %d q=lucene&defType=edismax&bq=cat:electronics manu:local^2 php-solr-2.5.1+2.4.0/solr-2.4.0/tests/112.solrdismaxquery_query_parser.phpt000066400000000000000000000005611374041537100257620ustar00rootroot00000000000000--TEST-- SolrDisMaxQuery - QueryParser Switch --FILE-- useDisMaxQueryParser(); echo $dismaxQuery.PHP_EOL; $dismaxQuery->useEDisMaxQueryParser(); echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- q=hard drive&defType=edismax q=hard drive&defType=dismax q=hard drive&defType=edismaxphp-solr-2.5.1+2.4.0/solr-2.4.0/tests/113.solrdismaxquery_bigramfields.phpt000066400000000000000000000015311374041537100256700ustar00rootroot00000000000000--TEST-- SolrDisMaxQuery - BigramFields and slop (addBigramPhraseField, removeBigramPhraseField, setBigramPhraseFields) --FILE-- addBigramPhraseField('cat', 2, 5.1) ->addBigramPhraseField('feature', 4.5) ; echo $dismaxQuery.PHP_EOL; // reverse $dismaxQuery ->removeBigramPhraseField('cat'); echo $dismaxQuery.PHP_EOL; $dismaxQuery->setBigramPhraseFields("cat~5.1^2 feature^4.5"); echo $dismaxQuery.PHP_EOL; $dismaxQuery->setBigramPhraseSlop(2); echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- q=lucene&defType=%s&pf2=cat~5.1^2 feature^4.5 q=lucene&defType=%s&pf2=feature^4.5 Notice: SolrDisMaxQuery::setBigramPhraseFields(): Parameter pf2 value(s) was overwritten by this call in %s on line %d q=lucene&defType=%s&pf2=cat~5.1^2 feature^4.5 q=lucene&defType=%s&pf2=cat~5.1^2 feature^4.5&ps2=2 php-solr-2.5.1+2.4.0/solr-2.4.0/tests/114.solrdismaxquery_trigramfields.phpt000066400000000000000000000015431374041537100261000ustar00rootroot00000000000000--TEST-- SolrDisMaxQuery - TrigramFields and slop (addTrigramPhraseField, removeTrigramPhraseField, setTrigramPhraseFields) --FILE-- addTrigramPhraseField('cat', 2, 5.1) ->addTrigramPhraseField('feature', 4.5) ; echo $dismaxQuery.PHP_EOL; // reverse $dismaxQuery ->removeTrigramPhraseField('cat'); echo $dismaxQuery.PHP_EOL; $dismaxQuery->setTrigramPhraseFields('cat~5.1^2 feature^4.5'); echo $dismaxQuery.PHP_EOL; $dismaxQuery->setTrigramPhraseSlop(2); echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- q=lucene&defType=%s&pf3=cat~5.1^2 feature^4.5 q=lucene&defType=%s&pf3=feature^4.5 Notice: SolrDisMaxQuery::setTrigramPhraseFields(): Parameter pf3 value(s) was overwritten by this call in %s on line %d q=lucene&defType=%s&pf3=cat~5.1^2 feature^4.5 q=lucene&defType=%s&pf3=cat~5.1^2 feature^4.5&ps3=2 php-solr-2.5.1+2.4.0/solr-2.4.0/tests/115.solrdismaxquery_userfields.phpt000066400000000000000000000012031374041537100254030ustar00rootroot00000000000000--TEST-- SolrDisMaxQuery - UserFields (uf parameter) (addUserField) --FILE-- addUserField('cat') ->addUserField('text') ->addUserField('*_dt') ; echo $dismaxQuery.PHP_EOL; // // reverse $dismaxQuery ->removeUserField('text'); echo $dismaxQuery.PHP_EOL; $dismaxQuery->setUserFields('field1 field2 *_txt'); echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- q=lucene&defType=%s&uf=cat text *_dt q=lucene&defType=%s&uf=cat *_dt Notice: SolrDisMaxQuery::setUserFields(): Parameter uf value(s) was overwritten by this call in %s on line %d q=lucene&defType=edismax&uf=field1 field2 *_txtphp-solr-2.5.1+2.4.0/solr-2.4.0/tests/116.solrdismaxquery_boostfunction.phpt000066400000000000000000000005251374041537100261410ustar00rootroot00000000000000--TEST-- SolrDisMaxQuery - setBoostFunction --FILE-- setBoostFunction($boostRecentDocsFunction); echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- q=lucene&defType=%s&bf=recip(ms(NOW,mydatefield),3.16e-11,1,1)php-solr-2.5.1+2.4.0/solr-2.4.0/tests/130.parameters_simple_list_separator.phpt000066400000000000000000000006251374041537100265360ustar00rootroot00000000000000--TEST-- simple_list_parameter type - Use of default, non-default separator --FILE-- addField("te")->addField("te2"); echo $query.PHP_EOL; $dismaxQuery = new SolrDisMaxQuery(); $dismaxQuery ->addUserField('cat') ->addUserField('text') ->addUserField('*_dt') ; echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- fl=te,te2 defType=edismax&uf=cat text *_dtphp-solr-2.5.1+2.4.0/solr-2.4.0/tests/150.solrcollapsefunction.phpt000066400000000000000000000015311374041537100241560ustar00rootroot00000000000000--TEST-- SolrCollapseFunction - string conversion --FILE-- setField('field2'); $func->setMax('max'); $func->setMin('min'); $func->setSize(1000); $func->setHint('hint'); $func->setNullPolicy(SolrCollapseFunction::NULLPOLICY_EXPAND); var_dump($func->getField()); var_dump($func->getMax()); var_dump($func->getMin()); var_dump($func->getSize()); var_dump($func->getHint()); var_dump($func->getNullPolicy()); var_dump((string)$func); $func->setMax('with space'); var_dump((string)$func); ?> --EXPECTF-- string(6) "field2" string(3) "max" string(3) "min" string(4) "1000" string(4) "hint" string(6) "expand" string(78) "{!collapse field=field2 max=max min=min size=1000 hint=hint nullPolicy=expand}" string(87) "{!collapse field=field2 max='with space' min=min size=1000 hint=hint nullPolicy=expand}" php-solr-2.5.1+2.4.0/solr-2.4.0/tests/151.solrcollapsefunction_illegal_operations.phpt000066400000000000000000000013701374041537100301140ustar00rootroot00000000000000--TEST-- SolrCollapseFunction - Illegal Operations --SKIPIF-- --FILE-- getCode(), $e->getMessage()).PHP_EOL; } $func->setMax('max'); try { // known issue, object corruption $tmp = serialize($func); } catch (SolrIllegalOperationException $e) { echo PHP_EOL . sprintf('Code %d: %s', $e->getCode(), $e->getMessage()).PHP_EOL; } ?> --EXPECTF-- Code 4001: Cloning of SolrCollapseFunction objects is currently not supported Code 1001: Serialization of SolrCollapseFunction objects is currently not supported php-solr-2.5.1+2.4.0/solr-2.4.0/tests/160.solr_update_document_block.phpt000066400000000000000000000042471374041537100253070ustar00rootroot00000000000000--TEST-- Solr - Fetch and Update nested documents --SKIPIF-- --FILE-- getChildDocuments(); $child = $children[0]; $child->deleteField('inventory_i'); $child->addField('inventory_i', $inventory); $document->deleteField('_version_'); }; $getInventory = function ($response) { return (int) current($response->response->docs[0]->getChildDocuments()[0]['inventory_i']->values); }; $options = array ( 'hostname' => SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_STORE_PATH, 'wt' => 'xml' ); $client = new SolrClient ( $options ); $query = new SolrQuery ('id:1 AND {!parent which=$parentFilter}'); $query->setParam ( 'parentFilter', 'content_type_s:product' ); $query->addFilterQuery('{!parent which=$parentFilter}'); $query->addField ( '*' ); $query->addField ( '[child parentFilter=$parentFilter]' ); $query->setStart ( 0 ); $query->setRows ( 1 ); // query existing inventory $queryResponse = $client->query ( $query ); $queryResponse->setParseMode(SolrResponse::PARSE_SOLR_DOC); $response = $queryResponse->getResponse(); $existingInventory = $getInventory($response); // update inventory to 300 $document = $response->response->docs[0]->getInputDocument(); $updateInventory($document, 300); $client->addDocument($document); $client->commit(); // fetch the document again after the update $queryResponse = $client->query ( $query ); $queryResponse->setParseMode(SolrResponse::PARSE_SOLR_DOC); $response = $queryResponse->getResponse(); $newInventory = $getInventory($response); assert($newInventory == 300); echo "------EXISTING------" . PHP_EOL; var_dump($existingInventory); echo "----AFTER UPDATE----" . PHP_EOL; var_dump($newInventory); // cleanup: restore document's original state $document = $response->response->docs[0]->getInputDocument(); $updateInventory($document, $existingInventory); $client->addDocument($document); $client->commit(); ?> --EXPECT-- ------EXISTING------ int(200) ----AFTER UPDATE---- int(300)php-solr-2.5.1+2.4.0/solr-2.4.0/tests/bootstrap.inc000066400000000000000000000004131374041537100212130ustar00rootroot00000000000000getCode(), $e->getMessage()). PHP_EOL; }php-solr-2.5.1+2.4.0/solr-2.4.0/tests/bug_59511_error.phpt000066400000000000000000000013151374041537100221340ustar00rootroot00000000000000--TEST-- Solr bug #59511 - SolrClient::query() Timeout shall throw a SolrClientException --SKIPIF-- --FILE-- 'anyhost', 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'timeout' => 2 ); $client = new SolrClient($options); $query = new SolrQuery("lucene"); try { $query_response = $client->query($query); } catch (SolrClientException $e) { echo $e->getMessage().PHP_EOL; echo $e->getCode().PHP_EOL; } ?> --EXPECTF-- Solr HTTP Error %d: '%s' 1004php-solr-2.5.1+2.4.0/solr-2.4.0/tests/bug_61836_error.phpt000066400000000000000000000010621374041537100221360ustar00rootroot00000000000000--TEST-- Solr bug #61836 - Extending SolrDocument --SKIPIF-- --FILE-- addField('testname', true); ?> --EXPECTF-- Fatal error: Class Model_SolrDocument may not inherit from final class (SolrDocument) in %s on line %dphp-solr-2.5.1+2.4.0/solr-2.4.0/tests/bug_67394.phpt000066400000000000000000000012501374041537100207310ustar00rootroot00000000000000--TEST-- Solr Bug #67394 - Unable to parse response with NaN --FILE-- stats->stats_fields->date->stddev); $xmlFixture = file_get_contents(ROOT_DIRECTORY . '/files/bug67394.xml'); if (!json_decode($fixture)) { echo "PHP JSON DECODE failed with: ". json_last_error_msg().PHP_EOL; } $response = SolrUtils::digestXmlResponse($xmlFixture); var_dump($response->response->stats->stats_fields->currentPrice->mean); ?> --EXPECTF-- string(3) "NaN" float(NAN)php-solr-2.5.1+2.4.0/solr-2.4.0/tests/bug_68179.phpt000066400000000000000000000005251374041537100207370ustar00rootroot00000000000000--TEST-- Solr Bug #68179 - Solr Params (Argument list) separator disappears --FILE-- addSortField('price', SolrQuery::ORDER_ASC); $dismaxQuery->addSortField('score', SolrQuery::ORDER_DESC); echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- q=score&defType=%s&sort=price asc,score descphp-solr-2.5.1+2.4.0/solr-2.4.0/tests/bug_68181.phpt000066400000000000000000000011011374041537100207170ustar00rootroot00000000000000--TEST-- Solr Bug #68181 - Conflict occurs when using SolrDisMax::addBoostQuery and setBoostQuery --FILE-- setBoostQuery("failing:val^3") ->addBoostQuery('category','software',2) ->setBoostQuery("end:result^4"); echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- Notice: SolrDisMaxQuery::addBoostQuery(): Parameter bq value(s) was overwritten by this call in %s on line %d Notice: SolrDisMaxQuery::setBoostQuery(): Parameter bq value(s) was overwritten by this call in %s on line %d q=lucene&defType=%s&bq=end:result^4php-solr-2.5.1+2.4.0/solr-2.4.0/tests/bug_69156.phpt000066400000000000000000000012231374041537100207270ustar00rootroot00000000000000--TEST-- Solr Bug #69156 - segfault on 500 response from Solr --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => 'solr/collection44444', 'wt' => 'phps' ); $client = new SolrClient($options); $query = new SolrQuery("lucene"); try { $query_response = $client->query($query); } catch (Exception $e) { } ?> --EXPECTF-- Notice: SolrClient::query(): Unable to parse serialized php response in %s on line %d php-solr-2.5.1+2.4.0/solr-2.4.0/tests/bug_70482.phpt000066400000000000000000000017021374041537100207230ustar00rootroot00000000000000--TEST-- Solr Bug #70482 - Segmentation fault on server 500 response with no msg field XML RW --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt' => 'xml' ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $func = new SolrCollapseFunction('manu_id_s'); $func->setMax('sum(cscore(),field(manu_id_s))'); $func->setSize(100); $func->setNullPolicy(SolrCollapseFunction::NULLPOLICY_EXPAND); $query->collapse($func); try { $queryResponse = $client->query($query); } catch (SolrServerException $e) { printf("Exception code %d", $e->getCode()); assert(strlen($e->getMessage()) > 0, 'Exception message is empty'); echo PHP_EOL; } ?> OK --EXPECTF-- Exception code %d OKphp-solr-2.5.1+2.4.0/solr-2.4.0/tests/bug_70495.phpt000066400000000000000000000017461374041537100207370ustar00rootroot00000000000000--TEST-- Solr Bug #70495 - Failed to parse 500 error response when Solr it lacks msg JSON RW --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt' => 'json' ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $func = new SolrCollapseFunction('manu_id_s'); $func->setMax('sum(cscore(),field(manu_id_s))'); $func->setSize(100); $func->setNullPolicy(SolrCollapseFunction::NULLPOLICY_EXPAND); $query->collapse($func); try { $queryResponse = $client->query($query); } catch (SolrServerException $e) { printf("Exception code %d", $e->getCode()); assert(strlen($e->getMessage()) > 0, 'Exception message is empty'); } ?> OK --EXPECTF-- Exception code 500 OKphp-solr-2.5.1+2.4.0/solr-2.4.0/tests/bug_70496.phpt000066400000000000000000000016421374041537100207330ustar00rootroot00000000000000--TEST-- Solr Bug #70496 - Failed to parse 500 error response when Solr it lacks msg PHPS RW --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt' => 'phps' ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $func = new SolrCollapseFunction('manu_id_s'); $func->setMax('sum(cscore(),field(manu_id_s))'); $func->setNullPolicy(SolrCollapseFunction::NULLPOLICY_EXPAND); $query->collapse($func); try { $queryResponse = $client->query($query); } catch (SolrServerException $e) { printf("Exception code %d", $e->getCode()); assert(strlen($e->getMessage()) > 0, 'Exception message is empty'); } ?> OK --EXPECTF-- Exception code 500 OKphp-solr-2.5.1+2.4.0/solr-2.4.0/tests/files/000077500000000000000000000000001374041537100176075ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.4.0/tests/files/bug67394.json000066400000000000000000000014351374041537100216770ustar00rootroot00000000000000{ "responseHeader": { "status": 0, "QTime": 5, "params": { "fl": "date", "indent": "true", "start": "0", "stats": "true", "stats.field": "date", "q": "bahruz", "_": "1402067668264", "wt": "json", "rows": "1" } }, "response": { "numFound": 1039, "start": 0, "docs": [ { "date": "2012-10-10T15:05:18Z" } ] }, "stats": { "stats_fields": { "date": { "min": "2011-10-20T11:16:34Z", "max": "2014-06-04T13:41:45Z", "count": 1039, "missing": 0, "sum": "47085-11-30T17:59:27.999Z", "mean": "2013-06-03T17:17:43.684Z", "sumOfSquares": -234260129500201700000, "stddev": "NaN", "facets": {} } } } } php-solr-2.5.1+2.4.0/solr-2.4.0/tests/files/bug67394.xml000066400000000000000000000012021374041537100215160ustar00rootroot00000000000000 0 72 0 0 0.0 0.0 NaN 0.0 php-solr-2.5.1+2.4.0/solr-2.4.0/tests/files/response_xml.1.xml000066400000000000000000000250461374041537100232150ustar00rootroot00000000000000 07215151321http-8983-3WAITINGorg.apache.tomcat.util.net.JIoEndpoint$Worker@1bf68a960.0000ms40.0000msjava.lang.Object.wait(Native Method)java.lang.Object.wait(Object.java:474)org.apache.tomcat.util.net.JIoEndpoint$Worker.await(JIoEndpoint.java:416)org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:442)java.lang.Thread.run(Thread.java:595)20http-8983-2WAITINGorg.apache.tomcat.util.net.JIoEndpoint$Worker@1706eb70.0000ms0.0000msjava.lang.Object.wait(Native Method)java.lang.Object.wait(Object.java:474)org.apache.tomcat.util.net.JIoEndpoint$Worker.await(JIoEndpoint.java:416)org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:442)java.lang.Thread.run(Thread.java:595)19http-8983-1RUNNABLE160.0000ms160.0000mssun.management.ThreadImpl.getThreadInfo0(Native Method)sun.management.ThreadImpl.getThreadInfo(ThreadImpl.java:142)org.apache.solr.handler.admin.ThreadDumpHandler.handleRequestBody(ThreadDumpHandler.java:73)org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)org.apache.solr.core.SolrCore.execute(SolrCore.java:1299)org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:338)org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:241)org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)java.lang.Thread.run(Thread.java:595)17TP-MonitorTIMED_WAITINGorg.apache.tomcat.util.threads.ThreadPool$MonitorRunnable@74db2c0.0000ms0.0000msjava.lang.Object.wait(Native Method)org.apache.tomcat.util.threads.ThreadPool$MonitorRunnable.run(ThreadPool.java:565)java.lang.Thread.run(Thread.java:595)16TP-Processor4RUNNABLEtrue0.0000ms0.0000msjava.net.PlainSocketImpl.socketAccept(Native Method)java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)java.net.ServerSocket.implAccept(ServerSocket.java:450)java.net.ServerSocket.accept(ServerSocket.java:421)org.apache.jk.common.ChannelSocket.accept(ChannelSocket.java:306)org.apache.jk.common.ChannelSocket.acceptConnections(ChannelSocket.java:660)org.apache.jk.common.ChannelSocket$SocketAcceptor.runIt(ChannelSocket.java:870)org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)java.lang.Thread.run(Thread.java:595)15TP-Processor3WAITINGorg.apache.tomcat.util.threads.ThreadPool$ControlRunnable@1e164830.0000ms0.0000msjava.lang.Object.wait(Native Method)java.lang.Object.wait(Object.java:474)org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:662)java.lang.Thread.run(Thread.java:595)14TP-Processor2WAITINGorg.apache.tomcat.util.threads.ThreadPool$ControlRunnable@8ddb930.0000ms0.0000msjava.lang.Object.wait(Native Method)java.lang.Object.wait(Object.java:474)org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:662)java.lang.Thread.run(Thread.java:595)13TP-Processor1WAITINGorg.apache.tomcat.util.threads.ThreadPool$ControlRunnable@14ab51b0.0000ms0.0000msjava.lang.Object.wait(Native Method)java.lang.Object.wait(Object.java:474)org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:662)java.lang.Thread.run(Thread.java:595)12http-8983-Acceptor-0RUNNABLEtrue0.0000ms0.0000msjava.net.PlainSocketImpl.socketAccept(Native Method)java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)java.net.ServerSocket.implAccept(ServerSocket.java:450)java.net.ServerSocket.accept(ServerSocket.java:421)org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:61)org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:310)java.lang.Thread.run(Thread.java:595)11ContainerBackgroundProcessor[StandardEngine[Catalina]]TIMED_WAITING1400.0000ms920.0000msjava.lang.Thread.sleep(Native Method)org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1579)java.lang.Thread.run(Thread.java:595)10pool-1-thread-1WAITING100.0000ms100.0000mssun.misc.Unsafe.park(Native Method)java.util.concurrent.locks.LockSupport.park(LockSupport.java:118)java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1841)java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:359)java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:470)java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:674)java.lang.Thread.run(Thread.java:595)4Signal DispatcherRUNNABLE0.0000ms0.0000ms3FinalizerWAITINGjava.lang.ref.ReferenceQueue$Lock@1b82d690.0000ms0.0000msjava.lang.Object.wait(Native Method)java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:120)java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:136)java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)2Reference HandlerWAITINGjava.lang.ref.Reference$Lock@ad65130.0000ms0.0000msjava.lang.Object.wait(Native Method)java.lang.Object.wait(Object.java:474)java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)1mainRUNNABLEtrue3340.0000ms3180.0000msjava.net.PlainSocketImpl.socketAccept(Native Method)java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)java.net.ServerSocket.implAccept(ServerSocket.java:450)java.net.ServerSocket.accept(ServerSocket.java:421)org.apache.catalina.core.StandardServer.await(StandardServer.java:389)org.apache.catalina.startup.Catalina.await(Catalina.java:642)org.apache.catalina.startup.Catalina.start(Catalina.java:602)sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)java.lang.reflect.Method.invoke(Method.java:585)org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) php-solr-2.5.1+2.4.0/solr-2.4.0/tests/files/response_xml.2.xml000066400000000000000000000007061374041537100232120ustar00rootroot00000000000000 parent_1 CHILD_1_1 parent_2 CHILD_2_1 CHILD_2_2 not_a_parent_1 php-solr-2.5.1+2.4.0/solr-2.4.0/tests/files/response_xml.3.xml000066400000000000000000000016471374041537100232200ustar00rootroot00000000000000 parent_1 Solr adds block join support CHILD_1_1 SolrCloud supports it too! parent_2 CHILD_2_1 Cool features CHILD_2_2 Cool features parent_3 CHILD_3_1 Cool features php-solr-2.5.1+2.4.0/solr-2.4.0/tests/files/response_xml.4.xml000066400000000000000000000037211374041537100232140ustar00rootroot00000000000000 0 0 *:* 0 2 xml GB18030TEST Test with some GB18030 encoded characters No accents here 这是一个功能 This is a feature (translated) 这份文件是很有光泽 This document is very shiny (translated) 0.0 true 1513324811722424320 SP2514N Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133 Samsung Electronics Co. Ltd. samsung electronics hard drive 7200RPM, 8MB cache, IDE Ultra ATA-133 NoiseGuard, SilentSeek technology, Fluid Dynamic Bearing (FDB) motor 92.0 6 true 2006-02-13T15:26:37Z 35.0752,-97.032 1513324812366249984 php-solr-2.5.1+2.4.0/solr-2.4.0/tests/skip.if.server_not_configured.inc000066400000000000000000000001651374041537100251370ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.4.0/tests/test.config.inc000066400000000000000000000035131374041537100214250ustar00rootroot00000000000000 php-solr-2.5.1+2.4.0/solr-2.5.1/000077500000000000000000000000001374041537100153455ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.5.1/CREDITS000066400000000000000000000000421374041537100163610ustar00rootroot00000000000000solr Israel Koko Ekpo Omar Shaban php-solr-2.5.1+2.4.0/solr-2.5.1/LICENSE000066400000000000000000000062041374041537100163540ustar00rootroot00000000000000-------------------------------------------------------------------- The PHP License, version 3.01 Copyright (c) 1999 - 2009 The PHP Group. All rights reserved. -------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, is permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name "PHP" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact group@php.net. 4. Products derived from this software may not be called "PHP", nor may "PHP" appear in their name, without prior written permission from group@php.net. You may indicate that your software works in conjunction with PHP by saying "Foo for PHP" instead of calling it "PHP Foo" or "phpfoo" 5. The PHP Group may publish revised and/or new versions of the license from time to time. Each version will be given a distinguishing version number. Once covered code has been published under a particular version of the license, you may always continue to use it under the terms of that version. You may also choose to use such covered code under the terms of any subsequent version of the license published by the PHP Group. No one other than the PHP Group has the right to modify the terms applicable to covered code created under this License. 6. Redistributions of any form whatsoever must retain the following acknowledgment: "This product includes PHP software, freely available from ". THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------- This software consists of voluntary contributions made by many individuals on behalf of the PHP Group. The PHP Group can be contacted via Email at group@php.net. For more information on the PHP Group and the PHP project, please see . PHP includes the Zend Engine, freely available at . php-solr-2.5.1+2.4.0/solr-2.5.1/README.ABOUT_SOLR_EXTENSION000066400000000000000000000140741374041537100213770ustar00rootroot00000000000000================================================================================ Introducing the Solr PHP Extension ================================================================================ The Solr extension is an extremely fast, light-weight, feature-rich library that allows PHP developers to communicate effectively with Solr server instances. There are tools to add documents and make updates to the solr server. It also contains tools that allows you to build advanced queries to the server when searching for documents. There are also special objects that simplifies the sending of name-value requests to the server. This includes the SolrParams class and all its child classes. The SolrClient object allows one to communicate with Solr containers that are behind proxy servers or that require HTTP Authentication to proceed. The SolrClient constructor accepts options such as http authentication username and passwor, proxy server name, port, login and passwords etc. Using an advanced http client like libcurl allows us to leverage the features available with the library. We can reuse the HTTP connections without having to create a separate one for each request. ================================================================================ How to Install ================================================================================ Please refer to the README.INSTALLATION file. ================================================================================ Magic Methods and Interfaces Implemented ================================================================================ SolrDocument implements the following interfaces. (1) ArrayAccess - to access the fields as array keys using field names. (2) Iterator - to iterate over the document fields using foreach() (3) Serializable - provides custom serialization of the object. SolrDocument also contains the __get and __set magic methods which allows developers to access the fields directly. When setting fields, if the field already has a value the new value will be appended to the list of values for that field. Each field is a SolrDocumentField object with the following public properties : (a) name - a string with name of the field. (b) boost - a double representing the boost value of the field (intentionally empty) (c) values - an array of all the field values as strings. Custom Serialization string SolrDocument::serialize(void) returns an XML document representing a SolrDocument as shown below : A0F43D Israel Ekpo Israel.Ekpo@israel.ekpo.com Reading Writing Soccer Teaching Inglés Espanól Here is a complete example of a serialized SolrDocument object: C:12:"SolrDocument":679:{ A0F43D Israel Ekpo Israel.Ekpo@israel.ekpo.com Reading Writing Soccer Teaching Inglés Espanól } One of the items on my todo list is to create a response writer to return serialized SolrDocument objects instead of document arrays. SolrDocument::unserialize(string $serialized) accepts an XML document representing the SolrDocument object. It will the bring the object back to live. The SolrDocument class also has the method SolrDocument::getInputDocument() to allow one do get the SolrInputDocument version of a SolrDocument instance. This method may be helpful if one needs to resubmit the document to the server to updates. The Solr extension has the SolrQuery object (a child of SolrParams) that enables the developer to send custom advanced name-value requests to the solr server. The SolrQuery object can also be serialized and reused later, which makes it very helpful to saving the state of the application across multiple requests. This may be very useful in cases such as facet browsing where additional parameters may need to be added to the current object or removed from it to get the desired results without having to start over from scratch. ================================================================================ Parsing of XML Responses from the Solr Server ================================================================================ XML responses from the solr server are expected to be formatted using version 2.2 These xml documents are parsed into serialized php code and returned as read-only SolrObject instances whose properties can also be accessed as array keys in addition to being accessible directly via the object->member notation. Having the properties accessible via object[member] notation is helpful in cases where the property name is not valid (contains dots and other characters not legal in php. ================================================================================ How to Report Bugs ================================================================================ Please report bugs to http://bugs.php.net If you experience a crash due to a segmentation fault, please follow the instructions on the link below to get a gdb backtrace and then submit the trace in your bug report as well http://bugs.php.net/bugs-generating-backtrace.php Thank you for using PHP php-solr-2.5.1+2.4.0/solr-2.5.1/README.CONTRIBUTORS000066400000000000000000000063371374041537100201720ustar00rootroot00000000000000================================================================================ Omar Shaban (omars@php.net) ================================================================================ - Lead Maintainer ================================================================================ Thanks to all our [contributors](https://github.com/php/pecl-search_engine-solr/graphs/contributors). ================================================================================ These are the people that made version 1.0 release of the Apache Solr PECL extension possible. If I have left anyone out or mis-stated your contributions, please let me know so that it can be correct to reflect your contributions accurately. Thanks again for making this possible. ================================================================================ Israel Ekpo (iekpo@php.net) ================================================================================ - Orignal Author of the Apache Solr PECL extension - Orignal Extension Concept and Design - Lead Maintainer ================================================================================ Pierre-Alain Joye (pajoye@php.net) ================================================================================ - Fine tuned and created the final version of the config.w32 script (291135) - Compiled and made available several versions of the .dll binaries for Windows. - Currently hosting the windows .dll binaries for the Apache Solr PECL extension. ================================================================================ Kalle Sommer Nielsen (kalle@php.net) ================================================================================ - Significant refactoring of the config.w32 script for Windows (288890) - Corrected Windows C++ compiler bugs (288890) ================================================================================ Pierrick Charron (pierrick@php.net) ================================================================================ - Assisted in the testing of the extension using various test cases. - Uncovered and reported several bugs due to his insight of the extension internals. - Discovered bugs 16943 and 16924 - Patched the config.w32 for its first successful compilation on Windows (291101). ================================================================================ Felipe Pena (felipe@php.net) ================================================================================ - Participated significantly after the intial release and uncovered a serious bug that lead to segfaults. - Discovered bugs 16855 thru 16859 - Contributed to development of UNIX config.m4 script (289148) ================================================================================ Alex Samorukov (alexey.samorukov@varien.com) ================================================================================ - Lowered minimum supported version for libcurl to 7.15.0 - Lowered minimum supported version for libxml2 to 2.6.26 ================================================================================ (trevor at blubolt dot com, max at blubolt dot com) ================================================================================ - Fixed PECL Bug# 17172 MoreLikeThis only parses one doc php-solr-2.5.1+2.4.0/solr-2.5.1/README.INSTALLATION000066400000000000000000000165661374041537100201430ustar00rootroot00000000000000================================================================================ PHP VERSION Dependencies ================================================================================ PHP version 5.3 or later is needed ================================================================================ Extension Dependencies ================================================================================ LIBXML extension JSON extension ================================================================================ Library Dependencies ================================================================================ libxml2 2.6.26 or later is required libcurl 7.15.0 or later is required ================================================================================ On UNIX ================================================================================ As mentioned before, the libxml and curl extensions must be enabled for the Apache Solr extension to be functional. Do not attempt to hack the code to make it compile. It will fail, possibly with errors that could be hard to debug To install the Apache Solr extension directly from PECL, please enter the following command, then follow the prompts pecl install solr To compile from source, please follow the following steps $ phpize $ ./configure $ make && make install This should compile the code and install it in the extension_dir specified in the ini file. Then open your php.ini file and add the following line to it extension=solr.so Then restart your webserver. For CLI only, you do not have to restart your webserver. Note : If your system does not have the minimum version of the libcurl or libxml libraries, you can download the libraries and compile them from source into a separate install prefix. wget http://curl.haxx.se/download/curl-7.19.6.tar.gz tar -zxvf curl-7.19.6.tar.gz cd curl-7.19.6 configure --prefix=/root/custom/software make && make install cd .. wget ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz tar -zxvf libxml2-2.7.6.tar.gz cd libxml2-2.7.6 configure --prefix=/root/custom/software make && make install This example assumes that the libxml2 and libcurl libraries were compiled from source and installed using "/root/custom/software" as the --prefix So the absolute path to the easy.h header file will be /root/custom/software/include/curl/easy.h And the absolute path to the libxml/parser.h header file wil be /root/custom/software/include/libxml2/libxml/parser.h The absolute path to the xml2-config script will be /root/custom/software/bin/xml2-config And the absolute path to the curl-config script will be /root/custom/software/bin/curl-config Then you can pass libcurl prefix to the configure script for CURL and LIBXML respectively during the configuration phase as shown here : 4B ./configure --enable-solr --with-curl=/root/custom/software --with-libxml-dir=/root/custom/software If you already have the latest versions of the libraries then the step listed in 4A alone is sufficient. 5. make && make install This should compile the code and install it in the extension_dir specified in the ini file. Then open your php.ini file and add the following line to it extension=solr.so If you would prefer to compile the Solr extension statically into php, you will need to follow the following steps. 1. copy the solr_xxx folder into the ext folder in the php source 2. Include the --enable-solr flag as one of the options when configuring php This will build the Solr extension statically into php. After the installation is completed, you will have to restart your webserver for the changes to take effect. For CLI only use, you do not have to restart your webserver. ================================================================================ On Windows ================================================================================ If you are using a pre-compiled dll, simply copy the php_solr.dll file to your extension_dir specified in the ini file. Then open your php.ini file and add the following line to it extension=php_solr.dll Then restart your webserver. For CLI only, you do not have to restart your webserver. If you are building from source, you will need to download the library dependencies for libxml and libcurl from the following link to the deps folder before running buildconf.bat http://wiki.php.net/internals/windows/libs http://pecl2.php.net/downloads/php-windows-builds/php-libs/ More details are avialable here http://wiki.php.net/internals/windows Windows DLLs are now available here http://downloads.php.net/pierre/ If you are building from source, you will need to download the library dependencies for libxml and libcurl from the following link to the deps folder before running buildconf.bat The Apache Solr extension can be compiled statically or shared. - Shared compilation creates a php_solr.dll file. - Static compilation puts the Solr extension directly into PHP (therefore it does not need to be loaded and cannot be unloaded). You can toggle between compiling statically or as library by adding =static or =shared to the configure.js command during the compilation. configure --with-solr=static configure --with-solr=shared - In the first configure command, the Apache Solr extension will be included in PHP - In the second configure command, the Apache Solr extension will be compiled as separate DLL Here is a more detail list of steps to follow : 1. Get visual studio 2008 ((express edition or professional) and install it. 2. Get and install windows sdk 6.1. 3. Get a php 5.3 snapshot (do not extract yet!). 4. Create the folder "c:\php-sdk" 5. Unpack the binary tools archive into this directory, there should be one sub-directory called "bin" and one called "script" 6. Open the "windows sdk 6.1 shell" (which is available from the start menu group) and execute the following commands in it: setenv /x86 /xp /release cd c:\php-sdk\ bin\phpsdk_setvars.bat bin\phpsdk_buildtree.bat php53dev 7. Now extract the snapshot from Step 3 to C:\php-sdk\php53dev\vc9\x86 with your favourite unpacker so that the following directory gets created: C:\php-sdk\php53dev\vc9\x86\php5.3-xyz 8. run in the windows-sdk-shell: cd C:\php-sdk\php53dev\vc9\x86\php5.3-xyz buildconf 9. now run configure --help, to get an overview of the compiling flags 10. configure --disable-all --enable-cli --with-solr=yes --with-curl=yes --with-libxml=yes 11. nmake If you are using Visual Studio 2005, use vc8 wherever you see vc9. If you are on a 64-bit system, use x64 instead of x86. The following resources can provide you with more information : http://wiki.php.net/internals/windows/libs http://pecl2.php.net/downloads/php-windows-builds/php-libs/ More details are avialable here : http://wiki.php.net/internals/windows The binary tools archive is available at : http://pecl2.php.net/downloads/php-windows-builds/php-libs/binary-tools.zip Windows SDK 6.1 is available at : http://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC&displaylang=en The PHP 5.3 shapshot is available at: http://windows.php.net/downloads/snaps/php-5.3/php-5.3-src-latest.zip ================================================================================ How to Report Bugs ================================================================================ Please report bugs to omars@php.net You can also register bugs here http://pecl.php.net/bugs/report.php?package=solr Thank you for using PHP php-solr-2.5.1+2.4.0/solr-2.5.1/README.MEMORY_ALLOCATION000066400000000000000000000053011374041537100207400ustar00rootroot00000000000000================================================================================ Solr Notes about Memory Allocation and interaction with HashTables ================================================================================ The following notes are for C-space PHP developers. If you are not really familiar with how the Zend HashTable API or the memory allocation marcros really works, please take sometime to read the notes below : This is correct as of Zend Engine version 2.3.0 - If memory was allocated with emalloc(), it has to be freed with efree(). - If memory was allocated using pemalloc(), the same value for the persistent parameter must be used during pefree() to deallocated the allocated memory. The memory manager for the Zend API will then decide whether to use free() or efree() depending on whether persistent is 1 or 0 respectively. The same principle applies to pestrdup(), pecalloc() and the other memory allocation macros. - When inserting values into the HashTables, if the value for the persistent parameter is set, then the memory allocation for the entered item should be persistent to i.e. pemalloc() with persistent set to 1. The following will apply when adding new values into a HashTable for items that were dynamically allocated : (a) If the value for the nDataSize parameter is the size of that of a pointer sizeof(void *), the HashTable API copies the contents of the pData parameter into the Bucket->pDataPtr member for that data Bucket. Then it sets the Bucket->pData member to the address of the Bucket->pDataPtr member for that data Bucket. (b) If the value for the nDataSize parameter is not equal to sizeof(void *), the HashTable API allocates new memory for the Bucket->pData member using the size equivalent to nDataSize and the same value for the persistent flag set for the target HashTable. The the contents of the pData parameter is copied into the Bucket->pData member in this newly allocated memory location. Then the Bucket->pDataPtr member for this Bucket is set to NULL. Do not worry about the newly allocated memory allocated by the HashTable API; if the nDataSize parameter was not equal to sizeof(void *), then during the cleanup process, the Zend API will free the new memory it allocated during the insert process. It will also call the destructor function if a valid one was passed when the HashTable was initialized with zend_hash_init(). In the extension, I have used the p* version of the memory allocation functions to allow me toggle if there is any need to do so in the future. This will prevent a massive search and replace effort. For all the HashTables, I set the intial size to 8 to reduce the looping when zend_hash_init() is setting up the HashTable pointer to use. php-solr-2.5.1+2.4.0/solr-2.5.1/README.SUBMITTING_CONTRIBUTIONS000066400000000000000000000043151374041537100220360ustar00rootroot00000000000000================================================================================ Submitting contributions ================================================================================ A lot of time has been put into designing, implementing and documenting this extension. A lot of work has also been put into ensuring that users of the extension experience very minimal defects during usage. New ideas, corrections, bug fixes, feature improvements are always welcome. However, you must discuss any changes you are about to make to any of the source files prior to making or submitting such changes either in the PECL developers mailing list (pecl-dev@lists.php.net) or by contacting the current author(s) or maintainer(s) of this extension directly. Test scripts should be included when making the submissions. Also explain thoroughly what has been fixed/added/changed by your patch. If your patch is easy to review and has obviously no side-effects, it might take up to a few hours until it is committed. Since this is a volunteer-driven effort, more complex patches will require more patience on the part of the submitter. ================================================================================ Testing thoroughly before submissions ================================================================================ This is a fairly large library and each component is dependent on another component either directly or indirectly. As a consequence, any and all changes must be tested thoroughly before commiting them. It is only polite to the users, author(s) or maintainer(s) that you do so. ================================================================================ Checklist for making submissions ================================================================================ - Did you run "make test" to check if your patch didn't break other features? - Did you compile PHP with --enable-debug and check the PHP and web server error logs when you test your patch? - Did you build PHP for multi-threaded web servers. - Did you create test script for "make test"? (Recommended) - Did you check your patch is unified format and it does not contain white space changes? - Did you read the patch again? php-solr-2.5.1+2.4.0/solr-2.5.1/TODO000066400000000000000000000014521374041537100160370ustar00rootroot000000000000002014-02-17 ================================================================================ Features and things to do in the library ================================================================================ - Set up php.ini entries for default servlet values. This will allow developers to set custom values for the servlets. - Ability to send custom requests to Solr (custom url, custom request contents) - Ability to add files (pdf, office documents, etc) - Ensure the SolrQuery::getFields(), SolrQuery::getFacets() et all returns an array consistently. - More frequent compilations of releases for PHP 5.3 on Windows - Support JSON Writer - Support Solr Spatial Features Natively - Introduce SolrServerException to parse and return Solr Server error messages instead of dumping xml docs php-solr-2.5.1+2.4.0/solr-2.5.1/config.m4000066400000000000000000000125511374041537100170600ustar00rootroot00000000000000dnl config.m4 for the solr extension dnl Configuring the CURL external library dnl This folder is the grand-parent folder of easy.h PHP_ARG_WITH(curl, for cURL support, [ --with-curl[=DIR] SOLR : libcurl install prefix]) if test -r $PHP_CURL/include/curl/easy.h; then CURL_DIR=$PHP_CURL AC_MSG_RESULT(curl headers found in $PHP_CURL) else AC_MSG_CHECKING(for cURL in default path) for i in /usr/local /usr; do if test -r $i/include/curl/easy.h; then CURL_DIR=$i AC_MSG_RESULT(found in $i) break fi done fi if test -z "$CURL_DIR"; then AC_MSG_RESULT(not found) AC_MSG_ERROR([Please reinstall the libcurl distribution - easy.h should be in /include/curl/]) fi CURL_CONFIG="curl-config" AC_MSG_CHECKING(for cURL 7.15.0 or greater) if ${CURL_DIR}/bin/curl-config --libs > /dev/null 2>&1; then CURL_CONFIG=${CURL_DIR}/bin/curl-config else if ${CURL_DIR}/curl-config --libs > /dev/null 2>&1; then CURL_CONFIG=${CURL_DIR}/curl-config fi fi curl_version_full=`$CURL_CONFIG --version` curl_version=`echo ${curl_version_full} | sed -e 's/libcurl //' | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` if test "$curl_version" -ge 7015000; then AC_MSG_RESULT($curl_version_full) CURL_LIBS=`$CURL_CONFIG --libs` else AC_MSG_ERROR([The Solr extension does not support libcurl libraries < 7.15.0. Please update your libraries]) fi PHP_ARG_ENABLE(solr, whether to enable the Solr extension, [ --enable-solr Enable solr support]) PHP_ARG_ENABLE(solr-debug, whether to compile with solr in verbose mode, [ --enable-solr-debug Compile with solr in verbose mode], no, no) dnl Configuring the LibXML external Library if test -z "$PHP_LIBXML_DIR"; then PHP_ARG_WITH(libxml-dir, libxml2 install dir, [ --with-libxml-dir=[DIR] SOLR : libxml2 install prefix], no, no) fi PHP_ARG_ENABLE(coverage, whether to enable code coverage, [ --enable-coverage Enable developer code coverage information],, no) dnl Setting up the apache Solr extension if test "$PHP_SOLR" != "no"; then if test "$PHP_CURL" = "no"; then AC_MSG_ERROR([Solr extension requires curl extension, add --with-curl]) fi PHP_CHECK_LIBRARY(curl,curl_easy_perform, [ AC_DEFINE(HAVE_CURL,1,[ ]) ],[ AC_MSG_ERROR(There is something wrong. Please check config.log for more information.) ],[ $CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR ]) PHP_ADD_INCLUDE($CURL_DIR/include) PHP_EVAL_LIBLINE($CURL_LIBS, SOLR_SHARED_LIBADD) PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/lib, SOLR_SHARED_LIBADD) if test "$PHP_LIBXML" = "no"; then AC_MSG_ERROR([Solr extension requires LIBXML extension, add --enable-libxml]) fi AC_MSG_CHECKING(for JSON) if test -f "$phpincludedir/ext/json/php_json.h" || test "$HAVE_JSON" != "no"; then AC_DEFINE(HAVE_JSON, 1, [JSON support]) AC_MSG_RESULT(Yes) else AC_MSG_ERROR([Solr extension requires json or jsonc support]) fi PHP_SETUP_LIBXML(SOLR_SHARED_LIBADD, [ AC_DEFINE(HAVE_SOLR, 1,[Setting the value of HAVE_SOLR to 1 ]) if test "$PHP_SOLR_DEBUG" != "no"; then AC_DEFINE(SOLR_DEBUG, 1, [Setting the value of SOLR_DEBUG to 1 ]) else AC_DEFINE(SOLR_DEBUG_OFF, 1, [Setting the value of SOLR_DEBUG_OFF to 1 ]) fi if test "$PHP_COVERAGE" = "yes"; then PHP_CHECK_GCC_ARG(-fprofile-arcs, COVERAGE_CFLAGS="$COVERAGE_CFLAGS -fprofile-arcs") PHP_CHECK_GCC_ARG(-ftest-coverage, COVERAGE_CFLAGS="$COVERAGE_CFLAGS -ftest-coverage") EXTRA_LDFLAGS="$COVERAGE_CFLAGS" fi export OLD_CPPFLAGS="$CPPFLAGS" export CPPFLAGS="$CPPFLAGS $INCLUDES" AC_MSG_CHECKING(PHP version) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include ]], [[ #if PHP_MAJOR_VERSION > 5 #error PHP > 5 #endif ]])],[ subdir=src/php5 AC_MSG_RESULT([PHP 5]) ],[ subdir=src/php7 AC_MSG_RESULT([PHP 7]) ]) PHP_SOLR_SRC_FILES="$subdir/php_solr.c \ $subdir/php_solr_object.c \ $subdir/php_solr_document.c \ $subdir/php_solr_input_document.c \ $subdir/php_solr_client.c \ $subdir/php_solr_params.c \ $subdir/php_solr_query.c \ $subdir/php_solr_response.c \ $subdir/php_solr_exception.c \ $subdir/php_solr_utils.c \ $subdir/php_solr_dismax_query.c \ $subdir/php_solr_collapse_function.c \ $subdir/php_solr_extract.c \ $subdir/solr_string.c \ $subdir/solr_functions_document.c \ $subdir/solr_functions_client.c \ $subdir/solr_functions_helpers.c \ $subdir/solr_functions_params.c \ $subdir/solr_functions_response.c \ $subdir/solr_functions_debug.c" PHP_NEW_EXTENSION(solr, $PHP_SOLR_SRC_FILES, $ext_shared,, [$COVERAGE_CFLAGS]) PHP_ADD_BUILD_DIR($abs_builddir/$subdir, 1) PHP_SUBST(SOLR_SHARED_LIBADD) ], [ AC_MSG_ERROR([xml2-config not found. Please check your libxml2 installation.]) ]) fi php-solr-2.5.1+2.4.0/solr-2.5.1/config.w32000066400000000000000000000100021374041537100171400ustar00rootroot00000000000000// vim:ft=javascript // config.w32 for solr extension ARG_ENABLE('solr', 'Whether to enable Apache Solr support', 'no'); if (typeof PHP_SOLR_DEBUG == 'undefined') PHP_SOLR_DEBUG = 'no'; if(PHP_SOLR != 'no') { if(!CHECK_LIB('libcurl_a.lib;libcurl.lib', 'solr', PHP_SOLR) || !CHECK_HEADER_ADD_INCLUDE('curl/easy.h', 'CFLAGS_SOLR')) { WARNING('solr was not enabled; curl libraries and/or headers not found'); PHP_SOLR = "no"; } if(!CHECK_LIB('libssh2_a.lib;libssh2.lib', 'solr', PHP_SOLR)) { WARNING('solr was not enabled; libssh2 library not found'); PHP_SOLR = "no"; } if(!CHECK_LIB('nghttp2_a.lib;nghttp2.lib', 'solr', PHP_SOLR)) { WARNING('solr was not enabled; nghttp2 library not found'); PHP_SOLR = "no"; } if(!CHECK_LIB('crypt32.lib', 'solr', PHP_SOLR)) { WARNING('solr was not enabled; crypt32 library not found'); PHP_SOLR = "no"; } if(!CHECK_LIB('normaliz.lib', 'solr', PHP_SOLR)) { WARNING('solr was not enabled; IDN libraries (normaliz.lib) not found'); PHP_SOLR = "no"; } if(!((CHECK_LIB('libssl.lib', 'solr', PHP_SOLR) && CHECK_LIB('libcrypto.lib', 'solr', PHP_SOLR)) || (CHECK_LIB('ssleay32.lib', 'solr', PHP_SOLR) && CHECK_LIB('libeay32.lib', 'solr', PHP_SOLR)))) { WARNING('solr was not enabled; openssl libraries not found'); PHP_SOLR = "no"; } if(!CHECK_LIB('winmm.lib', 'solr', PHP_SOLR) || !CHECK_LIB('wldap32.lib', 'solr', PHP_SOLR)) { WARNING('solr not enabled; ldap libraries not found'); PHP_SOLR = "no"; } if(!((PHP_ZLIB == 'no' && CHECK_LIB('zlib_a.lib;zlib.lib', 'solr', PHP_SOLR)) || (PHP_ZLIB_SHARED && CHECK_LIB('zlib.lib', 'solr', PHP_SOLR)) || (PHP_ZLIB == 'yes' && !PHP_ZLIB_SHARED))) { WARNING('solr not enabled; zlib libraries not found'); PHP_SOLR = "no"; } if(PHP_LIBXML == 'no' || !ADD_EXTENSION_DEP('solr', 'libxml')) { WARNING('solr was not enabled; libxml is not enabled'); PHP_SOLR = "no"; } else { if (!CHECK_LIB("libxml2_a_dll.lib;libxml2_a.lib", "solr", PHP_SOLR) || !CHECK_LIB("libiconv_a.lib;iconv_a.lib;libiconv.lib;iconv.lib", "solr", PHP_SOLR) || !CHECK_HEADER_ADD_INCLUDE('libxml/parser.h', 'CFLAGS_SOLR', PHP_PHP_BUILD + "\\include\\libxml2") || !CHECK_HEADER_ADD_INCLUDE('libxml/tree.h', 'CFLAGS_SOLR', PHP_PHP_BUILD + "\\include\\libxml2") ) { WARNING('solr was not enabled; libxml or iconv not found'); PHP_SOLR = "no"; } } if(PHP_JSON == 'no' || !ADD_EXTENSION_DEP('solr', 'json')) { WARNING('solr was not enabled; json is not enabled'); PHP_SOLR = "no"; } if(PHP_SOLR != 'no') { if(PHP_SOLR_DEBUG == 'yes') { AC_DEFINE('SOLR_DEBUG', 1, 'Solr debugging set to on'); } else { AC_DEFINE('SOLR_DEBUG_OFF', 1, 'Solr debugging set to off'); } var dll = get_define('PHPDLL'); var old_conf_dir = configure_module_dirname; /* XXX tricky job here, override configure_module_dirname, define the basic extension, then set it back*/ if (null != dll.match(/^php5/)) { configure_module_dirname = configure_module_dirname + "\\src\\php5"; } else if (null != dll.match(/^php7/)) { configure_module_dirname = configure_module_dirname + "\\src\\php7"; } else { ERROR("Cannot match any known PHP version with '" + dll + "'"); } EXTENSION('solr', 'php_solr.c php_solr_client.c php_solr_document.c php_solr_exception.c ' + 'php_solr_input_document.c php_solr_object.c php_solr_params.c php_solr_query.c ' + 'php_solr_response.c php_solr_utils.c solr_functions_client.c solr_functions_debug.c ' + 'solr_functions_document.c solr_functions_helpers.c solr_functions_params.c ' + 'solr_functions_response.c solr_string.c php_solr_dismax_query.c ' + 'php_solr_collapse_function.c php_solr_extract.c' ); configure_module_dirname = old_conf_dir; ADD_FLAG('CFLAGS_SOLR', '/I"' + configure_module_dirname + '" /D CURL_STATICLIB /D LIBXML_STATICLIB'); AC_DEFINE('HAVE_SOLR', 1, 'Solr support'); if (!PHP_SOLR_SHARED) { ADD_FLAG("CFLAGS_SOLR", "/D LIBXML_STATIC"); } ADD_EXTENSION_DEP('solr', 'libxml'); } } php-solr-2.5.1+2.4.0/solr-2.5.1/docs/000077500000000000000000000000001374041537100162755ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.5.1/docs/documentation.php000066400000000000000000002605241374041537100216700ustar00rootroot00000000000000 | | Omar Shaban | +----------------------------------------------------------------------+ */ define('SOLR_MAJOR_VERSION', 2); define('SOLR_MINOR_VERSION', 5); define('SOLR_PATCH_VERSION', 1); define('SOLR_EXTENSION_VERSION', '2.5.1'); /** * Returns the current version of the Apache Solr extension * * @return string */ function solr_get_version() { return SOLR_EXTENSION_VERSION; } /** * This is the base class for all exception thrown by the Solr extension classes. * * @author Israel Ekpo */ class SolrException extends Exception { /* Properties */ protected $sourceline; protected $sourcefile; protected $zif_name; /** * Returns internal information where the Exception was thrown * @return array * @link http://docs.php.net/manual/en/solrexception.getinternalinfo.php */ public function getInternalInfo() {} } /** * An exception thrown when there is an error while making a request to the server from the client. * @author Israel Ekpo */ class SolrClientException extends SolrException { /** * Returns internal information where the Exception was thrown * * @return array * @link http://docs.php.net/manual/en/solrclientexception.getinternalinfo.php */ public function getInternalInfo() {} } /** * Used for Solr Related Exceptions * * @author Omar Shaban */ class SolrServerException extends SolrException { /** * Returns internal information where the Exception was thrown * * @return array * @link http://docs.php.net/manual/en/solrserverexception.getinternalinfo.php */ public function getInternalInfo() {} } /** * This object is thrown when an illeglal or invalid argument is passed to a method. * * @link http://docs.php.net/manual/en/class.solrillegalargumentexception.php * @author Israel Ekpo */ class SolrIllegalArgumentException extends SolrException { /** * Returns internal information where the Exception was thrown * @return string * @link http://docs.php.net/manual/en/solrillegalargumentexception.getinternalinfo.php */ public function getInternalInfo() {} } /** * @link http://docs.php.net/manual/en/class.solrillegaloperationexception.php * @author Israel Ekpo */ class SolrIllegalOperationException extends SolrException { /** * Returns internal information where the Exception was thrown * * @return string * @link http://docs.php.net/manual/en/solrillegaloperationexception.getinternalinfo.php */ public function getInternalInfo() {} } /** * @author Omar Shaban */ class SolrMissingMandatoryParameterException extends SolrException { } /** * * @author Israel Ekpo * @author Omar Shaban */ abstract class SolrUtils { /** * Parses an response XML string into a SolrObject * * @param string $xmlresponse * @param int $parse_mode * @return SolrObject * @link http://docs.php.net/manual/en/solrutils.digestxmlresponse.php */ public static function digestXmlResponse($xmlresponse, $parse_mode = 0) {} /** * Escapes a lucene query string * * @param string $str String to be escaped * @return string * @link http://docs.php.net/manual/en/solrutils.escapequerychars.php */ public static function escapeQueryChars($str) {} /** * Returns the current version of the Solr extension * @return string * @link http://docs.php.net/manual/en/solrutils.getsolrversion.php */ public static function getSolrVersion() {} /** * Prepares a phrase from an unescaped lucene string * * @param string $str * @return string * @link http://docs.php.net/manual/en/solrutils.queryphrase.php */ public static function queryPhrase($str) {} } /** * Represents a field in a Solr document. All its properties are read-only. * * @author Israel Ekpo */ class SolrDocumentField { /** * The name of the field * * @var string */ public $name; /** * The boost value for the field * * @var float */ public $boost; /** * An array of values for this field * @var array */ public $values; /** * Constructor */ public function __construct() {} /** * Destructor */ public function __destruct() {} } /** * Represents a Solr document that is about to be submitted to the Solr index * * @link http://docs.php.net/manual/en/class.solrinputdocument.php * @author Israel Ekpo * @author Omar Shaban */ final class SolrInputDocument { /** * Sorts the fields in ascending order */ const SORT_DEFAULT = 1 ; /** * Sorts the fields in ascending order */ const SORT_ASC = 1 ; /** * Sorts the fields in descending order */ const SORT_DESC = 2 ; /** * Sorts the fields by name */ const SORT_FIELD_NAME = 1 ; /** * Sorts the fields by number of values */ const SORT_FIELD_VALUE_COUNT = 2 ; /** * Sorts the fields by boost value */ const SORT_FIELD_BOOST_VALUE = 4 ; /** * Adds a new value to a multivalued field */ const UPDATE_MODIFIER_ADD = 1; /** * Sets a field value */ const UPDATE_MODIFIER_SET = 2; /** * Increments a field value */ const UPDATE_MODIFIER_INC = 3; /** * Removes a value from a multivalued field */ const UPDATE_MODIFIER_REMOVE = 4; /** * Removes values matching a java regular expression */ const UPDATE_MODIFIER_REMOVEREGEX = 5; /** * Concurrency default * @var int */ const VERSION_ASSERT_NONE = 0; /** * Assert that a document does not exist, will fail if the document exists * @var int */ const VERSION_ASSERT_NOT_EXISTS = -1; /** * Assert that the document already exists * if the document does not exist, the updates will be rejected. * * @var int */ const VERSION_ASSERT_EXISTS = 1; /** * Adds a field to the document * * @param string $fieldName The name of the field * @param string $fieldValue The value for the field * @param float $fieldBoostValue The index time boost for the field. Though this cannot be negative, you can still pass values less than 1.0 but they must be greater than zero. * @link http://docs.php.net/manual/en/solrinputdocument.addfield.php */ public function addField($fieldName, $fieldValue, $fieldBoostValue = 0.0) {} /** * Resets the document by dropping all the fields and resets the document boost to zero * * @link http://docs.php.net/manual/en/solrinputdocument.clear.php * @return bool Returns TRUE on success or FALSE on failure */ public function clear() {} /** * Removes a field from the document * @param string $fieldName * @link http://docs.php.net/manual/en/solrinputdocument.deletefield.php */ public function deleteField($fieldName) {} /** * Checks if a field exists * * @param $fieldName * @return bool * @link http://docs.php.net/manual/en/solrinputdocument.fieldexists.php */ public function fieldExists($fieldName) {} /** * Retrieves the current boost value for the document * * @return float * @link http://docs.php.net/manual/en/solrinputdocument.getboost.php */ public function getBoost() {} /** * Retrieves a field by name * * @param string $fieldName * @return SolrDocumentField */ public function getField($fieldName) {} /** * Retrieves the boost value for a particular field * * @param string $fieldName * @return float * @link http://docs.php.net/manual/en/solrinputdocument.getfieldboost.php */ public function getFieldBoost($fieldName) {} /** * Returns the number of fields in the document * * @return int * @link http://docs.php.net/manual/en/solrinputdocument.getfieldcount.php */ public function getFieldCount() {} /** * Returns an array containing all the fields in the document * * @return array * @link http://docs.php.net/manual/en/solrinputdocument.getfieldnames.php */ public function getFieldNames() {} /** * Merges one input document into another * * @param SolrInputDocument $sourceDoc * @param bool $overwrite * @link http://docs.php.net/manual/en/solrinputdocument.merge.php */ public function merge(SolrInputDocument $sourceDoc, $overwrite = true) {} /** * This is an alias of SolrInputDocument::clear * * @return bool * @link http://docs.php.net/manual/en/solrinputdocument.reset.php */ public function reset() {} /** * Sets the boost value for this document * * @param float $documentBoostValue * @link http://docs.php.net/manual/en/solrinputdocument.setboost.php */ public function setBoost($documentBoostValue) {} /** * Sets the index-time boost value for a field * * @param string $fieldName * @param float $fieldBoostValue * @link http://docs.php.net/manual/en/solrinputdocument.setfieldboost.php */ public function setFieldBoost($fieldName, $fieldBoostValue) {} /** * Sorts the fields within the document * * @param int $sortOrderBy * @param int $sortDirection One of the SolrInputDocument::SORT_* constants * @link http://docs.php.net/manual/en/solrinputdocument.sort.php */ public function sort($sortOrderBy, $sortDirection = SolrInputDocument::SORT_ASC) {} /** * Returns an array representation of the input document * * @return array * @link http://docs.php.net/manual/en/solrinputdocument.toarray.php */ public function toArray() {} /** * Adds a child document * * @param SolrInputDocument $child * @return void * @throws SolrIllegalArgumentException * @throws SolrException */ public function addChildDocument(SolrInputDocument $child) {} /** * Adds child documents * * @param array $children * @return void * @throws SolrIllegalArgumentException * @throws SolrException */ public function addChildDocuments(array $children) {} /** * Whether this input document has child documents * * @return bool */ public function hasChildDocuments() {} /** * Returns an array of child documents (SolrInputDocument) * * @return array */ public function getChildDocuments() {} /** * Returns the number of child documents * * @return int */ public function getChildDocumentsCount() {} /** * Set document version to enable optimistic concurrency mode using self::VERSION_* constants * or asserting version match * * @param int $version */ public function setVersion($version) {} /** * @return int */ public function getVersion() {} public function __clone() {} public function __construct() {} public function __destruct() {} } /** * Represents a Solr document retrieved from a query response * * @link http://docs.php.net/manual/en/class.solrdocument.php * @author Israel Ekpo * @author Omar Shaban */ final class SolrDocument implements ArrayAccess, Iterator, Serializable { const SORT_DEFAULT = 1 ; const SORT_ASC = 1 ; const SORT_DESC = 2 ; const SORT_FIELD_NAME = 1 ; const SORT_FIELD_VALUE_COUNT = 2 ; const SORT_FIELD_BOOST_VALUE = 4 ; public function __construct() {} public function __clone() {} public function __destruct() {} /** * Adds a field to the document * * @param string $fieldName * @param string $fieldValue * @return Returns TRUE on success or FALSE on failure * @link http://docs.php.net/manual/en/solrdocument.addfield.php */ public function addField($fieldName, $fieldValue) {} /** * Drops all the fields in the document * * @return Returns TRUE on success or FALSE on failure * @link http://docs.php.net/manual/en/solrdocument.addfield.php */ public function clear() {} /** * Retrieves the current field * * @return SolrDocumentField * @link http://docs.php.net/manual/en/solrdocument.current.php */ public function current() {} /** * Removes a field from the document * * @param string $fieldName * @link http://docs.php.net/manual/en/solrdocument.deletefield.php */ public function deleteField($fieldName) {} /** * Checks if a field exists in the document * @param string $fieldName * @return Returns TRUE if the field is present and FALSE if it does not * @link http://docs.php.net/manual/en/solrdocument.fieldexists.php */ public function fieldExists($fieldName) {} /** * Magic method for accessing the field as a property * * @param string $fieldName * @link http://docs.php.net/manual/en/solrdocument.get.php */ public function __get($fieldName) {} /** * Retrieves a field by name * * @param string $fieldName * @return SolrDocumentField */ public function getField($fieldName) {} /** * Returns the number of fields in this document. Multi-value fields are only counted once. * * @return int * @link http://docs.php.net/manual/en/solrdocument.getfieldcount.php */ public function getFieldCount() {} /** * Returns an array of fields names in the document * * @return array * @link http://docs.php.net/manual/en/solrdocument.getfieldcount.php */ public function getFieldNames() {} /** * Returns a SolrInputDocument equivalent of the object * * @return SolrInputDocument * @link http://docs.php.net/manual/en/solrdocument.getinputdocument.php */ public function getInputDocument() {} public function __isset($fieldName) {} public function key() {} /** * Merges source to the current SolrDocument * * @param SolrDocument $sourceDoc * @param bool $overwrite * @link http://docs.php.net/manual/en/solrdocument.merge.php */ public function merge(SolrDocument $sourceDoc, $overwrite = true) {} public function next() {} public function offsetExists($fieldName) {} public function offsetGet($fieldName) {} public function offsetSet($fieldName, $fieldValue) {} public function offsetUnset($fieldName) {} public function reset() {} public function rewind() {} public function serialize() {} public function __set($fieldName, $fieldValue) {} public function sort($sortOrderBy, $sortDirection) {} public function toArray() {} public function unserialize($serialized) {} public function __unset($fieldName) {} public function valid() {} /** * Checks whether this document contains child documents * * @return bool */ public function hasChildDocuments() {} /** * Returns an array of child documents (SolrDocument) * * @return array */ public function getChildDocuments() {} /** * Returns the number of child documents * * @return int */ public function getChildDocumentsCount() {} } /** * * @author Israel Ekpo */ class SolrObject implements ArrayAccess { /* Methods */ public function __construct() {} public function __destruct() {} public function getPropertyNames() {} public function offsetExists($property_name) {} public function offsetGet($property_name) {} public function offsetSet($property_name, $property_value) {} public function offsetUnset($property_name) {} } /** * * @author Israel Ekpo * @author Omar Shaban */ final class SolrClient { /* Constants */ const SEARCH_SERVLET_TYPE = 1 ; const UPDATE_SERVLET_TYPE = 2 ; const THREADS_SERVLET_TYPE = 4 ; const PING_SERVLET_TYPE = 8 ; const TERMS_SERVLET_TYPE = 16 ; const SYSTEM_SERVLET_TYPE = 32; const DEFAULT_SEARCH_SERVLET = 'select' ; const DEFAULT_UPDATE_SERVLET = 'update' ; const DEFAULT_THREADS_SERVLET = 'admin/threads' ; const DEFAULT_PING_SERVLET = 'admin/ping' ; const DEFAULT_TERMS_SERVLET = 'terms' ; const DEFAULT_SYSTEM_SERVLET = 'admin/system' ; /** * Constructor * * @param array $clientOptions */ public function __construct(array $clientOptions) {} public function __destruct() {} /** * Adds a document to the index * * @param SolrInputDocument $doc * @param bool $overwrite * @param int $commitWithin 0 means disabled * @return SolrUpdateResponse */ public function addDocument(SolrInputDocument &$doc, $overwrite = true, $commitWithin = 0) {} /** * Adds a collection of SolrInputDocument instances to the index * * @param array $docs An array of SolrInputDocument objects * @param bool $overwrite * @param int $commitWithin * @return SolrUpdateResponse */ public function addDocuments(array &$docs, $overwrite = true, $commitWithin = 0) {} /** * Finalizes all add/deletes made to the index * * @param bool $softCommit * @param bool $waitSearcher * @param bool $expungeDeletes * @return SolrUpdateResponse */ public function commit($softCommit = false, $waitSearcher = true, $expungeDeletes = false) {} /** * Get Document By Id. Utilizes Solr Realtime Get (RTG). * * @param string $id * @return SolrQueryResponse */ public function getById($id) {} /** * Get Documents by their Ids. Utilizes Solr Realtime Get (RTG). * * @param array $ids * @return SolrQueryResponse */ public function getByIds(array $ids) {} /** * Deletes the document with the specified ID. * * Where ID is the value of the uniqueKey field declared in the schema * * @param string $id * @return SolrUpdateResponse */ public function deleteById($id) {} /** * Deletes a collection of documents with the specified set of ids * * @param array $ids * @return SolrUpdateResponse */ public function deleteByIds(array $ids) {} /** * Removes all documents matching any of the queries * * @param array $queries * @return SolrUpdateResponse */ public function deleteByQueries(array $queries) {} /** * Deletes all documents matching the given query * * @param string $query * @return SolrUpdateResponse */ public function deleteByQuery($query) {} /** * Returns the debug data for the last connection attempt * * @return string */ public function getDebug() {} /** * Returns the client options set internally * * @return array */ public function getOptions() {} /** * Defragments the index for faster search performance * * @param int $maxSegments * @param bool $softCommit * @param bool $waitSearcher * @return SolrUpdateResponse */ public function optimize($maxSegments = 1, $softCommit = false, $waitSearcher = true) {} /** * Checks if Solr server is still up * * @return SolrPingResponse */ public function ping() {} /** * Sends a query to the server * * @param SolrParams $query * @return SolrQueryResponse */ public function query(SolrParams $query) {} /** * Sends a raw XML update request to the server * * @param string $raw_request * @return SolrUpdateResponse */ public function request($raw_request) {} /** * Rollbacks all add/deletes made to the index since the last commit * * @return SolrUpdateResponse */ public function rollback() {} /** * Changes the specified servlet type to a new value * * @param int $type * @param string $value * * @return bool * @link http://docs.php.net/manual/en/solrclient.setservlet.php */ public function setServlet($type, $value) {} /** * Checks the threads status * * @return SolrGenericResponse * @link http://docs.php.net/manual/en/solrclient.threads.php */ public function threads() {} /** * Retrieve Solr Server System Information * * @return SolrGenericResponse */ public function system() {} } /** * @author Omar Shaban * * @link https://cwiki.apache.org/confluence/display/solr/Uploading+Data+with+Solr+Cell+using+Apache+Tika */ class SolrExtractRequest { /** * Capture the specified fields (and everything included below it that isn't capture by some other capture field) separately from the default. This is different * from the case of passing in an XPath expression. *

* The Capture field is based on the localName returned to the SolrContentHandler * by Tika, not to be confused by the mapped field. The field name can then * be mapped into the index schema. *

* For instance, a Tika document may look like: *

     *  <html>
     *    ...
     *    <body>
     *      <p>some text here.  <div>more text</div></p>
     *      Some more text
     *    </body>
     * 
* By passing in the p tag, you could capture all P tags separately from the rest of the t * Thus, in the example, the capture of the P tag would be: "some text here. more text" * */ const CAPTURE_ELEMENTS = 'capture'; /** * Capture attributes separately according to the name of the element, instead of just adding them to the string * buffer. */ const CAPTURE_ATTRIBUTES = 'captureAttr'; /** * Commit document within X number of milliseconds. */ const COMMIT_WITHIN = 'commitWithin'; /** * Defines the date format patterns to identify in the documents. */ const DATE_FORMATS = 'date.formats'; /** * If specified and the name of a potential field cannot be determined, the default Field specified will be used * instead. */ const DEFAULT_FIELD = 'defaultField'; /** * Only extract and return the content, do not index it. */ const EXTRACT_ONLY = 'extractOnly'; /** * Content output format if extractOnly is true. (accepts: xml|text, default xml) */ const EXTRACT_FORMAT = 'extractFormat'; /** * If true, exceptions found during processing will be skipped. Any metadata available, however, will be indexed. */ const IGNORE_TIKA_EXCEPTION = 'ignoreTikaException'; /** * Literal field values will by default override other values such as metadata and content. */ const LITERALS_OVERRIDE = 'literalsOverride'; /** * Map all generated attribute names to field names with lowercase and underscores. */ const LOWERNAMES = 'lowernames'; /** * Useful if uploading very large documents, this defines the KB size of documents to allow. */ const MULTIPART_UPLOAD_LIMIT = 'multipartUploadLimitInKB'; /** * If specified, loads the file as a source for password lookups for Tika encrypted documents. * * File format is Java properties format with one key=value per line. The key is evaluated as a regex against * the file name, and the value is the password The rules are evaluated top-bottom, * i.e. the first match will be used If you want a fallback password to be always used, * supply a .*= at the end */ const PASSWORD_MAP_FILE = 'passwordsFile'; /** * The file name. If specified, Tika can take this into account while guessing the MIME type. */ const RESOURCE_NAME = 'resource.name'; /** * The password for this resource. Will be used instead of the rule based password lookup mechanisms. */ const RESOURCE_PASSWORD = 'resource.password'; /** * Tika config path */ const TIKE_CONFIG = 'tika.config'; /** * If specified, the prefix will be prepended to all Metadata, such that it would be possible to setup a * dynamic field to automatically capture it. */ const UNKNOWN_FIELD_PREFIX = 'uprefix'; /** * Restrict the extracted parts of a document to be indexed by passing in an XPath expression. */ const XPATH_EXPRESSION = 'xpath'; /** * Mapping Tika metadata to Solr fields. (parameter prefix) */ const FIELD_MAPPING_PREFIX = 'fmap.'; /** * Boost value for the name of the field. (parameter prefix) */ const FIELD_BOOST_PREFIX = 'boost.'; /** * Pass in literal values to be added to the document, as is. (parameter prefix) */ const LITERALS_PREFIX = 'literal.'; private function __construct(); /** * @param string $filename * @param SolrModifiableParams $params * * @return SolrExtractRequest */ public static function createFromFile($filename, SolrModifiableParams $params); /** * Create request from a binary stream * * @param string $content * @param string $contentType * @param SolrModifiableParams $params * * @return SolrExtractRequest */ public static function createFromStream($content, $contentType, SolrModifiableParams $params); } /** * * @author Israel Ekpo */ class SolrResponse { /* Constants */ const PARSE_SOLR_OBJ = 0 ; const PARSE_SOLR_DOC = 1 ; /* Properties */ protected $http_status; protected $parser_mode; protected $success; protected $http_status_message; protected $http_request_url; protected $http_raw_request_headers; protected $http_raw_request; protected $http_raw_response_headers; protected $http_raw_response; protected $http_digested_response; /* Methods */ public function __construct() {} public function __destruct() {} /** * Returns the XML response as serialized PHP data * * @return string * @link http://docs.php.net/manual/en/solrresponse.getdigestedresponse.php */ public function getDigestedResponse() {} /** * @return int * @link http://docs.php.net/manual/en/solrresponse.gethttpstatus.php */ public function getHttpStatus() {} /** * @return string * @link http://docs.php.net/manual/en/solrresponse.gethttpstatusmessage.php */ public function getHttpStatusMessage() {} /** * @return string * @link http://docs.php.net/manual/en/solrresponse.getrawrequest.php */ public function getRawRequest() {} /** * @return string * @link http://docs.php.net/manual/en/solrresponse.getrawrequestheaders.php */ public function getRawRequestHeaders() {} /** * @return string * @link http://docs.php.net/manual/en/solrresponse.getrawresponse.php */ public function getRawResponse() {} /** * Returns the raw response headers from the server * * @return string * @link http://docs.php.net/manual/en/solrresponse.getrawresponseheaders.php */ public function getRawResponseHeaders() {} /** * Returns the full URL the request was sent to * * @return string * @link http://docs.php.net/manual/en/solrresponse.getrequesturl.php */ public function getRequestUrl() {} /** * Returns a SolrObject representing the XML response from the server * * @return SolrObject * @link http://docs.php.net/manual/en/solrresponse.getresponse.php */ public function getResponse() {} /** * @param int $parser_mode * @return bool * @link http://docs.php.net/manual/en/solrresponse.setparsemode.php */ public function setParseMode($parser_mode) {} /** * @return bool * @link http://docs.php.net/manual/en/solrresponse.success.php */ public function success() {} } /** * * @author Israel Ekpo */ class SolrQueryResponse extends SolrResponse { } /** * * @author Israel Ekpo */ class SolrUpdateResponse extends SolrResponse { } /** * * @author Israel Ekpo */ class SolrPingResponse extends SolrResponse { } /** * * @author Israel Ekpo */ class SolrGenericResponse extends SolrResponse { } /** * * @author Israel Ekpo */ abstract class SolrParams implements Serializable { /** * This is an alias for SolrParams::addParam * * @param $name * @param $value * @return SolrParams */ public function add($name, $value) {} /** * Adds a parameter to the object * * @param string $name Param name * @param string $value Param value * @return SolrParams */ public function addParam($name, $value) {} /** * This is an alias for SolrParams::getParam * * Returns an array or string depending on the type of parameter * * @param string $param_name * * @return mixed */ public function get($param_name) {} /** * Returns an array or string depending on the type of parameter * * @param string $param_name * * @return mixed */ public function getParam($param_name) {} /** * Returns an array of non URL-encoded parameters * * @return array */ public function getParams() {} /** * Returns an array on URL-encoded parameters * * @return array */ public function getPreparedParams() {} /** * Used for custom serialization * * @return string */ public function serialize() {} /** * * @param $name * @param $value * @return SolrParams */ public function set($name, $value) {} /** * * @param $name * @param $value * @return SolrParams */ public function setParam($name, $value) {} /** * Returns all the name-value pair parameters in the object * * @param bool $url_encode Whether to return URL-encoded values * * @return string */ public function toString($url_encode) {} /** * Used for Custom serialization * * @param string $serialized * @return void */ public function unserialize($serialized) {} } /** * Represents a collection of name-value pairs sent to the Solr server during a request * * @author Israel Ekpo */ class SolrModifiableParams extends SolrParams implements Serializable { public function __construct() {} public function __destruct() {} /** * This is an alias for SolrParams::addParam * * @param $name * @param $value * @return SolrModifiableParams */ public function add($name, $value) {} /** * Adds a parameter to the object * * @param string $name Param name * @param string $value Param value * @return SolrParams */ public function addParam($name, $value) {} /** * Returns an array on URL-encoded parameters * * @return array */ public function getPreparedParams() {} /** * Used for custom serialization * * @return string */ public function serialize() {} /** * * @param $name * @param $value * @return SolrModifiableParams */ public function set($name, $value) {} /** * * @param $name * @param $value * @return SolrModifiableParams */ public function setParam($name, $value) {} /** * Returns all the name-value pair parameters in the object * * @param bool $url_encode Whether to return URL-encoded values * * @return string */ public function toString($url_encode) {} /** * Used for Custom serialization * * @param string $serialized * @return void */ public function unserialize($serialized) {} } /** * * @author Israel Ekpo * @author Omar Shaban */ class SolrQuery extends SolrModifiableParams implements Serializable { /* Constants */ const ORDER_ASC = 0 ; const ORDER_DESC = 1 ; const FACET_SORT_INDEX = 0 ; const FACET_SORT_COUNT = 1 ; const TERMS_SORT_INDEX = 0 ; const TERMS_SORT_COUNT = 1 ; /** * * @param string $q Query string */ public function __construct($q = null) {} public function __destruct() {} /** * This is an alias for SolrParams::addParam * * @param $name * @param $value * @return SolrQuery */ public function add($name, $value) {} /** * Adds a parameter to the object * * @param string $name Param name * @param string $value Param value * @return SolrParams */ public function addParam($name, $value) {} /** * This is an alias for SolrParams::getParam * * Returns an array or string depending on the type of parameter * * @param string $param_name * * @return mixed */ public function get($param_name) {} /** * Returns an array or string depending on the type of parameter * * @param string $param_name * * @return mixed */ public function getParam($param_name) {} /** * Returns an array of non URL-encoded parameters * * @return array */ public function getParams() {} /** * Returns an array on URL-encoded parameters * * @return array */ public function getPreparedParams() {} /** * Used for custom serialization * * @return string */ public function serialize() {} /** * * @param $name * @param $value * @return SolrQuery */ public function set($name, $value) {} /** * * @param $name * @param $value * @return SolrQuery */ public function setParam($name, $value) {} /** * Returns all the name-value pair parameters in the object * * @param bool $url_encode Whether to return URL-encoded values * * @return string */ public function toString($url_encode) {} /** * Used for Custom serialization * * @param string $serialized * @return void */ public function unserialize($serialized) {} /** * @param string $dateField * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addfacetdatefield.php */ public function addFacetDateField($dateField) {} /** * Adds another facet.date.other parameter * * @param string $value * @param string $field_override [optional] Field name for the override * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addfacetdateother.php */ public function addFacetDateOther($value, $field_override = null) {} /** * Adds another field to the facet * * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addfacetfield.php */ public function addFacetField($field) {} /** * @param string $facetQuery * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addfacetquery.php */ public function addFacetQuery($facetQuery) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addfield.php */ public function addField($field) {} /** * @param string $fq * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addfilterquery.php */ public function addFilterQuery($fq) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addhighlightfield.php */ public function addHighlightField($field) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addmltfield.php */ public function addMltField($field) {} /** * @param string $field * @param float $boost * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addmltqueryfield.php */ public function addMltQueryField($field, $boost) {} /** * @param string $field * @param int $order * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addsortfield.php */ public function addSortField($field, $order) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addstatsfacet.php */ public function addStatsFacet($field) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.addstatsfield.php */ public function addStatsField($field) {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.getfacet.php */ public function getFacet() {} /** * @param string $field_override [optional] * @return string * @link http://docs.php.net/manual/en/solrquery.getfacetdateend.php */ public function getFacetDateEnd($field_override = null) {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getfacetdatefields.php */ public function getFacetDateFields() {} /** * @param string $field_override [optional] * @return string * @link http://docs.php.net/manual/en/solrquery.getfacetdategap.php */ public function getFacetDateGap($field_override = null) {} /** * @param string $field_override [optional] * @return string * @link http://docs.php.net/manual/en/solrquery.getfacetdatehardend.php */ public function getFacetDateHardEnd($field_override = null) {} /** * @param string $field_override [optional] * @return array * @link http://docs.php.net/manual/en/solrquery.getfacetdateother.php */ public function getFacetDateOther($field_override = null) {} /** * @param string $field_override [optional] * @return string * @link http://docs.php.net/manual/en/solrquery.getfacetdatestart.php */ public function getFacetDateStart($field_override = null) {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getfacetfields.php */ public function getFacetFields() {} /** * @param string $field_override [optional] * @return int * @link http://docs.php.net/manual/en/solrquery.getfacetlimit.php */ public function getFacetLimit($field_override) {} /** * @param string $field_override [optional] * @return string * @link http://docs.php.net/manual/en/solrquery.getfacetmethod.php */ public function getFacetMethod($field_override) {} /** * @param string $field_override [optional] * @return int * @link http://docs.php.net/manual/en/solrquery.getfacetmincount.php */ public function getFacetMinCount($field_override) {} /** * @param string $field_override [optional] * * @return bool * @link http://docs.php.net/manual/en/solrquery.getfacetmissing.php */ public function getFacetMissing($field_override) {} /** * @param string $field_override [optional] * * @return int * @link http://docs.php.net/manual/en/solrquery.getfacetoffset.php */ public function getFacetOffset($field_override) {} /** * @param string $field_override [optional] * * @return string * @link http://docs.php.net/manual/en/solrquery.getfacetprefix.php */ public function getFacetPrefix($field_override) {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getfacetqueries.php */ public function getFacetQueries() {} /** * @param string $field_override [optional] * * @return int * @link http://docs.php.net/manual/en/solrquery.getfacetsort.php */ public function getFacetSort($field_override) {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getfields.php */ public function getFields() {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getfilterqueries.php */ public function getFilterQueries() {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.gethighlight.php */ public function getHighlight() {} /** * @param string $field_override [optional] * * @return string * @link http://docs.php.net/manual/en/solrquery.gethighlightalternatefield.php */ public function getHighlightAlternateField($field_override = null) {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.gethighlightfields.php */ public function getHighlightFields() {} /** * @param string $field_override [optional] * * @return string * @link http://docs.php.net/manual/en/solrquery.gethighlightformatter.php */ public function getHighlightFormatter($field_override = null) {} /** * @param string $field_override [optional] * @return string * @link http://docs.php.net/manual/en/solrquery.gethighlightfragmenter.php */ public function getHighlightFragmenter($field_override = null) {} /** * @param string $field_override [optional] * @return int * @link http://docs.php.net/manual/en/solrquery.gethighlightfragsize.php */ public function getHighlightFragsize($field_override = null) {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.gethighlighthighlightmultiterm.php */ public function getHighlightHighlightMultiTerm() {} /** * @param string $field_override [optional] * @return int * @link http://docs.php.net/manual/en/solrquery.gethighlightmaxalternatefieldlength.php */ public function getHighlightMaxAlternateFieldLength($field_override = null) {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.gethighlightmaxanalyzedchars.php */ public function getHighlightMaxAnalyzedChars() {} /** * @param string $field_override [optional] * @return bool * @link http://docs.php.net/manual/en/solrquery.gethighlightmergecontiguous.php */ public function getHighlightMergeContiguous($field_override = null) {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.gethighlightregexmaxanalyzedchars.php */ public function getHighlightRegexMaxAnalyzedChars() {} /** * @return string * @link http://docs.php.net/manual/en/solrquery.gethighlightregexpattern.php */ public function getHighlightRegexPattern() {} /** * @return float * @link http://docs.php.net/manual/en/solrquery.gethighlightregexslop.php */ public function getHighlightRegexSlop() {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.gethighlightrequirefieldmatch.php */ public function getHighlightRequireFieldMatch() {} /** * @param string $field_override [optional] * @return string * @link http://docs.php.net/manual/en/solrquery.gethighlightsimplepost.php */ public function getHighlightSimplePost($field_override = null) {} /** * @param string $field_override [optional] * @return string * @link http://docs.php.net/manual/en/solrquery.gethighlightsimplepre.php */ public function getHighlightSimplePre($field_override = null) {} /** * @param string $field_override [optional] * @return int * @link http://docs.php.net/manual/en/solrquery.gethighlightsnippets.php */ public function getHighlightSnippets($field_override = null) {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.gethighlightusephrasehighlighter.php */ public function getHighlightUsePhraseHighlighter() {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.getmlt.php */ public function getMlt() {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.getmltboost.php */ public function getMltBoost() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.getmltcount.php */ public function getMltCount() {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getmltfields.php */ public function getMltFields() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.getmltmaxnumqueryterms.php */ public function getMltMaxNumQueryTerms() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.getmltmaxnumtokens.php */ public function getMltMaxNumTokens() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.getmltmaxwordlength.php */ public function getMltMaxWordLength() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.getmltmindocfrequency.php */ public function getMltMinDocFrequency() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.getmltmintermfrequency.php */ public function getMltMinTermFrequency() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.getmltminwordlength.php */ public function getMltMinWordLength() {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getmltqueryfields.php */ public function getMltQueryFields() {} /** * @return string * @link http://docs.php.net/manual/en/solrquery.getquery.php */ public function getQuery() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.getrows.php */ public function getRows() {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getsortfields.php */ public function getSortFields() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.getstart.php */ public function getStart() {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.getstats.php */ public function getStats() {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getstatsfacets.php */ public function getStatsFacets() {} /** * @return array * @link http://docs.php.net/manual/en/solrquery.getstatsfields.php */ public function getStatsFields() {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.getterms.php */ public function getTerms() {} /** * @return string * @link http://docs.php.net/manual/en/solrquery.gettermsfield.php */ public function getTermsField() {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.gettermsincludelowerbound.php */ public function getTermsIncludeLowerBound() {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.gettermsincludeupperbound.php */ public function getTermsIncludeUpperBound() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.gettermslimit.php */ public function getTermsLimit() {} /** * @return string * @link http://docs.php.net/manual/en/solrquery.gettermslowerbound.php */ public function getTermsLowerBound() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.gettermsmaxcount.php */ public function getTermsMaxCount() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.gettermsmincount.php */ public function getTermsMinCount() {} /** * @return string * @link http://docs.php.net/manual/en/solrquery.gettermsprefix.php */ public function getTermsPrefix() {} /** * @return bool * @link http://docs.php.net/manual/en/solrquery.gettermsreturnraw.php */ public function getTermsReturnRaw() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.gettermssort.php */ public function getTermsSort() {} /** * @return string * @link http://docs.php.net/manual/en/solrquery.gettermsupperbound.php */ public function getTermsUpperBound() {} /** * @return int * @link http://docs.php.net/manual/en/solrquery.gettimeallowed.php */ public function getTimeAllowed() {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removefacetdatefield.php */ public function removeFacetDateField($field) {} /** * @param string $value * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removefacetdateother.php */ public function removeFacetDateOther($value, $field_override) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removefacetfield.php */ public function removeFacetField($field) {} /** * @param string $value * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removefacetquery.php */ public function removeFacetQuery($value) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removefield.php */ public function removeField($field) {} /** * @param string $fq * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removefilterquery.php */ public function removeFilterQuery($fq) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removehighlightfield.php */ public function removeHighlightField($field) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removemltfield.php */ public function removeMltField($field) {} /** * @param string $queryField * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removemltqueryfield.php */ public function removeMltQueryField($queryField) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removesortfield.php */ public function removeSortField($field) {} /** * @param string $value * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removestatsfacet.php */ public function removeStatsFacet($value) {} /** * @param string $field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.removestatsfield.php */ public function removeStatsField($field) {} /** * @param bool $flag * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setechohandler.php */ public function setEchoHandler($flag) {} /** * @param string $type * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setechoparams.php */ public function setEchoParams($type) {} /** * @param string $query * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setexplainother.php */ public function setExplainOther($query) {} /** * @param bool $flag * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacet.php */ public function setFacet($flag) {} /** * @param string $value * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetdateend.php */ public function setFacetDateEnd($value, $field_override) {} /** * @param string $value * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetdategap.php */ public function setFacetDateGap($value, $field_override) {} /** * @param bool $value * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetdatehardend.php */ public function setFacetDateHardEnd($value, $field_override) {} /** * @param string $value * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetdatestart.php */ public function setFacetDateStart($value, $field_override) {} /** * @param int $frequency * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetenumcachemindefaultfrequency.php */ public function setFacetEnumCacheMinDefaultFrequency($frequency, $field_override = null) {} /** * @param int $limit * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetlimit.php */ public function setFacetLimit($limit, $field_override = null) {} /** * @param string $method * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetmethod.php */ public function setFacetMethod($method, $field_override = null) {} /** * @param int $mincount * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetmincount.php */ public function setFacetMinCount($mincount, $field_override = null) {} /** * @param bool $flag * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetmissing.php */ public function setFacetMissing($flag, $field_override = null) {} /** * @param int $offset * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetoffset.php */ public function setFacetOffset($offset, $field_override = null) {} /** * @param string $prefix * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetprefix.php */ public function setFacetPrefix($prefix, $field_override = null) {} /** * @param int $facetSort * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.setfacetsort.php */ public function setFacetSort($facetSort, $field_override = null) {} /** * Enables or disables highlighting * * @param bool $flag * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlight.php */ public function setHighlight($flag) {} /** * Specifies the highlithing backup field to use * * @param string $field * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightalternatefield.php */ public function setHighlightAlternateField($field, $field_override = null) {} /** * Specify a formatter for the highlight output * * @param string $formatter * @param string $field_override [optional] * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightformatter.php */ public function setHighlightFormatter($formatter, $field_override) {} /** * Sets a text snippet generator for highlighted text * * @param string $fragmenter * @param string $field_override * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightfragmenter.php */ public function setHighlightFragmenter($fragmenter, $field_override = null) {} /** * The size of fragments to consider for highlighting * * @param int $size Size (in characters) of fragments to consider for highlighting * @param string $field_override Name of the field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightfragsize.php */ public function setHighlightFragsize($size, $field_override = null) {} /** * @param bool $flag * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlighthighlightmultiterm.php */ public function setHighlightHighlightMultiTerm($flag) {} /** * Sets the maximum number of characters of the field to return * * @param int $fieldLength Length of the field * @param string $field_override Name of the field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightmaxalternatefieldlength.php */ public function setHighlightMaxAlternateFieldLength($fieldLength, $field_override = null) {} /** * Specifies the number of characters into a document to look for suitable snippets * * @param int $value The number of characters into a document to look for suitable snippets * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightmaxanalyzedchars.php */ public function setHighlightMaxAnalyzedChars($value) {} /** * Sets whether or not to collapse contiguous fragments into a single fragment * * @param bool $flag Whether or not to collapse contiguous fragments into a single fragment * @param null $field_override * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightmergecontiguous.php */ public function setHighlightMergeContiguous($flag, $field_override = null) {} /** * Specify the maximum number of characters to analyze * * @param int $maxAnalyzedChars * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightregexmaxanalyzedchars.php */ public function setHighlightRegexMaxAnalyzedChars($maxAnalyzedChars) {} /** * Specify the regular expression for fragmenting * * @param string $value The regular expression for fragmenting. This could be used to extract sentences * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightregexpattern.php */ public function setHighlightRegexPattern($value) {} /** * Sets the factor by which the regex fragmenter can stray from the ideal fragment size * * @param float $factor The factor by which the regex fragmenter can stray from the ideal fragment size * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightregexslop.php */ public function setHighlightRegexSlop($factor) {} /** * Sets whether field matching is required when highlighting * * @param bool $flag If TRUE, then a field will only be highlighted if the query * matched in this particular field. This will only work if * SolrQuery::setHighlightUsePhraseHighlighter() was set to TRUE * * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightrequirefieldmatch.php */ public function setHighlightRequireFieldMatch($flag) {} /** * Sets the text which appears after a highlighted term * * @param string $simplePost * @param string $field_override [optional] Name of the field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightsimplepost.php */ public function setHighlightSimplePost($simplePost, $field_override = null) {} /** * Sets the text which appears before a highlighted term * * @param string $simplePre * @param string $field_override [optional] Name of the field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightsimplepre.php */ public function setHighlightSimplePre($simplePre, $field_override = null) {} /** * @param int $value Maximum number of highlighted snippets to generate per field * @param string $field_override [optional] Name of the field * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightsnippets.php */ public function setHighlightSnippets($value, $field_override = null) {} /** * Whether to highlight phrase terms only when they appear within the query phrase * * @param bool $flag * @return SolrQuery * @link http://docs.php.net/manual/en/solrquery.sethighlightusephrasehighlighter.php */ public function setHighlightUsePhraseHighlighter($flag) {} /** * Enables or disables moreLikeThis * * @param bool $flag TRUE enables it and FALSE turns it off * * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setmlt.php */ public function setMlt($flag) {} /** * Set if the query will be boosted by the interesting term relevance * * @param bool $flag * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setmltboost.php */ public function setMltBoost($flag) {} /** * Set the number of similar documents to return for each result * * @param int $count * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setmltcount.php */ public function setMltCount($count) {} /** * Sets the maximum number of query terms included * * @param int $value The maximum number of query terms that will be included in any generated query * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setmltmaxnumqueryterms.php */ public function setMltMaxNumQueryTerms($value) {} /** * Specifies the maximum number of tokens to parse * * @param int $value The maximum number of tokens to parse * * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setmltmaxnumtokens.php */ public function setMltMaxNumTokens($value) {} /** * Sets the maximum word length * * @param int $maxWordLength The maximum word length above which words will be ignored * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setmltmaxwordlength.php */ public function setMltMaxWordLength($maxWordLength) {} /** * The frequency at which words will be ignored which do not occur in at least this many docs * * @param int $minDocFrequency * * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setmltmindocfrequency.php */ public function setMltMinDocFrequency($minDocFrequency) {} /** * Sets the frequency below which terms will be ignored in the source docs * * @param int $minTermFrequency * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setmltmintermfrequency.php */ public function setMltMinTermFrequency($minTermFrequency) {} /** * Sets the minimum word length below which words will be ignored * * @param int $minWordLength * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setmltminwordlength.php */ public function setMltMinWordLength($minWordLength) {} /** * Exclude the header from the returned results * * @param bool $flag TRUE excludes the header from the result * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setomitheader.php */ public function setOmitHeader($flag) {} /** * Sets the search query * * @param string $query * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setquery.php */ public function setQuery($query) {} /** * Specifies the maximum number of rows to return in the result * * @param int $rows * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setrows.php */ public function setRows($rows) {} /** * Flag to show debug information * * @param bool $flag * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setshowdebuginfo.php */ public function setShowDebugInfo($flag) {} /** * Specifies the number of rows to skip * * @param int $start * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setstart.php */ public function setStart($start) {} /** * Enables or disables the Stats component * * @param bool $flag * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setstats.php */ public function setStats($flag) {} /** * Enables or disables the TermsComponent * * @param bool $flag * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.setterms.php */ public function setTerms($flag) {} /** * Sets the name of the field to get the Terms from * * @param string $fieldname * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermsfield.php */ public function setTermsField($fieldname) {} /** * Sets whether to include the lower bound term in the result set * * @param bool $flag * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermsincludelowerbound.php */ public function setTermsIncludeLowerBound($flag) {} /** * Include the upper bound term in the result set * * @param bool $flag * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermsincludeupperbound.php */ public function setTermsIncludeUpperBound($flag) {} /** * Sets the maximum number of terms to return * * @param int $limit * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermslimit.php */ public function setTermsLimit($limit) {} /** * Specifies the Term to start from * * @param string $lowerBound * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermslowerbound.php */ public function setTermsLowerBound($lowerBound) {} /** * Sets the maximum document frequency * * @param int $frequency * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermsmaxcount.php */ public function setTermsMaxCount($frequency) {} /** * Sets the minimum document frequency * * @param int $frequency * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermsmincount.php */ public function setTermsMinCount($frequency) {} /** * Restrict matches to terms that start with the prefix * * @param string $prefix * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermsprefix.php */ public function setTermsPrefix($prefix) {} /** * Return the raw characters of the indexed term * * @param bool $flag * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermsreturnraw.php */ public function setTermsReturnRaw($flag) {} /** * Specifies how to sort the returned terms * * @param int $sortType If SolrQuery::TERMS_SORT_COUNT, sorts the terms by the term frequency (highest count first). If SolrQuery::TERMS_SORT_INDEX, returns the terms in index order * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermssort.php */ public function setTermsSort($sortType) {} /** * Sets the term to stop at * * @param string $upperBound * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settermsupperbound.php */ public function setTermsUpperBound($upperBound) {} /** * The time allowed for search to finish * * @param int $timeAllowed Time in milliseconds * @return SolrQuery Returns the current SolrQuery object * @link http://docs.php.net/manual/en/solrquery.settimeallowed.php */ public function setTimeAllowed($timeAllowed) {} /** * Collapses the result set to a single document per group before it forwards * the result set to the rest of the search components. * So all downstream components (faceting, highlighting, etc...) will work with * the collapsed result set. * * A collapse function object is passed to collapse the query * * @param SolrCollapseFunction $function * @throws SolrMissingMandatoryParameterException * @return SolrQuery */ public function collapse(SolrCollapseFunction $function) {} /** * Enable/Disable result grouping (group parameter) * * @param bool $value * @return SolrQuery */ public function setGroup($value) {} /** * Returns true if grouping is enabled * @return bool */ public function getGroup() {} /** * The name of the field by which to group results. The field must be single-valued, and either be indexed * or a field type that has a value source and works in a function query, * such as ExternalFileField. It must also be a string-based field, such as StrField or TextField * * @param string $value * @return SolrQuery */ public function addGroupField($value) {} /** * Returns group fields (group.field parameter values) * * @return array */ public function getGroupFields() {} /** * Adds a group function (group.func parameter) * Allows grouping results based on the unique values of a function query. * * @param string $value * @return SolrQuery */ public function addGroupFunction($value) {} /** * Returns group functions (group.func parameter values) * * @return array */ public function getGroupFunctions () {} /** * Adds query to the group.query parameter * Allows grouping of documents that match the given query. * * @param string $value * @return SolrQuery */ public function addGroupQuery($value) {} /** * Returns all the group.query parameter values * * @return array */ public function getGroupQueries() {} /** * Specifies the number of results to return for each group. The server default value is 1. * * @param integer $value * @return SolrQuery */ public function setGroupLimit($value) {} /** * Returns the group.limit value * @return integer */ public function getGroupLimit() {} /** * Sets the group.offset parameter. * @param integer $offset * @return SolrQuery */ public function setGroupOffset($offset) {} /** * Returns the group.offset value * * @return integer */ public function getGroupOffset() {} /** * Adds a group sort field (group.sort parameter). * * @param string $sort * @param integer $direction * @return SolrQuery */ public function addGroupSortField($sort, $direction) {} /** * Returns the group.sort value * * @return array */ public function getGroupSortFields() {} /** * Sets the group.format parameter. * If this parameter is set to simple, the grouped documents are presented in a single flat list, and the start and * rows parameters affect the numbers of documents instead of groups. * * @param string $value * @return SolrQuery */ public function setGroupFormat($value) {} /** * Returns the group.format value * * @return string */ public function getGroupFormat() {} /** * If true, the result of the first field grouping command is used as the main result list in the response, using group.format=simple. * * @param bool $value * @return SolrQuery */ public function setGroupMain($value) {} /** * Returns the group.main value * * @return bool */ public function getGroupMain() {} /** * If true, Solr includes the number of groups that have matched the query in the results. * The default value is false. (group.ngroups parameter) * * @param bool $value * @return SolrQuery */ public function setGroupNGroups($value) {} /** * Returns the group.ngroups value * @return bool */ public function getGroupNGroups() {} /** * If true, facet counts are based on the most relevant document of each group matching the query. * The server default value is false. * group.truncate parameter * * @param bool $value * @return SolrQuery */ public function setGroupTruncate($value) {} /** * Returns the group.truncate value * * @return bool */ public function getGroupTruncate() {} /** * Determines whether to compute grouped facets for the field facets specified in facet.field parameters. * Grouped facets are computed based on the first specified group. * group.facet parameter * * @param bool $value * @return SolrQuery */ public function setGroupFacet($value) {} /** * Returns the group.facet parameter value * * @return bool */ public function getGroupFacet() {} /** * Setting this parameter to a number greater than 0 enables caching for result grouping. * Result Grouping executes two searches; this option caches the second search. The default value is 0. * * Testing has shown that group caching only improves search time with Boolean, wildcard, and fuzzy queries. For simple queries like term or "match all" queries, group caching degrades performance. * group.cache.percent parameter * * @param integer * @throws SolrIllegalArgumentException * @return SolrQuery */ public function setGroupCachePercent($value) {} /** * Returns the group cache percent group.cache.percent value * * @return integer */ public function getGroupCachePercent() {} /** * Sets the expand parameter. This enables or disables group expanding. * * @param bool $value * @return SolrQuery */ public function setExpand($value) {} /** * Returns true if group expanding is enabled * @return bool */ public function getExpand() {} /** * Orders the documents within the expanded groups (expand.sort parameter). * * @param string $sort * @param integer $direction defaults to DESC * @return SolrQuery */ public function addExpandSortField($sort, $direction = SolrQuery::ORDER_DESC) {} /** * Removes an expand sort field from the expand.sort parameter. * * @param string $field * @return SolrQuery */ public function removeExpandSortField($field) {} /** * Returns an array of fields * * @return array */ public function getExpandSortFields() {} /** * Sets the number of rows to display in each group (expand.rows). Server Default 5 * @param integer $rows * @return SolrQuery */ public function setExpandRows($rows) {} /** * Returns The number of rows to display in each group (expand.rows) * * @return integer */ public function getExpandRows() {} /** * Sets the expand.q parameter. Overrides the main q parameter, * determines which documents to include in the main group. * * @param string $q * @return SolrQuery */ public function setExpandQuery($q) {} /** * Returns the expand query expand.q parameter * * @return string */ public function getExpandQuery() {} /** * Overrides main fq's, determines which documents to include in the main group. * * @param string $fq * @return SolrQuery */ public function addExpandFilterQuery($fq) {} /** * Removes an expand filter query. * * @param string $fq * @return SolrQuery */ public function removeExpandFilterQuery($fq) {} /** * Returns the expand filter queries * * @return array */ public function getExpandFilterQueries() {} } /** * SolrDisMaxQuery Makes use of the Solr's DisMax query parser * and eases the use of it using class methods * * @author Omar Shaban */ class SolrDisMaxQuery extends SolrQuery { public function __construct($q = null) {} /** * Switch Query Parser to dismax */ public function useDisMaxQueryParser() {} /** * Switch Query Parser to edismax */ public function useEDisMaxQueryParser() {} /** * Set Query Alternate (q.alt parameter) * When the main q parameter is not specified or is blank. The q.alt parameter is used * * @param string $q */ public function setQueryAlt($q) {} /** * Add a query field with optional boost (qf parameter) * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Theqf%28QueryFields%29Parameter * @param string $field * @param string $boost * @return SolrDisMaxQuery */ public function addQueryField ($field, $boost=null) {} /** * Remove query field (qf parameter) * * @param string $field * @return SolrDisMaxQuery */ public function removeQueryField($field) {} /** * Add a phrase field (pf parameter) * output format: field~slop^boost * * Sample output: title~2^4 * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Thepf%28PhraseFields%29Parameter * @param string $field * @param float $boost * @param integer $slop * @return SolrDisMaxQuery */ public function addPhraseField($field, $boost, $slop=null) {} /** * Removes a phrase field (pf parameter) * @param string $field * @return SolrDisMaxQuery */ public function removePhraseField($field) {} /** * Set Phrase Fields (pf parameter) * @param string $fields * @return SolrDisMaxQuery */ public function setPhraseFields($fields) {} /** * Set Phrase Slop (ps parameter) * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Theps%28PhraseSlop%29Parameter * @param integer $slop * @return SolrDisMaxQuery */ public function setPhraseSlop($slop) {} /** * Set Query Phrase Slop (qs parameter) * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Theqs%28QueryPhraseSlop%29Parameter * @param integer $slop * @return SolrDisMaxQuery */ public function setQueryPhraseSlop($slop) {} /** * Add a boost query field with value and boost * Sample Output: type:lucene^2 * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Thebq%28BoostQuery%29Parameter * * @param string $field * @param string $value * @param string $boost * @return SolrDisMaxQuery */ public function addBoostQuery($field, $value, $boost=null) {} /** * Remove a boost query field * * @param string $field * @return SolrDisMaxQuery */ public function removeBoostQuery($field) {} /** * Sets Boost Query Parameter (bq) * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Thebq%28BoostQuery%29Parameter * * @param string $q * @return SolrDisMaxQuery * */ public function setBoostQuery($q) {} /** * Sets the boost function (bf) * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Thebf%28BoostFunctions%29Parameter * * @param string $function * @return SolrDisMaxQuery */ public function setBoostFunction($function) {} /** * Set Tie Minimum *Should* Match parameter (mm) * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Themm%28MinimumShouldMatch%29Parameter * * @param mixed $value * @return SolrDisMaxQuery */ public function setMinimumMatch($value) {} /** * Set Tie Breaker parameter (tie) * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Thetie%28TieBreaker%29Parameter * @param float $tieBreaker * @return SolrDisMaxQuery */ public function setTieBreaker($tieBreaker) {} /** * Set Bigram Phrase Slop (ps2 parameter) * * @see https://cwiki.apache.org/confluence/display/solr/The+Extended+DisMax+Query+Parser * * @param integer $slop * @return SolrDisMaxQuery */ public function setBigramPhraseSlop($slop) {} /** * Add a phrase Bigram field (pf2 parameter) * output format: field~slop^boost * * Sample output: title~2^4 * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Thepf%28PhraseFields%29Parameter * * @param string $field * @param float $boost * @param integer $slop * @return SolrDisMaxQuery */ public function addBigramPhraseField($field, $boost, $slop=null) {} /** * Removes phrase bigram field (pf2 parameter) * * @param string $field * @return SolrDisMaxQuery */ public function removeBigramPhraseField($field) {} /** * Sets pf2 parameter * * @param string $fields * @return SolrDisMaxQuery */ public function setBigramPhraseFields($fields) {} /** * Add a Trigram Phrase Field (pf3 parameter) * output format: field~slop^boost * * Sample output: title~2^4 * * @see https://cwiki.apache.org/confluence/display/solr/The+DisMax+Query+Parser#TheDisMaxQueryParser-Thepf%28PhraseFields%29Parameter * @param string $field * @param float $boost * @param integer $slop * @return SolrDisMaxQuery */ public function addTrigramPhraseField($field, $boost, $slop=null) {} /** * Removes a Trigram Phrase Field (pf3 parameter) * @param string $field * @return SolrDisMaxQuery */ public function removeTrigramPhraseField($field) {} /** * Sets pf3 parameter * * @param string $fields * @return SolrDisMaxQuery */ public function setTrigramPhraseFields($fields) {} /** * Set Trigram Phrase Slop (ps3 parameter) * * @see https://cwiki.apache.org/confluence/display/solr/The+Extended+DisMax+Query+Parser * * @param integer $slop * @return SolrDisMaxQuery */ public function setTrigramPhraseSlop ($slop) {} /** * Adds a field to User Fields Parameter (uf) * * Specifies which schema fields the end user shall be allowed to query for explicitly. * This parameter supports wildcards. * * @param string $field * @return SolrDisMaxQuery */ public function addUserField($field){} /** * Removes a field from User Fields Parameter (uf) * * @param string $field * @return SolrDisMaxQuery */ public function removeUserField($field){} /** * Sets User Fields parameter (uf) * * Specifies which schema fields the end user shall be allowed to query for explicitly. * This parameter supports wildcards. * * @param string $fields * @return SolrDisMaxQuery */ public function setUserFields($fields){} } /** * Collapses the result set to a single document per group before it forwards * the result set to the rest of the search components. * So all downstream components (faceting, highlighting, etc...) will work with * the collapsed result set. * * @see https://cwiki.apache.org/confluence/display/solr/Collapse+and+Expand+Results * * @author Omar Shaban */ class SolrCollapseFunction { const NULLPOLICY_IGNORE = 'ignore'; const NULLPOLICY_EXPAND = 'expand'; const NULLPOLICY_COLLAPSE = 'collapse'; /** * Accepts the field to collapse on. * * @param string $field */ public function __construct($field = null) {} /** * Set the field that is being collapsed on. * In order to collapse a result. The field type must be a single valued String, Int or Float. * * @param string $field * @return SolrCollapseFunction */ public function setField($field) {} /** * Get the field that is being collapsed on. * * @return string */ public function getField() {} /** * Selects the group heads by the max value of a numeric field or function query. * * @param string $max * @return SolrCollapseFunction */ public function setMax($max) {} /** * Get max * * @return string */ public function getMax() {} /** * Sets the initial size of the collapse data structures when collapsing on a numeric field only. * * @param string $min * @return SolrCollapseFunction */ public function setMin($min) {} /** * Return min parameter * * @return string */ public function getMin() {} /** * Currently there is only one hint available "top_fc", which stands for top level FieldCache. * * @param string $hint * @return SolrCollapseFunction */ public function setHint($hint) {} /** * Get collapse hint. * * @return string */ public function getHint() {} /** * Sets the NULL Policy. * Accepts ignore, expand, or collapse. * * @param string $policy * @return SolrCollapseFunction */ public function setNullPolicy($policy) {} /** * Returns null policy * * @return string */ public function getNullPolicy() {} /** * Sets the initial size of the collapse data structures when collapsing on a numeric field only. * * @param integer $size * @return SolrCollapseFunction */ public function setSize($size) {} /** * Gets the initial size of the collapse data structures when collapsing on a numeric field only. * * @return integer */ public function getSize() {} /** * A string representation (Solr LocalParams) of the function. * @return string */ public function __toString() {} } /* phpdoc -f documentation.php --title Solr --parseprivate on --defaultpackagename Solr --output "HTML:frames:phphtmllib" -t solr_phpdoc */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/examples/000077500000000000000000000000001374041537100171635ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.5.1/examples/bootstrap.php000066400000000000000000000000421374041537100217050ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $query->setFacet(true); $query->addFacetField('cat')->addFacetField('name')->setFacetMinCount(2); $updateResponse = $client->query($query); $response_array = $updateResponse->getResponse(); $facet_data = $response_array->facet_counts->facet_fields; print_r($facet_data); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/facet_002.php000066400000000000000000000011671374041537100213440ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $query->setFacet(true); $query->addFacetField('cat')->addFacetField('name')->setFacetMinCount(2); $query->setFacetMinCount(4, 'name'); $updateResponse = $client->query($query); $response_array = $updateResponse->getResponse(); $facet_data = $response_array->facet_counts->facet_fields; print_r($facet_data); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrclient_001_adddocument_01.php000066400000000000000000000011411374041537100252760ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 334455); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Lucene'); $updateResponse = $client->addDocument($doc); print_r($updateResponse->getResponse()); /* you will have to commit changes to be written if you didn't use $commitWithin */ $client->commit(); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrclient_002_adddocument_02.php000066400000000000000000000011661374041537100253070ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 334455); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Lucene'); // No need to call commit() because $commitWithin is passed, so Solr Server will auto commit within 10 seconds $updateResponse = $client->addDocument($doc, false, 10000); print_r($updateResponse->getResponse()); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrclient_002_adddocument_03_child_docs.php000066400000000000000000000031201374041537100274530ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_STORE_PATH, ); $client = new SolrClient($options); $product = new SolrInputDocument(); $product->addField('id', 'black'); $product->addField('cat', 'tshirt'); $product->addField('cat', 'polo'); $product->addField('content_type', 'product'); $small = new SolrInputDocument(); $small->addField('id', 'TS-BLK-S'); $small->addField('content_type', 'sku'); $small->addField('size', 'S'); $small->addField('inventory', 100); $medium = new SolrInputDocument(); $medium->addField('id', 'TS-BLK-M'); $medium->addField('content_type', 'sku'); $medium->addField('size', 'M'); $medium->addField('inventory', 200); $large = new SolrInputDocument(); $large->addField('id', 'TS-BLK-L'); $large->addField('content_type', 'sku'); $large->addField('size', 'L'); $large->addField('inventory', 300); // add child documents $product->addChildDocument($small); $product->addChildDocument($medium); $product->addChildDocument($large); // or // $skus = [$small, $medium, $large]; // $product->addChildDocuments($skus); // add product document to the index $updateResponse = $client->addDocument( $product, true, // overwrite if the document exists 10000 // commit within 10 seconds ); print_r($updateResponse->getResponse()); /* OUTPUT SIMILAR TO: SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => 0 [QTime] => 5 ) ) */ php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrclient_003_adddocuments_01.php000066400000000000000000000013171374041537100254700ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 334455); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Lucene'); $doc2 = clone $doc; $doc2->deleteField('id'); $doc2->addField('id', 334456); $docs = array($doc, $doc2); $updateResponse = $client->addDocuments($docs); /* you will have to commit changes to be written if you didn't use $commitWithin */ $client->commit(); print_r($updateResponse->getResponse()); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrclient_004_adddocuments_02.php000066400000000000000000000011621374041537100254700ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 334455); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Lucene'); $doc2 = clone $doc; $doc2->deleteField('id'); $doc2->addField('id', 334456); $docs = array($doc, $doc2); $updateResponse = $client->addDocuments($docs, true, 1024); print $updateResponse->getRawRequest(); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrclient_005_optimize.php000066400000000000000000000006311374041537100243560ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $update_response = $client->optimize(4, false, false); $response = $update_response->getRawRequest(); print_r($response); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrclient_006_commit.php000066400000000000000000000006321374041537100240100ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $update_response = $client->commit(true, false, false); $response = $update_response->getRawRequest(); print_r($response); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrclient_007_query.php000066400000000000000000000011041374041537100236610ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setQuery('lucene'); $query->setStart(0); $query->setRows(50); $query->addField('cat')->addField('features')->addField('id')->addField('timestamp'); $query_response = $client->query($query); $response = $query_response->getResponse(); print_r($response); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrclient_008_query_lucene.php000066400000000000000000000011461374041537100252230ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setQuery('manu:"Apple Computer Inc." OR text:apple'); $query->setStart(0); $query->setRows(50); $query->addField('cat')->addField('features')->addField('id')->addField('timestamp'); $query_response = $client->query($query); $response = $query_response->getResponse(); print_r($response); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrclient_009_query_parsemode.php000066400000000000000000000012071374041537100257260ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setQuery('lucene'); $query->setStart(0); $query->setRows(50); $query->addField('cat')->addField('features')->addField('id')->addField('timestamp'); $query_response = $client->query($query); $query_response->setParseMode(SolrQueryResponse::PARSE_SOLR_DOC); $response = $query_response->getResponse(); print_r($response); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrclient_010_getbyid.php000066400000000000000000000005471374041537100241470ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $response = $client->getById('GB18030TEST'); print_r($response->getResponse()); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrclient_011_getbyids.php000066400000000000000000000005661374041537100243340ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $response = $client->getByIds(['GB18030TEST', '6H500F0']); print_r($response->getResponse()); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrclient_012_system.php000066400000000000000000000006041374041537100240400ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query_response = $client->system(); $response = $query_response->getResponse(); print_r($response); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrdismaxquery_001.php000066400000000000000000000017451374041537100235360ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $disMaxQuery = new SolrDisMaxQuery(); $disMaxQuery->setStart(0)->setQuery('solr')->setTimeAllowed(500)->setRows(17); $disMaxQuery->addSortField('price', 0); $disMaxQuery ->setQueryAlt('*:*')->addQueryField('text', 1.5) ->addQueryField('title', 5) ->addBoostQuery('cat', 'electronics', 2) ->setQueryPhraseSlop(1) ->setBigramPhraseSlop(3) ->addBigramPhraseField('text', 2.5) ->addBigramPhraseField('type', 3, 4) ->setTrigramPhraseFields('content^0.5 anchor~4^1.5 title^1.2 site^1.5') ; $queryResponse = $client->query($disMaxQuery); $response = $queryResponse->getResponse(); if($response->response->numFound > 0) { $docs = $response->response->docs; print_r($docs); } else { echo "No Documents Found".PHP_EOL; } php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrdocument_001.php000066400000000000000000000004531374041537100227740ustar00rootroot00000000000000addField('id', 1123); $doc->features = "PHP Client Side"; $doc->features = "Fast development cycles"; $doc['cat'] = 'Software'; $doc['cat'] = 'Custom Search'; $doc->cat = 'Information Technology'; print_r($doc->toArray()); ?> php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrdocument_002.php000066400000000000000000000005701374041537100227750ustar00rootroot00000000000000addField('id', 1123); $doc->features = "PHP Client Side"; $doc->features = "Fast development cycles"; $doc['cat'] = 'Software'; $doc['cat'] = 'Custom Search'; $doc->cat = 'Information Technology'; foreach ($doc as $fieldname => $fieldvalues) { print "$fieldname\n"; print_r($fieldvalues); } ?> php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrdocument_003.php000066400000000000000000000005331374041537100227750ustar00rootroot00000000000000addField('id', 1123); $doc->features = "PHP Client Side"; $doc->features = "Fast development cycles"; $doc['cat'] = 'Software'; $doc['cat'] = 'Custom Search'; $doc->cat = 'Information Technology'; $input_doc = $doc->getInputDocument(); var_dump(get_class($input_doc)); ?> php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrdocument_004.php000066400000000000000000000006471374041537100230040ustar00rootroot00000000000000addField('id', 1123); $doc->features = "PHP Client Side"; $doc->features = "Fast development cycles"; $doc['cat'] = 'Software'; $doc['cat'] = 'Custom Search'; $doc->cat = 'Information Technology'; $second_doc->addField('cat', 'Lucene Search'); $second_doc->merge($doc, true); print_r($second_doc->toArray()); ?> php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrinputdocument_update_partial.php000066400000000000000000000011161374041537100265470ustar00rootroot00000000000000addField('id', 'my_long_doc_id'); $doc->updateField('field1', SolrInputDocument::UPDATE_MODIFIER_ADD, 'newly added value'); $doc->updateField('field1', SolrInputDocument::UPDATE_MODIFIER_REMOVE, 'remove me please'); $doc->updateField('field3_i', SolrInputDocument::UPDATE_MODIFIER_INC, 5); $doc->updateField('field2_s', SolrInputDocument::UPDATE_MODIFIER_SET, 'updated string'); $doc->updateField('field1', SolrInputDocument::UPDATE_MODIFIER_REMOVEREGEX, '[\d]{2}/[\d]{2}/[\d]{4}'); $response = $client->addDocument($doc); $client->commit();php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrobject_001.php000066400000000000000000000002611374041537100224210ustar00rootroot00000000000000 php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrobject_002.php000066400000000000000000000003421374041537100224220ustar00rootroot00000000000000email = "iekpo@php.net"; } catch (Exception $e) { var_dump($e->getCode()); var_dump($e->getMessage()); } var_dump($solrObject->getPropertyNames()); ?> php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrobject_003.php000066400000000000000000000003311374041537100224210ustar00rootroot00000000000000system->threadDump->thread->stackTrace); ?> php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrobject_004.php000066400000000000000000000004121374041537100224220ustar00rootroot00000000000000responseHeader); $system = $solrObject->system; print_r($header); print_r($system); ?> php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrobject_005.php000066400000000000000000000004161374041537100224270ustar00rootroot00000000000000 php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrquery_001.php000066400000000000000000000006131374041537100223210ustar00rootroot00000000000000setParam('a', 1); $query->setParam('b', 2); $query->setParam('c', 3); $query->setStart(4)->setQuery('solr')->setTimeAllowed(500)->setRows(17); $query->addField('israel')->addField('joshua')->addField('june'); $query->addSortField('cat', 0); $query->addFilterQuery('solr')->addFilterQuery('solr1')->addFilterQuery('solr2'); echo $query; echo "\n"; php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrquery_002_facet.php000066400000000000000000000011361374041537100234650ustar00rootroot00000000000000setFacet(0); $query->addFacetField('israel')->addFacetField('israel2'); $query->addFacetQuery('silk')->addFacetQuery('name:june'); $query->setFacetPrefix('A')->setFacetPrefix('C', 'june'); $query->setFacetSort(1)->setFacetSort(0, 'june'); // $query->setFacetLimit(98)->setFacetLimit(44, 'june'); $query->setFacetOffset(110)->setFacetOffset(12, 'june'); $query->setFacetMinCount(4)->setFacetMinCount(30, 'june'); $query->setFacetMissing(1)->setFacetMissing(0, 'june'); $query->setFacetMethod('enum')->setFacetMethod('fc', 'june'); echo $query; echo "\n"; php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrquery_003_date_facet.php000066400000000000000000000014071374041537100244640ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $query->setFacet(true); $query->addFacetDateField('manufacturedate_dt'); $query->setFacetDateStart('2006-02-13T00:00:00Z'); $query->setFacetDateEnd('2012-02-13T00:00:00Z'); $query->setFacetDateGap('+1YEAR'); $query->setFacetDateHardEnd(1); $query->addFacetDateOther('before'); $updateResponse = $client->query($query); $response_array = $updateResponse->getResponse(); $facet_data = $response_array->facet_counts->facet_dates; print_r($facet_data); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrquery_004_highlight.php000066400000000000000000000030431374041537100243530ustar00rootroot00000000000000setHighlight(0); $query->addHighlightField('a')->addHighlightField('a')->addHighlightField('a'); $query->removeHighlightField('a')->removeHighlightField('a')->removeHighlightField('a'); $query->setHighlightSnippets(4)->setHighlightSnippets(5, 'june'); $query->setHighlightFragsize(41)->setHighlightFragsize(52, 'june'); $query->setHighlightMergeContiguous(true)->setHighlightMergeContiguous(false, 'june'); $query->setHighlightRequireFieldMatch(true); $query->setHighlightMaxAnalyzedChars(44)->setHighlightMaxAnalyzedChars(53); $query->setHighlightAlternateField('pizza')->setHighlightAlternateField('bread', 'june'); $query->setHighlightAlternateField('blue')->setHighlightAlternateField('red','june'); $query->setHighlightAlternateField('a')->setHighlightAlternateField('b','june'); $query->setHighlightMaxAlternateFieldLength(300)->setHighlightMaxAlternateFieldLength(335, 'june'); $query->setHighlightFormatter('F')->setHighlightFormatter('G', 'june'); $query->setHighlightSimplePre('OO')->setHighlightSimplePre('PP', 'june'); $query->setHighlightSimplePost('ZZ')->setHighlightSimplePost('YY', 'june'); $query->setHighlightFragmenter('gap')->setHighlightFragmenter('space', 'june'); $query->setHighlightUsePhraseHighlighter(false); $query->setHighlightHighlightMultiTerm(1); $query->setHighlightRegexSlop(0.0025); $query->setHighlightRegexPattern("israel")->setHighlightRegexPattern("ekpo"); $query->setHighlightRegexMaxAnalyzedChars(444)->setHighlightRegexMaxAnalyzedChars(5.0); echo $query; echo "\n"; php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrquery_005_stats.php000066400000000000000000000003661374041537100235500ustar00rootroot00000000000000setStats(0); $query->addStatsField('hello')->addStatsField('june')->removeStatsField('hello'); $query->addStatsFacet('world')->addStatsFacet('pear')->removeStatsFacet('world'); echo $query; echo "\n"; php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrquery_006_mlt.php000066400000000000000000000010211374041537100231740ustar00rootroot00000000000000setMlt(1); $query->setMltCount(55)->setMltCount(90); $query->addMltField('june')->addMltField('joshua')->addMltField('mom')->removeMltField('joshua'); $query->addMltQueryField('june', 0.0)->addMltQueryField('israel', 9.558); $query->setMltMinTermFrequency(9); $query->setMltMinDocFrequency(5); $query->setMltMinWordLength(8); $query->setMltMaxWordLength(99); $query->setMltMaxNumTokens(6); $query->setMltMaxNumQueryTerms(2); $query->setMltBoost(true); echo $query; echo "\n"; php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrquery_007_terms.php000066400000000000000000000007111374041537100235400ustar00rootroot00000000000000setTerms(true); $query->setTermsField('israel'); $query->setTermsLowerBound('june'); $query->setTermsUpperBound('joshua'); $query->setTermsIncludeLowerBound(false); $query->setTermsIncludeUpperBound(0); $query->setTermsMinCount(50); $query->setTermsMaxCount(200); $query->setTermsPrefix('A'); $query->setTermsLimit(45); $query->setTermsReturnRaw(false); $query->setTermsSort(0); echo $query; echo "\n"; php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrquery_008_facetquery.php000066400000000000000000000010551374041537100245610ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $query->setFacet(true); $query->addFacetQuery('price:[* TO 500]')->addFacetQuery('price:[500 TO *]'); $query_response = $client->query($query); $response = $query_response->getResponse(); print_r($response->facet_counts->facet_queries); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrquery_009_grouping.php000066400000000000000000000011551374041537100242450ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $query = new SolrDismaxQuery('*:*'); $query->setRows(4); $query->setGroup(true); $query->addGroupField('manu_s_id'); $query->setGroupLimit(2); $query->addGroupSortField('price', SolrQuery::ORDER_ASC); $query->setGroupNGroups(true); $query_response = $client->query($query); $response = $query_response->getResponse(); print_r($response); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrquery_010_collapse.php000066400000000000000000000012361374041537100242050ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $collapseFunction = new SolrCollapseFunction('manu_id_s'); $collapseFunction ->setSize(2) ->setNullPolicy(SolrCollapseFunction::NULLPOLICY_IGNORE); // $collapseFunction->setMax('sum(cscore(),field(A))'); $query ->collapse($collapseFunction) ->setRows(4); $queryResponse = $client->query($query); $response = $queryResponse->getResponse(); print_r($response); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrquery_011_expand.php000066400000000000000000000012611374041537100236610ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $func = new SolrCollapseFunction('manu_id_s'); $query->collapse($func); $query->setExpand(true); $query->setExpandRows(10); $query->setExpandQuery('manu_id_s:corsair'); $query->addExpandFilterQuery('inStock:true'); $query->addExpandSortField('score', SolrQuery::ORDER_DESC); $queryResponse = $client->query($query); $response = $queryResponse->getResponse(); print_r($response); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/solrutils_001_digestxmlresponse.php000066400000000000000000000003311374041537100261500ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, ); $client = new SolrClient($options); $query = new SolrQuery(); $userInput = 'USB/2'; $escapedUserInput = SolrUtils::escapeQueryChars($userInput); $query->setQuery('text:'.$escapedUserInput); echo $query.PHP_EOL; php-solr-2.5.1+2.4.0/solr-2.5.1/examples/terms_001.php000066400000000000000000000007031374041537100214060ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setTerms(true); $query->setTermsField('cat'); $updateResponse = $client->query($query); print_r($updateResponse->getResponse()); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/terms_002.php000066400000000000000000000010321374041537100214030ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setTerms(true); /* Return only terms starting with $prefix */ $prefix = 'c'; $query->setTermsField('cat')->setTermsPrefix($prefix); $updateResponse = $client->query($query); print_r($updateResponse->getResponse()); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/terms_003.php000066400000000000000000000012121374041537100214040ustar00rootroot00000000000000 SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setTerms(true); /* Return only terms starting with $prefix */ $prefix = 'c'; /* Return only terms with a frequency of 2 or greater */ $min_frequency = 2; $query->setTermsField('cat')->setTermsPrefix($prefix)->setTermsMinCount($min_frequency); $updateResponse = $client->query($query); print_r($updateResponse->getResponse()); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/test.config.php000066400000000000000000000033211374041537100221160ustar00rootroot00000000000000 php-solr-2.5.1+2.4.0/solr-2.5.1/examples/update_stream_file.php000066400000000000000000000020161374041537100235270ustar00rootroot00000000000000set(SolrExtractRequest::LITERALS_PREFIX . 'id', 'doc1') // capture what is inside paragraph tags ->set(SolrExtractRequest::CAPTURE_ELEMENTS, 'p') // Indexes attributes of the Tika XHTML elements into separate fields ->set(SolrExtractRequest::CAPTURE_ATTRIBUTES, 'true') // map p content to solr field ->set( SolrExtractRequest::FIELD_MAPPING_PREFIX . 'p', 'an_indexed_field_name_that_holds_paragraphs' ) // capture unmapped content here ->set(SolrExtractRequest::DEFAULT_FIELD, '__text__') // restrict capturing to matching xpath expression ->set( SolrExtractRequest::XPATH_EXPRESSION, '/xhtml:html/xhtml:body/xhtml:div//node()' ) ; // please reference docs/documentation.php for the rest of the parameters $extractRequest = SolrExtractRequest::createFromFile('path/to/file.html', $extractParams); $response = $client->sendUpdateStream($extractRequest); php-solr-2.5.1+2.4.0/solr-2.5.1/examples/update_stream_payload.php000066400000000000000000000021141374041537100242400ustar00rootroot00000000000000set(SolrExtractRequest::LITERALS_PREFIX . 'id', 'doc1') // capture what is inside paragraph tags ->set(SolrExtractRequest::CAPTURE_ELEMENTS, 'p') // Indexes attributes of the Tika XHTML elements into separate fields ->set(SolrExtractRequest::CAPTURE_ATTRIBUTES, 'true') // map p content to solr field ->set( SolrExtractRequest::FIELD_MAPPING_PREFIX . 'p', 'an_indexed_field_name_that_holds_paragraphs' ) // capture unmapped content here ->set(SolrExtractRequest::DEFAULT_FIELD, '__text__') // restrict capturing to matching xpath expression ->set( SolrExtractRequest::XPATH_EXPRESSION, '/xhtml:html/xhtml:body/xhtml:div//node()' ) ; $binContent = file_get_contents('somefile.pdf'); // please reference docs/documentation.php for the rest of the parameters $extractRequest = SolrExtractRequest::createFromStream($binContent, 'application/pdf', $extractParams); $response = $client->sendUpdateStream($extractRequest); php-solr-2.5.1+2.4.0/solr-2.5.1/pecl-compat/000077500000000000000000000000001374041537100175515ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.5.1/pecl-compat/compat.h000066400000000000000000000051041374041537100212050ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Compatibility macros for different PHP versions | +----------------------------------------------------------------------+ | Copyright (c) 2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Francois Laupretre | +----------------------------------------------------------------------+ */ #ifndef _COMPAT_H #define _COMPAT_H #define PECL_COMPAT_VERSION 1.2 #include #include #include #include "php.h" #include "zend.h" #include "zend_extensions.h" #include "zend_API.h" #define PHP_5_0_X_API_NO 220040412 #define PHP_5_1_X_API_NO 220051025 #define PHP_5_2_X_API_NO 220060519 #define PHP_5_3_X_API_NO 220090626 #define PHP_5_4_X_API_NO 220100525 #define PHP_5_5_X_API_NO 220121212 #define PHP_5_6_X_API_NO 220131226 #if PHP_MAJOR_VERSION >= 7 # define PHP_7 #endif #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef PHP_WIN32 # include "win32/time.h" #elif defined(NETWARE) # include # include #else # include #endif #ifdef HAVE_SYS_RESOURCE_H # include #endif #include #include #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef PHP_WIN32 #include #else #include #endif #if ZEND_EXTENSION_API_NO >= PHP_5_6_X_API_NO #include "zend_virtual_cwd.h" #else #include "TSRM/tsrm_virtual_cwd.h" #endif #ifdef PHP_7 #include "Zend/zend_portability.h" #endif /*-- Include submodules */ #include "src/misc.h" #include "src/zend_string.h" #include "src/zend_hash.h" #endif /* _COMPAT_H */ php-solr-2.5.1+2.4.0/solr-2.5.1/pecl-compat/src/000077500000000000000000000000001374041537100203405ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.5.1/pecl-compat/src/misc.h000066400000000000000000000160251374041537100214500ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Compatibility between PHP versions | +----------------------------------------------------------------------+ | Copyright (c) 2015 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Francois Laupretre | +----------------------------------------------------------------------+ */ #ifndef __PECL_COMPAT_MISC_H #define __PECL_COMPAT_MISC_H 1 #ifdef PHP_7 /*============================================================================*/ typedef zend_string * OPENED_PATH_PTR; /* Type of stream opened_path argument */ typedef size_t COMPAT_ARG_SIZE_T; /* Size of string arguments */ typedef zend_long COMPAT_ARG_LONG_T; /* Type of long (integer) arguments */ #define compat_zval_ptr_dtor(zp) zval_ptr_dtor(zp) #include #else /*== PHP 5 ===================================================================*/ typedef char * OPENED_PATH_PTR; typedef off_t zend_off_t; typedef int COMPAT_ARG_SIZE_T; typedef long COMPAT_ARG_LONG_T; typedef long zend_long; #define compat_zval_ptr_dtor(zp) zval_dtor(zp) #endif /*============================================================================*/ #ifndef MIN # define MIN(a,b) (((a) < (b)) ? (a) : (b)) #endif #ifndef MAX # define MAX(a,b) (((a) > (b)) ? (a) : (b)) #endif /*---------------------------------------------------------------*/ /* (Taken from pcre/pcrelib/internal.h) */ /* To cope with SunOS4 and other systems that lack memmove() but have bcopy(), define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPY is set. Otherwise, include an emulating function for those systems that have neither (there are some non-Unix environments where this is the case). This assumes that all calls to memmove are moving strings upwards in store, which is the case in this extension. */ #if ! HAVE_MEMMOVE # ifdef memmove # undef memmove /* some systems may have a macro */ # endif # if HAVE_BCOPY # define memmove(a, b, c) bcopy(b, a, c) # else static void *my_memmove(unsigned char *dest, const unsigned char *src, size_t n) { int i; dest += n; src += n; for (i = 0; i < n; ++i) *(--dest) = *(--src); } # define memmove(a, b, c) my_memmove(a, b, c) # endif /* not HAVE_BCOPY */ #endif /* not HAVE_MEMMOVE */ #ifdef _AIX # undef PHP_SHLIB_SUFFIX # define PHP_SHLIB_SUFFIX "a" #endif #ifndef ZVAL_IS_ARRAY #define ZVAL_IS_ARRAY(zp) (Z_TYPE_P((zp))==IS_ARRAY) #endif #ifndef ZVAL_IS_STRING #define ZVAL_IS_STRING(zp) (Z_TYPE_P((zp))==IS_STRING) #endif #ifndef ZVAL_IS_LONG #define ZVAL_IS_LONG(zp) (Z_TYPE_P((zp))==IS_LONG) #endif #ifndef ZVAL_IS_BOOL #define ZVAL_IS_BOOL(zp) (Z_TYPE_P((zp))==IS_BOOL) #endif #ifndef INIT_ZVAL #define INIT_ZVAL(z) memset(&z, 0, sizeof(z)) #endif #ifndef ZVAL_UNDEF #define ZVAL_UNDEF(z) INIT_ZVAL(*(z)) #endif #ifndef MAKE_STD_ZVAL #define MAKE_STD_ZVAL(zp) { zp = emalloc(sizeof(zval)); INIT_ZVAL(*zp); } #endif #ifndef ALLOC_INIT_ZVAL #define ALLOC_INIT_ZVAL(zp) MAKE_STD_ZVAL(zp) #endif #ifndef ZEND_ASSUME #if defined(ZEND_WIN32) && !defined(__clang__) # define ZEND_ASSUME(c) __assume(c) #else # define ZEND_ASSUME(c) #endif #endif #ifndef ZEND_ASSERT #if ZEND_DEBUG # define ZEND_ASSERT(c) assert(c) #else # define ZEND_ASSERT(c) ZEND_ASSUME(c) #endif #endif #ifndef EMPTY_SWITCH_DEFAULT_CASE /* Only use this macro if you know for sure that all of the switches values are covered by its case statements */ #if ZEND_DEBUG # define EMPTY_SWITCH_DEFAULT_CASE() default: ZEND_ASSERT(0); break; #else # define EMPTY_SWITCH_DEFAULT_CASE() default: ZEND_ASSUME(0); break; #endif #endif #ifndef ZEND_IGNORE_VALUE #if defined(__GNUC__) && __GNUC__ >= 4 # define ZEND_IGNORE_VALUE(x) (({ __typeof__ (x) __x = (x); (void) __x; })) #else # define ZEND_IGNORE_VALUE(x) ((void) (x)) #endif #endif #if PHP_API_VERSION >= 20100412 typedef size_t PHP_ESCAPE_HTML_ENTITIES_SIZE; #else typedef int PHP_ESCAPE_HTML_ENTITIES_SIZE; #endif /* Avoid a warning when compiling stream wrapper declarations for openfile/opendir/url_stat */ #if ZEND_EXTENSION_API_NO >= PHP_5_6_X_API_NO # define COMPAT_STREAM_CONST_DECL const #else # define COMPAT_STREAM_CONST_DECL #endif #ifndef ZEND_MODULE_GLOBALS_ACCESSOR # ifdef ZTS # define ZEND_MODULE_GLOBALS_ACCESSOR(module_name, v) \ TSRMG(module_name##_globals_id, zend_##module_name##_globals *, v) # else # define ZEND_MODULE_GLOBALS_ACCESSOR(module_name, v) \ (module_name##_globals.v) # endif #endif #ifndef ZEND_MODULE_GLOBALS_BULK # ifdef ZTS # define ZEND_MODULE_GLOBALS_BULK(module_name) \ ((zend_##module_name##_globals *) \ (*((void ***) tsrm_ls))[module_name##_globals_id - 1]) # else # define ZEND_MODULE_GLOBALS_BULK(module_name) \ (&module_name##_globals) # endif #endif #ifndef ZEND_TSRMLS_CACHE_DEFINE # define ZEND_TSRMLS_CACHE_DEFINE() #endif #ifndef ZEND_TSRMLS_CACHE_UPDATE # define ZEND_TSRMLS_CACHE_UPDATE() #endif #ifndef PHP_FE_END # define PHP_FE_END { NULL, NULL, NULL } #endif #ifndef ZEND_MOD_END /* for php < 5.3.7 */ # define ZEND_MOD_END {NULL, NULL, NULL} #endif /*============================================================================*/ /* Duplicate a memory buffer */ /* Supports zero size (allocates 1 byte) */ static zend_always_inline void *_compat_dup(const void *ptr, size_t size, int persistent) { char *p; if (!ptr) return NULL; if (size) { p = pemalloc(size, persistent); memmove(p, ptr, size); } else { p = pemalloc(1,persistent); (*p) = '\0'; /* Ensures deterministic behavior */ } return p; } /*---------------------------------------------------------------*/ /* Duplicate a string and set terminating null. Input string does not have to be null-terminated */ static zend_always_inline void *_compat_dup_str(const void *ptr, size_t size, int persistent) { char *p; if (!ptr) return NULL; p = pemalloc(size + 1, persistent); if (size) memmove(p, ptr, size); p[size] = '\0'; return p; } /*-----------------------------------------------------*/ /* Fatal error - display message and abort process */ static zend_always_inline void compat_unsupported(char *msg) { php_error(E_CORE_ERROR, "This feature is not supported in this environment : %s", msg); exit(1); } /*============================================================================*/ #endif /* __PECL_COMPAT_MISC_H */ php-solr-2.5.1+2.4.0/solr-2.5.1/pecl-compat/src/zend_hash.h000066400000000000000000000260521374041537100224610ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | zend_hash compatibility layer for PHP 5 & 7 | +----------------------------------------------------------------------+ | Copyright (c) 2005-2007 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Francois Laupretre | +----------------------------------------------------------------------+ */ #ifndef _COMPAT_ZEND_HASH_H #define _COMPAT_ZEND_HASH_H #include "zend_hash.h" #ifdef PHP_7 /*============================================================================*/ #define compat_zend_hash_exists(ht, key) zend_hash_exists(ht, key) #define compat_zend_hash_str_exists(ht, str, len) zend_hash_str_exists(ht, str, len) #define COMPAT_HASH_PTR(_zp) (&(Z_PTR_P(_zp))) /*---------*/ /* Changes from original version: - If numeric key, returned (zend_string *) is set to NULL. - If non null, returned zend_string must be released. */ static zend_always_inline int compat_zend_hash_get_current_key_ex(const HashTable *ht , zend_string **str_index, zend_ulong *num_index, HashPosition *pos) { int status; if (str_index) (*str_index) = NULL; status = zend_hash_get_current_key_ex(ht, str_index, num_index, pos); if (*str_index) zend_string_addref(*str_index); return status; } /*---------*/ /* Added - This function is equivalent to the PHP 5 version of zend_hash_get_current_key_ex() */ static zend_always_inline int compat_zend_hash_str_get_current_key_ex(const HashTable *ht , char **str_index, size_t *str_length, zend_ulong *num_index , zend_bool duplicate, HashPosition *pos) { int status; zend_string *zp; zp = NULL; status = zend_hash_get_current_key_ex(ht, &zp, num_index, pos); if (zp) { if (duplicate) { (*str_index) = estrndup(ZSTR_VAL(zp), ZSTR_LEN(zp)); } else { (*str_index) = ZSTR_VAL(zp); } (*str_length) = ZSTR_LEN(zp); } return status; } /*---------*/ static zend_always_inline void *compat_zend_hash_get_current_data_ptr_ex(HashTable *ht , HashPosition *pos) { zval *zp; zp = zend_hash_get_current_data_ex(ht, pos); return Z_PTR_P(zp); } #define compat_zend_hash_get_current_data_ptr(ht) \ compat_zend_hash_get_current_data_ptr_ex(ht, &(ht)->nInternalPointer) /*---------*/ static zend_always_inline void *compat_zend_hash_get_current_data_ex(HashTable *ht , HashPosition *pos) { return (void *)zend_hash_get_current_data_ex(ht, pos); } #define compat_zend_hash_get_current_data(ht) \ compat_zend_hash_get_current_data_ex(ht, &(ht)->nInternalPointer) #define compat_zend_hash_get_current_zval_ex(ht, pos) \ (zval *)compat_zend_hash_get_current_data_ex(ht, pos) #define compat_zend_hash_get_current_zval(ht) \ compat_zend_hash_get_current_zval_ex(ht, &(ht)->nInternalPointer) #else /*= PHP 5 ====================================================================*/ #ifndef HASH_KEY_NON_EXISTENT #define HASH_KEY_NON_EXISTENT HASH_KEY_NON_EXISTANT #endif #define COMPAT_HASH_PTR(_zp) (_zp) /*------------------------------------------------*/ static zend_always_inline void *zend_hash_add_ptr(HashTable *ht , zend_string *key, void *pData) { int status; status = zend_hash_quick_add(ht, ZSTR_VAL(key), (uint)(ZSTR_LEN(key) + 1) , (ulong)ZSTR_HASH(key), &pData, sizeof(void *), NULL); return (status == SUCCESS ? pData : NULL); } #define zend_hash_add_new_ptr(ht, key, pData) zend_hash_add_ptr(ht, key, pData) #define zend_hash_add_mem(ht, key, pData, size) \ zend_hash_add_ptr(ht, key, _compat_dup(pData, size, ht->persistent)) /*---------*/ static zend_always_inline void *zend_hash_str_add_ptr(HashTable *ht , const char *str, size_t len, void *pData) { int status; char *strn = _compat_dup_str(str, len, 0); status = zend_hash_add(ht, strn, len + 1, &pData, sizeof(void *), NULL); efree(strn); return (status == SUCCESS ? pData : NULL); } #define zend_hash_str_add_new_ptr(ht, str, len, pData) zend_hash_str_add_ptr(ht, str, len, pData) #define zend_hash_str_add_mem(ht, str, len, pData, size) \ zend_hash_str_add_ptr(ht, str, len, _compat_dup(pData, size, ht->persistent)) /*---------*/ static zend_always_inline void *zend_hash_index_add_ptr(HashTable *ht , zend_ulong h, void *pData) { int status; status = zend_hash_index_update(ht, (ulong)h, &pData, sizeof(void *), NULL); return (status == SUCCESS ? pData : NULL); } #define zend_hash_index_add_new_ptr(ht, h, pData) \ zend_hash_index_add_ptr(ht, h, pData) #define zend_hash_index_add_mem(ht, h, pData, size) \ zend_hash_index_add_ptr(ht, h, _compat_dup(pData, size, ht->persistent)) /*---------*/ static zend_always_inline void *zend_hash_next_index_insert_ptr(HashTable *ht , void *pData) { int status; status = zend_hash_next_index_insert(ht, &pData, sizeof(void *), NULL); return (status == SUCCESS ? pData : NULL); } #define zend_hash_next_index_insert_mem(ht, pData, size) \ zend_hash_next_index_insert_ptr(ht, _compat_dup(pData, size, ht->persistent)) /*---------*/ static zend_always_inline void *zend_hash_update_ptr(HashTable *ht , zend_string *key, void *pData) { int status; status = zend_hash_quick_update(ht, ZSTR_VAL(key), (uint)(ZSTR_LEN(key) + 1) , (ulong)ZSTR_HASH(key), &pData, sizeof(void *), NULL); return (status == SUCCESS ? pData : NULL); } #define zend_hash_update_mem(ht, key, pData, size) \ zend_hash_update_ptr(ht, key, _compat_dup(pData, size, ht->persistent)) /*---------*/ static zend_always_inline void *zend_hash_str_update_ptr(HashTable *ht , const char *str, size_t len, void *pData) { int status; char *strn = _compat_dup_str(str, len, 0); status = zend_hash_update(ht, strn, len + 1, &pData, sizeof(void *), NULL); efree(strn); return (status == SUCCESS ? pData : NULL); } #define zend_hash_str_upate_mem(ht, str, len, pData, size) \ zend_hash_str_update_ptr(ht, str, len, _compat_dup(pData, size, ht->persistent)) #define zend_hash_index_update_ptr(ht, h, pData) \ zend_hash_index_add_ptr(ht, h, pData) #define zend_hash_index_update_mem(ht, h, pData, size) \ zend_hash_index_add_mem(ht, h, pData, size) /*---------*/ static zend_always_inline void *zend_hash_find_ptr(const HashTable *ht , zend_string *key) { int status; void **p; status = zend_hash_quick_find(ht, ZSTR_VAL(key), (uint)(ZSTR_LEN(key) + 1) , (ulong)ZSTR_HASH(key), (void **)(&p)); return (status == SUCCESS ? (*p) : NULL); } /*---------*/ static zend_always_inline void *zend_hash_str_find_ptr(const HashTable *ht , const char *str, size_t len) { int status; void **p; char *strn = _compat_dup_str(str, len, 0); status = zend_hash_find(ht, strn, len + 1, (void **)(&p)); efree(strn); return (status == SUCCESS ? (*p) : NULL); } /*---------*/ static zend_always_inline void *zend_hash_index_find_ptr(const HashTable *ht , zend_ulong h) { int status; void **p; status = zend_hash_index_find(ht, h, (void **)(&p)); return (status == SUCCESS ? (*p) : NULL); } /*---------*/ #define zend_hash_str_del(ht, arKey, nKeyLength) zend_hash_del(ht, arKey, nKeyLength) /*---------*/ static zend_always_inline zend_bool compat_zend_hash_exists(const HashTable *ht , zend_string *key) { return zend_hash_quick_exists(ht, ZSTR_VAL(key), (uint)(ZSTR_LEN(key) + 1) , (ulong)ZSTR_HASH(key)); } /*---------*/ static zend_always_inline zend_bool compat_zend_hash_str_exists(const HashTable *ht , const char *str, size_t len) { zend_bool status; char *strn = _compat_dup_str(str, len, 0); status = zend_hash_exists(ht, strn, (uint)(len + 1)); efree(strn); return status; } /*---------*/ /* Changes from original version: - Returns a zend_string - If key is a string, returned zend_string must be released. */ static zend_always_inline int compat_zend_hash_get_current_key_ex(const HashTable *ht , zend_string **str_index, zend_ulong *num_index, HashPosition *pos) { int status; char *str; uint32_t str_length; zend_ulong num; status = zend_hash_get_current_key_ex(ht, &str, &str_length, &num, 0, pos); if (status == HASH_KEY_IS_STRING) { (*str_index) = zend_string_init(str, str_length - 1, ht->persistent); } else if (status == HASH_KEY_IS_LONG) { (*num_index) = (zend_ulong)num; } return status; } /*---------*/ /* Diff with original : - Type casts - Return string length, without trailing null */ static zend_always_inline int compat_zend_hash_str_get_current_key_ex(const HashTable *ht , char **str_index, size_t *str_length, zend_ulong *num_index , zend_bool duplicate, HashPosition *pos) { int status; uint32_t length; zend_ulong num; status = zend_hash_get_current_key_ex(ht, str_index, &length, &num, duplicate, pos); if (status == HASH_KEY_IS_STRING) { (*str_length) = (size_t)(length - 1); } else if (status == HASH_KEY_IS_LONG) { (*num_index) = (zend_ulong)num; } return status; } /*---------*/ static zend_always_inline void *compat_zend_hash_get_current_data_ptr_ex(HashTable *ht , HashPosition *pos) { int status; void **p; status = zend_hash_get_current_data_ex(ht, (void **)(&p), pos); return ((status == SUCCESS) ? (*p) : NULL); } #define compat_zend_hash_get_current_data_ptr(ht) \ compat_zend_hash_get_current_data_ptr_ex(ht, NULL) /*---------*/ static zend_always_inline void *compat_zend_hash_get_current_data_ex(HashTable *ht , HashPosition *pos) { int status; void **p; status = zend_hash_get_current_data_ex(ht, (void **)(&p), pos); return ((status == SUCCESS) ? p : NULL); } #define compat_zend_hash_get_current_data(ht) \ compat_zend_hash_get_current_data_ex(ht, NULL) #define compat_zend_hash_get_current_zval_ex(ht, pos) \ *((zval **)compat_zend_hash_get_current_data_ex(ht, pos)) #define compat_zend_hash_get_current_zval(ht) \ compat_zend_hash_get_current_zval_ex(ht, NULL) /*------------------------------------------------------------*/ #define ZEND_HASH_FOREACH(_ht, indirect) do { \ HashPosition _pos; \ for (zend_hash_internal_pointer_reset_ex(_ht, &_pos) \ ;;zend_hash_move_forward_ex(_ht, &_pos)) { \ if (zend_hash_has_more_elements_ex(_ht, &_pos) != SUCCESS) break; #define ZEND_HASH_FOREACH_END() \ } \ } while (0) #define ZEND_HASH_FOREACH_PTR(_ht, _ptr) \ ZEND_HASH_FOREACH(_ht, 0); \ _ptr = compat_zend_hash_get_current_data_ptr_ex(_ht, &_pos); #define ZEND_HASH_FOREACH_NUM_KEY(_ht, _h) \ ZEND_HASH_FOREACH(_ht, 0); \ compat_zend_hash_get_current_key_ex(_ht, NULL, &_h, &_pos); #define ZEND_HASH_FOREACH_NUM_KEY_PTR(_ht, _h, _ptr) \ ZEND_HASH_FOREACH(_ht, 0); \ _ptr = compat_zend_hash_get_current_data_ptr_ex(_ht, &_pos); \ compat_zend_hash_get_current_key_ex(_ht, NULL, &_h, &_pos); /*============================================================================*/ #endif /* PHP_7 */ #endif /* _COMPAT_ZEND_HASH_H */ php-solr-2.5.1+2.4.0/solr-2.5.1/pecl-compat/src/zend_string.h000066400000000000000000000160121374041537100230370ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | zend_string compatibility layer for PHP 5 & 7 | +----------------------------------------------------------------------+ | Copyright (c) 2005-2007 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt. | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Francois Laupretre | +----------------------------------------------------------------------+ */ #ifndef _COMPAT_ZEND_STRING_H #define _COMPAT_ZEND_STRING_H #ifdef PHP_7 /*============================================================================*/ #include "zend_string.h" #ifndef ZSTR_IS_PERSISTENT # define ZSTR_IS_PERSISTENT(s) (GC_FLAGS(s) & IS_STR_PERSISTENT) #endif #else /*============================================================================*/ /*---- zend_string for PHP 5 ----*/ struct _zend_string { int persistent; int hash_is_set; /* needed because computed hash may be null */ zend_ulong h; /* hash value */ uint32_t refcount; size_t len; char val[1]; }; typedef struct _zend_string zend_string; /* Shortcuts */ #define ZSTR_VAL(zstr) (zstr)->val #define ZSTR_LEN(zstr) (zstr)->len #define ZSTR_H(zstr) (zstr)->h #define ZSTR_HASH(zstr) zend_string_hash_val(zstr) #define _ZSTR_HEADER_SIZE XtOffsetOf(zend_string, val) #define _ZSTR_STRUCT_SIZE(len) (_ZSTR_HEADER_SIZE + len + 1) #define ZSTR_IS_PERSISTENT(s) (s->persistent) /*---------*/ static zend_always_inline uint32_t zend_string_refcount(zend_string *s) { return (s->refcount); } /*---------*/ static zend_always_inline uint32_t zend_string_addref(zend_string *s) { return ++(s->refcount); } /*---------*/ static zend_always_inline uint32_t zend_string_delref(zend_string *s) { return --(s->refcount); } /*---------*/ static zend_always_inline zend_ulong zend_string_hash_val(zend_string *s) { char c, *p; if (! s->hash_is_set) { /* Compute with terminating null but preserve string */ p = &(ZSTR_VAL(s)[ZSTR_LEN(s)]); c = (*p); (*p) = '\0'; ZSTR_H(s) = zend_get_hash_value(ZSTR_VAL(s), ZSTR_LEN(s)+1); (*p) = c; s->hash_is_set = 1; } return ZSTR_H(s); } /*---------*/ static zend_always_inline void zend_string_forget_hash_val(zend_string *s) { s->hash_is_set = 0; ZSTR_H(s) = 0; /* Security */ } /*---------*/ static zend_always_inline zend_string *zend_string_alloc(size_t len, int persistent) { zend_string *ret = (zend_string *)pemalloc(ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent); ret->persistent = persistent; zend_string_forget_hash_val(ret); ret->refcount = 1; ZSTR_LEN(ret) = len; return ret; } /*---------*/ static zend_always_inline zend_string *zend_string_safe_alloc(size_t n , size_t m, size_t l, int persistent) { zend_string *ret = (zend_string *)safe_pemalloc(n, m, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(l)), persistent); ret->persistent = persistent; zend_string_forget_hash_val(ret); ret->refcount = 1; ZSTR_LEN(ret) = l; return ret; } /*---------*/ static zend_always_inline zend_string *zend_string_init(const char *str, size_t len, int persistent) { zend_string *ret = zend_string_alloc(len, persistent); memcpy(ZSTR_VAL(ret), str, len); ZSTR_VAL(ret)[len] = '\0'; return ret; } /*---------*/ static zend_always_inline zend_string *zend_string_dup(zend_string *s, int persistent) { zend_string *target; target = zend_string_init(ZSTR_VAL(s), ZSTR_LEN(s), persistent); if (s->hash_is_set) { ZSTR_H(target) = ZSTR_H(s); target->hash_is_set = 1; } return target; } /*---------*/ static zend_always_inline zend_string *zend_string_realloc(zend_string *s , size_t len, int persistent) { zend_string *ret; if (EXPECTED(s->refcount == 1)) { ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent); ZSTR_LEN(ret) = len; zend_string_forget_hash_val(ret); return ret; } zend_string_delref(s); ret = zend_string_alloc(len, persistent); memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), MIN(len, ZSTR_LEN(s)) + 1); return ret; } /*---------*/ static zend_always_inline zend_string *zend_string_extend(zend_string *s , size_t len, int persistent) { zend_string *ret; ZEND_ASSERT(len >= ZSTR_LEN(s)); if (EXPECTED(s->refcount == 1)) { ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent); ZSTR_LEN(ret) = len; zend_string_forget_hash_val(ret); return ret; } zend_string_delref(s); ret = zend_string_alloc(len, persistent); memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), ZSTR_LEN(s) + 1); return ret; } /*---------*/ static zend_always_inline zend_string *zend_string_truncate(zend_string *s , size_t len, int persistent) { zend_string *ret; ZEND_ASSERT(len <= ZSTR_LEN(s)); if (EXPECTED(s->refcount == 1)) { ret = (zend_string *)perealloc(s, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent); ZSTR_LEN(ret) = len; zend_string_forget_hash_val(ret); return ret; } zend_string_delref(s); ret = zend_string_alloc(len, persistent); memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), len + 1); return ret; } /*---------*/ static zend_always_inline zend_string *zend_string_safe_realloc(zend_string *s , size_t n, size_t m, size_t l, int persistent) { zend_string *ret; if (EXPECTED(s->refcount == 1)) { ret = (zend_string *)safe_perealloc(s, n, m, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(l)), persistent); ZSTR_LEN(ret) = (n * m) + l; zend_string_forget_hash_val(ret); return ret; } zend_string_delref(s); ret = zend_string_safe_alloc(n, m, l, persistent); memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), MIN((n * m) + l, ZSTR_LEN(s)) + 1); return ret; } /*---------*/ static zend_always_inline void zend_string_free(zend_string *s) { if (s) { pefree(s, s->persistent); } } /*---------*/ static zend_always_inline void zend_string_release(zend_string *s) { if (s) { s->refcount--; if (s->refcount == 0) { zend_string_free(s); } } } /*---------*/ static zend_always_inline zend_string *zend_string_copy(zend_string *s) { zend_string_addref(s); return (s); } /*---------*/ static zend_always_inline zend_bool zend_string_equals(zend_string *s1, zend_string *s2) { return s1 == s2 || (s1->len == s2->len && !memcmp(s1->val, s2->val, s1->len)); } #define zend_string_equals_literal(str, literal) \ ((str)->len == sizeof(literal)-1 && !memcmp((str)->val, literal, sizeof(literal) - 1)) #endif /* PHP_7 */ #endif /* _COMPAT_ZEND_STRING_H */ php-solr-2.5.1+2.4.0/solr-2.5.1/solr.dsp000066400000000000000000000140761374041537100170440ustar00rootroot00000000000000# Microsoft Developer Studio Project File - Name="Solr" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=Solr - Win32 Debug_TS !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "Solr.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "Solr.mak" CFG="Solr - Win32 Debug_TS" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "Solr - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "Solr - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "Solr - Win32 Release_TS" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release_TS" # PROP BASE Intermediate_Dir "Release_TS" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release_TS" # PROP Intermediate_Dir "Release_TS" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SOLR_EXPORTS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_SOLR" /D ZTS=1 /D HAVE_SOLR=1 /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x407 /d "NDEBUG" # ADD RSC /l 0x407 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386 # ADD LINK32 wsock32.lib php5ts.lib libcurl.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /machine:I386 /out:"..\..\Release_TS/php_solr.dll" /implib:"..\..\Release_TS/php_solr.lib" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline" /libpath:"..\..\..\bindlib_w32\Release" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "Solr - Win32 Debug_TS" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug_TS" # PROP BASE Intermediate_Dir "Debug_TS" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug_TS" # PROP Intermediate_Dir "Debug_TS" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SOLR_EXPORTS" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /D ZEND_DEBUG=1 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_SOLR" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_SOLR=1 /YX /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x407 /d "_DEBUG" # ADD RSC /l 0x407 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386 # ADD LINK32 php5ts_debug.lib libcurl.lib ws2_32.lib resolv.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /debug /machine:I386 /nodefaultlib:"msvcrt" /out:"..\..\Debug_TS\php_solr.dll" /implib:"..\..\Debug_TS/php_solr.lib" /libpath:"..\..\Debug_TS" /libpath:"..\..\..\bindlib_w32\Release" !ENDIF # Begin Target # Name "Solr - Win32 Release_TS" # Name "Solr - Win32 Debug_TS" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=./php_solr.c # End Source File # Begin Source File SOURCE=./php_solr_exception.c # End Source File # Begin Source File SOURCE=./php_solr_object.c # End Source File # Begin Source File SOURCE=./php_solr_response.c # End Source File # Begin Source File SOURCE=./php_solr_document.c # End Source File # Begin Source File SOURCE=./php_solr_input_document.c # End Source File # Begin Source File SOURCE=./php_solr_query.c # End Source File # Begin Source File SOURCE=./php_solr_client.c # End Source File # Begin Source File SOURCE=./php_solr_functions.c # End Source File # Begin Source File SOURCE=./php_solr_params.c # End Source File # Begin Source File SOURCE=./php_solr_utils.c # End Source File # Begin Source File SOURCE=./solr_functions_debug.c # End Source File # Begin Source File SOURCE=./solr_functions_params.c # End Source File # Begin Source File SOURCE=./solr_functions_document.c # End Source File # Begin Source File SOURCE=./solr_functions_response.c # End Source File # Begin Source File SOURCE=./solr_functions_client.c # End Source File # Begin Source File SOURCE=./solr_functions_helpers.c # End Source File # Begin Source File SOURCE=./solr_string.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=.\php_solr.h # End Source File # Begin Source File SOURCE=.\php_solr_api.h # End Source File # Begin Source File SOURCE=.\solr_constants.h # End Source File # Begin Source File SOURCE=.\solr_macros.h # End Source File # Begin Source File SOURCE=.\solr_string.h # End Source File # Begin Source File SOURCE=.\solr_types.h # End Source File # End Group # End Target # End Project php-solr-2.5.1+2.4.0/solr-2.5.1/src/000077500000000000000000000000001374041537100161345ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/000077500000000000000000000000001374041537100170125ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/php_solr.c000066400000000000000000002056111374041537100210110ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_solr.h" #ifdef HAVE_SOLR #if LIBCURL_VERSION_NUM < 0x070F00 #error libcurl 7.15.0 or later is required. Please upgrade your libcurl version. #endif #if LIBXML_VERSION < 20616 #error libxml2 2.6.16 or later is required. Please upgrade your libxml2 version. #endif /******************************************************************************/ /** GLOBAL VARIABLE FOR THE EXTENSION **/ /******************************************************************************/ /* {{{ ZEND_DECLARE_MODULE_GLOBALS(solr) */ ZEND_DECLARE_MODULE_GLOBALS(solr) /* }}} */ /******************************************************************************/ /** OBJECT HANDLERS AND DECLARATIONS FOR CLASS ENTRIES **/ /******************************************************************************/ /* {{{ zend_class_entry declarations of the classes */ zend_class_entry *solr_ce_SolrObject; zend_class_entry *solr_ce_SolrInputDocument; zend_class_entry *solr_ce_SolrDocument; zend_class_entry *solr_ce_SolrDocumentField; zend_class_entry *solr_ce_SolrExtractRequest; zend_class_entry *solr_ce_SolrClient; zend_class_entry *solr_ce_SolrParams; zend_class_entry *solr_ce_SolrModifiableParams; zend_class_entry *solr_ce_SolrCollapseFunction; zend_class_entry *solr_ce_SolrQuery; zend_class_entry *solr_ce_SolrResponse; zend_class_entry *solr_ce_SolrQueryResponse; zend_class_entry *solr_ce_SolrUpdateResponse; zend_class_entry *solr_ce_SolrPingResponse; zend_class_entry *solr_ce_SolrGenericResponse; zend_class_entry *solr_ce_SolrUtils; zend_class_entry *solr_ce_SolrException; zend_class_entry *solr_ce_SolrIllegalOperationException; zend_class_entry *solr_ce_SolrIllegalArgumentException; zend_class_entry *solr_ce_SolrClientException; zend_class_entry *solr_ce_SolrServerException; zend_class_entry *solr_ce_SolrMissingMandatoryParameterException; /* }}} */ /* {{{ zend_object_handlers */ zend_object_handlers solr_object_handlers; zend_object_handlers solr_document_field_handlers; zend_object_handlers solr_input_document_object_handlers; zend_object_handlers solr_client_object_handlers; zend_object_handlers solr_response_object_handlers; zend_object_handlers solr_collapse_function_object_handlers; zend_object_handlers solr_extract_request_object_handlers; /* }}} */ /* {{{ static void php_solr_globals_ctor(zend_solr_globals *solr_globals_arg) Global variable initializer. In ZTS mode, called once for each thread spawned. */ static void php_solr_globals_ctor(zend_solr_globals *solr_globals_arg) { /* Initializing the counters to Zero */ solr_globals_arg->request_count = 0U; solr_globals_arg->document_count = 0U; solr_globals_arg->client_count = 0U; solr_globals_arg->functions_count = 0U; solr_globals_arg->documents = NULL; solr_globals_arg->clients = NULL; solr_globals_arg->params = NULL; solr_globals_arg->functions = NULL; solr_globals_arg->ustreams = NULL; } /* }}} */ /******************************************************************************/ /** DECLARING STRUCTURES FOR METHOD ARGUMENTS TYPE HINTING **/ /******************************************************************************/ /* {{{ arg_info vectors for functions and methods */ ZEND_BEGIN_ARG_INFO_EX(SolrObject__get_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, property_name) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrObject__set_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, property_name) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, property_value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrObject_one_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, property_name) ZEND_END_ARG_INFO() /* {{{ SolrDocument arguments */ ZEND_BEGIN_ARG_INFO_EX(SolrDocument__construct_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_addField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldValue) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_getField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_fieldExists_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_deleteField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_sort_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, sortOrderBy) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, sortDirection) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_merge_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, sourceDoc, SolrDocument, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, overwrite) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_current_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDocument_getInputDocument_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(SolrDocument_unserialize_args, 0) ZEND_ARG_INFO(0, serialized) ZEND_END_ARG_INFO() /* }}} */ /* {{{ SolrInputDocument arguments */ ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument__construct_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_setBoost_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, documentBoostValue) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_addField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldValue) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldBoostValue) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_getFieldBoost_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_getField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_setFieldBoost_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldBoostValue) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_fieldExists_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_deleteField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_sort_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, sortOrderBy) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, sortDirection) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_merge_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, sourceDoc, SolrInputDocument, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, overwrite) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_addChildDocument_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, child, SolrInputDocument, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_addChildDocuments_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_ARRAY_INFO(SOLR_ARG_PASS_BY_REF_TRUE, docs, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_updateField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 3) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, modifier) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrInputDocument_setVersion_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, version) ZEND_END_ARG_INFO() /* }}} */ /* {{{ SolrClient arguments */ ZEND_BEGIN_ARG_INFO_EX(SolrClient_constructor_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_ARRAY_INFO(SOLR_ARG_PASS_BY_REF_FALSE, clientOptions, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_query_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, query, SolrParams, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_addDocument_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, doc, SolrInputDocument, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, overwrite) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, commitWithin) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_addDocuments_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_ARRAY_INFO(SOLR_ARG_PASS_BY_REF_TRUE, docs, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, overwrite) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, commitWithin) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_sendUpdateStream_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, request, SolrExtractRequest, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_request_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, raw_request) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_setResponseWriter_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, responseWriter) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_commit_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, softCommit) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, waitSearcher) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, expungeDeletes) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_optimize_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, maxSegments) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, softCommit) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, waitSearcher) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_rollback_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_deleteById_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, id) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_deleteByIds_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_ARRAY_INFO(SOLR_ARG_PASS_BY_REF_FALSE, ids, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_deleteByQuery_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, query) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_deleteByQueries_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_ARRAY_INFO(SOLR_ARG_PASS_BY_REF_FALSE, queries, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_ping_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_threads_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_info_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrClient_setServlet_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, type) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() /* }}} */ /* {{{ SolrParams arguments */ ZEND_BEGIN_ARG_INFO_EX(SolrParams_setParam_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, name) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrParams_addParam_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, name) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrParams_toString_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, url_encode) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrParams_getParam_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, param_name) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(SolrParams_unserialize_args, 0) ZEND_ARG_INFO(0, serialized) ZEND_END_ARG_INFO() /* }}} */ /* {{{ SolrQuery arguments */ ZEND_BEGIN_ARG_INFO_EX(SolrQuery_constructor_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, q) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setQuery_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, q) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setStart_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, start) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setRows_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, rows) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_addField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_addSortField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, order) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_addFilterQuery_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fq) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setShowDebugInfo_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, flag) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setExplainOther_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, flag) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setTimeAllowed_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, timeAllowed) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setOmitHeader_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, flag) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setEchoHandler_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, flag) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setEchoParams_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, type) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_facet_get_1_0_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field_override) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_facet_1_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_facet_2_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field_override) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_group_1_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_hl_get_1_0_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field_override) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_hl_1_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_hl_2_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field_override) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_stats_1_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_mlt_1_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_mlt_2_2_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, boost) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_terms_1_1_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_setGroupCachePct_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, percent) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrQuery_collapse_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, collapseFunction, SolrCollapseFunction, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() /* }}} */ /* {{{ Solr Generic arguments */ ZEND_BEGIN_ARG_INFO_EX(Solr_no_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_END_ARG_INFO() /* }}} */ /* {{{ */ ZEND_BEGIN_ARG_INFO_EX(SolrResponse_setParseMode_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, parser_mode) ZEND_END_ARG_INFO() /* }}} */ /* {{{ SolrUtils */ ZEND_BEGIN_ARG_INFO_EX(SolrUtils_escapeQueryChars_arg, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, str) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrUtils_digestXML_arg, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, xmlresponse) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, parse_mode) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrUtils_digestJson_arg, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, jsonResponse) ZEND_END_ARG_INFO() /* }}} */ ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_construct_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, field) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_set_size_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, size) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_set_hint_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, hint) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_set_max_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, max) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_set_min_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, min) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_set_field_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, fieldName) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrCollapseFunction_set_null_policy_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, policy) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrExtractRequest_createFromFile_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, filename) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, params, SolrModifiableParams, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrExtractRequest_createFromStream_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 3) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, content) ZEND_ARG_INFO(SOLR_ARG_PASS_BY_REF_FALSE, mime_type) ZEND_ARG_OBJ_INFO(SOLR_ARG_PASS_BY_REF_TRUE, params, SolrModifiableParams, SOLR_ARG_ALLOW_NULL_FALSE) ZEND_END_ARG_INFO() /* }}} */ /* {{{ solr_functions[] */ static zend_function_entry solr_functions[] = { PHP_FE(solr_get_version, Solr_no_args) PHP_FE_END }; /* }}} */ /* {{{ solr_object_methods */ static zend_function_entry solr_object_methods[] = { SOLR_CTOR(SolrObject, __construct, Solr_no_args) SOLR_DTOR(SolrObject, __destruct, Solr_no_args) /** Temporarily disconnected for now. May be brought back in the future. PHP_ME(SolrObject, __set, SolrObject__set_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, __get, SolrObject__get_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, __isset, SolrObject_one_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, __unset, SolrObject_one_args, ZEND_ACC_PUBLIC) */ PHP_ME(SolrObject, offsetSet, SolrObject__set_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, offsetGet, SolrObject__get_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, offsetExists, SolrObject_one_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, offsetUnset, SolrObject_one_args, ZEND_ACC_PUBLIC) PHP_ME(SolrObject, getPropertyNames, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_document_methods */ static zend_function_entry solr_document_field_methods[] = { SOLR_CTOR(SolrDocumentField, __construct, Solr_no_args) SOLR_DTOR(SolrDocumentField, __destruct, Solr_no_args) PHP_FE_END }; /* }}} */ /* {{{ solr_collapse_function_methods for the SolrCollapseFunction ce */ static zend_function_entry solr_collapse_function_methods[] = { SOLR_CTOR(SolrCollapseFunction, __construct, SolrCollapseFunction_construct_args) SOLR_DTOR(SolrCollapseFunction, __destruct, Solr_no_args) PHP_ME(SolrCollapseFunction, setField, SolrCollapseFunction_set_field_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, getField, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, setMax, SolrCollapseFunction_set_max_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, getMax, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, setMin, SolrCollapseFunction_set_min_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, getMin, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, setSize, SolrCollapseFunction_set_size_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, getSize, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, setHint, SolrCollapseFunction_set_hint_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, getHint, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, setNullPolicy, SolrCollapseFunction_set_null_policy_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, getNullPolicy, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, __toString, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, __sleep, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrCollapseFunction, __wakeup, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_document_methods */ static zend_function_entry solr_document_methods[] = { SOLR_CTOR(SolrDocument, __construct, SolrDocument__construct_args) SOLR_DTOR(SolrDocument, __destruct, Solr_no_args) PHP_ME(SolrDocument, __clone, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, __set, SolrDocument_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, __get, SolrDocument_getField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, __isset, SolrDocument_fieldExists_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, __unset, SolrDocument_deleteField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, offsetSet, SolrDocument_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, offsetGet, SolrDocument_getField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, offsetExists, SolrDocument_fieldExists_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, offsetUnset, SolrDocument_deleteField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, current, SolrDocument_current_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, key, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, next, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, rewind, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, valid, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, serialize, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, unserialize, SolrDocument_unserialize_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, clear, Solr_no_args, ZEND_ACC_PUBLIC) PHP_MALIAS(SolrDocument, reset, clear, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, addField, SolrDocument_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, getFieldNames, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, getFieldCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, getField, SolrDocument_getField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, toArray, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, fieldExists, SolrDocument_fieldExists_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, deleteField, SolrDocument_deleteField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, sort, SolrDocument_sort_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, merge, SolrDocument_merge_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, getInputDocument, SolrDocument_getInputDocument_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, getChildDocumentsCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, hasChildDocuments, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDocument, getChildDocuments, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_input_document_methods */ static zend_function_entry solr_input_document_methods[] = { SOLR_CTOR(SolrInputDocument, __construct, SolrInputDocument__construct_args) SOLR_DTOR(SolrInputDocument, __destruct, Solr_no_args) PHP_ME(SolrInputDocument, __clone, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, __sleep, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, __wakeup, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, setBoost, SolrInputDocument_setBoost_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getBoost, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, clear, Solr_no_args, ZEND_ACC_PUBLIC) PHP_MALIAS(SolrInputDocument, reset, clear, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, addField, SolrInputDocument_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, updateField, SolrInputDocument_updateField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getFieldBoost, SolrInputDocument_getFieldBoost_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, setFieldBoost, SolrInputDocument_setFieldBoost_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getFieldNames, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getFieldCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getField, SolrInputDocument_getField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, toArray, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, fieldExists, SolrInputDocument_fieldExists_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, deleteField, SolrInputDocument_deleteField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, sort, SolrInputDocument_sort_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, merge, SolrInputDocument_merge_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, addChildDocument, SolrInputDocument_addChildDocument_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getChildDocuments, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, hasChildDocuments, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getChildDocumentsCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, addChildDocuments, SolrInputDocument_addChildDocuments_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, setVersion, SolrInputDocument_setVersion_args, ZEND_ACC_PUBLIC) PHP_ME(SolrInputDocument, getVersion, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_client_methods */ static zend_function_entry solr_client_methods[] = { SOLR_CTOR(SolrClient, __construct, SolrClient_constructor_args) SOLR_DTOR(SolrClient, __destruct, Solr_no_args) PHP_ME(SolrClient, __sleep, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, __wakeup, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, __clone, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, getOptions, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, getDebug, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, setServlet, SolrClient_setServlet_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, query, SolrClient_query_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, addDocument, SolrClient_addDocument_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, addDocuments, SolrClient_addDocuments_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, sendUpdateStream, SolrClient_sendUpdateStream_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, request, SolrClient_request_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, setResponseWriter, SolrClient_setResponseWriter_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, deleteById, SolrClient_deleteById_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, deleteByIds, SolrClient_deleteByIds_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, deleteByQuery, SolrClient_deleteByQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, deleteByQueries, SolrClient_deleteByQueries_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, getById, SolrClient_deleteById_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, getByIds, SolrClient_deleteByIds_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, commit, SolrClient_commit_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, optimize, SolrClient_optimize_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, rollback, SolrClient_rollback_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, ping, SolrClient_ping_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, system, SolrClient_info_args, ZEND_ACC_PUBLIC) PHP_ME(SolrClient, threads, SolrClient_threads_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_exception_methods. None. */ static zend_function_entry solr_exception_methods[] = { PHP_ME(SolrException, getInternalInfo, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_exception_methods. None. */ static zend_function_entry solr_client_exception_methods[] = { PHP_ME(SolrClientException, getInternalInfo, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_exception_methods. None. */ static zend_function_entry solr_server_exception_methods[] = { PHP_ME(SolrServerException, getInternalInfo, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_exception_methods. None. */ static zend_function_entry solr_illegal_operation_exception_methods[] = { PHP_ME(SolrIllegalOperationException, getInternalInfo, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_exception_methods. None. */ static zend_function_entry solr_illegal_argument_exception_methods[] = { PHP_ME(SolrIllegalArgumentException, getInternalInfo, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* PHP_MALIAS(SolrInputDocument, reset, clear, Solr_no_args, ZEND_ACC_PUBLIC) */ /* {{{ solr_params_methods. */ static zend_function_entry solr_params_methods[] = { PHP_ME(SolrParams, setParam, SolrParams_setParam_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, addParam, SolrParams_addParam_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, __toString, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, toString, SolrParams_toString_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, getParams, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, getParam, SolrParams_getParam_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, getPreparedParams, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, __clone, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, serialize, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrParams, unserialize, SolrParams_unserialize_args, ZEND_ACC_PUBLIC) PHP_MALIAS(SolrParams, add, addParam, SolrParams_addParam_args, ZEND_ACC_PUBLIC) PHP_MALIAS(SolrParams, set, setParam, SolrParams_setParam_args, ZEND_ACC_PUBLIC) PHP_MALIAS(SolrParams, get, getParam, SolrParams_getParam_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_modifiable_params_methods. */ static zend_function_entry solr_modifiable_params_methods[] = { SOLR_CTOR(SolrModifiableParams, __construct, Solr_no_args) SOLR_DTOR(SolrModifiableParams, __destruct, Solr_no_args) PHP_FE_END }; /* }}} */ static zend_function_entry solr_extract_request_methods[] = { PHP_ME(SolrExtractRequest, __construct, Solr_no_args, ZEND_ACC_PRIVATE | ZEND_ACC_CTOR) PHP_ME(SolrExtractRequest, __destruct, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrExtractRequest, createFromFile, SolrExtractRequest_createFromFile_args, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(SolrExtractRequest, createFromStream, SolrExtractRequest_createFromStream_args, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(SolrExtractRequest, __clone, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrExtractRequest, __sleep, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrExtractRequest, __wakeup, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* {{{ solr_query_methods. */ static zend_function_entry solr_query_methods[] = { SOLR_CTOR(SolrQuery, __construct, SolrQuery_constructor_args) SOLR_DTOR(SolrQuery, __destruct, Solr_no_args) /* CommonQueryParameters */ PHP_ME(SolrQuery, setQuery, SolrQuery_setQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getQuery, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setStart, SolrQuery_setStart_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getStart, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setRows, SolrQuery_setRows_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getRows, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addField, SolrQuery_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeField, SolrQuery_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addSortField, SolrQuery_addSortField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeSortField, SolrQuery_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getSortFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addFilterQuery, SolrQuery_addFilterQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeFilterQuery, SolrQuery_addFilterQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFilterQueries, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setShowDebugInfo, SolrQuery_setShowDebugInfo_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setExplainOther, SolrQuery_setExplainOther_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTimeAllowed, SolrQuery_setTimeAllowed_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTimeAllowed, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setOmitHeader, SolrQuery_setOmitHeader_args, ZEND_ACC_PUBLIC) /* CoreQueryParameters */ PHP_ME(SolrQuery, setEchoHandler, SolrQuery_setEchoHandler_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setEchoParams, SolrQuery_setEchoParams_args, ZEND_ACC_PUBLIC) /* SimpleFacetParameters */ PHP_ME(SolrQuery, setFacet, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacet, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addFacetField, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeFacetField, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addFacetQuery, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeFacetQuery, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetQueries, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetPrefix, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetPrefix, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetSort, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetSort, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetLimit, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetLimit, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetOffset, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetOffset, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetMinCount, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetMinCount, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetMissing, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetMissing, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetMethod, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetMethod, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetEnumCacheMinDefaultFrequency, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) /* Date Faceting Parameters */ PHP_ME(SolrQuery, addFacetDateField, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeFacetDateField, SolrQuery_facet_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetDateFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetDateStart, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetDateStart, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetDateEnd, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetDateEnd, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetDateGap, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetDateGap, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setFacetDateHardEnd, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetDateHardEnd, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addFacetDateOther, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeFacetDateOther, SolrQuery_facet_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getFacetDateOther, SolrQuery_facet_get_1_0_args, ZEND_ACC_PUBLIC) /* SimpleGroupParameters */ PHP_ME(SolrQuery, setGroup, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroup, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addGroupField, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addGroupFunction, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupFunctions, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addGroupQuery, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupQueries, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupLimit, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupLimit, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupOffset, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupOffset, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addGroupSortField, SolrQuery_addSortField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupSortFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupFormat, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupFormat, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupMain, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupMain, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupNGroups, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupNGroups, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupTruncate, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupTruncate, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupFacet, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupFacet, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setGroupCachePercent, SolrQuery_setGroupCachePct_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getGroupCachePercent, Solr_no_args, ZEND_ACC_PUBLIC) /* Collapse Function */ PHP_ME(SolrQuery, collapse, SolrQuery_collapse_args, ZEND_ACC_PUBLIC) /* Expand Componenet */ PHP_ME(SolrQuery, setExpand, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getExpand, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addExpandSortField, SolrQuery_addSortField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeExpandSortField, SolrQuery_addField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getExpandSortFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setExpandRows, SolrQuery_group_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getExpandRows, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setExpandQuery, SolrQuery_setQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getExpandQuery, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addExpandFilterQuery, SolrQuery_addFilterQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeExpandFilterQuery, SolrQuery_addFilterQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getExpandFilterQueries, Solr_no_args, ZEND_ACC_PUBLIC) /* HighlightingParameters */ PHP_ME(SolrQuery, setHighlight, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlight, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addHighlightField, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeHighlightField, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightSnippets, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightSnippets, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightFragsize, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightFragsize, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightMergeContiguous, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightMergeContiguous, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightRequireFieldMatch, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightRequireFieldMatch, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightMaxAnalyzedChars, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightMaxAnalyzedChars, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightAlternateField, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightAlternateField, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightMaxAlternateFieldLength, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightMaxAlternateFieldLength, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightFormatter, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightFormatter, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightSimplePre, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightSimplePre, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightSimplePost, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightSimplePost, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightFragmenter, SolrQuery_hl_2_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightFragmenter, SolrQuery_hl_get_1_0_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightUsePhraseHighlighter, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightUsePhraseHighlighter, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightHighlightMultiTerm, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightHighlightMultiTerm, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightRegexSlop, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightRegexSlop, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightRegexPattern, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightRegexPattern, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setHighlightRegexMaxAnalyzedChars, SolrQuery_hl_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getHighlightRegexMaxAnalyzedChars, Solr_no_args, ZEND_ACC_PUBLIC) /* StatsComponent */ PHP_ME(SolrQuery, setStats, SolrQuery_stats_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getStats, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addStatsField, SolrQuery_stats_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeStatsField, SolrQuery_stats_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getStatsFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addStatsFacet, SolrQuery_stats_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeStatsFacet, SolrQuery_stats_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getStatsFacets, Solr_no_args, ZEND_ACC_PUBLIC) /* MoreLikeThis */ PHP_ME(SolrQuery, setMlt, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMlt, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltCount, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addMltField, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeMltField, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, addMltQueryField, SolrQuery_mlt_2_2_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, removeMltQueryField, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltQueryFields, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltMinTermFrequency, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltMinTermFrequency, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltMinDocFrequency, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltMinDocFrequency, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltMinWordLength, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltMinWordLength, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltMaxWordLength, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltMaxWordLength, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltMaxNumTokens, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltMaxNumTokens, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltMaxNumQueryTerms, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltMaxNumQueryTerms, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setMltBoost, SolrQuery_mlt_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getMltBoost, Solr_no_args, ZEND_ACC_PUBLIC) /* TermsComponent */ PHP_ME(SolrQuery, setTerms, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTerms, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsField, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsField, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsLowerBound, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsLowerBound, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsUpperBound, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsUpperBound, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsIncludeLowerBound, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsIncludeLowerBound, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsIncludeUpperBound, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsIncludeUpperBound, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsMinCount, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsMinCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsMaxCount, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsMaxCount, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsPrefix, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsPrefix, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsLimit, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsLimit, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsReturnRaw, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsReturnRaw, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, setTermsSort, SolrQuery_terms_1_1_args, ZEND_ACC_PUBLIC) PHP_ME(SolrQuery, getTermsSort, Solr_no_args, ZEND_ACC_PUBLIC) /* TODO : TermVectorComponent */ PHP_FE_END }; /* }}} */ /* {{{ solr_response_methods. */ static zend_function_entry solr_response_methods[] = { PHP_ME(SolrResponse, getHttpStatus, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getHttpStatusMessage, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, success, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getRequestUrl, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getRawRequestHeaders, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getRawRequest, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getRawResponseHeaders, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getRawResponse, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getDigestedResponse, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, setParseMode, SolrResponse_setParseMode_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getResponse, Solr_no_args, ZEND_ACC_PUBLIC) PHP_ME(SolrResponse, getArrayResponse, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_query_response_methods. */ static zend_function_entry solr_query_response_methods[] = { SOLR_CTOR(SolrQueryResponse, __construct, Solr_no_args) SOLR_DTOR(SolrQueryResponse, __destruct, Solr_no_args) PHP_FE_END }; /* }}} */ /* {{{ solr_update_response_methods. */ static zend_function_entry solr_update_response_methods[] = { SOLR_CTOR(SolrUpdateResponse, __construct, Solr_no_args) SOLR_DTOR(SolrUpdateResponse, __destruct, Solr_no_args) PHP_FE_END }; /* }}} */ /* {{{ solr_ping_response_methods. */ static zend_function_entry solr_ping_response_methods[] = { SOLR_CTOR(SolrPingResponse, __construct, Solr_no_args) SOLR_DTOR(SolrPingResponse, __destruct, Solr_no_args) PHP_ME(SolrPingResponse, getResponse, Solr_no_args, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ /* {{{ solr_generic_response_methods. */ static zend_function_entry solr_generic_response_methods[] = { SOLR_CTOR(SolrGenericResponse, __construct, Solr_no_args) SOLR_DTOR(SolrGenericResponse, __destruct, Solr_no_args) PHP_FE_END }; /* }}} */ /* {{{ solr_utils_methods. */ static zend_function_entry solr_utils_methods[] = { PHP_ME(SolrUtils, escapeQueryChars, SolrUtils_escapeQueryChars_arg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(SolrUtils, queryPhrase, SolrUtils_escapeQueryChars_arg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(SolrUtils, digestXmlResponse, SolrUtils_digestXML_arg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(SolrUtils, digestJsonResponse, SolrUtils_digestJson_arg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(SolrUtils, getSolrVersion, Solr_no_args, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(SolrUtils, getSolrStats, Solr_no_args, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_FE_END }; /* }}} */ /* {{{ solr_module_deps */ static zend_module_dep solr_module_deps[] = { ZEND_MOD_REQUIRED(PHP_LIBXML_EXTENSION_NAME) ZEND_MOD_REQUIRED(PHP_JSON_EXTENSION_NAME) ZEND_MOD_END }; /* }}} */ /* {{{ solr_module_entry */ zend_module_entry solr_module_entry = { STANDARD_MODULE_HEADER_EX, NULL, solr_module_deps, PHP_SOLR_EXTENSION_NAME, solr_functions, PHP_MINIT(solr), PHP_MSHUTDOWN(solr), PHP_RINIT(solr), PHP_RSHUTDOWN(solr), PHP_MINFO(solr), PHP_SOLR_DOTTED_VERSION, /* The current extension version number. */ STANDARD_MODULE_PROPERTIES }; /* }}} */ #ifdef COMPILE_DL_SOLR ZEND_GET_MODULE(solr) #endif /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(solr) { #ifdef ZTS /* As of ZE 2.2.0, this has to be NULL. */ /* It causes a segmentation fault, if it points to an actual function */ /* Probably a bug in the Zend Engine API */ ts_allocate_dtor php_solr_globals_dtor = NULL; #endif zend_class_entry ce; memcpy(&solr_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); memcpy(&solr_document_field_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); memcpy(&solr_input_document_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); memcpy(&solr_client_object_handlers, &solr_input_document_object_handlers, sizeof(zend_object_handlers)); memcpy(&solr_collapse_function_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); memcpy(&solr_extract_request_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); solr_extract_request_object_handlers.offset = XtOffsetOf(solr_ustream_t, std); solr_collapse_function_object_handlers.clone_obj = solr_collapse_function_object_handler_clone; solr_input_document_object_handlers.clone_obj = solr_document_object_handler_clone; /* solr_object_handlers.read_property = solr_object_read_property; */ solr_object_handlers.write_property = solr_object_write_property; solr_object_handlers.write_dimension = solr_object_write_dimension; solr_object_handlers.unset_property = solr_object_unset_property; solr_object_handlers.unset_dimension = solr_object_unset_dimension; solr_document_field_handlers.write_property = solr_document_field_write_property; solr_document_field_handlers.unset_property = solr_document_field_unset_property; #ifdef ZTS ZEND_INIT_MODULE_GLOBALS(solr, php_solr_globals_ctor, php_solr_globals_dtor); #else php_solr_globals_ctor(&solr_globals); #endif /* Register extension constants */ solr_extension_register_constants(type, module_number); /* Register the SolrObject class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_OBJECT_CLASSNAME, solr_object_methods); solr_ce_SolrObject = zend_register_internal_class(&ce); solr_ce_SolrObject->ce_flags |= ZEND_ACC_FINAL; /* SolrObject implements ArrayAccess */ zend_class_implements(solr_ce_SolrObject, 1, solr_ce_ArrayAccess); /* Register the SolrDocument class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_DOCUMENT_CLASSNAME, solr_document_methods); solr_ce_SolrDocument = zend_register_internal_class(&ce); solr_ce_SolrDocument->ce_flags |= ZEND_ACC_FINAL; /* This internal property will be used to map to this SolrDocument instance */ zend_declare_property_long(solr_ce_SolrDocument, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) -1, 0L, ZEND_ACC_PRIVATE); /* Register SolrDocument class constants */ solr_document_register_class_constants(solr_ce_SolrDocument); /* SolrDocument implements ArrayAccess, Iterator, Serializable */ zend_class_implements(solr_ce_SolrDocument, 3, solr_ce_ArrayAccess, solr_ce_Iterator, solr_ce_Serializable); /* Register the SolrDocumentField class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_DOCUMENT_FIELD_CLASSNAME, solr_document_field_methods); solr_ce_SolrDocumentField = zend_register_internal_class(&ce); solr_ce_SolrDocumentField->ce_flags |= ZEND_ACC_FINAL; /* Register the name, boost and values properties */ zend_declare_property_stringl(solr_ce_SolrDocumentField, SOLR_FIELD_NAME_PROPERTY_NAME, sizeof(SOLR_FIELD_NAME_PROPERTY_NAME)-1, SOLR_SPACE_STRING, sizeof(SOLR_SPACE_STRING)-1, ZEND_ACC_PUBLIC); zend_declare_property_double(solr_ce_SolrDocumentField, SOLR_FIELD_BOOST_PROPERTY_NAME, sizeof(SOLR_FIELD_BOOST_PROPERTY_NAME)-1, 0.0f, ZEND_ACC_PUBLIC); zend_declare_property_null(solr_ce_SolrDocumentField, SOLR_FIELD_VALUES_PROPERTY_NAME, sizeof(SOLR_FIELD_VALUES_PROPERTY_NAME)-1, ZEND_ACC_PUBLIC); /* Register the SolrInputDocument class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_INPUT_DOCUMENT_CLASSNAME, solr_input_document_methods); solr_ce_SolrInputDocument = zend_register_internal_class(&ce); solr_ce_SolrInputDocument->ce_flags |= ZEND_ACC_FINAL; /* This internal property will be used to map to this SolrDocument instance */ zend_declare_property_long(solr_ce_SolrInputDocument, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) -1, 0L, ZEND_ACC_PRIVATE); /* Register SolrInputDocument class constants */ solr_input_document_register_class_constants(solr_ce_SolrInputDocument); /* Register SolrClient Class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_CLIENT_CLASSNAME, solr_client_methods); solr_ce_SolrClient = zend_register_internal_class(&ce); /* solr_ce_SolrClient->ce_flags |= ZEND_ACC_FINAL; */ /* This internal property will be used to map to this SolrClient instance */ zend_declare_property_long(solr_ce_SolrClient, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) -1, 0L, ZEND_ACC_PRIVATE); /* Register SolrClient class constants */ solr_client_register_class_constants(solr_ce_SolrClient); /* Register the SolrParams class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_PARAMS_CLASSNAME, solr_params_methods); solr_ce_SolrParams = zend_register_internal_class(&ce); solr_ce_SolrParams->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; zend_class_implements(solr_ce_SolrParams, 1, solr_ce_Serializable); /* This internal property will be used to map to this SolrParams instance */ zend_declare_property_long(solr_ce_SolrParams, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) -1, 0L, ZEND_ACC_PROTECTED); /* Register the SolrModifiableParams class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_MODIFIABLE_PARAMS_CLASSNAME, solr_modifiable_params_methods); solr_ce_SolrModifiableParams = zend_register_internal_class_ex(&ce, solr_ce_SolrParams); /* Register the SolrQuery class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_QUERY_CLASSNAME, solr_query_methods); solr_ce_SolrQuery = zend_register_internal_class_ex(&ce, solr_ce_SolrModifiableParams); init_solr_dismax_query(); solr_query_register_class_constants(solr_ce_SolrQuery); /* Register SolrExtractRequest */ INIT_CLASS_ENTRY(ce, PHP_SOLR_EXTRACTREQUEST_CLASSNAME, solr_extract_request_methods); solr_ce_SolrExtractRequest = zend_register_internal_class(&ce); solr_ce_SolrExtractRequest->ce_flags |= ZEND_ACC_FINAL; solr_ce_SolrExtractRequest->create_object = solr_extract_create_object_handler; zend_declare_property_long(solr_ce_SolrExtractRequest, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME)-1, 0L, ZEND_ACC_PRIVATE); solr_extract_register_class_constants(solr_ce_SolrExtractRequest); /* Register the SolrCollapseFunction class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_COLLAPSE_FUNCTION_CLASSNAME, solr_collapse_function_methods); solr_ce_SolrCollapseFunction = zend_register_internal_class_ex(&ce, solr_ce_SolrCollapseFunction); zend_declare_property_long(solr_ce_SolrCollapseFunction, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME)-1, 0l, ZEND_ACC_PROTECTED); solr_collapse_function_register_class_constants(solr_ce_SolrCollapseFunction); /* Register the SolrResponse base class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_RESPONSE_CLASSNAME, solr_response_methods); solr_ce_SolrResponse = zend_register_internal_class(&ce); solr_ce_SolrResponse->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; /* Register all the properties for the SolrResponse object */ solr_response_register_class_properties(solr_ce_SolrResponse); /* Register all the constants for the SolrResponse object */ solr_response_register_class_constants(solr_ce_SolrResponse); /* Register the SolrQueryResponse class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_QUERY_RESPONSE_CLASSNAME, solr_query_response_methods); solr_ce_SolrQueryResponse = zend_register_internal_class_ex(&ce, solr_ce_SolrResponse); solr_ce_SolrQueryResponse->ce_flags |= ZEND_ACC_FINAL; /* Register the SolrUpdateResponse class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_UPDATE_RESPONSE_CLASSNAME, solr_update_response_methods); solr_ce_SolrUpdateResponse = zend_register_internal_class_ex(&ce, solr_ce_SolrResponse); solr_ce_SolrUpdateResponse->ce_flags |= ZEND_ACC_FINAL; /* Register the SolrPingResponse class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_PING_RESPONSE_CLASSNAME, solr_ping_response_methods); solr_ce_SolrPingResponse = zend_register_internal_class_ex(&ce, solr_ce_SolrResponse); solr_ce_SolrPingResponse->ce_flags |= ZEND_ACC_FINAL; /* Register the SolrGenericResponse class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_GENERIC_RESPONSE_CLASSNAME, solr_generic_response_methods); solr_ce_SolrGenericResponse = zend_register_internal_class_ex(&ce, solr_ce_SolrResponse); solr_ce_SolrGenericResponse->ce_flags |= ZEND_ACC_FINAL; /* Register the SolrUtils class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_UTILS_CLASSNAME, solr_utils_methods); solr_ce_SolrUtils = zend_register_internal_class(&ce); solr_ce_SolrUtils->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; /* Register the SolrException class */ INIT_CLASS_ENTRY(ce, PHP_SOLR_EXCEPTION_CLASSNAME, solr_exception_methods); solr_ce_SolrException = zend_register_internal_class_ex(&ce, solr_ce_Exception); solr_exception_register_class_properties(solr_ce_SolrException); INIT_CLASS_ENTRY(ce, PHP_SOLR_ILLEGAL_OPERATION_EXCEPTION_CLASSNAME, solr_illegal_operation_exception_methods); solr_ce_SolrIllegalOperationException = zend_register_internal_class_ex(&ce, solr_ce_SolrException); INIT_CLASS_ENTRY(ce, PHP_SOLR_ILLEGAL_ARGUMENT_EXCEPTION_CLASSNAME, solr_illegal_argument_exception_methods); solr_ce_SolrIllegalArgumentException = zend_register_internal_class_ex(&ce, solr_ce_SolrException); INIT_CLASS_ENTRY(ce, PHP_SOLR_CLIENT_EXCEPTION_CLASSNAME, solr_client_exception_methods); solr_ce_SolrClientException = zend_register_internal_class_ex(&ce, solr_ce_SolrException); INIT_CLASS_ENTRY(ce, PHP_SOLR_SERVER_EXCEPTION_CLASSNAME, solr_server_exception_methods); solr_ce_SolrServerException = zend_register_internal_class_ex(&ce, solr_ce_SolrException); INIT_CLASS_ENTRY(ce, PHP_SOLR_MISSING_MANDATORY_PARAMETER_EXCEPTION_CLASSNAME, NULL); solr_ce_SolrMissingMandatoryParameterException = zend_register_internal_class_ex(&ce, solr_ce_SolrException); return SUCCESS; } /* }}} */ /* {{{ PHP_RINIT_FUNCTION */ PHP_RINIT_FUNCTION(solr) { zend_bool persistent = SOLR_HASHTABLE_PERSISTENT; /* Initial size of the HashTable */ uint32_t nSize = SOLR_INITIAL_HASH_TABLE_SIZE; ALLOC_HASHTABLE(SOLR_GLOBAL(documents)); ALLOC_HASHTABLE(SOLR_GLOBAL(clients)); ALLOC_HASHTABLE(SOLR_GLOBAL(params)); ALLOC_HASHTABLE(SOLR_GLOBAL(functions)); ALLOC_HASHTABLE(SOLR_GLOBAL(ustreams)); /* Initialize the HashTable for directory for SolrInputDocuments */ zend_hash_init(SOLR_GLOBAL(documents), nSize, NULL, solr_destroy_document, persistent); zend_hash_init(SOLR_GLOBAL(clients), nSize, NULL, solr_destroy_client, persistent); /* Initialize the HashTable for directory of SolrParams */ zend_hash_init(SOLR_GLOBAL(params), nSize, NULL, solr_destroy_params, persistent); zend_hash_init(SOLR_GLOBAL(functions), nSize, NULL, solr_destroy_function, persistent); zend_hash_init(SOLR_GLOBAL(ustreams), nSize, NULL, solr_destroy_ustream, persistent); return SUCCESS; } /* }}} */ /* {{{ PHP_RSHUTDOWN_FUNCTION */ PHP_RSHUTDOWN_FUNCTION(solr) { zend_hash_destroy(SOLR_GLOBAL(documents)); zend_hash_destroy(SOLR_GLOBAL(clients)); zend_hash_destroy(SOLR_GLOBAL(params)); zend_hash_destroy(SOLR_GLOBAL(functions)); zend_hash_destroy(SOLR_GLOBAL(ustreams)); FREE_HASHTABLE(SOLR_GLOBAL(documents)); FREE_HASHTABLE(SOLR_GLOBAL(clients)); FREE_HASHTABLE(SOLR_GLOBAL(params)); FREE_HASHTABLE(SOLR_GLOBAL(functions)); FREE_HASHTABLE(SOLR_GLOBAL(ustreams)); return SUCCESS; } /* }}} */ /* {{{ PHP_MSHUTDOWN_FUNCTION */ PHP_MSHUTDOWN_FUNCTION(solr) { return SUCCESS; } /* }}} */ /* {{{ PHP_MINFO_FUNCTION */ PHP_MINFO_FUNCTION(solr) { php_info_print_table_start(); php_info_print_table_header(2, "Solr Support", "enabled"); php_info_print_table_row(2, "Version", PHP_SOLR_DOTTED_VERSION); php_info_print_table_row(2, "Last Build Date", __DATE__); php_info_print_table_row(2, "Last Build Time", __TIME__); php_info_print_table_end(); } /* }}} */ #endif /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/php_solr.h000066400000000000000000001145331374041537100210200ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #ifndef SOLRCLIENT_H #define SOLRCLIENT_H /* #define SOLR_MEM_DEBUG 1 */ #include
#ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_SOLR #include #include #include
#include
#include
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern zend_module_entry solr_module_entry; #define phpext_solr_ptr &solr_module_entry /* {{{ Startup, Shutdown, Activation, Deactivation and Info functions */ PHP_MINIT_FUNCTION(solr); /* Module Startup Function */ PHP_MSHUTDOWN_FUNCTION(solr); /* Module Shutdown Function */ PHP_RINIT_FUNCTION(solr); /* Request Activation Function */ PHP_RSHUTDOWN_FUNCTION(solr); /* Request Deactivation Function */ PHP_MINFO_FUNCTION(solr); /* Module Information Display Function */ /* }}} */ #ifdef ZTS #include #endif /* List of constants */ #include "solr_constants.h" /* List of types */ #include "solr_types.h" #ifdef ZTS # define SOLR_GLOBAL(v) TSRMG(solr_globals_id, zend_solr_globals *, v) #else # define SOLR_GLOBAL(v) (solr_globals.v) #endif #include #include "php_solr_api.h" /* {{{ Variables declared elsewhere */ ZEND_EXTERN_MODULE_GLOBALS(solr) /* ZEND_EXTERN_MODULE_GLOBALS(json) */ extern zend_class_entry *solr_ce_SolrObject; extern zend_class_entry *solr_ce_SolrInputDocument; extern zend_class_entry *solr_ce_SolrDocument; extern zend_class_entry *solr_ce_SolrDocumentField; extern zend_class_entry *solr_ce_SolrClient; extern zend_class_entry *solr_ce_SolrParams; extern zend_class_entry *solr_ce_SolrModifiableParams; extern zend_class_entry *solr_ce_SolrCollapseFunction; extern zend_class_entry *solr_ce_SolrQuery; extern zend_class_entry *solr_ce_SolrResponse; extern zend_class_entry *solr_ce_SolrQueryResponse; extern zend_class_entry *solr_ce_SolrUpdateResponse; extern zend_class_entry *solr_ce_SolrPingResponse; extern zend_class_entry *solr_ce_SolrGenericResponse; extern zend_class_entry *solr_ce_SolrUtils; extern zend_class_entry *solr_ce_SolrException; extern zend_class_entry *solr_ce_SolrIllegalOperationException; extern zend_class_entry *solr_ce_SolrIllegalArgumentException; extern zend_class_entry *solr_ce_SolrClientException; extern zend_class_entry *solr_ce_SolrServerException; extern zend_class_entry *solr_ce_SolrMissingMandatoryParameterException; extern ZEND_API zend_class_entry *zend_ce_serializable; extern ZEND_API zend_class_entry *zend_ce_arrayaccess; extern ZEND_API zend_class_entry *zend_ce_iterator; /* {{{ Aliases for external class entries */ #define solr_ce_Serializable zend_ce_serializable #define solr_ce_ArrayAccess zend_ce_arrayaccess #define solr_ce_Iterator zend_ce_iterator #define solr_ce_Exception zend_exception_get_default() /* }}} */ extern zend_object_handlers solr_object_handlers; extern zend_object_handlers solr_document_field_handlers; extern zend_object_handlers solr_input_document_object_handlers; extern zend_object_handlers solr_client_object_handlers; extern zend_object_handlers solr_response_object_handlers; extern zend_object_handlers solr_collapse_function_object_handlers; /* }}} */ /******************************************************************************/ /** DECLARATIONS FOR EXTENSION METHODS AND FUNCTIONS **/ /******************************************************************************/ /* {{{ Extension functions */ PHP_FUNCTION(solr_get_version); /* }}} */ /* {{{ SolrObject methods */ PHP_METHOD(SolrObject, __construct); PHP_METHOD(SolrObject, __destruct); PHP_METHOD(SolrObject, __set); PHP_METHOD(SolrObject, __get); PHP_METHOD(SolrObject, __isset); PHP_METHOD(SolrObject, __unset); PHP_METHOD(SolrObject, offsetSet); PHP_METHOD(SolrObject, offsetGet); PHP_METHOD(SolrObject, offsetExists); PHP_METHOD(SolrObject, offsetUnset); PHP_METHOD(SolrObject, getPropertyNames); /* }}} */ /* {{{ SolException object methods */ PHP_METHOD(SolrException, getInternalInfo); PHP_METHOD(SolrClientException, getInternalInfo); PHP_METHOD(SolrIllegalOperationException, getInternalInfo); PHP_METHOD(SolrIllegalArgumentException, getInternalInfo); PHP_METHOD(SolrServerException, getInternalInfo); /* }}} */ /* {{{ SolrDocument methods declarations */ PHP_METHOD(SolrDocument, __construct); PHP_METHOD(SolrDocument, __destruct); PHP_METHOD(SolrDocument, __clone); PHP_METHOD(SolrDocument, __get); PHP_METHOD(SolrDocument, __set); PHP_METHOD(SolrDocument, __isset); PHP_METHOD(SolrDocument, __unset); /* Methods from Serializable */ PHP_METHOD(SolrDocument, serialize); PHP_METHOD(SolrDocument, unserialize); /* Methods from ArrayAccess */ PHP_METHOD(SolrDocument, offsetExists); PHP_METHOD(SolrDocument, offsetGet); PHP_METHOD(SolrDocument, offsetSet); PHP_METHOD(SolrDocument, offsetUnset); /* Methods from Iterator */ PHP_METHOD(SolrDocument, current); PHP_METHOD(SolrDocument, key); PHP_METHOD(SolrDocument, next); PHP_METHOD(SolrDocument, rewind); PHP_METHOD(SolrDocument, valid); PHP_METHOD(SolrDocument, clear); PHP_METHOD(SolrDocument, addField); PHP_METHOD(SolrDocument, getFieldNames); PHP_METHOD(SolrDocument, getFieldCount); PHP_METHOD(SolrDocument, getField); PHP_METHOD(SolrDocument, toArray); PHP_METHOD(SolrDocument, fieldExists); PHP_METHOD(SolrDocument, deleteField); PHP_METHOD(SolrDocument, sort); PHP_METHOD(SolrDocument, merge); PHP_METHOD(SolrDocument, getInputDocument); PHP_METHOD(SolrDocument, hasChildDocuments); PHP_METHOD(SolrDocument, getChildDocuments); PHP_METHOD(SolrDocument, getChildDocumentsCount); /* }}} */ /* {{{ SolrExtractRequest methods */ PHP_METHOD(SolrExtractRequest, __construct); PHP_METHOD(SolrExtractRequest, createFromFile); PHP_METHOD(SolrExtractRequest, createFromStream); PHP_METHOD(SolrExtractRequest, __destruct); PHP_METHOD(SolrExtractRequest, __clone); PHP_METHOD(SolrExtractRequest, __sleep); PHP_METHOD(SolrExtractRequest, __wakeup); /* }}} */ /* {{{ SolrDocumentField methods */ PHP_METHOD(SolrDocumentField, __construct); PHP_METHOD(SolrDocumentField, __destruct); /* }}} */ /* {{{ SolrInputDocument methods declarations */ PHP_METHOD(SolrInputDocument, __construct); PHP_METHOD(SolrInputDocument, __destruct); PHP_METHOD(SolrInputDocument, __clone); PHP_METHOD(SolrInputDocument, __sleep); PHP_METHOD(SolrInputDocument, __wakeup); PHP_METHOD(SolrInputDocument, setBoost); PHP_METHOD(SolrInputDocument, getBoost); PHP_METHOD(SolrInputDocument, clear); PHP_METHOD(SolrInputDocument, addField); PHP_METHOD(SolrInputDocument, updateField); PHP_METHOD(SolrInputDocument, setFieldBoost); PHP_METHOD(SolrInputDocument, getFieldBoost); PHP_METHOD(SolrInputDocument, getFieldNames); PHP_METHOD(SolrInputDocument, getFieldCount); PHP_METHOD(SolrInputDocument, getField); PHP_METHOD(SolrInputDocument, toArray); PHP_METHOD(SolrInputDocument, fieldExists); PHP_METHOD(SolrInputDocument, deleteField); PHP_METHOD(SolrInputDocument, sort); PHP_METHOD(SolrInputDocument, merge); PHP_METHOD(SolrInputDocument, addChildDocument); PHP_METHOD(SolrInputDocument, getChildDocuments); PHP_METHOD(SolrInputDocument, hasChildDocuments); PHP_METHOD(SolrInputDocument, getChildDocumentsCount); PHP_METHOD(SolrInputDocument, addChildDocuments); PHP_METHOD(SolrInputDocument, setVersion); PHP_METHOD(SolrInputDocument, getVersion); /* }}} */ /* {{{ SolrClient methods declarations */ PHP_METHOD(SolrClient, __construct); PHP_METHOD(SolrClient, __destruct); PHP_METHOD(SolrClient, __sleep); PHP_METHOD(SolrClient, __wakeup); PHP_METHOD(SolrClient, __clone); PHP_METHOD(SolrClient, query); PHP_METHOD(SolrClient, getOptions); PHP_METHOD(SolrClient, getDebug); PHP_METHOD(SolrClient, addDocument); PHP_METHOD(SolrClient, addDocuments); PHP_METHOD(SolrClient, setServlet); PHP_METHOD(SolrClient, setResponseWriter); PHP_METHOD(SolrClient, request); PHP_METHOD(SolrClient, sendUpdateStream); PHP_METHOD(SolrClient, ping); PHP_METHOD(SolrClient, system); PHP_METHOD(SolrClient, threads); PHP_METHOD(SolrClient, deleteById); PHP_METHOD(SolrClient, deleteByIds); PHP_METHOD(SolrClient, deleteByQuery); PHP_METHOD(SolrClient, deleteByQueries); PHP_METHOD(SolrClient, getById); PHP_METHOD(SolrClient, getByIds); PHP_METHOD(SolrClient, optimize); PHP_METHOD(SolrClient, commit); PHP_METHOD(SolrClient, rollback); /* }}} */ /* {{{ SolrParams methods declarations */ PHP_METHOD(SolrParams, setParam); /* Parameter can only accept one value */ PHP_METHOD(SolrParams, addParam); /* Parameter can accept more than one value */ PHP_METHOD(SolrParams, getParams); /* Retrieves the parameters and their values */ PHP_METHOD(SolrParams, getParam); /* Retrieves a parameter value */ PHP_METHOD(SolrParams, __toString); /* Returns a string representation of the object */ PHP_METHOD(SolrParams, toString); /* Returns a string representation of the object */ PHP_METHOD(SolrParams, getPreparedParams); /* Returns the prepared parameters */ PHP_METHOD(SolrParams, serialize); /* used by serialize() */ PHP_METHOD(SolrParams, unserialize); /* used by unserialize() */ PHP_METHOD(SolrParams, __clone); /* Used to enforce the cloning of SolrParams is currently unsupported */ /* }}} */ /* {{{ SolrModifiableParams methods declarations */ PHP_METHOD(SolrModifiableParams, __construct); PHP_METHOD(SolrModifiableParams, __destruct); /* }}} */ /* {{{ SolrQuery methods declarations */ /* Constructor and Destructor */ PHP_METHOD(SolrQuery, __construct); PHP_METHOD(SolrQuery, __destruct); /* CommonQueryParameters */ PHP_METHOD(SolrQuery, setQuery); PHP_METHOD(SolrQuery, getQuery); PHP_METHOD(SolrQuery, setStart); PHP_METHOD(SolrQuery, getStart); PHP_METHOD(SolrQuery, setRows); PHP_METHOD(SolrQuery, getRows); PHP_METHOD(SolrQuery, addField); PHP_METHOD(SolrQuery, removeField); PHP_METHOD(SolrQuery, getFields); PHP_METHOD(SolrQuery, addSortField); PHP_METHOD(SolrQuery, removeSortField); PHP_METHOD(SolrQuery, getSortFields); PHP_METHOD(SolrQuery, addFilterQuery); PHP_METHOD(SolrQuery, removeFilterQuery); PHP_METHOD(SolrQuery, getFilterQueries); PHP_METHOD(SolrQuery, setShowDebugInfo); PHP_METHOD(SolrQuery, setExplainOther); PHP_METHOD(SolrQuery, setTimeAllowed); PHP_METHOD(SolrQuery, getTimeAllowed); PHP_METHOD(SolrQuery, setOmitHeader); /* CoreQueryParameters */ PHP_METHOD(SolrQuery, setEchoHandler); PHP_METHOD(SolrQuery, setEchoParams); /* SimpleFacetParameters */ PHP_METHOD(SolrQuery, setFacet); PHP_METHOD(SolrQuery, getFacet); PHP_METHOD(SolrQuery, addFacetField); PHP_METHOD(SolrQuery, removeFacetField); PHP_METHOD(SolrQuery, getFacetFields); PHP_METHOD(SolrQuery, addFacetQuery); PHP_METHOD(SolrQuery, removeFacetQuery); PHP_METHOD(SolrQuery, getFacetQueries); PHP_METHOD(SolrQuery, setFacetPrefix); PHP_METHOD(SolrQuery, getFacetPrefix); PHP_METHOD(SolrQuery, setFacetSort); PHP_METHOD(SolrQuery, getFacetSort); PHP_METHOD(SolrQuery, setFacetLimit); PHP_METHOD(SolrQuery, getFacetLimit); PHP_METHOD(SolrQuery, setFacetOffset); PHP_METHOD(SolrQuery, getFacetOffset); PHP_METHOD(SolrQuery, setFacetMinCount); PHP_METHOD(SolrQuery, getFacetMinCount); PHP_METHOD(SolrQuery, setFacetMissing); PHP_METHOD(SolrQuery, getFacetMissing); PHP_METHOD(SolrQuery, setFacetMethod); PHP_METHOD(SolrQuery, getFacetMethod); PHP_METHOD(SolrQuery, setFacetEnumCacheMinDefaultFrequency); /* Date facet parameters */ PHP_METHOD(SolrQuery, addFacetDateField); PHP_METHOD(SolrQuery, removeFacetDateField); PHP_METHOD(SolrQuery, getFacetDateFields); PHP_METHOD(SolrQuery, setFacetDateStart); PHP_METHOD(SolrQuery, getFacetDateStart); PHP_METHOD(SolrQuery, setFacetDateEnd); PHP_METHOD(SolrQuery, getFacetDateEnd); PHP_METHOD(SolrQuery, setFacetDateGap); PHP_METHOD(SolrQuery, getFacetDateGap); PHP_METHOD(SolrQuery, setFacetDateHardEnd); PHP_METHOD(SolrQuery, getFacetDateHardEnd); PHP_METHOD(SolrQuery, addFacetDateOther); PHP_METHOD(SolrQuery, removeFacetDateOther); PHP_METHOD(SolrQuery, getFacetDateOther); /* GroupParameters */ PHP_METHOD(SolrQuery, setGroup); PHP_METHOD(SolrQuery, getGroup); PHP_METHOD(SolrQuery, addGroupField); PHP_METHOD(SolrQuery, getGroupFields); PHP_METHOD(SolrQuery, addGroupFunction); PHP_METHOD(SolrQuery, getGroupFunctions); PHP_METHOD(SolrQuery, addGroupQuery); PHP_METHOD(SolrQuery, getGroupQueries); PHP_METHOD(SolrQuery, setGroupLimit); PHP_METHOD(SolrQuery, getGroupLimit); PHP_METHOD(SolrQuery, setGroupOffset); PHP_METHOD(SolrQuery, getGroupOffset); PHP_METHOD(SolrQuery, addGroupSortField); PHP_METHOD(SolrQuery, getGroupSortFields); PHP_METHOD(SolrQuery, setGroupFormat); PHP_METHOD(SolrQuery, getGroupFormat); PHP_METHOD(SolrQuery, setGroupMain); PHP_METHOD(SolrQuery, getGroupMain); PHP_METHOD(SolrQuery, setGroupNGroups); PHP_METHOD(SolrQuery, getGroupNGroups); PHP_METHOD(SolrQuery, setGroupTruncate); PHP_METHOD(SolrQuery, getGroupTruncate); PHP_METHOD(SolrQuery, setGroupFacet); PHP_METHOD(SolrQuery, getGroupFacet); PHP_METHOD(SolrQuery, setGroupCachePercent); PHP_METHOD(SolrQuery, getGroupCachePercent); /* Collapse */ PHP_METHOD(SolrQuery, collapse); /* Expand Parameters */ PHP_METHOD(SolrQuery, setExpand); PHP_METHOD(SolrQuery, getExpand); PHP_METHOD(SolrQuery, addExpandSortField); PHP_METHOD(SolrQuery, removeExpandSortField); PHP_METHOD(SolrQuery, getExpandSortFields); PHP_METHOD(SolrQuery, setExpandRows); PHP_METHOD(SolrQuery, getExpandRows); PHP_METHOD(SolrQuery, setExpandQuery); PHP_METHOD(SolrQuery, getExpandQuery); PHP_METHOD(SolrQuery, addExpandFilterQuery); PHP_METHOD(SolrQuery, removeExpandFilterQuery); PHP_METHOD(SolrQuery, getExpandFilterQueries); /* HighlightingParameters */ PHP_METHOD(SolrQuery, setHighlight); PHP_METHOD(SolrQuery, getHighlight); PHP_METHOD(SolrQuery, addHighlightField); PHP_METHOD(SolrQuery, removeHighlightField); PHP_METHOD(SolrQuery, getHighlightFields); PHP_METHOD(SolrQuery, setHighlightSnippets); PHP_METHOD(SolrQuery, getHighlightSnippets); PHP_METHOD(SolrQuery, setHighlightFragsize); PHP_METHOD(SolrQuery, getHighlightFragsize); PHP_METHOD(SolrQuery, setHighlightMergeContiguous); PHP_METHOD(SolrQuery, getHighlightMergeContiguous); PHP_METHOD(SolrQuery, setHighlightRequireFieldMatch); PHP_METHOD(SolrQuery, getHighlightRequireFieldMatch); PHP_METHOD(SolrQuery, setHighlightMaxAnalyzedChars); PHP_METHOD(SolrQuery, getHighlightMaxAnalyzedChars); PHP_METHOD(SolrQuery, setHighlightAlternateField); PHP_METHOD(SolrQuery, getHighlightAlternateField); PHP_METHOD(SolrQuery, setHighlightMaxAlternateFieldLength); PHP_METHOD(SolrQuery, getHighlightMaxAlternateFieldLength); PHP_METHOD(SolrQuery, setHighlightFormatter); PHP_METHOD(SolrQuery, getHighlightFormatter); PHP_METHOD(SolrQuery, setHighlightSimplePre); PHP_METHOD(SolrQuery, getHighlightSimplePre); PHP_METHOD(SolrQuery, setHighlightSimplePost); PHP_METHOD(SolrQuery, getHighlightSimplePost); PHP_METHOD(SolrQuery, setHighlightFragmenter); PHP_METHOD(SolrQuery, getHighlightFragmenter); PHP_METHOD(SolrQuery, setHighlightUsePhraseHighlighter); PHP_METHOD(SolrQuery, getHighlightUsePhraseHighlighter); PHP_METHOD(SolrQuery, setHighlightHighlightMultiTerm); PHP_METHOD(SolrQuery, getHighlightHighlightMultiTerm); PHP_METHOD(SolrQuery, setHighlightRegexSlop); PHP_METHOD(SolrQuery, getHighlightRegexSlop); PHP_METHOD(SolrQuery, setHighlightRegexPattern); PHP_METHOD(SolrQuery, getHighlightRegexPattern); PHP_METHOD(SolrQuery, setHighlightRegexMaxAnalyzedChars); PHP_METHOD(SolrQuery, getHighlightRegexMaxAnalyzedChars); /* StatsComponent */ PHP_METHOD(SolrQuery, setStats); PHP_METHOD(SolrQuery, getStats); PHP_METHOD(SolrQuery, addStatsField); PHP_METHOD(SolrQuery, removeStatsField); PHP_METHOD(SolrQuery, getStatsFields); PHP_METHOD(SolrQuery, addStatsFacet); PHP_METHOD(SolrQuery, removeStatsFacet); PHP_METHOD(SolrQuery, getStatsFacets); /* MoreLikeThis */ PHP_METHOD(SolrQuery, setMlt); PHP_METHOD(SolrQuery, getMlt); PHP_METHOD(SolrQuery, setMltCount); PHP_METHOD(SolrQuery, getMltCount); PHP_METHOD(SolrQuery, addMltField); PHP_METHOD(SolrQuery, removeMltField); PHP_METHOD(SolrQuery, getMltFields); PHP_METHOD(SolrQuery, addMltQueryField); PHP_METHOD(SolrQuery, removeMltQueryField); PHP_METHOD(SolrQuery, getMltQueryFields); PHP_METHOD(SolrQuery, setMltMinTermFrequency); PHP_METHOD(SolrQuery, getMltMinTermFrequency); PHP_METHOD(SolrQuery, setMltMinDocFrequency); PHP_METHOD(SolrQuery, getMltMinDocFrequency); PHP_METHOD(SolrQuery, setMltMinWordLength); PHP_METHOD(SolrQuery, getMltMinWordLength); PHP_METHOD(SolrQuery, setMltMaxWordLength); PHP_METHOD(SolrQuery, getMltMaxWordLength); PHP_METHOD(SolrQuery, setMltMaxNumTokens); PHP_METHOD(SolrQuery, getMltMaxNumTokens); PHP_METHOD(SolrQuery, setMltMaxNumQueryTerms); PHP_METHOD(SolrQuery, getMltMaxNumQueryTerms); PHP_METHOD(SolrQuery, setMltBoost); PHP_METHOD(SolrQuery, getMltBoost); /* TermsComponent */ PHP_METHOD(SolrQuery, setTerms); PHP_METHOD(SolrQuery, getTerms); PHP_METHOD(SolrQuery, setTermsField); PHP_METHOD(SolrQuery, getTermsField); PHP_METHOD(SolrQuery, setTermsLowerBound); PHP_METHOD(SolrQuery, getTermsLowerBound); PHP_METHOD(SolrQuery, setTermsUpperBound); PHP_METHOD(SolrQuery, getTermsUpperBound); PHP_METHOD(SolrQuery, setTermsIncludeLowerBound); PHP_METHOD(SolrQuery, getTermsIncludeLowerBound); PHP_METHOD(SolrQuery, setTermsIncludeUpperBound); PHP_METHOD(SolrQuery, getTermsIncludeUpperBound); PHP_METHOD(SolrQuery, setTermsMinCount); PHP_METHOD(SolrQuery, getTermsMinCount); PHP_METHOD(SolrQuery, setTermsMaxCount); PHP_METHOD(SolrQuery, getTermsMaxCount); PHP_METHOD(SolrQuery, setTermsPrefix); PHP_METHOD(SolrQuery, getTermsPrefix); PHP_METHOD(SolrQuery, setTermsLimit); PHP_METHOD(SolrQuery, getTermsLimit); PHP_METHOD(SolrQuery, setTermsReturnRaw); PHP_METHOD(SolrQuery, getTermsReturnRaw); PHP_METHOD(SolrQuery, setTermsSort); PHP_METHOD(SolrQuery, getTermsSort); /* TODO : TermVectorComponent */ /* {{{ TermVectorComponent methods not yet defined */ PHP_METHOD(SolrQuery, setTermVector); PHP_METHOD(SolrQuery, setTermVectorTermFrequency); PHP_METHOD(SolrQuery, setTermVectorDocFrequency); PHP_METHOD(SolrQuery, setTermVectorPositions); PHP_METHOD(SolrQuery, setTermVectorOffsets); PHP_METHOD(SolrQuery, setTermVectorTfIdfProduct); PHP_METHOD(SolrQuery, setTermVectorAll); PHP_METHOD(SolrQuery, addTermVectorField); PHP_METHOD(SolrQuery, addTermVectorLuceneDocId); /* }}} */ /* }}} */ /* {{{ SolrResponse methods declarations */ PHP_METHOD(SolrResponse, getHttpStatus); PHP_METHOD(SolrResponse, getHttpStatusMessage); PHP_METHOD(SolrResponse, success); PHP_METHOD(SolrResponse, getRequestUrl); PHP_METHOD(SolrResponse, getRawRequestHeaders); PHP_METHOD(SolrResponse, getRawRequest); PHP_METHOD(SolrResponse, getRawResponseHeaders); PHP_METHOD(SolrResponse, getRawResponse); PHP_METHOD(SolrResponse, getDigestedResponse); PHP_METHOD(SolrResponse, setParseMode); PHP_METHOD(SolrResponse, getArrayResponse); PHP_METHOD(SolrResponse, getResponse); /* }}} */ /* {{{ SolrQueryResponse methods */ PHP_METHOD(SolrQueryResponse, __construct); PHP_METHOD(SolrQueryResponse, __destruct); /* }}} */ /* {{{ SolrUpdateResponse methods */ PHP_METHOD(SolrUpdateResponse, __construct); PHP_METHOD(SolrUpdateResponse, __destruct); /* }}} */ /* {{{ SolrPingResponse methods declarations */ PHP_METHOD(SolrPingResponse, __construct); PHP_METHOD(SolrPingResponse, __destruct); PHP_METHOD(SolrPingResponse, getResponse); /* }}} */ /* {{{ SolrGenericResponse methods */ PHP_METHOD(SolrGenericResponse, __construct); PHP_METHOD(SolrGenericResponse, __destruct); /* }}} */ /* {{{ SolrCollapseFunction methods */ PHP_METHOD(SolrCollapseFunction, __construct); PHP_METHOD(SolrCollapseFunction, __destruct); PHP_METHOD(SolrCollapseFunction, setField); PHP_METHOD(SolrCollapseFunction, getField); PHP_METHOD(SolrCollapseFunction, setMin); PHP_METHOD(SolrCollapseFunction, getMin); PHP_METHOD(SolrCollapseFunction, setMax); PHP_METHOD(SolrCollapseFunction, getMax); PHP_METHOD(SolrCollapseFunction, setNullPolicy); PHP_METHOD(SolrCollapseFunction, getNullPolicy); PHP_METHOD(SolrCollapseFunction, setHint); PHP_METHOD(SolrCollapseFunction, getHint); PHP_METHOD(SolrCollapseFunction, setSize); PHP_METHOD(SolrCollapseFunction, getSize); PHP_METHOD(SolrCollapseFunction, __toString); PHP_METHOD(SolrCollapseFunction, __sleep); PHP_METHOD(SolrCollapseFunction, __wakeup); /* }}} */ /* {{{ SolrUtils methods declarations */ PHP_METHOD(SolrUtils, escapeQueryChars); PHP_METHOD(SolrUtils, queryPhrase); PHP_METHOD(SolrUtils, digestXmlResponse); PHP_METHOD(SolrUtils, digestJsonResponse); PHP_METHOD(SolrUtils, getSolrVersion); PHP_METHOD(SolrUtils, getSolrStats); /* }}} */ /******************************************************************************/ /** DECLARATIONS FOR HELPERS AND EXTENSION-SPECIFIC FUNCTIONS **/ /******************************************************************************/ /* {{{ HTTP request function declarations */ size_t solr_curl_write(solr_char_t *data, size_t size, size_t nmemb, void *ctx); size_t solr_curl_write_header(solr_char_t *data, size_t size, size_t nmemb, void *ctx); int solr_curl_debug_callback(CURL *curl_handle, curl_infotype infotype, solr_char_t *debug_data, size_t size, void *ctx); PHP_SOLR_API int solr_init_options(solr_client_options_t *options); PHP_SOLR_API int solr_init_handle(solr_curl_t *sch, solr_client_options_t *options); PHP_SOLR_API int solr_make_request(solr_client_t *client, solr_request_type_t request_type); PHP_SOLR_API int solr_make_update_stream_request(solr_client_t *client, solr_ustream_t* stream_data, solr_string_t *request_params); PHP_SOLR_API void solr_free_handle(solr_curl_t *sch); PHP_SOLR_API void solr_free_option(solr_client_options_t *options); /* }}} */ PHP_SOLR_API void solr_extension_register_constants(int type, int module_number); PHP_SOLR_API void solr_document_register_class_constants(zend_class_entry *ce); PHP_SOLR_API void solr_extract_register_class_constants(zend_class_entry *ce); PHP_SOLR_API void solr_client_register_class_constants(zend_class_entry *ce); PHP_SOLR_API void solr_query_register_class_constants(zend_class_entry *ce); PHP_SOLR_API void solr_collapse_function_register_class_constants(zend_class_entry *ce); PHP_SOLR_API void solr_response_register_class_properties(zend_class_entry *ce); PHP_SOLR_API void solr_response_register_class_constants(zend_class_entry *ce); PHP_SOLR_API void solr_exception_register_class_properties(zend_class_entry *ce); PHP_SOLR_API void solr_input_document_register_class_constants(zend_class_entry *ce); PHP_SOLR_API void solr_set_response_object_properties(zend_class_entry *scope, zval *response_object, const solr_client_t *client, const solr_string_t *request_url, zend_bool success); PHP_SOLR_API void solr_throw_exception_ex(zend_class_entry *exception_ce, long code, const char *filename, int file_line, const char *function_name, char *format, ...); PHP_SOLR_API void solr_throw_exception(zend_class_entry *exception_ce, char *message, long code, const char *filename, int file_line, const char *function_name); PHP_SOLR_API void solr_throw_solr_server_exception(solr_client_t *client,const char *requestType); /* {{{ init functions called in constructors - allocate/initialize params_t */ PHP_SOLR_API int solr_params_obj_ctor(zval *obj); PHP_SOLR_API void solr_params_obj_dtor(zval *obj); PHP_SOLR_API int solr_init_params(solr_params_t *solr_params, long int index); zend_object *solr_extract_create_object_handler(zend_class_entry *ce); /* }}} */ PHP_SOLR_API int solr_init_ustream(zval *obj); PHP_SOLR_API void solr_destroy_ustream_ex(solr_ustream_t *stream); PHP_SOLR_API void solr_destroy_ustream_zv(zval *obj); PHP_SOLR_API int solr_fetch_ustream_entry(zval *objptr, solr_ustream_t **stream_entry); #ifdef PHP_7 #define solr_destroy_ustream solr_destroy_ustream_zv #else #define solr_destroy_ustream solr_destroy_ustream_ex #endif /* {{{ solr_document_t based objects methods*/ PHP_SOLR_API solr_document_t *solr_init_document(long int document_index); PHP_SOLR_API solr_document_t *solr_input_doc_ctor(zval *objptr); #if PHP_VERSION_ID < 80000 PHP_SOLR_API zend_object *solr_document_object_handler_clone(zval *zobject); #else PHP_SOLR_API zend_object *solr_document_object_handler_clone(zend_object *zobject); #endif /* }}} */ /* {{{ zend_hash_free functions */ PHP_SOLR_API void solr_destroy_field_list_ht_dtor(zval *zv_field_entry); PHP_SOLR_API void solr_destroy_field_list(solr_field_list_t *field_entry); PHP_SOLR_API void solr_destroy_client(zval *client); PHP_SOLR_API void solr_destroy_document_zv(zval *document); PHP_SOLR_API void solr_destroy_document_ex(solr_document_t *document); #ifdef PHP_7 #define solr_destroy_document solr_destroy_document_zv #else #define solr_destroy_document solr_destroy_document_ex #endif PHP_SOLR_API void solr_destroy_params(zval *solr_params); PHP_SOLR_API void solr_destroy_function(zval *solr_function); PHP_SOLR_API void solr_destory_param_ht_dtor(zval *param_zv); PHP_SOLR_API void solr_destroy_param(solr_param_t **param); /* dead */ PHP_SOLR_API void solr_destroy_param_value(solr_param_t *param, solr_param_value_t *param_value); /* }}} */ #ifdef PHP_7 #define field_copy_constructor field_copy_constructor_zv #else #define field_copy_constructor field_copy_constructor_ex #endif /* {{{ used for SolrDocument field manipulations */ PHP_SOLR_API int solr_document_insert_field_value_ex(solr_field_list_t *queue, const solr_char_t *field_value, double field_boost, int modifier); PHP_SOLR_API void field_copy_constructor_ex(solr_field_list_t **original_field_queue); PHP_SOLR_API void field_copy_constructor_zv(zval *field_queue_zv); /* }}} */ /* {{{ Used for comparison of document fields */ #if PHP_VERSION_ID < 80000 PHP_SOLR_API int solr_compare_field_name (const void *a, const void *b); PHP_SOLR_API int solr_rcompare_field_name(const void *a, const void *b); PHP_SOLR_API int solr_compare_field_value_count (const void *a, const void *b); PHP_SOLR_API int solr_rcompare_field_value_count(const void *a, const void *b); PHP_SOLR_API int solr_compare_field_boost_value (const void *a, const void *b); PHP_SOLR_API int solr_rcompare_field_boost_value(const void *a, const void *b); #else PHP_SOLR_API int solr_compare_field_name (Bucket *a, Bucket *b); PHP_SOLR_API int solr_rcompare_field_name(Bucket *a, Bucket *b); PHP_SOLR_API int solr_compare_field_value_count (Bucket *a, Bucket *b); PHP_SOLR_API int solr_rcompare_field_value_count(Bucket *a, Bucket *b); PHP_SOLR_API int solr_compare_field_boost_value (Bucket *a, Bucket *b); PHP_SOLR_API int solr_rcompare_field_boost_value(Bucket *a, Bucket *b); #endif /* }}} */ /* {{{ Functions for SolrParams Parameters */ PHP_SOLR_API solr_param_t *solr_create_new_param(const solr_char_t *param_name, size_t param_name_len, solr_param_type_t param_type, solr_bool allow_multiple, solr_param_value_equal_func_t value_equal_func, solr_param_fetch_func_t param_fetch_func, solr_param_value_free_func_t value_free_func, solr_char_t delimiter, solr_char_t arg_separator); PHP_SOLR_API int solr_params_insert_param_value(solr_param_t *param, solr_param_value_t *param_value); PHP_SOLR_API int solr_params_delete_param_value(solr_param_t *param, const solr_param_value_t *target_value); PHP_SOLR_API int solr_delete_solr_parameter(zval *objptr, solr_char_t *name, int name_length); PHP_SOLR_API int solr_add_or_set_normal_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, zend_bool allow_multiple); PHP_SOLR_API int solr_add_simple_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length); PHP_SOLR_API int solr_add_simple_list_param_ex(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *separator); PHP_SOLR_API int solr_add_arg_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t delimiter, solr_char_t arg_separator); PHP_SOLR_API int solr_add_arg_list_param_ex(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t delimiter, solr_char_t arg_separator, solr_char_t delimiter_override); PHP_SOLR_API solr_param_value_t* create_parameter_value_arg_list(solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t *delimiter_override, solr_bool delimiter_overriden); #define solr_set_normal_param(objptr, pname, pname_length, pvalue, pvalue_length) solr_add_or_set_normal_param((objptr), (pname), (pname_length), (pvalue), (pvalue_length), 0) #define solr_add_normal_param(objptr, pname, pname_length, pvalue, pvalue_length) solr_add_or_set_normal_param((objptr), (pname), (pname_length), (pvalue), (pvalue_length), 1) PHP_SOLR_API int solr_normal_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b); PHP_SOLR_API int solr_simple_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b); PHP_SOLR_API int solr_arg_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b); PHP_SOLR_API void solr_normal_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer); PHP_SOLR_API void solr_simple_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer); PHP_SOLR_API void solr_arg_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer); PHP_SOLR_API void solr_normal_param_value_display(solr_param_t *solr_param, zval *param_value_array); PHP_SOLR_API void solr_simple_list_param_value_display(solr_param_t *solr_param, zval *param_value_array); PHP_SOLR_API void solr_arg_list_param_value_display(solr_param_t *solr_param, zval *param_value_array); /* Used to display values where allow_multiple is false */ PHP_SOLR_API void solr_normal_param_value_display_string(solr_param_t *solr_param, zval *param_value); PHP_SOLR_API void solr_normal_param_value_display_integer(solr_param_t *solr_param, zval *param_value); PHP_SOLR_API void solr_normal_param_value_display_double(solr_param_t *solr_param, zval *param_value); PHP_SOLR_API void solr_normal_param_value_display_boolean(solr_param_t *solr_param, zval *param_value); PHP_SOLR_API void solr_normal_param_value_display_sort_type(solr_param_t *solr_param, zval *param_value); PHP_SOLR_API int solr_param_find(zval *objptr, solr_char_t *pname, int pname_length, solr_param_t **solr_param); PHP_SOLR_API solr_string_t solr_params_to_string(solr_params_t * solr_params, zend_bool url_encode); PHP_SOLR_API void solr_normal_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode); PHP_SOLR_API void solr_simple_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode); PHP_SOLR_API void solr_arg_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode); PHP_SOLR_API void solr_normal_param_value_free(solr_param_value_t *param_value); PHP_SOLR_API void solr_simple_list_param_value_free(solr_param_value_t *param_value); PHP_SOLR_API void solr_arg_list_param_value_free(solr_param_value_t *param_value); /* Used for removing parameter values from the list of values for that param */ PHP_SOLR_API int solr_delete_normal_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length); PHP_SOLR_API int solr_delete_simple_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length); PHP_SOLR_API int solr_delete_arg_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length); /* }}} */ /* {{{ Debugging functions */ /* Debug function used to print field values in the field queue */ PHP_SOLR_API void solr_debug_print_fields(const solr_field_list_t *queue); /* Used when debugging is enabled to run in verbose mode */ PHP_SOLR_API void solr_debug_printf(const char *format, ...); /* }}} */ /* {{{ Document utility functions */ PHP_SOLR_API void solr_generate_document_xml_from_fields(xmlNode *solr_doc_node, HashTable *document_fields); PHP_SOLR_API void solr_create_document_field_object(solr_field_list_t *field_values, zval **field_obj); PHP_SOLR_API void solr_add_doc_node(xmlNode *root_node, solr_document_t *doc_entry); PHP_SOLR_API xmlDocPtr solr_xml_create_xml_doc(const xmlChar *root_node_name, xmlNode **root_node_ptr); /* }}} */ /* {{{ identical functions used on both SolrDocument and SolrInputDocument */ PHP_SOLR_API void solr_document_get_field_names(INTERNAL_FUNCTION_PARAMETERS); /* }}} */ /* {{{ Utility functions */ PHP_SOLR_API long solr_get_json_last_error(void); PHP_SOLR_API solr_char_t *solr_get_json_error_msg(solr_json_error_codes_t error_code); PHP_SOLR_API int solr_json_to_php_native(solr_string_t *buffer, const solr_char_t *json_string, int json_string_length); PHP_SOLR_API int solr_is_supported_response_writer(const solr_char_t * response_writer, int length); PHP_SOLR_API int solr_hashtable_get_new_index(HashTable *ht); #if PHP_VERSION_ID < 80000 PHP_SOLR_API int solr_fetch_document_entry(zval *objptr, solr_document_t **doc_entry); #else PHP_SOLR_API int solr_fetch_document_entry(zend_object *objptr, solr_document_t **doc_entry); #endif PHP_SOLR_API int solr_fetch_client_entry(zval *objptr, solr_client_t **solr_client); PHP_SOLR_API int solr_fetch_params_entry(zval *objptr, solr_params_t **solr_params); PHP_SOLR_API int solr_fetch_function_entry(zval *objptr, solr_function_t **solr_params); PHP_SOLR_API void solr_encode_generic_xml_response(solr_string_t *buffer, const solr_char_t *serialized, int size, long int parse_mode); PHP_SOLR_API void solr_set_return_solr_params_object(zval *return_value_ptr, zval *current_objptr); PHP_SOLR_API void solr_escape_query_chars(solr_string_t *sbuilder, solr_char_t *unescaped, long int unescaped_length); /* serialized array to serialized SolrObject */ PHP_SOLR_API int solr_sarray_to_sobject(solr_string_t *buffer); PHP_SOLR_API int solr_sobject_to_sarray(solr_string_t *buffer); PHP_SOLR_API void solr_response_get_response_impl(INTERNAL_FUNCTION_PARAMETERS, int return_array); /* }}} */ /* {{{ SolrFunction Helpers (solrfunc to avoid confusion with solr_function) */ PHP_SOLR_API int solr_solrfunc_update_string(zval *obj, solr_char_t *key, int key_len, solr_char_t *value, int value_len); PHP_SOLR_API int solr_solrfunc_fetch_string(zval *obj, solr_char_t *key, int key_len, solr_string_t **string); PHP_SOLR_API int solr_solrfunc_return_string(zval *obj, solr_char_t *key, int key_len, zval **return_value); PHP_SOLR_API void solr_solrfunc_to_string(solr_function_t *function, solr_string_t **dest); PHP_SOLR_API int solr_solrfunc_display_string(zval *obj, solr_char_t *key, int key_len, zval **return_value); #if PHP_VERSION_ID < 80000 zend_object *solr_collapse_function_object_handler_clone(zval *object); #else zend_object *solr_collapse_function_object_handler_clone(zend_object *object); #endif /* }}} */ /* {{{ Solr Server Exception Handling */ PHP_SOLR_API int solr_get_xml_error(solr_string_t buffer, solr_exception_t *exceptionData); PHP_SOLR_API int solr_get_json_error(solr_string_t buffer, solr_exception_t *exceptionData); PHP_SOLR_API int solr_get_phpnative_error(solr_string_t buffer, solr_exception_t *exceptionData); PHP_SOLR_API int hydrate_error_zval(zval *response, solr_exception_t *exceptionData); /* }}} */ /* {{{ Solr Object Handlers */ #if PHP_VERSION_ID < 80000 #define OBJ_FOR_PROP(zv) (zv) #if PHP_VERSION_ID < 70400 PHP_SOLR_API void solr_object_write_property(zval *object, zval *member, zval *value, void **cache_slot); PHP_SOLR_API void solr_document_field_write_property(zval *object, zval *member, zval *value, void **cache_slot); #else PHP_SOLR_API zval *solr_object_write_property(zval *object, zval *member, zval *value, void **cache_slot); PHP_SOLR_API zval *solr_document_field_write_property(zval *object, zval *member, zval *value, void **cache_slot); #endif PHP_SOLR_API zval *solr_object_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv); PHP_SOLR_API void solr_object_unset_property(zval *object, zval *member, void **cache_slot); PHP_SOLR_API void solr_object_write_dimension(zval *object, zval *offset, zval *value); PHP_SOLR_API void solr_object_unset_dimension(zval *object, zval *offset); PHP_SOLR_API void solr_document_field_unset_property(zval *object, zval *member, void **cache_slot); #else #define OBJ_FOR_PROP(zv) Z_OBJ_P(zv) PHP_SOLR_API zval *solr_document_field_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot); PHP_SOLR_API zval *solr_object_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot); PHP_SOLR_API zval *solr_object_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv); PHP_SOLR_API void solr_object_unset_property(zend_object *object, zend_string *member, void **cache_slot); PHP_SOLR_API void solr_object_write_dimension(zend_object *object, zval *offset, zval *value); PHP_SOLR_API void solr_object_unset_dimension(zend_object *object, zval *offset); PHP_SOLR_API void solr_document_field_unset_property(zend_object *object, zend_string *member, void **cache_slot); #endif /* }}} */ int add_phrase_field(zval *obj, solr_char_t *pname, zval *boost, zval *slop, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_len); #include "solr_macros.h" #include "php_solr_dismax_query.h" #endif /* HAVE_SOLR */ #endif /* SOLRCLIENT_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/php_solr_api.h000066400000000000000000000033261374041537100216460ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Israel Ekpo | +----------------------------------------------------------------------+ */ /** * Declaring Macro for function attributes * * This is for functions on GNU systems and Win32 systems * * On Win32 systems __declspec(dllexport) adds the export directive to the * object file so you do not need to use a .def file * * Using __declspec(dllexport) in addition to using a .def file should * not cause build errors. */ #ifndef PHP_SOLR_API_H #define PHP_SOLR_API_H #ifdef PHP_WIN32 #define PHP_SOLR_API __declspec(dllexport) #elif defined(__GNUC__) && __GNUC__ >= 4 #define PHP_SOLR_API __attribute__ ((visibility("default"))) #else #define PHP_SOLR_API #endif #endif /* PHP_SOLR_API_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/php_solr_client.c000066400000000000000000001724141374041537100223530ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_solr.h" /* {{{ Macros */ /* resets the key_str with key and tries to find the zv */ static inline int solr_opt_check(HashTable *options_ht, const char * key, zend_string * key_str, zval ** zv) { int result = 0; key_str = zend_string_init(key, strlen (key), 0); result = (*zv = zend_hash_find(options_ht, key_str)) != NULL; zend_string_release(key_str); return result; } /* {{{ static void solr_client_init_urls(solr_client_t *solr_client) */ static void solr_client_init_urls(solr_client_t *solr_client) { solr_string_t url_prefix; solr_client_options_t *options = &(solr_client->options); memset(&url_prefix, 0, sizeof(solr_string_t)); /* Release all previously allocated URL values, if any */ solr_string_free(&(options->update_url)); solr_string_free(&(options->extract_url)); solr_string_free(&(options->search_url)); solr_string_free(&(options->thread_url)); solr_string_free(&(options->ping_url)); solr_string_free(&(options->terms_url)); solr_string_free(&(options->system_url)); solr_string_free(&(options->get_url)); /* Making http://hostname:host_port/path/ */ if (options->secure) { solr_string_append_const(&url_prefix, "https://"); } else { solr_string_append_const(&url_prefix, "http://"); } solr_string_append_solr_string(&url_prefix, &(options->hostname)); solr_string_appendc(&url_prefix, ':'); solr_string_append_long(&url_prefix, options->host_port); solr_string_appendc(&url_prefix, '/'); solr_string_append_solr_string(&url_prefix, &(options->path)); solr_string_appendc(&url_prefix, '/'); /* Copying over the prefixes */ solr_string_append_solr_string(&(options->update_url), &url_prefix); solr_string_append_solr_string(&(options->extract_url), &url_prefix); solr_string_append_solr_string(&(options->search_url), &url_prefix); solr_string_append_solr_string(&(options->thread_url), &url_prefix); solr_string_append_solr_string(&(options->ping_url), &url_prefix); solr_string_append_solr_string(&(options->terms_url), &url_prefix); solr_string_append_solr_string(&(options->system_url), &url_prefix); solr_string_append_solr_string(&(options->get_url), &url_prefix); /* Making http://hostname:host_port/path/servlet/ */ solr_string_append_solr_string(&(options->update_url), &(options->update_servlet)); solr_string_append_solr_string(&(options->extract_url), &(options->extract_servlet)); solr_string_append_solr_string(&(options->search_url), &(options->search_servlet)); solr_string_append_solr_string(&(options->thread_url), &(options->thread_servlet)); solr_string_append_solr_string(&(options->ping_url), &(options->ping_servlet)); solr_string_append_solr_string(&(options->terms_url), &(options->terms_servlet)); solr_string_append_solr_string(&(options->system_url), &(options->system_servlet)); solr_string_append_solr_string(&(options->get_url), &(options->get_servlet)); solr_string_append_const(&(options->update_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->extract_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->search_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->thread_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->ping_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->terms_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->system_url), "/?version=2.2&indent=on&wt="); solr_string_append_const(&(options->get_url), "/?version=2.2&indent=on&wt="); solr_string_append_solr_string(&(options->update_url), &(options->response_writer)); solr_string_append_solr_string(&(options->extract_url), &(options->response_writer)); solr_string_append_solr_string(&(options->search_url), &(options->response_writer)); solr_string_append_solr_string(&(options->thread_url), &(options->response_writer)); solr_string_append_solr_string(&(options->ping_url), &(options->response_writer)); solr_string_append_solr_string(&(options->terms_url), &(options->response_writer)); solr_string_append_solr_string(&(options->system_url), &(options->response_writer)); solr_string_append_solr_string(&(options->get_url), &(options->response_writer)); solr_string_free(&url_prefix); } /* }}} */ /* {{{ static int solr_http_build_query(solr_string_t *buffer, zval *params_objptr, const solr_char_t *delimiter, int delimiter_length) */ static int solr_http_build_query(solr_string_t *buffer, solr_params_t *solr_params, const solr_char_t *delimiter, int delimiter_length) { HashTable *params = NULL; solr_param_t *solr_param = NULL; params = solr_params->params; ZEND_HASH_FOREACH_PTR(params, solr_param) { solr_string_t tmp_values_buffer; memset(&tmp_values_buffer, 0, sizeof(solr_string_t)); solr_param->fetch_func(solr_param, &tmp_values_buffer); solr_string_append_solr_string(buffer, &tmp_values_buffer); solr_string_appends(buffer, delimiter, delimiter_length); solr_string_free(&tmp_values_buffer); } ZEND_HASH_FOREACH_END(); solr_string_remove_last_char(buffer); return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API solr_client_t* solr_init_client(zval * objptr) inititialize solr_client_t and update zval's index */ PHP_SOLR_API solr_client_t *solr_init_client(zval *objptr) { long int client_index = SOLR_UNIQUE_CLIENT_INDEX(); solr_client_t *solr_client = NULL; zend_update_property_long(solr_ce_SolrClient, OBJ_FOR_PROP(objptr), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, client_index); solr_client = (solr_client_t *) pemalloc(sizeof(solr_client_t), SOLR_CLIENT_PERSISTENT); memset(solr_client, 0, sizeof(solr_client_t)); solr_client->client_index = client_index; if ((solr_client = zend_hash_index_update_ptr(SOLR_GLOBAL(clients), client_index, (void *)solr_client)) == NULL) { pefree(solr_client, SOLR_CLIENT_PERSISTENT); php_error_docref(NULL, E_ERROR, "Error while registering client in HashTable"); return NULL; } return solr_client; } /* }}} */ /******************************************************************************/ /** DEFINITIONS FOR SOLR CLIENT METHODS **/ /******************************************************************************/ /* {{{ proto SolrClient::__construct(array options ) Constructor for SolrClient */ PHP_METHOD(SolrClient, __construct) { zval *options = NULL; zval *objptr = getThis(); HashTable *options_ht = NULL; zval *tmp1 = NULL, *tmp2 = NULL; solr_client_t *solr_client_dest = NULL; solr_client_options_t *client_options = NULL; solr_curl_t *handle = NULL; zend_string *key_str; /* tmp storage to use with zend_hash_find */ key_str = zend_string_init("", 0, 0); size_t num_options = 0; long int secure = 0L; long int verify_peer = 0L; long int verify_host = 2L; long int timeout = 30L; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &options) == FAILURE) { zend_string_release(key_str); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Invalid parameter. The client options array is required for a SolrClient instance. It must also be passed as the only parameter"); return; } options_ht = Z_ARRVAL_P(options); num_options = zend_hash_num_elements(options_ht); if (!num_options) { zend_string_release(key_str); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "The SolrClient options cannot be an empty array"); return; } solr_client_dest = solr_init_client(objptr); if (!solr_client_dest) { zend_string_release(key_str); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Unable to initialize solr_client_t "); return; } /* Release the original pointer */ client_options = &(solr_client_dest->options); handle = &(solr_client_dest->handle); solr_init_options(client_options); solr_string_append_const(&(client_options->response_writer), SOLR_XML_RESPONSE_WRITER); solr_string_append_const(&(client_options->update_servlet), SOLR_DEFAULT_UPDATE_SERVLET); solr_string_append_const(&(client_options->extract_servlet), SOLR_DEFAULT_EXTRACT_SERVLET); solr_string_append_const(&(client_options->search_servlet), SOLR_DEFAULT_SEARCH_SERVLET); solr_string_append_const(&(client_options->thread_servlet), SOLR_DEFAULT_THREADS_SERVLET); solr_string_append_const(&(client_options->ping_servlet), SOLR_DEFAULT_PING_SERVLET); solr_string_append_const(&(client_options->terms_servlet), SOLR_DEFAULT_TERMS_SERVLET); solr_string_append_const(&(client_options->system_servlet), SOLR_DEFAULT_SYSTEM_SERVLET); solr_string_append_const(&(client_options->get_servlet), SOLR_DEFAULT_GET_SERVLET); if ( solr_opt_check(options_ht, "wt", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { if (solr_is_supported_response_writer((solr_char_t *)Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1))) { solr_string_set(&(client_options->response_writer), (const solr_char_t *) Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); } else { php_error_docref(NULL, E_WARNING, "Unsupported response writer %s. This value will be ignored", Z_STRVAL_P(tmp1)); } } if (solr_opt_check(options_ht, "secure", key_str, &tmp1)) { if (Z_TYPE_P(tmp1) == IS_TRUE) { secure = (long int) 1L; } else if (Z_TYPE_P(tmp1) == IS_LONG) { secure = Z_LVAL_P(tmp1); } } client_options->secure = secure; /** * FOR NOW LET'S LEAVE IT AT 2 : This will force and require a match on the common name * if (secure && zend_hash_find(options_ht, "ssl_verifyhost", sizeof("ssl_verifyhost"), (void**) &tmp1) == SUCCESS && Z_TYPE_P(tmp1) == IS_LONG) { verify_host = ((Z_LVAL_P(tmp1) > 0L && Z_LVAL_P(tmp1) < 3L) ? Z_LVAL_P(tmp1) : verify_host); } */ client_options->ssl_verify_host = verify_host; if (secure && solr_opt_check(options_ht, "ssl_cert", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { verify_peer = 1L; solr_string_appends(&(client_options->ssl_cert), Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); } if (secure && solr_opt_check(options_ht, "ssl_key", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { verify_peer = 1L; solr_string_appends(&(client_options->ssl_key), (solr_char_t *) Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); } if (secure && solr_opt_check(options_ht, "ssl_keypassword", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { verify_peer = 1L; solr_string_appends(&(client_options->ssl_keypassword), (solr_char_t *) Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); } // ssl_cainfo if (secure && solr_opt_check(options_ht, "ssl_cainfo", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { verify_peer = 1L; solr_string_appends(&(client_options->ssl_cainfo), (solr_char_t *) Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); } // ssl_capath if (secure && solr_opt_check(options_ht, "ssl_capath", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { verify_peer = 1L; solr_string_appends(&(client_options->ssl_capath), (solr_char_t *) Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); } client_options->ssl_verify_peer = verify_peer; // hostname if (solr_opt_check(options_ht, "hostname", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { solr_string_appends(&(client_options->hostname), (solr_char_t *) Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); } else { solr_string_append_const(&(client_options->hostname), SOLR_REQUEST_DEFAULT_HOST); } // port if (solr_opt_check(options_ht, "port", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_LONG) { client_options->host_port = Z_LVAL_P(tmp1); } else if (solr_opt_check(options_ht, "port", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { long int host_port = atol(Z_STRVAL_P(tmp1)); if (host_port) { client_options->host_port = host_port; } else { client_options->host_port = SOLR_REQUEST_DEFAULT_PORT; } } else { client_options->host_port = SOLR_REQUEST_DEFAULT_PORT; } if (solr_opt_check(options_ht, "timeout", key_str, &tmp1)) { long int timeout_value = 30L; if (Z_TYPE_P(tmp1) == IS_LONG) { timeout_value = Z_LVAL_P(tmp1); } else if (Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { timeout_value = atol(Z_STRVAL_P(tmp1)); } timeout = ((timeout_value > 0L) ? timeout_value : timeout); } client_options->timeout = timeout; if (solr_opt_check(options_ht, "path", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { char *path_to_solr = Z_STRVAL_P(tmp1); size_t path_to_solr_start = 0; size_t length_adjustment = 0; if (path_to_solr[0] == '/') { path_to_solr_start = length_adjustment = 1; } if (path_to_solr[Z_STRLEN_P(tmp1)] == '/') { length_adjustment++; } solr_string_appends(&(client_options->path), Z_STRVAL_P(tmp1) + path_to_solr_start, Z_STRLEN_P(tmp1) - length_adjustment); } else { solr_string_append_const(&(client_options->path), SOLR_REQUEST_DEFAULT_PATH); } if ( solr_opt_check(options_ht, "query_string_delimiter", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING) { solr_string_appends(&(client_options->qs_delimiter), Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); } else { solr_string_append_const(&(client_options->qs_delimiter), SOLR_REQUEST_DEFAULT_QS_DELIMITER); } if ( solr_opt_check(options_ht, "login", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && solr_opt_check(options_ht, "password", key_str, &tmp2) && Z_TYPE_P(tmp2) == IS_STRING) { solr_string_appends(&(client_options->http_auth_credentials), Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); solr_string_appendc(&(client_options->http_auth_credentials), ':'); solr_string_appends(&(client_options->http_auth_credentials), Z_STRVAL_P(tmp2), Z_STRLEN_P(tmp2)); } if (solr_opt_check(options_ht, "proxy_host", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING) { solr_string_appends(&(client_options->proxy_hostname), Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); } if (solr_opt_check(options_ht, "proxy_port", key_str, &tmp1)) { long int proxy_port_value = 0L; if (Z_TYPE_P(tmp1) == IS_LONG) { proxy_port_value = Z_LVAL_P(tmp1); } else if (Z_TYPE_P(tmp1) == IS_STRING && Z_STRLEN_P(tmp1)) { proxy_port_value = atol(Z_STRVAL_P(tmp1)); } if (proxy_port_value > 0L) { client_options->proxy_port = proxy_port_value; } } if (solr_opt_check(options_ht, "proxy_login", key_str, &tmp1) && Z_TYPE_P(tmp1) == IS_STRING && solr_opt_check(options_ht, "proxy_password", key_str, &tmp2) && Z_TYPE_P(tmp2) == IS_STRING) { solr_string_appends(&(client_options->proxy_auth_credentials), Z_STRVAL_P(tmp1), Z_STRLEN_P(tmp1)); solr_string_appendc(&(client_options->proxy_auth_credentials), ':'); solr_string_appends(&(client_options->proxy_auth_credentials), Z_STRVAL_P(tmp2), Z_STRLEN_P(tmp2)); } solr_init_handle(handle, client_options); zend_string_free(key_str); SOLR_GLOBAL(client_count)++; } /* }}} */ /* {{{ proto SolrClient::__destruct(void) Destructor for SolrClient */ PHP_METHOD(SolrClient, __destruct) { solr_client_t *solr_client = NULL; if (solr_fetch_client_entry(getThis(), &solr_client) == SUCCESS) { zend_hash_index_del(SOLR_GLOBAL(clients), solr_client->client_index); /* Keep track of how many SolrClient instances we have. */ SOLR_GLOBAL(client_count)--; return ; } } /* }}} */ /* {{{ proto SolrClient::__sleep(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrClient, __sleep) { solr_init_client(getThis()); solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1001, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1001_MSG); } /* }}} */ /* {{{ proto SolrClient::__wakeup(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrClient, __wakeup) { solr_init_client(getThis()); solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1001, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1001_MSG); } /* }}} */ /* {{{ proto SolrClient::__clone(void) Should not be called directly. Cloning is not supported. */ PHP_METHOD(SolrClient, __clone) { solr_init_client(getThis()); solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_4001, SOLR_FILE_LINE_FUNC, "Cloning of SolrClient objects is currently not supported"); } /* }}} */ /* {{{ proto bool SolrClient::setServelet(int servlet_type, string new_value) Changes the specified servlet type to a new value */ PHP_METHOD(SolrClient, setServlet) { long int servlet_type_value = 0L; solr_char_t *new_servlet_value = NULL; COMPAT_ARG_SIZE_T new_servlet_value_length = 0; solr_client_t *client = NULL; solr_servlet_type_t servlet_type = SOLR_SERVLET_TYPE_BEGIN; if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &servlet_type_value, &new_servlet_value, &new_servlet_value_length) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter."); RETURN_FALSE; } if (!new_servlet_value_length) { php_error_docref(NULL, E_WARNING, "Invalid servlet value."); RETURN_FALSE; } /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to retrieve client"); RETURN_FALSE; } servlet_type = (solr_servlet_type_t) servlet_type_value; switch(servlet_type) { case SOLR_SERVLET_TYPE_SEARCH : { solr_string_set(&(client->options.search_servlet), new_servlet_value, new_servlet_value_length); } break; case SOLR_SERVLET_TYPE_TERMS : { solr_string_set(&(client->options.terms_servlet), new_servlet_value, new_servlet_value_length); } break; case SOLR_SERVLET_TYPE_UPDATE : { solr_string_set(&(client->options.update_servlet), new_servlet_value, new_servlet_value_length); } break; case SOLR_SERVLET_TYPE_THREADS : { solr_string_set(&(client->options.thread_servlet), new_servlet_value, new_servlet_value_length); } break; case SOLR_SERVLET_TYPE_PING : { solr_string_set(&(client->options.ping_servlet), new_servlet_value, new_servlet_value_length); } break; case SOLR_SERVLET_TYPE_SYSTEM : { solr_string_set(&(client->options.system_servlet), new_servlet_value, new_servlet_value_length); } break; default : { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Invalid Servlet type %ld specified. Value discarded.", servlet_type_value); RETURN_FALSE; } } RETURN_TRUE; } /* }}} */ // client->handle.err.str client->handle.request_body_debug.buffer.str /* {{{ proto SolrQueryResponse SolrClient::query(SolrParams query) Sends a name-value pair request to the Solr server. */ PHP_METHOD(SolrClient, query) { zval *solr_params_obj = NULL; solr_client_t *client = NULL; solr_params_t *solr_params = NULL; solr_string_t *buffer = NULL; solr_char_t *delimiter = NULL; COMPAT_ARG_SIZE_T delimiter_length = 0; zend_bool success = 1; solr_request_type_t solr_request_type = SOLR_REQUEST_SEARCH; solr_string_t *request_url = NULL; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &solr_params_obj, solr_ce_SolrParams) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, SOLR_ERROR_4000_MSG); return; } /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to retrieve client"); return; } /* Make sure the SolrParams object passed is a valid one */ if (solr_fetch_params_entry(solr_params_obj, &solr_params) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "SolrParams parameter passed is not a valid one."); return ; } /* The SolrParams instance must contain at least one parameter */ if (zend_hash_num_elements(solr_params->params) < 1) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "SolrParams parameter passed contains no parameters."); return ; } buffer = &(client->handle.request_body.buffer); /* Get rid of all the data from the previous request */ solr_string_free(buffer); delimiter = client->options.qs_delimiter.str; delimiter_length = client->options.qs_delimiter.len; /* Remove wt if any */ zend_hash_str_del(solr_params->params, "wt", sizeof("wt")-1); if (solr_http_build_query(buffer, solr_params, delimiter, delimiter_length) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1003, SOLR_FILE_LINE_FUNC, "Error building HTTP query from parameters"); return; } /* Always reset the URLs before making any request */ solr_client_init_urls(client); request_url = &(client->options.search_url); /* terms.fl is a required parameter for the TermsComponent */ if (zend_hash_str_exists(solr_params->params, "terms.fl", sizeof("terms.fl")-1)) { /* Change the request type to a TermsComponent request */ solr_request_type = SOLR_REQUEST_TERMS; request_url =&(client->options.terms_url); } /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, solr_request_type) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"query"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrQueryResponse); solr_set_response_object_properties(solr_ce_SolrQueryResponse, return_value, client, request_url, success); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::addDocument(SolrInputDocument doc [, bool overwrite [, int commitWithin]]) Adds a document to the Solr server. */ PHP_METHOD(SolrClient, addDocument) { zval *solr_input_doc = NULL; zend_bool overwrite = 1; long int commitWithin = 0L; solr_document_t *doc_entry = NULL; solr_client_t *client = NULL; HashTable *document_fields; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; char *overwriteValue = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|bl", &solr_input_doc, solr_ce_SolrInputDocument, &overwrite, &commitWithin) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter."); return; } if (solr_fetch_document_entry(OBJ_FOR_PROP(solr_input_doc), &doc_entry) == FAILURE) { php_error_docref(NULL, E_WARNING, "SolrInputDocument is not valid. Object not present in HashTable"); return; } document_fields = doc_entry->fields; /* Document must contain at least one field */ if (0 == zend_hash_num_elements(document_fields)) { php_error_docref(NULL, E_WARNING, "SolrInputDocument has no fields"); return; } /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to retrieve client"); return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "add", &root_node); overwriteValue = (overwrite)? "true" : "false"; xmlNewProp(root_node, (xmlChar *) "overwrite", (xmlChar *) overwriteValue); if (commitWithin > 0L) { auto char commitWithinBuffer[32]; memset(commitWithinBuffer, 0, sizeof(commitWithinBuffer)); php_sprintf(commitWithinBuffer, "%ld", commitWithin); xmlNewProp(root_node, (xmlChar *) "commitWithin", (xmlChar *) commitWithinBuffer); } solr_add_doc_node(root_node, doc_entry); xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::addDocuments(array docs [, bool overwrite [, int commitWithin]]) Adds an array of SolrInputDocuments to the Solr server. */ PHP_METHOD(SolrClient, addDocuments) { zval *docs_array = NULL; zend_bool overwrite = 1; long int commitWithin = 0L; HashTable *solr_input_docs; size_t num_input_docs = 0; solr_client_t *client = NULL; solr_document_t **doc_entries = NULL; size_t curr_pos = 0U; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; xmlChar *overwriteValue = NULL; size_t pos = 0U; solr_document_t *current_doc_entry = NULL; int format = 1; int size = 0; zend_bool success = 1; xmlChar *request_string = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "a|bl", &docs_array, &overwrite, &commitWithin) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); return; } solr_input_docs = Z_ARRVAL_P(docs_array); num_input_docs = zend_hash_num_elements(solr_input_docs); if(!num_input_docs) { php_error_docref(NULL, E_WARNING, "The array parameter passed is empty"); return; } /* This should be released if there is an error */ doc_entries = (solr_document_t **) pemalloc((sizeof(solr_document_t *) * (num_input_docs + 1)), SOLR_DOCUMENT_PERSISTENT); memset(doc_entries, 0, sizeof(solr_document_t *) * (num_input_docs + 1)); /* Please check all the SolrInputDocument instances passed via the array */ SOLR_HASHTABLE_FOR_LOOP(solr_input_docs) { zval *solr_input_doc = NULL; solr_document_t *doc_entry = NULL; HashTable *document_fields; solr_input_doc = zend_hash_get_current_data(solr_input_docs); if (Z_TYPE_P(solr_input_doc) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(solr_input_doc), solr_ce_SolrInputDocument)) { SOLR_FREE_DOC_ENTRIES(doc_entries); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u is not a valid SolrInputDocument instance", (curr_pos + 1U)); return; } if (solr_fetch_document_entry(OBJ_FOR_PROP(solr_input_doc), &doc_entry) == FAILURE) { SOLR_FREE_DOC_ENTRIES(doc_entries); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u is not valid. Object not present in HashTable", (curr_pos + 1U)); return; } document_fields = doc_entry->fields; /* SolrInputDocument must contain at least one field */ if (0 == zend_hash_num_elements(document_fields)) { SOLR_FREE_DOC_ENTRIES(doc_entries); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u has no fields", (curr_pos + 1U)); return; } doc_entries[curr_pos] = doc_entry; curr_pos++; } /* Mark the end of the list */ doc_entries[curr_pos] = NULL; /* All the input documents have been validated. We can now retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { SOLR_FREE_DOC_ENTRIES(doc_entries); php_error_docref(NULL, E_ERROR, "Unable to retrieve client from HashTable"); return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "add", &root_node); overwriteValue = (overwrite) ? (xmlChar *) "true" : (xmlChar *) "false"; xmlNewProp(root_node, (xmlChar *) "overwrite", overwriteValue); if (commitWithin > 0L) { auto char commitWithinBuffer[32]; memset(commitWithinBuffer, 0, sizeof(commitWithinBuffer)); php_sprintf(commitWithinBuffer, "%ld", commitWithin); xmlNewProp(root_node, (xmlChar *) "commitWithin", (xmlChar *) commitWithinBuffer); } /* Grab the first (solr_document_t *) pointer */ current_doc_entry = doc_entries[pos]; while(current_doc_entry != NULL) { solr_add_doc_node(root_node, current_doc_entry); pos++; /* Grab the next (solr_document_t *) pointer */ current_doc_entry = doc_entries[pos]; } /* We are done with the doc_entries pointer */ SOLR_FREE_DOC_ENTRIES(doc_entries); xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::request(string request_string) Allows the user to send a manual XML update request */ PHP_METHOD(SolrClient, request) { solr_char_t *request_string = NULL; COMPAT_ARG_SIZE_T request_length = 0; solr_client_t *client = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &request_string, &request_length) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); return; } if (!request_length) { solr_throw_exception(solr_ce_SolrIllegalArgumentException, "Invalid request length. Request string is empty.", SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC); return; } if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to retrieve client from HashTable"); return; } /* The update request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), request_string, request_length); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::sendUpdateStream(SolrExtractRequest request) sends an update stream request. */ PHP_METHOD(SolrClient, sendUpdateStream) { zval *request_zv = NULL, *params_zv = NULL; solr_ustream_t *stream = NULL; solr_client_t *client = NULL; solr_string_t *qs_buffer; /* query string buffer */ solr_char_t *delimiter = NULL; size_t delimiter_length = 0L; solr_params_t *params = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &request_zv) == FAILURE) { return; } if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { return; } stream = Z_USTREAM_P(Z_REFVAL_P(request_zv)); params_zv = stream->params; if (params_zv && IS_NULL != Z_TYPE_P(params_zv)) { solr_fetch_params_entry(params_zv, ¶ms); } /* Always reset the URLs before making any request */ solr_client_init_urls(client); qs_buffer = &(client->handle.request_body.buffer); /* Get rid of all the data from the previous request */ solr_string_free(qs_buffer); delimiter = client->options.qs_delimiter.str; delimiter_length = client->options.qs_delimiter.len; if (solr_http_build_query(qs_buffer, params, delimiter, delimiter_length) == FAILURE){ solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1003, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1003_MSG); return; } if (solr_make_update_stream_request(client, stream, qs_buffer) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"extract"); } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.extract_url), success); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::deleteById(string id) Allows the user to delete a document by id */ PHP_METHOD(SolrClient, deleteById) { solr_char_t *id = NULL; COMPAT_ARG_SIZE_T id_length = 0L; solr_client_t *client = NULL; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; xmlChar *escaped_id_value = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &id, &id_length) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); return; } if (!id_length) { solr_throw_exception(solr_ce_SolrIllegalArgumentException, "Invalid id parameter", SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC); return; } if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to retrieve client from HashTable"); return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "delete", &root_node); escaped_id_value = xmlEncodeEntitiesReentrant(doc_ptr, (xmlChar *) id); xmlNewChild(root_node, NULL, (xmlChar *) "id", escaped_id_value); xmlFree(escaped_id_value); xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::request(array ids) Allows the user to delete a set of documents by ids. This should be an array of strings */ PHP_METHOD(SolrClient, deleteByIds) { zval *ids_array = NULL; HashTable *doc_ids = NULL; size_t num_ids = 0; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; zend_bool invalid_param = 0; size_t error_pos = 1, current_position = 1; solr_client_t *client = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; HashPosition loop_pos; if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &ids_array) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); return; } doc_ids = Z_ARRVAL_P(ids_array); num_ids = zend_hash_num_elements(doc_ids); if(!num_ids) { solr_throw_exception(solr_ce_SolrIllegalArgumentException, "The array parameter passed is empty", SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC); return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "delete", &root_node); if (doc_ids->nNumOfElements) { SOLR_HASHTABLE_FOR_LOOP_EX(doc_ids, loop_pos) { zval *id_zval = NULL; id_zval = zend_hash_get_current_data_ex(doc_ids, &loop_pos); if (Z_TYPE_P(id_zval) == IS_STRING && Z_STRLEN_P(id_zval) > 0) { xmlChar *escaped_id_value = xmlEncodeEntitiesReentrant(doc_ptr, (xmlChar *) Z_STRVAL_P(id_zval)); xmlNewChild(root_node, NULL, (xmlChar *) "id", escaped_id_value); xmlFree(escaped_id_value); } else { invalid_param = 1; /* This id is not a valid string */ error_pos = current_position; goto end_doc_ids_loop; } current_position++; } } end_doc_ids_loop : if (invalid_param) { xmlFreeDoc(doc_ptr); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Id number %u is not a valid string", error_pos); return; } if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to retrieve client from HashTable"); return; } xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::deleteByQuery(string query) Allows the user to delete a set of documents matching the query */ PHP_METHOD(SolrClient, deleteByQuery) { solr_char_t *query = NULL; COMPAT_ARG_SIZE_T query_length = 0L; solr_client_t *client = NULL; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; xmlChar *escaped_query_value = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &query, &query_length) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); return; } if (!query_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "The query parameter is not a valid id"); return; } if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to retrieve client from HashTable"); return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "delete", &root_node); escaped_query_value = xmlEncodeEntitiesReentrant(doc_ptr, (xmlChar *) query); xmlNewChild(root_node, NULL, (xmlChar *) "query", escaped_query_value); xmlFree(escaped_query_value); xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success); } /* }}} */ /* {{{ proto SolrQueryResponse SolrClient::getById(string id) Get Document By Id. Utilizes Solr Realtime Get (RTG) */ PHP_METHOD(SolrClient, getById) { solr_client_t *client; solr_char_t *id; COMPAT_ARG_SIZE_T id_len = 0; solr_string_t query_string; int success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &id, &id_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); return; } if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); return; } /* Always reset the URLs before making any request */ solr_client_init_urls(client); solr_string_init(&query_string); solr_string_appends(&query_string, "id=", sizeof("id=")-1); solr_string_appends(&query_string, id, id_len); solr_string_set_ex(&(client->handle.request_body.buffer), query_string.str, query_string.len); if (solr_make_request(client, SOLR_REQUEST_GET) == FAILURE) { /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"get"); success = 0; } object_init_ex(return_value, solr_ce_SolrQueryResponse); solr_set_response_object_properties(solr_ce_SolrQueryResponse, return_value, client, &(client->options.get_url), success); solr_string_free(&query_string); } /* }}} */ /* {{{ proto SolrQueryResponse SolrClient::getByIds(array ids) Get Documents by their Ids. Utilizes Solr Realtime Get (RTG) */ PHP_METHOD(SolrClient, getByIds) { solr_client_t *client; HashTable *ids = NULL; zval *ids_z = NULL; zend_bool invalid_param = 0; solr_string_t query_string; size_t current_position = 0; int success = 1; HashPosition loop_pos; if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &ids_z) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); return; } if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_WARNING, "Internal Error: Cannot fetch client object"); return; } ids = Z_ARRVAL_P(ids_z); if (ids->nNumOfElements < 1) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, 4000, SOLR_FILE_LINE_FUNC, "Invalid parameter: at least 1 ID is required. Passed an empty array.", current_position); } /* Always reset the URLs before making any request */ solr_client_init_urls(client); solr_string_init(&query_string); solr_string_appends(&query_string, "ids=", sizeof("ids=")-1); if (ids->nNumOfElements) { SOLR_HASHTABLE_FOR_LOOP_EX(ids, loop_pos) { zval *id_zv = NULL; id_zv = zend_hash_get_current_data_ex(ids, &loop_pos); if (Z_TYPE_P(id_zv) == IS_STRING && Z_STRLEN_P(id_zv) > 0) { solr_string_appends(&query_string, Z_STRVAL_P(id_zv), Z_STRLEN_P(id_zv)); solr_string_appendc(&query_string, ','); } else { invalid_param = 1; goto solr_getbyids_exit; } current_position++; } } solr_getbyids_exit: if (invalid_param) { solr_string_free(&query_string); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, 4000, SOLR_FILE_LINE_FUNC, "Invalid id at position %ld", current_position); return; } solr_string_remove_last_char(&query_string); solr_string_set_ex(&(client->handle.request_body.buffer), query_string.str, query_string.len); if (solr_make_request(client, SOLR_REQUEST_GET) == FAILURE) { /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"get"); success = 0; } object_init_ex(return_value, solr_ce_SolrQueryResponse); solr_set_response_object_properties(solr_ce_SolrQueryResponse, return_value, client, &(client->options.get_url), success); solr_string_set_ex(&(client->handle.request_body.buffer),(solr_char_t *)0x00, 0); solr_string_free(&query_string); } /* }}} */ /* {{{ proto void SolrClient::setResponseWriter(string responseWriter) Allows the user to specify which response writer to use */ PHP_METHOD(SolrClient, setResponseWriter) { solr_char_t *wt = NULL; COMPAT_ARG_SIZE_T wt_length = 0L; solr_client_t *client = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &wt, &wt_length) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); return; } if (!wt_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "The response writer is not a valid string"); return; } if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to retrieve client from HashTable"); return; } if (solr_is_supported_response_writer((const solr_char_t *) wt, wt_length)) { /* The response writer used to present the response from Solr */ solr_string_set(&(client->options.response_writer), (solr_char_t *) wt, wt_length); } else { php_error_docref(NULL, E_WARNING, "Unsupported response writer %s. This value will be ignored", wt); } } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::deleteByQueries(array queries) Allows the user to delete a set of documents matching the queries specified */ PHP_METHOD(SolrClient, deleteByQueries) { zval *queries_array = NULL; HashTable *doc_queries = NULL; size_t num_queries = 0; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; zend_bool invalid_param = 0; size_t error_pos, current_position = 1; solr_client_t *client = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; HashPosition loop_pos; if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &queries_array) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); return; } doc_queries = Z_ARRVAL_P(queries_array); num_queries = zend_hash_num_elements(doc_queries); if(!num_queries) { php_error_docref(NULL, E_WARNING, "The array parameter passed is empty"); return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "delete", &root_node); SOLR_HASHTABLE_FOR_LOOP_EX(doc_queries, loop_pos) { zval *query_zval = NULL; query_zval = zend_hash_get_current_data_ex(doc_queries, &loop_pos); if (Z_TYPE_P(query_zval) == IS_STRING && Z_STRLEN_P(query_zval)) { xmlChar *escaped_query_value = xmlEncodeEntitiesReentrant(doc_ptr, (xmlChar *) Z_STRVAL_P(query_zval)); xmlNewChild(root_node, NULL, (xmlChar *) "query", escaped_query_value); xmlFree(escaped_query_value); } else { invalid_param = 1; /* This query is not a valid string */ error_pos = current_position; goto end_doc_queries_loop; } current_position++; } end_doc_queries_loop : if (invalid_param) { xmlFreeDoc(doc_ptr); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Query number %u is not a valid query string", error_pos); return; } if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to retrieve client from HashTable"); return; } xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::optimize([string maxSegments [, bool softCommit [, bool waitSearcher]]) Sends an optimize XML request to the server. */ PHP_METHOD(SolrClient, optimize) { zend_bool softCommit = 0, waitSearcher = 1; char *maxSegments = "1"; int maxSegmentsLen = sizeof("1")-1; char *softCommitValue, *waitSearcherValue; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; solr_client_t *client = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|sbb", &maxSegments, &maxSegmentsLen, &softCommit, &waitSearcher) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); return; } softCommitValue = (softCommit)? "true" : "false"; waitSearcherValue = (waitSearcher)? "true" : "false"; doc_ptr = solr_xml_create_xml_doc((xmlChar *) "optimize", &root_node); xmlNewProp(root_node, (xmlChar *) "maxSegments", (xmlChar *) maxSegments); xmlNewProp(root_node, (xmlChar *) "softCommit", (xmlChar *) softCommitValue); xmlNewProp(root_node, (xmlChar *) "waitSearcher", (xmlChar *) waitSearcherValue); if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to retrieve client from HashTable"); return; } xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::commit( [bool softCommit [, bool waitSearcher [, bool expungeDeletes]]]) Sends a commit XML request to the server. */ PHP_METHOD(SolrClient, commit) { zend_bool softCommit = 0, waitSearcher = 1, expungeDeletes = 0; char *softCommitValue, *waitSearcherValue, *expungeDeletesValue; xmlNode *root_node = NULL; xmlDoc *doc_ptr = NULL; solr_client_t *client = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; zend_bool success = 1; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|bbb", &softCommit, &waitSearcher, &expungeDeletes) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); return; } softCommitValue = (softCommit)? "true" : "false"; waitSearcherValue = (waitSearcher)? "true" : "false"; expungeDeletesValue = (expungeDeletes)? "true": "false"; doc_ptr = solr_xml_create_xml_doc((xmlChar *) "commit", &root_node); xmlNewProp(root_node, (xmlChar *) "softCommit", (xmlChar *) softCommitValue); xmlNewProp(root_node, (xmlChar *) "waitSearcher", (xmlChar *) waitSearcherValue); xmlNewProp(root_node, (xmlChar *) "expungeDeletes", (xmlChar *) expungeDeletesValue); if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to retrieve client from HashTable"); return; } xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success); } /* }}} */ /* {{{ proto SolrUpdateResponse SolrClient::rollback(void) Sends a rollback XML request to the server. */ PHP_METHOD(SolrClient, rollback) { xmlNode *root_node = NULL; zend_bool success = 1; xmlDoc *doc_ptr = NULL; solr_client_t *client = NULL; int format = 1; int size = 0; xmlChar *request_string = NULL; doc_ptr = solr_xml_create_xml_doc((xmlChar *) "rollback", &root_node); if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to retrieve client from HashTable"); return; } xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, &request_string, &size, "UTF-8", format); /* The XML request we are sending to Solr */ solr_string_set(&(client->handle.request_body.buffer), (solr_char_t *) request_string, size); xmlFree(request_string); xmlFreeDoc(doc_ptr); /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_UPDATE) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"update"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrUpdateResponse); solr_set_response_object_properties(solr_ce_SolrUpdateResponse, return_value, client, &(client->options.update_url), success); } /* }}} */ /* {{{ proto SolrPingResponse SolrClient::ping() Sends a HEAD request to check if the server is still up and running. */ PHP_METHOD(SolrClient, ping) { solr_client_t *client = NULL; zend_bool success = 1; /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to retrieve client"); return; } /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_PING) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"ping"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrPingResponse); solr_set_response_object_properties(solr_ce_SolrPingResponse, return_value, client, &(client->options.ping_url), success); } /* }}} */ /* {{{ proto SolrGenericResponse SolrClient::threads() Sends a request to get info about threads. */ PHP_METHOD(SolrClient, threads) { zend_bool success = 1; solr_client_t *client = NULL; /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to retrieve client"); return; } /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_THREADS) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"threads"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrGenericResponse); solr_set_response_object_properties(solr_ce_SolrGenericResponse, return_value, client, &(client->options.thread_url), success); } /* }}} */ /* {{{ proto SolrGenericResponse SolrClient::info() Sends a request to get system info. */ PHP_METHOD(SolrClient, system) { zend_bool success = 1; solr_client_t *client = NULL; /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to retrieve client"); return; } /* Always reset the URLs before making any request */ solr_client_init_urls(client); /* Make the HTTP request to the Solr instance */ if (solr_make_request(client, SOLR_REQUEST_SYSTEM) == FAILURE) { success = 0; /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception (omars) */ HANDLE_SOLR_SERVER_ERROR(client,"system"); /* SOLR_SHOW_CURL_WARNING; commented by: omars */ } object_init_ex(return_value, solr_ce_SolrGenericResponse); solr_set_response_object_properties(solr_ce_SolrGenericResponse, return_value, client, &(client->options.system_url), success); } /* }}} */ /* {{{ proto array SolrClient::getOptions() Returns all the options for this client. */ PHP_METHOD(SolrClient, getOptions) { solr_client_t *client = NULL; solr_client_options_t *options = NULL; /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to retrieve client"); return; } options = &(client->options); array_init(return_value); add_assoc_long(return_value, "timeout", options->timeout); add_assoc_bool(return_value, "secure", (int) options->secure); add_assoc_stringl(return_value, "hostname", options->hostname.str, options->hostname.len); add_assoc_stringl(return_value, "wt", options->response_writer.str, options->response_writer.len); add_assoc_long(return_value, "port", options->host_port); add_assoc_stringl(return_value, "proxy_host", options->proxy_hostname.str, options->proxy_hostname.len); add_assoc_long(return_value, "proxy_port", options->proxy_port); add_assoc_stringl(return_value, "path", options->path.str, options->path.len); add_assoc_stringl(return_value, "http_auth", options->http_auth_credentials.str, options->http_auth_credentials.len); add_assoc_stringl(return_value, "proxy_auth", options->proxy_auth_credentials.str, options->proxy_auth_credentials.len); add_assoc_bool(return_value, "ssl_verify_peer", (int) options->ssl_verify_peer); add_assoc_long(return_value, "ssl_verify_host", options->ssl_verify_host); add_assoc_stringl(return_value, "ssl_cert", options->ssl_cert.str, options->ssl_cert.len); add_assoc_stringl(return_value, "ssl_key", options->ssl_key.str, options->ssl_key.len); add_assoc_stringl(return_value, "ssl_keypassword", options->ssl_keypassword.str, options->ssl_keypassword.len); add_assoc_stringl(return_value, "ssl_cainfo", options->ssl_cainfo.str, options->ssl_cainfo.len); add_assoc_stringl(return_value, "ssl_capath", options->ssl_capath.str, options->ssl_capath.len); } /* }}} */ /* {{{ proto string SolrClient::getDebug() Returns all debug data captured in the process of making the request. */ PHP_METHOD(SolrClient, getDebug) { solr_client_t *client = NULL; solr_curl_t *handle = NULL; /* Retrieve the client entry */ if (solr_fetch_client_entry(getThis(), &client) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to retrieve client"); return; } handle = &(client->handle); if (!handle->debug_data_buffer.len) { RETURN_NULL(); } RETVAL_STRINGL(handle->debug_data_buffer.str, handle->debug_data_buffer.len); } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/php_solr_collapse_function.c000066400000000000000000000246671374041537100246120ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: | | Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_solr.h" /* {{{ proto void SolrFunction::__construct([string field]) Constructor. */ PHP_METHOD(SolrCollapseFunction, __construct) { long int index = SOLR_UNIQUE_FUNCTION_INDEX(); uint32_t nSize = SOLR_INITIAL_HASH_TABLE_SIZE; solr_function_t *solr_function_dest = NULL; zval *objptr = getThis(); #ifdef PHP_7 solr_function_dest = pemalloc(sizeof(solr_function_t), SOLR_FUNCTIONS_PERSISTENT); #endif solr_char_t *param_name = (solr_char_t *)"field"; COMPAT_ARG_SIZE_T param_name_len = sizeof("field"); solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; if ((solr_function_dest = zend_hash_index_update_ptr(SOLR_GLOBAL(functions),index,(void *) solr_function_dest)) == NULL) { php_error_docref(NULL, E_ERROR, "Error while registering query parameters in HashTable"); return ; } zend_update_property_long(solr_ce_SolrCollapseFunction, OBJ_FOR_PROP(objptr), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, index); solr_function_dest->function_index = index; solr_function_dest->name_length = strlen("collapse"); solr_function_dest->name = (solr_char_t *)"collapse"; /* Allocated memory for the params HashTable using fast cache for HashTables */ ALLOC_HASHTABLE(solr_function_dest->params); zend_hash_init(solr_function_dest->params, nSize, NULL, (dtor_func_t) solr_destroy_solr_string, SOLR_FUNCTIONS_PERSISTENT); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_ERROR, "Error Parsing Parameters"); return; } if (field_name_len > 0 ) { solr_solrfunc_update_string(getThis(), param_name, param_name_len, field_name, field_name_len); } Z_OBJ_HT_P(getThis()) = &solr_collapse_function_object_handlers; } /* }}} */ /* {{{ proto void SolrFunction::__destruct(void) Destructor. */ PHP_METHOD(SolrCollapseFunction, __destruct) { solr_function_t *function = NULL; /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_function_entry(getThis(), &function) == SUCCESS ) { zend_hash_index_del(SOLR_GLOBAL(functions), function->function_index); } return; } /* {{{ proto string SolrFunction::setField(string field) Set the field that is being collapsed on. The field must be a single valued String, Int or Float. */ PHP_METHOD(SolrCollapseFunction, setField) { solr_char_t *key = "field", *arg; COMPAT_ARG_SIZE_T key_len = sizeof("field"), arg_len; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) { RETURN_NULL(); } if (solr_solrfunc_update_string(getThis(), key, key_len, (solr_char_t *)arg, arg_len) == FAILURE) { php_error_docref(NULL, E_ERROR, "Error assigning field"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto string SolrFunction::getField(void) Get Collapse Field */ PHP_METHOD(SolrCollapseFunction, getField) { solr_char_t *key = "field"; COMPAT_ARG_SIZE_T key_len = sizeof("field"); solr_solrfunc_display_string(getThis(), key, key_len, &return_value); } /* }}} */ /* {{{ proto string SolrFunction::setMin(string value) Selects the group heads by the min value of a numeric field or function query. */ PHP_METHOD(SolrCollapseFunction, setMin) { solr_char_t *key = "min", *arg; COMPAT_ARG_SIZE_T key_len = sizeof("min"), arg_len; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) { RETURN_NULL(); } if (solr_solrfunc_update_string(getThis(), key, key_len, (solr_char_t *)arg, arg_len) == FAILURE) { php_error_docref(NULL, E_ERROR, "Error assigning field"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto string SolrFunction::setMax(string value) Selects the group heads by the max value of a numeric field or function query. */ PHP_METHOD(SolrCollapseFunction, setMax) { solr_char_t *key = "max", *arg; COMPAT_ARG_SIZE_T key_len = sizeof("max"), arg_len; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) { RETURN_NULL(); } if (solr_solrfunc_update_string(getThis(), key, key_len, (solr_char_t *)arg, arg_len) == FAILURE) { php_error_docref(NULL, E_ERROR, "Error assigning field"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto string SolrFunction::getMin(void) Get min parameter */ PHP_METHOD(SolrCollapseFunction, getMin) { solr_char_t *key = "min"; COMPAT_ARG_SIZE_T key_len = sizeof("min"); solr_solrfunc_display_string(getThis(), key, key_len, &return_value); } /* }}} */ /* {{{ proto string SolrFunction::getMax(void) Get max parameter */ PHP_METHOD(SolrCollapseFunction, getMax) { solr_char_t *key = "max"; COMPAT_ARG_SIZE_T key_len = sizeof("max"); solr_solrfunc_display_string(getThis(), key, key_len, &return_value); } /* }}} */ /* {{{ proto string SolrFunction::setSize(void) Sets the initial size of the collapse data structures when collapsing on a numeric field only */ PHP_METHOD(SolrCollapseFunction, setSize) { solr_char_t *key = "size", *arg; COMPAT_ARG_SIZE_T key_len = sizeof("size"), arg_len; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) { RETURN_NULL(); } if (solr_solrfunc_update_string(getThis(), key, key_len, (solr_char_t *)arg, arg_len) == FAILURE) { php_error_docref(NULL, E_ERROR, "Error assigning field"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto string SolrFunction::getSize(void) Get size parameter */ PHP_METHOD(SolrCollapseFunction, getSize) { solr_char_t *key = "size"; COMPAT_ARG_SIZE_T key_len = sizeof("size"); solr_solrfunc_display_string(getThis(), key, key_len, &return_value); } /* }}} */ /* {{{ proto string SolrFunction::setHint(void) Set collapse hint Currently there is only one hint available "top_fc", which stands for top level FieldCache */ PHP_METHOD(SolrCollapseFunction, setHint) { solr_char_t *key = "hint", *arg; COMPAT_ARG_SIZE_T key_len = sizeof("hint"), arg_len; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) { RETURN_NULL(); } if (solr_solrfunc_update_string(getThis(), key, key_len, (solr_char_t *)arg, arg_len) == FAILURE) { php_error_docref(NULL, E_ERROR, "Error assigning field"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto string SolrFunction::getHint(void) Get Hint */ PHP_METHOD(SolrCollapseFunction, getHint) { solr_char_t *key = "hint"; COMPAT_ARG_SIZE_T key_len = sizeof("hint"); solr_solrfunc_display_string(getThis(), key, key_len, &return_value); } /* }}} */ /* {{{ proto string SolrFunction::setNullPolicy(void) Sets the NULL Policy. Accepts ignore, expand, or collapse */ PHP_METHOD(SolrCollapseFunction, setNullPolicy) { solr_char_t *key = "nullPolicy", *arg; COMPAT_ARG_SIZE_T key_len = sizeof("nullPolicy"), arg_len; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) { RETURN_NULL(); } if (solr_solrfunc_update_string(getThis(), key, key_len, (solr_char_t *)arg, arg_len) == FAILURE) { php_error_docref(NULL, E_ERROR, "Error assigning field"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto string SolrFunction::getNullPolicy(void) Get NullPolicy */ PHP_METHOD(SolrCollapseFunction, getNullPolicy) { solr_char_t *key = "nullPolicy"; COMPAT_ARG_SIZE_T key_len = sizeof("nullPolicy"); solr_solrfunc_display_string(getThis(), key, key_len, &return_value); } /* }}} */ /* {{{ proto string SolrFunction::__toString(void) String value of the function object */ PHP_METHOD(SolrCollapseFunction, __toString) { solr_function_t *collapse_func; solr_string_t *buffer = NULL; if(solr_fetch_function_entry(getThis(), &collapse_func) == FAILURE) { RETURN_NULL(); } buffer = (solr_string_t *)emalloc(sizeof(solr_string_t)); memset(buffer, 0, sizeof(solr_string_t)); solr_solrfunc_to_string(collapse_func, &buffer); ZVAL_STRINGL(return_value, buffer->str, buffer->len); solr_string_free(buffer); efree(buffer); } /* }}} */ /* {{{ proto SolrClient::__sleep(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrCollapseFunction, __sleep) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1001, SOLR_FILE_LINE_FUNC, "Serialization of SolrCollapseFunction objects is currently not supported"); } /* }}} */ /* {{{ proto SolrClient::__wakeup(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrCollapseFunction, __wakeup) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1001, SOLR_FILE_LINE_FUNC, "Unserialization of SolrCollapseFunction objects is currently not supported"); } /* }}} */ /* {{{ throw exception on cloning (clone handler) */ #if PHP_VERSION_ID < 80000 zend_object* solr_collapse_function_object_handler_clone(zval *object) #else zend_object* solr_collapse_function_object_handler_clone(zend_object *object) #endif { zend_object *fake; fake = zend_objects_new(zend_standard_class_def); solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_4001, SOLR_FILE_LINE_FUNC, "Cloning of SolrCollapseFunction objects is currently not supported"); return fake; } /* }}} */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/php_solr_dismax_query.c000066400000000000000000001056451374041537100236110ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_solr.h" /* extern function_entry; */ zend_class_entry *solr_ce_SolrDixMaxQuery; ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_zero_arg_info, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_addQueryField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, field) ZEND_ARG_INFO(0, boost) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery__construct_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 0) ZEND_ARG_INFO(0, q) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery__queryAlt_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, q) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_remove_field_arg, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, field) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_addPhraseField_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(0, field) ZEND_ARG_INFO(0, boost) ZEND_ARG_INFO(0, slop) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_addBoostQuery_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 2) ZEND_ARG_INFO(0, field) ZEND_ARG_INFO(0, value) ZEND_ARG_INFO(0, boost) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_setPhraseSlop_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, slop) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_setBoostFunction_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, function) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_setMinimumMatch_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_setTieBreaker_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, tieBreaker) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_setFields_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, fields) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_uf_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, field) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(SolrDisMaxQuery_setufs_args, SOLR_ARG_PASS_REMAINING_BY_REF_FALSE, SOLR_METHOD_RETURN_REFERENCE_FALSE, 1) ZEND_ARG_INFO(0, fields) ZEND_END_ARG_INFO() static zend_function_entry solr_dismax_query_methods[] = { PHP_ME(SolrDisMaxQuery, __construct, SolrDisMaxQuery__construct_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setQueryAlt, SolrDisMaxQuery__queryAlt_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, addQueryField, SolrDisMaxQuery_addQueryField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, removeQueryField, SolrDisMaxQuery_remove_field_arg, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, addPhraseField, SolrDisMaxQuery_addPhraseField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, removePhraseField, SolrDisMaxQuery_remove_field_arg, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setPhraseFields, SolrDisMaxQuery_setFields_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setPhraseSlop, SolrDisMaxQuery_setPhraseSlop_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setQueryPhraseSlop, SolrDisMaxQuery_setPhraseSlop_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setBoostQuery, SolrDisMaxQuery__queryAlt_args , ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, addBoostQuery, SolrDisMaxQuery_addBoostQuery_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, removeBoostQuery, SolrDisMaxQuery_remove_field_arg, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setBoostFunction, SolrDisMaxQuery_setBoostFunction_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setMinimumMatch, SolrDisMaxQuery_setMinimumMatch_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setTieBreaker, SolrDisMaxQuery_setTieBreaker_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, useDisMaxQueryParser, SolrDisMaxQuery_zero_arg_info, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, useEDisMaxQueryParser, SolrDisMaxQuery_zero_arg_info, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setBigramPhraseFields, SolrDisMaxQuery_setFields_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, addBigramPhraseField, SolrDisMaxQuery_addPhraseField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, removeBigramPhraseField, SolrDisMaxQuery_remove_field_arg, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setBigramPhraseSlop, SolrDisMaxQuery_setPhraseSlop_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setTrigramPhraseFields, SolrDisMaxQuery_setFields_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, addTrigramPhraseField, SolrDisMaxQuery_addPhraseField_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, removeTrigramPhraseField, SolrDisMaxQuery_remove_field_arg, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setTrigramPhraseSlop, SolrDisMaxQuery_setPhraseSlop_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, addUserField, SolrDisMaxQuery_uf_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, removeUserField, SolrDisMaxQuery_uf_args, ZEND_ACC_PUBLIC) PHP_ME(SolrDisMaxQuery, setUserFields, SolrDisMaxQuery_setufs_args, ZEND_ACC_PUBLIC) PHP_FE_END }; void init_solr_dismax_query(void){ zend_class_entry ce; INIT_CLASS_ENTRY(ce, "SolrDisMaxQuery", solr_dismax_query_methods); solr_ce_SolrDixMaxQuery = zend_register_internal_class_ex( &ce, solr_ce_SolrQuery ); } /* {{{ proto SolrQuery::__construct([string q]) Constructor for SolrDisMaxQuery */ PHP_METHOD(SolrDisMaxQuery, __construct) { zval *param_value = NULL; solr_char_t *deftype_param_name = "defType", *deftype_param_value = SOLR_DISMAX_DEFAULT_PARSER; COMPAT_ARG_SIZE_T deftype_param_name_len = strlen("defType"), deftype_param_value_len = strlen(SOLR_DISMAX_DEFAULT_PARSER); if(zend_parse_parameters(ZEND_NUM_ARGS(), "|z", ¶m_value) == FAILURE){ php_error_docref(NULL, E_ERROR, "Invalid parameters"); RETURN_NULL(); } if(param_value == NULL){ zend_call_method_with_0_params(OBJ_FOR_PROP(getThis()), solr_ce_SolrDixMaxQuery, &solr_ce_SolrDixMaxQuery->parent->constructor, "__construct", NULL); }else{ zend_call_method_with_1_params(OBJ_FOR_PROP(getThis()), solr_ce_SolrDixMaxQuery, &solr_ce_SolrDixMaxQuery->parent->constructor, "__construct", NULL, param_value); } solr_add_or_set_normal_param( getThis(), deftype_param_name, deftype_param_name_len, deftype_param_value, deftype_param_value_len, 0 ); } /* }}} */ /* {{{ proto SolrQuery::useDisMaxQueryParser() Switch Query Parser to dismax */ PHP_METHOD(SolrDisMaxQuery, useDisMaxQueryParser) { solr_char_t *param_name = "defType", *param_value = "dismax"; COMPAT_ARG_SIZE_T param_name_len = strlen("defType"), param_value_len = strlen("dismax"), result=1; result = solr_add_or_set_normal_param( getThis(), param_name, param_name_len, param_value, param_value_len, 0 ); if(result != SUCCESS) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrQuery::useDisMaxQueryParser() Switch Query Parser to edismax */ PHP_METHOD(SolrDisMaxQuery, useEDisMaxQueryParser) { solr_char_t *pname = "defType", *param_value = "edismax"; COMPAT_ARG_SIZE_T pname_len = strlen("defType"), param_value_len = strlen("edismax"), result=1; result = solr_add_or_set_normal_param( getThis(), pname, pname_len, param_value, param_value_len, 0 ); if(result != SUCCESS) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrQuery::setQueryAlt(string q) SetQueryAlt uses q.alt if the q param is not defined */ PHP_METHOD(SolrDisMaxQuery, setQueryAlt) { solr_char_t *pname = "q.alt"; COMPAT_ARG_SIZE_T pname_len = sizeof("q.alt")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0, set_param_return = 0; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE){ php_error_docref(NULL, E_ERROR, "Invalid parameters"); RETURN_NULL(); } set_param_return = solr_add_or_set_normal_param(getThis(), pname, pname_len, param_value, param_value_len, 0); if(set_param_return == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrQuery::addQueryField(string field[, bool boost]) SetQueryAlt uses q.alt if the q param is not defined */ PHP_METHOD(SolrDisMaxQuery, addQueryField) { solr_char_t *pname = "qf"; COMPAT_ARG_SIZE_T pname_len = sizeof("qf")-1; solr_char_t *boost_str = NULL; solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; int add_result = 0; solr_char_t *delimiter = " "; solr_char_t *separator = "^"; solr_char_t *separator_override=""; zval * boost = NULL; int boost_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s|z", &field_name, &field_name_len, &boost) == FAILURE) { php_error_docref(NULL, E_ERROR, "Invalid parameters"); RETURN_NULL(); } if(boost != NULL) { convert_to_string(boost); boost_str = Z_STRVAL_P(boost); boost_len = Z_STRLEN_P(boost); add_result = solr_add_arg_list_param( getThis(), pname, pname_len, field_name, field_name_len, boost_str, boost_len, *delimiter, *separator ); }else{ boost_str = ""; add_result = solr_add_arg_list_param_ex( getThis(), pname, pname_len, field_name, field_name_len, boost_str, boost_len, *delimiter, *separator, *separator_override ); } if(add_result == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::removeQueryField(string field) Removes a sort field from the sort parameter. */ PHP_METHOD(SolrDisMaxQuery, removeQueryField) { solr_char_t *pname = (solr_char_t*) "qf"; COMPAT_ARG_SIZE_T pname_len = sizeof("qf")-1; solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value( getThis(), pname, pname_len, field_name, field_name_len ); SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::addPhraseField(string field, float boost [, float slop]) * Adds a new phrase field */ PHP_METHOD(SolrDisMaxQuery, addPhraseField) { solr_char_t *pname = (solr_char_t*) "pf"; COMPAT_ARG_SIZE_T pname_len = sizeof("pf")-1; solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; zval *boost = NULL; zval *slop = NULL; solr_char_t *boost_str = NULL; solr_char_t *slop_str = NULL; int add_result = 0; char * separator = "^"; solr_char_t * delimiter_override = ""; solr_string_t boost_slop_buffer; if(zend_parse_parameters(ZEND_NUM_ARGS(), "sz|z", &field_name, &field_name_len, &boost, &slop) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if(boost != NULL) { convert_to_string(boost); boost_str = Z_STRVAL_P(boost); } if (slop != NULL) { convert_to_string(slop); slop_str = Z_STRVAL_P(slop); } if (slop != NULL && boost !=NULL) { delimiter_override = "~"; memset(&boost_slop_buffer, 0, sizeof(solr_string_t)); solr_string_appends(&boost_slop_buffer, (solr_char_t *)slop_str , Z_STRLEN_P(slop)); solr_string_appendc(&boost_slop_buffer, '^'); solr_string_appends(&boost_slop_buffer, boost_str , Z_STRLEN_P(boost)); add_result = solr_add_arg_list_param_ex( getThis(), pname, pname_len, field_name, field_name_len, boost_slop_buffer.str, boost_slop_buffer.len, ' ', *separator, *delimiter_override ); solr_string_free(&boost_slop_buffer); } else { add_result = solr_add_arg_list_param( getThis(), pname, pname_len, field_name, field_name_len, boost_str, Z_STRLEN_P(boost),' ',*separator ); } if(add_result == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::removeQueryField(string field) Removes a phrase field from pf. */ PHP_METHOD(SolrDisMaxQuery, removePhraseField) { solr_char_t *pname = (solr_char_t*) "pf"; COMPAT_ARG_SIZE_T pname_len = sizeof("pf")-1; solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value( getThis(), pname, pname_len, field_name, field_name_len ); SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrQuery::setPhraseFields(string fields) setPhraseFields uses pf parameter */ PHP_METHOD(SolrDisMaxQuery, setPhraseFields) { solr_char_t *pname = "pf"; COMPAT_ARG_SIZE_T pname_len = sizeof("pf")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; solr_param_t *param = NULL; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } /* if the parameter is registered with a different type, remove it first */ if(solr_param_find(getThis(), pname, pname_len, ¶m) == SUCCESS && param->type != SOLR_PARAM_TYPE_NORMAL) { php_error_docref(NULL, E_NOTICE, "Parameter %s value(s) was overwritten by this call", pname); solr_delete_solr_parameter(getThis(), pname, pname_len); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0); if(add_result == FAILURE) { php_error_docref(NULL, E_WARNING, "Unable to add parameter %s", pname); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setPhraseSlop(integer slop) sets Phrase Slop ps argument. */ PHP_METHOD(SolrDisMaxQuery, setPhraseSlop) { solr_char_t *pname = (solr_char_t*) "ps"; COMPAT_ARG_SIZE_T pname_len = sizeof("ps")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0); if(add_result == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter value"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setQueryPhraseSlop(integer slop) sets QueryPhrase Slop qs argument. */ PHP_METHOD(SolrDisMaxQuery, setQueryPhraseSlop) { solr_char_t *pname = (solr_char_t*) "qs"; COMPAT_ARG_SIZE_T pname_len = sizeof("qs")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0); if(add_result == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter value"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setBoostQuery(string q) sets Boost Query bq parameter. */ PHP_METHOD(SolrDisMaxQuery, setBoostQuery) { solr_char_t *pname = (solr_char_t*) "bq"; COMPAT_ARG_SIZE_T pname_len = sizeof("bq")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; solr_param_t *param = NULL; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } /* if the parameter is registered with a different type, remove it first */ if(solr_param_find(getThis(), pname, pname_len, ¶m) == SUCCESS && param->type != SOLR_PARAM_TYPE_NORMAL) { php_error_docref(NULL, E_NOTICE, "Parameter %s value(s) was overwritten by this call", pname); solr_delete_solr_parameter(getThis(), pname, pname_len); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0); if(add_result == FAILURE) { php_error_docref(NULL, E_WARNING, "Unable to add parameter %s", pname); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::addBoostQueryField(string field, string value [, float boost]) * Adds a new boost query field using the bq parameter */ PHP_METHOD(SolrDisMaxQuery, addBoostQuery) { solr_char_t *pname = (solr_char_t*) "bq"; COMPAT_ARG_SIZE_T pname_len = sizeof("bq")-1; solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; zval *boost = NULL; solr_char_t *field_value = NULL; COMPAT_ARG_SIZE_T field_value_len = 0; solr_char_t *boost_str = NULL; int add_result = 0; char * separator = ":"; solr_char_t *boost_separator = "^"; solr_string_t *value_boost_str = NULL; solr_param_t *param = NULL; if(zend_parse_parameters(ZEND_NUM_ARGS(), "ss|z", &field_name, &field_name_len, &field_value, &field_value_len, &boost) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } /* if the parameter is registered with a different type, remove it first */ if(solr_param_find(getThis(), pname, pname_len, ¶m) == SUCCESS && param->type != SOLR_PARAM_TYPE_ARG_LIST) { php_error_docref(NULL, E_NOTICE, "Parameter %s value(s) was overwritten by this call", pname); solr_delete_solr_parameter(getThis(), pname, pname_len); } if(boost != NULL) { convert_to_string(boost); boost_str = Z_STRVAL_P(boost); } if(boost !=NULL) { value_boost_str = emalloc(sizeof(solr_string_t)); memset(value_boost_str, 0, sizeof(solr_string_t)); solr_string_appends(value_boost_str, field_value, field_value_len); solr_string_appendc(value_boost_str, *boost_separator); solr_string_appends(value_boost_str, boost_str, Z_STRLEN_P(boost)); add_result = solr_add_arg_list_param( getThis(),pname, pname_len, field_name, field_name_len, value_boost_str->str, value_boost_str->len,' ',*separator ); solr_string_free(value_boost_str); efree(value_boost_str); }else{ add_result = solr_add_arg_list_param( getThis(),pname, pname_len, field_name, field_name_len, field_value, field_value_len,' ',*separator ); } if(add_result == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::removeBoostQuery(string field) Removes a sort field from the sort parameter. */ PHP_METHOD(SolrDisMaxQuery, removeBoostQuery) { solr_char_t *pname = (solr_char_t*) "bq"; COMPAT_ARG_SIZE_T pname_len = sizeof("bq")-1; solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value( getThis(), pname, pname_len, field_name, field_name_len ); SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setBoostFunction(string function) sets Boost Query bf parameter. */ PHP_METHOD(SolrDisMaxQuery, setBoostFunction) { solr_char_t *pname = (solr_char_t*) "bf"; COMPAT_ARG_SIZE_T pname_len = sizeof("bf")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0); if(add_result == FAILURE) { php_error_docref(NULL, E_WARNING, "Unable to add parameter %s", pname); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setMinimumMatch(string value) sets Minimum Match (mm) parameter. */ PHP_METHOD(SolrDisMaxQuery, setMinimumMatch) { solr_char_t *pname = (solr_char_t*) "mm"; COMPAT_ARG_SIZE_T pname_len = sizeof("mm")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0); if(add_result == FAILURE) { php_error_docref(NULL, E_WARNING, "Unable to add parameter %s", pname); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setTieBreaker(float tieBreaker) sets Tie Breaker (tie) parameter. */ PHP_METHOD(SolrDisMaxQuery, setTieBreaker) { solr_char_t *pname = (solr_char_t*) "tie"; COMPAT_ARG_SIZE_T pname_len = sizeof("tie")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0); if(add_result == FAILURE) { php_error_docref(NULL, E_WARNING, "Unable to add parameter %s", pname); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setBigramPhraseFields(string bigramFields) setBigramPhraseFields uses pf2 parameter */ PHP_METHOD(SolrDisMaxQuery, setBigramPhraseFields) { solr_char_t *pname = "pf2"; COMPAT_ARG_SIZE_T pname_len = sizeof("pf2")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; int set_param_return = 0; solr_param_t *param = NULL; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE){ php_error_docref(NULL, E_ERROR, "Invalid parameters"); RETURN_NULL(); } /* if the parameter is registered with a different type, remove it first */ if(solr_param_find(getThis(), pname, pname_len, ¶m) == SUCCESS && param->type != SOLR_PARAM_TYPE_NORMAL) { php_error_docref(NULL, E_NOTICE, "Parameter %s value(s) was overwritten by this call", pname); solr_delete_solr_parameter(getThis(), pname, pname_len); } set_param_return = solr_add_or_set_normal_param(getThis(), pname, pname_len, param_value, param_value_len, 0); if(set_param_return == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::addBigramPhraseField(string field, float boost [, float slop]) * Adds a new bigram phrase field (pf2) to the list of fields */ PHP_METHOD(SolrDisMaxQuery, addBigramPhraseField) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; zval *boost = NULL; zval *slop = NULL; int add_result = 0; if(zend_parse_parameters(ZEND_NUM_ARGS(), "sz|z", &field_name, &field_name_len, &boost, &slop) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = add_phrase_field(getThis(), "pf2", boost, slop, field_name, field_name_len); if(add_result == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::removeQueryField(string field) Removes a bigram phrase field. */ PHP_METHOD(SolrDisMaxQuery, removeBigramPhraseField) { solr_char_t *pname = (solr_char_t*) "pf2"; COMPAT_ARG_SIZE_T pname_len = sizeof("pf2")-1; solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value( getThis(), pname, pname_len, field_name, field_name_len ); SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setBigramPhraseSlop(integer slop) sets Bigram Phrase Slop ps argument. */ PHP_METHOD(SolrDisMaxQuery, setBigramPhraseSlop) { solr_char_t *pname = (solr_char_t*) "ps2"; COMPAT_ARG_SIZE_T pname_len = sizeof("ps2")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0); if(add_result == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter value"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setTrigramPhraseFields(string fields) setTrigramPhraseFields uses pf3 parameter */ PHP_METHOD(SolrDisMaxQuery, setTrigramPhraseFields) { solr_char_t *pname = "pf3"; COMPAT_ARG_SIZE_T pname_len = sizeof("pf3")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; int set_param_return = 0; solr_param_t *param = NULL; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE){ php_error_docref(NULL, E_ERROR, "Invalid parameters"); RETURN_NULL(); } /* if the parameter is registered with a different type, remove it first */ if(solr_param_find(getThis(), pname, pname_len, ¶m) == SUCCESS && param->type != SOLR_PARAM_TYPE_NORMAL) { php_error_docref(NULL, E_NOTICE, "Parameter %s value(s) was overwritten by this call", pname); solr_delete_solr_parameter(getThis(), pname, pname_len); } set_param_return = solr_add_or_set_normal_param(getThis(), pname, pname_len, param_value, param_value_len, 0); if(set_param_return == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::addTrigramPhraseField(string field, float boost [, float slop]) * Adds a new trigram phrase field (pf3) to the list of fields */ PHP_METHOD(SolrDisMaxQuery, addTrigramPhraseField) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; zval *boost = NULL; zval *slop = NULL; int add_result = 0; if(zend_parse_parameters(ZEND_NUM_ARGS(), "sz|z", &field_name, &field_name_len, &boost, &slop) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = add_phrase_field(getThis(), "pf3", boost, slop, field_name, field_name_len); if(add_result == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::removeQueryField(string field) Removes a trigram phrase field. */ PHP_METHOD(SolrDisMaxQuery, removeTrigramPhraseField) { solr_char_t *pname = (solr_char_t*) "pf3"; COMPAT_ARG_SIZE_T pname_len = sizeof("pf3")-1; solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value( getThis(), pname, pname_len, field_name, field_name_len ); SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setTrigramPhraseSlop(integer slop) sets Trigram Phrase Slop ps3 argument. */ PHP_METHOD(SolrDisMaxQuery, setTrigramPhraseSlop) { solr_char_t *pname = (solr_char_t*) "ps3"; COMPAT_ARG_SIZE_T pname_len = sizeof("ps3")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_or_set_normal_param(getThis(), pname, pname_len, pvalue, pvalue_len, 0); if(add_result == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter value"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::addUserField(string field) Adds a userfield rule to uf parameter. */ PHP_METHOD(SolrDisMaxQuery, addUserField) { solr_char_t *pname = (solr_char_t*) "uf"; COMPAT_ARG_SIZE_T pname_len = sizeof("uf")-1; int add_result = -1; solr_char_t *pvalue = NULL; COMPAT_ARG_SIZE_T pvalue_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", &pvalue, &pvalue_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } add_result = solr_add_simple_list_param_ex(getThis(), pname, pname_len, pvalue, pvalue_len, " "); if(add_result == FAILURE) { php_error_docref(NULL, E_WARNING, "Unable to add user field: Invalid parameter value"); RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::removeUserField(string field) Removes a userfield rule from uf parameter. */ PHP_METHOD(SolrDisMaxQuery, removeUserField) { solr_char_t *pname = (solr_char_t*) "uf"; COMPAT_ARG_SIZE_T pname_len = sizeof("uf")-1; solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_simple_list_param_value(getThis(), pname, pname_len, field_name, field_name_len); SOLR_RETURN_THIS(); } /* }}} */ /* {{{ proto SolrDisMaxQuery SolrDisMaxQuery::setUserFields(string fields) Sets user fields (uf parameter) */ PHP_METHOD(SolrDisMaxQuery, setUserFields) { solr_char_t *pname = "uf"; COMPAT_ARG_SIZE_T pname_len = sizeof("uf")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; int set_param_return = 0; solr_param_t *param = NULL; if(zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE){ php_error_docref(NULL, E_ERROR, "Invalid parameters"); RETURN_NULL(); } /* if the parameter is registered with a different type, remove it first */ if(solr_param_find(getThis(), pname, pname_len, ¶m) == SUCCESS && param->type != SOLR_PARAM_TYPE_NORMAL) { php_error_docref(NULL, E_NOTICE, "Parameter %s value(s) was overwritten by this call", pname); solr_delete_solr_parameter(getThis(), pname, pname_len); } set_param_return = solr_add_or_set_normal_param(getThis(), pname, pname_len, param_value, param_value_len, 0); if(set_param_return == FAILURE) { RETURN_NULL(); } SOLR_RETURN_THIS(); } /* }}} */ int add_phrase_field(zval *obj, solr_char_t *pname, zval *boost, zval *slop, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_len) { COMPAT_ARG_SIZE_T pname_len = strlen(pname); int add_result = 0; solr_char_t *boost_str = NULL; solr_char_t *slop_str = NULL; char * separator = "^"; solr_char_t * delimiter_override = ""; solr_string_t boost_slop_buffer; if(boost != NULL) { convert_to_string(boost); boost_str = Z_STRVAL_P(boost); } if (slop != NULL) { convert_to_string(slop); slop_str = Z_STRVAL_P(slop); } if (slop != NULL && boost !=NULL) { delimiter_override = "~"; memset(&boost_slop_buffer, 0, sizeof(solr_string_t)); solr_string_appends(&boost_slop_buffer, (solr_char_t *)slop_str , Z_STRLEN_P(slop)); solr_string_appendc(&boost_slop_buffer, '^'); solr_string_appends(&boost_slop_buffer, boost_str , Z_STRLEN_P(boost)); add_result = solr_add_arg_list_param_ex( obj, pname, pname_len, field_name, field_name_len, boost_slop_buffer.str, boost_slop_buffer.len, ' ', *separator, *delimiter_override ); solr_string_free(&boost_slop_buffer); } else { add_result = solr_add_arg_list_param( obj, pname, pname_len, field_name, field_name_len, boost_str, Z_STRLEN_P(boost),' ',*separator ); } return add_result; } php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/php_solr_dismax_query.h000066400000000000000000000046411374041537100236100ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Omar Shaban | +----------------------------------------------------------------------+ */ #ifndef SOLR_DISMAX_QUERY_H_ #define SOLR_DISMAX_QUERY_H_ void init_solr_dismax_query(void); PHP_METHOD(SolrDisMaxQuery, __construct); PHP_METHOD(SolrDisMaxQuery, setQueryAlt); PHP_METHOD(SolrDisMaxQuery, addQueryField); PHP_METHOD(SolrDisMaxQuery, removeQueryField); PHP_METHOD(SolrDisMaxQuery, addPhraseField); PHP_METHOD(SolrDisMaxQuery, removePhraseField); PHP_METHOD(SolrDisMaxQuery, setPhraseFields); PHP_METHOD(SolrDisMaxQuery, setPhraseSlop); PHP_METHOD(SolrDisMaxQuery, setQueryPhraseSlop); PHP_METHOD(SolrDisMaxQuery, setBoostQuery); PHP_METHOD(SolrDisMaxQuery, addBoostQuery); PHP_METHOD(SolrDisMaxQuery, removeBoostQuery); PHP_METHOD(SolrDisMaxQuery, setBoostFunction); PHP_METHOD(SolrDisMaxQuery, setMinimumMatch); PHP_METHOD(SolrDisMaxQuery, setTieBreaker); PHP_METHOD(SolrDisMaxQuery, useDisMaxQueryParser); PHP_METHOD(SolrDisMaxQuery, useEDisMaxQueryParser); PHP_METHOD(SolrDisMaxQuery, setBigramPhraseFields); PHP_METHOD(SolrDisMaxQuery, addBigramPhraseField); PHP_METHOD(SolrDisMaxQuery, removeBigramPhraseField); PHP_METHOD(SolrDisMaxQuery, setBigramPhraseSlop); PHP_METHOD(SolrDisMaxQuery, setTrigramPhraseFields); PHP_METHOD(SolrDisMaxQuery, addTrigramPhraseField); PHP_METHOD(SolrDisMaxQuery, removeTrigramPhraseField); PHP_METHOD(SolrDisMaxQuery, setTrigramPhraseSlop); PHP_METHOD(SolrDisMaxQuery, addUserField); PHP_METHOD(SolrDisMaxQuery, removeUserField); PHP_METHOD(SolrDisMaxQuery, setUserFields); #endif /* SOLR_DISMAX_QUERY_H_ */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/php_solr_document.c000066400000000000000000001133341374041537100227070ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_solr.h" /** ************************************************************************ **/ /** DEFINITIONS FOR SOLR DOCUMENT METHODS **/ /** ************************************************************************ **/ /* {{{ static int solr_document_set_field(zval *objptr, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_length, solr_char_t *field_value, COMPAT_ARG_SIZE_T field_value_length) */ static int solr_document_set_field(zval *objptr, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_length, solr_char_t *field_value, COMPAT_ARG_SIZE_T field_value_length) { double field_boost = 0.0f; solr_document_t *doc_entry = NULL; if (!field_name_length) { return FAILURE; } if (!field_value_length) { return FAILURE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(OBJ_FOR_PROP(objptr), &doc_entry) == SUCCESS) { solr_field_list_t *field_values = NULL; zval *tmp; /* If the field already exists in the SolrDocument instance append the value to the field list queue */ if ((field_values = zend_hash_str_find_ptr(doc_entry->fields, field_name, field_name_length)) != NULL) { if (solr_document_insert_field_value(field_values, field_value, field_boost) == FAILURE) { return FAILURE; } } else { /* Otherwise, create a new one and add it to the hash table */ field_values = (solr_field_list_t *) pemalloc(sizeof(solr_field_list_t), SOLR_DOCUMENT_FIELD_PERSISTENT); memset(field_values, 0, sizeof(solr_field_list_t)); field_values->count = 0L; field_values->field_boost = 0.0; field_values->field_name = (solr_char_t *) pestrdup(field_name,SOLR_DOCUMENT_FIELD_PERSISTENT); field_values->head = NULL; field_values->last = NULL; if (solr_document_insert_field_value(field_values, field_value, field_boost) == FAILURE) { solr_destroy_field_list(field_values); return FAILURE; } if ((tmp = zend_hash_str_add_ptr(doc_entry->fields, field_name, field_name_length, field_values)) == NULL) { solr_destroy_field_list(field_values); return FAILURE; } /* Increment field count only when HEAD is added */ doc_entry->field_count++; } return SUCCESS; } return FAILURE; } /* }}} */ /* {{{ static int solr_document_get_field(zval *objptr, zval *return_value, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_length) */ static int solr_document_get_field(zval *objptr, zval *return_value, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_length) { solr_document_t *doc_entry = NULL; if (!field_name_length) { return FAILURE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(OBJ_FOR_PROP(objptr), &doc_entry) == SUCCESS) { solr_field_list_t *field_values = NULL; if ((field_values = zend_hash_str_find_ptr(doc_entry->fields, (char *)field_name, field_name_length)) != NULL) { solr_create_document_field_object(field_values, &return_value); /* The field was retrieved, so we're done here */ return SUCCESS; } return FAILURE; } return FAILURE; } /* }}} */ /* {{{ static int solr_document_remove_field(zval *objptr, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_length) */ static int solr_document_remove_field(zval *objptr, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_length) { solr_document_t *doc_entry = NULL; if (!field_name_length) { return FAILURE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(OBJ_FOR_PROP(objptr), &doc_entry) == SUCCESS) { if (zend_hash_str_del(doc_entry->fields, field_name, field_name_length) == SUCCESS) { doc_entry->field_count--; return SUCCESS; } return FAILURE; } return FAILURE; } /* }}} */ /* {{{ static int solr_document_field_exists(zval *objptr, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_length) */ static int solr_document_field_exists(zval *objptr, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_length) { solr_document_t *doc_entry = NULL; if (!field_name_length) { return FAILURE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(OBJ_FOR_PROP(objptr), &doc_entry) == SUCCESS) { if (zend_hash_str_exists(doc_entry->fields, field_name, field_name_length)) { return SUCCESS; } else { return FAILURE; } } return FAILURE; } /* }}} */ /* {{{ static void solr_serialize_document_object(HashTable *document_fields, xmlChar **buffer, int *size) */ static void solr_serialize_document_object(HashTable *document_fields, xmlChar **buffer, int *size) { xmlNode *root_node = NULL, *fields_node = NULL; xmlDoc *doc_ptr = NULL; int format = 1; if(!buffer) { return; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "solr_document", &root_node); fields_node = xmlNewChild(root_node, NULL, (xmlChar *) "fields", NULL); SOLR_HASHTABLE_FOR_LOOP(document_fields) { solr_field_list_t *field = NULL; solr_char_t *doc_field_name = NULL; solr_field_value_t *doc_field_value = NULL; xmlNode *field_node = NULL; field = zend_hash_get_current_data_ptr(document_fields); doc_field_name = field->field_name; doc_field_value = field->head; field_node = xmlNewChild(fields_node, NULL, (xmlChar *) "field", NULL); xmlNewProp(field_node, (xmlChar *) "name", (xmlChar *) doc_field_name); /* Loop through all the values for this field */ while(doc_field_value != NULL) { xmlChar *escaped_field_value = xmlEncodeEntitiesReentrant(doc_ptr, (xmlChar *) doc_field_value->field_value); xmlNewChild(field_node, NULL, (xmlChar *) "field_value", escaped_field_value); /* Release the memory allocated by xmlEncodeEntitiesReentrant */ xmlFree(escaped_field_value); /* Grab the next value for this field if any */ doc_field_value = doc_field_value->next; } /* while(doc_field_value != NULL) */ } /* SOLR_HASHTABLE_FOR_LOOP(document_fields) */ xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, buffer, size, "UTF-8", format); xmlFreeDoc(doc_ptr); } /* }}} */ /* {{{ static void solr_unserialize_document_field(HashTable *document_fields, xmlNode *field_node) */ static void solr_unserialize_document_field(HashTable *document_fields, xmlNode *field_node) { solr_char_t *field_name = NULL; xmlNode *xml_curr_value = NULL; solr_field_list_t *field_values = (solr_field_list_t *) pemalloc(sizeof(solr_field_list_t), SOLR_DOCUMENT_FIELD_PERSISTENT); zend_string *field_str; memset(field_values, 0, sizeof(solr_field_list_t)); field_name = (solr_char_t *) solr_xml_get_node_contents(field_node->properties); field_values->count = 0L; field_values->field_boost = 0.0f; field_values->field_name = (solr_char_t *) pestrdup(field_name, SOLR_DOCUMENT_FIELD_PERSISTENT); field_values->head = NULL; field_values->last = NULL; /* Grab the first field node */ xml_curr_value = field_node->children; /* Looping through all the field_value nodes */ while(xml_curr_value != NULL) { /* No assumptions. It must be the field value nodes */ if (xml_curr_value->type == XML_ELEMENT_NODE && solr_xml_match_node(xml_curr_value, "field_value")) { solr_char_t *field_value = (solr_char_t *) solr_xml_get_node_contents(xml_curr_value); /* Add this value to the list of values */ if (solr_document_insert_field_value(field_values, field_value, 0.0f) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error adding field value during SolrDocument unserialization"); } } /* Move to the next field_value */ xml_curr_value = xml_curr_value->next; } field_str = zend_string_init(field_name, strlen(field_name), SOLR_DOCUMENT_FIELD_PERSISTENT); /* All the values have been retrieved for this field. Now let's drop the field in the HashTable */ if ((field_values = zend_hash_add_new_ptr(document_fields, field_str, (void *) field_values)) == NULL) { zend_string_release(field_str); solr_destroy_field_list(field_values); php_error_docref(NULL, E_WARNING, "Error adding field values to HashTable during SolrDocument unserialization"); return; } zend_string_release(field_str); } /* }}} */ /* {{{ static int solr_unserialize_child_documents(xmlDoc *doc, solr_document_t *doc_entry) * 1. retrieve doc hashes * 2. base64_decode * 3. unserialize (call php method) * 4. add child to solr_doc_t.children */ static int solr_unserialize_child_documents(xmlDoc *doc, solr_document_t *doc_entry) { xmlXPathContext *xp_ctx = NULL; xmlXPathObject *xp_obj = NULL; xmlNodeSet *result = NULL; xmlChar *hash, *xp_expression; int num_nodes = 0, idx = 0; /* unserialize vars */ php_unserialize_data_t var_hash; zval solr_doc_zv; xp_expression = (xmlChar *)"/solr_document/child_docs/dochash"; xp_ctx = xmlXPathNewContext(doc); xp_obj = xmlXPathEvalExpression(xp_expression, xp_ctx); result = xp_obj->nodesetval; num_nodes = result->nodeNr; if (num_nodes > 0) { for (;idx < num_nodes; idx++) { zend_string *sdoc_str; /* serialized document string */ unsigned char *sdoc_copy, *str_end; hash = result->nodeTab[idx]->children->content; sdoc_str = (zend_string *)php_base64_decode((const unsigned char*)hash, strlen((char *)hash)); memset(&var_hash, 0, sizeof(php_unserialize_data_t)); PHP_VAR_UNSERIALIZE_INIT(var_hash); sdoc_copy = (unsigned char *)sdoc_str->val; str_end = (unsigned char *) (sdoc_copy + strlen((const char *)sdoc_copy)); if (!php_var_unserialize(&solr_doc_zv, (const unsigned char **)&sdoc_copy, str_end, &var_hash)){ PHP_VAR_UNSERIALIZE_DESTROY(var_hash); php_error_docref(NULL, E_ERROR, "Unable to unserialize child document"); xmlXPathFreeContext(xp_ctx); xmlXPathFreeObject(xp_obj); zend_string_release(sdoc_str); return FAILURE; } zend_string_release(sdoc_str); if (zend_hash_next_index_insert(doc_entry->children, &solr_doc_zv) == NULL) { php_error_docref(NULL, E_ERROR, "Unable to add child document to parent document post-unserialize"); } PHP_VAR_UNSERIALIZE_DESTROY(var_hash); } } xmlXPathFreeContext(xp_ctx); xmlXPathFreeObject(xp_obj); return SUCCESS; } /* }}} */ static int solr_unserialize_document_fields(xmlDoc *doc, HashTable *document_fields) { xmlXPathContext *xpathctxt = NULL; xmlChar *xpath_expression = NULL; xmlXPathObject *xpathObj = NULL; xmlNodeSet *result = NULL; register size_t num_nodes = 0U; register size_t i = 0U; xpathctxt = xmlXPathNewContext(doc); if (!xpathctxt) { xmlFreeDoc(doc); php_error_docref(NULL, E_WARNING, "A valid XML xpath context could not be created"); return FAILURE; } xpath_expression = (xmlChar *) "/solr_document/fields/field/@name"; xpathObj = xmlXPathEval(xpath_expression, xpathctxt); if (!xpathObj) { xmlXPathFreeContext(xpathctxt); xmlFreeDoc(doc); php_error_docref(NULL, E_WARNING, "A valid XML xpath object could not be created from the expression"); return FAILURE; } result = xpathObj->nodesetval; if (!result) { xmlXPathFreeContext(xpathctxt); xmlXPathFreeObject(xpathObj); xmlFreeDoc(doc); php_error_docref(NULL, E_WARNING, "Document has no fields"); return FAILURE; } num_nodes = result->nodeNr; i = 0U; if (!num_nodes) { xmlXPathFreeContext(xpathctxt); xmlXPathFreeObject(xpathObj); xmlFreeDoc(doc); php_error_docref(NULL, E_WARNING, "Document has no fields"); return FAILURE; } for (i = 0U; i < num_nodes; i++) { xmlNode *currNode = result->nodeTab[i]; /* Absolutely No assumptions. I have to make sure that this is the name attribute */ if (currNode->type == XML_ATTRIBUTE_NODE && solr_xml_match_node(currNode, "name")) { /* Get the field node */ xmlNode *field_xml_node = currNode->parent; /* Retrieve all the values for this field and put them in the HashTable */ solr_unserialize_document_field(document_fields, field_xml_node); } } xmlXPathFreeContext(xpathctxt); xmlXPathFreeObject(xpathObj); return SUCCESS; } /* {{{ static int solr_unserialize_document_object(HashTable *document_fields, char *serialized, int size) */ static int solr_unserialize_document_object(solr_document_t *doc_entry, char *serialized, int size) { xmlDoc *doc = NULL; doc = xmlReadMemory(serialized, size, NULL, "UTF-8", 0); if (!doc) { php_error_docref(NULL, E_WARNING, "The serialized document string is invalid"); return FAILURE; } if (solr_unserialize_document_fields(doc, doc_entry->fields) == FAILURE) { php_error_docref(NULL, E_WARNING, "Unable to unserialize document fields"); return FAILURE; } if (solr_unserialize_child_documents(doc, doc_entry) == FAILURE) { php_error_docref(NULL, E_WARNING, "Unable to unserialize document fields"); return FAILURE; } xmlFreeDoc(doc); return SUCCESS; } /* }}} */ /* {{{ proto void SolrDocument::__construct(void) SolrDocument constructor */ PHP_METHOD(SolrDocument, __construct) { zval *objptr = getThis(); zend_ulong document_index = SOLR_UNIQUE_DOCUMENT_INDEX(); if (solr_init_document(document_index) == NULL) { return; } /* Set the value of the internal id property */ zend_update_property_long(solr_ce_SolrDocument, OBJ_FOR_PROP(objptr), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, document_index); /* Overriding the default object handlers */ Z_OBJ_HT_P(objptr) = &solr_input_document_object_handlers; } /* }}} */ /* {{{ proto void SolrDocument::__destruct(void) Destructor for SolrDocument */ PHP_METHOD(SolrDocument, __destruct) { solr_document_t *doc_entry = NULL; /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == SUCCESS) { zend_hash_index_del(SOLR_GLOBAL(documents), doc_entry->document_index); /* Keep track of how many SolrDocument instances we currently have */ SOLR_GLOBAL(document_count)--; return ; } } /* }}} */ /* {{{ proto SolrDocument::__clone(void) Clone method for SolrDocument */ PHP_METHOD(SolrDocument, __clone) { RETURN_NULL(); } /* }}} */ /* {{{ proto SolrDocument::__set(string fieldname, string field_value) Magic method for setting field names. */ PHP_METHOD(SolrDocument, __set) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; solr_char_t *field_value = NULL; COMPAT_ARG_SIZE_T field_value_length = 0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &field_name, &field_name_length, &field_value, &field_value_length) == FAILURE) { RETURN_FALSE; } if (solr_document_set_field(getThis(), field_name, field_name_length, field_value, field_value_length) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto SolrDocumentField SolrDocument::__get(string fieldname) Magic method for getting a field. */ PHP_METHOD(SolrDocument, __get) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_get_field(getThis(), return_value, field_name, field_name_length) == FAILURE) { RETURN_NULL(); } } /* }}} */ /* {{{ proto bool SolrDocument::__isset(string field_name) Checks if a field exists */ PHP_METHOD(SolrDocument, __isset) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_field_exists(getThis(), field_name, field_name_length) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrDocument::__unset(string fieldname) Removes a field from the document. */ PHP_METHOD(SolrDocument, __unset) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_remove_field(getThis(), field_name, field_name_length) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto void SolrDocument::offsetSet(string field_name, string field_value) Sets the specified field in the document */ PHP_METHOD(SolrDocument, offsetSet) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; solr_char_t *field_value = NULL; COMPAT_ARG_SIZE_T field_value_length = 0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &field_name, &field_name_length, &field_value, &field_value_length) == FAILURE) { return; } if (solr_document_set_field(getThis(), field_name, field_name_length, field_value, field_value_length) == SUCCESS) { return; } } /* }}} */ /* {{{ proto SolrDocumentField SolrDocument::offsetGet(string field_name) Returns the request field. */ PHP_METHOD(SolrDocument, offsetGet) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_get_field(getThis(), return_value, field_name, field_name_length) == FAILURE) { RETURN_NULL(); } } /* }}} */ /* {{{ proto bool SolrDocument::offsetExists(string fieldname) Checks if the request field exists in the document */ PHP_METHOD(SolrDocument, offsetExists) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_field_exists(getThis(), field_name, field_name_length) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto void SolrDocument::offsetUnset(string fieldname) Removes the specified field from the document */ PHP_METHOD(SolrDocument, offsetUnset) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_length) == FAILURE) { return; } if (solr_document_remove_field(getThis(), field_name, field_name_length) == SUCCESS) { return; } } /* }}} */ /* {{{ proto void SolrDocument::rewind(void) Resets the internal pointer. */ PHP_METHOD(SolrDocument, rewind) { solr_document_t *doc_entry = NULL; HashTable *doc_fields = NULL; if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == FAILURE) { return; } doc_fields = doc_entry->fields; zend_hash_internal_pointer_reset(doc_fields); } /* }}} */ /* {{{ proto SolrDocumentField SolrDocument::current(void) Retrieves the current field. */ PHP_METHOD(SolrDocument, current) { solr_document_t *doc_entry = NULL; HashTable *doc_fields = NULL; solr_field_list_t *field_values = NULL; if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == FAILURE) { return; } doc_fields = doc_entry->fields; field_values = zend_hash_get_current_data_ptr(doc_fields); if(field_values && field_values ) { solr_create_document_field_object(field_values, &return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrDocument::key(void) Retrieves the current key. */ PHP_METHOD(SolrDocument, key) { solr_document_t *doc_entry = NULL; zend_ulong num_index = 0L; HashTable *doc_fields = NULL; zend_string *field_name_str; if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == FAILURE) { return; } doc_fields = doc_entry->fields; if (zend_hash_get_current_key(doc_fields, &field_name_str, &num_index)) { RETURN_STR_COPY(field_name_str); } } /* }}} */ /* {{{ proto void SolrDocument::next(void) Moves the internal pointer to the next field. */ PHP_METHOD(SolrDocument, next) { solr_document_t *doc_entry = NULL; HashTable *doc_fields = NULL; if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == FAILURE) { return; } doc_fields = doc_entry->fields; zend_hash_move_forward(doc_fields); } /* }}} */ /* {{{ proto bool SolrDocument::valid(void) Checks if the current internal pointer position is still valid. */ PHP_METHOD(SolrDocument, valid) { solr_document_t *doc_entry = NULL; HashTable *doc_fields = NULL; zend_bool is_valid = 0; if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == FAILURE) { return; } doc_fields = doc_entry->fields; is_valid = (zend_bool) ( SUCCESS == zend_hash_has_more_elements(doc_fields) ); RETURN_BOOL(is_valid); } /* }}} */ /* {{{ proto string SolrDocument::serialize(void) Custom SolrDocument serializer. Returns an XML document string representing the object. */ PHP_METHOD(SolrDocument, serialize) { solr_document_t *doc_entry = NULL; HashTable *doc_fields = NULL; char *serialized = NULL; int size = 0; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == FAILURE) { /* todo error here */ RETURN_NULL(); } doc_fields = doc_entry->fields; solr_serialize_document_object(doc_fields, (xmlChar **) &serialized, &size); if (size) { RETVAL_STRINGL(serialized, size); xmlFree(serialized); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto void SolrDocument::unserialize(string serialized_xml) Custom SolrDocument unserializer. Brings the object back to life. */ PHP_METHOD(SolrDocument, unserialize) { solr_char_t *serialized = NULL; COMPAT_ARG_SIZE_T serialized_length = 0; zval *objptr = getThis(); zend_ulong document_index = SOLR_UNIQUE_DOCUMENT_INDEX(); solr_document_t *doc_entry = NULL; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_length) == FAILURE) { RETURN_FALSE; } doc_entry = solr_init_document(document_index); /* Set the value of the internal id property */ zend_update_property_long(solr_ce_SolrDocument, OBJ_FOR_PROP(objptr), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, document_index); /* Overriding the default object handlers */ Z_OBJ_HT_P(objptr) = &solr_input_document_object_handlers; if (solr_unserialize_document_object(doc_entry, serialized, serialized_length) == FAILURE) { return; } doc_entry->field_count = zend_hash_num_elements(doc_entry->fields); } /* }}} */ /* {{{ proto bool SolrDocument::clear(void) Resets the current object. Discards all the fields and resets the document boost to zero. */ PHP_METHOD(SolrDocument, clear) { solr_document_t *doc_entry = NULL; if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == SUCCESS) { doc_entry->document_boost = 0.0; doc_entry->field_count = 0L; zend_hash_clean(doc_entry->fields); RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrDocument::addField(string fieldname, string value) Adds a field to the document */ PHP_METHOD(SolrDocument, addField) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; solr_char_t *field_value = NULL; COMPAT_ARG_SIZE_T field_value_length = 0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &field_name, &field_name_length, &field_value, &field_value_length) == FAILURE) { RETURN_FALSE; } if (solr_document_set_field(getThis(), field_name, field_name_length, field_value, field_value_length) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto array SolrDocument::getFieldNames(void) Returns an array of fields names in the document. */ PHP_METHOD(SolrDocument, getFieldNames) { solr_document_get_field_names(INTERNAL_FUNCTION_PARAM_PASSTHRU); } /* }}} */ /* {{{ proto int SolrDocument::getFieldCount(void) Returns the number of fields in this document. Multi-value fields are only counted once. */ PHP_METHOD(SolrDocument, getFieldCount) { solr_document_t *doc_entry = NULL; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == SUCCESS) { RETURN_LONG(zend_hash_num_elements(doc_entry->fields)); } RETURN_FALSE; } /* }}} */ /* {{{ proto SolrDocumentField SolrDocument::getField(string fieldname) Retrieves the requested field */ PHP_METHOD(SolrDocument, getField) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_get_field(getThis(), return_value, field_name, field_name_length) == FAILURE) { RETURN_FALSE; } } /* }}} */ /* {{{ proto array SolrDocument::toArray(void) Returns an array representation of the SolrDocument object. */ PHP_METHOD(SolrDocument, toArray) { solr_document_t *doc_entry = NULL; zval arr_tmp; zval *fields_array = &arr_tmp; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == SUCCESS) { HashTable *fields_ht; #ifndef PHP_7 MAKE_STD_ZVAL(fields_array); #endif array_init(return_value); array_init(fields_array); add_assoc_double(return_value, "document_boost", doc_entry->document_boost); add_assoc_long(return_value, "field_count", doc_entry->field_count); add_assoc_zval(return_value, "fields", fields_array); fields_ht = doc_entry->fields; SOLR_HASHTABLE_FOR_LOOP(fields_ht) { solr_field_list_t *field = NULL; zval current_field_tmp; zval *current_field = ¤t_field_tmp; #ifndef PHP_7 MAKE_STD_ZVAL(current_field); #endif field = zend_hash_get_current_data_ptr(fields_ht); solr_create_document_field_object(field, ¤t_field); add_next_index_zval(fields_array, current_field); } /* We are done */ return; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrDocument::fieldExists(string fieldname) Checks if the field exists. */ PHP_METHOD(SolrDocument, fieldExists) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_field_exists(getThis(), field_name, field_name_length) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrDocument::deleteField(string field_name) Removes the requested field. */ PHP_METHOD(SolrDocument, deleteField) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (solr_document_remove_field(getThis(), field_name, field_name_length) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrDocument::sort(int sort_criterion [, int sort_direction]) Sorts the fields in the document */ PHP_METHOD(SolrDocument, sort) { long int order_by = 0L; long int sort_direction = SOLR_SORT_ASC; solr_document_t *doc_entry = NULL; int renumber = 0; /* The pointer to the comparison function used by zend_qsort */ #if PHP_VERSION_ID < 80000 compare_func_t comparison_function = NULL; #else bucket_compare_func_t comparison_function = NULL; #endif if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &order_by, &sort_direction) == FAILURE) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == FAILURE) { RETURN_FALSE; } /* {{{ Select the appropriate comparison function */ switch(order_by) { case SOLR_SORT_FIELD_NAME : /* Sorting by field name */ { switch(sort_direction) { case SOLR_SORT_ASC : comparison_function = solr_compare_field_name; break; case SOLR_SORT_DESC : comparison_function = solr_rcompare_field_name; break; } } break; /* case SOLR_SORT_FIELD_NAME */ case SOLR_SORT_FIELD_VALUE_COUNT : /* Sorting by number of values per field */ { switch(sort_direction) { case SOLR_SORT_ASC : comparison_function = solr_compare_field_value_count; break; case SOLR_SORT_DESC : comparison_function = solr_rcompare_field_value_count; break; } } break; /* case SOLR_SORT_FIELD_VALUE_COUNT */ case SOLR_SORT_FIELD_BOOST_VALUE : /* Sorting by field boost values */ { switch(sort_direction) { case SOLR_SORT_ASC : comparison_function = solr_compare_field_boost_value; break; case SOLR_SORT_DESC : comparison_function = solr_rcompare_field_boost_value; break; } } break; /* case SOLR_SORT_FIELD_BOOST_VALUE */ default : /* Undefined sort criteria */ RETURN_FALSE; break; } /* }}} switch(order_by) */ /* Undefined sort direction. It was not ASC or DESC */ if (!comparison_function) { RETURN_FALSE; } zend_hash_sort(doc_entry->fields, comparison_function, renumber); RETURN_TRUE; } /* }}} */ /* {{{ proto bool SolrDocument::merge(SolrDocument source [, bool override]) Merges source to the current SolrDocument. */ PHP_METHOD(SolrDocument, merge) { solr_document_t *destination_document = NULL; solr_document_t *source_document = NULL; copy_ctor_func_t p_copy_ctor = (copy_ctor_func_t) field_copy_constructor; /* The destination SolrDocument instance */ zval *destination_document_zval = getThis(); /* The source SolrDocument instance */ zval *source_document_zval = NULL; /* Should we skip fields that already exist in destination */ zend_bool overwrite = (zend_bool) 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|b", &source_document_zval, solr_ce_SolrDocument, &overwrite) == FAILURE) { RETURN_FALSE; } if (solr_fetch_document_entry(OBJ_FOR_PROP(source_document_zval), &source_document) == FAILURE) { RETURN_FALSE; } if (solr_fetch_document_entry(OBJ_FOR_PROP(destination_document_zval), &destination_document) == FAILURE) { RETURN_FALSE; } if (zend_hash_num_elements(source_document->fields) == 0) { php_error_docref(NULL, E_WARNING, "Source SolrDocument has no fields. Source"); RETURN_FALSE; } /* TODO child documents */ /* Copy the fields in the source HashTable to the destination HashTable */ zend_hash_merge(destination_document->fields, source_document->fields, p_copy_ctor, (int) overwrite); /* Update the field count */ destination_document->field_count = (uint32_t) zend_hash_num_elements(destination_document->fields); RETURN_TRUE; } /* }}} */ static void solr_add_child_input_documents_from_documents(HashTable * children, solr_document_t *new_doc_entry) { SOLR_HASHTABLE_FOR_LOOP(children) { zval solr_input_doc; zval *solr_doc = zend_hash_get_current_data(children); zend_call_method_with_0_params(OBJ_FOR_PROP(solr_doc), Z_OBJCE_P(solr_doc), NULL, "getinputdocument", &solr_input_doc); if (zend_hash_next_index_insert(new_doc_entry->children, &solr_input_doc) == NULL) { php_error_docref(NULL, E_ERROR, "Unable to convert child SolrDocument to SolrInputDocument"); } } } /* {{{ proto SolrInputDocument SolrDocument::getInputDocument(void) Returns a SolrInputDocument equivalent of the object. */ PHP_METHOD(SolrDocument, getInputDocument) { zval *objptr = getThis(); solr_document_t new_solr_doc; solr_document_t *new_doc_entry = NULL, *old_doc_entry = NULL; memset(&new_solr_doc, 0, sizeof(solr_document_t)); new_doc_entry = &new_solr_doc; /* Retrieve the document entry for the original SolrDocument */ if (solr_fetch_document_entry(OBJ_FOR_PROP(objptr), &old_doc_entry) == FAILURE) { php_error_docref(NULL, E_ERROR, "SolrDocument could not be fetched."); return; } object_init_ex(return_value, solr_ce_SolrInputDocument); if ((new_doc_entry = solr_input_doc_ctor(return_value))== NULL) { php_error_docref(NULL, E_ERROR, "SolrInputDocument could not be created."); } /* Duplicate the doc_entry contents */ new_doc_entry->field_count = old_doc_entry->field_count; new_doc_entry->document_boost = old_doc_entry->document_boost; /* Initializing the hash table used for storing fields in this SolrDocument */ /* Copy the contents of the old fields HashTable to the new SolrDocument */ zend_hash_copy(new_doc_entry->fields, old_doc_entry->fields, (copy_ctor_func_t) field_copy_constructor); /* call getInputDocument on each child SolrDocument and store children */ if (zend_hash_num_elements(old_doc_entry->children) > 0) { solr_add_child_input_documents_from_documents(old_doc_entry->children, new_doc_entry); } } /* }}} */ /* {{{ proto array SolrInputDocument::getChildDocuments( void ) Returns child documents or null if none */ PHP_METHOD(SolrDocument, getChildDocuments) { solr_document_t *solr_doc = NULL; if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &solr_doc) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to fetch document entry for current object"); return; } if (zend_hash_num_elements(solr_doc->children) > 0) { array_init(return_value); zend_hash_init(Z_ARRVAL_P(return_value), zend_hash_num_elements(solr_doc->children), NULL, ZVAL_PTR_DTOR, 0); zend_hash_copy(Z_ARRVAL_P(return_value), solr_doc->children, (copy_ctor_func_t)zval_add_ref); } } /* }}} */ /* {{{ proto bool SolrInputDocument::hasChildDocuments( void ) Checks whether this document has child documents */ PHP_METHOD(SolrDocument, hasChildDocuments) { solr_document_t *solr_doc = NULL; if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &solr_doc) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to fetch document entry for current object"); return; } if (zend_hash_num_elements(solr_doc->children) > 0) { RETURN_TRUE; } else { RETURN_FALSE; } } /* }}} */ /* {{{ proto int SolrInputDocument::getChildDocumentsCount( void ) Returns the number of child documents */ PHP_METHOD(SolrDocument, getChildDocumentsCount) { solr_document_t *solr_doc = NULL; if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &solr_doc) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to fetch document entry for current object"); return; } ZVAL_LONG(return_value, zend_hash_num_elements(solr_doc->children)); } /* }}} */ /* {{{ proto SolrDocumentField::__construct(void) Constructor */ PHP_METHOD(SolrDocumentField, __construct) { Z_OBJ_HT_P(getThis()) = &solr_document_field_handlers; } /* }}} */ /* {{{ proto SolrDocumentField::__destruct(void) Destructor */ PHP_METHOD(SolrDocumentField, __destruct) { } /* }}} */ /* {{{ PHP_SOLR_API void solr_document_field_write_property(zval *object, zval *member, zval *value) */ #if PHP_VERSION_ID < 70400 PHP_SOLR_API void solr_document_field_write_property(zval *object, zval *member, zval *value, void **cache_slot) #elif PHP_VERSION_ID < 80000 PHP_SOLR_API zval *solr_document_field_write_property(zval *object, zval *member, zval *value, void **cache_slot) #else PHP_SOLR_API zval *solr_document_field_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) #endif { solr_throw_exception(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1007_MSG, SOLR_ERROR_1007, SOLR_FILE_LINE_FUNC); /* if (Z_TYPE_P(member) == IS_STRING) { php_error_docref(NULL, E_WARNING, "Attempting to set value for [%s] property in a SolrDocumentField instance", Z_STRVAL_P(member)); } */ #if PHP_VERSION_ID >= 70400 return value; #endif } /* }}} */ /* {{{ PHP_SOLR_API void solr_document_field_unset_property(zval *object, zval *member) */ #if PHP_VERSION_ID < 80000 PHP_SOLR_API void solr_document_field_unset_property(zval *object, zval *member, void ** cache_slot) #else PHP_SOLR_API void solr_document_field_unset_property(zend_object *object, zend_string *member, void ** cache_slot) #endif { solr_throw_exception(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1007_MSG, SOLR_ERROR_1007, SOLR_FILE_LINE_FUNC); /* if (Z_TYPE_P(member) == IS_STRING) { php_error_docref(NULL, E_WARNING, "Attempting to remove [%s] property in a SolrDocumentField instance", Z_STRVAL_P(member)); } */ } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/php_solr_exception.c000066400000000000000000000145241374041537100230700ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_solr.h" /* {{{ static void solr_prepare_internal_info(zval *object, zval *return_value) */ static void solr_prepare_internal_info(zval *object, zval *return_value) { zval *rv = NULL; zval *line_no = zend_read_property(Z_OBJCE_P(object), OBJ_FOR_PROP(object), SOLR_SOURCELINE_NO_PROPERTY_NAME, sizeof(SOLR_SOURCELINE_NO_PROPERTY_NAME)-1, 0, rv); zval *solr_file = zend_read_property(Z_OBJCE_P(object), OBJ_FOR_PROP(object), SOLR_SOURCEFILE_PROPERTY_NAME, sizeof(SOLR_SOURCEFILE_PROPERTY_NAME)-1, 0, rv); zval *solr_zif_name = zend_read_property(Z_OBJCE_P(object), OBJ_FOR_PROP(object), SOLR_ZIFNAME_PROPERTY_NAME, sizeof(SOLR_ZIFNAME_PROPERTY_NAME)-1, 0, rv); long int source_line = Z_LVAL_P(line_no); char *solr_source_file = Z_STRVAL_P(solr_file); char *solr_zifname = Z_STRVAL_P(solr_zif_name); array_init(return_value); add_assoc_long(return_value, SOLR_SOURCELINE_NO_PROPERTY_NAME, source_line); add_assoc_string(return_value, SOLR_SOURCEFILE_PROPERTY_NAME, solr_source_file); add_assoc_string(return_value, SOLR_ZIFNAME_PROPERTY_NAME, solr_zifname); } /* }}} */ /* {{{ void solr_throw_exception_ex(zend_class_entry *exception_ce, long code, const char *filename, int file_line, const char *function_name, char *format, ...) */ PHP_SOLR_API void solr_throw_exception_ex(zend_class_entry *exception_ce, long code, const char *filename, int file_line, const char *function_name, char *format, ...) { char *message = NULL; zval object; zend_object *object_val = NULL; va_list args; va_start(args,format); /* Preparing the message string from the format and variable argument list, if any. */ ap_php_vasprintf(&message, format, args); va_end(args); /* Retrieves the thrown object and updates the properties */ object_val = zend_throw_exception(exception_ce, message, code); ZVAL_OBJ(&object, object_val); /* This is the line number in the source file where it was thrown */ zend_update_property_long(exception_ce, OBJ_FOR_PROP(&object), SOLR_SOURCELINE_NO_PROPERTY_NAME, sizeof(SOLR_SOURCELINE_NO_PROPERTY_NAME)-1, file_line); /* This is the line source file where it was thrown */ zend_update_property_string(exception_ce, OBJ_FOR_PROP(&object), SOLR_SOURCEFILE_PROPERTY_NAME, sizeof(SOLR_SOURCEFILE_PROPERTY_NAME)-1, (char *) filename); /* This is the C function where it was thrown */ zend_update_property_string(exception_ce, OBJ_FOR_PROP(&object), SOLR_ZIFNAME_PROPERTY_NAME, sizeof(SOLR_ZIFNAME_PROPERTY_NAME)-1, (char *) function_name); /* message must be freed */ if (message != NULL) { free(message); } } /* }}} */ /* {{{ void solr_throw_exception(zend_class_entry *exception_ce, char *message, long code, const char *filename, int file_line, const char *function_name) */ PHP_SOLR_API void solr_throw_exception(zend_class_entry *exception_ce, char *message, long code, const char *filename, int file_line, const char *function_name) { /* Retrieves the thrown object and updates the properties */ zend_object *object_val = NULL; zval object; object_val = zend_throw_exception(exception_ce, message, code); ZVAL_OBJ(&object, object_val); /* This is the line number in the source file where it was thrown */ zend_update_property_long(exception_ce, OBJ_FOR_PROP(&object), SOLR_SOURCELINE_NO_PROPERTY_NAME, sizeof(SOLR_SOURCELINE_NO_PROPERTY_NAME)-1, file_line); /* This is the line source file where it was thrown */ zend_update_property_string(exception_ce, OBJ_FOR_PROP(&object), SOLR_SOURCEFILE_PROPERTY_NAME, sizeof(SOLR_SOURCEFILE_PROPERTY_NAME)-1, (char *) filename); /* This is the C function where it was thrown */ zend_update_property_string(exception_ce, OBJ_FOR_PROP(&object), SOLR_ZIFNAME_PROPERTY_NAME, sizeof(SOLR_ZIFNAME_PROPERTY_NAME)-1, (char *) function_name); } /* }}} */ /* Macro for preparing the return value array */ #define solr_exception_return_internal_info() { \ solr_prepare_internal_info(getThis(), return_value); \ } /* {{{ proto array SolrException::getInternalInfo(void) Returns the internal API information where the exception was generated */ PHP_METHOD(SolrException, getInternalInfo) { solr_exception_return_internal_info() } /* }}} */ /* {{{ proto array SolrClientException::getInternalInfo(void) Returns the internal API information where the exception was generated */ PHP_METHOD(SolrClientException, getInternalInfo) { solr_exception_return_internal_info() } /* }}} */ /* {{{ proto array SolrIllegalOperationException::getInternalInfo(void) Returns the internal API information where the exception was generated */ PHP_METHOD(SolrIllegalOperationException, getInternalInfo) { solr_exception_return_internal_info() } /* }}} */ /* {{{ proto array SolrIllegalArgumentException::getInternalInfo(void) Returns the internal API information where the exception was generated */ PHP_METHOD(SolrIllegalArgumentException, getInternalInfo) { solr_exception_return_internal_info() } /* }}} */ /* {{{ proto array SolrServerException::getInternalInfo(void) Returns the internal API information where the exception was generated */ PHP_METHOD(SolrServerException, getInternalInfo) { solr_exception_return_internal_info() } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/php_solr_extract.c000066400000000000000000000137301374041537100225420ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_solr.h" extern zend_class_entry *solr_ce_SolrExtractRequest; extern zend_object_handlers solr_extract_request_object_handlers; extern zend_class_entry *solr_ce_SolrIllegalArgumentException; extern zend_class_entry *solr_ce_SolrIllegalOperationException; extern HashTable *ustreams; #define SOLR_EXTRACT_OBJ_CTOR() { \ do { \ object_init_ex(return_value, solr_ce_SolrExtractRequest); \ stream_entry = Z_USTREAM_P(return_value); \ stream_entry->params = Z_REFVAL_P(params); \ Z_ADDREF_P(stream_entry->params); \ } while(0); \ } PHP_SOLR_API int solr_init_ustream(zval *obj) { zend_ulong index = SOLR_UNIQUE_USTREAM_INDEX(); solr_ustream_t *ustream_entry = NULL; ustream_entry = pemalloc(sizeof(solr_ustream_t), 0); if (zend_hash_index_update_ptr(SOLR_GLOBAL(ustreams), index, ustream_entry) == NULL) { return FAILURE; } return SUCCESS; } /* {{{ solr_extract_obj_handlers */ static void solr_extract_free_object_handler(zend_object *obj) { solr_ustream_t *intern = solr_get_ustream_object(obj); solr_string_free(&(intern->content_info->filename)); solr_string_free(&(intern->content_info->stream_info.binary_content)); solr_string_free(&(intern->content_info->stream_info.mime_type)); Z_DELREF_P(intern->params); efree(intern->content_info); zend_object_std_dtor(obj); efree(intern); } zend_object *solr_extract_create_object_handler(zend_class_entry *ce) { solr_ustream_t *intern = ecalloc(1, sizeof(solr_ustream_t)+zend_object_properties_size(ce)); memset(intern, 0, sizeof(solr_ustream_t)); zend_object_std_init(&intern->std, ce); object_properties_init(&intern->std, ce); intern->content_info = emalloc(sizeof(solr_cuv_t)); solr_string_init(&(intern->content_info->stream_info.mime_type)); solr_string_init(&(intern->content_info->stream_info.binary_content)); solr_extract_request_object_handlers.free_obj = solr_extract_free_object_handler; intern->std.handlers = &solr_extract_request_object_handlers; return &intern->std; } /* }}} */ PHP_METHOD(SolrExtractRequest, __construct) { } PHP_METHOD(SolrExtractRequest, __destruct) { } /* {{{ proto SolrExtractRequest::createFromFile(string filename, SolrModifiableParams params) Create request from file */ PHP_METHOD(SolrExtractRequest, createFromFile) { char *filename; COMPAT_ARG_SIZE_T filename_length = 0; solr_ustream_t *stream_entry = NULL; zval *params = NULL; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, solr_ce_SolrIllegalArgumentException, &error_handling); if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz", &filename, &filename_length, ¶ms) == FAILURE) { zend_restore_error_handling(&error_handling); return; } SOLR_EXTRACT_OBJ_CTOR(); stream_entry->content_type = SOLR_EXTRACT_CONTENT_FILE; solr_string_set_ex(&(stream_entry->content_info->filename), filename, filename_length); } /* {{{ proto SolrExtractRequest::createFromStream(string content, string contentType, SolrModifiableParams params) Create request from binary stream */ PHP_METHOD(SolrExtractRequest, createFromStream) { char *content, *content_type; COMPAT_ARG_SIZE_T content_length = 0, content_type_length = 0; solr_ustream_t *stream_entry = NULL; zval *params = NULL; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, solr_ce_SolrIllegalArgumentException, &error_handling); if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssz", &content, &content_length, &content_type, &content_type_length, ¶ms) == FAILURE) { zend_restore_error_handling(&error_handling); return; } SOLR_EXTRACT_OBJ_CTOR(); stream_entry->content_type = SOLR_EXTRACT_CONTENT_STREAM; solr_string_set_ex(&(stream_entry->content_info->stream_info.mime_type), content_type, content_type_length); solr_string_set_ex(&(stream_entry->content_info->stream_info.binary_content), content, content_length); } /* }}} */ /* {{{ proto SolrExtractRequest::__clone(void) Should not be called directly. Cloning is not supported. */ PHP_METHOD(SolrExtractRequest, __clone) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_4001, SOLR_FILE_LINE_FUNC, "Cloning of SolrExtractRequest objects is currently not supported"); } /* }}} */ /* {{{ proto SolrExtractRequest::__sleep(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrExtractRequest, __sleep) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_4001, SOLR_FILE_LINE_FUNC, "SolrExtractRequest objects cannot be serialized or unserialized"); } /* }}} */ /* {{{ proto SolrExtractRequest::__wakeup(void) Should not be called directly. Deserialization is not supported. */ PHP_METHOD(SolrExtractRequest, __wakeup) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_4001, SOLR_FILE_LINE_FUNC, "SolrExtractRequest objects cannot be serialized or unserialized"); } /* }}} */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/php_solr_input_document.c000066400000000000000000000674171374041537100241400ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_solr.h" /** ************************************************************************ **/ /** DEFINITIONS FOR SOLR INPUT DOCUMENT METHODS **/ /** ************************************************************************ **/ /* {{{ proto void SolrInputDocument::__construct() SolrInputDocument constructor */ PHP_METHOD(SolrInputDocument, __construct) { zval *objptr = getThis(); if (solr_input_doc_ctor(objptr) == NULL) { return; } } /* }}} */ /* {{{ proto void SolrInputDocument::__destruct(void) Destructor for SolrInputDocument */ PHP_METHOD(SolrInputDocument, __destruct) { solr_document_t *doc_entry = NULL; /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == SUCCESS) { zend_hash_index_del(SOLR_GLOBAL(documents), doc_entry->document_index); /* Keep track of how many SolrDocument instances we currently have */ SOLR_GLOBAL(document_count)--; return ; } } /* }}} */ /* {{{ proto void SolrInputDocument::__clone(void) Clones the current object. Not to be called directly. */ PHP_METHOD(SolrInputDocument, __clone) { RETURN_NULL(); } /* }}} */ /* {{{ proto void SolrInputDocument::__sleep(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrInputDocument, __sleep) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1005, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1005_MSG); } /* }}} */ /* {{{ proto void SolrInputDocument::__wakeup(void) Should not be called directly. Serialization is not supported. */ PHP_METHOD(SolrInputDocument, __wakeup) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1005, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1005_MSG); } /* }}} */ /* {{{ proto bool SolrInputDocument::setBoost(float document_boost) Sets the boost for the document. */ PHP_METHOD(SolrInputDocument, setBoost) { double boost_value = 0.0f; solr_document_t *doc_entry = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "d", &boost_value) == FAILURE) { RETURN_FALSE; } /* If the submitted boost_value is negative. */ if (boost_value < 0.0) { RETURN_FALSE; } /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == SUCCESS) { doc_entry->document_boost = boost_value; RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto float SolrInputDocument::getBoost(void) Retrieves the boost for the document. */ PHP_METHOD(SolrInputDocument, getBoost) { solr_document_t *doc_entry = NULL; if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == SUCCESS) { RETURN_DOUBLE(doc_entry->document_boost); } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrInputDocument::clear(void) Discards all the fields and resets the document boost to zero. */ PHP_METHOD(SolrInputDocument, clear) { solr_document_t *doc_entry = NULL; if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == SUCCESS) { doc_entry->document_boost = 0.0; doc_entry->field_count = 0L; zend_hash_clean(doc_entry->fields); RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrInputDocument::addField(string field_name, field_value [, float field_boost]) Adds a field to the document. Can be called multiple times. */ PHP_METHOD(SolrInputDocument, addField) { solr_char_t *field_name = NULL, *field_value = NULL; COMPAT_ARG_SIZE_T field_name_length = 0, field_value_length = 0; solr_document_t *doc_entry = NULL; double field_boost = 0.0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|d", &field_name, &field_name_length, &field_value, &field_value_length, &field_boost) == FAILURE) { RETURN_FALSE; } if (!field_name_length) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == SUCCESS) { solr_field_list_t *field_values = NULL; /* If the field already exists in the SolrDocument instance append the value to the field list queue */ if ((field_values = (solr_field_list_t *)zend_hash_str_find_ptr(doc_entry->fields, field_name, field_name_length)) != NULL) { if (solr_document_insert_field_value(field_values, (solr_char_t *)field_value, field_boost) == FAILURE) { RETURN_FALSE; } } else { /* Otherwise, create a new one and add it to the hash table */ field_values = (solr_field_list_t *) pemalloc(sizeof(solr_field_list_t), SOLR_DOCUMENT_FIELD_PERSISTENT); memset(field_values, 0, sizeof(solr_field_list_t)); field_values->count = 0L; field_values->field_boost = 0.0; field_values->field_name = (solr_char_t *) pestrdup((char *)field_name, SOLR_DOCUMENT_FIELD_PERSISTENT); field_values->head = NULL; field_values->last = NULL; if (solr_document_insert_field_value(field_values, field_value, field_boost) == FAILURE) { solr_destroy_field_list(field_values); RETURN_FALSE; } if (zend_hash_str_add_ptr(doc_entry->fields, field_name, field_name_length,(void *) field_values) == NULL) { solr_destroy_field_list(field_values); RETURN_FALSE; } /* Increment field count only when HEAD is added */ doc_entry->field_count++; } RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrInputDocument::updateField(string fieldName, int modifier, string value) */ PHP_METHOD(SolrInputDocument, updateField) { solr_char_t *field_name = NULL, *field_value = NULL; COMPAT_ARG_SIZE_T field_name_length = 0, field_value_len = 0; solr_document_t *doc_entry; solr_field_list_t *field; long modifier = 0L; if (zend_parse_parameters(ZEND_NUM_ARGS(), "sls", &field_name, &field_name_length, &modifier, &field_value, &field_value_len) == FAILURE) { return; } if (!field_name_length || !field_value_len) { RETURN_FALSE; } if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == FAILURE) { return; } switch (modifier) { case SOLR_FIELD_VALUE_MOD_ADD: case SOLR_FIELD_VALUE_MOD_REMOVE: case SOLR_FIELD_VALUE_MOD_REMOVEREGEX: case SOLR_FIELD_VALUE_MOD_SET: case SOLR_FIELD_VALUE_MOD_INC: break; default: solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4003, SOLR_FILE_LINE_FUNC, SOLR_ERROR_4003_MSG); RETURN_FALSE; } if ((field = zend_hash_str_find_ptr(doc_entry->fields, field_name, field_name_length)) == NULL){ field = (solr_field_list_t *)pemalloc(sizeof(solr_field_list_t), SOLR_DOCUMENT_FIELD_PERSISTENT); memset(field, 0, sizeof(solr_field_list_t)); field->field_name = pestrdup(field_name, SOLR_DOCUMENT_FIELD_PERSISTENT); field->count = 1; field->head = NULL; field->last = NULL; if (modifier > 0) { field->modified = 1; } doc_entry->field_count++; if (zend_hash_str_add_ptr(doc_entry->fields, field_name, field_name_length, field) == NULL) { RETURN_FALSE; } } else if (field->modified == 0) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_4004, SOLR_FILE_LINE_FUNC, SOLR_ERROR_4004_MSG); RETURN_FALSE; } solr_document_insert_field_value_ex(field, field_value, 0.0, modifier); } /* }}} */ /* {{{ proto bool SolrInputDocument::setFieldBoost(string fieldname, float boost_value) Sets the boost for the specified field. */ PHP_METHOD(SolrInputDocument, setFieldBoost) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; double field_boost = 0.0; solr_document_t *doc_entry = NULL; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sd", &field_name, &field_name_length, &field_boost) == FAILURE) { RETURN_FALSE; } if (!field_name_length) { RETURN_FALSE; } if (field_boost < 0.0) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == SUCCESS) { solr_field_list_t *field_values = NULL; /* If the field already exists in the SolrDocument instance append the value to the field list queue */ if ((field_values = zend_hash_str_find_ptr(doc_entry->fields, field_name, field_name_length)) != NULL) { field_values->field_boost = field_boost; RETURN_TRUE; } RETURN_FALSE; } RETURN_FALSE; } /* }}} */ /** * {{{ proto bool SolrInputDocument::setVersion(int version) * Enable optimistic concurrency using assertions */ PHP_METHOD(SolrInputDocument, setVersion) { long version = 0; solr_document_t *doc_entry = NULL; solr_field_list_t *field = NULL; solr_char_t *field_name = "_version_"; COMPAT_ARG_SIZE_T field_name_length = sizeof("_version_"); char version_str[80]; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, solr_ce_SolrIllegalArgumentException, &error_handling); if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &version) == FAILURE) { zend_restore_error_handling(&error_handling); return; } zend_restore_error_handling(&error_handling); if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == FAILURE) { return; } if (zend_hash_str_find_ptr(doc_entry->fields, field_name, field_name_length)) { zend_hash_str_del(doc_entry->fields, field_name, field_name_length); } field = pemalloc(sizeof(solr_field_list_t), SOLR_DOCUMENT_FIELD_PERSISTENT); field->count = 0L; field->field_boost = 0.0f; field->field_name = pestrdup(field_name, SOLR_DOCUMENT_FIELD_PERSISTENT); field->head = field->last = NULL; snprintf(version_str, 80, "%ld", version); solr_document_insert_field_value(field, version_str, 0.0); if (zend_hash_str_update_ptr(doc_entry->fields, field_name, field_name_length, field) == NULL) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1008, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1008_MSG); solr_destroy_field_list(field); return; } RETURN_TRUE; } /* }}} */ /* {{{ proto int SolrInputDocument::getVersion( void ) */ PHP_METHOD(SolrInputDocument, getVersion) { solr_document_t *doc_entry = NULL; solr_char_t *field_name = "_version_"; COMPAT_ARG_SIZE_T field_name_length = sizeof("_version_"); solr_field_list_t *field = NULL; if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == FAILURE) { RETURN_NULL(); } if ((field = zend_hash_str_find_ptr(doc_entry->fields, field_name, field_name_length)) != NULL) { RETURN_LONG(atol(field->head->field_value)); } RETURN_NULL(); } /* }}} */ /* {{{ proto float SolrInputDocument::getFieldBoost(string fieldname) Returns the boost value for the specified field. */ PHP_METHOD(SolrInputDocument, getFieldBoost) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; solr_document_t *doc_entry = NULL; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (!field_name_length) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == SUCCESS) { solr_field_list_t *field_values = NULL; if ((field_values = zend_hash_str_find_ptr(doc_entry->fields, field_name, field_name_length)) != NULL) { RETURN_DOUBLE(field_values->field_boost); } RETURN_FALSE; } RETURN_FALSE; } /* }}} */ /* {{{ proto array SolrInputDocument::getFieldNames(void) Returns an array of all the field names in the document. */ PHP_METHOD(SolrInputDocument, getFieldNames) { solr_document_get_field_names(INTERNAL_FUNCTION_PARAM_PASSTHRU); } /* }}} */ /* {{{ proto int SolrInputDocument::getFieldCount(void) Returns the number of fields in document. Multivalued fields are only counted once. */ PHP_METHOD(SolrInputDocument, getFieldCount) { solr_document_t *doc_entry = NULL; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == SUCCESS) { RETURN_LONG(zend_hash_num_elements(doc_entry->fields)); } RETURN_FALSE; } /* }}} */ /* {{{ proto SolrDocumentField SolrInputDocument::getField(string fieldname) Returns the requested field. */ PHP_METHOD(SolrInputDocument, getField) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; solr_document_t *doc_entry = NULL; zend_string *field_str = NULL; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (!field_name_length) { RETURN_FALSE; } field_str = zend_string_init(field_name, field_name_length, SOLR_DOCUMENT_FIELD_PERSISTENT); /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == SUCCESS) { solr_field_list_t *field_values = NULL; if ((field_values = zend_hash_find_ptr(doc_entry->fields, field_str)) != NULL) { solr_create_document_field_object(field_values, &return_value); /* The field was retrieved, so we're done here */ zend_string_release(field_str); return ; } goto return_false; } return_false: zend_string_release(field_str); RETURN_FALSE; } /* }}} */ /* {{{ proto array SolrInputDocument::toArray(void) Returns an array representation of the object. */ PHP_METHOD(SolrInputDocument, toArray) { solr_document_t *doc_entry = NULL; zval fields_array; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == SUCCESS) { HashTable *fields_ht; array_init(return_value); array_init(&fields_array); zend_hash_init(Z_ARRVAL(fields_array), zend_hash_num_elements(doc_entry->fields), NULL, ZVAL_PTR_DTOR, 0); add_assoc_double(return_value, "document_boost", doc_entry->document_boost); add_assoc_long(return_value, "field_count", doc_entry->field_count); add_assoc_zval(return_value, "fields", &fields_array); fields_ht = doc_entry->fields; SOLR_HASHTABLE_FOR_LOOP(fields_ht) { solr_field_list_t *field = NULL; zval current_field; zval *current_field_ptr = ¤t_field; field = zend_hash_get_current_data_ptr(fields_ht); /* create SolrDocumentField */ solr_create_document_field_object(field, ¤t_field_ptr); /* create SolrDocumentField to the fields HT */ add_next_index_zval(&fields_array, current_field_ptr); } /* We are done */ return; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrInputDocument::fieldExists(string field_name) Checks if the field name exists in the document. */ PHP_METHOD(SolrInputDocument, fieldExists) { solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_length = 0; solr_document_t *doc_entry = NULL; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_length) == FAILURE) { RETURN_FALSE; } if (!field_name_length) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == SUCCESS) { if (zend_hash_str_exists(doc_entry->fields, field_name, field_name_length)) { RETURN_TRUE; } else { RETURN_FALSE; } } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrInputDocument::deleteField(string field_name) Removes the request field from the document. */ PHP_METHOD(SolrInputDocument, deleteField) { solr_document_t *doc_entry = NULL; char *field_name; COMPAT_ARG_SIZE_T field_name_len = 0; /* Process the parameters passed to the default constructor */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &field_name, &field_name_len) == FAILURE) { RETURN_FALSE; } if (!field_name_len) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == SUCCESS) { if (zend_hash_str_del(doc_entry->fields, field_name, field_name_len) == SUCCESS) { doc_entry->field_count--; RETURN_TRUE; } RETURN_FALSE; } RETURN_FALSE; } /* }}} */ /* {{{ proto bool SolrInputDocument::sort(int sort_criterion [, int sort_direction]) Sorts the document fields by the specified criterion. */ PHP_METHOD(SolrInputDocument, sort) { long int order_by = 0L; long int sort_direction = SOLR_SORT_ASC; solr_document_t *doc_entry = NULL; int renumber = 0; /* The pointer to the comparison function used by zend_qsort */ #if PHP_VERSION_ID < 80000 compare_func_t comparison_function = NULL; #else bucket_compare_func_t comparison_function = NULL; #endif if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &order_by, &sort_direction) == FAILURE) { RETURN_FALSE; } /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == FAILURE) { RETURN_FALSE; } /* {{{ Select the appropriate comparison function */ switch(order_by) { case SOLR_SORT_FIELD_NAME : /* Sorting by field name */ { switch(sort_direction) { case SOLR_SORT_ASC : comparison_function = solr_compare_field_name; break; case SOLR_SORT_DESC : comparison_function = solr_rcompare_field_name; break; } } break; /* case SOLR_SORT_FIELD_NAME */ case SOLR_SORT_FIELD_VALUE_COUNT : /* Sorting by number of values per field */ { switch(sort_direction) { case SOLR_SORT_ASC : comparison_function = solr_compare_field_value_count; break; case SOLR_SORT_DESC : comparison_function = solr_rcompare_field_value_count; break; } } break; /* case SOLR_SORT_FIELD_VALUE_COUNT */ case SOLR_SORT_FIELD_BOOST_VALUE : /* Sorting by field boost values */ { switch(sort_direction) { case SOLR_SORT_ASC : comparison_function = solr_compare_field_boost_value; break; case SOLR_SORT_DESC : comparison_function = solr_rcompare_field_boost_value; break; } } break; /* case SOLR_SORT_FIELD_BOOST_VALUE */ default : /* Undefined sort criteria */ RETURN_FALSE; break; } /* }}} switch(order_by) */ /* Undefined sort direction. It was not ASC or DESC */ if (!comparison_function) { RETURN_FALSE; } zend_hash_sort(doc_entry->fields, comparison_function, renumber); RETURN_TRUE; } /* }}} */ /* {{{ proto bool SolrInputDocument::merge(SolrInputDocument source [, bool override]) Merges the source document to the current object. */ PHP_METHOD(SolrInputDocument, merge) { solr_document_t *destination_document = NULL; solr_document_t *source_document = NULL; /* The destination SolrDocument instance */ zval * destination_document_zval = getThis(); /* The source SolrDocument instance */ zval *source_document_zval = NULL; /* Should we skip fields that already exist in destination */ zend_bool overwrite = (zend_bool) 0; copy_ctor_func_t p_copy_ctor = (copy_ctor_func_t) field_copy_constructor; if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|b", &source_document_zval, solr_ce_SolrInputDocument, &overwrite) == FAILURE) { RETURN_FALSE; } if (solr_fetch_document_entry(OBJ_FOR_PROP(source_document_zval), &source_document) == FAILURE) { RETURN_FALSE; } if (solr_fetch_document_entry(OBJ_FOR_PROP(destination_document_zval), &destination_document) == FAILURE) { RETURN_FALSE; } if (zend_hash_num_elements(source_document->fields) == 0) { php_error_docref(NULL, E_WARNING, "Source SolrInputDocument has no fields. Source documentId"); RETURN_FALSE; } /* Copy the fields in the source HashTable to the destination HashTable */ zend_hash_merge(destination_document->fields, source_document->fields, p_copy_ctor, overwrite); /* Update the field count */ destination_document->field_count = (uint32_t) zend_hash_num_elements(destination_document->fields); RETURN_TRUE; } /* }}} */ /* {{{ proto void SolrInputDocument::addChildDocument(SolrInputDocument child) Adds a child document */ PHP_METHOD(SolrInputDocument, addChildDocument) { zval *child_obj = NULL; solr_document_t *solr_doc = NULL, *child_doc_entry = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &child_obj, solr_ce_SolrInputDocument) == FAILURE) { RETURN_FALSE; } if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &solr_doc) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1008, SOLR_FILE_LINE_FUNC, "Internal Error: Unable to fetch document_entry."); return; } if (solr_fetch_document_entry(OBJ_FOR_PROP(child_obj), &child_doc_entry) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1008, SOLR_FILE_LINE_FUNC, "Internal Error: Unable to fetch document_entry for child document."); return; } /* SolrInputDocument must contain at least one field */ if (0 == zend_hash_num_elements(child_doc_entry->fields)) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Child document has no fields"); return; } if (zend_hash_next_index_insert(solr_doc->children, child_obj) == NULL) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Internal Error: Unable to add child to the hashtable."); } else { Z_ADDREF_P(child_obj); } } /* }}} */ /* {{{ proto void SolrInputDocument::addChildDocuments(array) Adds a child documents */ PHP_METHOD(SolrInputDocument, addChildDocuments) { HashTable *solr_input_docs; solr_document_t *solr_doc = NULL; zval *docs_array = NULL; int num_input_docs = 0, curr_pos = 0; size_t pos = 0U; zval **input_docs = NULL, *current_input_doc = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &docs_array) == FAILURE) { return; } if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &solr_doc) == FAILURE) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1008, SOLR_FILE_LINE_FUNC, "Internal Error: Unable to fetch document_entry."); } solr_input_docs = Z_ARRVAL_P(docs_array); num_input_docs = zend_hash_num_elements(solr_input_docs); if(!num_input_docs) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "The array parameter passed is empty"); return; } /* This should be released if there is an error */ input_docs = (zval **) pemalloc((sizeof(zval *) * (num_input_docs + 1)), SOLR_DOCUMENT_PERSISTENT); memset(input_docs, 0, sizeof(zval *) * (num_input_docs + 1)); /* Please check all the SolrInputDocument instances passed via the array */ SOLR_HASHTABLE_FOR_LOOP(solr_input_docs) { zval *solr_input_doc = NULL; solr_document_t *doc_entry = NULL; HashTable *document_fields; solr_input_doc = zend_hash_get_current_data(solr_input_docs); if (Z_TYPE_P(solr_input_doc) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(solr_input_doc), solr_ce_SolrInputDocument)) { SOLR_FREE_DOC_ENTRIES(input_docs); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u is not a valid SolrInputDocument instance", (curr_pos + 1U)); return; } if (solr_fetch_document_entry(OBJ_FOR_PROP(solr_input_doc), &doc_entry) == FAILURE) { SOLR_FREE_DOC_ENTRIES(input_docs); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u is not valid. Object not present in HashTable", (curr_pos + 1U)); return; } document_fields = doc_entry->fields; /* SolrInputDocument must contain at least one field */ if (0 == zend_hash_num_elements(document_fields)) { SOLR_FREE_DOC_ENTRIES(input_docs); solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u has no fields", (curr_pos + 1U)); return; } input_docs[curr_pos] = solr_input_doc; curr_pos++; } /* Grab the first (solr_document_t *) pointer */ current_input_doc = input_docs[pos]; while(current_input_doc != NULL) { if (zend_hash_next_index_insert(solr_doc->children, current_input_doc) == NULL) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "SolrInputDocument number %u has no fields", (pos + 1U)); SOLR_FREE_DOC_ENTRIES(input_docs); return; } /* todo possible leak */ Z_ADDREF_P(current_input_doc); pos++; current_input_doc = input_docs[pos]; } SOLR_FREE_DOC_ENTRIES(input_docs); } /* }}} */ /* {{{ proto array SolrInputDocument::getChildDocuments( void ) Returns child documents or null if none */ PHP_METHOD(SolrInputDocument, getChildDocuments) { solr_document_t *solr_doc = NULL; if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &solr_doc) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to fetch document entry for current object"); } if (zend_hash_num_elements(solr_doc->children) > 0) { array_init(return_value); zend_hash_init(Z_ARRVAL_P(return_value), zend_hash_num_elements(solr_doc->children), NULL, ZVAL_PTR_DTOR, 0); zend_hash_copy(Z_ARRVAL_P(return_value), solr_doc->children, (copy_ctor_func_t)zval_add_ref); } } /* }}} */ /* {{{ proto bool SolrInputDocument::hasChildDocuments (void) Checks whether this document has got child documents */ PHP_METHOD(SolrInputDocument, hasChildDocuments) { solr_document_t *solr_doc = NULL; if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &solr_doc)) { php_error_docref(NULL, E_ERROR, "Unable to fetch document entry for current object"); } if (zend_hash_num_elements(solr_doc->children) > 0) { RETURN_TRUE; } else { RETURN_FALSE; } } /* }}} */ /* {{{ proto int SolrInputDocument::getChildDocumentsCount (void) Returns the number of child documents */ PHP_METHOD(SolrInputDocument, getChildDocumentsCount) { solr_document_t *solr_doc = NULL; if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &solr_doc)) { php_error_docref(NULL, E_ERROR, "Unable to fetch document entry for current object"); } ZVAL_LONG(return_value, zend_hash_num_elements(solr_doc->children)); } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/php_solr_object.c000066400000000000000000000240731374041537100223400ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_solr.h" /* {{{ PHP_SOLR_API void solr_object_write_property(zval *object, zval *member, zval *value) */ #if PHP_VERSION_ID < 70400 PHP_SOLR_API void solr_object_write_property(zval *object, zval *member, zval *value, void **cache_slot) #elif PHP_VERSION_ID < 80000 PHP_SOLR_API zval *solr_object_write_property(zval *object, zval *member, zval *value, void **cache_slot) #else PHP_SOLR_API zval *solr_object_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) #endif { solr_throw_exception(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1006_MSG, SOLR_ERROR_1006, SOLR_FILE_LINE_FUNC); #if PHP_VERSION_ID >= 70400 return value; #endif } /* }}} */ /* {{{ PHP_SOLR_API void solr_object_write_dimension(zval *object, zval *offset, zval *value) */ #if PHP_VERSION_ID < 80000 PHP_SOLR_API void solr_object_write_dimension(zval *object, zval *offset, zval *value) #else PHP_SOLR_API void solr_object_write_dimension(zend_object *object, zval *offset, zval *value) #endif { solr_throw_exception(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1006_MSG, SOLR_ERROR_1006, SOLR_FILE_LINE_FUNC); if (Z_TYPE_P(offset) == IS_STRING) { php_error_docref(NULL, E_WARNING, "Attempting to set value for [%s] property in a SolrObject instance", Z_STRVAL_P(offset)); } } /* }}} */ /* {{{ PHP_SOLR_API void solr_object_unset_property(zval *object, zval *member) */ #if PHP_VERSION_ID < 80000 PHP_SOLR_API void solr_object_unset_property(zval *object, zval *member, void **cache_slot) #else PHP_SOLR_API void solr_object_unset_property(zend_object *object, zend_string *member, void **cache_slot) #endif { solr_throw_exception(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1006_MSG, SOLR_ERROR_1006, SOLR_FILE_LINE_FUNC); } /* }}} */ /* {{{ PHP_SOLR_API void solr_object_unset_dimension(zval *object, zval *offset) */ #if PHP_VERSION_ID < 80000 PHP_SOLR_API void solr_object_unset_dimension(zval *object, zval *offset) #else PHP_SOLR_API void solr_object_unset_dimension(zend_object *object, zval *offset) #endif { solr_throw_exception(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1006_MSG, SOLR_ERROR_1006, SOLR_FILE_LINE_FUNC); if (Z_TYPE_P(offset) == IS_STRING) { php_error_docref(NULL, E_WARNING, "Attempting to remove [%s] property in a SolrObject instance", Z_STRVAL_P(offset)); } } /* }}} */ /* {{{ PHP_SOLR_API zval *solr_object_read_property(zval *object, zval *member, int type) */ #if PHP_VERSION_ID < 80000 PHP_SOLR_API zval *solr_object_read_property(zval *object, zval *member, int type, void **cache_slot, zval* rv) #else PHP_SOLR_API zval *solr_object_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval* rv) #endif { zval *value = &EG(uninitialized_zval); char *name = NULL; HashTable *properties = NULL; #if PHP_VERSION_ID < 70000 if (Z_TYPE_P(member) != IS_STRING) { return value; } #endif SOLR_HASHTABLE_FOR_LOOP(properties) { char *property_name = NULL; /* If the property name is in the HashTable */ if (property_name && !strcmp(property_name, name)) { value = zend_hash_get_current_data(properties); } } return value; } /* }}} */ /* {{{ proto SolrObject::__construct(void) Constructor for SolrObject */ PHP_METHOD(SolrObject, __construct) { Z_OBJ_HT_P(getThis()) = &solr_object_handlers; } /* }}} */ /* {{{ proto SolrObject::__destruct(void) Destructor for SolrObject. */ PHP_METHOD(SolrObject, __destruct) { } /* }}} */ /* {{{ proto void SolrObject::__set(string property_name, mixed value) Magic method for setting/updating property values. */ PHP_METHOD(SolrObject, __set) { } /* }}} */ /* {{{ proto mixed SolrObject::__get(string property_name) Magic method for retrieving properties. */ PHP_METHOD(SolrObject, __get) { solr_char_t *name = NULL; COMPAT_ARG_SIZE_T name_len = 0; zval *property = NULL, rv; zend_bool copy_value = 1; void *dtor = NULL; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) { RETURN_FALSE; } property = zend_read_property(solr_ce_SolrObject, OBJ_FOR_PROP(getThis()), name, name_len, 0, &rv); if (property) { RETURN_ZVAL(property, copy_value, dtor); } } /* }}} */ /* {{{ proto bool SolrObject::__isset(string property_name) Magic method for checking if a property exists in the object. */ PHP_METHOD(SolrObject, __isset) { solr_char_t *name = NULL; COMPAT_ARG_SIZE_T name_len = 0; zend_object *zobject = NULL; zval *value = NULL; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) { RETURN_FALSE; } zobject = Z_OBJ_P(getThis()); value = zend_hash_str_find(zobject->properties, name, name_len); if (value) { RETURN_TRUE; } RETURN_FALSE; } /* }}} */ /* {{{ proto void SolrObject::__unset(string property_name) Magic method for removing the specified property. */ PHP_METHOD(SolrObject, __unset) { solr_char_t *name = NULL; COMPAT_ARG_SIZE_T name_len = 0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) { return; } solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1002, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1002_MSG, name); RETURN_FALSE; } /* }}} */ /* {{{ proto void SolrObject::offsetSet(string key, mixed value) Sets the specified key to value. */ PHP_METHOD(SolrObject, offsetSet) { solr_char_t *name = NULL; COMPAT_ARG_SIZE_T name_len = 0; zval *prop = NULL; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz", &name, &name_len, &prop) == FAILURE) { RETURN_FALSE; } if (prop && Z_TYPE_P(prop) == IS_NULL) { solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1002, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1002_MSG, name); return ; } zend_update_property(Z_OBJCE_P(getThis()), OBJ_FOR_PROP(getThis()), name, name_len, prop); } /* }}} */ /* {{{ proto mixed SolrObject::offsetGet(string key) Retrieves the requested key. */ PHP_METHOD(SolrObject, offsetGet) { solr_char_t *name = NULL; COMPAT_ARG_SIZE_T name_len = 0; zend_object *zobject = Z_OBJ_P(getThis()); HashTable *properties = zobject->properties; zval *property_value = NULL; zend_bool copy_value = 1; void *dtor = NULL; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) { RETURN_FALSE; } if ((property_value = zend_hash_str_find(properties, name, name_len)) != NULL) { goto job_complete; } else { RETURN_NULL(); } job_complete : if (property_value && (property_value)) { RETURN_ZVAL((property_value), copy_value, dtor); } } /* }}} */ /* {{{ proto bool SolrObject::offsetExists(string key) Checks if the key exists. */ PHP_METHOD(SolrObject, offsetExists) { solr_char_t *name = NULL; COMPAT_ARG_SIZE_T name_len = 0; zend_object *zobject = Z_OBJ_P(getThis()); HashTable *properties = zobject->properties; zend_bool property_exists = 0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) { RETURN_FALSE; } if (!properties) { RETURN_FALSE; } property_exists = zend_hash_str_exists(properties, name, name_len); zend_hash_internal_pointer_reset(properties); RETURN_BOOL(property_exists); } /* }}} */ /* {{{ proto void SolrObject::offsetUnset(string key) Removes the specified key. */ PHP_METHOD(SolrObject, offsetUnset) { solr_char_t *name = NULL; COMPAT_ARG_SIZE_T name_len = 0; /* Process the parameters passed to the method */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) { return; } solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_1002, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1002_MSG, name); RETURN_FALSE; } /* }}} */ /* {{{ proto array SolrObject::getPropertyNames(void) Returns an array of all the properties/keys in the object. */ PHP_METHOD(SolrObject, getPropertyNames) { zend_object *zobject = Z_OBJ_P(getThis()); zval new_val; zend_ulong num_idx; zend_string *str_idx; HashTable *properties = zobject->properties; if (! properties || !zend_hash_num_elements(properties)) { array_init_size(return_value, 0); zend_hash_real_init(Z_ARRVAL_P(return_value), 1); return; } array_init_size(return_value, zend_hash_num_elements(properties)); zend_hash_real_init(Z_ARRVAL_P(return_value), 1); ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(return_value)) { /* Go through input array and add keys to the return array */ ZEND_HASH_FOREACH_KEY(properties, num_idx, str_idx) { if (str_idx) { ZVAL_STR_COPY(&new_val, str_idx); } else { ZVAL_LONG(&new_val, num_idx); } ZEND_HASH_FILL_ADD(&new_val); } ZEND_HASH_FOREACH_END(); } ZEND_HASH_FILL_END(); } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/php_solr_params.c000066400000000000000000000666571374041537100223730ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_solr.h" /* {{{ static void solr_serialize_xml_set_param_props(xmlNode *xml_param_node, solr_param_t *param) */ static void solr_serialize_xml_set_param_props(xmlNode *xml_param_node, solr_param_t *param) { char tmp_buffer[32]; /* This should be enough to hold any value */ memset(tmp_buffer, 0, sizeof(tmp_buffer)); /* Set the name attribute on the param node */ xmlNewProp(xml_param_node, (xmlChar *) "name", (xmlChar *) param->param_name); php_sprintf(tmp_buffer, "%d", param->type); /* Set the type attribute on the param node */ xmlNewProp(xml_param_node, (xmlChar *) "type", (xmlChar *) tmp_buffer); php_sprintf(tmp_buffer, "%d", param->allow_multiple); /* Set the allow_multiple attribute on the param node */ xmlNewProp(xml_param_node, (xmlChar *) "allow_multiple", (xmlChar *) tmp_buffer); php_sprintf(tmp_buffer, "%u", param->count); /* Set the count attribute on the param node */ xmlNewProp(xml_param_node, (xmlChar *) "count", (xmlChar *) tmp_buffer); php_sprintf(tmp_buffer, "%d", param->delimiter); /* Set the delimiter attribute on the param node */ xmlNewProp(xml_param_node, (xmlChar *) "delimiter", (xmlChar *) tmp_buffer); php_sprintf(tmp_buffer, "%d", param->arg_separator); /* Set the arg_separator attribute on the param node */ xmlNewProp(xml_param_node, (xmlChar *) "arg_separator", (xmlChar *) tmp_buffer); } /* }}} */ /* {{{ static void solr_serialize_normal_param_value(xmlNode *xml_params_node, solr_param_t *param) */ static void solr_serialize_normal_param_value(xmlNode *xml_params_node, solr_param_t *param) { xmlNode *xml_param_node = xmlNewChild(xml_params_node, NULL, (xmlChar *) "param", NULL); solr_param_value_t *curr_value = param->head; solr_serialize_xml_set_param_props(xml_param_node, param); while(curr_value != NULL) { xmlChar *param_value_txt = xmlEncodeEntitiesReentrant(xml_params_node->doc, (xmlChar *) curr_value->contents.normal.str); xmlNewChild(xml_param_node, NULL, (xmlChar *) "param_value", param_value_txt); xmlFree(param_value_txt); curr_value = curr_value->next; /* Go to the next value in the list */ } } /* }}} */ /* {{{ static void solr_serialize_simple_list_param_value(xmlNode *xml_params_node, solr_param_t *param) */ static void solr_serialize_simple_list_param_value(xmlNode *xml_params_node, solr_param_t *param) { xmlNode *xml_param_node = xmlNewChild(xml_params_node, NULL, (xmlChar *) "param", NULL); solr_param_value_t *curr_value = param->head; solr_serialize_xml_set_param_props(xml_param_node, param); while(curr_value != NULL) { xmlChar *param_value_txt = xmlEncodeEntitiesReentrant(xml_params_node->doc, (xmlChar *) curr_value->contents.simple_list.str); xmlNewChild(xml_param_node, NULL, (xmlChar *) "param_value", param_value_txt); xmlFree(param_value_txt); curr_value = curr_value->next; /* Go to the next value in the list */ } } /* }}} */ /* {{{ static void solr_serialize_arg_list_param_value(xmlNode *xml_params_node, solr_param_t *param) */ static void solr_serialize_arg_list_param_value(xmlNode *xml_params_node, solr_param_t *param) { xmlNode *xml_param_node = xmlNewChild(xml_params_node, NULL, (xmlChar *) "param", NULL); solr_param_value_t *curr_value = param->head; solr_serialize_xml_set_param_props(xml_param_node, param); while(curr_value != NULL) { xmlChar *param_value_txt = xmlEncodeEntitiesReentrant(xml_params_node->doc, (xmlChar *) curr_value->contents.arg_list.value.str); xmlChar *arg_value_txt = xmlEncodeEntitiesReentrant(xml_params_node->doc, (xmlChar *) curr_value->contents.arg_list.arg.str); xmlNode *xml_param_value = xmlNewChild(xml_param_node, NULL, (xmlChar *) "param_value", param_value_txt); xmlNewProp(xml_param_value, (xmlChar *) "argument", arg_value_txt); xmlFree(param_value_txt); xmlFree(arg_value_txt); curr_value = curr_value->next; /* Go to the next value in the list */ } } /* }}} */ /* {{{ static int solr_serialize_solr_params_object(xmlChar **serialized, int *size, zval *objptr) */ static int solr_serialize_solr_params_object(xmlChar **serialized, int *size, zval *objptr) { solr_params_t *solr_params = NULL; xmlNode *xml_solr_params = NULL, *xml_params = NULL; xmlDoc *doc_ptr = NULL; HashTable *params = NULL; int format = 1; if (solr_fetch_params_entry(objptr, &solr_params) == FAILURE) { return FAILURE; } if (!serialized || !size || !objptr) { return FAILURE; } doc_ptr = solr_xml_create_xml_doc((xmlChar *) "solr_params", &xml_solr_params); xml_params = xmlNewChild(xml_solr_params, NULL, (xmlChar *) "params", NULL); params = solr_params->params; SOLR_HASHTABLE_FOR_LOOP(params) { solr_param_t *solr_param_ptr = NULL; solr_param_ptr = zend_hash_get_current_data_ptr(params); switch(solr_param_ptr->type) { case SOLR_PARAM_TYPE_NORMAL : { solr_serialize_normal_param_value(xml_params, solr_param_ptr); } break; case SOLR_PARAM_TYPE_SIMPLE_LIST : { solr_serialize_simple_list_param_value(xml_params, solr_param_ptr); } break; case SOLR_PARAM_TYPE_ARG_LIST : { solr_serialize_arg_list_param_value(xml_params, solr_param_ptr); } break; default : { php_error_docref(NULL, E_WARNING, "Invalid Solr Param Type %d", solr_param_ptr->type); } } } xmlIndentTreeOutput = 1; xmlDocDumpFormatMemoryEnc(doc_ptr, serialized, size, "UTF-8", format); xmlFreeDoc(doc_ptr); return SUCCESS; } /* }}} */ /* {{{ static void solr_unserialize_get_param_normal(xmlNode *normal_param, HashTable *params_ht) */ static void solr_unserialize_get_param_normal(xmlNode *normal_param, HashTable *params_ht) { solr_char_t *param_name = NULL; size_t param_name_len = 0U; solr_bool allow_multiple = 0; solr_param_type_t param_type = SOLR_PARAM_TYPE_NORMAL; xmlAttr *currAttr = normal_param->properties; solr_param_t *param = NULL; xmlNode *currNode = normal_param->children; solr_param_value_equal_func_t equal_func = solr_normal_param_value_equal; solr_param_fetch_func_t fetch_func = (solr_param_fetch_func_t) solr_normal_param_value_fetch; solr_param_value_free_func_t free_func = solr_normal_param_value_free; /* Grab the name and setting for this parameter */ while(currAttr != NULL) { if (solr_xml_match_node(currAttr, "name")) { param_name = (solr_char_t *) solr_xml_get_node_contents(currAttr); param_name_len = solr_strlen(param_name); } if (solr_xml_match_node(currAttr, "allow_multiple")) { allow_multiple = solr_xml_get_node_contents_int(currAttr); } currAttr = currAttr->next; } param = solr_create_new_param(param_name, param_name_len, param_type, allow_multiple, equal_func, fetch_func, free_func, '&', 0); /* Retrieve all the values for this parameter */ while(currNode != NULL) { if (solr_xml_match_node(currNode, "param_value")) { xmlChar *pvalue = solr_xml_get_node_contents(currNode); size_t pvalue_length = solr_strlen((char *)pvalue); solr_param_value_t *parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.normal), (solr_char_t *) pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); } currNode = currNode->next; } /* Add this parameter to the hash table */ if (zend_hash_str_add_ptr(params_ht, (char *) param_name, param_name_len, (void *) param) == NULL) { /* Release all the memory allocated to this paramter */ solr_destroy_param(¶m); php_error_docref(NULL, E_WARNING, "Error from %s %s", __func__, (char *) param_name); return; } } /* }}} */ /* {{{ static void solr_unserialize_get_param_simple_list(xmlNode *list_param, HashTable *params_ht) */ static void solr_unserialize_get_param_simple_list(xmlNode *list_param, HashTable *params_ht) { solr_char_t *param_name = NULL; size_t param_name_len = 0U; solr_bool allow_multiple = 0; solr_param_type_t param_type = SOLR_PARAM_TYPE_SIMPLE_LIST; solr_param_t *param = NULL; xmlNode *currNode = list_param->children; xmlAttr *currAttr = list_param->properties; solr_param_value_equal_func_t equal_func = solr_simple_list_param_value_equal; solr_param_fetch_func_t fetch_func = (solr_param_fetch_func_t) solr_simple_list_param_value_fetch; solr_param_value_free_func_t free_func = solr_simple_list_param_value_free; /* Grab the name and setting for this parameter */ while(currAttr != NULL) { if (solr_xml_match_node(currAttr, "name")) { param_name = (solr_char_t *) solr_xml_get_node_contents(currAttr); param_name_len = solr_strlen(param_name); } if (solr_xml_match_node(currAttr, "allow_multiple")) { allow_multiple = solr_xml_get_node_contents_int(currAttr); } currAttr = currAttr->next; } param = solr_create_new_param(param_name, param_name_len, param_type, allow_multiple, equal_func, fetch_func, free_func, ',', 0); /* Retrieve all the values for this parameter */ while(currNode != NULL) { if (solr_xml_match_node(currNode, "param_value")) { solr_char_t *pvalue = (solr_char_t *) solr_xml_get_node_contents(currNode); size_t pvalue_length = solr_strlen(pvalue); solr_param_value_t *parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.simple_list), pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); } currNode = currNode->next; } /* Add this parameter to the hash table */ if (zend_hash_str_add_ptr(params_ht, (char *) param_name, param_name_len, (void *) param) == NULL) { /* Release all the memory allocated to this paramter */ solr_destroy_param(¶m); php_error_docref(NULL, E_WARNING, "Error from %s %s", __func__, (char *) param_name); return; } } /* }}} */ /* {{{ static void solr_unserialize_get_param_arg_list(xmlNode *sort_param, HashTable *params_ht) */ static void solr_unserialize_get_param_arg_list(xmlNode *sort_param, HashTable *params_ht) { solr_char_t *param_name = NULL; size_t param_name_len = 0U; solr_bool allow_multiple = 0; solr_char_t delimiter = 0; solr_char_t separator = 0; xmlAttr *currAttr = sort_param->properties; solr_param_type_t param_type = SOLR_PARAM_TYPE_ARG_LIST; solr_param_t *param = NULL; xmlNode *currNode = sort_param->children; solr_param_value_equal_func_t equal_func = solr_arg_list_param_value_equal; solr_param_fetch_func_t fetch_func = (solr_param_fetch_func_t) solr_arg_list_param_value_fetch; solr_param_value_free_func_t free_func = solr_arg_list_param_value_free; /* Grab the name and setting for this parameter */ while(currAttr != NULL) { if (solr_xml_match_node(currAttr, "name")) { param_name = (solr_char_t *) solr_xml_get_node_contents(currAttr); param_name_len = solr_strlen(param_name); } if (solr_xml_match_node(currAttr, "allow_multiple")) { allow_multiple = solr_xml_get_node_contents_int(currAttr); } if (solr_xml_match_node(currAttr, "delimiter")) { delimiter = solr_xml_get_node_contents_int(currAttr); } if (solr_xml_match_node(currAttr, "arg_separator")) { separator = solr_xml_get_node_contents_int(currAttr); } currAttr = currAttr->next; } param = solr_create_new_param(param_name, param_name_len, param_type, allow_multiple, equal_func, fetch_func, free_func, delimiter, separator); /* Retrieve all the values for this parameter */ while(currNode != NULL) { if (solr_xml_match_node(currNode, "param_value")) { solr_char_t *pvalue = (solr_char_t *) solr_xml_get_node_contents(currNode); xmlAttr *argument = currNode->properties; /* the argument is the only property */ solr_char_t *avalue = (solr_char_t *) solr_xml_get_node_contents(argument); size_t pvalue_length = solr_strlen(pvalue); size_t avalue_length = solr_strlen(avalue); solr_param_value_t *parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.arg_list.value), pvalue, pvalue_length); solr_string_appends(&(parameter_value->contents.arg_list.arg), avalue, avalue_length); solr_params_insert_param_value(param, parameter_value); } currNode = currNode->next; } /* Add this parameter to the hash table */ if (zend_hash_str_add_ptr(params_ht, (char *) param_name, param_name_len, (void *) param) == NULL) { /* Release all the memory allocated to this paramter */ solr_destroy_param(¶m); php_error_docref(NULL, E_WARNING, "Error from %s %s", __func__, (char *) param_name); return; } } /* }}} */ /* {{{ static int solr_unserialize_solr_params_object(const char *serialized, int size, zval *objptr) */ static int solr_unserialize_solr_params_object(const char *serialized, int size, zval *objptr) { solr_params_t *solr_params = NULL; long int params_index = SOLR_UNIQUE_PARAMS_INDEX(); solr_params_t tmp_solr_params; uint32_t nSize = SOLR_INITIAL_HASH_TABLE_SIZE; HashTable *params_ht = NULL; xmlDoc *doc = NULL; xmlXPathContext *xpathctxt; const xmlChar *xpath_expression = (xmlChar *) "/solr_params/params/param/@type"; xmlXPathObject *xpathObj; xmlNodeSet *result = NULL; register size_t num_nodes; register size_t i = 0U; int return_status = SUCCESS; #ifdef PHP_7 solr_params = pemalloc(sizeof(solr_params_t), SOLR_PARAMS_PERSISTENT); #endif zend_update_property_long(Z_OBJCE_P(objptr), OBJ_FOR_PROP(objptr), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, params_index); memset(&tmp_solr_params, 0, sizeof(solr_params_t)); if ((solr_params = zend_hash_index_update_ptr(SOLR_GLOBAL(params), params_index, (void *) solr_params)) == NULL) { php_error_docref(NULL, E_WARNING, "Error while registering SolrParam object in HashTable"); return FAILURE; } solr_params->params_index = params_index; /* Allocate memory for the parameters HashTable using fast cache for HashTables */ ALLOC_HASHTABLE(solr_params->params); zend_hash_init(solr_params->params, nSize, NULL, (dtor_func_t) solr_destory_param_ht_dtor, SOLR_PARAMS_PERSISTENT); params_ht = solr_params->params; doc = xmlReadMemory(serialized, size, NULL, "UTF-8", 0); if (doc == NULL) { php_error_docref(NULL, E_WARNING, "Error while parsing serialized XML string"); return FAILURE; } xpathctxt = xmlXPathNewContext(doc); if (xpathctxt == NULL) { xmlFreeDoc(doc); php_error_docref(NULL, E_WARNING, "Error while creating XML Xpath context"); return FAILURE; } xpathObj = xmlXPathEval(xpath_expression, xpathctxt); if (xpathObj == NULL) { xmlXPathFreeContext(xpathctxt); xmlFreeDoc(doc); php_error_docref(NULL, E_WARNING, "Error while evaluation XML Xpath expression"); return FAILURE; } result = xpathObj->nodesetval; if (result == NULL) { xmlXPathFreeObject(xpathObj); xmlXPathFreeContext(xpathctxt); xmlFreeDoc(doc); php_error_docref(NULL, E_WARNING, "Error while extracting result from XML xpath object during unserialization"); return FAILURE; } num_nodes = result->nodeNr; /* Number of parameter nodes matches in the xmlDocument */ /* Loop through all the parameter nodes and create an entry in the HashTable for each one */ for (i = 0U; i < num_nodes; i++) { xmlNode *currNode = result->nodeTab[i]; /* Absolutely No assumptions. I have to make sure that this is an attribute node */ if (currNode->type == XML_ATTRIBUTE_NODE) { /* Find out what type of parameter this is */ const solr_param_type_t param_type = solr_xml_get_node_contents_int(currNode); /* Get the /solr_params/params/param node */ xmlNode *param_xml_node = currNode->parent; /* Handle each parameter type separately */ switch(param_type) { case SOLR_PARAM_TYPE_NORMAL : { solr_unserialize_get_param_normal(param_xml_node, params_ht); } break; case SOLR_PARAM_TYPE_SIMPLE_LIST : { solr_unserialize_get_param_simple_list(param_xml_node, params_ht); } break; case SOLR_PARAM_TYPE_ARG_LIST : { solr_unserialize_get_param_arg_list(param_xml_node, params_ht); } break; default : { php_error_docref(NULL, E_WARNING, "Invalid parameter type"); return_status = FAILURE; goto loop_complete; } } /* End switch */ } /* End if (currNode->type == XML_ATTRIBUTE_NODE) */ } /* End for */ loop_complete: xmlXPathFreeObject(xpathObj); xmlXPathFreeContext(xpathctxt); xmlFreeDoc(doc); return return_status; } /* }}} */ /* {{{ SolrParams object constructor inner */ PHP_SOLR_API int solr_params_obj_ctor(zval *obj) { long int params_index = SOLR_UNIQUE_PARAMS_INDEX(); solr_params_t solr_params; if (solr_init_params(&solr_params, params_index) == FAILURE) { return FAILURE; } zend_update_property_long(Z_OBJCE_P(obj), OBJ_FOR_PROP(obj), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, params_index); return SUCCESS; } /* }}} */ /* {{{ SolrParams object destructor inner */ PHP_SOLR_API void solr_params_obj_dtor(zval *obj) { solr_params_t *solr_params = NULL; /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_params_entry(obj, &solr_params) == SUCCESS) { zend_hash_index_del(SOLR_GLOBAL(params), solr_params->params_index); return ; } } /* }}} */ /* {{{ proto SolrParams::__clone(void) Should never be called directly. Throws exceptions whenever there is an attempt to clone a SolrParams instance */ PHP_METHOD(SolrParams, __clone) { long int params_index = SOLR_UNIQUE_PARAMS_INDEX(); solr_params_t solr_params; if (solr_init_params(&solr_params, params_index) == FAILURE) { return; } zend_update_property_long(solr_ce_SolrQuery, OBJ_FOR_PROP(getThis()), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, params_index); solr_throw_exception_ex(solr_ce_SolrIllegalOperationException, SOLR_ERROR_4001, SOLR_FILE_LINE_FUNC, "Cloning of SolrParams object instances is currently not supported"); } /* }}} */ /* {{{ proto SolrParams::setParam(string param_name, string param_value) Sets the parameter to the specified value */ PHP_METHOD(SolrParams, setParam) { solr_char_t *param_name = NULL; COMPAT_ARG_SIZE_T param_name_length = 0; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", ¶m_name, ¶m_name_length, ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrParams::addParam(string param_name, string param_value) Adds another param_name to the object. */ PHP_METHOD(SolrParams, addParam) { solr_char_t *param_name = NULL; COMPAT_ARG_SIZE_T param_name_length = 0; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", ¶m_name, ¶m_name_length, ¶m_value, ¶m_value_length) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_length, param_value, param_value_length) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrParams::getParam(string param_name) Retrieves a parameter value */ PHP_METHOD(SolrParams, getParam) { solr_char_t *param_name = NULL; COMPAT_ARG_SIZE_T param_name_length = 0; solr_param_t *solr_param = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", ¶m_name, ¶m_name_length) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_FALSE; } if (!param_name_length) { php_error_docref(NULL, E_WARNING, "Invalid parameter name"); RETURN_NULL(); } if (solr_param_find(getThis(), param_name, param_name_length, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } if (!solr_param) { /* This should never happen unless there is a logic error in solr_param_find() */ php_error_docref(NULL, E_ERROR, "Very severe internal error while fetching (solr_param_t **) from solr_param_find() %s", __func__); return; } switch(solr_param->type) { case SOLR_PARAM_TYPE_NORMAL : { if (solr_param->allow_multiple) { array_init(return_value); solr_normal_param_value_display(solr_param, return_value); return; } else { solr_normal_param_value_display_string(solr_param, return_value); return; } } break; case SOLR_PARAM_TYPE_SIMPLE_LIST : { array_init(return_value); solr_simple_list_param_value_display(solr_param, return_value); return; } break; case SOLR_PARAM_TYPE_ARG_LIST : { array_init(return_value); solr_arg_list_param_value_display(solr_param, return_value); return; } break; default : { /* This should never happen. However, never say never! */ php_error_docref(NULL, E_ERROR, "Invalid parameter type in switch case %s", __func__); } } /* END switch(solr_param->type) */ } /* }}} */ /* {{{ proto array SolrParams::getPreparedParams(void) Returns an array of all the parameters (url-encoded) as they will be sent in the name-value pair POST request. */ PHP_METHOD(SolrParams, getPreparedParams) { solr_params_t *solr_params = NULL; array_init(return_value); /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_params_entry(getThis(), &solr_params) == SUCCESS) { HashTable *params = solr_params->params; SOLR_HASHTABLE_FOR_LOOP(params) { solr_param_t *solr_param = NULL; solr_string_t tmp_buffer; solr_param = zend_hash_get_current_data_ptr(params); memset(&tmp_buffer, 0, sizeof(solr_string_t)); solr_param->fetch_func(solr_param, &tmp_buffer); add_assoc_stringl(return_value, solr_param->param_name, tmp_buffer.str, tmp_buffer.len); solr_string_free(&tmp_buffer); } return; } php_error_docref(NULL, E_WARNING, "SolrParams instance could not be retrieved from HashTable"); RETURN_NULL(); } /* }}} */ /* {{{ proto array SolrParams::getParams(void) Returns an array of the parameters in the object. The values are not url-encoded. */ PHP_METHOD(SolrParams, getParams) { solr_params_t *solr_params = NULL; array_init(return_value); /* Retrieve the document entry for this SolrDocument */ if (solr_fetch_params_entry(getThis(), &solr_params) == SUCCESS) { HashTable *params = solr_params->params; SOLR_HASHTABLE_FOR_LOOP(params) { solr_param_t *solr_param_ptr = NULL; solr_param_display_func_t display_func = NULL; zval *current_param = NULL; solr_param_ptr = zend_hash_get_current_data_ptr(params); switch(solr_param_ptr->type) { case SOLR_PARAM_TYPE_NORMAL : { display_func = solr_normal_param_value_display; } break; case SOLR_PARAM_TYPE_SIMPLE_LIST : { display_func = solr_simple_list_param_value_display; } break; case SOLR_PARAM_TYPE_ARG_LIST : { display_func = solr_arg_list_param_value_display; } break; default : { php_error_docref(NULL, E_WARNING, "Invalid parameter type"); } } MAKE_STD_ZVAL(current_param); array_init(current_param); add_assoc_zval(return_value, solr_param_ptr->param_name, current_param); display_func(solr_param_ptr, current_param); #ifdef PHP_7 efree(current_param); #endif } return; } php_error_docref(NULL, E_WARNING, "SolrParams instance could not be retrieved from HashTable"); RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrParams::__toString(void) Returns a string representation of the object */ PHP_METHOD(SolrParams, __toString) { solr_params_t *solr_params = NULL; /* Retrieve the params entry */ if (solr_fetch_params_entry(getThis(), &solr_params) == SUCCESS) { solr_string_t params_str = solr_params_to_string(solr_params, 0); if (params_str.str && params_str.len) { RETVAL_STRINGL((char *) params_str.str, params_str.len); solr_string_free(&(params_str)); return; } } RETVAL_STRINGL(SOLR_SPACE_STRING, sizeof(SOLR_SPACE_STRING)-1); } /* }}} */ /* {{{ proto string SolrParams::toString([bool urlEncode=false]) Returns a string representation of the object */ PHP_METHOD(SolrParams, toString) { solr_params_t *solr_params = NULL; zend_bool url_encode = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &url_encode) == FAILURE) { return; } /* Retrieve the params entry */ if (solr_fetch_params_entry(getThis(), &solr_params) == SUCCESS) { solr_string_t params_str = solr_params_to_string(solr_params, url_encode); if (params_str.str && params_str.len) { RETVAL_STRINGL((char *) params_str.str, params_str.len); solr_string_free(&(params_str)); return; } } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrParams::serialize(void) Returns a string representation of the object. Used for custom serialization. */ PHP_METHOD(SolrParams, serialize) { xmlChar *serialized = NULL; int size = 0; if (solr_serialize_solr_params_object(&serialized, &size, getThis()) == FAILURE || !serialized || !size) { php_error_docref(NULL, E_WARNING, "Unable to serialize object"); RETURN_NULL(); } RETVAL_STRINGL((char *) serialized, size); xmlFree(serialized); } /* }}} */ /* {{{ proto void SolrParams::unserialize(string serialized) Brings the serialized object back to life. */ PHP_METHOD(SolrParams, unserialize) { char *serialized_object = NULL; COMPAT_ARG_SIZE_T serialized_object_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized_object, &serialized_object_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if(serialized_object_len == 0) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_unserialize_solr_params_object(serialized_object, serialized_object_len, getThis()) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error during unserialization"); } } /* }}} */ /* {{{ proto void SolrModifiableParams::__construct(void) Constructor. */ PHP_METHOD(SolrModifiableParams, __construct) { solr_params_obj_ctor(getThis()); } /* }}} */ /* {{{ proto void SolrModifiableParams::__destruct(void) Destructor. */ PHP_METHOD(SolrModifiableParams, __destruct) { solr_params_obj_dtor(getThis()); } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/php_solr_query.c000066400000000000000000004622501374041537100222420ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_solr.h" /* Outstanding Work/Changes */ /* TODO: Change SolrQuery::getTermsSort() to return integer */ /* TODO: Change SolrQuery::getFacetSort() to return integer */ /** * Note about methods implementation: * * One reason why each SolrQuery has custom code is because each method * could require separate tweaking. * * At this point in time, even though most of the SolrQuery methods share * basic features, I still believe that is a better idea to write separate code * for each method implementation. * * This will make the methods easier to maintain because * * from time to time, Solr modifies the way some of the request parameters are * submitted or processed. * * Hence, it is currently more logical to make each method an independent entity. */ /* {{{ proto SolrQuery::__construct([string q]) Constructor for SolrQuery */ PHP_METHOD(SolrQuery, __construct) { long int params_index = SOLR_UNIQUE_PARAMS_INDEX(); solr_char_t *q = NULL; COMPAT_ARG_SIZE_T query_length = 0; solr_params_t solr_params; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, solr_ce_SolrIllegalArgumentException, &error_handling); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &q, &query_length) == FAILURE) { zend_restore_error_handling(&error_handling); return; } zend_restore_error_handling(&error_handling); if (solr_init_params(&solr_params, params_index) == FAILURE) { return; } zend_update_property_long(solr_ce_SolrQuery, OBJ_FOR_PROP(getThis()), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, params_index); if (query_length) { if (solr_set_normal_param(getThis(), (solr_char_t *) "q", sizeof("q")-1, q, query_length) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error while setting query parameter"); return; } } } /* }}} */ /* {{{ proto SolrQuery::__destruct() Destructor for SolrQuery */ PHP_METHOD(SolrQuery, __destruct) { solr_params_t *solr_params = NULL; /* Retrieve the entry for this SolrParams instance */ if (solr_fetch_params_entry(getThis(), &solr_params) == SUCCESS) { zend_hash_index_del(SOLR_GLOBAL(params), solr_params->params_index); return ; } /* This would only happen if user attempted an illegal operation */ php_error_docref(NULL, E_ERROR, SOLR_ERROR_1008_MSG, SOLR_FILE_LINE_FUNC); } /* }}} */ /* {{{ CommonQueryParameters */ /* {{{ proto SolrQuery SolrQuery::setQuery(string q) Sets the q parameter */ PHP_METHOD(SolrQuery, setQuery) { solr_char_t *param_name = (solr_char_t *) "q"; COMPAT_ARG_SIZE_T param_name_len = sizeof("q")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setStart(int start) Sets the start parameter */ PHP_METHOD(SolrQuery, setStart) { solr_char_t *param_name = (solr_char_t *) "start"; COMPAT_ARG_SIZE_T param_name_len = sizeof("start")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setRows(int rows) Sets the rows parameter */ PHP_METHOD(SolrQuery, setRows) { solr_char_t *param_name = (solr_char_t *) "rows"; COMPAT_ARG_SIZE_T param_name_len = sizeof("rows")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addField(string fl) Adds another fl parameter */ PHP_METHOD(SolrQuery, addField) { solr_char_t *param_name = (solr_char_t *) "fl"; size_t param_name_len = sizeof("fl")-1; solr_char_t *param_value = NULL; size_t param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_simple_list_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addSortField(string fl [, int sort_direction]) Adds another sort parameter */ PHP_METHOD(SolrQuery, addSortField) { solr_char_t *param_name = (solr_char_t *) "sort"; COMPAT_ARG_SIZE_T param_name_len = sizeof("sort")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; long int sort_direction = 1L; solr_sort_dir_t sort_order = SOLR_SORT_DIR_DESC; solr_char_t *avalue = NULL; COMPAT_ARG_SIZE_T avalue_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", ¶m_value, ¶m_value_len, &sort_direction) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } sort_order = (sort_direction < 0L || sort_direction > 1L) ? SOLR_SORT_DIR_DESC : (solr_sort_dir_t) sort_direction; avalue = (sort_order) ? "desc" : "asc"; avalue_length = solr_strlen(avalue); if (solr_add_arg_list_param(getThis(), param_name, param_name_len, param_value, param_value_len, avalue, avalue_length, ',', ' ') == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addFiterQuery(string fq) Adds another fq parameter */ PHP_METHOD(SolrQuery, addFilterQuery) { solr_char_t *param_name = (solr_char_t *) "fq"; COMPAT_ARG_SIZE_T param_name_len = sizeof("fq")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setShowDebugInfo(bool flag) Sets the debugQuery parameter */ PHP_METHOD(SolrQuery, setShowDebugInfo) { solr_char_t *param_name = (solr_char_t *) "debugQuery"; COMPAT_ARG_SIZE_T param_name_len = sizeof("debugQuery")-1; zend_bool show_debug_info = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &show_debug_info) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (!show_debug_info) { solr_delete_solr_parameter(getThis(), param_name, param_name_len); solr_return_solr_params_object(); return; } if (solr_set_normal_param(getThis(), param_name, param_name_len, "true", sizeof("true")-1) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error adding debugging info "); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setExplainOther(string explainOther) Sets the explainOther parameter */ PHP_METHOD(SolrQuery, setExplainOther) { solr_char_t *param_name = (solr_char_t *) "explainOther"; COMPAT_ARG_SIZE_T param_name_len = sizeof("explainOther")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTimeAllowed(int milliseconds) Sets the maximum time in milliseconds allowed for the query */ PHP_METHOD(SolrQuery, setTimeAllowed) { solr_char_t *param_name = (solr_char_t *) "timeAllowed"; COMPAT_ARG_SIZE_T param_name_len = sizeof("timeAllowed")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setOmitHeader(bool flag) Sets the omitHeader parameter */ PHP_METHOD(SolrQuery, setOmitHeader) { solr_char_t *param_name = (solr_char_t *) "omitHeader"; COMPAT_ARG_SIZE_T param_name_len = sizeof("omitHeader")-1; COMPAT_ARG_SIZE_T param_value_len = 0; zend_bool omit_header = 0; solr_char_t *omit_header_str = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &omit_header) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } omit_header_str = (omit_header)? "true" : "false"; param_value_len = solr_strlen(omit_header_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, omit_header_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, omit_header_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* }}} END OF CommonQueryParameters */ /* {{{ CoreQueryParameters */ /* {{{ proto SolrQuery SolrQuery::setEchoHandler(bool flag) Sets the echoHandler parameter */ PHP_METHOD(SolrQuery, setEchoHandler) { solr_char_t *param_name = (solr_char_t *) "echoHandler"; COMPAT_ARG_SIZE_T param_name_len = sizeof("echoHandler")-1; COMPAT_ARG_SIZE_T param_value_len = 0; zend_bool echo_handler = 0; solr_char_t *echo_handler_str = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &echo_handler) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } echo_handler_str = (echo_handler)? "true" : "false"; param_value_len = solr_strlen(echo_handler_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, echo_handler_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, echo_handler_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setEchoParams(string value) Sets the echoParams parameter */ PHP_METHOD(SolrQuery, setEchoParams) { solr_char_t *param_name = (solr_char_t *) "echoParams"; COMPAT_ARG_SIZE_T param_name_len = sizeof("echoParams")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* }}} END OF CoreQueryParameters */ /* {{{ SimpleFacetParameters */ /* {{{ proto SolrQuery SolrQuery::setFacet(bool value) Sets the facet parameter */ PHP_METHOD(SolrQuery, setFacet) { solr_char_t *param_name = (solr_char_t *) "facet"; COMPAT_ARG_SIZE_T param_name_len = sizeof("facet")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bool_flag) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addFacetField(string value) Sets the facet.field parameter */ PHP_METHOD(SolrQuery, addFacetField) { solr_char_t *param_name = (solr_char_t *) "facet.field"; COMPAT_ARG_SIZE_T param_name_len = sizeof("facet.field")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addFacetQuery(string value) Adds another facet.query parameter */ PHP_METHOD(SolrQuery, addFacetQuery) { solr_char_t *param_name = (solr_char_t *) "facet.query"; COMPAT_ARG_SIZE_T param_name_len = sizeof("facet.query")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetPrefix(string value [, string field_override]) Sets the facet.prefix parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetPrefix) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.prefix"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetSort(int value [, string field_override]) Sets the facet.sort parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetSort) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; long int sort_type = 0L; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|s", &sort_type, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.sort"); param_value = ((sort_type)? "count" : "index"); param_value_len = solr_strlen(param_value); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetLimit(string value [, string field_override]) Sets the facet.limit parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetLimit) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.limit"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetOffset(string value [, string field_override]) Sets the facet.offset parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetOffset) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.offset"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetMinCount(string value [, string field_override]) Sets the facet.mincount parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetMinCount) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.mincount"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetMissing(bool value [, string field_override]) Sets the facet.missing parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetMissing) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; zend_bool bool_flag = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "b|s", &bool_flag, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.missing"); param_value = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(param_value); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetMethod(string value [, string field_override]) Sets the facet.method parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetMethod) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.method"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetEnumCacheMinDefaultFrequency(string value [, string field_override]) Sets the facet.enum.cache.minDf parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetEnumCacheMinDefaultFrequency) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.enum.cache.minDf"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ Date facet parameters */ /* {{{ proto SolrQuery SolrQuery::addFacetDateField(string value) Adds another facet.date parameter. */ PHP_METHOD(SolrQuery, addFacetDateField) { solr_char_t *param_name = (solr_char_t *) "facet.date"; COMPAT_ARG_SIZE_T param_name_len = sizeof("facet.date")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetDateStart(string value [, string field_override]) Sets the facet.date.start parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetDateStart) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.date.start"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetDateEnd(string value [, string field_override]) Sets the facet.date.end parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetDateEnd) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.date.end"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetDateGap(string value [, string field_override]) Sets the facet.date.gap parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetDateGap) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.date.gap"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setFacetDateHardEnd(bool value [, string field_override]) Sets the facet.date.hardend parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setFacetDateHardEnd) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; zend_bool bool_flag = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "b|s", &bool_flag, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.date.hardend"); param_value = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(param_value); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addFacetDateOther(string value [, string field_override]) Sets the facet.date.other parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, addFacetDateOther) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.date.other"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* }}} End of date facet parameters */ /* }}} End of SimpleFacetParameters */ /* {{{ SimpleGroupParameters */ /* {{{ proto SolrQuery SolrQuery::setGroup(bool value) Enable result grouping (group parameter) */ PHP_METHOD(SolrQuery, setGroup) { solr_char_t *param_name = (solr_char_t *) "group"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bool_flag) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto bool SolrQuery::getGroup() Returns true if grouping is enabled */ PHP_METHOD(SolrQuery, getGroup) { solr_char_t *param_name = (solr_char_t *) "group"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addGroupField(string value) Adds a group.field parameter */ PHP_METHOD(SolrQuery, addGroupField) { solr_char_t *param_name = (solr_char_t *) "group.field"; int param_name_len = sizeof("group.field")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto string SolrQuery::getGroupFields() Returns all the group fields (group.field parameter values) */ PHP_METHOD(SolrQuery, getGroupFields) { solr_char_t *param_name = (solr_char_t *) "group.field"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.field")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addGroupFunction(string value) Adds a group function (group.func parameter) */ PHP_METHOD(SolrQuery, addGroupFunction) { solr_char_t *param_name = (solr_char_t *) "group.func"; int param_name_len = sizeof("group.func")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto string SolrQuery::getGroupFunctions() Returns all the group functions (group.func parameters) */ PHP_METHOD(SolrQuery, getGroupFunctions) { solr_char_t *param_name = (solr_char_t *) "group.func"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.func")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addGroupQuery(string value) Sets the group.query parameter */ PHP_METHOD(SolrQuery, addGroupQuery) { solr_char_t *param_name = (solr_char_t *) "group.query"; int param_name_len = sizeof("group.query")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto string SolrQuery::getGroupQueries() Returns all the group.query parameter values */ PHP_METHOD(SolrQuery, getGroupQueries) { solr_char_t *param_name = (solr_char_t *) "group.query"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.query")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupLimit(string value) Sets the group.limit parameter. */ PHP_METHOD(SolrQuery, setGroupLimit) { solr_char_t *param_name = (solr_char_t *) "group.limit"; int param_name_len = sizeof("group.limit")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto int SolrQuery::getGroupLimit() Returns the group.limit value */ PHP_METHOD(SolrQuery, getGroupLimit) { solr_char_t *param_name = (solr_char_t *) "group.limit"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.limit")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupOffset(int offset) Sets the group.offset parameter. */ PHP_METHOD(SolrQuery, setGroupOffset) { solr_char_t *param_name = (solr_char_t *) "group.offset"; int param_name_len = sizeof("group.offset")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto int SolrQuery::getGroupOffset() Returns the group.offset value */ PHP_METHOD(SolrQuery, getGroupOffset) { solr_char_t *param_name = (solr_char_t *) "group.offset"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.offset")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addGroupSortField(string sort[, integer direction]) Add a group sort field (group.sort parameter). */ PHP_METHOD(SolrQuery, addGroupSortField) { solr_char_t *param_name = (solr_char_t *) "group.sort"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.sort")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; long int sort_direction = 1L; solr_sort_dir_t sort_order = SOLR_SORT_DIR_DESC; solr_char_t *avalue = NULL; COMPAT_ARG_SIZE_T avalue_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", ¶m_value, ¶m_value_len, &sort_direction) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } sort_order = (sort_direction < 0L || sort_direction > 1L) ? SOLR_SORT_DIR_DESC : (solr_sort_dir_t) sort_direction; avalue = (sort_order) ? "desc" : "asc"; avalue_length = solr_strlen(avalue); if (solr_add_arg_list_param(getThis(), param_name, param_name_len, param_value, param_value_len, avalue, avalue_length, ',', ' ') == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto array SolrQuery::getGroupSortFields() Returns the group.sort value */ PHP_METHOD(SolrQuery, getGroupSortFields) { solr_char_t *param_name = (solr_char_t *) "group.sort"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.sort")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_arg_list_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupFormat(string value) Sets the group.format parameter. */ PHP_METHOD(SolrQuery, setGroupFormat) { solr_char_t *param_name = (solr_char_t *) "group.format"; int param_name_len = sizeof("group.format")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Unable to add param value %s to %s ", param_value, param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto string SolrQuery::getGroupFormat() Returns the group.format value */ PHP_METHOD(SolrQuery, getGroupFormat) { solr_char_t *param_name = (solr_char_t *) "group.format"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.format")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupMain(bool value) Sets the group.main parameter */ PHP_METHOD(SolrQuery, setGroupMain) { solr_char_t *param_name = (solr_char_t *) "group.main"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.main")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bool_flag) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto bool SolrQuery::getGroupMain() Returns the group.main value */ PHP_METHOD(SolrQuery, getGroupMain) { solr_char_t *param_name = (solr_char_t *) "group.main"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.main")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupNGroups(bool value) Sets the group.ngroups parameter */ PHP_METHOD(SolrQuery, setGroupNGroups) { solr_char_t *param_name = (solr_char_t *) "group.ngroups"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.ngroups")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bool_flag) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto bool SolrQuery::getGroupNGroups() Returns the group.ngroups value */ PHP_METHOD(SolrQuery, getGroupNGroups) { solr_char_t *param_name = (solr_char_t *) "group.ngroups"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.ngroups")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupTruncate(bool value) Sets the group.truncate parameter */ PHP_METHOD(SolrQuery, setGroupTruncate) { solr_char_t *param_name = (solr_char_t *) "group.truncate"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.truncate")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bool_flag) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto bool SolrQuery::getGroupTruncate() Returns the group.truncate value */ PHP_METHOD(SolrQuery, getGroupTruncate) { solr_char_t *param_name = (solr_char_t *) "group.truncate"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.truncate")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupFacet(bool value) Sets the group.facet parameter */ PHP_METHOD(SolrQuery, setGroupFacet) { solr_char_t *param_name = (solr_char_t *) "group.facet"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.facet")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bool_flag) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto bool SolrQuery::getGroupFacet() Returns the group.facet value */ PHP_METHOD(SolrQuery, getGroupFacet) { solr_char_t *param_name = (solr_char_t *) "group.facet"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.facet")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setGroupCachePercent(int value) sets the group cache percent group.cache.percent value */ PHP_METHOD(SolrQuery, setGroupCachePercent) { solr_char_t *param_name = (solr_char_t *) "group.cache.percent"; COMPAT_ARG_SIZE_T param_name_len = sizeof ("group.cache.percent")-1; long cache_pct = 0; solr_char_t pval[4]; int pval_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &cache_pct)) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } if (cache_pct < 0 || cache_pct > 100) { solr_throw_exception(solr_ce_SolrIllegalArgumentException, "Group cache percent must be between 0 and 100", SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC); RETURN_NULL(); } snprintf (pval, sizeof(pval), "%ld", cache_pct); pval_len = strlen(pval); if (solr_add_or_set_normal_param(getThis(), param_name, param_name_len, pval, pval_len, 0)) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, pval); efree(pval); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto int SolrQuery::getGroupCachePercent() Gets the group cache percent group.cache.percent value */ PHP_METHOD(SolrQuery, getGroupCachePercent) { solr_char_t *param_name = (solr_char_t *) "group.cache.percent"; COMPAT_ARG_SIZE_T param_name_len = sizeof("group.cache.percent")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* }}} End of SimpleGroupParameters */ /* {{{ proto SolrQuery SolrQuery::collapse(SolrCollapseFunction collapseFunction) Collapse a Solr Query */ PHP_METHOD(SolrQuery, collapse) { solr_char_t *param_name = (solr_char_t *) "fq"; COMPAT_ARG_SIZE_T param_name_len = sizeof("fq")-1; zval *collapse_func_obj, *obj_ref; solr_function_t *collapse_func; solr_string_t *buffer = NULL; zend_string *field_str = zend_string_init("field", sizeof("field"), SOLR_FUNCTIONS_PERSISTENT); if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &obj_ref) == FAILURE) { RETURN_NULL(); } if (Z_TYPE_P(obj_ref) == IS_REFERENCE) { collapse_func_obj = Z_REFVAL_P(obj_ref); } else { collapse_func_obj = obj_ref; } if(solr_fetch_function_entry(collapse_func_obj, &collapse_func) == FAILURE) { php_error_docref(NULL, E_ERROR, "Internal Error Unable to fetch function from functions global"); RETURN_NULL(); } /* validate */ if (!zend_hash_exists(collapse_func->params, field_str)) { solr_throw_exception_ex(solr_ce_SolrMissingMandatoryParameterException,SOLR_ERROR_4100, SOLR_FILE_LINE_FUNC, SOLR_ERROR_4100_MSG, "field"); } buffer = (solr_string_t *)pemalloc(sizeof(solr_string_t), SOLR_STRING_PERSISTENT); memset(buffer, 0, sizeof(solr_string_t)); solr_solrfunc_to_string(collapse_func, &buffer); if (solr_add_or_set_normal_param(getThis(), param_name, param_name_len, buffer->str, buffer->len, 1) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, buffer->str); } solr_string_free(buffer); pefree(buffer, SOLR_STRING_PERSISTENT); zend_string_release(field_str); solr_return_solr_params_object(); } /* }}} */ /* {{{ Expand Parameters */ /* {{{ proto SolrQuery SolrQuery::setExpand(bool value) Sets the expand parameter. This enables or disables group expanding. */ PHP_METHOD(SolrQuery, setExpand) { solr_char_t *param_name = (solr_char_t *) "expand"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bool_flag) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto bool SolrQuery::getExpand() Returns true if group expanding is enabled */ PHP_METHOD(SolrQuery, getExpand) { solr_char_t *param_name = (solr_char_t *) "expand"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addExpandSortField(string sort[, integer direction]) Orders the documents within the expanded groups (expand.sort parameter). */ PHP_METHOD(SolrQuery, addExpandSortField) { solr_char_t *param_name = (solr_char_t *) "expand.sort"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand.sort")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; long int sort_direction = 1L; solr_sort_dir_t sort_order = SOLR_SORT_DIR_DESC; solr_char_t *avalue = NULL; COMPAT_ARG_SIZE_T avalue_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", ¶m_value, ¶m_value_len, &sort_direction) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } sort_order = (sort_direction < 0L || sort_direction > 1L) ? SOLR_SORT_DIR_DESC : (solr_sort_dir_t) sort_direction; avalue = (sort_order) ? "desc" : "asc"; avalue_length = solr_strlen(avalue); if (solr_add_arg_list_param(getThis(), param_name, param_name_len, param_value, param_value_len, avalue, avalue_length, ',', ' ') == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeExpandSortField(string field) Removes an expand sort field from the expand.sort parameter. */ PHP_METHOD(SolrQuery, removeExpandSortField) { solr_char_t *pname = (solr_char_t *) "expand.sort"; int pname_length = sizeof("expand.sort")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value(getThis(), pname, pname_length, param_value, param_value_len); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto string SolrQuery::getExpandSortFields() returns an array of fields */ PHP_METHOD(SolrQuery, getExpandSortFields) { solr_char_t *param_name = (solr_char_t *) "expand.sort"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand.sort")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setExpandRows(int rows) Sets the number of rows to display in each group (expand.rows). Server Default 5 */ PHP_METHOD(SolrQuery, setExpandRows) { solr_char_t *param_name = (solr_char_t *) "expand.rows"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand.rows")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto int SolrQuery::getExpandRows() Returns The number of rows to display in each group (expand.rows) */ PHP_METHOD(SolrQuery, getExpandRows) { solr_char_t *param_name = (solr_char_t *) "expand.rows"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand.rows")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setExpandQuery(string q) Sets the expand.q parameter. Overrides the main q parameter, determines which documents to include in the main group. */ PHP_METHOD(SolrQuery, setExpandQuery) { solr_char_t *param_name = (solr_char_t *) "expand.q"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand.q")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto string SolrQuery::getExpandQuery() Returns the expand query expand.q parameter */ PHP_METHOD(SolrQuery, getExpandQuery) { solr_char_t *param_name = (solr_char_t *) "expand.q"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand.q")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addExpandFilterQuery(string fq) Overrides main fq's, determines which documents to include in the main group. */ PHP_METHOD(SolrQuery, addExpandFilterQuery) { solr_char_t *param_name = (solr_char_t *) "expand.fq"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand.fq")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeExpandFilterQuery(string fq) Removes an expand filter query. */ PHP_METHOD(SolrQuery, removeExpandFilterQuery) { solr_char_t *pname = (solr_char_t *) "expand.fq"; int pname_length = sizeof("expand.fq")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_len); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto array SolrQuery::getExpandFilterQueries() Returns the expand filter queries */ PHP_METHOD(SolrQuery, getExpandFilterQueries) { solr_char_t *param_name = (solr_char_t *) "expand.fq"; COMPAT_ARG_SIZE_T param_name_len = sizeof("expand.fq")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* }}} */ /* {{{ HighlightingParameters */ /* {{{ proto SolrQuery SolrQuery::setHighlight(bool value) Sets the hl parameter. This enables or disables highlighting. */ PHP_METHOD(SolrQuery, setHighlight) { solr_char_t *param_name = (solr_char_t *) "hl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bool_flag) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addHighlightField(string value) Adds another hl.fl parameter. */ PHP_METHOD(SolrQuery, addHighlightField) { solr_char_t *list_param_name = (solr_char_t *) "hl.fl"; COMPAT_ARG_SIZE_T list_param_name_len = sizeof("hl.fl")-1; solr_char_t *list_param_value = NULL; COMPAT_ARG_SIZE_T list_param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &list_param_value, &list_param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_simple_list_param(getThis(), list_param_name, list_param_name_len, list_param_value, list_param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Unable to add param value %s to %s list ", list_param_value, list_param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightSnippets(string value [, string field_override]) Sets the hl.snippets parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightSnippets) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.snippets"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightFragsize(string value [, string field_override]) Sets the hl.fragsize parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightFragsize) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.fragsize"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightMergeContiguous(bool flag [, string field_override]) Sets the hl.mergeContiguous parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightMergeContiguous) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; zend_bool bool_flag = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "b|s", &bool_flag, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.mergeContiguous"); param_value = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(param_value); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightRequireFieldMatch(bool flag) Sets the hl.requireFieldMatch. */ PHP_METHOD(SolrQuery, setHighlightRequireFieldMatch) { solr_char_t *param_name = (solr_char_t *) "hl.requireFieldMatch"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.requireFieldMatch")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bool_flag) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightMaxAnalyzedChars(string value) Sets the hl.maxAnalyzedChars parameter */ PHP_METHOD(SolrQuery, setHighlightMaxAnalyzedChars) { solr_char_t *param_name = (solr_char_t *) "hl.maxAnalyzedChars"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.maxAnalyzedChars")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightAlternateField(string value [, string field_override]) Sets the hl.alternateField parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightAlternateField) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.alternateField"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightMaxAlternateFieldLength(string value [, string field_override]) Sets the hl.maxAlternateFieldLength parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightMaxAlternateFieldLength) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.maxAlternateFieldLength"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightFormatter(string value [, string field_override]) Sets the hl.formatter parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightFormatter) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = "simple"; COMPAT_ARG_SIZE_T param_value_len = sizeof("simple")-1; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.formatter"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightSimplePre(string value [, string field_override]) Sets the hl.simple.pre parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightSimplePre) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = ""; COMPAT_ARG_SIZE_T param_value_len = sizeof("")-1; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.simple.pre"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightSimplePost(string value [, string field_override]) Sets the hl.simple.post parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightSimplePost) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = ""; COMPAT_ARG_SIZE_T param_value_len = sizeof("")-1; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.simple.post"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightFragmenter(string value [, string field_override]) Sets the hl.fragmenter parameter. Accepts an optional field override. */ PHP_METHOD(SolrQuery, setHighlightFragmenter) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "hl.fragmenter"); if (solr_set_normal_param(getThis(), fbuf.str, fbuf.len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", fbuf.str, param_value); solr_string_free(&fbuf); RETURN_NULL(); } solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightUsePhraseHighlighter(bool flag) Sets the hl.usePhraseHighlighter parameter. */ PHP_METHOD(SolrQuery, setHighlightUsePhraseHighlighter) { solr_char_t *param_name = (solr_char_t *) "hl.usePhraseHighlighter"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.usePhraseHighlighter")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bool_flag) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightHighlightMultiTerm(bool flag) Sets the hl.highlightMultiTerm parameter. */ PHP_METHOD(SolrQuery, setHighlightHighlightMultiTerm) { solr_char_t *param_name = (solr_char_t *) "hl.highlightMultiTerm"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.highlightMultiTerm")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bool_flag) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightRegexSlop(string value) Sets the hl.regex.slop parameter. */ PHP_METHOD(SolrQuery, setHighlightRegexSlop) { solr_char_t *param_name = (solr_char_t *) "hl.regex.slop"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.regex.slop")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightRegexPattern(string value) Sets the hl.regex.pattern parameter. */ PHP_METHOD(SolrQuery, setHighlightRegexPattern) { solr_char_t *param_name = (solr_char_t *) "hl.regex.pattern"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.regex.pattern")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setHighlightRegexMaxAnalyzedChars(string value) Sets the hl.regex.maxAnalyzedChars parameter. */ PHP_METHOD(SolrQuery, setHighlightRegexMaxAnalyzedChars) { solr_char_t *param_name = (solr_char_t *) "hl.regex.maxAnalyzedChars"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.regex.maxAnalyzedChars")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* }}} End of HighlightingParameters */ /* {{{ StatsComponent */ /* {{{ proto SolrQuery SolrQuery::setStats(bool flag) Sets the stats parameter. Enables or disables stats */ PHP_METHOD(SolrQuery, setStats) { solr_char_t *param_name = (solr_char_t *) "stats"; COMPAT_ARG_SIZE_T param_name_len = sizeof("stats")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bool_flag) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addStatsField(string value) Adds another stats.field parameter. */ PHP_METHOD(SolrQuery, addStatsField) { solr_char_t *param_name = (solr_char_t *) "stats.field"; COMPAT_ARG_SIZE_T param_name_len = sizeof("stats.field")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error adding parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addStatsFacet(string value) Adds another stats.facet parameter. */ PHP_METHOD(SolrQuery, addStatsFacet) { solr_char_t *param_name = (solr_char_t *) "stats.facet"; COMPAT_ARG_SIZE_T param_name_len = sizeof("stats.facet")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error adding parameter %s=%s ", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* }}} End of StatsComponent */ /* {{{ MoreLikeThis */ /* {{{ proto SolrQuery SolrQuery::setMlt(bool flag) Sets the mlt parameter. Enables or disables the moreLikeThis component */ PHP_METHOD(SolrQuery, setMlt) { solr_char_t *param_name = (solr_char_t *) "mlt"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bool_flag) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltCount(string value) Sets the mlt.count parameter. */ PHP_METHOD(SolrQuery, setMltCount) { solr_char_t *param_name = (solr_char_t *) "mlt.count"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.count")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addMltField(string field) Adds another field name to the mlt.fl parameter. */ PHP_METHOD(SolrQuery, addMltField) { solr_char_t *list_param_name = (solr_char_t *) "mlt.fl"; COMPAT_ARG_SIZE_T list_param_name_len = sizeof("mlt.fl")-1; solr_char_t *list_param_value = NULL; COMPAT_ARG_SIZE_T list_param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &list_param_value, &list_param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_simple_list_param(getThis(), list_param_name, list_param_name_len, list_param_value, list_param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Unable to add param value %s to %s list ", list_param_value, list_param_name); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::addMltQueryField(string value, string boost) Adds another query field and boost value to the mlt.qf parameter. */ PHP_METHOD(SolrQuery, addMltQueryField) { solr_char_t *param_name = (solr_char_t *) "mlt.qf"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.qf")-1; solr_char_t *query_field = NULL; COMPAT_ARG_SIZE_T query_field_length = 0; solr_char_t *boost_value = "1.0"; COMPAT_ARG_SIZE_T boost_value_length = sizeof("1.0"); /* TODO: make boost optional parameter. */ /* If boost is not sent, then the index time boost is used */ /* This will involve re-doing all the arg_list functions to allow optional args. */ /* Temporary solution is to use SolrQuery::add("mlt.qf", "value"). This should be documented. */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &query_field, &query_field_length, &boost_value, &boost_value_length) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_add_arg_list_param(getThis(), param_name, param_name_len, query_field, query_field_length, boost_value, boost_value_length, ' ', '^') == FAILURE) { RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltMinTermFrequency(string value) Sets the mlt.mintf parameter. */ PHP_METHOD(SolrQuery, setMltMinTermFrequency) { solr_char_t *param_name = (solr_char_t *) "mlt.mintf"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.mintf")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltMinDocFrequency(string value) Sets the mlt.mindf parameter. */ PHP_METHOD(SolrQuery, setMltMinDocFrequency) { solr_char_t *param_name = (solr_char_t *) "mlt.mindf"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.mindf")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltMinWordLength(string value) Sets the mlt.minwl parameter. */ PHP_METHOD(SolrQuery, setMltMinWordLength) { solr_char_t *param_name = (solr_char_t *) "mlt.minwl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.minwl")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltMaxWordLength(string value) Sets the mlt.maxwl parameter. */ PHP_METHOD(SolrQuery, setMltMaxWordLength) { solr_char_t *param_name = (solr_char_t *) "mlt.maxwl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.maxwl")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltMaxNumTokens(string value) Sets the mlt.maxntp parameter. */ PHP_METHOD(SolrQuery, setMltMaxNumTokens) { solr_char_t *param_name = (solr_char_t *) "mlt.maxntp"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.maxntp")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltMaxNumQueryTerms(string value) Sets the mlt.maxqt parameter. */ PHP_METHOD(SolrQuery, setMltMaxNumQueryTerms) { solr_char_t *param_name = (solr_char_t *) "mlt.maxqt"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.maxqt")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setMltBoost(bool flag) Sets the mlt.boost parameter. */ PHP_METHOD(SolrQuery, setMltBoost) { solr_char_t *param_name = (solr_char_t *) "mlt.boost"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.boost")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bool_flag) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* }}} End of MoreLikeThis */ /* {{{ TermsComponent */ /* {{{ proto SolrQuery SolrQuery::setTerms(bool flag) Sets the terms parameter. This flag enables or disables the TermsComponent */ PHP_METHOD(SolrQuery, setTerms) { solr_char_t *param_name = (solr_char_t *) "terms"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bool_flag) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsField(string field) Sets the terms.fl parameter. */ PHP_METHOD(SolrQuery, setTermsField) { solr_char_t *param_name = (solr_char_t *) "terms.fl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.fl")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsLowerBound(string value) Sets the terms.lower parameter. */ PHP_METHOD(SolrQuery, setTermsLowerBound) { solr_char_t *param_name = (solr_char_t *) "terms.lower"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.lower")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsUpperBound(string value) Sets the terms.upper parameter. */ PHP_METHOD(SolrQuery, setTermsUpperBound) { solr_char_t *param_name = (solr_char_t *) "terms.upper"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.upper")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsIncludeLowerBound(string value) Sets the terms.lower.incl parameter. */ PHP_METHOD(SolrQuery, setTermsIncludeLowerBound) { solr_char_t *param_name = (solr_char_t *) "terms.lower.incl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.lower.incl")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bool_flag) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsIncludeUpperBound(string value) Sets the terms.upper.incl parameter. */ PHP_METHOD(SolrQuery, setTermsIncludeUpperBound) { solr_char_t *param_name = (solr_char_t *) "terms.upper.incl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.upper.incl")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bool_flag) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsMinCount(string value) Sets the terms.mincount parameter. */ PHP_METHOD(SolrQuery, setTermsMinCount) { solr_char_t *param_name = (solr_char_t *) "terms.mincount"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.mincount")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsMaxCount(string value) Sets the terms.maxcount parameter. */ PHP_METHOD(SolrQuery, setTermsMaxCount) { solr_char_t *param_name = (solr_char_t *) "terms.maxcount"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.maxcount")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsPrefix(string value) Sets the terms.prefix parameter. */ PHP_METHOD(SolrQuery, setTermsPrefix) { solr_char_t *param_name = (solr_char_t *) "terms.prefix"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.prefix")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsLimit(string value) Sets the terms.limit parameter. */ PHP_METHOD(SolrQuery, setTermsLimit) { solr_char_t *param_name = (solr_char_t *) "terms.limit"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.limit")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } if (solr_set_normal_param(getThis(), param_name, param_name_len, param_value, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s", param_name, param_value); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsReturnRaw(bool flag) Sets the terms.raw parameter. */ PHP_METHOD(SolrQuery, setTermsReturnRaw) { solr_char_t *param_name = (solr_char_t *) "terms.raw"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.raw")-1; zend_bool bool_flag = 0; solr_char_t *bool_flag_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &bool_flag) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } bool_flag_str = ((bool_flag)? "true" : "false"); param_value_len = solr_strlen(bool_flag_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, bool_flag_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, bool_flag_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::setTermsSort(int sort) Sets the terms.sort parameter. */ PHP_METHOD(SolrQuery, setTermsSort) { solr_char_t *param_name = (solr_char_t *) "terms.sort"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.sort")-1; long int sort_type = 0L; solr_char_t *sort_type_str = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &sort_type) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameter"); RETURN_NULL(); } sort_type_str = ((sort_type)? "count" : "index"); param_value_len = solr_strlen(sort_type_str); if (solr_set_normal_param(getThis(), param_name, param_name_len, sort_type_str, param_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Error setting parameter %s=%s ", param_name, sort_type_str); RETURN_NULL(); } solr_return_solr_params_object(); } /* }}} */ /* }}} End of TermsComponent */ /* {{{ Value removal methods */ /* {{{ proto SolrQuery SolrQuery::removeField(string fl) Removes a field from the fl parameter */ PHP_METHOD(SolrQuery, removeField) { solr_char_t *pname = (solr_char_t *) "fl"; int pname_length = sizeof("fl")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_simple_list_param_value(getThis(), pname, pname_length, param_value, param_value_len); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeSortField(string fl) Removes a sort field from the sort parameter. */ PHP_METHOD(SolrQuery, removeSortField) { solr_char_t *pname = (solr_char_t *) "sort"; int pname_length = sizeof("sort")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value(getThis(), pname, pname_length, param_value, param_value_len); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeFilterQuery(string fq) Removes one of the fq parameter. */ PHP_METHOD(SolrQuery, removeFilterQuery) { solr_char_t *pname = (solr_char_t *) "fq"; int pname_length = sizeof("fq")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_len); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeFacetField(string field) Removes one of fields from the facet.field parameter. */ PHP_METHOD(SolrQuery, removeFacetField) { solr_char_t *pname = (solr_char_t *) "facet.field"; int pname_length = sizeof("facet.field")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_len); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeFacetQuery(string facet_query) Removes one of the facet.query parameters. */ PHP_METHOD(SolrQuery, removeFacetQuery) { solr_char_t *pname = (solr_char_t *) "facet.query"; int pname_length = sizeof("facet.query")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_len); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeFacetDateField(string date_field) Removes one of the facet.date parameters. */ PHP_METHOD(SolrQuery, removeFacetDateField) { solr_char_t *pname = (solr_char_t *) "facet.date"; int pname_length = sizeof("facet.date")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_len); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeFacetDateOther(string value [, string field_override]) Removes one of the facet.date.other parameters. Also accepts an optional field override. */ PHP_METHOD(SolrQuery, removeFacetDateOther) { solr_string_t fbuf; /* Field name buffer to prepare field override */ /* Parameter value */ solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; /* Field name override,f if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; memset(&fbuf, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", ¶m_value, ¶m_value_len, &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&fbuf, field_name, field_name_len, "facet.date.other"); solr_delete_normal_param_value(getThis(), fbuf.str, fbuf.len, param_value, param_value_len); solr_string_free(&fbuf); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeHighlightField(string field) Removes one of the fields from the hl.fl parameter. */ PHP_METHOD(SolrQuery, removeHighlightField) { solr_char_t *pname = (solr_char_t *) "hl.fl"; int pname_length = sizeof("hl.fl")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_simple_list_param_value(getThis(), pname, pname_length, param_value, param_value_len); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeStatsField(string field) Removes one of the stats.field parameters. */ PHP_METHOD(SolrQuery, removeStatsField) { solr_char_t *pname = (solr_char_t *) "stats.field"; int pname_length = sizeof("stats.field")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_len); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeStatsFacet(string value) Removes one of the stats.facet parameters. */ PHP_METHOD(SolrQuery, removeStatsFacet) { solr_char_t *pname = (solr_char_t *) "stats.facet"; int pname_length = sizeof("stats.facet")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_normal_param_value(getThis(), pname, pname_length, param_value, param_value_len); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeMltField(string field) Removes one of the fields from the mlt.fl parameter. */ PHP_METHOD(SolrQuery, removeMltField) { solr_char_t *pname = (solr_char_t *) "mlt.fl"; int pname_length = sizeof("mlt.fl")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_simple_list_param_value(getThis(), pname, pname_length, param_value, param_value_len); solr_return_solr_params_object(); } /* }}} */ /* {{{ proto SolrQuery SolrQuery::removeMltQueryField(string field) Removes one of the values from the mlt.qf parameter. */ PHP_METHOD(SolrQuery, removeMltQueryField) { solr_char_t *pname = (solr_char_t *) "mlt.qf"; int pname_length = sizeof("mlt.qf")-1; solr_char_t *param_value = NULL; COMPAT_ARG_SIZE_T param_value_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", ¶m_value, ¶m_value_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_delete_arg_list_param_value(getThis(), pname, pname_length, param_value, param_value_len); solr_return_solr_params_object(); } /* }}} */ /* }}} End of Value removal methods */ /* {{{ Begin getter methods */ /* {{{ proto string SolrQuery::getQuery() Returns the query */ PHP_METHOD(SolrQuery, getQuery) { solr_char_t *param_name = (solr_char_t *) "q"; COMPAT_ARG_SIZE_T param_name_len = sizeof("q")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getStart() Returns the start parameter */ PHP_METHOD(SolrQuery, getStart) { solr_char_t *param_name = (solr_char_t *) "start"; COMPAT_ARG_SIZE_T param_name_len = sizeof("start")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getRows() Returns the rows parameter */ PHP_METHOD(SolrQuery, getRows) { solr_char_t *param_name = (solr_char_t *) "rows"; COMPAT_ARG_SIZE_T param_name_len = sizeof("rows")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto array SolrQuery::getFields() Returns the fields */ PHP_METHOD(SolrQuery, getFields) { solr_char_t *param_name = (solr_char_t *) "fl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("fl")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_simple_list_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto array SolrQuery::getSortFields() Returns all the sort fields */ PHP_METHOD(SolrQuery, getSortFields) { solr_char_t *param_name = (solr_char_t *) "sort"; COMPAT_ARG_SIZE_T param_name_len = sizeof("sort")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_arg_list_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getFilterQueries() Returns all the filter queries */ PHP_METHOD(SolrQuery, getFilterQueries) { solr_char_t *param_name = (solr_char_t *) "fq"; COMPAT_ARG_SIZE_T param_name_len = sizeof("fq")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getTimeAllowed() Returns the maximum time in milliseconds allowed for the search query */ PHP_METHOD(SolrQuery, getTimeAllowed) { solr_char_t *param_name = (solr_char_t *) "timeAllowed"; COMPAT_ARG_SIZE_T param_name_len = sizeof("timeAllowed")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getFacet() Returns true is faceting is enabled */ PHP_METHOD(SolrQuery, getFacet) { solr_char_t *param_name = (solr_char_t *) "facet"; COMPAT_ARG_SIZE_T param_name_len = sizeof("facet")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getFacetFields() Returns all the facet fields */ PHP_METHOD(SolrQuery, getFacetFields) { solr_char_t *param_name = (solr_char_t *) "facet.field"; COMPAT_ARG_SIZE_T param_name_len = sizeof("facet.field")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getFacetQueries() Returns all the facet queries */ PHP_METHOD(SolrQuery, getFacetQueries) { solr_char_t *param_name = (solr_char_t *) "facet.query"; COMPAT_ARG_SIZE_T param_name_len = sizeof("facet.query")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getFacetPrefix([string field_override]) Returns the prefix for the facet */ PHP_METHOD(SolrQuery, getFacetPrefix) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.prefix"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto int SolrQuery::getFacetSort([string field_override]) Returns the facet sort state (for the field, if it was overridden) */ PHP_METHOD(SolrQuery, getFacetSort) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.sort"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_sort_type(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto int SolrQuery::getFacetLimit([string field_override]) Returns the maximum number of items for the facet */ PHP_METHOD(SolrQuery, getFacetLimit) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.limit"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_integer(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto int SolrQuery::getFacetOffset([string field_override]) Returns the offset into the list of constraints */ PHP_METHOD(SolrQuery, getFacetOffset) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.offset"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_integer(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto int SolrQuery::getFacetMinCount([string field_override]) Returns the minimum count for the facet */ PHP_METHOD(SolrQuery, getFacetMinCount) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.mincount"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_integer(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto bool SolrQuery::getFacetMissing([string field_override]) Returns the facet.missing parameter */ PHP_METHOD(SolrQuery, getFacetMissing) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.missing"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_boolean(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getFacetMethod([string field_override]) Returns the facet.method parameter */ PHP_METHOD(SolrQuery, getFacetMethod) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.method"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto array SolrQuery::getFacetDateFields() Returns all the facet.date fields */ PHP_METHOD(SolrQuery, getFacetDateFields) { solr_char_t *param_name = (solr_char_t *) "facet.date"; COMPAT_ARG_SIZE_T param_name_len = sizeof("facet.date")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getFacetDateStart([string field_override]) Returns the facet.date.start parameter */ PHP_METHOD(SolrQuery, getFacetDateStart) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.date.start"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getFacetDateEnd([string field_override]) Returns the facet.date.end parameter */ PHP_METHOD(SolrQuery, getFacetDateEnd) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.date.end"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getFacetDateGap([string field_override]) Returns the facet.date.gap */ PHP_METHOD(SolrQuery, getFacetDateGap) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.date.gap"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto bool SolrQuery::getFacetDateHardEnd([string field_override]) Returns the facet.date.hardend parameter */ PHP_METHOD(SolrQuery, getFacetDateHardEnd) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.date.hardend"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_boolean(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getFacetDateOther([string field_override]) Returns the facet.date.other parameter */ PHP_METHOD(SolrQuery, getFacetDateOther) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "facet.date.other"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { array_init(return_value); solr_normal_param_value_display(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto bool SolrQuery::getHighlight() Returns the state of the hl parameter */ PHP_METHOD(SolrQuery, getHighlight) { solr_char_t *param_name = (solr_char_t *) "hl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto array SolrQuery::getHighlightFields() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightFields) { solr_char_t *param_name = (solr_char_t *) "hl.fl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.fl")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_simple_list_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getHighlightSnippets([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightSnippets) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.snippets"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_integer(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto int SolrQuery::getHighlightFragsize([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightFragsize) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.fragsize"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_integer(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto bool SolrQuery::getHighlightMergeContiguous([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightMergeContiguous) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.mergeContiguous"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_boolean(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto bool SolrQuery::getHighlightRequireFieldMatch() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightRequireFieldMatch) { solr_char_t *param_name = (solr_char_t *) "hl.requireFieldMatch"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.requireFieldMatch")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getHighlightMaxAnalyzedChars() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightMaxAnalyzedChars) { solr_char_t *param_name = (solr_char_t *) "hl.maxAnalyzedChars"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.maxAnalyzedChars")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getHighlightAlternateField([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightAlternateField) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.alternateField"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto int SolrQuery::getHighlightMaxAlternateFieldLength([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightMaxAlternateFieldLength) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.maxAlternateFieldLength"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_integer(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getHighlightFormatter([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightFormatter) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.formatter"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getHighlightSimplePre([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightSimplePre) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.simple.pre"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getHighlightSimplePost([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightSimplePost) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.simple.post"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrQuery::getHighlightFragmenter([string field_override]) Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightFragmenter) { solr_param_t *solr_param = NULL; solr_string_t field_override_buffer; /* Field name buffer to prepare field override */ /* Field name override, if any */ solr_char_t *field_name = NULL; COMPAT_ARG_SIZE_T field_name_len = 0; /* Set if the parameter was found in the HashTable and off otherwise */ zend_bool param_is_set = 1; memset(&field_override_buffer, 0, sizeof(solr_string_t)); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &field_name, &field_name_len) == FAILURE) { php_error_docref(NULL, E_WARNING, "Invalid parameters"); RETURN_NULL(); } solr_query_field_override(&field_override_buffer, field_name, field_name_len, "hl.fragmenter"); if (solr_param_find(getThis(), field_override_buffer.str, field_override_buffer.len, (solr_param_t **) &solr_param) == FAILURE) { param_is_set = 0; } solr_string_free(&field_override_buffer); if (param_is_set) { solr_normal_param_value_display_string(solr_param, return_value); return; } RETURN_NULL(); } /* }}} */ /* {{{ proto bool SolrQuery::getHighlightUsePhraseHighlighter() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightUsePhraseHighlighter) { solr_char_t *param_name = (solr_char_t *) "hl.usePhraseHighlighter"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.usePhraseHighlighter")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getHighlightHighlightMultiTerm() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightHighlightMultiTerm) { solr_char_t *param_name = (solr_char_t *) "hl.highlightMultiTerm"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.highlightMultiTerm")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto float SolrQuery::getHighlightRegexSlop() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightRegexSlop) { solr_char_t *param_name = (solr_char_t *) "hl.regex.slop"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.regex.slop")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_double(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getHighlightRegexPattern() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightRegexPattern) { solr_char_t *param_name = (solr_char_t *) "hl.regex.pattern"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.regex.pattern")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getHighlightRegexMaxAnalyzedChars() Returns the parameter */ PHP_METHOD(SolrQuery, getHighlightRegexMaxAnalyzedChars) { solr_char_t *param_name = (solr_char_t *) "hl.regex.maxAnalyzedChars"; COMPAT_ARG_SIZE_T param_name_len = sizeof("hl.regex.maxAnalyzedChars")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getStats() Returns the status of the stats parameter */ PHP_METHOD(SolrQuery, getStats) { solr_char_t *param_name = (solr_char_t *) "stats"; COMPAT_ARG_SIZE_T param_name_len = sizeof("stats")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto array SolrQuery::getStatsFields() Returns the stats.field parameters */ PHP_METHOD(SolrQuery, getStatsFields) { solr_char_t *param_name = (solr_char_t *) "stats.field"; COMPAT_ARG_SIZE_T param_name_len = sizeof("stats.field")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getStatsFacets() Returns all the stats facets */ PHP_METHOD(SolrQuery, getStatsFacets) { solr_char_t *param_name = (solr_char_t *) "stats.facet"; COMPAT_ARG_SIZE_T param_name_len = sizeof("stats.facet")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_normal_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getMlt() Returns the parameter */ PHP_METHOD(SolrQuery, getMlt) { solr_char_t *param_name = (solr_char_t *) "mlt"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltCount() Returns the parameter */ PHP_METHOD(SolrQuery, getMltCount) { solr_char_t *param_name = (solr_char_t *) "mlt.count"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.count")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto array SolrQuery::getMltFields() Returns the parameter */ PHP_METHOD(SolrQuery, getMltFields) { solr_char_t *param_name = (solr_char_t *) "mlt.fl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.fl")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_simple_list_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto array SolrQuery::getMltQueryFields() Returns the parameter */ PHP_METHOD(SolrQuery, getMltQueryFields) { solr_char_t *param_name = (solr_char_t *) "mlt.qf"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.qf")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } array_init(return_value); solr_arg_list_param_value_display(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltMinTermFrequency() Returns the parameter */ PHP_METHOD(SolrQuery, getMltMinTermFrequency) { solr_char_t *param_name = (solr_char_t *) "mlt.mintf"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.mintf")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltMinDocFrequency() Returns the parameter */ PHP_METHOD(SolrQuery, getMltMinDocFrequency) { solr_char_t *param_name = (solr_char_t *) "mlt.mindf"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.mindf")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltMinWordLength() Returns the parameter */ PHP_METHOD(SolrQuery, getMltMinWordLength) { solr_char_t *param_name = (solr_char_t *) "mlt.minwl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.minwl")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltMaxWordLength() Returns the parameter */ PHP_METHOD(SolrQuery, getMltMaxWordLength) { solr_char_t *param_name = (solr_char_t *) "mlt.maxwl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.maxwl")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltMaxNumTokens() Returns the parameter */ PHP_METHOD(SolrQuery, getMltMaxNumTokens) { solr_char_t *param_name = (solr_char_t *) "mlt.maxntp"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.maxntp")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getMltMaxNumQueryTerms() Returns the parameter */ PHP_METHOD(SolrQuery, getMltMaxNumQueryTerms) { solr_char_t *param_name = (solr_char_t *) "mlt.maxqt"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.maxqt")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getMltBoost() Returns the parameter */ PHP_METHOD(SolrQuery, getMltBoost) { solr_char_t *param_name = (solr_char_t *) "mlt.boost"; COMPAT_ARG_SIZE_T param_name_len = sizeof("mlt.boost")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getTerms() Returns the parameter */ PHP_METHOD(SolrQuery, getTerms) { solr_char_t *param_name = (solr_char_t *) "terms"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getTermsField() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsField) { solr_char_t *param_name = (solr_char_t *) "terms.fl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.fl")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getTermsLowerBound() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsLowerBound) { solr_char_t *param_name = (solr_char_t *) "terms.lower"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.lower")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getTermsUpperBound() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsUpperBound) { solr_char_t *param_name = (solr_char_t *) "terms.upper"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.upper")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getTermsIncludeLowerBound() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsIncludeLowerBound) { solr_char_t *param_name = (solr_char_t *) "terms.lower.incl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.lower.incl")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getTermsIncludeUpperBound() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsIncludeUpperBound) { solr_char_t *param_name = (solr_char_t *) "terms.upper.incl"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.upper.incl")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getTermsMinCount() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsMinCount) { solr_char_t *param_name = (solr_char_t *) "terms.mincount"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.mincount")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getTermsMaxCount() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsMaxCount) { solr_char_t *param_name = (solr_char_t *) "terms.maxcount"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.maxcount")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto string SolrQuery::getTermsPrefix() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsPrefix) { solr_char_t *param_name = (solr_char_t *) "terms.prefix"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.prefix")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_string(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getTermsLimit() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsLimit) { solr_char_t *param_name = (solr_char_t *) "terms.limit"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.limit")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_integer(solr_param, return_value); } /* }}} */ /* {{{ proto bool SolrQuery::getTermsReturnRaw() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsReturnRaw) { solr_char_t *param_name = (solr_char_t *) "terms.raw"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.raw")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_boolean(solr_param, return_value); } /* }}} */ /* {{{ proto int SolrQuery::getTermsSort() Returns the parameter */ PHP_METHOD(SolrQuery, getTermsSort) { solr_char_t *param_name = (solr_char_t *) "terms.sort"; COMPAT_ARG_SIZE_T param_name_len = sizeof("terms.sort")-1; solr_param_t *solr_param = NULL; if (solr_param_find(getThis(), param_name, param_name_len, (solr_param_t **) &solr_param) == FAILURE) { RETURN_NULL(); } solr_normal_param_value_display_sort_type(solr_param, return_value); } /* }}} */ /* }}} End of getter methods */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/php_solr_response.c000066400000000000000000000264701374041537100227330ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_solr.h" /* {{{ Macro for extracting property values using string constants */ #define solr_read_response_object_property(objptr, name, silent, rv) zend_read_property(Z_OBJCE_P(objptr), OBJ_FOR_PROP(objptr), name, sizeof(name)-1, silent, rv) /* }}} */ /* {{{ proto int SolrResponse::getHttpStatus(void) Returns the value of the http_status property. */ PHP_METHOD(SolrResponse, getHttpStatus) { zend_bool silent = 1; zval rv; zval *objptr = getThis(); zval *http_status = NULL; http_status = solr_read_response_object_property(objptr, "http_status", silent, &rv); RETURN_LONG(Z_LVAL_P(http_status)); } /* }}} */ /* {{{ proto string SolrResponse::getHttpStatusMessage(void) Returns the http_status_message property. */ PHP_METHOD(SolrResponse, getHttpStatusMessage) { zend_bool silent = 1; zval rv; zval *objptr = getThis(); zval *http_status_message = NULL; http_status_message = solr_read_response_object_property(objptr, "http_status_message", silent, &rv); RETURN_STRINGL(Z_STRVAL_P(http_status_message), Z_STRLEN_P(http_status_message)); } /* }}} */ /* {{{ proto bool SolrResponse::success(void) Returns whether the request was successful or not. */ PHP_METHOD(SolrResponse, success) { zend_bool silent = 1; zval rv; zval *objptr = getThis(); zval *success = NULL; success = solr_read_response_object_property(objptr, "success", silent, &rv); RETURN_ZVAL(success, 0, 0); } /* }}} */ /* {{{ proto string SolrResponse::getRequestUrl(void) Returns the URL used for the request. */ PHP_METHOD(SolrResponse, getRequestUrl) { zend_bool silent = 1; zval rv; zval *objptr = getThis(); zval *prop = NULL; prop = solr_read_response_object_property(objptr, "http_request_url", silent, &rv); RETURN_STRINGL(Z_STRVAL_P(prop), Z_STRLEN_P(prop)); } /* }}} */ /* {{{ proto string SolrResponse::getRawRequestHeaders(void) Returns the raw http request headers sent to the server. */ PHP_METHOD(SolrResponse, getRawRequestHeaders) { zend_bool silent = 1; zval rv; zval *objptr = getThis(); zval *prop = NULL; prop = solr_read_response_object_property(objptr, "http_raw_request_headers", silent, &rv); RETURN_STRINGL(Z_STRVAL_P(prop), Z_STRLEN_P(prop)); } /* }}} */ /* {{{ proto string SolrResponse::getRawRequest(void) Returns the raw http request sent to the server. */ PHP_METHOD(SolrResponse, getRawRequest) { zend_bool silent = 1; zval rv; zval *objptr = getThis(); zval *prop = NULL; prop = solr_read_response_object_property(objptr, "http_raw_request", silent, &rv); RETURN_STRINGL(Z_STRVAL_P(prop), Z_STRLEN_P(prop)); } /* }}} */ /* {{{ proto string SolrResponse::getRawResponseHeaders(void) Returns the raw http response headers from the server. */ PHP_METHOD(SolrResponse, getRawResponseHeaders) { zend_bool silent = 1; zval rv; zval *objptr = getThis(); zval *prop = NULL; prop = solr_read_response_object_property(objptr, "http_raw_response_headers", silent, &rv); RETURN_STRINGL(Z_STRVAL_P(prop), Z_STRLEN_P(prop)); } /* }}} */ /* {{{ proto string SolrResponse::getRawResponse(void) Returns the raw http response from the server. */ PHP_METHOD(SolrResponse, getRawResponse) { zend_bool silent = 1; zval rv; zval *objptr = getThis(); zval *prop = NULL; prop = solr_read_response_object_property(objptr, "http_raw_response", silent, &rv); if (Z_STRLEN_P(prop)) { RETURN_STRINGL(Z_STRVAL_P(prop), Z_STRLEN_P(prop)); } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrResponse::getDigestedResponse(void) Returns the serialized object string derived from the XML response. */ PHP_METHOD(SolrResponse, getDigestedResponse) { zend_bool silent = 0; zval rv; zval *objptr = getThis(); zval *prop = NULL; prop = solr_read_response_object_property(objptr, "http_digested_response", silent, &rv); if (Z_STRLEN_P(prop)) { RETURN_STRINGL(Z_STRVAL_P(prop), Z_STRLEN_P(prop)); } RETURN_NULL(); } /* }}} */ /* {{{ proto string SolrReponse::setParseMode([bool parse_mode]) Sets the parsing mode. This determines whether documents will be parsed as SolrObjects or SolrDocuments. */ PHP_METHOD(SolrResponse, setParseMode) { long int parse_mode = 0L; zval *objptr = getThis(); if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &parse_mode) == FAILURE) { RETURN_FALSE; } parse_mode = ((parse_mode < 0L) ? 0L : ((parse_mode > 1L) ? 1L : parse_mode)); zend_update_property_long(Z_OBJCE_P(objptr), OBJ_FOR_PROP(objptr), "parser_mode", sizeof("parser_mode")-1, parse_mode); RETURN_TRUE; } /* }}} */ /* {{{ proto SolrObject SolrResponse::getResponse(void) Returns the response object from the server. */ PHP_METHOD(SolrResponse, getResponse) { solr_response_get_response_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU,0); } /* }}} */ /* {{{ proto array SolrResponse::getArrayResponse(void) Returns the response array from the server. */ PHP_METHOD(SolrResponse, getArrayResponse) { solr_response_get_response_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU,1); } /* }}} */ /** * Digest solr server raw response * and return SolrObject or array */ PHP_SOLR_API void solr_response_get_response_impl( INTERNAL_FUNCTION_PARAMETERS, int return_array) { zend_bool silent = 0; zval *objptr = getThis(); zval rv; zval *response_writer = solr_read_response_object_property(objptr, "response_writer", silent, &rv); zval *raw_response = solr_read_response_object_property(objptr, "http_raw_response", silent, &rv); zval *success = solr_read_response_object_property(objptr, "success", silent, &rv); zval *parser_mode = solr_read_response_object_property(objptr, "parser_mode", silent, &rv); if (Z_TYPE_P(success) == IS_TRUE && Z_STRLEN_P(raw_response)) { solr_string_t buffer; php_unserialize_data_t var_hash; const unsigned char *raw_resp; size_t raw_res_length; const unsigned char *str_end; int successful = 1; memset(&buffer, 0, sizeof(solr_string_t)); if (Z_STRLEN_P(response_writer)) { if (0 == strcmp(Z_STRVAL_P(response_writer), SOLR_XML_RESPONSE_WRITER)) { /* SOLR_XML_RESPONSE_WRITER */ /* Convert from XML serialization to PHP serialization format */ solr_encode_generic_xml_response(&buffer, Z_STRVAL_P(raw_response), Z_STRLEN_P(raw_response), Z_LVAL_P(parser_mode)); if(return_array) { solr_sobject_to_sarray(&buffer); } } else if (0 == strcmp(Z_STRVAL_P(response_writer), SOLR_PHP_NATIVE_RESPONSE_WRITER) || 0 == strcmp(Z_STRVAL_P(response_writer), SOLR_PHP_SERIALIZED_RESPONSE_WRITER)) { /* SOLR_PHP_NATIVE_RESPONSE_WRITER */ /* Response string is already in Native PHP serialization format */ solr_string_set(&buffer, Z_STRVAL_P(raw_response), Z_STRLEN_P(raw_response)); if(!return_array) { solr_sarray_to_sobject(&buffer); } } else if (0 == strcmp(Z_STRVAL_P(response_writer), SOLR_JSON_RESPONSE_WRITER)) { int json_translation_result = solr_json_to_php_native(&buffer, Z_STRVAL_P(raw_response), Z_STRLEN_P(raw_response)); /* SOLR_JSON_RESPONSE_WRITER */ /* Convert from JSON serialization to PHP serialization format */ if (json_translation_result > 0) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1000, SOLR_FILE_LINE_FUNC, solr_get_json_error_msg(json_translation_result)); php_error_docref(NULL, E_WARNING, "Error in JSON->PHP conversion. JSON Error Code %d", json_translation_result); } if(!return_array) { solr_sarray_to_sobject(&buffer); } } } if (buffer.len) { zend_update_property_stringl(Z_OBJCE_P(objptr), OBJ_FOR_PROP(objptr), "http_digested_response", sizeof("http_digested_response")-1, buffer.str, buffer.len); } memset(&var_hash, 0, sizeof(php_unserialize_data_t)); PHP_VAR_UNSERIALIZE_INIT(var_hash); raw_resp = (unsigned char *) buffer.str; raw_res_length = buffer.len; str_end = (unsigned char *) (raw_resp + raw_res_length); if (!php_var_unserialize(return_value, &raw_resp, str_end, &var_hash)) { successful = 0; solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1000, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1000_MSG); php_error_docref(NULL, E_WARNING, "Error unserializing raw response."); } PHP_VAR_UNSERIALIZE_DESTROY(var_hash); solr_string_free(&buffer); if (successful && !return_array) { /* Overriding the default object handlers */ Z_OBJ_HT_P(return_value) = &solr_object_handlers; } return ; } RETURN_NULL(); } /* {{{ proto string SolrPingResponse::getResponse(void) Ping responses are always empty. Returns null. */ PHP_METHOD(SolrPingResponse, getResponse) { /* Ping responses are not serialized */ RETURN_NULL(); } /* }}} */ /* {{{ proto SolrPingResponse::__construct(void) Constructor */ PHP_METHOD(SolrPingResponse, __construct) { } /* }}} */ /* {{{ proto SolrPingResponse::__destruct(void) Destructor */ PHP_METHOD(SolrPingResponse, __destruct) { } /* }}} */ /* {{{ proto SolrQueryResponse::__construct(void) Constructor */ PHP_METHOD(SolrQueryResponse, __construct) { } /* }}} */ /* {{{ proto SolrQueryResponse::__destruct(void) Destructor */ PHP_METHOD(SolrQueryResponse, __destruct) { } /* }}} */ /* {{{ proto SolrUpdateResponse::__construct(void) Constructor */ PHP_METHOD(SolrUpdateResponse, __construct) { } /* }}} */ /* {{{ proto SolrUpdateResponse::__destruct(void) Destructor */ PHP_METHOD(SolrUpdateResponse, __destruct) { } /* }}} */ /* {{{ proto SolrGenericResponse::__construct(void) Constructor */ PHP_METHOD(SolrGenericResponse, __construct) { } /* }}} */ /* {{{ proto SolrGenericResponse::__destruct(void) Destructor */ PHP_METHOD(SolrGenericResponse, __destruct) { } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/php_solr_utils.c000066400000000000000000000166721374041537100222400ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_solr.h" /* {{{ proto string SolrUtils::escapeQueryChars(string unescaped) Escapes the lucene string */ PHP_METHOD(SolrUtils, escapeQueryChars) { solr_char_t *unescaped = NULL; solr_string_t sbuilder; COMPAT_ARG_SIZE_T unescaped_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &unescaped, &unescaped_length) == FAILURE) { RETURN_FALSE; } if (!unescaped_length) { RETURN_NULL(); } memset(&sbuilder, 0, sizeof(solr_string_t)); solr_escape_query_chars(&sbuilder, unescaped, unescaped_length); RETVAL_STRINGL(sbuilder.str, sbuilder.len); solr_string_free(&sbuilder); } /* }}} */ /* {{{ proto string SolrUtils::queryPhrase(string unescaped) Prepares a phrase from an unescaped lucene string. */ PHP_METHOD(SolrUtils, queryPhrase) { solr_char_t *unescaped = NULL; solr_string_t sbuilder; COMPAT_ARG_SIZE_T unescaped_length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &unescaped, &unescaped_length) == FAILURE) { RETURN_FALSE; } if (!unescaped_length) { RETURN_NULL(); } memset(&sbuilder, 0, sizeof(solr_string_t)); solr_string_appendc(&sbuilder, '"'); solr_escape_query_chars(&sbuilder, unescaped, unescaped_length); solr_string_appendc(&sbuilder, '"'); RETVAL_STRINGL(sbuilder.str, sbuilder.len); solr_string_free(&sbuilder); } /* }}} */ /* {{{ proto string SolrUtils::digestXMLResponse(string xml_response [, int parse_mode]) Digests the xml response into a php serialize string. */ PHP_METHOD(SolrUtils, digestXmlResponse) { solr_char_t *xmlresponse = NULL; COMPAT_ARG_SIZE_T xmlresponse_len = 0; long int parse_mode = 0L; solr_string_t sbuilder; unsigned char *raw_resp = NULL, *str_end = NULL; size_t raw_res_length = 0; php_unserialize_data_t var_hash; int successful = 1; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &xmlresponse, &xmlresponse_len, &parse_mode) == FAILURE) { RETURN_FALSE; } if (!xmlresponse_len) { php_error_docref(NULL, E_WARNING, "Raw response is empty"); RETURN_NULL(); } parse_mode = ((parse_mode < 0L) ? 0L : ((parse_mode > 1L) ? 1L : parse_mode)); memset(&sbuilder, 0, sizeof(solr_string_t)); solr_encode_generic_xml_response(&sbuilder, xmlresponse, xmlresponse_len, parse_mode); if (sbuilder.str == NULL || sbuilder.len == 0) { php_error_docref(NULL, E_WARNING, "Raw response was not valid"); RETURN_NULL(); } memset(&var_hash, 0, sizeof(php_unserialize_data_t)); PHP_VAR_UNSERIALIZE_INIT(var_hash); raw_resp = (unsigned char *) sbuilder.str; raw_res_length = sbuilder.len; str_end = (unsigned char *) (raw_resp + raw_res_length); if (!php_var_unserialize(return_value, (const unsigned char **) &raw_resp, str_end, &var_hash)) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1000, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1000_MSG); php_error_docref(NULL, E_WARNING, "Error unserializing raw response."); successful = 0; } PHP_VAR_UNSERIALIZE_DESTROY(var_hash); solr_string_free(&sbuilder); if (successful) { /* Overriding the default object handlers */ Z_OBJ_HT_P(return_value) = &solr_object_handlers; } } /* }}} */ /* {{{ proto string SolrUtils::digestJsonResponse(string jsonResponse) Digests the json response into a php serialize string. */ PHP_METHOD(SolrUtils, digestJsonResponse) { solr_char_t *jsonResponse = NULL; COMPAT_ARG_SIZE_T jsonResponse_len = 0; unsigned char *raw_resp = NULL, *str_end = NULL; solr_string_t buffer; php_unserialize_data_t var_hash; COMPAT_ARG_SIZE_T raw_res_length; int successful = 1; int json_translation_result; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &jsonResponse, &jsonResponse_len) == FAILURE) { RETURN_FALSE; } memset(&buffer, 0, sizeof(solr_string_t)); json_translation_result = solr_json_to_php_native(&buffer, jsonResponse, jsonResponse_len); if (json_translation_result > 0) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1000, SOLR_FILE_LINE_FUNC, solr_get_json_error_msg(json_translation_result)); php_error_docref(NULL, E_WARNING, "Error in JSON->PHP conversion. JSON Error Code %d", json_translation_result); }else{ solr_sarray_to_sobject(&buffer); } memset(&var_hash, 0, sizeof(php_unserialize_data_t)); PHP_VAR_UNSERIALIZE_INIT(var_hash); raw_resp = (unsigned char *) buffer.str; raw_res_length = buffer.len; str_end = (unsigned char *) (raw_resp + raw_res_length); if (!php_var_unserialize(return_value, (const unsigned char **)&raw_resp, str_end, &var_hash)) { solr_throw_exception_ex(solr_ce_SolrException, SOLR_ERROR_1000, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1000_MSG); php_error_docref(NULL, E_WARNING, "Error unserializing raw response."); successful = 0; } solr_string_free(&buffer); PHP_VAR_UNSERIALIZE_DESTROY(var_hash); if (successful) { /* Overriding the default object handlers */ Z_OBJ_HT_P(return_value) = &solr_object_handlers; } } /* }}} */ /* {{{ proto string SolrUtils::getSolrVersion(void) Returns the current extension version */ PHP_METHOD(SolrUtils, getSolrVersion) { #ifdef SOLR_DEBUG char * version; asprintf(&version,"%s (DEBUG)", PHP_SOLR_DOTTED_VERSION); ZVAL_STRING(return_value, version); #else RETURN_STRING(PHP_SOLR_DOTTED_VERSION); #endif } /* }}} */ /* {{{ proto array SolrUtils::getSolrStats(void) Returns the number of active documents, clients and SolrParam objects in the current thread. */ PHP_METHOD(SolrUtils, getSolrStats) { int document_count = zend_hash_num_elements(SOLR_GLOBAL(documents)); int client_count = zend_hash_num_elements(SOLR_GLOBAL(clients)); int params_count = zend_hash_num_elements(SOLR_GLOBAL(params)); array_init(return_value); add_assoc_long(return_value, "document_count", document_count); add_assoc_long(return_value, "client_count", client_count); add_assoc_long(return_value, "params_count", params_count); } /* }}} */ /* {{{ proto string solr_get_version(void) Returns the current extension version */ PHP_FUNCTION(solr_get_version) { #ifdef SOLR_DEBUG char * version; asprintf(&version,"%s (DEBUG)", PHP_SOLR_DOTTED_VERSION); ZVAL_STRING(return_value, version); #else RETURN_STRING(PHP_SOLR_DOTTED_VERSION); #endif } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/php_solr_version.h000066400000000000000000000046311374041537100225620ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_version.h" #ifndef PHP_SOLR_VERSION_H #define PHP_SOLR_VERSION_H #define PHP_SOLR_MAJOR_VERSION 2 #define PHP_SOLR_MINOR_VERSION 5 #define PHP_SOLR_PATCH_VERSION 1 #define PHP_SOLR_RELEASE_VERSION PHP_SOLR_PATCH_VERSION #define PHP_SOLR_VERSION "2.5.1" #define PHP_SOLR_DOTTED_VERSION PHP_SOLR_VERSION /** * Extension version numbers using hexadecimal numbers * * This is the numeric version of the extension, meant for easier * parsing and comparisons by programs. The PHP_SOLR_VERSION_ID define will * always follow this syntax: * * 0xXXYYZZ * * Where XX, YY and ZZ are the main version, minor version and patch numbers in * hexadecimal (using 8 bits each). All three numbers are always represented * using two digits. 1.2 would appear as "0x010200" while version 9.11.7 * appears as "0x090b07". * * This 6-digit (24 bits) hexadecimal number does not show pre-release number, * and it is always a greater number in a more recent release. It makes * comparisons with greater than and less than work. */ #define PHP_SOLR_VERSION_ID 0x020500 #define SOLR_CLIENT_USER_AGENT "PHP Solr Client 2.5.0" #endif /* PHP_SOLR_VERSION_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/solr_constants.h000066400000000000000000000200151374041537100222340ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #ifndef SOLR_CONSTANTS_H #define SOLR_CONSTANTS_H #include "php_solr_version.h" #define SOLR_SPACE_STRING " " /* {{{ Constants for the SolrClient with*/ #define SOLR_DEFAULT_UPDATE_SERVLET "update" #define SOLR_DEFAULT_EXTRACT_SERVLET "update/extract" #define SOLR_DEFAULT_SEARCH_SERVLET "select" #define SOLR_DEFAULT_THREADS_SERVLET "admin/threads" #define SOLR_DEFAULT_PING_SERVLET "admin/ping" #define SOLR_DEFAULT_TERMS_SERVLET "terms" #define SOLR_DEFAULT_SYSTEM_SERVLET "admin/system" #define SOLR_DEFAULT_GET_SERVLET "get" #define SOLR_PHP_SERIALIZED_RESPONSE_WRITER "phps" #define SOLR_PHP_NATIVE_RESPONSE_WRITER "phpnative" #define SOLR_XML_RESPONSE_WRITER "xml" #define SOLR_JSON_RESPONSE_WRITER "json" #define SOLR_REQUEST_DEFAULT_HOST "localhost" #define SOLR_REQUEST_DEFAULT_PATH "solr" #define SOLR_REQUEST_DEFAULT_QS_DELIMITER "&" #define SOLR_REQUEST_DEFAULT_PORT 8983L #define SOLR_CURL_MAX_WRITE_SIZE CURL_MAX_WRITE_SIZE #define SOLR_CURL_OPTIONS_LENGTH 512 /* }}} */ /* {{{ Names of Objects */ #define PHP_SOLR_OBJECT_CLASSNAME "SolrObject" #define PHP_SOLR_DOCUMENT_CLASSNAME "SolrDocument" #define PHP_SOLR_DOCUMENT_FIELD_CLASSNAME "SolrDocumentField" #define PHP_SOLR_INPUT_DOCUMENT_CLASSNAME "SolrInputDocument" #define PHP_SOLR_EXTRACTREQUEST_CLASSNAME "SolrExtractRequest" #define PHP_SOLR_CLIENT_CLASSNAME "SolrClient" #define PHP_SOLR_PARAMS_CLASSNAME "SolrParams" #define PHP_SOLR_QUERY_CLASSNAME "SolrQuery" #define PHP_SOLR_COLLAPSE_FUNCTION_CLASSNAME "SolrCollapseFunction" #define PHP_SOLR_MODIFIABLE_PARAMS_CLASSNAME "SolrModifiableParams" #define PHP_SOLR_RESPONSE_CLASSNAME "SolrResponse" #define PHP_SOLR_QUERY_RESPONSE_CLASSNAME "SolrQueryResponse" #define PHP_SOLR_UPDATE_RESPONSE_CLASSNAME "SolrUpdateResponse" #define PHP_SOLR_PING_RESPONSE_CLASSNAME "SolrPingResponse" #define PHP_SOLR_GENERIC_RESPONSE_CLASSNAME "SolrGenericResponse" #define PHP_SOLR_UTILS_CLASSNAME "SolrUtils" #define PHP_SOLR_EXCEPTION_CLASSNAME "SolrException" #define PHP_SOLR_ILLEGAL_OPERATION_EXCEPTION_CLASSNAME "SolrIllegalOperationException" #define PHP_SOLR_ILLEGAL_ARGUMENT_EXCEPTION_CLASSNAME "SolrIllegalArgumentException" #define PHP_SOLR_CLIENT_EXCEPTION_CLASSNAME "SolrClientException" #define PHP_SOLR_SERVER_EXCEPTION_CLASSNAME "SolrServerException" #define PHP_SOLR_MISSING_MANDATORY_PARAMETER_EXCEPTION_CLASSNAME "SolrMissingMandatoryParameterException" /* }}} */ /* {{{ Informational constants */ #define PHP_SOLR_EXTENSION_NAME "solr" #define PHP_CURL_EXTENSION_NAME "curl" #define PHP_LIBXML_EXTENSION_NAME "libxml" #define PHP_JSON_EXTENSION_NAME "json" /* }}} */ /* {{{ Property names */ #define SOLR_INDEX_PROPERTY_NAME "_hashtable_index" #define SOLR_FIELD_NAME_PROPERTY_NAME "name" #define SOLR_FIELD_BOOST_PROPERTY_NAME "boost" #define SOLR_FIELD_VALUES_PROPERTY_NAME "values" #define SOLR_SOURCELINE_NO_PROPERTY_NAME "sourceline" #define SOLR_SOURCEFILE_PROPERTY_NAME "sourcefile" #define SOLR_ZIFNAME_PROPERTY_NAME "zif_name" #define SOLR_DISMAX_DEFAULT_PARSER "edismax" #ifdef PHP_WIN32 #define __func__ __FUNCTION__ #endif #define SOLR_FILE_LINE_FUNC __FILE__, __LINE__, __func__ /* }}} */ /* {{{ Constants for Method/Function arguments and return styles */ #define SOLR_ARG_PASS_BY_REF_FALSE 0 #define SOLR_ARG_PASS_BY_REF_TRUE 1 #define SOLR_ARG_PASS_REMAINING_BY_REF_FALSE 0 #define SOLR_ARG_PASS_REMAINING_BY_REF_TRUE 1 #define SOLR_ARG_ALLOW_NULL_FALSE 0 #define SOLR_ARG_ALLOW_NULL_TRUE 1 #define SOLR_METHOD_RETURN_REFERENCE_FALSE 0 #define SOLR_METHOD_RETURN_REFERENCE_TRUE 1 /* }}} */ /* {{{ Constants for Sorting SolrDocument Fields */ #define SOLR_SORT_ASC 1 #define SOLR_SORT_DESC 2 #define SOLR_SORT_FIELD_NAME 1 #define SOLR_SORT_FIELD_VALUE_COUNT 2 #define SOLR_SORT_FIELD_BOOST_VALUE 4 /* }}} */ /* {{{ Constants for document encoding formats */ #define SOLR_XML_ENCODE_OBJ 0L #define SOLR_XML_ENCODE_DOC 1L /* }}} */ /** * Setting this to 8 gets rid of the extra while loops in _zend_hash_init() * * _zend_hash_init loops 3 times to increase the value of the size to 8 */ #define SOLR_INITIAL_HASH_TABLE_SIZE (1<<3) /* {{{ Memory Allocation Related Constants */ #define SOLR_HASHTABLE_PERSISTENT 0 #define SOLR_DOCUMENT_PERSISTENT 0 #define SOLR_DOCUMENT_FIELD_PERSISTENT 0 #define SOLR_CLIENT_PERSISTENT 0 #define SOLR_PARAMS_PERSISTENT 0 #define SOLR_FUNCTIONS_PERSISTENT 0 /* }}} */ /* {{{ SolrException Codes : Internal and UserSpace */ /* {{{ Error codes and messages */ #define SOLR_ERROR_1000 1000L #define SOLR_ERROR_1000_MSG "Error un-serializing response" #define SOLR_ERROR_1001 1001L #define SOLR_ERROR_1001_MSG "SolrClient objects cannot be serialized or unserialized" #define SOLR_ERROR_1002 1002L #define SOLR_ERROR_1002_MSG "The '%s' property cannot be removed or set to NULL. SolrObject properties cannot be unset or set to NULL." #define SOLR_ERROR_1003 1003L #define SOLR_ERROR_1003_MSG "Error building HTTP query from parameters" #define SOLR_ERROR_1004 1004L #define SOLR_ERROR_1004_MSG "Unsuccessful HTTP request" #define SOLR_ERROR_1005 1005L #define SOLR_ERROR_1005_MSG "SolrInputDocument objects cannot be serialized or unserialized" #define SOLR_ERROR_1006 1006L #define SOLR_ERROR_1006_MSG "SolrObject instances are read-only. Properties cannot be added, updated or removed." #define SOLR_ERROR_1007 1007L #define SOLR_ERROR_1007_MSG "SolrDocumentField instances are read-only. Properties cannot be updated or removed." #define SOLR_ERROR_1008 1008L #define SOLR_ERROR_1008_MSG "Internal Error 1008 generated from %s %d %s. The observed error is a possible side-effect of an illegal/unsupported operation in userspace. Please check the documentation and try again later." #define SOLR_ERROR_1009 1009L #define SOLR_ERROR_1009_MSG "The observed error is a possible side-effect of an illegal/unsupported operation in userspace. This object cannot be cloned. Cloning of this object type is not yet supported." #define SOLR_ERROR_1010 1010L #define SOLR_ERROR_1010_MSG "Unsuccessful %s request : Response Code %ld. %s" #define SOLR_ERROR_4000 4000L #define SOLR_ERROR_4000_MSG "Invalid argument" #define SOLR_ERROR_4001 4001L #define SOLR_ERROR_4001_MSG "Illegal Operation" #define SOLR_ERROR_4002 4002L #define SOLR_ERROR_4002_MSG "Return value requested without processing output" #define SOLR_ERROR_4003 4003L #define SOLR_ERROR_4003_MSG "Invalid field value modifier." #define SOLR_ERROR_4004 4004L #define SOLR_ERROR_4004_MSG "Cannot add and modify the same field." /* }}} */ /* {{{ UserSpace Errors */ #define SOLR_ERROR_4100 4100L #define SOLR_ERROR_4100_MSG "Mandatory parameter Missing: %s" /* }}} */ /* {{{ Compile time errors */ /* }}} */ /* }}} */ #endif /* SOLR_CONSTANTS_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/solr_functions_client.c000066400000000000000000001004621374041537100235660ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_solr.h" /* {{{ PHP_SOLR_API int solr_init_options(solr_client_options_t *options) */ PHP_SOLR_API int solr_init_options(solr_client_options_t *options) { solr_string_init(&(options->hostname)); solr_string_init(&(options->path)); solr_string_init(&(options->http_auth_credentials)); solr_string_init(&(options->proxy_hostname)); solr_string_init(&(options->proxy_auth_credentials)); solr_string_init(&(options->ssl_cert)); solr_string_init(&(options->ssl_key)); solr_string_init(&(options->ssl_keypassword)); solr_string_init(&(options->ssl_cainfo)); solr_string_init(&(options->ssl_capath)); solr_string_init(&(options->qs_delimiter)); solr_string_init(&(options->response_writer)); solr_string_init(&(options->update_url)); solr_string_init(&(options->search_url)); solr_string_init(&(options->thread_url)); solr_string_init(&(options->ping_url)); solr_string_init(&(options->terms_url)); solr_string_init(&(options->system_url)); solr_string_init(&(options->get_url)); solr_string_init(&(options->update_servlet)); solr_string_init(&(options->search_servlet)); solr_string_init(&(options->thread_servlet)); solr_string_init(&(options->ping_servlet)); solr_string_init(&(options->terms_servlet)); solr_string_init(&(options->system_servlet)); solr_string_init(&(options->get_servlet)); return SUCCESS; } /* }}} */ /* {{{ static void solr_set_initial_handle_options(solr_curl_t **sch, solr_client_options_t *options) */ static void solr_set_initial_curl_handle_options(solr_curl_t **sch_ptr, solr_client_options_t *options) { solr_curl_t * sch = *sch_ptr; /** Setup all the required CURL options here **/ curl_easy_setopt(sch->curl_handle, CURLOPT_NOPROGRESS, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_VERBOSE, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_ERRORBUFFER, sch->err.str); curl_easy_setopt(sch->curl_handle, CURLOPT_WRITEFUNCTION, solr_curl_write); curl_easy_setopt(sch->curl_handle, CURLOPT_WRITEDATA, (void *) sch); curl_easy_setopt(sch->curl_handle, CURLOPT_HEADERFUNCTION, solr_curl_write_header); curl_easy_setopt(sch->curl_handle, CURLOPT_HEADERDATA, (void *) sch); curl_easy_setopt(sch->curl_handle, CURLOPT_DEBUGFUNCTION, solr_curl_debug_callback); curl_easy_setopt(sch->curl_handle, CURLOPT_DEBUGDATA, (void *) sch); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); /** #if LIBCURL_VERSION_NUM >= 0x071304 curl_easy_setopt(sch->curl_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP); #endif */ curl_easy_setopt(sch->curl_handle, CURLOPT_DNS_CACHE_TIMEOUT, 120L); curl_easy_setopt(sch->curl_handle, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_MAXREDIRS, 16L); /* prevent infinite redirects */ curl_easy_setopt(sch->curl_handle, CURLOPT_UNRESTRICTED_AUTH, 0L); curl_easy_setopt(sch->curl_handle, CURLOPT_ACCEPT_ENCODING, ""); #ifdef ZTS curl_easy_setopt(sch->curl_handle, CURLOPT_NOSIGNAL, 1L); /** Needed in multi-threaded environments **/ #endif curl_easy_setopt(sch->curl_handle, CURLOPT_TIMEOUT, options->timeout); curl_easy_setopt(sch->curl_handle, CURLOPT_USERAGENT, SOLR_CLIENT_USER_AGENT); /* If the login and password options are passed, send the authentication headers */ if (options->http_auth_credentials.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_easy_setopt(sch->curl_handle, CURLOPT_USERPWD, options->http_auth_credentials.str); } /* If there is proxy info, send it too */ if (options->proxy_hostname.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_PROXY, options->proxy_hostname.str); if (options->proxy_port) { curl_easy_setopt(sch->curl_handle, CURLOPT_PROXYPORT, options->proxy_port); } if (options->proxy_auth_credentials.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_PROXYUSERPWD, options->proxy_auth_credentials.str); } } /* * When negotiating an SSL connection, the server sends a certificate indicating its identity. * cURL verifies whether the certificate is authentic */ if (options->secure) { /* The name of the PEM-formatted private key and private certificate concatenated */ if (options->ssl_cert.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_SSLCERT, options->ssl_cert.str); curl_easy_setopt(sch->curl_handle, CURLOPT_SSLCERTTYPE, "PEM"); } /* The name of the PEM-formatted private key, if certificate and private key are separate */ if (options->ssl_key.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_SSLKEY, options->ssl_key.str); curl_easy_setopt(sch->curl_handle, CURLOPT_SSLKEYTYPE, "PEM"); } /* Password for the PEM-formatted private key */ if (options->ssl_keypassword.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_KEYPASSWD, options->ssl_keypassword.str); } /* The file holding one or more CA certificates to verify the peer with */ if (options->ssl_cainfo.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_CAINFO, options->ssl_cainfo.str); } /* The directory holding multiple CA certificates to verify the peer with */ if (options->ssl_capath.len) { curl_easy_setopt(sch->curl_handle, CURLOPT_CAPATH , options->ssl_capath.str); } /* * Whether curl verifies the authenticity of the host name of server * Based on the Common name section of the certificate */ if (options->ssl_verify_peer && options->ssl_verify_host) { curl_easy_setopt(sch->curl_handle, CURLOPT_SSL_VERIFYHOST, options->ssl_verify_host); } /* * Verify the authenticity of the peer's certificate * This authentication is based on a chain of digital signatures, * rooted in certification authority (CA) certificates. * * If something is not right, the connection will not be valid */ curl_easy_setopt(sch->curl_handle, CURLOPT_SSL_VERIFYPEER, options->ssl_verify_peer); } } /* }}} */ /* {{{ PHP_SOLR_API int solr_init_handle(solr_curl_t *sch, solr_client_options_t *options) */ PHP_SOLR_API int solr_init_handle(solr_curl_t *sch, solr_client_options_t *options) { sch->response_header.response_code = 0L; memset(sch->err.str, 0, sizeof(sch->err.str)); sch->curl_handle = curl_easy_init(); if (NULL == sch->curl_handle) { return FAILURE; } sch->result_code = CURLE_OK; sch->handle_status = 1; solr_string_init(&(sch->request_header.buffer)); solr_string_init(&(sch->request_body.buffer)); solr_string_init(&(sch->request_body_debug.buffer)); solr_string_init(&(sch->response_header.buffer)); solr_string_init(&(sch->response_body.buffer)); solr_string_init(&(sch->debug_data_buffer)); solr_set_initial_curl_handle_options(&(sch), options); return SUCCESS; } /* }}} */ /** * solr_curl_write * * Called by libcurl as soon as there is response body data received that needs to be saved. * * The size of the data pointed to by *data is size multiplied with nmemb, it will not be zero terminated * * The *ctx parameter is the solr_curl pointer */ /* {{{ size_t solr_curl_write(solr_char_t *data, size_t size, size_t nmemb, void *ctx) */ size_t solr_curl_write(solr_char_t *data, size_t size, size_t nmemb, void *ctx) { size_t length = (size * nmemb); solr_curl_t *sch = (solr_curl_t *) ctx; solr_string_appends(&(sch->response_body.buffer), data, length); return length; } /* }}} */ /** * solr_curl_write_header * * Called by libcurl as soon as it has received header data * * It will be called once for each header and only complete header lines are passed on to the callback. * * Note: header lines may not be null-terminated so beware. * * The *ctx parameter is the solr_curl pointer */ /* {{{ size_t solr_curl_write_header(solr_char_t *data, size_t size, size_t nmemb, void *ctx) */ size_t solr_curl_write_header(solr_char_t *data, size_t size, size_t nmemb, void *ctx) { size_t length = (size * nmemb); solr_curl_t *sch = (solr_curl_t *) ctx; solr_string_appends(&(sch->response_header.buffer), data, length); return length; } /* }}} */ /** * solr_curl_debug_callback * * The infotype parameter is one of : * * 0 = CURLINFO_TEXT * 1 = CURLINFO_HEADER_IN (Response Headers) * 2 = CURLINFO_HEADER_OUT (Request Headers) * 3 = CURLINFO_DATA_IN (Response Body) * 4 = CURLINFO_DATA_OUT (Request Body) * 5 = CURLINFO_SSL_DATA_IN * 6 = CURLINFO_SSL_DATA_OUT * * The debug_data parameter is not null-terminated but is exactly size characters * * The ctx parameter is a solr_curl * pointer */ /* {{{ int solr_curl_debug_callback(CURL *curl_handle, curl_infotype infotype, solr_char_t *debug_data, size_t size, void *ctx) */ int solr_curl_debug_callback(CURL *curl_handle, curl_infotype infotype, solr_char_t *debug_data, size_t size, void *ctx) { solr_curl_t *sch = (solr_curl_t *) ctx; /* TODO : Check why this function is still called after destructor has been called */ if (!sch->handle_status) { return 0; } switch(infotype) { case CURLINFO_HEADER_OUT : /* Capture the Actual Request Headers Sent to Server */ { solr_string_appends(&(sch->request_header.buffer), debug_data, size); } break; case CURLINFO_DATA_OUT : /* Capture the Actual Request Body Sent to Server */ { solr_string_appends(&(sch->request_body_debug.buffer), debug_data, size); } break; default : { /* do nothing */ } break; } /* Captures ALL debug information */ solr_string_appends(&(sch->debug_data_buffer), debug_data, size); return 0; } /* }}} */ PHP_SOLR_API void solr_curl_request_reset(solr_curl_t *sch, solr_client_options_t *options) { /* Reset the buffers */ solr_string_free(&sch->request_header.buffer); solr_string_free(&sch->request_body_debug.buffer); solr_string_free(&sch->response_body.buffer); solr_string_free(&sch->response_header.buffer); solr_string_free(&sch->debug_data_buffer); curl_easy_reset(sch->curl_handle); solr_set_initial_curl_handle_options(&(sch), options); /* Reset the CURL options if the handle is reused */ curl_easy_setopt(sch->curl_handle, CURLOPT_HEADER, 0L); curl_easy_setopt(sch->curl_handle, CURLOPT_POST, 0L); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPGET, 0L); curl_easy_setopt(sch->curl_handle, CURLOPT_NOBODY, 0L); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDSIZE, 0L); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDS, NULL); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, NULL); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, NULL); } PHP_SOLR_API solr_http_header_list_t *solr_curl_init_header_list() { solr_http_header_list_t *header_list = NULL; header_list = curl_slist_append(header_list, "Accept-Charset: utf-8"); header_list = curl_slist_append(header_list, "Keep-Alive: 300"); header_list = curl_slist_append(header_list, "Connection: keep-alive"); /* Disable the Expect: 100-continue header. Jetty gets confused with this header */ header_list = curl_slist_append(header_list, "Expect:"); return header_list; } PHP_SOLR_API int solr_is_request_successful(CURLcode info_status, solr_curl_t *sch) { int return_status = SUCCESS; if (info_status != CURLE_OK) { solr_throw_exception_ex( solr_ce_SolrClientException, SOLR_ERROR_1004, SOLR_FILE_LINE_FUNC, "HTTP Transfer status could not be retrieved successfully" ); return_status = FAILURE; } if (sch->result_code != CURLE_OK) { solr_throw_exception_ex( solr_ce_SolrClientException, SOLR_ERROR_1004, SOLR_FILE_LINE_FUNC, "Solr HTTP Error %d: '%s' ", sch->result_code, curl_easy_strerror(sch->result_code) ); return_status = FAILURE; } if (sch->response_header.response_code != 200L) { return_status = FAILURE; } return return_status; } PHP_SOLR_API int solr_make_update_stream_request(solr_client_t *client, solr_ustream_t* stream_data, solr_string_t *request_params) { solr_curl_t *sch = &(client->handle); solr_client_options_t *options = &(client->options); int return_status = SUCCESS; CURLcode info_status = CURLE_OK; struct curl_httppost *formpost = NULL, *lastptr = NULL; int is_binary = stream_data->content_type == SOLR_EXTRACT_CONTENT_STREAM; solr_string_t content_type_header; solr_http_header_list_t *header_list = solr_curl_init_header_list(); solr_curl_request_reset(sch, options); solr_string_appendc(&(options->extract_url), '&'); solr_string_append_solr_string(&(options->extract_url), request_params); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->extract_url.str); if (is_binary) { solr_string_init(&content_type_header); solr_string_appends(&content_type_header, "Content-Type: ", sizeof("Content-Type: ")-1); solr_string_append_solr_string(&content_type_header, &(stream_data->content_info->stream_info.mime_type)); header_list = curl_slist_append(header_list, content_type_header.str); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDS, stream_data->content_info->stream_info.binary_content.str); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDSIZE, stream_data->content_info->stream_info.binary_content.len); solr_string_free_ex(&content_type_header); } else{ curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "PHPSOLRCLIENT", CURLFORM_FILE, (const char *) stream_data->content_info->filename.str, CURLFORM_END ); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPPOST, formpost); } curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); sch->result_code = curl_easy_perform(sch->curl_handle); info_status = curl_easy_getinfo(sch->curl_handle, CURLINFO_RESPONSE_CODE, &(sch->response_header.response_code)); return_status = solr_is_request_successful(info_status, sch); curl_slist_free_all(header_list); if (!is_binary) { curl_formfree(formpost); } return return_status; } /* {{{ PHP_SOLR_API int solr_make_request(solr_client_t *client, solr_request_type_t request_type) */ PHP_SOLR_API int solr_make_request(solr_client_t *client, solr_request_type_t request_type) { solr_curl_t *sch = &(client->handle); solr_client_options_t *options = &(client->options); solr_http_header_list_t *header_list = NULL; int return_status = SUCCESS; CURLcode info_status = CURLE_OK; solr_curl_request_reset(sch, options); header_list = solr_curl_init_header_list(); switch(request_type) { case SOLR_REQUEST_SEARCH : /* HTTP FORM POST */ { header_list = curl_slist_append(header_list, "Content-Type: application/x-www-form-urlencoded;charset=UTF-8"); curl_easy_setopt(sch->curl_handle, CURLOPT_POST, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->search_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDSIZE, sch->request_body.buffer.len); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDS, sch->request_body.buffer.str); } break; case SOLR_REQUEST_TERMS : /* HTTP FORM POST */ { header_list = curl_slist_append(header_list, "Content-Type: application/x-www-form-urlencoded;charset=UTF-8"); curl_easy_setopt(sch->curl_handle, CURLOPT_POST, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->terms_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDSIZE, sch->request_body.buffer.len); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDS, sch->request_body.buffer.str); } break; case SOLR_REQUEST_UPDATE : /* HTTP XML POST */ { header_list = curl_slist_append(header_list, "Content-Type: text/xml;charset=UTF-8"); curl_easy_setopt(sch->curl_handle, CURLOPT_POST, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->update_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDSIZE, sch->request_body.buffer.len); curl_easy_setopt(sch->curl_handle, CURLOPT_POSTFIELDS, sch->request_body.buffer.str); } break; case SOLR_REQUEST_THREADS : /* HTTP GET */ { curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPGET, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->thread_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); } break; case SOLR_REQUEST_PING : /* HTTP HEAD REQUEST. */ { curl_easy_setopt(sch->curl_handle, CURLOPT_HEADER, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_NOBODY, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->ping_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); } break; case SOLR_REQUEST_SYSTEM: /* HTTP GET to fetch system info */ { curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPGET, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->system_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); } break; case SOLR_REQUEST_GET: solr_string_appendc(&(options->get_url), '&'); solr_string_append_solr_string(&(options->get_url), &(sch->request_body.buffer)); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPGET, 1L); curl_easy_setopt(sch->curl_handle, CURLOPT_URL, options->get_url.str); curl_easy_setopt(sch->curl_handle, CURLOPT_HTTPHEADER, header_list); break; default : { return_status = FAILURE; } break; } sch->result_code = curl_easy_perform(sch->curl_handle); info_status = curl_easy_getinfo(sch->curl_handle, CURLINFO_RESPONSE_CODE, &(sch->response_header.response_code)); return_status = solr_is_request_successful(info_status, sch); curl_slist_free_all(header_list); return return_status; } /* }}} */ /** Deallocates memory associated with the Solr CURL Handle. **/ /* {{{ PHP_SOLR_API void solr_free_handle(solr_curl_t *sch) */ PHP_SOLR_API void solr_free_handle(solr_curl_t *sch) { solr_string_free(&((sch)->request_header.buffer)); solr_string_free(&((sch)->request_body.buffer)); solr_string_free(&((sch)->request_body_debug.buffer)); solr_string_free(&((sch)->response_header.buffer)); solr_string_free(&((sch)->response_body.buffer)); solr_string_free(&((sch)->debug_data_buffer)); sch->handle_status = 0; curl_easy_cleanup((sch)->curl_handle); sch->curl_handle = NULL; } /* }}} */ /* {{{ PHP_SOLR_API void solr_free_options(solr_client_options_t *options) */ PHP_SOLR_API void solr_free_options(solr_client_options_t *options) { solr_string_free(&((options)->hostname)); solr_string_free(&((options)->http_auth_credentials)); solr_string_free(&((options)->path)); solr_string_free(&((options)->proxy_auth_credentials)); solr_string_free(&((options)->ssl_cert)); solr_string_free(&((options)->ssl_key)); solr_string_free(&((options)->ssl_keypassword)); solr_string_free(&((options)->ssl_cainfo)); solr_string_free(&((options)->ssl_capath)); solr_string_free(&((options)->proxy_hostname)); solr_string_free(&((options)->qs_delimiter)); solr_string_free(&((options)->response_writer)); solr_string_free(&((options)->update_url)); solr_string_free(&((options)->search_url)); solr_string_free(&((options)->thread_url)); solr_string_free(&((options)->ping_url)); solr_string_free(&((options)->terms_url)); solr_string_free(&((options)->system_url)); solr_string_free(&((options)->get_url)); solr_string_free(&((options)->extract_url)); solr_string_free(&((options)->update_servlet)); solr_string_free(&((options)->search_servlet)); solr_string_free(&((options)->thread_servlet)); solr_string_free(&((options)->ping_servlet)); solr_string_free(&((options)->terms_servlet)); solr_string_free(&((options)->system_servlet)); solr_string_free(&((options)->get_servlet)); solr_string_free(&((options)->extract_servlet)); } /* }}} */ /* {{{ PHP_SOLR_API void solr_destroy_client(void *client) */ PHP_SOLR_API void solr_destroy_client(zval *client) { solr_client_t *solr_client = (solr_client_t *) Z_PTR_P(client); if (solr_client) { solr_free_options(&(solr_client->options)); solr_free_handle(&(solr_client->handle)); pefree(solr_client, SOLR_CLIENT_PERSISTENT); solr_client = NULL; } } /* }}} */ /* {{{ PHP_SOLR_API int solr_get_xml_error(solr_string_t buffer, solr_exception_t *exceptionData) */ PHP_SOLR_API int solr_get_xml_error(solr_string_t buffer, solr_exception_t *exceptionData) { xmlDoc *doc = xmlReadMemory((const char *)buffer.str, buffer.len, NULL, "UTF-8", XML_PARSE_RECOVER); xmlXPathContext *xpathContext = NULL; xmlXPathObject *xpathObject = NULL; xmlChar *xpathExpression = (unsigned char *)"/response/lst[@name='error']"; xmlNode * nodeCurser; const unsigned char * nodePropName = (const unsigned char *)"name"; if (!doc) { php_error_docref(NULL, E_WARNING, "Error loading XML document"); return 1; } /* Create xpath evaluation context */ xpathContext = xmlXPathNewContext(doc); if(xpathContext == NULL) { php_error_docref(NULL, E_WARNING, "Error creating xml xpath context"); xmlFreeDoc(doc); return 1; } /* Evaluate xpath expression */ xpathObject = xmlXPathEvalExpression(xpathExpression, xpathContext); if(xpathObject == NULL){ php_error_docref(NULL, E_WARNING, "Error evaluating xml xpath expression"); xmlFreeDoc(doc); return 1; } if(!xpathObject->nodesetval){ php_error_docref(NULL, E_WARNING, "Xpath Error: no elements found"); xmlXPathFreeObject(xpathObject); xmlFreeDoc(doc); return 1; } nodeCurser = xpathObject->nodesetval->nodeTab[0]->children; while (nodeCurser != NULL) { if (xmlHasProp(nodeCurser, nodePropName)) { if (strcmp((const char *)xmlGetProp(nodeCurser,nodePropName), (const char *)"msg") == 0) { exceptionData->message = (solr_char_t *)estrdup((const char *)nodeCurser->children->content); } else if(strcmp((const char *)xmlGetProp(nodeCurser,nodePropName),"code") == 0) { exceptionData->code = atoi((const char *)nodeCurser->children->content); } else if(strcmp( (const char *)xmlGetProp(nodeCurser, nodePropName), (const char *) "trace") == 0) { exceptionData->message = (solr_char_t *)estrdup((const char *)nodeCurser->children->content); } } nodeCurser = nodeCurser->next; } xmlXPathFreeObject(xpathObject); xmlXPathFreeContext(xpathContext); xmlFreeDoc(doc); return 0; } /* }}} */ /* {{{ PHP_SOLR_API int hydrate_error_zval(zval *response, solr_exception_t *exceptionData) */ PHP_SOLR_API int hydrate_error_zval(zval *response, solr_exception_t *exceptionData) { zval *error_p; zval *msg_zv_p=(zval *) NULL, *code_zv_p = (zval *) NULL; zend_string *msg_key_str = zend_string_init("msg", sizeof("msg")-1, 1); zend_string *code_key_str = zend_string_init("code", sizeof("code")-1, 1); zend_string *error_key_str = zend_string_init("error", sizeof("error")-1, 1); zend_string *trace_key_str = zend_string_init("trace", sizeof("trace")-1, 1); int return_code = 0; if ( (error_p = zend_hash_find( Z_ARRVAL_P(response), error_key_str)) != NULL) { if (zend_hash_exists(HASH_OF(error_p), msg_key_str)) { if ((msg_zv_p = zend_hash_find(Z_ARRVAL_P(error_p), msg_key_str)) != NULL) { exceptionData->message = (solr_char_t *)estrdup(Z_STRVAL(*msg_zv_p)); } else { php_error_docref(NULL, E_NOTICE, "Undefined variable: %s", "msg"); return_code = 1; goto solr_error_func_return_end; } } else if (zend_hash_exists(HASH_OF(error_p), trace_key_str)) { if ((msg_zv_p = zend_hash_find(Z_ARRVAL_P(error_p), trace_key_str)) != NULL) { exceptionData->message = (solr_char_t *)estrdup(Z_STRVAL(*msg_zv_p)); } else { php_error_docref(NULL, E_NOTICE, "Undefined variable: %s", "trace"); return_code = 1; goto solr_error_func_return_end; } } else{ php_error_docref(NULL, E_NOTICE, "Unable to find %s in error response zval", "message or trace" ); return_code = 1; goto solr_error_func_return_end; } if ((code_zv_p = zend_hash_find(Z_ARRVAL_P(error_p), code_key_str)) != NULL) { exceptionData->code = (int)Z_LVAL_P(code_zv_p); } else { php_error_docref(NULL, E_NOTICE, "Unable to find element with key %s in error response zval","code" ); return_code = 1; goto solr_error_func_return_end; } } else { php_error_docref(NULL, E_NOTICE, "Unable to find %s in error response", "error element" ); return_code = 1; goto solr_error_func_return_end; } solr_error_func_return_end: zend_string_release(msg_key_str); zend_string_release(code_key_str); zend_string_release(error_key_str); zend_string_release(trace_key_str); return return_code; } /* }}} */ /* {{{ PHP_SOLR_API int solr_get_json_error(solr_string_t buffer, solr_exception_t *exceptionData) */ PHP_SOLR_API int solr_get_json_error(solr_string_t buffer, solr_exception_t *exceptionData) { zval json_response; zval *error_p; zval *msg_zv_p=(zval *)NULL,*code_zv_p=(zval *)NULL; HashTable *errorHashTable; char * key = "error"; long nSize = 1000; int return_code = 0; zend_string *msg_key_str = zend_string_init("msg", sizeof("msg")-1, 1); zend_string *code_key_str = zend_string_init("code", sizeof("code")-1, 1); zend_string *error_key_str = zend_string_init("error", sizeof("error")-1, 1); zend_string *trace_key_str = zend_string_init("trace", sizeof("trace")-1, 1); php_json_decode(&json_response, (char *) buffer.str, buffer.len, 1, 1024L); if (Z_TYPE(json_response) == IS_NULL) { zval_ptr_dtor(&json_response); php_error_docref(NULL, E_WARNING, "Unable to parse Solr Server Error Response. JSON serialization error"); return 1; } ALLOC_HASHTABLE(errorHashTable); zend_hash_init(errorHashTable, nSize, NULL, NULL, 0); if ( (error_p = zend_hash_find( Z_ARRVAL(json_response), error_key_str)) != NULL) { if ((code_zv_p = zend_hash_find(Z_ARRVAL_P(error_p), code_key_str)) != NULL) { exceptionData->code = (int)Z_LVAL_P(code_zv_p); } else { php_error_docref(NULL, E_NOTICE, "Unable to find %s in json error response","code" ); } if (zend_hash_exists(HASH_OF(error_p), msg_key_str)) { if ((msg_zv_p = zend_hash_find(Z_ARRVAL_P(error_p), msg_key_str)) != NULL) { exceptionData->message = (solr_char_t *)estrdup(Z_STRVAL_P(msg_zv_p)); } } else if (!exceptionData->message && zend_hash_exists(HASH_OF(error_p), trace_key_str)) { if ((msg_zv_p = zend_hash_find(Z_ARRVAL_P(error_p), trace_key_str)) != NULL) { exceptionData->message = (solr_char_t *)estrdup(Z_STRVAL_P(msg_zv_p)); } else { php_error_docref(NULL, E_NOTICE, "Undefined variable: %s","trace" ); } } else { php_error_docref(NULL, E_NOTICE, "Unable to find %s in error response zval","message" ); return_code = 1; goto solr_error_func_return_end; } }else{ php_error_docref(NULL, E_NOTICE, "Undefined variable: %s",key ); } solr_error_func_return_end: zend_string_release(msg_key_str); zend_string_release(code_key_str); zend_string_release(error_key_str); zend_string_release(trace_key_str); zval_ptr_dtor(&json_response); zend_hash_destroy(errorHashTable); FREE_HASHTABLE(errorHashTable); return return_code; } /* }}} */ /* {{{ PHP_SOLR_API int solr_get_phpnative_error(solr_string_t buffer, solr_exception_t *exceptionData) */ PHP_SOLR_API int solr_get_phpnative_error(solr_string_t buffer, solr_exception_t *exceptionData) { zval *response_obj; php_unserialize_data_t var_hash; const unsigned char * raw_resp = (const unsigned char *) buffer.str; const unsigned char * str_end = (const unsigned char *) (buffer.str + buffer.len); ALLOC_INIT_ZVAL(response_obj); PHP_VAR_UNSERIALIZE_INIT(var_hash); if(!php_var_unserialize(response_obj, &raw_resp, str_end, &var_hash)) { /* There is a known issue, that solr responses will not always be * with the dictated response format, as jetty or tomcat may return errors in their format */ PHP_VAR_UNSERIALIZE_DESTROY(var_hash); zval_ptr_dtor(response_obj); #ifdef PHP_7 efree(response_obj); #endif return 1; } hydrate_error_zval(response_obj, exceptionData); PHP_VAR_UNSERIALIZE_DESTROY(var_hash); zval_ptr_dtor(response_obj); #ifdef PHP_7 efree(response_obj); #endif return 0; } /* }}} */ /* {{{ PHP_SOLR_API void solr_throw_solr_server_exception(solr_client_t *client,const char * requestType) parse the solr server response and throw a SolrServerException */ PHP_SOLR_API void solr_throw_solr_server_exception(solr_client_t *client,const char * requestType) { const char * response_writer = (char *) client->options.response_writer.str; solr_exception_t *exceptionData; exceptionData = (solr_exception_t*) emalloc(sizeof(solr_exception_t )); exceptionData->code = 0; memset(exceptionData, 0, sizeof(solr_exception_t)); if( 0 == strcmp(response_writer, SOLR_XML_RESPONSE_WRITER)){ if(solr_get_xml_error(client->handle.response_body.buffer, exceptionData) != SUCCESS) { /* fallback to normal exception */ solr_throw_exception_ex(solr_ce_SolrClientException, SOLR_ERROR_1010, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1010_MSG, requestType, SOLR_RESPONSE_CODE_BODY); return; } } if( 0 == strcmp(response_writer, SOLR_JSON_RESPONSE_WRITER)) { if(solr_get_json_error(client->handle.response_body.buffer, exceptionData) != SUCCESS) { solr_throw_exception_ex(solr_ce_SolrClientException, SOLR_ERROR_1010, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1010_MSG, requestType, SOLR_RESPONSE_CODE_BODY); } } if( 0 == strcmp(response_writer, SOLR_PHP_NATIVE_RESPONSE_WRITER) || 0 == strcmp(response_writer, SOLR_PHP_SERIALIZED_RESPONSE_WRITER)) { if(solr_get_phpnative_error(client->handle.response_body.buffer,exceptionData) != SUCCESS) { php_error_docref(NULL, E_NOTICE, "Unable to parse serialized php response" ); } } if(exceptionData->code == 0){ solr_throw_exception_ex(solr_ce_SolrClientException, SOLR_ERROR_1010, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1010_MSG, requestType, SOLR_RESPONSE_CODE_BODY); }else if (exceptionData->code > 0 && exceptionData->message){ solr_throw_exception_ex(solr_ce_SolrServerException, exceptionData->code, SOLR_FILE_LINE_FUNC, exceptionData->message); } else { php_error_docref(NULL, E_ERROR, "Unable to parse solr exception message, Internal Error" ); } if(exceptionData->message != NULL) { efree(exceptionData->message); } efree(exceptionData); } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/solr_functions_debug.c000066400000000000000000000106201374041537100233720ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Omar Shaban | | Israel Ekpo | +----------------------------------------------------------------------+ */ #include "php_solr.h" /* {{{ void solr_debug_printf(const char *format, ...) */ PHP_SOLR_API void solr_debug_printf(const char *format, ...) { #ifdef SOLR_DEBUG va_list args; va_start(args,format); vprintf(format,args); va_end(args); #endif } /* }}} */ /* {{{ void solr_debug_print_fields(const solr_field_list_t *field_list) */ PHP_SOLR_API void solr_debug_print_fields(const solr_field_list_t *field_list) { /* Used to debug field inserted */ } /* }}} */ /** * print_xpath_nodes: * @nodes: the nodes set. * @output: the output file handle. * * Prints the @nodes content to @output. */ /* {{{ void print_xpath_nodes(xmlNodeSetPtr nodes, FILE* output) */ PHP_SOLR_API void print_xpath_nodes(xmlNodeSetPtr nodes, FILE* output) { xmlNodePtr cur; int size; int i; assert(output); size = (nodes) ? nodes->nodeNr : 0; fprintf(output, "Result (%d nodes):\n", size); for(i = 0; i < size; ++i) { assert(nodes->nodeTab[i]); if(nodes->nodeTab[i]->type == XML_NAMESPACE_DECL) { xmlNsPtr ns; ns = (xmlNsPtr)nodes->nodeTab[i]; cur = (xmlNodePtr)ns->next; if(cur->ns) { fprintf(output, "= namespace \"%s\"=\"%s\" for node %s:%s\n", ns->prefix, ns->href, cur->ns->href, cur->name); } else { fprintf(output, "= namespace \"%s\"=\"%s\" for node %s\n", ns->prefix, ns->href, cur->name); } } else if(nodes->nodeTab[i]->type == XML_ELEMENT_NODE) { cur = nodes->nodeTab[i]; if(cur->ns) { fprintf(output, "= element node \"%s:%s\"\n", cur->ns->href, cur->name); } else { fprintf(output, "= element node \"%s\"\n", cur->name); } } else { cur = nodes->nodeTab[i]; fprintf(output, "= node \"%s\": type %d\n", cur->name, cur->type); } } } /* }}} */ /* {{{ void print_children (xmlNode * node) */ PHP_SOLR_API void print_children (xmlNode * node) { fprintf(stdout,"\n================- start print children -=================\n"); while (node != NULL) { if(node->ns) { fprintf(stdout, "= element node \"%s:%s\"\n", node->ns->href,node->name); } else { fprintf(stdout, "= element node \"%s\"\n", node->name); } if(node->type == XML_ELEMENT_NODE){ xmlNode * cur2 = node->children; while (cur2 != NULL) { if(strcmp((const char *)cur2->name,"text")==0) { fprintf(stdout, "= element node \"%s\", text: %s\n",cur2->name,cur2->content); }else{ fprintf(stdout, "= element node \"%s\"\n", cur2->name); } cur2 = cur2->next; } } if(node->children != NULL) { print_children(node->children); } node = node->next; } fprintf(stdout,"\n======================- end -=====================\n"); } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/solr_functions_document.c000066400000000000000000000452411374041537100241310ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Israel Ekpo | +----------------------------------------------------------------------+ */ #include "php_solr.h" #if PHP_VERSION_ID < 80000 PHP_SOLR_API zend_object *solr_document_object_handler_clone(zval *zobject) { zend_object *old_object = Z_OBJ_P(zobject); #else PHP_SOLR_API zend_object *solr_document_object_handler_clone(zend_object *old_object) { #endif zend_object *new_object; solr_document_t *doc_entry, *old_doc_entry; long document_index = SOLR_UNIQUE_DOCUMENT_INDEX(); new_object = zend_objects_new(old_object->ce); object_properties_init(new_object, old_object->ce); zend_objects_clone_members(new_object, old_object); #if PHP_VERSION_ID < 80000 if (solr_fetch_document_entry(zobject, &old_doc_entry) == FAILURE) { #else if (solr_fetch_document_entry(old_object, &old_doc_entry) == FAILURE) { #endif php_error_docref(NULL, E_ERROR, "Clone Failed: Unable to fetch document entry of the source document"); } doc_entry = solr_init_document(document_index); ZVAL_LONG(&(new_object->properties_table[0]), document_index); /* Add the document entry to the directory of documents */ doc_entry->field_count = old_doc_entry->field_count; doc_entry->document_boost = old_doc_entry->document_boost; zend_hash_copy(doc_entry->fields, old_doc_entry->fields, (copy_ctor_func_t) field_copy_constructor); zend_hash_copy(doc_entry->children, old_doc_entry->children, (copy_ctor_func_t) zval_add_ref); return new_object; } PHP_SOLR_API void field_copy_constructor_ex(solr_field_list_t **original_field_queue_ptr) { solr_field_list_t *original_field_queue = *original_field_queue_ptr; solr_field_value_t *ptr = original_field_queue->head; if (ptr == NULL) { return; } solr_field_list_t *new_field_queue = (solr_field_list_t *) pemalloc(sizeof(solr_field_list_t), SOLR_DOCUMENT_FIELD_PERSISTENT); new_field_queue->count = 0L; new_field_queue->field_name = (solr_char_t *) pestrdup((char *) (original_field_queue)->field_name, SOLR_DOCUMENT_FIELD_PERSISTENT); new_field_queue->head = NULL; new_field_queue->last = NULL; new_field_queue->field_boost = original_field_queue->field_boost; while(ptr != NULL) { if (solr_document_insert_field_value(new_field_queue, ptr->field_value, 0.0) == FAILURE) { php_error_docref(NULL, E_ERROR, "Unable to insert field value"); } ptr = ptr->next; } *original_field_queue_ptr = new_field_queue; } /* {{{ void field_copy_constructor_zv(zval *field_queue_zv) */ PHP_SOLR_API void field_copy_constructor_zv(zval *field_queue_zv) { solr_field_list_t *original_field_queue = NULL; original_field_queue = Z_PTR_P(field_queue_zv); field_copy_constructor_ex(&original_field_queue); ZVAL_PTR(field_queue_zv, original_field_queue); } /* }}} */ /* {{{ PHP_SOLR_API int solr_document_insert_field_value(solr_field_list_t *queue, const solr_char_t *field_value, double field_boost, int modifier) */ PHP_SOLR_API int solr_document_insert_field_value_ex(solr_field_list_t *queue, const solr_char_t *field_value, double field_boost, int modifier) { solr_field_value_t *new_entry = (solr_field_value_t *) pemalloc(sizeof(solr_field_value_t), SOLR_DOCUMENT_FIELD_PERSISTENT); if (new_entry == NULL) { return FAILURE; } new_entry->field_value = (solr_char_t *) pestrdup((char *) field_value, SOLR_DOCUMENT_FIELD_PERSISTENT); if (new_entry->field_value == NULL) { return FAILURE; } new_entry->next = NULL; new_entry->modifier = modifier; if (queue->head == NULL) { /* This is the first and only item in the field list */ queue->head = new_entry; queue->last = new_entry; /* Update the field boost value */ if (field_boost > 0.0) { queue->field_boost = field_boost; } } else { /* There are already entries in the list. */ /* Append to the end of the queue */ queue->last->next = new_entry; /* Set the last item in the queue to the latest entry */ queue->last = new_entry; /* Update the field boost value */ if (field_boost > 0.0) { if (queue->field_boost > 0.0) { queue->field_boost *= field_boost; } else { queue->field_boost = field_boost; } } } queue->count++; return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API solr_document_t *solr_init_document(long int document_index) * create and allocate a solr_document_t with the specified index */ PHP_SOLR_API solr_document_t *solr_init_document(long int document_index) { uint32_t nSize = SOLR_INITIAL_HASH_TABLE_SIZE; solr_document_t *doc_ptr = NULL; solr_document_t *doc_entry; #ifdef PHP_7 doc_entry = pemalloc(sizeof(solr_document_t), SOLR_DOCUMENT_PERSISTENT); #endif doc_entry->document_index = document_index; doc_entry->field_count = 0L; doc_entry->document_boost = 0.0f; /* Allocated memory for the fields HashTable using fast cache for HashTables */ ALLOC_HASHTABLE(doc_entry->fields); ALLOC_HASHTABLE(doc_entry->children); /* Initializing the hash table used for storing fields in this SolrDocument */ zend_hash_init(doc_entry->fields, nSize, NULL, (dtor_func_t) solr_destroy_field_list_ht_dtor, SOLR_DOCUMENT_FIELD_PERSISTENT); zend_hash_init(doc_entry->children, nSize, NULL, ZVAL_PTR_DTOR, SOLR_DOCUMENT_FIELD_PERSISTENT); /* Let's check one more time before insert into the HashTable */ if (zend_hash_index_exists(SOLR_GLOBAL(documents), document_index)) { /* todo call dtor ? */ pefree(doc_entry->fields, SOLR_DOCUMENT_FIELD_PERSISTENT); pefree(doc_entry->children, SOLR_DOCUMENT_FIELD_PERSISTENT); return NULL; } /* Add the document entry to the directory of documents */ doc_ptr = zend_hash_index_update_ptr(SOLR_GLOBAL(documents), document_index, (void *) doc_entry); /* Keep track of how many SolrDocument instances we currently have */ SOLR_GLOBAL(document_count)++; return doc_ptr; } /* }}} */ /* {{{ PHP_SOLR_API solr_document_t *solr_input_doc_ctor(zval *objptr) * constructor populate/allocate the new document after object instantiation * and allocates hashtables for fields and children */ PHP_SOLR_API solr_document_t *solr_input_doc_ctor(zval *objptr) { zend_ulong document_index = SOLR_UNIQUE_DOCUMENT_INDEX(); solr_document_t *solr_doc = NULL; if ((solr_doc = solr_init_document(document_index)) == NULL) { return NULL; } /* Set the value of the internal id property */ zend_update_property_long(solr_ce_SolrInputDocument, OBJ_FOR_PROP(objptr), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, document_index); /* Overriding the default object handlers */ Z_OBJ_HT_P(objptr) = &solr_input_document_object_handlers; return solr_doc; } /* }}} */ /* {{{ PHP_SOLR_API void solr_destroy_document_zv(zval *document) * destory a solr_document within a zval (ZE 3) */ PHP_SOLR_API void solr_destroy_document_zv(zval *document) { solr_document_t *doc_entry = (solr_document_t *) Z_PTR_P(document); solr_destroy_document_ex(doc_entry); pefree(doc_entry, SOLR_DOCUMENT_PERSISTENT); } /* }}} */ /* {{{ void solr_destroy_document(void *document) * destory a solr_document_t */ PHP_SOLR_API void solr_destroy_document_ex(solr_document_t *doc_entry) { /* Release all the field_lists one at a time with solr_destroy_field_list */ zend_hash_destroy(doc_entry->fields); /* Deallocate memory for the fields HashTable */ pefree(doc_entry->fields, SOLR_DOCUMENT_FIELD_PERSISTENT); if (doc_entry->children) { zend_hash_destroy(doc_entry->children); pefree(doc_entry->children, SOLR_DOCUMENT_FIELD_PERSISTENT); } } /* }}} */ PHP_SOLR_API void solr_destroy_field_list_ht_dtor(zval *zv_field_entry) { solr_field_list_t *field_entry = Z_PTR_P(zv_field_entry); solr_destroy_field_list(field_entry); } /* {{{ void solr_destroy_field_list(solr_field_list_t **field_entry_ptr) */ PHP_SOLR_API void solr_destroy_field_list(solr_field_list_t *field_entry) { solr_field_value_t *tmp = NULL; solr_field_value_t *current_field_value = field_entry->head; /* Go through the list and free all the values */ while(current_field_value != NULL) { tmp = current_field_value->next; pefree(current_field_value->field_value, SOLR_DOCUMENT_FIELD_PERSISTENT); pefree(current_field_value, SOLR_DOCUMENT_FIELD_PERSISTENT); current_field_value = tmp; } field_entry->head = NULL; field_entry->last = NULL; pefree(field_entry->field_name, SOLR_DOCUMENT_FIELD_PERSISTENT); pefree(field_entry, SOLR_DOCUMENT_FIELD_PERSISTENT); } /* }}} */ /* Comparison functions for field entries */ /* {{{ int solr_compare_field_name(const void *a, const void *b) */ #if PHP_VERSION_ID < 80000 PHP_SOLR_API int solr_compare_field_name(const void *a, const void *b) { const Bucket *x = (Bucket *) a; const Bucket *y = (Bucket *) b; #else PHP_SOLR_API int solr_compare_field_name(Bucket *x, Bucket *y) { #endif const solr_field_list_t *first = (solr_field_list_t *) Z_PTR(x->val); const solr_field_list_t *second = (solr_field_list_t *) Z_PTR(y->val); const int diff = strcmp((char *) first->field_name, (char *) second->field_name); const int result = ((diff > 0) ? 1 : ((diff < 0) ? -1 : 0)); return result; } /* }}} */ /* {{{ int solr_rcompare_field_name(const void *a, const void *b) */ #if PHP_VERSION_ID < 80000 PHP_SOLR_API int solr_rcompare_field_name(const void *a, const void *b) #else PHP_SOLR_API int solr_rcompare_field_name(Bucket *a, Bucket *b) #endif { return (solr_compare_field_name(a, b) * -1); } /* }}} */ /* {{{ int solr_compare_field_value_count(const void *a, const void *b) */ #if PHP_VERSION_ID < 80000 PHP_SOLR_API int solr_compare_field_value_count(const void *a, const void *b) { const Bucket *x = (Bucket *) a; const Bucket *y = (Bucket *) b; #else PHP_SOLR_API int solr_compare_field_value_count(Bucket *x, Bucket *y) { #endif const solr_field_list_t *first = (solr_field_list_t *) Z_PTR(x->val); const solr_field_list_t *second = (solr_field_list_t *) Z_PTR(y->val); const int diff = first->count - second->count; const int result = ((diff > 0) ? 1 : ((diff < 0) ? -1 : 0)); return result; } /* }}} */ /* {{{ int solr_rcompare_field_value_count(const void *a, const void *b) */ #if PHP_VERSION_ID < 80000 PHP_SOLR_API int solr_rcompare_field_value_count(const void *a, const void *b) #else PHP_SOLR_API int solr_rcompare_field_value_count(Bucket *a, Bucket *b) #endif { return (solr_compare_field_value_count(a, b) * -1); } /* }}} */ /* {{{ int solr_compare_field_boost_value(const void *a, const void *b) */ #if PHP_VERSION_ID < 80000 PHP_SOLR_API int solr_compare_field_boost_value(const void *a, const void *b) { const Bucket *x = (Bucket *) a; const Bucket *y = (Bucket *) b; #else PHP_SOLR_API int solr_compare_field_boost_value(Bucket *x, Bucket *y) { #endif const solr_field_list_t *first = (solr_field_list_t *) Z_PTR(x->val); const solr_field_list_t *second = (solr_field_list_t *) Z_PTR(y->val); const double diff = first->field_boost - second->field_boost; const int result = ((diff > 0.0) ? 1 : ((diff < 0.0) ? -1 : 0)); return result; } /* }}} */ /* {{{ int solr_rcompare_field_boost_value(const void *a, const void *b) */ #if PHP_VERSION_ID < 80000 PHP_SOLR_API int solr_rcompare_field_boost_value(const void *a, const void *b) #else PHP_SOLR_API int solr_rcompare_field_boost_value(Bucket *a, Bucket *b) #endif { return (solr_compare_field_boost_value(a, b) * -1); } /* }}} */ /* {{{ PHP_SOLR_API void solr_create_document_field_object(solr_field_list_t *field_values, zval **field_obj) */ PHP_SOLR_API void solr_create_document_field_object(solr_field_list_t *field_values, zval **field_obj) { zval *doc_field = *field_obj; solr_field_value_t *curr_ptr = NULL; zval field_values_array_tmp; zval *field_values_array = &field_values_array_tmp; array_init(field_values_array); curr_ptr = field_values->head; while(curr_ptr != NULL) { solr_char_t *current_value = curr_ptr->field_value; add_next_index_string(field_values_array, current_value); curr_ptr = curr_ptr->next; } object_init_ex(doc_field, solr_ce_SolrDocumentField); zend_update_property_string(solr_ce_SolrDocumentField, OBJ_FOR_PROP(doc_field), SOLR_FIELD_NAME_PROPERTY_NAME, sizeof(SOLR_FIELD_NAME_PROPERTY_NAME)-1, field_values->field_name); zend_update_property_double(solr_ce_SolrDocumentField, OBJ_FOR_PROP(doc_field), SOLR_FIELD_BOOST_PROPERTY_NAME, sizeof(SOLR_FIELD_BOOST_PROPERTY_NAME)-1, field_values->field_boost); zend_update_property(solr_ce_SolrDocumentField, OBJ_FOR_PROP(doc_field), SOLR_FIELD_VALUES_PROPERTY_NAME, sizeof(SOLR_FIELD_VALUES_PROPERTY_NAME)-1, field_values_array); zval_ptr_dtor(field_values_array); Z_OBJ_HT_P(doc_field) = &solr_document_field_handlers; } /* }}} */ /* {{{ PHP_SOLR_API void solr_create_document_field_object(solr_field_list_t *field_values, zval **field_obj) constructs the element when adding a document to the index */ PHP_SOLR_API void solr_add_doc_node(xmlNode *root_node, solr_document_t *doc_entry) { HashTable *document_fields = NULL; xmlNode *solr_doc_node = NULL; document_fields = doc_entry->fields; solr_doc_node = xmlNewChild(root_node, NULL, (xmlChar *) "doc", NULL); if (doc_entry->document_boost > 0.0f) { auto char tmp_buffer[256]; /* Scratch pad for converting numeric values to strings */ memset(tmp_buffer, 0, sizeof(tmp_buffer)); php_gcvt(doc_entry->document_boost, EG(precision), '.', 'e' , tmp_buffer); xmlNewProp(solr_doc_node, (xmlChar *) "boost", (xmlChar *) tmp_buffer); } solr_generate_document_xml_from_fields(solr_doc_node, document_fields); if (zend_hash_num_elements(doc_entry->children) > 0) { SOLR_HASHTABLE_FOR_LOOP(doc_entry->children) { zval *doc_obj = NULL; solr_document_t *child_doc_entry = NULL; doc_obj = zend_hash_get_current_data(doc_entry->children); if (solr_fetch_document_entry(OBJ_FOR_PROP(doc_obj), &child_doc_entry) == SUCCESS) { solr_add_doc_node(solr_doc_node, child_doc_entry); } } } } /* }}} */ /* {{{ static void solr_generate_document_xml_from_fields(xmlNode *solr_doc_node, HashTable *document_fields) */ PHP_SOLR_API void solr_generate_document_xml_from_fields(xmlNode *solr_doc_node, HashTable *document_fields) { xmlDoc *doc_ptr = solr_doc_node->doc; solr_char_t *doc_field_name; zend_string *field_str = NULL; solr_field_value_t *doc_field_value; solr_field_list_t *field = NULL; zend_ulong num_idx = 0L; ZEND_HASH_FOREACH_KEY_PTR(document_fields, num_idx, field_str, field) { (void)num_idx; zend_bool is_first_value = 1; /* Turn on first value flag */ xmlChar *modifier_string = NULL; doc_field_name = field_str->val; doc_field_value = field->head; /* Loop through all the values for this field */ while(doc_field_value != NULL) { xmlChar *escaped_field_value = xmlEncodeEntitiesReentrant(doc_ptr, (xmlChar *) doc_field_value->field_value); xmlNode *solr_field_node = xmlNewChild(solr_doc_node, NULL, (xmlChar *) "field", escaped_field_value); xmlNewProp(solr_field_node, (xmlChar *) "name", (xmlChar *) doc_field_name); if (field->modified) { switch (doc_field_value->modifier) { case SOLR_FIELD_VALUE_MOD_ADD: modifier_string = (xmlChar *)"add"; break; case SOLR_FIELD_VALUE_MOD_REMOVE: modifier_string = (xmlChar *)"remove"; break; case SOLR_FIELD_VALUE_MOD_REMOVEREGEX: modifier_string = (xmlChar *)"removeregex"; break; case SOLR_FIELD_VALUE_MOD_SET: modifier_string = (xmlChar *)"set"; break; case SOLR_FIELD_VALUE_MOD_INC: modifier_string = (xmlChar *)"inc"; break; case SOLR_FIELD_VALUE_MOD_NONE:default: break; } if (modifier_string) { xmlNewProp(solr_field_node, (xmlChar *) "update", modifier_string); } } /* Set the boost attribute if this is the first value */ if (is_first_value && field->field_boost > 0.0f) { auto char tmp_boost_value_buffer[256]; memset(tmp_boost_value_buffer, 0, sizeof(tmp_boost_value_buffer)); php_gcvt(field->field_boost, EG(precision), '.', 'e' , tmp_boost_value_buffer); xmlNewProp(solr_field_node, (xmlChar *) "boost", (xmlChar *) tmp_boost_value_buffer); is_first_value = 0; /* Turn off the flag */ } /* Release the memory allocated by xmlEncodeEntitiesReentrant */ xmlFree(escaped_field_value); /* Grab the next value for this field if any */ doc_field_value = doc_field_value->next; } /* while(doc_field_value != NULL) */ } ZEND_HASH_FOREACH_END(); /* end fields loop */ } /* }}} */ PHP_SOLR_API void solr_document_get_field_names(INTERNAL_FUNCTION_PARAMETERS) { solr_document_t *doc_entry = NULL; /* Retrieve the document entry for the SolrDocument instance */ if (solr_fetch_document_entry(OBJ_FOR_PROP(getThis()), &doc_entry) == SUCCESS) { HashTable *fields_ht = doc_entry->fields; array_init(return_value); SOLR_HASHTABLE_FOR_LOOP(fields_ht) { solr_field_list_t *field = NULL; field = zend_hash_get_current_data_ptr(fields_ht); add_next_index_string(return_value, (char *) field->field_name); } return; } RETURN_FALSE; } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/solr_functions_helpers.c000066400000000000000000001576461374041537100237720ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_solr.h" ZEND_EXTERN_MODULE_GLOBALS(json) /** ************************************************************************ **/ /** FUNCTIONS FOR DECLARING CONSTANTS **/ /** ************************************************************************ **/ /* {{{ void solr_extension_register_constants(int type, int module_number) */ PHP_SOLR_API void solr_extension_register_constants(int type, int module_number) { REGISTER_LONG_CONSTANT("SOLR_MAJOR_VERSION", PHP_SOLR_MAJOR_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SOLR_MINOR_VERSION", PHP_SOLR_MINOR_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SOLR_PATCH_VERSION", PHP_SOLR_PATCH_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("SOLR_EXTENSION_VERSION", PHP_SOLR_DOTTED_VERSION, CONST_CS | CONST_PERSISTENT); } /* }}} */ /* {{{ void solr_document_register_class_constants(zend_class_entry * ce) */ PHP_SOLR_API void solr_document_register_class_constants(zend_class_entry *ce) { zend_declare_class_constant_long(ce, "SORT_DEFAULT", sizeof("SORT_DEFAULT")-1, SOLR_SORT_ASC); zend_declare_class_constant_long(ce, "SORT_ASC", sizeof("SORT_ASC")-1, SOLR_SORT_ASC); zend_declare_class_constant_long(ce, "SORT_DESC", sizeof("SORT_DESC")-1, SOLR_SORT_DESC); zend_declare_class_constant_long(ce, "SORT_FIELD_NAME", sizeof("SORT_FIELD_NAME")-1, SOLR_SORT_FIELD_NAME); zend_declare_class_constant_long(ce, "SORT_FIELD_VALUE_COUNT", sizeof("SORT_FIELD_VALUE_COUNT")-1, SOLR_SORT_FIELD_VALUE_COUNT); zend_declare_class_constant_long(ce, "SORT_FIELD_BOOST_VALUE", sizeof("SORT_FIELD_BOOST_VALUE")-1, SOLR_SORT_FIELD_BOOST_VALUE); } /* }}} */ PHP_SOLR_API void solr_input_document_register_class_constants(zend_class_entry *ce) { solr_document_register_class_constants(ce); zend_declare_class_constant_long(ce, "UPDATE_MODIFIER_ADD", sizeof("UPDATE_MODIFIER_ADD")-1, SOLR_FIELD_VALUE_MOD_ADD); zend_declare_class_constant_long(ce, "UPDATE_MODIFIER_SET", sizeof("UPDATE_MODIFIER_SET")-1, SOLR_FIELD_VALUE_MOD_SET); zend_declare_class_constant_long(ce, "UPDATE_MODIFIER_INC", sizeof("UPDATE_MODIFIER_INC")-1, SOLR_FIELD_VALUE_MOD_INC); zend_declare_class_constant_long(ce, "UPDATE_MODIFIER_REMOVE", sizeof("UPDATE_MODIFIER_REMOVE")-1, SOLR_FIELD_VALUE_MOD_REMOVE); zend_declare_class_constant_long(ce, "UPDATE_MODIFIER_REMOVEREGEX", sizeof("UPDATE_MODIFIER_REMOVEREGEX")-1, SOLR_FIELD_VALUE_MOD_REMOVEREGEX); zend_declare_class_constant_long(ce, "VERSION_ASSERT_NONE", sizeof("VERSION_ASSERT_NONE")-1, SOLR_VERSION_ASSERT_NONE); zend_declare_class_constant_long(ce, "VERSION_ASSERT_EXISTS", sizeof("VERSION_ASSERT_EXISTS")-1, SOLR_VERSION_ASSERT_EXISTS); zend_declare_class_constant_long(ce, "VERSION_ASSERT_NOT_EXISTS", sizeof("VERSION_ASSERT_NOT_EXISTS")-1, SOLR_VERSION_ASSERT_NOT_EXISTS); } /* {{{ void solr_collapse_function_register_class_constants(zend_class_entry * ce) */ PHP_SOLR_API void solr_collapse_function_register_class_constants(zend_class_entry *ce) { zend_declare_class_constant_string(ce, "NULLPOLICY_IGNORE", sizeof("NULLPOLICY_IGNORE")-1, "ignore"); zend_declare_class_constant_string(ce, "NULLPOLICY_EXPAND", sizeof("NULLPOLICY_EXPAND")-1, "expand"); zend_declare_class_constant_string(ce, "NULLPOLICY_COLLAPSE", sizeof("NULLPOLICY_COLLAPSE")-1, "collapse"); } /* }}} */ /* {{{ void solr_client_register_class_constants(zend_class_entry *ce) */ PHP_SOLR_API void solr_client_register_class_constants(zend_class_entry *ce) { zend_declare_class_constant_long(ce, "SEARCH_SERVLET_TYPE", sizeof("SEARCH_SERVLET_TYPE")-1, SOLR_SERVLET_TYPE_SEARCH); zend_declare_class_constant_long(ce, "UPDATE_SERVLET_TYPE", sizeof("UPDATE_SERVLET_TYPE")-1, SOLR_SERVLET_TYPE_UPDATE); zend_declare_class_constant_long(ce, "THREADS_SERVLET_TYPE", sizeof("THREADS_SERVLET_TYPE")-1, SOLR_SERVLET_TYPE_THREADS); zend_declare_class_constant_long(ce, "PING_SERVLET_TYPE", sizeof("PING_SERVLET_TYPE")-1, SOLR_SERVLET_TYPE_PING); zend_declare_class_constant_long(ce, "TERMS_SERVLET_TYPE", sizeof("TERMS_SERVLET_TYPE")-1, SOLR_SERVLET_TYPE_TERMS); zend_declare_class_constant_long(ce, "SYSTEM_SERVLET_TYPE", sizeof("SYSTEM_SERVLET_TYPE")-1, SOLR_SERVLET_TYPE_SYSTEM); zend_declare_class_constant_string(ce, "DEFAULT_SEARCH_SERVLET", sizeof("DEFAULT_SEARCH_SERVLET")-1, SOLR_DEFAULT_SEARCH_SERVLET); zend_declare_class_constant_string(ce, "DEFAULT_UPDATE_SERVLET", sizeof("DEFAULT_UPDATE_SERVLET")-1, SOLR_DEFAULT_UPDATE_SERVLET); zend_declare_class_constant_string(ce, "DEFAULT_THREADS_SERVLET", sizeof("DEFAULT_THREADS_SERVLET")-1, SOLR_DEFAULT_THREADS_SERVLET); zend_declare_class_constant_string(ce, "DEFAULT_PING_SERVLET", sizeof("DEFAULT_PING_SERVLET")-1, SOLR_DEFAULT_PING_SERVLET); zend_declare_class_constant_string(ce, "DEFAULT_TERMS_SERVLET", sizeof("DEFAULT_TERMS_SERVLET")-1, SOLR_DEFAULT_TERMS_SERVLET); zend_declare_class_constant_string(ce, "DEFAULT_SYSTEM_SERVLET", sizeof("DEFAULT_SYSTEM_SERVLET")-1, SOLR_DEFAULT_SYSTEM_SERVLET); } /* }}} */ /* {{{ void solr_response_register_class_properties(zend_class_entry *ce) */ PHP_SOLR_API void solr_response_register_class_properties(zend_class_entry *ce) { zend_declare_property_long(ce, "http_status", sizeof("http_status")-1, 0L, ZEND_ACC_PROTECTED); zend_declare_property_long(ce, "parser_mode", sizeof("parser_mode")-1, 0L, ZEND_ACC_PROTECTED); zend_declare_property_bool(ce, "success", sizeof("success")-1, 0L, ZEND_ACC_PROTECTED); zend_declare_property_string(ce, "response_writer", sizeof("response_writer")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED); zend_declare_property_string(ce, "http_status_message", sizeof("http_status_message")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED); zend_declare_property_string(ce, "http_request_url", sizeof("http_request_url")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED); zend_declare_property_string(ce, "http_raw_request_headers", sizeof("http_raw_request_headers")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED); zend_declare_property_string(ce, "http_raw_request", sizeof("http_raw_request")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED); zend_declare_property_string(ce, "http_raw_response_headers", sizeof("http_raw_response_headers")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED); zend_declare_property_string(ce, "http_raw_response", sizeof("http_raw_response")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED); zend_declare_property_string(ce, "http_digested_response", sizeof("http_digested_response")-1, SOLR_SPACE_STRING, ZEND_ACC_PROTECTED); } /* }}} */ /* {{{ void solr_exception_register_class_properties(zend_class_entry *ce) */ PHP_SOLR_API void solr_exception_register_class_properties(zend_class_entry *ce) { zend_declare_property_long(ce, SOLR_SOURCELINE_NO_PROPERTY_NAME, sizeof(SOLR_SOURCELINE_NO_PROPERTY_NAME)-1, __LINE__, ZEND_ACC_PROTECTED); zend_declare_property_string(ce, SOLR_SOURCEFILE_PROPERTY_NAME, sizeof(SOLR_SOURCEFILE_PROPERTY_NAME)-1, __FILE__, ZEND_ACC_PROTECTED); zend_declare_property_string(ce, SOLR_ZIFNAME_PROPERTY_NAME, sizeof(SOLR_ZIFNAME_PROPERTY_NAME)-1, (char *) __func__, ZEND_ACC_PROTECTED); } /* }}} */ /* {{{ void solr_response_register_class_constants(zend_class_entry *ce) */ PHP_SOLR_API void solr_response_register_class_constants(zend_class_entry *ce) { zend_declare_class_constant_long(ce, "PARSE_SOLR_OBJ", sizeof("PARSE_SOLR_OBJ")-1, 0L); zend_declare_class_constant_long(ce, "PARSE_SOLR_DOC", sizeof("PARSE_SOLR_DOC")-1, 1L); } /* }}} */ /* {{{ void solr_query_register_class_constants(zend_class_entry *ce) */ PHP_SOLR_API void solr_query_register_class_constants(zend_class_entry *ce) { zend_declare_class_constant_long(ce, "ORDER_ASC", sizeof("ORDER_ASC")-1, SOLR_SORT_DIR_ASC); zend_declare_class_constant_long(ce, "ORDER_DESC", sizeof("ORDER_DESC")-1, SOLR_SORT_DIR_DESC); zend_declare_class_constant_long(ce, "FACET_SORT_INDEX", sizeof("FACET_SORT_INDEX")-1, 0L); zend_declare_class_constant_long(ce, "FACET_SORT_COUNT", sizeof("FACET_SORT_COUNT")-1, 1L); zend_declare_class_constant_long(ce, "TERMS_SORT_INDEX", sizeof("TERMS_SORT_INDEX")-1, 0L); zend_declare_class_constant_long(ce, "TERMS_SORT_COUNT", sizeof("TERMS_SORT_COUNT")-1, 1L); } /* }}} */ PHP_SOLR_API void solr_extract_register_class_constants(zend_class_entry *ce) { zend_declare_class_constant_string(ce, "CAPTURE_ELEMENTS", sizeof("CAPTURE_ELEMENTS")-1, "capture"); zend_declare_class_constant_string(ce, "CAPTURE_ATTRIBUTES", sizeof("CAPTURE_ATTRIBUTES")-1, "captureAttr"); zend_declare_class_constant_string(ce, "COMMIT_WITHIN", sizeof("COMMIT_WITHIN")-1, "commitWithin"); zend_declare_class_constant_string(ce, "DATE_FORMATS", sizeof("DATE_FORMATS")-1, "date.formats"); zend_declare_class_constant_string(ce, "DEFAULT_FIELD", sizeof("DEFAULT_FIELD")-1, "defaultField"); zend_declare_class_constant_string(ce, "EXTRACT_ONLY", sizeof("EXTRACT_ONLY")-1, "extractOnly"); zend_declare_class_constant_string(ce, "EXTRACT_FORMAT", sizeof("EXTRACT_FORMAT")-1,"extractFormat"); zend_declare_class_constant_string(ce, "IGNORE_TIKA_EXCEPTION", sizeof("IGNORE_TIKA_EXCEPTION")-1, "ignoreTikaException"); zend_declare_class_constant_string(ce, "LITERALS_OVERRIDE", sizeof("LITERALS_OVERRIDE")-1, "literalsOverride"); zend_declare_class_constant_string(ce, "LOWERNAMES", sizeof("LOWERNAMES")-1, "lowernames"); zend_declare_class_constant_string(ce, "MULTIPART_UPLOAD_LIMIT", sizeof("MULTIPART_UPLOAD_LIMIT")-1, "multipartUploadLimitInKB"); zend_declare_class_constant_string(ce, "PASSWORD_MAP_FILE", sizeof("PASSWORD_MAP_FILE")-1, "passwordsFile"); zend_declare_class_constant_string(ce, "RESOURCE_NAME", sizeof("RESOURCE_NAME")-1, "resource.name"); zend_declare_class_constant_string(ce, "RESOURCE_PASSWORD", sizeof("RESOURCE_PASSWORD")-1, "resource.password"); zend_declare_class_constant_string(ce, "TIKE_CONFIG", sizeof("TIKE_CONFIG")-1, "tika.config"); zend_declare_class_constant_string(ce, "UNKNOWN_FIELD_PREFIX", sizeof("UNKNOWN_FIELD_PREFIX")-1, "uprefix"); zend_declare_class_constant_string(ce, "XPATH_EXPRESSION", sizeof("XPATH_EXPRESSION")-1, "xpath"); zend_declare_class_constant_string(ce, "FIELD_MAPPING_PREFIX", sizeof("FIELD_MAPPING_PREFIX")-1, "fmap."); zend_declare_class_constant_string(ce, "FIELD_BOOST_PREFIX", sizeof("FIELD_BOOST_PREFIX")-1, "boost."); zend_declare_class_constant_string(ce, "LITERALS_PREFIX", sizeof("LITERALS_PREFIX")-1, "literal."); } /** ************************************************************************ **/ /** UTILITY FUNCTIONS **/ /** ************************************************************************ **/ /* {{{ int solr_hashtable_get_new_index(HashTable *ht) Retrieves a unique index for this HashTable */ PHP_SOLR_API int solr_hashtable_get_new_index(HashTable *ht) { int new_index = SOLR_GET_RANDOM_NUMBER(); /* If the key already exists in the HashTable, create another one. */ while(zend_hash_index_exists(ht, new_index)) { new_index = SOLR_GET_RANDOM_NUMBER(); } return new_index; } /* }}} */ /* {{{ static inline int solr_fetch_document_entry(zval *objptr, solr_document_t **doc_entry) Retrieves a Document from the HashTable */ #if PHP_VERSION_ID < 80000 PHP_SOLR_API int solr_fetch_document_entry(zval *objptr, solr_document_t **doc_entry) { zval *rv = NULL; zval *id = zend_read_property(Z_OBJCE_P(objptr), objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, 1, rv); #else PHP_SOLR_API int solr_fetch_document_entry(zend_object *objptr, solr_document_t **doc_entry) { zval *rv = NULL; zval *id = zend_read_property(objptr->ce, objptr, SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, 1, rv); #endif /* Retrieving the value of the document index from the zval */ long int document_index = Z_LVAL_P(id); *doc_entry = NULL; /* Retrieve the doc_entry from the HashTable */ if ((*doc_entry = (solr_document_t *)zend_hash_index_find_ptr(SOLR_GLOBAL(documents), document_index)) == NULL) { php_error_docref(NULL, E_WARNING, "Invalid Document Index %ld. HashTable index does not exist.", document_index); php_error_docref(NULL, E_WARNING, SOLR_ERROR_1008_MSG, SOLR_FILE_LINE_FUNC); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_fetch_client_entry(zval *objptr, solr_client_t **solr_client) */ PHP_SOLR_API int solr_fetch_client_entry(zval *objptr, solr_client_t **solr_client) { zval rv; zval *id = zend_read_property(solr_ce_SolrClient, OBJ_FOR_PROP(objptr), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, 1, &rv); /* Retrieving the value of the client index from the zval */ long int client_index = Z_LVAL_P(id); *solr_client = NULL; /* Retrieve the doc_entry from the HashTable */ if ((*solr_client = zend_hash_index_find_ptr(SOLR_GLOBAL(clients), client_index)) == NULL) { php_error_docref(NULL, E_WARNING, "Invalid SolrClient Index %ld. HashTable index does not exist.", client_index); php_error_docref(NULL, E_WARNING, SOLR_ERROR_1008_MSG, SOLR_FILE_LINE_FUNC); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_fetch_params_entry(zval *objptr, solr_params_t **solr_params) */ PHP_SOLR_API int solr_fetch_params_entry(zval *objptr, solr_params_t **solr_params) { zval rv; zval *id = zend_read_property(Z_OBJCE_P(objptr), OBJ_FOR_PROP(objptr), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, 1, &rv); long int params_index = Z_LVAL_P(id); *solr_params = NULL; if ((*solr_params = zend_hash_index_find_ptr(SOLR_GLOBAL(params), params_index)) == NULL) { php_error_docref(NULL, E_WARNING, "Invalid SolrParams Index %ld. HashTable index does not exist.", params_index); php_error_docref(NULL, E_WARNING, SOLR_ERROR_1008_MSG, SOLR_FILE_LINE_FUNC); return FAILURE; } return SUCCESS; } /* }}} */ PHP_SOLR_API int solr_fetch_function_entry(zval *objptr, solr_function_t **solr_function) { zval rv; zval *id = zend_read_property(Z_OBJCE_P(objptr), OBJ_FOR_PROP(objptr), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME) - 1, 1, &rv); long int params_index = Z_LVAL_P(id); *solr_function = NULL; if ((*solr_function = zend_hash_index_find_ptr(SOLR_GLOBAL(functions), params_index)) == NULL) { php_error_docref(NULL, E_WARNING, "Invalid solr_function Index %ld. HashTable index does not exist.", params_index); php_error_docref(NULL, E_WARNING, SOLR_ERROR_1008_MSG, SOLR_FILE_LINE_FUNC); return FAILURE; } return SUCCESS; } /* {{{ PHP_SOLR_API void solr_destroy_function(zval *solr_function) */ PHP_SOLR_API void solr_destroy_function(zval *solr_function) { solr_function_t *function = (solr_function_t *) Z_PTR_P(solr_function); zend_hash_destroy(function->params); pefree(function->params, SOLR_FUNCTIONS_PERSISTENT); #ifdef PHP_7 pefree(function, SOLR_FUNCTIONS_PERSISTENT); #endif } /* }}} */ /* {{{ PHP_SOLR_API xmlDocPtr solr_xml_create_xml_doc(const xmlChar *root_node_name, xmlNode **root_node_ptr) */ PHP_SOLR_API xmlDocPtr solr_xml_create_xml_doc(const xmlChar *root_node_name, xmlNode **root_node_ptr) { xmlNs *ns = NULL; xmlDoc *doc_ptr = xmlNewDoc((xmlChar *) "1.0"); xmlNode *root_node = xmlNewNode(ns, root_node_name); xmlDocSetRootElement(doc_ptr, root_node); if (root_node_ptr) { *root_node_ptr = root_node; } return doc_ptr; } /* }}} */ /** * escapes strings with characters that are part of the Lucene query syntax * * @sbuilder is a solr_string_t pointer used to store the escape char sequence * @unescaped is the unescaped string. It must be null terminated * @unescaped_length is the original length of the unescaped_string */ /* {{{ PHP_SOLR_API void solr_escape_query_chars(solr_string_t *sbuilder, solr_char_t *unescaped, long int unescaped_length) */ PHP_SOLR_API void solr_escape_query_chars(solr_string_t *sbuilder, solr_char_t *unescaped, long int unescaped_length) { register int i = 0; /** * Lucene supports escaping special characters that are part of the query syntax. * * The current list special characters are * + - && || ! ( ) { } [ ] ^ " ~ * ? : \ / * * These characters are part of the query syntax and must be escaped */ for (i = 0; i < unescaped_length; i++) { enter_switchboard : switch(unescaped[i]) { case '\\' : case '+' : case '-' : case '!' : case '(' : case ')' : case ':' : case '/' : case '^' : case '[' : case ']' : case '"' : case '{' : case '}' : case '~' : case '*' : case '?' : case ';' : { solr_string_appendc(sbuilder, '\\'); } break; case '|' : /* || */ { if ('|' == unescaped[i+1]) { solr_string_appendc(sbuilder, '\\'); solr_string_append_const(sbuilder, "||"); i += 2; goto enter_switchboard; } } break; case '&' : /* && */ { if ('&' == unescaped[i+1]) { solr_string_appendc(sbuilder, '\\'); solr_string_append_const(sbuilder, "&&"); i += 2; goto enter_switchboard; } } break; default : /* The current character is not a special character */ { /* Do nothing. Just append the character as is */ } } /* END switch(unescaped[i]) */ solr_string_appendc(sbuilder, unescaped[i]); } /* END for (i = 0; i < unescaped_length; i++) { */ } /* }}} */ /******************************************************************************/ /* SOLR XML RESPONSE DIGEST DATA TYPES AND FUNCTIONS */ /******************************************************************************/ /* {{{ solr_doc_encode_t, solr_php_encode_t, solr_encoding_type_t, solr_php_encode_func_t, solr_document_field_encode_func_t */ typedef enum { SOLR_DOC_ENCODE_START = 0, SOLR_DOC_ENCODE_FIELDS = 1, SOLR_DOC_ENCODE_FIELD = 2, SOLR_DOC_ENCODE_END } solr_doc_encode_t; typedef enum { SOLR_ENCODE_START = 0, SOLR_ENCODE_NULL = 1, SOLR_ENCODE_BOOL = 2, SOLR_ENCODE_INT = 3, SOLR_ENCODE_FLOAT = 4, SOLR_ENCODE_STRING = 5, SOLR_ENCODE_ARRAY = 6, SOLR_ENCODE_OBJECT = 7, SOLR_ENCODE_DOC = 8, SOLR_ENCODE_RESULT = 9, SOLR_ENCODE_END } solr_php_encode_t; typedef enum { SOLR_ENCODE_STANDALONE = 0, SOLR_ENCODE_OBJECT_PROPERTY = 1, SOLR_ENCODE_ARRAY_KEY = 2, SOLR_ENCODE_ARRAY_INDEX = 3 } solr_encoding_type_t; typedef void (*solr_php_encode_func_t)(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); typedef void (*solr_document_field_encode_func_t)(const xmlNode *node, xmlNode *field); /* }}} */ /* {{{ Macros for XML transcoding */ /* Serializes the current XML node */ #define solr_encode_xml_node(__node, __buf, __enc_type, __arr_idx, __mode) solr_encoder_functions[solr_get_xml_type((__node))]((__node),(__buf), (__enc_type), (__arr_idx), (__mode)) #define solr_write_object_closer(__buf) solr_string_append_const((__buf), "}") #define solr_write_array_closer(__buf) solr_string_append_const((__buf), "}") #define solr_write_root_object_closer(__buf) solr_string_append_const((__buf), "}") /* }}} */ /* {{{ static void solr_encode_* prototypes */ static void solr_encode_null(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_bool(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_int(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_float(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_string(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_array(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_object(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_document(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_result(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_encode_document_field_simple(const xmlNode *fieldNode, xmlNode *field); static void solr_encode_document_field_complex(const xmlNode *fieldNode, xmlNode *field); /* }}} */ /* {{{ global variables solr_encoder_functions[], solr_document_field_encoders[] */ static solr_php_encode_func_t solr_encoder_functions[] = { solr_encode_string, solr_encode_null, solr_encode_bool, solr_encode_int, solr_encode_float, solr_encode_string, solr_encode_array, solr_encode_object, solr_encode_document, solr_encode_result, NULL }; static solr_document_field_encode_func_t solr_document_field_encoders[] = { solr_encode_document_field_simple, /* maps to SOLR_SIMPLE_FIELD */ solr_encode_document_field_complex, /* maps to SOLR_COMPLEX_FIELD */ NULL }; /* }}} */ /* {{{ Constants and Macros for handling node types */ #define SOLR_SIMPLE_FIELD 0 #define SOLR_COMPLEX_FIELD 1 #define solr_xml_field_node_type(node) (xmlStrEqual((node)->name, (xmlChar *)"arr")? SOLR_COMPLEX_FIELD : SOLR_SIMPLE_FIELD) #define solr_encode_document_field(field_in, field_out) solr_document_field_encoders[solr_xml_field_node_type((field_in))]((field_in), (field_out)) /* }}} */ /* Used to figure out now many properties or elements there are in an object or an array */ /* {{{ static inline int solr_get_node_size(const xmlNode *data_node) */ static inline int solr_get_node_size(const xmlNode *data_node) { register int size = 0; xmlNode *curr_node = data_node->children; while(curr_node != NULL) { if (XML_ELEMENT_NODE == curr_node->type) { size++; } curr_node = curr_node->next; } return size; } /* }}} */ /* {{{ static inline int solr_get_xml_type(xmlNode *node) */ static inline int solr_get_xml_type(xmlNode *node) { solr_char_t *node_name = (solr_char_t *) node->name; if (!node_name) { return SOLR_ENCODE_STRING; } if (!strcmp(node_name, "str")) { return SOLR_ENCODE_STRING; } else if (!strcmp(node_name, "int") || !strcmp(node_name, "long") || !strcmp(node_name, "short") || !strcmp(node_name, "byte")) { return SOLR_ENCODE_INT; } else if (!strcmp(node_name, "double") || !strcmp(node_name, "float")) { return SOLR_ENCODE_FLOAT; } else if (!strcmp(node_name, "lst")) { return SOLR_ENCODE_OBJECT; } else if (!strcmp(node_name, "arr")) { return SOLR_ENCODE_ARRAY; } else if (!strcmp(node_name, "bool")) { return SOLR_ENCODE_BOOL; } else if (!strcmp(node_name, "null")) { return SOLR_ENCODE_NULL; } else if (!strcmp(node_name, "result")) { return SOLR_ENCODE_RESULT; }else if (!strcmp(node_name, "doc")) { return SOLR_ENCODE_OBJECT; } else { return SOLR_ENCODE_STRING; } } /* }}} */ /* {{{ static inline void solr_write_variable_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) */ static inline void solr_write_variable_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) { switch(enc_type) { case SOLR_ENCODE_OBJECT_PROPERTY : /* fall through */ case SOLR_ENCODE_ARRAY_KEY : { solr_char_t *object_name = "_undefined_property_name"; xmlAttr *name_attr = node->properties; /* get the contents of the name attribute */ if (name_attr) { object_name = (solr_char_t *) solr_xml_get_node_contents(name_attr); } solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, strlen(object_name)); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, object_name, strlen(object_name)); solr_string_append_const(buffer, "\";"); } break; case SOLR_ENCODE_ARRAY_INDEX : { solr_string_append_const(buffer, "i:"); solr_string_append_long(buffer, array_index); solr_string_appendc(buffer, ';'); } break; default : { /* do nothing */ } break; } } /* }}} */ /* {{{ static void solr_write_object_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) */ static void solr_write_object_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) { int size = solr_get_node_size(node); solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "O:10:\"SolrObject\":"); solr_string_append_long(buffer, size); solr_string_append_const(buffer, ":{"); } /* }}} */ /* {{{ static void solr_write_solr_document_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, int size) */ static void solr_write_solr_document_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, int size) { solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "C:12:\"SolrDocument\":"); solr_string_append_long(buffer, size); solr_string_append_const(buffer, ":{"); } /* }}} */ /* {{{ static void solr_write_array_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) */ static void solr_write_array_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) { int size = solr_get_node_size(node); solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "a:"); solr_string_append_long(buffer, size); solr_string_append_const(buffer, ":{"); } /* }}} */ static void solr_serialize_solr_document(const xmlNode *node, solr_string_t *dest); static void solr_encode_solr_document_children(const xmlNode *node, xmlNode* builder_node, int child_docs_found); static void solr_encode_solr_document(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode); static void solr_serialize_solr_document(const xmlNode *node, solr_string_t *dest) { xmlChar *doc_txt_buffer = NULL; int doc_txt_len = 0; xmlNode *solr_document_node = NULL; xmlDoc *doc_ptr = solr_xml_create_xml_doc((xmlChar *) "solr_document", &solr_document_node); xmlNode *fields_node = xmlNewChild(solr_document_node, NULL, (xmlChar *) "fields", NULL); xmlNode *curr_node = node->children; int format = 1; int child_docs_found = 0; while(curr_node != NULL) { if (XML_ELEMENT_NODE == curr_node->type) { if (strcmp((const char *)curr_node->name, "doc") == 0) { child_docs_found++; } else { xmlNode *field = xmlNewChild(fields_node, NULL, (xmlChar *)"field", NULL); solr_encode_document_field(curr_node, field); } } curr_node = curr_node->next; } if (child_docs_found > 0) { solr_encode_solr_document_children(node, solr_document_node, child_docs_found); } /* We have written all the fields to the document */ /* Dumping the document from memory to the buffer */ xmlDocDumpFormatMemoryEnc(doc_ptr, &doc_txt_buffer, &doc_txt_len, "UTF-8", format); solr_string_appends_ex(dest, (solr_char_t *)doc_txt_buffer, doc_txt_len); xmlFreeDoc(doc_ptr); xmlFree(doc_txt_buffer); } /* {{{ static void solr_encode_document_children(const xmlNode *node, solr_string_t* buffer, int child_docs_found, long int parse_mode) encodes the doc/doc child/nested documents */ static void solr_encode_solr_document_children(const xmlNode *node, xmlNode* builder_node, int child_docs_found) { int current_index = 0; xmlXPathContext *xpathctxt = NULL; const xmlChar *xpath_expression = (xmlChar *) "child::doc"; xmlXPathObject *xpathObj = NULL; xmlNodeSet *result = NULL; xmlNode *child_docs_node = NULL; xpathctxt = xmlXPathNewContext(node->doc); xpathctxt->node = (xmlNodePtr) node; xpathObj = xmlXPathEval(xpath_expression, xpathctxt); result = xpathObj->nodesetval; child_docs_found = result->nodeNr; child_docs_node = xmlNewChild(builder_node, NULL, (xmlChar *)"child_docs", NULL); for (current_index=0; current_index < child_docs_found; current_index++) { zend_string *encoded_str = NULL; solr_string_t tmp_buffer; solr_string_t tmp_s_buffer; memset(&tmp_buffer, 0, sizeof(solr_string_t)); memset(&tmp_s_buffer, 0, sizeof(solr_string_t)); solr_serialize_solr_document(result->nodeTab[current_index], &tmp_buffer); solr_string_append_const(&tmp_s_buffer, "C:12:\"SolrDocument\":"); solr_string_append_long(&tmp_s_buffer, tmp_buffer.len); solr_string_append_const(&tmp_s_buffer, ":{"); solr_string_appends_ex(&tmp_s_buffer, tmp_buffer.str, tmp_buffer.len); solr_write_object_closer(&tmp_s_buffer); encoded_str = php_base64_encode((const unsigned char*)tmp_s_buffer.str, tmp_s_buffer.len); xmlNewChild(child_docs_node, NULL, (const xmlChar *) "dochash", (xmlChar *)encoded_str->val); solr_string_free_ex(&tmp_buffer); solr_string_free_ex(&tmp_s_buffer); zend_string_free(encoded_str); } } /* }}} */ /** * * The @enc_type parameter must be SOLR_ENCODE_ARRAY_INDEX */ /* {{{ static void solr_encode_solr_document(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_solr_document(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { solr_string_t doc_serialized_buffer; memset(&doc_serialized_buffer, 0, sizeof(solr_string_t)); solr_serialize_solr_document(node, &doc_serialized_buffer); solr_write_solr_document_opener(NULL, buffer, enc_type, array_index, doc_serialized_buffer.len); solr_string_appends(buffer, (char *) doc_serialized_buffer.str, doc_serialized_buffer.len); solr_write_object_closer(buffer); solr_string_free(&doc_serialized_buffer); } /* }}} */ /* {{{ static void solr_write_object_opener(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) */ static void solr_write_object_opener_child_doc(const xmlNode *node, int num_child_docs ,solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index) { int size = solr_get_node_size(node) - num_child_docs + 1; solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "O:10:\"SolrObject\":"); solr_string_append_long(buffer, size); solr_string_append_const(buffer, ":{"); } /* }}} */ /* {{{ static void solr_encode_document_children(const xmlNode *node, solr_string_t* buffer, int child_docs_found, long int parse_mode) encodes the doc/doc child/nested documents ONLY FOR SolrObject */ static void solr_encode_document_children(const xmlNode *node, solr_string_t* buffer, int child_docs_found, long int parse_mode) { int current_index = 0; xmlXPathContext *xpathctxt = NULL; const xmlChar *xpath_expression = (xmlChar *) "child::doc"; xmlXPathObject *xpathObj = NULL; xmlNodeSet *result = NULL; solr_php_encode_func_t document_encoder_functions[] = { solr_encode_document, solr_encode_solr_document, NULL }; solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, sizeof("_childDocuments_")-1); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, "_childDocuments_", sizeof("_childDocuments_")-1); solr_string_append_const(buffer, "\";"); solr_string_append_const(buffer, "a:"); solr_string_append_long(buffer, child_docs_found); solr_string_append_const(buffer, ":{"); xpathctxt = xmlXPathNewContext(node->doc); xpathctxt->node = (xmlNodePtr) node; xpathObj = xmlXPathEval(xpath_expression, xpathctxt); result = xpathObj->nodesetval; child_docs_found = result->nodeNr; for (current_index=0; current_index < child_docs_found; current_index++) { document_encoder_functions[parse_mode](result->nodeTab[current_index], buffer, SOLR_ENCODE_ARRAY_INDEX, current_index, parse_mode); } solr_write_array_closer(buffer); } /* }}} */ /* {{{ static void solr_encode_document(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) encodes/serializes the element result/doc */ static void solr_encode_document(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { xmlNode *curr_node = NULL; int child_docs_found = 0; solr_string_t inner_buffer; memset(&inner_buffer, 0, sizeof(solr_string_t)); curr_node = node->children; while(curr_node != NULL) { if (XML_ELEMENT_NODE == curr_node->type) { if (strcmp((const char*) curr_node->name, "doc") == 0) { /* skip doc/doc elements to be processed later */ child_docs_found++; } else { solr_encode_xml_node(curr_node, &inner_buffer, SOLR_ENCODE_OBJECT_PROPERTY, 0L, parse_mode); } } curr_node = curr_node->next; } if (child_docs_found > 0){ solr_encode_document_children(node, &inner_buffer, child_docs_found, parse_mode); /** * write and calculate proper object opener * because the object number of properties depends on whether there are child documents involved */ solr_write_object_opener_child_doc(node, child_docs_found, buffer, enc_type, array_index); } else { solr_write_object_opener(node, buffer, enc_type, array_index); } solr_string_appends_ex(buffer, inner_buffer.str, inner_buffer.len); solr_write_object_closer(buffer); solr_string_free_ex(&inner_buffer); } /* }}} */ /** * Handles simple data types like strings, integers, booleans etc. */ /* {{{ static void solr_encode_document_field_simple(const xmlNode *fieldNode, xmlNode *field) */ static void solr_encode_document_field_simple(const xmlNode *fieldNode, xmlNode *field) { xmlChar *fieldname = solr_xml_get_node_contents(fieldNode->properties); xmlChar *field_value = xmlEncodeEntitiesReentrant(fieldNode->doc, solr_xml_get_node_contents(fieldNode)); xmlNewChild(field, NULL, (xmlChar *) "field_value", field_value); xmlNewProp(field, (xmlChar *) "name", fieldname); xmlFree(field_value); } /* }}} */ /* Handles complex data types like arrays */ /* {{{ static void solr_encode_document_field_complex(const xmlNode *fieldNode, xmlNode *field) */ static void solr_encode_document_field_complex(const xmlNode *fieldNode, xmlNode *field) { xmlChar *fieldname = solr_xml_get_node_contents(fieldNode->properties); xmlNode *current_value = fieldNode->children; while(current_value != NULL) { if (current_value->type == XML_ELEMENT_NODE) { xmlChar *field_value = xmlEncodeEntitiesReentrant(fieldNode->doc, solr_xml_get_node_contents(current_value)); xmlNewChild(field, NULL, (xmlChar *) "field_value", field_value); xmlFree(field_value); } current_value = current_value->next; } xmlNewProp(field, (xmlChar *) "name", fieldname); } /* }}} */ /* {{{ static void solr_encode_result(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_result(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { xmlAttr *properties = node->properties; solr_char_t *object_name = (solr_char_t *) node->name; solr_char_t *num_found = NULL; solr_char_t *start = NULL; solr_char_t *max_score = NULL; solr_php_encode_func_t document_encoder_functions[] = { solr_encode_document, solr_encode_solr_document, NULL }; xmlAttr *curr_prop = properties; xmlXPathContext *xpathctxt = NULL; const xmlChar *xpath_expression = (xmlChar *) "child::doc"; xmlXPathObject *xpathObj = NULL; xmlNodeSet *result = NULL; long int document_count = 0; while(curr_prop != NULL) { if (solr_xml_match_node(curr_prop, "numFound")) { num_found = (solr_char_t *) solr_xml_get_node_contents(curr_prop); } if (solr_xml_match_node(curr_prop, "start")) { start = (solr_char_t *) solr_xml_get_node_contents(curr_prop); } if (solr_xml_match_node(curr_prop, "name")) { object_name = (solr_char_t *) solr_xml_get_node_contents(curr_prop); } if (solr_xml_match_node(curr_prop, "maxScore")) { max_score = (solr_char_t *) solr_xml_get_node_contents(curr_prop); } curr_prop = curr_prop->next; } xpathctxt = xmlXPathNewContext(node->doc); xpathctxt->node = (xmlNodePtr) node; xpathObj = xmlXPathEval(xpath_expression, xpathctxt); result = xpathObj->nodesetval; document_count = result->nodeNr; solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, strlen(object_name)); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, object_name, strlen(object_name)); solr_string_append_const(buffer, "\";"); solr_string_append_const(buffer, "O:10:\"SolrObject\":"); if (max_score) { solr_string_append_long(buffer, 4); /* numFound, start, docs, maxScore properties */ } else { solr_string_append_long(buffer, 3); /* numFound, start, docs properties */ } solr_string_append_const(buffer, ":{"); /* Object Opener for response */ /* Writing the numFound property */ solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, sizeof("numFound")-1); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, "numFound", sizeof("numFound")-1); solr_string_append_const(buffer, "\";"); solr_string_append_const(buffer, "i:"); solr_string_appends(buffer, num_found, solr_strlen(num_found)); solr_string_appendc(buffer, ';'); /* Writing the start property */ solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, sizeof("start")-1); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, "start", sizeof("start")-1); solr_string_append_const(buffer, "\";"); solr_string_append_const(buffer, "i:"); solr_string_appends(buffer, start, solr_strlen(start)); solr_string_appendc(buffer, ';'); /* writing max score property */ if (max_score) { solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, sizeof("maxScore")-1); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, "maxScore", sizeof("maxScore")-1); solr_string_append_const(buffer, "\";"); solr_string_append_const(buffer, "d:"); solr_string_appends(buffer, max_score, solr_strlen(max_score)); solr_string_appendc(buffer, ';'); } /* Writing the docs property */ solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, sizeof("docs")-1); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, "docs", sizeof("docs")-1); solr_string_append_const(buffer, "\";"); if (document_count) { /* Grab all the first /response/result/doc node */ xmlNode *curr_doc = node->children; long int curr_doc_index = 0L; /* Array opener */ solr_string_append_const(buffer, "a:"); solr_string_append_long(buffer, document_count); solr_string_append_const(buffer, ":{"); while(curr_doc != NULL) { /* Absolutely no assumptions. At least for now. */ if (XML_ELEMENT_NODE == curr_doc->type && solr_xml_match_node(curr_doc, "doc")) { /* This is where you decided whether to use SolrDocument or StdClass */ /* parse_mode value of 0 creates SolrObject; 1 creates SolrDocument */ document_encoder_functions[parse_mode](curr_doc, buffer, SOLR_ENCODE_ARRAY_INDEX, curr_doc_index, parse_mode); curr_doc_index++; } curr_doc = curr_doc->next; } solr_write_array_closer(buffer); /* Array closer */ } else { solr_string_append_const(buffer, "b:0;"); /* This means there are no docs */ } solr_write_object_closer(buffer); /* Object closer */ xmlXPathFreeContext(xpathctxt); xmlXPathFreeObject(xpathObj); } /* }}} */ /* {{{ static void solr_encode_null(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_null(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { /* SolrObject should not contain nulls because of how magic functionality is implemented */ solr_write_variable_opener(node, buffer, enc_type, array_index); /* Setting nulls to boolean false */ solr_string_append_const(buffer, "b:0;"); } /* }}} */ /* {{{ static void solr_encode_bool(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_bool(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { solr_char_t *data_value = (solr_char_t *) solr_xml_get_node_contents(node); long int boolean_value = (!strcmp("true", data_value))? 1 : 0; solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "b:"); solr_string_append_long(buffer, boolean_value); solr_string_appendc(buffer, ';'); } /* }}} */ /* {{{ static void solr_encode_int(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_int(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { solr_char_t *data_value = (solr_char_t *) solr_xml_get_node_contents(node); size_t data_value_len = solr_strlen(data_value); solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "i:"); solr_string_appends(buffer, data_value, data_value_len); solr_string_appendc(buffer, ';'); } /* }}} */ /* {{{ static void solr_encode_float(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_float(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { solr_char_t *data_value = (solr_char_t *) solr_xml_get_node_contents(node); size_t data_value_len = solr_strlen(data_value); solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "d:"); if (strcmp(data_value, "NaN" ) == 0) { data_value = (solr_char_t *)"NAN"; } solr_string_appends(buffer, data_value, data_value_len); solr_string_appendc(buffer, ';'); } /* }}} */ /* {{{ static void solr_encode_string(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_string(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { solr_char_t *data_value = (solr_char_t *) solr_xml_get_node_contents(node); size_t data_value_len = solr_strlen(data_value); solr_write_variable_opener(node, buffer, enc_type, array_index); solr_string_append_const(buffer, "s:"); solr_string_append_long(buffer, data_value_len); solr_string_append_const(buffer, ":\""); solr_string_appends(buffer, data_value, data_value_len); solr_string_append_const(buffer, "\";"); } /* }}} */ /* {{{ static void solr_encode_array(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_array(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { xmlNode *curr_node = NULL; long int current_index = 0L; solr_write_array_opener(node, buffer, enc_type, array_index); curr_node = node->children; while(curr_node != NULL) { if (XML_ELEMENT_NODE == curr_node->type) { solr_encode_xml_node(curr_node, buffer, SOLR_ENCODE_ARRAY_INDEX, current_index, parse_mode); current_index++; } curr_node = curr_node->next; } solr_write_array_closer(buffer); } /* }}} */ /* {{{ static void solr_encode_object(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) */ static void solr_encode_object(const xmlNode *node, solr_string_t *buffer, solr_encoding_type_t enc_type, long int array_index, long int parse_mode) { xmlNode *curr_node = NULL; solr_write_object_opener(node, buffer, enc_type, array_index); curr_node = node->children; while(curr_node != NULL) { if (XML_ELEMENT_NODE == curr_node->type) { solr_encode_xml_node(curr_node, buffer, SOLR_ENCODE_OBJECT_PROPERTY, 0L, parse_mode); } curr_node = curr_node->next; } solr_write_object_closer(buffer); } /* }}} */ /** * Used to digest Xml response messages from Solr * */ /* {{{ PHP_SOLR_API void solr_encode_generic_xml_response(solr_string_t *buffer, const solr_char_t *serialized, int size, long int parse_mode) */ PHP_SOLR_API void solr_encode_generic_xml_response(solr_string_t *buffer, const solr_char_t *serialized, int size, long int parse_mode) { xmlDoc *doc = xmlReadMemory(serialized, size, NULL, "UTF-8", XML_PARSE_RECOVER); xmlNode *root = NULL; if (!doc) { php_error_docref(NULL, E_WARNING, "Error loading XML document"); return; } root = xmlDocGetRootElement(doc); if (!root) { xmlFreeDoc(doc); php_error_docref(NULL, E_WARNING, "Error loading root of XML document"); return; } parse_mode = ((parse_mode < 0L) ? 0L : ((parse_mode > 1L) ? 1L : parse_mode)); solr_encode_object(root, buffer, SOLR_ENCODE_STANDALONE, 0L, parse_mode); if (buffer->len == 0) { php_error_docref(NULL, E_WARNING, "Error parsing XML document"); } xmlFreeDoc(doc); } /* }}} */ /* {{{ PHP_SOLR_API int solr_is_supported_response_writer(const solr_char_t * response_writer, int length) */ PHP_SOLR_API int solr_is_supported_response_writer(const solr_char_t * response_writer, int length) { if (length < 1) { return 0; } if (0 == strcmp(response_writer, SOLR_PHP_SERIALIZED_RESPONSE_WRITER)) { return 1; } if (0 == strcmp(response_writer, SOLR_XML_RESPONSE_WRITER)) { return 1; } if (0 == strcmp(response_writer, SOLR_JSON_RESPONSE_WRITER)) { return 1; } return 0; } /* }}} */ /* {{{ PHP_SOLR_API solr_char_t *solr_get_json_error_msg(solr_json_error_codes_t error_code) */ PHP_SOLR_API solr_char_t *solr_get_json_error_msg(solr_json_error_codes_t error_code) { switch(error_code) { case SOLR_JSON_ERROR_DEPTH: return "JSON maximum recursion depth was exceeded"; break; case SOLR_JSON_ERROR_STATE_MISMATCH: return "JSON error state mismatch"; break; case SOLR_JSON_ERROR_CTRL_CHAR: return "JSON control character was encountered"; break; case SOLR_JSON_ERROR_SYNTAX: return "JSON syntax error"; break; case SOLR_JSON_ERROR_UTF8: return "JSON UTF8 error"; break; default : return "JSON unknown error"; break; } } /* }}} */ /* {{{ PHP_SOLR_API int solr_json_to_php_native(solr_string_t *buffer, const solr_char_t *json_string, int json_string_length) */ PHP_SOLR_API int solr_json_to_php_native(solr_string_t *buffer, const solr_char_t *json_string, int json_string_length) { /* todo php7 review if we ever need that indirection with ret_val */ /* JSON recursion depth. default is 512 */ long recursion_depth = 1024L; long json_error = 0L; php_serialize_data_t var_hash; smart_str serialize_buffer = {0}; /* return value for the function */ zval json_decode_ret_val, *json_decode_ret_val_ptr; zend_uchar json_decode_ret_val_type = IS_NULL; json_decode_ret_val_ptr = &json_decode_ret_val; php_json_decode(&json_decode_ret_val, (char *) json_string, json_string_length, 1, recursion_depth); json_error = solr_get_json_last_error(); /* Why ? todo investigate */ /* solr_string_set(buffer, "i:99;", sizeof("i:99;")); */ if (json_error > 0) { zval_dtor(&json_decode_ret_val); php_error_docref(NULL, E_WARNING, "JSON error. JSON->PHP serialization error"); return (int) json_error; } memset(&var_hash, 0, sizeof(php_serialize_data_t)); PHP_VAR_SERIALIZE_INIT(var_hash); php_var_serialize(&serialize_buffer, &json_decode_ret_val, &var_hash); json_decode_ret_val_type = Z_TYPE_P(json_decode_ret_val_ptr); zval_dtor(&json_decode_ret_val); solr_string_set(buffer, serialize_buffer.s->val, serialize_buffer.s->len); PHP_VAR_SERIALIZE_DESTROY(var_hash); smart_str_free(&serialize_buffer); /* return value should not be of NULL type. NULL means an error has occurred */ if (json_decode_ret_val_type == IS_NULL) { php_error_docref(NULL, E_WARNING, "JSON error. Error occurred in php_json_decode(). Raw JSON string is \n %s \n", (char *) json_string); /* json_error always fails to detect an error. * todo investigate */ return (int) SOLR_JSON_ERROR_SERIALIZATION; } return (int) json_error; } /* }}} */ PHP_SOLR_API long solr_get_json_last_error(void) { long json_error; zval json_last_error_ret_val, *object_p; zval *json_last_error_params = NULL; zval json_last_error_function_name; ZVAL_STRING(&json_last_error_function_name, "json_last_error"); /* object instance to perform the method call */ object_p = (zval *) NULL; call_user_function(EG(function_table), object_p, &json_last_error_function_name, &json_last_error_ret_val, 0, json_last_error_params); json_error = Z_LVAL(json_last_error_ret_val); zval_dtor(&json_last_error_ret_val); #ifdef PHP_7 zval_dtor(&json_last_error_function_name); #endif return json_error; } static inline int solr_pcre_replace_into_buffer(solr_string_t *buffer, char * search, char *replace) { zend_string *result; int limit = -1; #if PHP_VERSION_ID >= 70300 size_t replace_count = -1; #else int replace_count = -1; #endif zend_string *regex_str = zend_string_init(search, strlen(search), 0); zend_string *subject_str = zend_string_init(buffer->str, buffer->len, 0); #if PHP_VERSION_ID >= 70200 zend_string *replace_str = zend_string_init(replace, strlen(replace), 0); #else zval replace_val; ZVAL_STRING(&replace_val, replace); #endif result = php_pcre_replace( regex_str, subject_str, buffer->str, buffer->len, #if PHP_VERSION_ID >= 70200 replace_str, #else &replace_val, 0, #endif limit, &replace_count ); solr_string_set_ex(buffer, (solr_char_t *)result->val, (size_t)result->len); /* fprintf(stdout, "%s", buffer->str); */ efree(result); #if PHP_VERSION_ID >= 70200 zend_string_release(replace_str); #else zval_ptr_dtor(&replace_val); #endif zend_string_release(regex_str); zend_string_release(subject_str); return SUCCESS; } /* serialized array to serialized object */ PHP_SOLR_API int solr_sarray_to_sobject(solr_string_t *buffer) { return solr_pcre_replace_into_buffer(buffer, "/a\\:([0-9]+):{s/i", "O:10:\"SolrObject\":\\1:{s"); } /* serialized object to serialized array */ PHP_SOLR_API int solr_sobject_to_sarray(solr_string_t *buffer) { return solr_pcre_replace_into_buffer(buffer, "/O:10:\"SolrObject\":([0-9]+):{s/i", "a:\\1:{s"); } /* }}} */ /* todo document and block this */ PHP_SOLR_API int solr_solrfunc_update_string(zval *obj, solr_char_t *key, int key_len, solr_char_t *value, int value_len) { solr_function_t *function; solr_string_t *string; #ifdef PHP_7 string = pemalloc(sizeof(solr_string_t), SOLR_FUNCTIONS_PERSISTENT); #endif memset(string, 0, sizeof(solr_string_t)); if (solr_fetch_function_entry(obj, &function) == FAILURE) { return FAILURE; } solr_string_set(string, (solr_char_t *)value, value_len); if (zend_hash_str_update_ptr(function->params, key, key_len, (void *)string) == NULL ) { solr_string_free(string); return FAILURE; } return SUCCESS; } PHP_SOLR_API int solr_solrfunc_fetch_string(zval *obj, solr_char_t *key, int key_len, solr_string_t **string) { solr_function_t *function; if (solr_fetch_function_entry(obj, &function) == FAILURE) { return FAILURE; } if ((*string = zend_hash_str_find_ptr(function->params, key, key_len)) == NULL) { return FAILURE; } return SUCCESS; } PHP_SOLR_API int solr_solrfunc_display_string(zval *obj, solr_char_t *key, int key_len, zval **return_value) { solr_string_t *field_string_ptr = NULL; memset(&field_string_ptr, 0, sizeof(solr_string_t *)); if (solr_solrfunc_fetch_string(obj, key, key_len, &field_string_ptr) == SUCCESS) { ZVAL_STRINGL(*return_value, field_string_ptr->str, field_string_ptr->len); return SUCCESS; } else { php_error_docref(NULL, E_ERROR, "Unable to fetch string"); return FAILURE; } } PHP_SOLR_API void solr_solrfunc_to_string(solr_function_t *function, solr_string_t **dest) { solr_string_t *buffer = *dest; solr_string_appends(buffer, (solr_char_t *)"{!", sizeof("{!")-1); solr_string_appends(buffer, function->name, function->name_length); solr_string_appendc(buffer, ' '); solr_string_t *value; zend_string *key; zend_ulong num_idx; ZEND_HASH_FOREACH_KEY_PTR(function->params, num_idx, key, value) { (void)num_idx; /* silent -Wunused-but-set-variable */ /* key is only maintained internally */ if (key) { solr_string_appends(buffer, key->val, key->len-1); } solr_string_appendc(buffer, '='); if (strpbrk(value->str, " ") != NULL && strpbrk(value->str,"'") == NULL) { solr_string_appendc(buffer, '\''); solr_string_append_solr_string (buffer, value); solr_string_appendc(buffer, '\''); } else { solr_string_append_solr_string (buffer, value); } solr_string_appendc(buffer, ' '); } ZEND_HASH_FOREACH_END(); solr_string_remove_last_char(buffer); solr_string_appendc(buffer, '}'); /* todo handle localParams argument */ } PHP_SOLR_API void solr_destroy_ustream_ex(solr_ustream_t *stream) { if (stream->content_info->filename.len > 0) { solr_string_free(&stream->content_info->filename); } pefree(stream->content_info, 0); pefree(stream, 0); } PHP_SOLR_API void solr_destroy_ustream_zv(zval *obj) { solr_ustream_t *entry = Z_PTR_P(obj); solr_destroy_ustream_ex(entry); } PHP_SOLR_API int solr_fetch_ustream_entry(zval *objptr, solr_ustream_t **stream_entry) { zval rv, *index_zv; zend_ulong index = 0; index_zv = zend_read_property(Z_OBJCE_P(objptr), OBJ_FOR_PROP(objptr), SOLR_INDEX_PROPERTY_NAME, sizeof(SOLR_INDEX_PROPERTY_NAME)-1, 1, &rv); index = Z_LVAL_P(index_zv); if ((*stream_entry = zend_hash_index_find_ptr(SOLR_GLOBAL(ustreams), index)) == NULL) { php_error_docref(NULL, E_WARNING, "Invalid Update Stream Index %ld. HashTable index does not exist.", index); php_error_docref(NULL, E_WARNING, SOLR_ERROR_1008_MSG, SOLR_FILE_LINE_FUNC); return FAILURE; } return SUCCESS; } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/solr_functions_params.c000066400000000000000000001312401374041537100235710ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #include "php_solr.h" PHP_SOLR_API int solr_init_params(solr_params_t *solr_params, long int index) { uint32_t nSize = SOLR_INITIAL_HASH_TABLE_SIZE; solr_params = (solr_params_t *)pemalloc( sizeof(solr_params_t), SOLR_PARAMS_PERSISTENT); memset(solr_params, 0, sizeof(solr_params_t)); if ((solr_params = zend_hash_index_update_ptr(SOLR_GLOBAL(params), index, (void *) solr_params)) == NULL) { php_error_docref(NULL, E_ERROR, "Error while registering query parameters in HashTable"); return FAILURE; } solr_params->params_index = index; solr_params->params_count = 0U; /* Allocated memory for the parameters HashTable using fast cache for HashTables */ ALLOC_HASHTABLE(solr_params->params); zend_hash_init(solr_params->params, nSize, NULL, (dtor_func_t) solr_destory_param_ht_dtor, SOLR_PARAMS_PERSISTENT); return SUCCESS; } /* {{{ PHP_SOLR_API void solr_destroy_params(zval *solr_params) */ PHP_SOLR_API void solr_destroy_params(zval *solr_params) { solr_params_t *params = (solr_params_t *) Z_PTR_P(solr_params); zend_hash_destroy(params->params); pefree(params->params, SOLR_PARAMS_PERSISTENT); pefree(params, SOLR_PARAMS_PERSISTENT); } /* }}} */ /* {{{ PHP_SOLR_API void solr_destroy_param(solr_param_t **param) */ PHP_SOLR_API void solr_destroy_param(solr_param_t **param) { solr_param_value_t *temp_ptr = NULL; solr_param_value_t *current_ptr = (*param)->head; while(current_ptr != NULL) { temp_ptr = current_ptr->next; (*param)->value_free_func(current_ptr); current_ptr = temp_ptr; } (*param)->head = NULL; (*param)->last = NULL; pefree((*param)->param_name, SOLR_PARAMS_PERSISTENT); (*param)->param_name = NULL; pefree((*param), SOLR_PARAMS_PERSISTENT); (*param) = NULL; } /* }}} */ PHP_SOLR_API void solr_destory_param_ht_dtor(zval *param_zv) { solr_param_t *param = (solr_param_t *) Z_PTR_P(param_zv); solr_destroy_param(¶m); } /* {{{ PHP_SOLR_API int solr_params_delete_param_value(solr_param_t *param, const solr_param_value_t *target_value) */ PHP_SOLR_API int solr_params_delete_param_value(solr_param_t *param, const solr_param_value_t *target_value) { solr_param_value_t *curr_value = param->head; int match_found = 0; if (!target_value) { php_error_docref(NULL, E_NOTICE, "Invalid pointer. Submitted target cannot be used for the delete search\n"); return FAILURE; } while(!match_found && curr_value != NULL) { match_found = param->value_equal_func(curr_value, target_value); /* If the target was found */ if (match_found) { /* If the target is not the head */ if (curr_value->prev) { curr_value->prev->next = curr_value->next; } else { param->head = curr_value->next; } /* If the target is not the tail */ if (curr_value->next) { curr_value->next->prev = curr_value->prev; } else { param->last = curr_value->prev; } /* Destroy target value */ param->value_free_func(curr_value); goto dpv_end; } curr_value = curr_value->next; } dpv_end : if (!match_found) { php_error_docref(NULL, E_NOTICE, "Target parameter value could not be found in '%s'. No value was deleted ", param->param_name); return FAILURE; } param->count--; /* Reduce the value count by one */ return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_params_insert_param_value(solr_param_t *param, solr_param_value_t *param_value) */ PHP_SOLR_API int solr_params_insert_param_value(solr_param_t *param, solr_param_value_t *param_value) { if (!param_value) { return FAILURE; } param_value->next = param_value->prev = NULL; if (!param->allow_multiple) { param->value_free_func(param->head); param->head = param_value; param->last = param_value; param->count = 1U; return SUCCESS; } if (param->head == NULL) { param->head = param_value; param->last = param_value; } else { param_value->prev = param->last; param->last->next = param_value; param->last = param_value; } param->count++; return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API solr_param_t *solr_create_new_param(const solr_char_t *param_name, size_t param_name_len, solr_param_type_t param_type, solr_bool allow_multiple, solr_param_value_equal_func_t value_equal_func, solr_param_fetch_func_t param_fetch_func, solr_param_value_free_func_t value_free_func, solr_char_t delimiter, solr_char_t arg_separator) */ PHP_SOLR_API solr_param_t *solr_create_new_param(const solr_char_t *param_name, size_t param_name_len, solr_param_type_t param_type, solr_bool allow_multiple, solr_param_value_equal_func_t value_equal_func, solr_param_fetch_func_t param_fetch_func, solr_param_value_free_func_t value_free_func, solr_char_t delimiter, solr_char_t arg_separator) { solr_param_t *query_param = (solr_param_t *) pemalloc(sizeof(solr_param_t), SOLR_PARAMS_PERSISTENT); /* Always initialize linked list containers to NULL. */ /* Member pointers may contain unallocated addresses */ /* This notice applies to all solr_param_t member pointers here */ memset(query_param, 0, sizeof(solr_param_t)); query_param->type = param_type; query_param->count = 0L; query_param->param_name = solr_strndup(param_name, param_name_len); query_param->param_name_length = param_name_len; query_param->allow_multiple = allow_multiple; query_param->head = query_param->last = NULL; query_param->value_equal_func = value_equal_func; query_param->fetch_func = param_fetch_func; query_param->value_free_func = value_free_func; query_param->delimiter = delimiter; query_param->arg_separator = arg_separator; return query_param; } /* }}} */ /* {{{ PHP_SOLR_API int solr_add_or_set_normal_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, zend_bool allow_multiple) parameter value addition functions */ PHP_SOLR_API int solr_add_or_set_normal_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, zend_bool allow_multiple) { solr_params_t *solr_params = NULL; HashTable *params = NULL; solr_param_type_t param_type = SOLR_PARAM_TYPE_NORMAL; solr_param_t *param = NULL; solr_param_value_t *parameter_value = NULL; if (!pname_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Invalid parameter name"); /* php_error_docref(NULL, E_ERROR, "Invalid parameter name"); */ return FAILURE; } if (!pvalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Invalid parameter value"); /* php_error_docref(NULL, E_ERROR, "Invalid parameter value"); */ return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params) == FAILURE) { php_error_docref(NULL, E_WARNING, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params = solr_params->params; if ((param = zend_hash_str_find_ptr(params, (char *) pname, pname_length)) != NULL) { parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.normal), pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); return SUCCESS; } param = solr_create_new_param(pname, pname_length, param_type, allow_multiple, solr_normal_param_value_equal, (solr_param_fetch_func_t) solr_normal_param_value_fetch, solr_normal_param_value_free, '&', 0); parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.normal), pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); if (zend_hash_str_add_ptr(params, pname, pname_length, (void *) param) == NULL) { php_error_docref(NULL, E_ERROR, "Error from %s %s=%s", __func__, (char *) pname, pvalue); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_add_simple_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length) */ PHP_SOLR_API int solr_add_simple_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length) { zend_bool allow_multiple = 1; /* This value type by definition allows multiple. add parameters can be added more than once */ solr_params_t *solr_params = NULL; HashTable *params = NULL; solr_param_type_t param_type = SOLR_PARAM_TYPE_SIMPLE_LIST; solr_param_t *param = NULL; solr_param_value_t *parameter_value = NULL; if (!pname_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Invalid parameter value"); return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params) == FAILURE) { php_error_docref(NULL, E_ERROR, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params = solr_params->params; if ((param = zend_hash_str_find_ptr(params, pname, pname_length)) != NULL) { parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.simple_list), pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); return SUCCESS; } param = solr_create_new_param(pname, pname_length, param_type, allow_multiple, solr_simple_list_param_value_equal, (solr_param_fetch_func_t) solr_simple_list_param_value_fetch, solr_simple_list_param_value_free, ',', 0); parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.simple_list), pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); if (zend_hash_str_add_ptr(params, pname, pname_length, (void *) param) == NULL) { php_error_docref(NULL, E_ERROR, "Error from %s %s=%s", __func__, (char *) pname, pvalue); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_add_simple_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length) */ PHP_SOLR_API int solr_add_simple_list_param_ex(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length,solr_char_t *separator) { zend_bool allow_multiple = 1; /* This value type by definition allows multiple. add parameters can be added more than once */ solr_params_t *solr_params = NULL; HashTable *params = NULL; solr_param_type_t param_type = SOLR_PARAM_TYPE_SIMPLE_LIST; solr_param_t *param = NULL; solr_param_value_t *parameter_value = NULL; if (!pname_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Invalid parameter value"); return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params) == FAILURE) { php_error_docref(NULL, E_ERROR, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params = solr_params->params; if ((param = zend_hash_str_find_ptr(params, pname, pname_length)) != NULL) { parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.simple_list), pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); return SUCCESS; } param = solr_create_new_param(pname, pname_length, param_type, allow_multiple, solr_simple_list_param_value_equal, (solr_param_fetch_func_t) solr_simple_list_param_value_fetch, solr_simple_list_param_value_free, *separator, 0); parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.simple_list), pvalue, pvalue_length); solr_params_insert_param_value(param, parameter_value); if (zend_hash_str_add_ptr(params, pname, pname_length, (void *) param) == NULL) { php_error_docref(NULL, E_ERROR, "Error from %s %s=%s", __func__, (char *) pname, pvalue); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_add_arg_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t delimiter, solr_char_t arg_separator) */ PHP_SOLR_API int solr_add_arg_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t delimiter, solr_char_t arg_separator) { zend_bool allow_multiple = 1; /* This value type by definition allows multiple */ solr_params_t *solr_params = NULL; solr_param_type_t param_type = SOLR_PARAM_TYPE_ARG_LIST; solr_param_t *param = NULL; /* holds a pointer to the param structure e.g. sort */ solr_param_value_t *parameter_value = NULL; HashTable *params = NULL; if (!pname_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Invalid parameter value"); return FAILURE; } /* if (!avalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Invalid argument value"); return FAILURE; } */ if (solr_fetch_params_entry(objptr, &solr_params) == FAILURE) { php_error_docref(NULL, E_WARNING, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params = solr_params->params; /* if parameter exists add the new value argument(param_value) */ if ((param = zend_hash_str_find_ptr(params, pname, pname_length)) != NULL) { parameter_value = create_parameter_value_arg_list(pvalue, pvalue_length, avalue, avalue_length, "", 0); solr_params_insert_param_value(param, parameter_value); return SUCCESS; } param = solr_create_new_param(pname, pname_length, param_type, allow_multiple, solr_arg_list_param_value_equal, (solr_param_fetch_func_t) solr_arg_list_param_value_fetch, solr_arg_list_param_value_free, delimiter, arg_separator); parameter_value = create_parameter_value_arg_list(pvalue, pvalue_length, avalue, avalue_length, (solr_char_t*)"", 0); solr_params_insert_param_value(param, parameter_value); if (zend_hash_str_add_ptr(params, pname, pname_length, (void *) param) == NULL) { php_error_docref(NULL, E_ERROR, "Error from %s %s=%s", __func__, (char *) pname, pvalue); return FAILURE; } return SUCCESS; } /* }}} */ PHP_SOLR_API solr_param_value_t* create_parameter_value_arg_list(solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t *delimiter_override, solr_bool delimiter_overriden) { solr_param_value_t *parameter_value = NULL; parameter_value = (solr_param_value_t *) pemalloc(sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); memset(parameter_value, 0, sizeof(solr_param_value_t)); solr_string_appends(&(parameter_value->contents.arg_list.value), pvalue, pvalue_length); solr_string_appends(&(parameter_value->contents.arg_list.arg), avalue, avalue_length); if(delimiter_overriden){ parameter_value->contents.arg_list.delimiter_override = solr_strndup(delimiter_override, sizeof(delimiter_override)); parameter_value->contents.arg_list.delimiter_overriden = delimiter_overriden; } return parameter_value; } PHP_SOLR_API int solr_add_arg_list_param_ex(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t delimiter, solr_char_t arg_separator, solr_char_t delimiter_override) { zend_bool allow_multiple = 1; /* This value type by definition allows multiple */ solr_params_t *solr_params = NULL; solr_param_type_t param_type = SOLR_PARAM_TYPE_ARG_LIST; solr_param_t *param = NULL; /* holds a pointer to the param structure e.g. sort */ solr_param_value_t *parameter_value = NULL; HashTable *params = NULL; if (!pname_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Invalid parameter value"); return FAILURE; } /* * commented for the favor of having empty value if (!avalue_length) { solr_throw_exception_ex(solr_ce_SolrIllegalArgumentException, SOLR_ERROR_4000, SOLR_FILE_LINE_FUNC, "Invalid argument value"); return FAILURE; } */ if (solr_fetch_params_entry(objptr, &solr_params) == FAILURE) { php_error_docref(NULL, E_WARNING, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params = solr_params->params; /* if parameter exists add the new value argument(param_value) */ if ((param = zend_hash_str_find_ptr(params, pname, pname_length)) != NULL) { parameter_value = create_parameter_value_arg_list(pvalue, pvalue_length, avalue, avalue_length, &delimiter_override, 1); solr_params_insert_param_value(param, parameter_value); return SUCCESS; } param = solr_create_new_param(pname, pname_length, param_type, allow_multiple, solr_arg_list_param_value_equal, (solr_param_fetch_func_t) solr_arg_list_param_value_fetch, solr_arg_list_param_value_free, delimiter, arg_separator); parameter_value = create_parameter_value_arg_list(pvalue, pvalue_length, avalue, avalue_length, &delimiter_override, 1); solr_params_insert_param_value(param, parameter_value); if (zend_hash_str_add_ptr(params, pname, pname_length, (void *) param) == NULL) { php_error_docref(NULL, E_ERROR, "Error from %s %s=%s", __func__, (char *) pname, pvalue); return FAILURE; } return SUCCESS; } /* {{{ Parameter value EQUALITY FUNCTIONS */ /* {{{ PHP_SOLR_API int solr_normal_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b) */ PHP_SOLR_API int solr_normal_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b) { return solr_string_equal(&(a->contents.normal), &(b->contents.normal)); } /* }}} */ /* {{{ PHP_SOLR_API int solr_simple_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b) */ PHP_SOLR_API int solr_simple_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b) { return solr_string_equal(&(a->contents.simple_list), &(b->contents.simple_list)); } /* }}} */ /* {{{ PHP_SOLR_API int solr_arg_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b) */ PHP_SOLR_API int solr_arg_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b) { return solr_string_equal(&(a->contents.arg_list.value), &(b->contents.arg_list.value)); } /* }}} */ /* }}} */ /* {{{ Parameter values retrieval functions */ /* {{{ PHP_SOLR_API void solr_normal_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer) */ PHP_SOLR_API void solr_normal_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer) { zend_string *url_encoded_param_value; solr_param_value_t *current_ptr = solr_param->head; solr_char_t glue = '&'; if (!solr_param->allow_multiple) { url_encoded_param_value = php_raw_url_encode((char *) current_ptr->contents.normal.str, current_ptr->contents.normal.len); solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); solr_string_appends(buffer, url_encoded_param_value->val, url_encoded_param_value->len); zend_string_free(url_encoded_param_value); } else { zend_ulong n_loops = solr_param->count - 1; while(n_loops) { url_encoded_param_value = NULL; url_encoded_param_value = php_raw_url_encode(current_ptr->contents.normal.str, current_ptr->contents.normal.len); solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); solr_string_appends(buffer, url_encoded_param_value->val, url_encoded_param_value->len); zend_string_release(url_encoded_param_value); solr_string_appendc(buffer, glue); n_loops--; current_ptr = current_ptr->next; } url_encoded_param_value = NULL; url_encoded_param_value = php_raw_url_encode(current_ptr->contents.normal.str, current_ptr->contents.normal.len); solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); solr_string_appends(buffer, url_encoded_param_value->val, url_encoded_param_value->len); zend_string_free(url_encoded_param_value); } } /* }}} */ /* {{{ PHP_SOLR_API void solr_simple_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer) */ PHP_SOLR_API void solr_simple_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer) { solr_param_value_t *current_ptr = solr_param->head; solr_char_t list_delimiter = ','; /* Comma 0x2C */ zend_ulong n_loops = solr_param->count - 1; auto solr_string_t tmp_buffer; zend_string *url_encoded_list = NULL; solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); memset(&tmp_buffer, 0, sizeof(solr_string_t)); while(n_loops) { solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.simple_list)); solr_string_appendc(&tmp_buffer, list_delimiter); n_loops--; current_ptr = current_ptr->next; } solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.simple_list)); url_encoded_list = php_raw_url_encode(tmp_buffer.str, tmp_buffer.len); solr_string_appends(buffer, url_encoded_list->val, url_encoded_list->len); zend_string_release(url_encoded_list); url_encoded_list = NULL; solr_string_free(&tmp_buffer); } /* }}} */ /* {{{ PHP_SOLR_API void solr_arg_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer) */ PHP_SOLR_API void solr_arg_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer) { solr_param_value_t *current_ptr = solr_param->head; solr_char_t list_delimiter = solr_param->delimiter; solr_char_t separator = solr_param->arg_separator; zend_ulong n_loops = solr_param->count - 1; solr_string_t tmp_buffer; zend_string *url_encoded_list = NULL; solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); memset(&tmp_buffer, 0, sizeof(solr_string_t)); while(n_loops) { solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.value)); if (current_ptr->contents.arg_list.delimiter_override && *current_ptr->contents.arg_list.delimiter_override) { solr_string_appendc(&tmp_buffer, *current_ptr->contents.arg_list.delimiter_override); } else { solr_string_appendc(&tmp_buffer, separator); } solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.arg)); solr_string_appendc(&tmp_buffer, list_delimiter); n_loops--; current_ptr = current_ptr->next; } solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.value)); if (current_ptr->contents.arg_list.delimiter_override && *current_ptr->contents.arg_list.delimiter_override) { solr_string_appendc(&tmp_buffer, *current_ptr->contents.arg_list.delimiter_override); } else { solr_string_appendc(&tmp_buffer, separator); } solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.arg)); url_encoded_list = php_raw_url_encode(tmp_buffer.str, tmp_buffer.len); solr_string_appends(buffer, url_encoded_list->val, url_encoded_list->len); zend_string_release(url_encoded_list); url_encoded_list = NULL; solr_string_free(&tmp_buffer); } /* }}} */ /* }}} */ /* {{{ Parameter retrieval functions. Only used for display. */ /* {{{ PHP_SOLR_API void solr_normal_param_value_display_string(solr_param_t *solr_param, zval *param_value) */ PHP_SOLR_API void solr_normal_param_value_display_string(solr_param_t *solr_param, zval *param_value) { solr_param_value_t *current_ptr = solr_param->head; ZVAL_STRINGL(param_value, current_ptr->contents.normal.str, current_ptr->contents.normal.len); } /* }}} */ /* {{{ PHP_SOLR_API void solr_normal_param_value_display_integer(solr_param_t *solr_param, zval *param_value) */ PHP_SOLR_API void solr_normal_param_value_display_integer(solr_param_t *solr_param, zval *param_value) { solr_param_value_t *current_ptr = solr_param->head; long int return_value = atol(current_ptr->contents.normal.str); ZVAL_LONG(param_value, return_value); } /* }}} */ /* {{{ PHP_SOLR_API void solr_normal_param_value_display_double(solr_param_t *solr_param, zval *param_value) */ PHP_SOLR_API void solr_normal_param_value_display_double(solr_param_t *solr_param, zval *param_value) { solr_param_value_t *current_ptr = solr_param->head; double return_value = zend_strtod(current_ptr->contents.normal.str, (const char **) NULL); ZVAL_DOUBLE(param_value, return_value); } /* }}} */ /* Checks if current_ptr->contents.normal.str matches str_const */ #define solr_npvdb_strcmp(str_const) (0 == strcmp(str_const, current_ptr->contents.normal.str)) /* {{{ PHP_SOLR_API void solr_normal_param_value_display_boolean(solr_param_t *solr_param, zval *param_value) */ PHP_SOLR_API void solr_normal_param_value_display_boolean(solr_param_t *solr_param, zval *param_value) { solr_param_value_t *current_ptr = solr_param->head; zend_bool return_value = (zend_bool) (solr_npvdb_strcmp("true") || solr_npvdb_strcmp("on") ); ZVAL_BOOL(param_value, return_value); } /* }}} */ /* {{{ PHP_SOLR_API void solr_normal_param_value_display_sort_type(solr_param_t *solr_param, zval *param_value) */ PHP_SOLR_API void solr_normal_param_value_display_sort_type(solr_param_t *solr_param, zval *param_value) { solr_param_value_t *current_ptr = solr_param->head; long int return_value = (long int) (solr_npvdb_strcmp("count")); ZVAL_LONG(param_value, return_value); } /* }}} */ /* {{{ PHP_SOLR_API void solr_normal_param_value_display(solr_param_t *solr_param, zval *param_value_array) */ PHP_SOLR_API void solr_normal_param_value_display(solr_param_t *solr_param, zval *param_value_array) { solr_param_value_t *current_ptr = solr_param->head; while (current_ptr != NULL) { add_next_index_stringl(param_value_array, current_ptr->contents.normal.str, current_ptr->contents.normal.len); current_ptr = current_ptr->next; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_simple_list_param_value_display(solr_param_t *solr_param, zval *param_value_array) */ PHP_SOLR_API void solr_simple_list_param_value_display(solr_param_t *solr_param, zval *param_value_array) { solr_param_value_t *current_ptr = solr_param->head; while (current_ptr != NULL) { add_next_index_stringl(param_value_array, current_ptr->contents.simple_list.str, current_ptr->contents.simple_list.len); current_ptr = current_ptr->next; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_arg_list_param_value_display(solr_param_t *solr_param, zval *param_value_array) */ PHP_SOLR_API void solr_arg_list_param_value_display(solr_param_t *solr_param, zval *param_value_array) { solr_param_value_t *current_ptr = solr_param->head; while (current_ptr != NULL) { solr_string_t tmp_buffer; memset(&tmp_buffer, 0, sizeof(solr_string_t)); solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.value)); solr_string_appendc(&tmp_buffer, solr_param->arg_separator); solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.arg)); add_next_index_stringl(param_value_array, tmp_buffer.str, tmp_buffer.len); solr_string_free(&tmp_buffer); current_ptr = current_ptr->next; } } /* }}} */ /* }}} */ /* {{{ Parameter retrieval functions. Only used for toString() */ /* {{{ PHP_SOLR_API void solr_normal_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode) */ PHP_SOLR_API void solr_normal_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode) { solr_param_value_t *current_ptr = solr_param->head; solr_char_t glue = '&'; if (!solr_param->allow_multiple) { zend_string *url_encoded_param_value = NULL; if (url_encode) { url_encoded_param_value = php_raw_url_encode((char *) current_ptr->contents.normal.str, current_ptr->contents.normal.len); } else { url_encoded_param_value = zend_string_init(current_ptr->contents.normal.str, current_ptr->contents.normal.len, 0); } solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); solr_string_appends(buffer, url_encoded_param_value->val, url_encoded_param_value->len); zend_string_release(url_encoded_param_value); } else { zend_ulong n_loops = solr_param->count - 1; zend_string *url_encoded_param_value = NULL; while(n_loops) { if (url_encode) { url_encoded_param_value = php_raw_url_encode(current_ptr->contents.normal.str, current_ptr->contents.normal.len); } else { url_encoded_param_value = zend_string_init(current_ptr->contents.normal.str, current_ptr->contents.normal.len, 0); } solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); solr_string_appends(buffer, url_encoded_param_value->val, url_encoded_param_value->len); zend_string_free(url_encoded_param_value); url_encoded_param_value = NULL; solr_string_appendc(buffer, glue); n_loops--; current_ptr = current_ptr->next; } if (url_encode) { url_encoded_param_value = php_raw_url_encode(current_ptr->contents.normal.str, current_ptr->contents.normal.len); } else { url_encoded_param_value = zend_string_init(current_ptr->contents.normal.str, current_ptr->contents.normal.len, 0); } solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); solr_string_appends(buffer, url_encoded_param_value->val, url_encoded_param_value->len); zend_string_free(url_encoded_param_value); url_encoded_param_value = NULL; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_simple_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode) */ PHP_SOLR_API void solr_simple_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode) { solr_param_value_t *current_ptr = solr_param->head; solr_char_t list_delimiter = solr_param->delimiter; /* Comma 0x2C */ zend_ulong n_loops = solr_param->count - 1; auto solr_string_t tmp_buffer; zend_string *url_encoded_list = NULL; solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); memset(&tmp_buffer, 0, sizeof(solr_string_t)); while(n_loops) { solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.simple_list)); solr_string_appendc(&tmp_buffer, list_delimiter); n_loops--; current_ptr = current_ptr->next; } solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.simple_list)); if (url_encode) { url_encoded_list = php_raw_url_encode(tmp_buffer.str, tmp_buffer.len); } else { url_encoded_list = zend_string_init(tmp_buffer.str, tmp_buffer.len, 0); } solr_string_appends(buffer, url_encoded_list->val, url_encoded_list->len); zend_string_free(url_encoded_list); url_encoded_list = NULL; solr_string_free(&tmp_buffer); } /* }}} */ /* {{{ PHP_SOLR_API void solr_arg_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode) */ PHP_SOLR_API void solr_arg_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode) { solr_param_value_t *current_ptr = solr_param->head; solr_char_t list_delimiter = solr_param->delimiter; solr_char_t separator = solr_param->arg_separator; zend_ulong n_loops = solr_param->count - 1; solr_string_t tmp_buffer; zend_string *url_encoded_list = NULL; solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); solr_string_appendc(buffer, '='); memset(&tmp_buffer, 0, sizeof(solr_string_t)); while(n_loops) { solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.value)); if(current_ptr->contents.arg_list.delimiter_overriden) { if(strlen(current_ptr->contents.arg_list.delimiter_override) > 0) { solr_string_appendc(&tmp_buffer, (*current_ptr->contents.arg_list.delimiter_override)); } }else{ solr_string_appendc(&tmp_buffer, separator); } solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.arg)); solr_string_appendc(&tmp_buffer, list_delimiter); n_loops--; current_ptr = current_ptr->next; } /* process last parameter value */ solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.value)); /* check for separator override */ if(current_ptr->contents.arg_list.delimiter_overriden) { if(strlen(current_ptr->contents.arg_list.delimiter_override) > 0) { solr_string_appendc(&tmp_buffer, (*current_ptr->contents.arg_list.delimiter_override)); } }else{ solr_string_appendc(&tmp_buffer, separator); } solr_string_append_solr_string(&tmp_buffer, &(current_ptr->contents.arg_list.arg)); if (url_encode) { url_encoded_list = php_raw_url_encode(tmp_buffer.str, tmp_buffer.len); } else { url_encoded_list = zend_string_init(tmp_buffer.str, tmp_buffer.len, 0); } solr_string_appends(buffer, url_encoded_list->val, url_encoded_list->len); zend_string_free(url_encoded_list); url_encoded_list = NULL; solr_string_free(&tmp_buffer); } /* }}} */ /* }}} */ /* {{{ Memory deallocation functions for parameter values */ /* {{{ PHP_SOLR_API void solr_normal_param_value_free(solr_param_value_t *param_value) */ PHP_SOLR_API void solr_normal_param_value_free(solr_param_value_t *param_value) { if (param_value) { solr_string_free(&(param_value->contents.normal)); pefree(param_value, SOLR_PARAMS_PERSISTENT); param_value = NULL; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_simple_list_param_value_free(solr_param_value_t *param_value) */ PHP_SOLR_API void solr_simple_list_param_value_free(solr_param_value_t *param_value) { if (param_value) { solr_string_free(&(param_value->contents.simple_list)); pefree(param_value, SOLR_PARAMS_PERSISTENT); param_value = NULL; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_arg_list_param_value_free(solr_param_value_t *param_value) */ PHP_SOLR_API void solr_arg_list_param_value_free(solr_param_value_t *param_value) { if (param_value) { solr_string_free(&(param_value->contents.arg_list.value)); solr_string_free(&(param_value->contents.arg_list.arg)); if(param_value->contents.arg_list.delimiter_override != NULL){ efree(param_value->contents.arg_list.delimiter_override); } pefree(param_value, SOLR_PARAMS_PERSISTENT); param_value = NULL; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_set_return_solr_params_object(zval *return_value_ptr, zval *current_objptr) */ PHP_SOLR_API void solr_set_return_solr_params_object(zval *return_value_ptr, zval *current_objptr) { #ifdef PHP_7 ZVAL_COPY(return_value_ptr, current_objptr); #else zval_ptr_dtor(return_value_ptr); ZVAL_MAKE_REF(current_objptr); Z_ADDREF_P(current_objptr); return_value_ptr = current_objptr; #endif } /* }}} */ /* {{{ PHP_SOLR_API int solr_delete_solr_parameter(zval *objptr, solr_char_t *name, int name_length) */ PHP_SOLR_API int solr_delete_solr_parameter(zval *objptr, solr_char_t *name, int name_length) { solr_params_t *solr_params = NULL; HashTable *params_ht = NULL; if (solr_fetch_params_entry(objptr, &solr_params) == FAILURE) { php_error_docref(NULL, E_ERROR, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params_ht = solr_params->params; if (zend_hash_str_del(params_ht, name, name_length) == FAILURE) { php_error_docref(NULL, E_NOTICE, "parameter '%s' was not set. Attempting to remove an undefined parameter.", name); return FAILURE; } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_delete_normal_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length) */ PHP_SOLR_API int solr_delete_normal_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length) { solr_params_t *solr_params = NULL; HashTable *params_ht = NULL; solr_param_t *param_ptr = NULL; solr_param_value_t *target_value = NULL; if (!pname_length) { php_error_docref(NULL, E_ERROR, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { php_error_docref(NULL, E_ERROR, "Invalid parameter value"); return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params) == FAILURE) { php_error_docref(NULL, E_ERROR, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params_ht = solr_params->params; if ((param_ptr = zend_hash_str_find_ptr(params_ht, pname, pname_length)) == NULL) { php_error_docref(NULL, E_WARNING, "parameter could not be retrieved from HashTable"); return FAILURE; } target_value = (solr_param_value_t *) pecalloc(1, sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); solr_string_appends(&(target_value->contents.normal), pvalue, pvalue_length); solr_params_delete_param_value(param_ptr, target_value); /* We are done with target_value. */ param_ptr->value_free_func(target_value); if (param_ptr->count < 1U) { zend_hash_str_del(params_ht, pname, pname_length); #if SOLR_DEBUG php_error_docref(NULL, E_NOTICE, "Deleted last value from parameter. Removing parameter '%s' from object instance.", pname); #endif } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_delete_simple_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length) */ PHP_SOLR_API int solr_delete_simple_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length) { solr_params_t *solr_params = NULL; solr_param_t *param_ptr = NULL; HashTable *params_ht = NULL; solr_param_value_t *target_value = NULL; if (!pname_length) { php_error_docref(NULL, E_ERROR, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { php_error_docref(NULL, E_ERROR, "Invalid parameter value"); return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params) == FAILURE) { php_error_docref(NULL, E_ERROR, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params_ht = solr_params->params; if ((param_ptr = zend_hash_str_find_ptr(params_ht, pname, pname_length)) == NULL) { php_error_docref(NULL, E_WARNING, "parameter could not be retrieved from HashTable"); return FAILURE; } target_value = (solr_param_value_t *) pecalloc(1, sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); solr_string_appends(&(target_value->contents.simple_list), pvalue, pvalue_length); solr_params_delete_param_value(param_ptr, target_value); /* We are done with target_value. */ param_ptr->value_free_func(target_value); if (param_ptr->count < 1U) { zend_hash_str_del(params_ht, pname, pname_length); #if SOLR_DEBUG php_error_docref(NULL, E_NOTICE, "Deleted last value from parameter. Removing parameter '%s' from object instance.", pname); #endif } return SUCCESS; } /* }}} */ /* {{{ PHP_SOLR_API int solr_delete_arg_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length) */ PHP_SOLR_API int solr_delete_arg_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length) { solr_params_t *solr_params = NULL; HashTable *params_ht = NULL; solr_param_t *param_ptr = NULL; solr_param_value_t *target_value = NULL; if (!pname_length) { php_error_docref(NULL, E_ERROR, "Invalid parameter name"); return FAILURE; } if (!pvalue_length) { php_error_docref(NULL, E_ERROR, "Invalid parameter value"); return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params) == FAILURE) { php_error_docref(NULL, E_WARNING, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params_ht = solr_params->params; if ((param_ptr = zend_hash_str_find_ptr(params_ht, pname, pname_length)) == NULL) { php_error_docref(NULL, E_WARNING, "parameter could not be retrieved from HashTable"); return FAILURE; } target_value = (solr_param_value_t *) pecalloc(1, sizeof(solr_param_value_t), SOLR_PARAMS_PERSISTENT); solr_string_appends(&(target_value->contents.arg_list.value), pvalue, pvalue_length); solr_params_delete_param_value(param_ptr, target_value); /* We are done with target_value. */ param_ptr->value_free_func(target_value); if (param_ptr->count < 1U) { zend_hash_str_del(params_ht, pname, pname_length); #if SOLR_DEBUG php_error_docref(NULL, E_NOTICE, "Deleted last value from parameter. Removing parameter '%s' from object instance.", pname); #endif } return SUCCESS; } /* }}} */ /* }}} */ /* {{{ PHP_SOLR_API int solr_param_find(zval *objptr, solr_char_t *pname, int pname_length, solr_param_t **solr_param) */ PHP_SOLR_API int solr_param_find(zval *objptr, solr_char_t *pname, int pname_length, solr_param_t **solr_param) { solr_params_t *solr_params = NULL; HashTable *params_ht = NULL; solr_param_t *solr_param_tmp = NULL; if (!pname_length) { php_error_docref(NULL, E_ERROR, "Invalid parameter name"); return FAILURE; } if (solr_fetch_params_entry(objptr, &solr_params) == FAILURE) { php_error_docref(NULL, E_ERROR, "SolrParams instance could not be retrieved from HashTable"); return FAILURE; } params_ht = solr_params->params; if ((solr_param_tmp = zend_hash_str_find_ptr(params_ht, pname, pname_length)) == NULL) { return FAILURE; } (*solr_param) = solr_param_tmp; return SUCCESS; } /* }}} */ PHP_SOLR_API solr_string_t solr_params_to_string(solr_params_t * solr_params, zend_bool url_encode) { HashTable *params = solr_params->params; solr_string_t tmp_buffer; memset(&tmp_buffer, 0, sizeof(solr_string_t)); SOLR_HASHTABLE_FOR_LOOP(params) { solr_param_t *solr_param_ptr = NULL; solr_param_tostring_func_t tostring_func = NULL; solr_param_ptr = zend_hash_get_current_data_ptr(params); switch(solr_param_ptr->type) { case SOLR_PARAM_TYPE_NORMAL : tostring_func = solr_normal_param_value_tostring; break; case SOLR_PARAM_TYPE_SIMPLE_LIST : tostring_func = solr_simple_list_param_value_tostring; break; case SOLR_PARAM_TYPE_ARG_LIST : tostring_func = solr_arg_list_param_value_tostring; break; default : php_error_docref(NULL, E_WARNING, "Invalid parameter type"); } tostring_func(solr_param_ptr, &(tmp_buffer), url_encode); solr_string_appendc(&(tmp_buffer), '&'); } if (tmp_buffer.str && tmp_buffer.len) { solr_string_remove_last_char(&(tmp_buffer)); } return tmp_buffer; } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/solr_functions_response.c000066400000000000000000000070501374041537100241450ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Israel Ekpo | +----------------------------------------------------------------------+ */ #include "php_solr.h" /* Used to set the properties of the SolrResponse instance after a call to the server */ /* {{{ PHP_SOLR_API void solr_set_response_object_properties(zend_class_entry *scope, zval *response_object, const solr_client_t *client, const solr_string_t *request_url, zend_bool success) */ PHP_SOLR_API void solr_set_response_object_properties(zend_class_entry *scope, zval *response_object, const solr_client_t *client, const solr_string_t *request_url, zend_bool success) { const solr_curl_t *handle = &(client->handle); const solr_string_t *raw_request_headers = &(handle->request_header.buffer); const solr_string_t *raw_request = &(handle->request_body_debug.buffer); const solr_string_t *raw_response_headers = &(handle->response_header.buffer); const solr_string_t *raw_response = &(handle->response_body.buffer); const solr_string_t *response_writer = &(client->options.response_writer); long int http_status = handle->response_header.response_code; zend_update_property_long(scope, OBJ_FOR_PROP(response_object), "http_status", sizeof("http_status")-1, http_status); zend_update_property_bool(scope, OBJ_FOR_PROP(response_object), "success", sizeof("success")-1, success); if (response_writer->str) { zend_update_property_stringl(scope, OBJ_FOR_PROP(response_object), "response_writer", sizeof("response_writer")-1, (char *)response_writer->str, response_writer->len); } if (request_url->str) { zend_update_property_stringl(scope, OBJ_FOR_PROP(response_object), "http_request_url", sizeof("http_request_url")-1, (char *)request_url->str, request_url->len); } if (raw_request_headers->str) { zend_update_property_stringl(scope, OBJ_FOR_PROP(response_object), "http_raw_request_headers", sizeof("http_raw_request_headers")-1, (char *)raw_request_headers->str, raw_request_headers->len); } if (raw_request->str) { zend_update_property_stringl(scope, OBJ_FOR_PROP(response_object), "http_raw_request", sizeof("http_raw_request")-1, (char *)raw_request->str, raw_request->len); } if (raw_response_headers->str) { zend_update_property_stringl(scope, OBJ_FOR_PROP(response_object), "http_raw_response_headers", sizeof("http_raw_response_headers")-1, (char *)raw_response_headers->str, raw_response_headers->len); } if (raw_response->str) { zend_update_property_stringl(scope, OBJ_FOR_PROP(response_object), "http_raw_response", sizeof("http_raw_response")-1, (char *)raw_response->str, raw_response->len); } } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: t * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/solr_macros.h000066400000000000000000000167301374041537100215150ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #ifndef SOLR_MACROS_H #define SOLR_MACROS_H #include /* Macros for Object constructors and destructors declaration */ #define SOLR_CTOR(class_name, func_name, arginfo) PHP_ME(class_name, func_name, arginfo, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) #define SOLR_DTOR(class_name, func_name, arginfo) PHP_ME(class_name, func_name, arginfo, ZEND_ACC_PUBLIC) /* Retrieve a unique hash index for this SolrDocument. Unique for this thread */ #define SOLR_UNIQUE_DOCUMENT_INDEX() solr_hashtable_get_new_index(SOLR_GLOBAL(documents)) /* Retrieve a unique hash index for this SolrClient. Unique for this thread */ #define SOLR_UNIQUE_CLIENT_INDEX() solr_hashtable_get_new_index(SOLR_GLOBAL(clients)) /* Retrieve a unique hash index for this SolrParams instance. Unique for this thread */ #define SOLR_UNIQUE_PARAMS_INDEX() solr_hashtable_get_new_index(SOLR_GLOBAL(params)) /* Retrieve a unique hash index for this SolrFunction instance. Unique for this thread */ #define SOLR_UNIQUE_FUNCTION_INDEX() solr_hashtable_get_new_index(SOLR_GLOBAL(functions)) /* Retrieve a unique hash index for this update stream instances. Unique for this thread */ #define SOLR_UNIQUE_USTREAM_INDEX() solr_hashtable_get_new_index(SOLR_GLOBAL(ustreams)) /* Iterates through the HashTable pointer */ #define SOLR_HASHTABLE_FOR_LOOP(HashTablePtr) \ if (HashTablePtr) for ( zend_hash_internal_pointer_reset((HashTablePtr)); \ SUCCESS == zend_hash_has_more_elements((HashTablePtr)); \ zend_hash_move_forward((HashTablePtr)) ) #define SOLR_HASHTABLE_FOR_LOOP_EX(HashTablePtr, pos) \ if (HashTablePtr) for ( zend_hash_internal_pointer_reset_ex(HashTablePtr, &pos); \ SUCCESS == zend_hash_has_more_elements_ex((HashTablePtr), &pos); \ zend_hash_move_forward_ex((HashTablePtr), &pos) ) #define SOLR_HASH_FOREACH_PTR(HashTablePtr, ptr) \ if (HashTablePtr) ZEND_HASH_FOREACH_PTR(HashTablePtr, ptr) #define SOLR_HASH_FOREACH_END() \ ZEND_HASH_FOREACH_END() /* Gets a random number between 1 and SHRT_MAX */ #define SOLR_GET_RANDOM_NUMBER() abs(rand() % SHRT_MAX + 1) /* {{{ Memory Allocation Macros */ /* Used only to release truly persistent allocations */ #define SOLR_FREE_PTR(ptr) { if (ptr != NULL) { pefree(ptr,SOLR_HASHTABLE_PERSISTENT); ptr = NULL; } else { printf("\nSOLR_FREE_PTR double free() from function %s() called in %s on line %d\n", __func__, __FILE__, __LINE__); } } /* }}} */ /** * Used to retrieve xmlAttr and xmlNode values * * At this time, I am not sure if the next and previous sibling links * are guaranteed to be document order 100% of the time. * This is why I am requiring matches for the attribute and element names before * copying values from the attributes or element nodes. * Since I am not 100%, I believe it is better to be safe than sorry. * There may be a slight performance hit but at least correctness is guaranteed. */ #define solr_xml_match_node(solrXmlNode, solrXmlNodeName) ( \ xmlStrEqual(solrXmlNode->name, (xmlChar *) solrXmlNodeName) && \ solrXmlNode->children && solrXmlNode->children->content ) /* Checks if children is a valid struct */ #define solr_xml_child_content_is_valid(solrXmlNode) (solrXmlNode && solrXmlNode->children) /* Checks to prevent segmentation fault. Ensures that children is a valid struct before attempting to get content */ #define solr_xml_get_node_contents(solrXmlNode) (solr_xml_child_content_is_valid(solrXmlNode)? (solrXmlNode->children->content) : ((xmlChar *) "")) #define solr_xml_get_node_contents_int(solrXmlNode) atoi((char *)solr_xml_get_node_contents(solrXmlNode)) #define solr_xml_get_node_contents_double(solrXmlNode) xmlXPathCastStringToNumber(solr_xml_get_node_contents(solrXmlNode)) /* hack for optional value modifier */ #define solr_document_insert_field_value(queue, field_value, field_boost, ...) solr_document_insert_field_value_ex( queue, field_value, field_boost, (0, ##__VA_ARGS__)) /** * Used to manage SolrQuery parameters that allow overrides by field name. * * Many parameters may be overridden on a per-field basis with the following syntax * * f..= * f..= * * @buf pointer to a solr_string_t object * @fname field name * @fname_len length of the field name * @pname a string constant representing the name of the parameter. */ #define solr_query_field_override(buf, fname, fname_len, pname) { \ if ((fname_len)) { \ solr_string_append_const((buf), "f."); \ solr_string_appends((buf), (fname), (fname_len)); \ solr_string_appendc((buf), '.'); \ } \ solr_string_append_const((buf), (pname)); \ } /* Macro for returning SolrParams objects if requested */ #define solr_return_solr_params_object() { \ solr_set_return_solr_params_object(return_value, getThis()); \ } /* client macros */ #define SOLR_RESPONSE_CODE_BODY (client->handle.response_header.response_code), (client->handle.response_body.buffer.str) #define SOLR_SHOW_CURL_WARNING { \ if (client->handle.err.str) \ { \ php_error_docref(NULL, E_WARNING, "%s", ((solr_char_t *) client->handle.err.str)); \ } \ } /* if there was an error with the http request solr_make_request throws an exception by itself * if it wasn't a curl connection error, throw exception */ #define HANDLE_SOLR_SERVER_ERROR(clientPtr,requestType){ \ if(clientPtr->handle.result_code == CURLE_OK){ \ solr_throw_solr_server_exception(clientPtr, (const char *)requestType);\ } \ } /* solr_throw_exception_ex(solr_ce_SolrClientException, SOLR_ERROR_1010, SOLR_FILE_LINE_FUNC, SOLR_ERROR_1010_MSG, requestType, SOLR_RESPONSE_CODE_BODY); \ */ #define SOLR_RETURN_THIS() { \ RETURN_ZVAL(getThis(), 1, 0); \ } /* Used to release the (solr_document_t **) pointers */ #define SOLR_FREE_DOC_ENTRIES(ptr) { \ if ((ptr) != NULL)\ { \ pefree(ptr, SOLR_DOCUMENT_PERSISTENT); \ ptr = NULL; \ } \ } /* }}} */ /* Used to release the (solr_document_t **) pointers */ #define SOLR_FREE_DOC_ENTRIES(ptr) { \ if ((ptr) != NULL)\ { \ pefree(ptr, SOLR_DOCUMENT_PERSISTENT); \ ptr = NULL; \ } \ } /* }}} */ static inline solr_ustream_t *solr_get_ustream_object(zend_object *obj) { return (solr_ustream_t *) ((char *) obj - XtOffsetOf(solr_ustream_t, std)); } #define Z_USTREAM_P(zv) solr_get_ustream_object(Z_OBJ_P(zv)); #endif /* SOLR_MACROS_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/solr_string.c000066400000000000000000000161311374041537100215250ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Israel Ekpo | +----------------------------------------------------------------------+ */ #include "php_solr.h" /* {{{ static inline void solr_string_alloc(solr_string_t *dest, size_t length, size_t *new_length SOLR_MEM_DEBUG_DC) */ static inline void solr_string_alloc(solr_string_t *dest, size_t length, size_t *new_length SOLR_MEM_DEBUG_DC) { /* If buffer is empty */ if (!dest->str) { (*new_length) = length; dest->cap = ((*new_length) < SOLR_STRING_START_SIZE) ? SOLR_STRING_START_SIZE : (length + SOLR_STRING_INCREMENT_SIZE); dest->str = (solr_char_t *) perealloc(dest->str, dest->cap * sizeof(solr_char_t), SOLR_STRING_PERSISTENT); } else { (*new_length) = dest->len + length; /* If the buffer full, get more space */ if ((*new_length) >= dest->cap) { dest->cap = (*new_length) + SOLR_STRING_INCREMENT_SIZE; dest->str = (solr_char_t *) perealloc(dest->str, dest->cap * sizeof(solr_char_t), SOLR_STRING_PERSISTENT); } } #ifdef SOLR_MEM_DEBUG php_printf("solr_string_alloc() [Re]allocated %u bytes at %p in %s(), %s Line %d \n", dest->cap, dest->str SOLR_MEM_DEBUG_CC); #endif } /* }}} */ /* {{{ PHP_SOLR_API void solr_string_appends(solr_string_t *dest, const solr_char_t *src, size_t length SOLR_MEM_DEBUG_DC) */ PHP_SOLR_API void solr_string_appends_ex(solr_string_t *dest, const solr_char_t *src, size_t length SOLR_MEM_DEBUG_DC) { auto size_t __new_length = 0U; /* (Re)allocates memory and increases the capacity if necessary */ solr_string_alloc(dest, length, &__new_length SOLR_MEM_DEBUG_CC); /* Copy the data from the source to the destination */ memcpy(dest->str + dest->len, src, length); /* Reset the length of the solr_string to the new value */ dest->len = __new_length; /* Always make it a null-terminated string */ dest->str[__new_length] = (solr_char_t) 0x00; } /* }}} */ /* {{{ PHP_SOLR_API void solr_string_appendc(solr_string_t *dest, solr_char_t ch SOLR_MEM_DEBUG_DC) */ PHP_SOLR_API void solr_string_appendc_ex(solr_string_t *dest, solr_char_t ch SOLR_MEM_DEBUG_DC) { auto size_t __new_length = 0U; /* (Re)allocates memory and increases the capacity if necessary */ solr_string_alloc(dest, 1, &__new_length SOLR_MEM_DEBUG_CC); dest->str[dest->len] = ch; /* Reset the length of the solr_string to the new value (dest->len + 1) */ dest->len = __new_length; /* Always make it a null-terminated string */ dest->str[__new_length] = (solr_char_t) 0x00; } /* }}} */ /* {{{ PHP_SOLR_API void solr_string_remove_last_char(solr_string_t *dest) */ PHP_SOLR_API void solr_string_remove_last_char(solr_string_t *dest) { if (dest->str && dest->len) { dest->str[dest->len - 1] = (solr_char_t) 0x00; dest->len--; } } /* }}} */ /* {{{ PHP_SOLR_API void solr_string_append_long(solr_string_t *dest, long int long_val) */ PHP_SOLR_API void solr_string_append_long_ex(solr_string_t *dest, long int long_val SOLR_MEM_DEBUG_DC) { auto size_t __new_length = 0U; auto char tmp_buffer[SOLR_STRING_LONG_BUFFER_SIZE]; size_t length = 0; /* Write the formated long to the buffer */ php_sprintf(tmp_buffer, "%ld", long_val); length = strlen(tmp_buffer); /* (Re)allocates memory and increases the capacity if necessary */ solr_string_alloc(dest, length, &__new_length SOLR_MEM_DEBUG_CC); /* Copy the data from the source to the destination */ memcpy(dest->str + dest->len, tmp_buffer, length); /* Reset the length of the solr_string to the new value */ dest->len = __new_length; /* Always make it a null-terminated string */ dest->str[__new_length] = (solr_char_t) 0x00; } /* }}} */ /* {{{ PHP_SOLR_API void solr_string_append_unsigned_long(solr_string_t *dest, unsigned long int long_val) */ PHP_SOLR_API void solr_string_append_unsigned_long_ex(solr_string_t *dest, unsigned long int long_val SOLR_MEM_DEBUG_DC) { auto size_t __new_length = 0U; auto char tmp_buffer[SOLR_STRING_UNSIGNED_LONG_BUFFER_SIZE]; size_t length = 0; /* Write the formated unsigned long to the buffer */ php_sprintf(tmp_buffer, "%lu", long_val); length = strlen(tmp_buffer); /* (Re)allocates memory and increases the capacity if necessary */ solr_string_alloc(dest, length, &__new_length SOLR_MEM_DEBUG_CC); /* Copy the data from the source to the destination */ memcpy(dest->str + dest->len, tmp_buffer, length); /* Reset the length of the solr_string to the new value */ dest->len = __new_length; /* Always make it a null-terminated string */ dest->str[__new_length] = (solr_char_t) 0x00; } /* }}} */ /** * Checks if both strings are equal OR have same exact content. * * Returns 1 if they are equal, 0 if they are different. */ /* {{{ PHP_SOLR_API int solr_string_equal(const solr_string_t *a, const solr_string_t *b) */ PHP_SOLR_API int solr_string_equal(const solr_string_t *a, const solr_string_t *b) { const solr_char_t *str1 = a->str; const solr_char_t *str2 = b->str; if (str1 == str2) return 1; if (str1 == NULL) return 0; if (str2 == NULL) return 0; do { if (*str1++ != *str2) return(0); } while (*str2++); return 1; } /* }}} */ /* Deallocates memory for the buffer */ /* {{{ PHP_SOLR_API void solr_string_free(solr_string_t *dest SOLR_MEM_DEBUG_DC) */ PHP_SOLR_API void solr_string_free_ex(solr_string_t *dest SOLR_MEM_DEBUG_DC) { /* Only attempt this if the buffer is still valid */ if (dest->str) { #ifdef SOLR_MEM_DEBUG php_printf("solr_string_free_ex() Releasing %u bytes at %p in %s(), %s Line %d \n", dest->cap, dest->str SOLR_MEM_DEBUG_CC); #endif pefree(dest->str, SOLR_STRING_PERSISTENT); dest->str = (solr_char_t *) 0x00; dest->cap = dest->len = 0U; } } /* }}} */ PHP_SOLR_API void solr_destory_solr_string_zv(zval *solr_string_zv) { solr_string_t *string = (solr_string_t *) Z_PTR_P(solr_string_zv); solr_string_free_ex(string); pefree(string, SOLR_STRING_PERSISTENT); } /* Update the contents of the dest solr_string */ /* {{{ PHP_SOLR_API void solr_string_set(solr_string_t *dest, const solr_char_t *value, size_t length SOLR_MEM_DEBUG_DC) */ PHP_SOLR_API void solr_string_set_ex(solr_string_t *dest, const solr_char_t *value, size_t length SOLR_MEM_DEBUG_DC) { solr_string_free(dest); solr_string_appends(dest, value, length); } /* }}} */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/solr_string.h000066400000000000000000000120251374041537100215300ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Israel Ekpo | +----------------------------------------------------------------------+ */ #ifndef SOLR_STRING_H #define SOLR_STRING_H #include
#include #define SOLR_STRING_PERSISTENT 0 #define SOLR_STRING_START_SIZE 64 #define SOLR_STRING_INCREMENT_SIZE 128 #define SOLR_STRING_LONG_BUFFER_SIZE 16 #define SOLR_STRING_UNSIGNED_LONG_BUFFER_SIZE 32 #include "php_solr_api.h" #ifdef SOLR_DEBUG /* #define SOLR_MEM_DEBUG 1 Uncomment if you need memdebug enabled */ #endif #ifdef SOLR_MEM_DEBUG #define SOLR_MEM_DEBUG_DC , const char * mm_function, char * mm_filename, int mm_line #define SOLR_MEM_DEBUG_CC , mm_function, mm_filename, mm_line #define SOLR_MEM_DEBUG_RC , __func__, __FILE__, __LINE__ #else #define SOLR_MEM_DEBUG_DC #define SOLR_MEM_DEBUG_CC #define SOLR_MEM_DEBUG_RC #endif /** * solr_char_t * * iekpo 2009/08/28 * * Decided to create this type just in case there is a special need in the * future to use unsigned char instead of plain char to transport character * arrays within the library. * * Having this typedef will allow us to toggle easily between plain char and * unsigned char, without having to do a massive search and replace. * * There may be a few cases where casting may be needed to handle cases where * the sign of the variable is now the opposite. */ typedef char solr_char_t; /* Structure to store solr strings */ typedef struct _solr_string { solr_char_t *str; /* The buffer to store the character array. */ size_t len; /* The current length of the solr_string_t object */ size_t cap; /* The current capacity of the solr_string_t object */ } solr_string_t; #define SOLR_STRING_INITIALIZER {.str = ((solr_char_t *)0), .len = 0U, .cap = 0U} /* Appends a string constant to a solr_string_t */ #define solr_string_append_const(dest, str) solr_string_appends((dest), (solr_char_t *) str, sizeof(str)-1) /* Appends one solr_string_t to another */ #define solr_string_append_solr_string(dest, src) solr_string_appends((dest), (src)->str, (src)->len) /* Initializes the solr_string_t structure to empty values */ #define solr_string_init(dest) \ { \ (dest)->str = (solr_char_t *) 0x00; \ (dest)->len = 0U; \ (dest)->cap = 0U; \ } #define solr_strndup estrndup #define solr_strdup estrdup #define solr_strlen strlen #define solr_string_appends(dest, src, len) solr_string_appends_ex((dest), (src), (len) SOLR_MEM_DEBUG_RC) #define solr_string_appendc(dest, ch) solr_string_appendc_ex((dest), (ch) SOLR_MEM_DEBUG_RC) #define solr_string_append_long(dest, long_val) solr_string_append_long_ex((dest), (long_val) SOLR_MEM_DEBUG_RC) #define solr_string_append_unsigned_long(dest, long_val) solr_string_append_unsigned_long((dest), (long_val) SOLR_MEM_DEBUG_RC) #define solr_string_set(dest, value, length) solr_string_set_ex((dest), (value), (length) SOLR_MEM_DEBUG_RC) #define solr_string_free(dest) solr_string_free_ex((dest) SOLR_MEM_DEBUG_RC) PHP_SOLR_API void solr_string_appends_ex(solr_string_t *dest, const solr_char_t *src, size_t length SOLR_MEM_DEBUG_DC); PHP_SOLR_API void solr_string_appendc_ex(solr_string_t *dest, solr_char_t ch SOLR_MEM_DEBUG_DC); PHP_SOLR_API void solr_string_append_long_ex(solr_string_t *dest, long int long_val SOLR_MEM_DEBUG_DC); PHP_SOLR_API void solr_string_append_unsigned_long_ex(solr_string_t *dest, unsigned long int long_val SOLR_MEM_DEBUG_DC); PHP_SOLR_API void solr_string_remove_last_char(solr_string_t *dest); PHP_SOLR_API int solr_string_equal(const solr_string_t *a, const solr_string_t *b); PHP_SOLR_API void solr_destory_solr_string_zv(zval *solr_string_zv); PHP_SOLR_API void solr_string_free_ex(solr_string_t *dest SOLR_MEM_DEBUG_DC); PHP_SOLR_API void solr_string_set_ex(solr_string_t *dest, const solr_char_t *value, size_t length SOLR_MEM_DEBUG_DC); /* destroy data element of hashtable of solr_string_t */ #ifdef PHP_7 #define solr_destroy_solr_string solr_destory_solr_string_zv /* frees a solr_string_t within a zval */ #else #define solr_destroy_solr_string solr_string_free #endif #endif /* SOLR_STRING_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/src/php7/solr_types.h000066400000000000000000000347741374041537100214050ustar00rootroot00000000000000/* +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: | | Israel Ekpo | | Omar Shaban | +----------------------------------------------------------------------+ */ #ifndef SOLR_TYPES_H #define SOLR_TYPES_H #include
#include #include #include #include /* Declaring workarounds for SSL private key constants */ #if LIBCURL_VERSION_NUM >= 0x071700 /* Use CURLOPT_KEYPASSWD as is */ #elif LIBCURL_VERSION_NUM >= 0x070903 #define CURLOPT_KEYPASSWD CURLOPT_SSLKEYPASSWD #else #define CURLOPT_KEYPASSWD CURLOPT_SSLCERTPASSWD #endif /* Declaring workarounds for ACCEPT ENCODING constants */ #if LIBCURL_VERSION_NUM >= 0x071506 /* Use CURLOPT_ACCEPT_ENCODING as is */ #else #define CURLOPT_ACCEPT_ENCODING CURLOPT_ENCODING #endif #include #include #include #include #include #include typedef unsigned char solr_bool; #include "solr_string.h" /* {{{ types for the http client */ typedef enum { SOLR_REQUEST_BEGIN = 0, SOLR_REQUEST_SEARCH = 1, /** 1 **/ SOLR_REQUEST_UPDATE = 2, /** 2 **/ SOLR_REQUEST_THREADS = 3, /** 3 **/ SOLR_REQUEST_PING = 4, /** 4 **/ SOLR_REQUEST_TERMS = 5, /** 5 **/ SOLR_REQUEST_SYSTEM = 6, /** 6 **/ SOLR_REQUEST_GET = 7, SOLR_REQUEST_EXTRACT = 8, SOLR_REQUEST_END } solr_request_type_t; typedef enum { SOLR_SERVLET_TYPE_BEGIN = 0, SOLR_SERVLET_TYPE_SEARCH = 1, SOLR_SERVLET_TYPE_UPDATE = 2, SOLR_SERVLET_TYPE_THREADS = 4, SOLR_SERVLET_TYPE_PING = 8, SOLR_SERVLET_TYPE_TERMS = 16, SOLR_SERVLET_TYPE_SYSTEM = 32, SOLR_SERVLET_TYPE_GET = 64, SOLR_SERVLET_TYPE_EXTRACT = 128, SOLR_SERVLET_TYPE_END } solr_servlet_type_t; typedef enum { SOLR_PARAM_TYPE_BEGIN = 0, SOLR_PARAM_TYPE_NORMAL = 1, SOLR_PARAM_TYPE_SIMPLE_LIST = 2, SOLR_PARAM_TYPE_ARG_LIST = 4, SOLR_PARAM_TYPE_END } solr_param_type_t; typedef enum { SOLR_SORT_DIR_ASC = 0, SOLR_SORT_DIR_DESC = 1 } solr_sort_dir_t; typedef enum { SOLR_JSON_ERROR_NONE = 0, SOLR_JSON_ERROR_DEPTH, SOLR_JSON_ERROR_STATE_MISMATCH, SOLR_JSON_ERROR_CTRL_CHAR, SOLR_JSON_ERROR_SYNTAX, SOLR_JSON_ERROR_UTF8, SOLR_JSON_ERROR_SERIALIZATION } solr_json_error_codes_t; /* document field value modifier */ typedef enum { SOLR_FIELD_VALUE_MOD_NONE = 0, SOLR_FIELD_VALUE_MOD_ADD = 1, SOLR_FIELD_VALUE_MOD_SET = 2, SOLR_FIELD_VALUE_MOD_INC = 3, SOLR_FIELD_VALUE_MOD_REMOVE = 4, SOLR_FIELD_VALUE_MOD_REMOVEREGEX = 5, } solr_fvm_t; /* solr input document optimistic concurrency */ typedef enum { SOLR_VERSION_ASSERT_NONE = 0, SOLR_VERSION_ASSERT_EXISTS = 1, SOLR_VERSION_ASSERT_NOT_EXISTS = -1 } solr_input_document_version_t; typedef struct curl_slist solr_http_header_list_t; typedef struct { solr_string_t buffer; /* Stores the HTTP request headers */ } solr_curl_send_headers_t; typedef struct _solr_curl_send_data { solr_string_t buffer; /* Stores the HTTP request data */ } solr_curl_send_data_t; typedef struct { solr_string_t buffer; /* Stores the HTTP response headers */ long int response_code; /* Stores the HTTP response code */ } solr_curl_response_headers_t; typedef struct { solr_string_t buffer; /* Stores the HTTP response data */ } solr_curl_response_data_t; typedef struct { char str[CURL_ERROR_SIZE + 1]; /* Stores the error message */ uint32_t number; /* Stores the error number */ } solr_curl_error_t; typedef struct { solr_curl_send_headers_t request_header; solr_curl_send_data_t request_body; solr_curl_send_data_t request_body_debug; solr_curl_response_headers_t response_header; solr_curl_response_data_t response_body; solr_curl_error_t err; solr_string_t debug_data_buffer; /* Stores all the debug data */ size_t handle_status; /* Whether or not the handle is still usable */ CURLcode result_code; CURL *curl_handle; } solr_curl_t; typedef struct { long int host_port; /* HTTP port for Solr server */ long int proxy_port; /* Proxy port for Solr server */ long int timeout; /* maximum time in seconds allowed for the http data transfer operation */ long int secure; /* Whether to connect to Solr Server using SSL/HTTPS */ long int ssl_verify_peer; /* Determines whether libcurl verifies the peer certificate */ long int ssl_verify_host; /* Determines how libcurl verifies the server certificate */ solr_string_t hostname; /* IP address or domain name */ solr_string_t path; /* Path to solr */ solr_string_t http_auth_credentials; /* HTTP Auth username:password */ solr_string_t proxy_hostname; /* IP address of domain name for the proxy server */ solr_string_t proxy_auth_credentials; /* Proxy Auth username:password */ solr_string_t ssl_cert; /* File name to a PEM-formatted private key + private certificate (concatenated in that order) */ solr_string_t ssl_key; /* File name to a PEM-formatted private key */ solr_string_t ssl_keypassword; /* The pass phrase/password for the private ssl_key */ solr_string_t ssl_cainfo; /* Name of file holding one or more certificates to verify peer with */ solr_string_t ssl_capath; /* Name of directory holding multiple CA certificates to verify peer with */ solr_string_t qs_delimiter; /* The query string delimiter */ solr_string_t response_writer; /* The response writer type (wt parameter) */ solr_string_t update_url; /* URL used for updates */ solr_string_t extract_url; /* URL used for file indexing using extract */ solr_string_t search_url; /* URL used for queries */ solr_string_t thread_url; /* URL used for thread monitoring */ solr_string_t ping_url; /* URL for sending ping requests */ solr_string_t terms_url; /* URL for sending terms requests */ solr_string_t system_url; /* URL for sending system requests */ solr_string_t get_url; /* URL for sending realtime get requests */ solr_string_t update_servlet; /* The update servlet */ solr_string_t extract_servlet; /* The update servlet appended with extract Req. handler */ solr_string_t search_servlet; /* The search servlet */ solr_string_t thread_servlet; /* The thread servlet */ solr_string_t ping_servlet; /* The ping servlet */ solr_string_t terms_servlet; /* The terms servlet */ solr_string_t system_servlet; /* The system info servlet */ solr_string_t get_servlet; /* The realtime get servlet */ } solr_client_options_t; typedef struct { zend_ulong client_index; /* Unique for the SolrClient instance. Used as index in HashTables */ uint32_t request_count; /* The number of requests made from this client */ solr_client_options_t options; /* The connection options for this client */ solr_curl_t handle; /* The Solr handle for this client */ } solr_client_t; /* }}} */ /* Types for documents and collections */ /* {{{ Types for documents and collections */ /* {{{ Types for SolrDocument fields */ typedef struct _solr_field_value_t { solr_char_t *field_value; /* The value for this field */ solr_fvm_t modifier; /* field value modifier for partial updates */ struct _solr_field_value_t *next; /* The next entry in the queue */ } solr_field_value_t; /** * List of Fields in a Solr Document * * @field_boost stores the boost value * @count stores how many fields there are in the list * @field_name stores the name of the field * @head the first entry in the list (if any) * @last the last entry in the list (if any) */ typedef struct { double field_boost; /* The boost value for this field */ uint32_t count; /* The number of values in this field */ uint32_t modified; /* marks field as getting modified */ solr_char_t *field_name; /* The name of the field */ solr_field_value_t *head; /* The first value in the queue */ solr_field_value_t *last; /* The last value in the queue */ } solr_field_list_t; /* }}} */ /* {{{ Types for Documents and Document Collections */ typedef struct { zend_ulong document_index; /* Unique for the SolrInputDocument instance. Used as index in HashTables */ uint32_t field_count; /* Number of fields in this document */ double document_boost; /* The boost value for this document */ HashTable *fields; /* HashTable for storing all the solr_field_list_t fields */ HashTable *children; /* Hashtable for storing child documents(zval *) */ } solr_document_t; /* }}} */ /* {{{ Types for Solr Query Parameters */ typedef struct { solr_string_t value; /* The value for this parameter */ solr_string_t arg; /* The argument for this value*/ solr_char_t *delimiter_override; /* overrides the arg_list delimiter for this particular argument */ solr_bool delimiter_overriden; /* is delimiter overriden */ } solr_arg_list_value_t; typedef union { solr_string_t normal; /* Stores normal parameters */ solr_string_t simple_list; /* Stores delimited list parameters */ solr_arg_list_value_t arg_list; /* Stores parameters that have arguments */ } solr_pvc_t; typedef struct _solr_param_value_t { solr_pvc_t contents; /* A union for the contents of this value */ struct _solr_param_value_t *prev; /* The previous value in the list */ struct _solr_param_value_t *next; /* The next value in the list */ } solr_param_value_t; /* Checks if two parameter values are equal */ typedef int (*solr_param_value_equal_func_t)(const solr_param_value_t *a, const solr_param_value_t *b); /* Used to retrieve all the values for this parameter as a single solr string */ typedef void (*solr_param_fetch_func_t)(void *solr_param, solr_string_t *buffer); /* Frees the parameter value and its contents. */ typedef void (*solr_param_value_free_func_t)(solr_param_value_t *param_value); typedef struct { solr_param_type_t type; /* What type of query parameter this is */ uint32_t count; /* The number of values for this parameter */ solr_char_t *param_name; /* The name of the parameter */ size_t param_name_length; /* The length of name of the parameter */ solr_bool allow_multiple; /* Whether this parameter should store more than one value */ solr_param_value_t *head; /* The first value in the list */ solr_param_value_t *last; /* The last value in the list */ solr_param_fetch_func_t fetch_func; /* Retrieves all the value contents as a single solr_string_t */ solr_param_value_free_func_t value_free_func; /* Frees the value and its contents */ solr_param_value_equal_func_t value_equal_func; /* Checks if two values are equal */ solr_char_t delimiter; /* Default is "," Used to separate list parameter values */ solr_char_t arg_separator; /* Used only be arg_lists to separate arguments from values */ } solr_param_t; /* Used to retrieve parameter values just for display purposes */ typedef void (*solr_param_display_func_t)(solr_param_t *solr_param, zval *param_value_array); /* Used to retrieve parameter values just for the toString() method */ /* The url_encode parameter will be ignored for now */ typedef void (*solr_param_tostring_func_t)(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode); typedef struct { zend_ulong params_index; /* The index for this object in the HashTable */ uint32_t params_count; /* The number of parameters for the query object */ HashTable *params; /* The HashTable for storing query parameters */ } solr_params_t; /* }}} */ /* {{{ solr function/localparams type */ typedef struct { zend_ulong function_index; /* The index for this object in the HashTable */ solr_char_t *name; size_t name_length; solr_char_t *argument; size_t argument_length; HashTable *params; /* The HashTable for storing function key-val parameters */ } solr_function_t; /* }}} */ /* {{{ content stream/extract types */ #define SOLR_EXTRACT_CONTENT_FILE 0 #define SOLR_EXTRACT_CONTENT_STREAM 1 typedef struct { solr_string_t binary_content; /* actual contents */ solr_string_t mime_type; /* mime type */ } solr_cuv_binary_t; typedef union { solr_string_t filename; solr_cuv_binary_t stream_info; } solr_cuv_t; typedef struct { solr_cuv_t *content_info; /* stores the content data whether filename or stream_info */ int content_type; /* stores the content type from the constants above */ zval *params; zend_object std; } solr_ustream_t; /* }}} */ /* }}} */ /* {{{ Extension Global : This should be the last data type declared. More members may be added later. */ ZEND_BEGIN_MODULE_GLOBALS(solr) uint32_t request_count; /* The number of times PHP_RINIT has been called */ uint32_t document_count; /* The number of active SolrDocuments in this request */ uint32_t client_count; /* The number of active SolrClients in this request */ uint32_t functions_count; /* The number of active Functions in this request */ HashTable *documents; /* HashTable for storing solr_document_t documents */ HashTable *clients; /* HashTable for storing solr_client_t clients */ HashTable *params; /* HashTable for storing solr_params_t parameter containers */ HashTable *functions; /* HashTable for storing solr_function_t */ HashTable *ustreams; /* HashTable for storing solr_ustream_t */ ZEND_END_MODULE_GLOBALS(solr) /* }}} */ typedef struct { int code; solr_char_t *message; } solr_exception_t; #endif /* SOLR_TYPES_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: fdm=marker * vim: noet sw=4 ts=4 */ php-solr-2.5.1+2.4.0/solr-2.5.1/tests/000077500000000000000000000000001374041537100165075ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.5.1/tests/000.solr_server_compat.phpt000066400000000000000000000012501374041537100236100ustar00rootroot00000000000000--TEST-- Solr Server 4+ Compatibility Test --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $query_response = $client->system(); $solrVersion = $query_response->getResponse()->lucene['solr-spec-version']; $match = preg_match('#([0-9]+)\.[0-9]+\.[0-9]+#', $solrVersion, $matches); var_dump($matches[1] >=4 ); ?> --EXPECTF-- bool(true)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/000.solrclient_ping.phpt000066400000000000000000000011021374041537100230670ustar00rootroot00000000000000--TEST-- SolrClient::ping() - Ping Solr Server --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $pingResponse = $client->ping(); echo $pingResponse->getRawResponse(); ?> --EXPECT-- HTTP/1.1 200 OK Content-Type: application/xml; charset=UTF-8 Content-Length: 0php-solr-2.5.1+2.4.0/solr-2.5.1/tests/001.solrclient_addDocument.phpt000066400000000000000000000017641374041537100244000ustar00rootroot00000000000000--TEST-- SolrClient::addDocument() - sending document to the Solr server --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 334455); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Lucene'); $doc2 = new SolrInputDocument(); $doc2->addField('id', 12345); $doc->addField('cat', 'Category1'); $doc->addField('cat', 'Category2'); $updateResponse = $client->addDocument($doc, true, 500); $updateResponse = $client->addDocument($doc2, true, 500); print_r($updateResponse->getResponse()); ?> --EXPECTF-- SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => 0 [QTime] => %d ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/001.solrclient_addDocument_partial.phpt000066400000000000000000000071161374041537100261110ustar00rootroot00000000000000--TEST-- SolrClient::addDocumnt() - Partial Update (integration) --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $printDocument = function() use ($client) { $response = $client->getById('testing_partials'); print_r($response->getResponse()); }; // clean up, before running the test $client->deleteById('testing_partials'); $client->commit(); $initialDoc = new SolrInputDocument(); $initialDoc->addField('id', 'testing_partials'); $initialDoc->addField('field1', 'existing value'); $initialDoc->addField('field1', 'remove me please'); $initialDoc->addField('field1', '15/01/2007'); $initialDoc->addField('field2_s', 'initialField'); $initialDoc->addField('field3_i', 0); $initialDoc->addField('field4', 'val1'); $initialDoc->addField('field5_s', 'unmodified field'); $client->addDocument($initialDoc); $client->commit(); separator('INITIAL'); $printDocument(); $doc = new SolrInputDocument(); $doc->addField('id', 'testing_partials'); $doc->updateField('field1', SolrInputDocument::UPDATE_MODIFIER_ADD, 'newly added value'); $doc->updateField('field1', SolrInputDocument::UPDATE_MODIFIER_REMOVE, 'remove me please'); $doc->updateField('field3_i', SolrInputDocument::UPDATE_MODIFIER_INC, 5); $doc->updateField('field2_s', SolrInputDocument::UPDATE_MODIFIER_SET, 'updated string'); $doc->updateField('field1', SolrInputDocument::UPDATE_MODIFIER_REMOVEREGEX, '[\d]{2}/[\d]{2}/[\d]{4}'); $response = $client->addDocument($doc); $client->commit(); separator('RAW REQUEST'); print_r($response->getRawRequest()); $client->commit(); separator('RESULT AFTER UPDATE'); $printDocument(); ?> --EXPECTF-- =================================== INITIAL ==================================== SolrObject Object ( [doc] => SolrObject Object ( [id] => testing_partials [field1] => Array ( [0] => existing value [1] => remove me please [2] => 15/01/2007 ) [field2_s] => initialField [field3_i] => 0 [field4] => Array ( [0] => val1 ) [field5_s] => unmodified field [_version_] => %d ) ) ================================= RAW REQUEST ================================== testing_partials newly added value remove me please [\d]{2}/[\d]{2}/[\d]{4} 5 updated string ============================= RESULT AFTER UPDATE ============================== SolrObject Object ( [doc] => SolrObject Object ( [id] => testing_partials [field1] => Array ( [0] => existing value [1] => newly added value ) [field2_s] => updated string [field3_i] => 5 [field4] => Array ( [0] => val1 ) [field5_s] => unmodified field [_version_] => %d ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/002.solrclient_addDocuments.phpt000066400000000000000000000017531374041537100245620ustar00rootroot00000000000000--TEST-- SolrClient::addDocuments() - sending multiple documents to the Solr server --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 334455); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Lucene'); $doc2 = new SolrInputDocument(); $doc2->addField('id', 12345); $doc->addField('cat', 'Category1'); $doc->addField('cat', 'Category2'); $docs = array($doc, $doc2); $updateResponse = $client->addDocuments($docs); $client->commit(); print_r($updateResponse->getResponse()); ?> --EXPECTF-- SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => 0 [QTime] => %d ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/003.solrclient_addDocument_no_overwrite.phpt000066400000000000000000000015601374041537100271760ustar00rootroot00000000000000--TEST-- SolrClient::addDocument() - Overwrite an existing document --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 334455); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Solr'); $updateResponse = $client->addDocument($doc, false); $client->commit(); print $updateResponse->getRawRequest(); ?> --EXPECT-- 334455 Software Solr php-solr-2.5.1+2.4.0/solr-2.5.1/tests/003.solrclient_addDocuments_commitwithin.phpt000066400000000000000000000017431374041537100273550ustar00rootroot00000000000000--TEST-- SolrClient::addDocuments() - sending multiple documents to the Solr server --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 334455); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Lucene'); $doc2 = new SolrInputDocument(); $doc2->addField('id', 12345); $doc->addField('cat', 'Category1'); $doc->addField('cat', 'Category2'); $docs = array($doc, $doc2); $updateResponse = $client->addDocuments($docs, true, 500); print_r($updateResponse->getResponse()); ?> --EXPECTF-- SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => 0 [QTime] => %d ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/003.solrclient_options.phpt000066400000000000000000000052271374041537100236440ustar00rootroot00000000000000--TEST-- SolrClient::__construct() - Test options --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'path' => SOLR_SERVER_PATH, 'timeout' => 400 ); $client = new SolrClient($options); $pingResponse = $client->ping(); print_r($pingResponse->getRawResponse()); $options = array ( 'hostname' => SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'port' => strval(SOLR_SERVER_PORT), 'password' => SOLR_SERVER_PASSWORD, 'path' => '/'.SOLR_SERVER_PATH, 'timeout' => '400' ); $client = new SolrClient($options); $pingResponse = $client->ping(); print_r($pingResponse->getRawResponse()); $options = array ( 'hostname' => SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'path' => SOLR_SERVER_PATH, 'proxy_host' => 'localhost', 'proxy_login' => 'test', 'proxy_password' => 'password', 'proxy_port' => 8181, 'query_string_delimiter' => '&' ); $client = new SolrClient($options); try { $pingResponse = $client->ping(); } catch (SolrClientException $e) { print_exception($e); } $options = array ( 'hostname' => SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'path' => SOLR_SERVER_PATH, 'proxy_host' => 'localhost', 'proxy_login' => 'test', 'proxy_password' => 'password', 'proxy_port' => '8181', 'query_string_delimiter' => '&' ); $client = new SolrClient($options); try { $pingResponse = $client->ping(); } catch (SolrClientException $e) { print_exception($e); } try { $client = new SolrClient(array()); } catch (SolrIllegalArgumentException $e) { print_exception($e); } $options = array ( 'hostname' => SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'path' => SOLR_SERVER_PATH, 'ssl_cert' => '/tmp/unavailable.crt', 'ssl_key' => 'test', 'ssl_keypassword' => 'test', 'ssl_cainfo' => 'test', 'ssl_capath' => '/tmp/' ); $client = new SolrClient($options); try { $pingResponse = $client->ping(); } catch (SolrClientException $e) { print_exception($e); } ?> --EXPECTF-- HTTP/1.1 200 OK Content-Type: application/xml; charset=UTF-8 Content-Length: 0 HTTP/1.1 200 OK Content-Type: application/xml; charset=UTF-8 Content-Length: 0 SolrClientException 1004: Solr HTTP Error 7: 'Couldn't connect to server' SolrClientException 1004: Solr HTTP Error 7: 'Couldn't connect to server' SolrIllegalArgumentException 4000: The SolrClient options cannot be an empty array php-solr-2.5.1+2.4.0/solr-2.5.1/tests/004.solrclient_query_response.phpt000066400000000000000000000020151374041537100252250ustar00rootroot00000000000000--TEST-- SolrClient::query() - Sending a chained query request --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setQuery('lucene'); $query->setStart(0); $query->setRows(50); $query->addField('cat')->addField('features')->addField('id')->addField('timestamp'); $query_response = $client->query($query); $response = $query_response->getResponse(); var_dump(get_class($response->responseHeader->params) == 'SolrObject'); var_dump(property_exists($response->responseHeader->params, 'q')); var_dump(property_exists($response->responseHeader->params, 'wt')); var_dump(property_exists($response->responseHeader->params, 'version')); ?> --EXPECTF-- bool(true) bool(true) bool(true) bool(true)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/004.solrclient_query_terms.phpt000066400000000000000000000021461374041537100245260ustar00rootroot00000000000000--TEST-- SolrClient::query() - Terms component --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $query->setTerms(true); $query->setTermsField('name'); $query->setTermsLowerBound('a'); $query->setTermsSort(SolrQuery::TERMS_SORT_INDEX); $query_response = $client->query($query); echo $query_response->getRequestUrl() .PHP_EOL; print_r($query_response->getResponse()); ?> --EXPECTF-- http://%s/solr/collection1/terms/?version=2.2&indent=on&wt=xml SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => %d [QTime] => %d ) [terms] => SolrObject Object ( [name] => SolrObject Object ( [iPod & iPod Mini USB 2.0 Cable] => %d ) ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/005.solrclient_query_error.phpt000066400000000000000000000013331374041537100245230ustar00rootroot00000000000000--TEST-- SolrClient::query() - throw SolrClientException on Solr Server exception --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $query = new SolrQuery("lucene\\"); try { $query_response = $client->query($query); } catch (SolrServerException $e) { echo $e->getMessage(); } ?> --EXPECTF-- %s: Cannot parse 'lucene\': Lexical error at line 1, column 8. Encountered: after : ""php-solr-2.5.1+2.4.0/solr-2.5.1/tests/006.solrclient_system.phpt000066400000000000000000000012041374041537100234670ustar00rootroot00000000000000--TEST-- SolrClient::system() - Retrieve Solr Server/System Info --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $genericResponse = $client->system(); var_dump(get_class($genericResponse->getResponse())) . PHP_EOL; var_dump(get_class($genericResponse->getResponse()->system)); ?> --EXPECTF-- string(10) "SolrObject" string(10) "SolrObject" php-solr-2.5.1+2.4.0/solr-2.5.1/tests/007.solrclient_deleteById.phpt000066400000000000000000000012461374041537100241640ustar00rootroot00000000000000--TEST-- SolrClient::deleteById() - Testing deleting a document by ID --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $response = $client->deleteById('334457'); $client->commit(); print_r($response->getResponse()); ?> --EXPECTF-- SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => %d [QTime] => %d ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/007.solrclient_deleteByIds.phpt000066400000000000000000000021661374041537100243510ustar00rootroot00000000000000--TEST-- SolrClient::deleteByIds() - Test deleting documents by an array of IDS --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $response = $client->deleteByIds(array('334455','334456')); $client->commit(); print_r($response->getResponse()); try { $client->deleteByIds(array(0)); } catch (SolrIllegalArgumentException $e) { echo sprintf("Exception %d: %s", $e->getCode(), $e->getMessage()). PHP_EOL; } try { $client->deleteByIds(array('334455', '')); } catch (SolrIllegalArgumentException $e) { echo sprintf("Exception %d: %s", $e->getCode(), $e->getMessage()). PHP_EOL; } ?> --EXPECTF-- SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => %d [QTime] => %d ) ) Exception 4000: Id number 1 is not a valid string Exception 4000: Id number 2 is not a valid stringphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/008.solrclient_commit.phpt000066400000000000000000000015361374041537100234450ustar00rootroot00000000000000--TEST-- SolrClient::commit() - Testing commit --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $updateResponse = $client->commit(); print $updateResponse->getRawRequest(); $updateResponse = $client->commit(true,false,true); print $updateResponse->getRawRequest(); $updateResponse = $client->commit(true,false,true); ?> --EXPECTF-- php-solr-2.5.1+2.4.0/solr-2.5.1/tests/008.solrclient_rollback.phpt000066400000000000000000000010511374041537100237360ustar00rootroot00000000000000--TEST-- SolrClient::rollback() - Testing rollback --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $updateResponse = $client->rollback(); print $updateResponse->getRawRequest(); ?> --EXPECTF-- php-solr-2.5.1+2.4.0/solr-2.5.1/tests/009.solrclient_optimize.phpt000066400000000000000000000014461374041537100240160ustar00rootroot00000000000000--TEST-- SolrClient::optimize() - Testing optimize --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $updateResponse = $client->optimize(); print $updateResponse->getRawRequest(); $updateResponse = $client->optimize(4,true,false); print $updateResponse->getRawRequest(); ?> --EXPECTF-- php-solr-2.5.1+2.4.0/solr-2.5.1/tests/010.solrclient_getOptions.phpt000066400000000000000000000014061374041537100242750ustar00rootroot00000000000000--TEST-- SolrClient::getOptions - Returning all the default options --FILE-- false); $client = new SolrClient($options); var_dump($client->getOptions()); ?> --EXPECTF-- array(17) { ["timeout"]=> int(30) ["secure"]=> bool(false) ["hostname"]=> string(9) "localhost" ["wt"]=> string(3) "xml" ["port"]=> int(8983) ["proxy_host"]=> string(0) "" ["proxy_port"]=> int(0) ["path"]=> string(4) "solr" ["http_auth"]=> string(0) "" ["proxy_auth"]=> string(0) "" ["ssl_verify_peer"]=> bool(false) ["ssl_verify_host"]=> int(2) ["ssl_cert"]=> string(0) "" ["ssl_key"]=> string(0) "" ["ssl_keypassword"]=> string(0) "" ["ssl_cainfo"]=> string(0) "" ["ssl_capath"]=> string(0) "" } php-solr-2.5.1+2.4.0/solr-2.5.1/tests/011.solrclient_phps_response.phpt000066400000000000000000000007441374041537100250370ustar00rootroot00000000000000--TEST-- SolrClient - PHPS response writer support --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient ( $options ); $client->setResponseWriter('phps'); $options = $client->getOptions(); var_dump($options['wt'] == 'phps'); ?> --EXPECTF-- bool(true)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/012.solrclient_getById.phpt000066400000000000000000000011701374041537100234710ustar00rootroot00000000000000--TEST-- SolrClient::getById() - Testing Real Time Get by id --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $response = $client->getById('GB18030TEST'); var_dump(isset($response->getArrayResponse()['doc'])).PHP_EOL; var_dump($response->getResponse()->doc->id) . PHP_EOL; ?> --EXPECTF-- bool(true) string(11) "GB18030TEST"php-solr-2.5.1+2.4.0/solr-2.5.1/tests/013.solrclient_getByIds.phpt000066400000000000000000000027161374041537100236640ustar00rootroot00000000000000--TEST-- SolrClient::getByIds() - Testing Real Time Get by ids --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $response = $client->getByIds(['GB18030TEST', '6H500F0']); var_dump(isset($response->getArrayResponse()['response']['docs'])) . PHP_EOL; var_dump($response->getResponse()->response->start) . PHP_EOL; try { $response = $client->getByIds(['GB18030TEST', '']); } catch (Exception $e) { printf("Exception %d: %s", $e->getCode(), $e->getMessage()); } echo PHP_EOL.PHP_EOL; // make sure request was reset $response = $client->getByIds(['GB18030TEST']); $headers = explode(PHP_EOL, trim($response->getRawRequestHeaders())); $headers = array_filter($headers, function($header) { return strstr($header, 'collection1') !== false; }); print_r(implode(PHP_EOL, $headers).PHP_EOL); echo PHP_EOL; try { $response = $client->getByIds([]); } catch (Exception $e) { printf("Exception %d: %s", $e->getCode(), $e->getMessage()); } ?> --EXPECTF-- bool(true) int(0) Exception 4000: Invalid id at position 1 GET /solr/collection1/get/?version=2.2&indent=on&wt=xml&ids=GB18030TEST HTTP/1.1 Exception 4000: Invalid parameter: at least 1 ID is required. Passed an empty array. php-solr-2.5.1+2.4.0/solr-2.5.1/tests/014.solrclient_addDocument_nested_document.phpt000066400000000000000000000040761374041537100276430ustar00rootroot00000000000000--TEST-- SolrClient::addDocument() - Sending a document with child documents --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 'CTEST_1'); $doc->addField('title', 'Solr adds block join support'); $doc->addField('content_type', 'parentDocument'); $doc2 = new SolrInputDocument(); $doc2->addField('id', 'CTEST_2'); $doc2->addField('comment_t', 'SolrCloud supports it too!'); $doc3 = new SolrInputDocument(); $doc3->addField('id', 'CTEST_3'); $doc3->addField('comment_t', 'Lots of features'); $doc->addChildDocument($doc2); $doc->addChildDocument($doc3); $doc4 = new SolrInputDocument(); $doc4->addField('id', 'CTEST_4'); $doc4->addField('comment_t', 'Child Child'); $doc3->addChildDocument($doc4); $docs = $doc->getChildDocuments(); $docs[0]->addField('one_more_field_t', 'testing'); $updateResponse = $client->addDocument($doc); print_r($updateResponse->getRawRequest()); print_r($updateResponse->getResponse()); $client->commit(); ?> --EXPECTF-- CTEST_1 Solr adds block join support parentDocument CTEST_2 SolrCloud supports it too! testing CTEST_3 Lots of features CTEST_4 Child Child SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => %d [QTime] => %d ) )php-solr-2.5.1+2.4.0/solr-2.5.1/tests/015.solrclient_addDocuments_nested_document.phpt000066400000000000000000000040341374041537100300210ustar00rootroot00000000000000--TEST-- SolrClient::addDocuments() - Sending multiple documents with child documents --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 'CTEST_1'); $doc->addField('title', 'Solr adds block join support'); $doc->addField('content_type', 'parentDocument'); $doc2 = new SolrInputDocument(); $doc2->addField('id', 'CTEST_2'); $doc2->addField('comment_t', 'SolrCloud supports it too!'); $doc3 = new SolrInputDocument(); $doc3->addField('id', 'CTEST_3'); $doc3->addField('content_type', 'parentDocument'); $doc3->addField('comment_t', 'Lots of features'); $doc4 = new SolrInputDocument(); $doc4->addField('id', 'CTEST_4'); $doc4->addField('comment_t', 'Cool features'); $doc->addChildDocument($doc2); $doc3->addChildDocument($doc4); $documents = [$doc, $doc3]; $updateResponse = $client->addDocuments($documents); print_r($updateResponse->getRawRequest()); print_r($updateResponse->getResponse()); $client->commit(); ?> --EXPECTF-- CTEST_1 Solr adds block join support parentDocument CTEST_2 SolrCloud supports it too! CTEST_3 parentDocument Lots of features CTEST_4 Cool features SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => %d [QTime] => %d ) )php-solr-2.5.1+2.4.0/solr-2.5.1/tests/016.solrclient_request.phpt000066400000000000000000000017621374041537100236450ustar00rootroot00000000000000--TEST-- SolrClient::Request() - Sending custom update request --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $rawAtomicUpdateRequest = << IW-02 1 New Atomic Update Feature true REQ; $response = $client->request($rawAtomicUpdateRequest)->getResponse(); $client->commit(); print_r($response); ?> --EXPECTF-- SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => %d [QTime] => %d ) )php-solr-2.5.1+2.4.0/solr-2.5.1/tests/016.solrclient_sendUpdateStream_bin.phpt000066400000000000000000000020771374041537100262550ustar00rootroot00000000000000--TEST-- SolrClient::sendUpdateStream - send SolrExtractRequest (bin) --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_FILES_PATH, ); $client = new SolrClient($options); $extractParams = new SolrModifiableParams(); $extractParams ->set(SolrExtractRequest::LITERALS_PREFIX . 'id', 'doc1') ->set(SolrExtractRequest::CAPTURE_ELEMENTS, 'p') ->set(SolrExtractRequest::FIELD_MAPPING_PREFIX . 'p', 'text') ; $binContent = file_get_contents(EXTRACT_FILE_1); $extractRequest = SolrExtractRequest::createFromStream($binContent, 'application/pdf', $extractParams); $response = $client->sendUpdateStream($extractRequest); $client->rollback(); echo $response->getHttpStatus() . PHP_EOL; echo $response->getRequestUrl() . PHP_EOL; ?> --EXPECTF-- 200 http://%s/update/extract/?version=2.2&indent=on&wt=xml&literal.id=doc1&capture=p&fmap.p=text php-solr-2.5.1+2.4.0/solr-2.5.1/tests/016.solrclient_sendUpdateStream_file.phpt000066400000000000000000000017741374041537100264270ustar00rootroot00000000000000--TEST-- SolrClient::sendUpdateStream - send SolrExtractRequest (file) --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_FILES_PATH, ); $client = new SolrClient($options); $extractParams = new SolrModifiableParams(); $extractParams ->set(SolrExtractRequest::LITERALS_PREFIX . 'id', 'doc1') ->set(SolrExtractRequest::CAPTURE_ELEMENTS, 'p') ->set(SolrExtractRequest::FIELD_MAPPING_PREFIX . 'p', 'text') ; $extractRequest = SolrExtractRequest::createFromFile(EXTRACT_FILE_1, $extractParams); $response = $client->sendUpdateStream($extractRequest); $client->rollback(); echo $response->getHttpStatus() . PHP_EOL; echo $response->getRequestUrl() . PHP_EOL; ?> --EXPECTF-- 200 http://%s/update/extract/?version=2.2&indent=on&wt=xml&literal.id=doc1&capture=p&fmap.p=text php-solr-2.5.1+2.4.0/solr-2.5.1/tests/017.solrclient_deletebyqueries.phpt000066400000000000000000000021041374041537100253400ustar00rootroot00000000000000--TEST-- SolrClient::deleteByQueries() - delete by multiple queries --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $serverOutput = $client->deleteByQueries([ 'id:3675', 'id:2548' ]); $response = $serverOutput->getResponse(); print_r($serverOutput->getRawRequest()); print_r($response); try { $client->deleteByQueries(array(0,'')); } catch (SolrIllegalArgumentException $e) { echo sprintf("Exception %d: %s", $e->getCode(), $e->getMessage()); } ?> --EXPECTF-- id:3675 id:2548 SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => %d [QTime] => %d ) ) Exception 4000: Query number 1 is not a valid query string php-solr-2.5.1+2.4.0/solr-2.5.1/tests/017.solrclient_deletebyquery.phpt000066400000000000000000000014561374041537100250410ustar00rootroot00000000000000--TEST-- SolrClient::deleteByQuery() - delete by query --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $serverOutput = $client->deleteByQuery('id:3675'); $response = $serverOutput->getResponse(); print_r($serverOutput->getRawRequest()); print_r($response); ?> --EXPECTF-- id:3675 SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => %d [QTime] => %d ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/017.solrclient_threads.phpt000066400000000000000000000011301374041537100235750ustar00rootroot00000000000000--TEST-- SolrClient::threads() - Solr Threads Info --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $response = $client->threads()->getResponse(); print_r($response->system->threadCount); ?> --EXPECTF-- SolrObject Object ( [current] => %d [peak] => %d [daemon] => %d ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/018.solrclient_setservlet.phpt000066400000000000000000000014431374041537100243530ustar00rootroot00000000000000--TEST-- SolrClient::setServlet() - set different servlet for a certain request type --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $response = $client->ping(); echo $response->getRequestUrl().PHP_EOL; $client->setServlet(SolrClient::PING_SERVLET_TYPE, 'select'); $response = $client->ping(); echo $response->getRequestUrl().PHP_EOL; ?> --EXPECTF-- http://%s/solr/collection1/admin/ping/?version=2.2&indent=on&wt=xml http://%s/solr/collection1/select/?version=2.2&indent=on&wt=xml php-solr-2.5.1+2.4.0/solr-2.5.1/tests/019.solrclient_clone.phpt000066400000000000000000000012401374041537100232470ustar00rootroot00000000000000--TEST-- SolrClient::__clone() - expect exception on clone --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); try { $failing = clone $client; } catch (SolrIllegalOperationException $e) { echo sprintf("Exception %d: %s", $e->getCode(), $e->getMessage()) . PHP_EOL; } ?> --EXPECTF-- Exception 4001: Cloning of SolrClient objects is currently not supportedphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/019.solrclient_getdebug.phpt000066400000000000000000000026021374041537100237400ustar00rootroot00000000000000--TEST-- SolrClient::getDebug() - Get request debug logs for the last request --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $response = $client->ping(); $debug = $client->getDebug(); $lines = explode("\n",$debug); $print = false; sort($lines); foreach ( $lines as $line) { if ($line == '' || FALSE !== strpos($line, 'Trying') || 0 === strpos($line, 'Mark bundle') || 0 === strpos($line, 'Server') || 0 === strpos($line, 'Hostname') || 0 === strpos($line, 'TCP_NODELAY') || 0 === strpos($line, 'Accept-Encoding') || 0 === strpos($line, 'Curl_http_done') ) { $print = false; } else { $print = true; } if ($print) { echo $line . "\n"; } } ?> --EXPECTF-- Accept-Charset: utf-8 Accept: */* Authorization: Basic YWRtaW46Y2hhbmdlaXQ= Connected to %s (%s) port 8983 (#0) Connection #0 to host %s left intact Connection: keep-alive Content-Length: 0 Content-Type: application/xml; charset=UTF-8 HEAD /solr/collection1/admin/ping/?version=2.2&indent=on&wt=xml HTTP/1.1 HTTP/1.1 200 OK Host: %s:8983 Keep-Alive: 300 User-Agent: %s php-solr-2.5.1+2.4.0/solr-2.5.1/tests/019.solrclient_serialize.phpt000066400000000000000000000016371374041537100241500ustar00rootroot00000000000000--TEST-- SolrClient - serialization --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); try { serialize($client); } catch (SolrIllegalOperationException $e) { echo sprintf("Exception %d: %s", $e->getCode(), $e->getMessage()) . PHP_EOL; } try { $serializedString = 'O:10:"SolrClient":0:{}'; unserialize($serializedString); } catch (SolrIllegalOperationException $e) { echo sprintf("Exception %d: %s", $e->getCode(), $e->getMessage()) . PHP_EOL; } ?> --EXPECTF-- Exception 1001: SolrClient objects cannot be serialized or unserialized Exception 1001: SolrClient objects cannot be serialized or unserialized php-solr-2.5.1+2.4.0/solr-2.5.1/tests/020.solrdocument_adding_fields.phpt000066400000000000000000000027541374041537100252660ustar00rootroot00000000000000--TEST-- SolrDocument - checking dimension and magic property sets. --FILE-- addField('id', 1123); $doc->features = "PHP Client Side"; $doc->features = "Fast development cycles"; $doc['cat'] = 'Software'; $doc['cat'] = 'Custom Search'; $doc->cat = 'Information Technology'; print_r($doc->toArray()); ?> --EXPECT-- Array ( [document_boost] => 0 [field_count] => 3 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => 1123 ) ) [1] => SolrDocumentField Object ( [name] => features [boost] => 0 [values] => Array ( [0] => PHP Client Side [1] => Fast development cycles ) ) [2] => SolrDocumentField Object ( [name] => cat [boost] => 0 [values] => Array ( [0] => Software [1] => Custom Search [2] => Information Technology ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/020.solrdocument_update_field.phpt000066400000000000000000000044111374041537100251270ustar00rootroot00000000000000--TEST-- SolrInputDocument::updateField --FILE-- addField('id', 1123); $doc->updateField('field1', SolrInputDocument::UPDATE_MODIFIER_ADD, 'val1'); $doc->updateField('field2_s', SolrInputDocument::UPDATE_MODIFIER_SET, 'val2'); $doc->updateField('field3_i', SolrInputDocument::UPDATE_MODIFIER_INC, 5); $doc->updateField('field1', SolrInputDocument::UPDATE_MODIFIER_REMOVE, 'val0'); $doc->updateField('field1', SolrInputDocument::UPDATE_MODIFIER_REMOVEREGEX, '[\d]{2}/[\d]{2}/[\d]{4}'); try { $doc->updateField('arr2', 6, 'not gonna happen'); } catch (SolrIllegalArgumentException $e) { print_exception($e); } try { $doc->updateField('arr3', 0, 'not gonna happen'); } catch (SolrIllegalArgumentException $e) { print_exception($e); } print_r($doc->toArray()); ?> --EXPECT-- SolrIllegalArgumentException 4003: Invalid field value modifier. SolrIllegalArgumentException 4003: Invalid field value modifier. Array ( [document_boost] => 0 [field_count] => 4 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => 1123 ) ) [1] => SolrDocumentField Object ( [name] => field1 [boost] => 0 [values] => Array ( [0] => val1 [1] => val0 [2] => [\d]{2}/[\d]{2}/[\d]{4} ) ) [2] => SolrDocumentField Object ( [name] => field2_s [boost] => 0 [values] => Array ( [0] => val2 ) ) [3] => SolrDocumentField Object ( [name] => field3_i [boost] => 0 [values] => Array ( [0] => 5 ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/021.solrdocument_iterator.phpt000066400000000000000000000017661374041537100243460ustar00rootroot00000000000000--TEST-- SolrDocument - checking Iterator interface implementation --FILE-- addField('id', 1123); $doc->features = "PHP Client Side"; $doc->features = "Fast development cycles"; $doc['cat'] = 'Software'; $doc['cat'] = 'Custom Search'; $doc->cat = 'Information Technology'; foreach ($doc as $fieldname => $fieldvalues) { print "$fieldname\n"; print_r($fieldvalues); } ?> --EXPECT-- id SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => 1123 ) ) features SolrDocumentField Object ( [name] => features [boost] => 0 [values] => Array ( [0] => PHP Client Side [1] => Fast development cycles ) ) cat SolrDocumentField Object ( [name] => cat [boost] => 0 [values] => Array ( [0] => Software [1] => Custom Search [2] => Information Technology ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/022.solrdocument_getInputDocument.phpt000066400000000000000000000007541374041537100260100ustar00rootroot00000000000000--TEST-- SolrDocument::getInputDocument() - creating SolrInputDocument from SolrDocument --FILE-- addField('id', 1123); $doc->features = "PHP Client Side"; $doc->features = "Fast development cycles"; $doc['cat'] = 'Software'; $doc['cat'] = 'Custom Search'; $doc->cat = 'Information Technology'; $input_doc = $doc->getInputDocument(); var_dump(get_class($input_doc)); ?> --EXPECT-- string(17) "SolrInputDocument" php-solr-2.5.1+2.4.0/solr-2.5.1/tests/023.solrdocument_merge.phpt000066400000000000000000000031631374041537100236070ustar00rootroot00000000000000--TEST-- SolrDocument::merge() - merging source document into current document --FILE-- addField('id', 1123); $doc->features = "PHP Client Side"; $doc->features = "Fast development cycles"; $doc['cat'] = 'Software'; $doc['cat'] = 'Custom Search'; $doc->cat = 'Information Technology'; $second_doc->addField('cat', 'Lucene Search'); $second_doc->merge($doc, true); print_r($second_doc->toArray()); ?> --EXPECT-- Array ( [document_boost] => 0 [field_count] => 3 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => cat [boost] => 0 [values] => Array ( [0] => Software [1] => Custom Search [2] => Information Technology ) ) [1] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => 1123 ) ) [2] => SolrDocumentField Object ( [name] => features [boost] => 0 [values] => Array ( [0] => PHP Client Side [1] => Fast development cycles ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/023.solrdocument_merge_no_overwrite.phpt000066400000000000000000000030401374041537100264030ustar00rootroot00000000000000--TEST-- SolrDocument::merge() - merging source document into current document without overwrite --FILE-- addField('id', 1123); $doc->features = "PHP Client Side"; $doc->features = "Fast development cycles"; $doc['cat'] = 'Software'; $doc['cat'] = 'Custom Search'; $doc->cat = 'Information Technology'; $second_doc->addField('cat', 'Lucene Search'); $second_doc->merge($doc, false); print_r($second_doc->toArray()); ?> --EXPECT-- Array ( [document_boost] => 0 [field_count] => 3 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => cat [boost] => 0 [values] => Array ( [0] => Lucene Search ) ) [1] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => 1123 ) ) [2] => SolrDocumentField Object ( [name] => features [boost] => 0 [values] => Array ( [0] => PHP Client Side [1] => Fast development cycles ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/024.solrdocument_child_fetch.phpt000066400000000000000000000024231374041537100247430ustar00rootroot00000000000000--TEST-- SolrClient::query() - Query child documents SolrObject (Integ) --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_STORE_PATH, 'wt' => 'xml' ); $client = new SolrClient ( $options ); $query = new SolrQuery (); $query->setQuery ( 'id:1 AND {!parent which=$parentFilter}' ); $query->setParam ( 'parentFilter', 'content_type_s:product' ); $query->addFilterQuery('{!parent which=$parentFilter}'); $query->addField ( '*' ); $query->addField ( '[child parentFilter=$parentFilter]' ); $query->setStart ( 0 ); $query->setRows ( 50 ); $queryResponse = $client->query ( $query ); $response = $queryResponse->getResponse (); echo "----XML----" . PHP_EOL; var_dump($response->response->docs[0]->_childDocuments_[0]->id); echo "----JSON----" . PHP_EOL; $options['wt'] = 'json'; $client = new SolrClient ( $options ); $queryResponse = $client->query($query); $response = $queryResponse->getResponse (); var_dump($response->response->docs[0]->_childDocuments_[0]->id); ?> --EXPECT-- ----XML---- string(9) "IMM-HOW-S" ----JSON---- string(9) "IMM-HOW-S"php-solr-2.5.1+2.4.0/solr-2.5.1/tests/025.solrdocument_haschilddocuments.phpt000066400000000000000000000005141374041537100262100ustar00rootroot00000000000000--TEST-- SolrDocument::hasChildDocuments() - Method test --FILE-- response->docs[0]->hasChildDocuments()); ?> --EXPECT-- bool(true)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/026.solrdocument_getchilddocscount.phpt000066400000000000000000000005221374041537100262140ustar00rootroot00000000000000--TEST-- SolrDocument::getChildDocumentsCount() - Method test --FILE-- response->docs[0]->getChildDocumentsCount()); ?> --EXPECT-- int(1)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/027.solrdocument_getinputdocument_children.phpt000066400000000000000000000023601374041537100277600ustar00rootroot00000000000000--TEST-- SolrDocument::getInputDocument() - Where document has child docs --FILE-- response->docs as $doc) { $childrenOfTheInput = $doc->getInputDocument()->getChildDocuments(); if ($childrenOfTheInput) { $firstChild = $childrenOfTheInput[0]; var_dump(get_class($firstChild)); var_dump(current($childrenOfTheInput)->toArray()); } } ?> --EXPECT-- string(17) "SolrInputDocument" array(3) { ["document_boost"]=> float(0) ["field_count"]=> int(1) ["fields"]=> array(1) { [0]=> object(SolrDocumentField)#9 (3) { ["name"]=> string(2) "id" ["boost"]=> float(0) ["values"]=> array(1) { [0]=> string(9) "CHILD_1_1" } } } } string(17) "SolrInputDocument" array(3) { ["document_boost"]=> float(0) ["field_count"]=> int(1) ["fields"]=> array(1) { [0]=> object(SolrDocumentField)#10 (3) { ["name"]=> string(2) "id" ["boost"]=> float(0) ["values"]=> array(1) { [0]=> string(9) "CHILD_2_1" } } } } php-solr-2.5.1+2.4.0/solr-2.5.1/tests/028.solrdocument_clone.phpt000066400000000000000000000023361374041537100236160ustar00rootroot00000000000000--TEST-- SolrDocument - clone --FILE-- response->docs as $doc) { $clone = clone $doc; $childrenOfTheInput = $clone->getInputDocument()->getChildDocuments(); if ($childrenOfTheInput) { $firstChild = $childrenOfTheInput[0]; var_dump(get_class($firstChild)); var_dump(current($childrenOfTheInput)->toArray()); } } ?> --EXPECTF-- string(17) "SolrInputDocument" array(3) { ["document_boost"]=> float(0) ["field_count"]=> int(1) ["fields"]=> array(1) { [0]=> object(SolrDocumentField)#%d (3) { ["name"]=> string(2) "id" ["boost"]=> float(0) ["values"]=> array(1) { [0]=> string(9) "CHILD_1_1" } } } } string(17) "SolrInputDocument" array(3) { ["document_boost"]=> float(0) ["field_count"]=> int(1) ["fields"]=> array(1) { [0]=> object(SolrDocumentField)#%d (3) { ["name"]=> string(2) "id" ["boost"]=> float(0) ["values"]=> array(1) { [0]=> string(9) "CHILD_2_1" } } } } php-solr-2.5.1+2.4.0/solr-2.5.1/tests/029.solrdocument_serialize.phpt000066400000000000000000000017311374041537100245040ustar00rootroot00000000000000--TEST-- SolrDocument - clone --FILE-- response->docs[1]; $serializedString = serialize($doc); print_r($serializedString); echo PHP_EOL; print_r(unserialize($serializedString)->toArray()); ?> --EXPECT-- C:12:"SolrDocument":172:{ parent_2 } Array ( [document_boost] => 0 [field_count] => 1 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => parent_2 ) ) ) )php-solr-2.5.1+2.4.0/solr-2.5.1/tests/030.solrdocument_magic.phpt000066400000000000000000000007341374041537100235670ustar00rootroot00000000000000--TEST-- SolrDocument - magic __isset/__unset/__get/__set --FILE-- check = 1; $doc->deleteMe = 1; var_dump(isset($doc->check)); var_dump(isset($doc->doesNotExist)); var_dump(isset($doc->deleteMe)); unset($doc->deleteMe); var_dump(isset($doc->deleteMe)); $doc->addField('id', 1); var_dump($doc->id instanceof SolrDocumentField); ?> --EXPECTF-- bool(true) bool(false) bool(true) bool(false) bool(true)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/031.solrdocument_clear.phpt000066400000000000000000000006361374041537100235770ustar00rootroot00000000000000--TEST-- SolrDocument::clear - Remove all fields from the document --FILE-- check = 1; var_dump($doc->getFieldCount()); $doc->clear(); var_dump($doc->getFieldCount()); ?> --EXPECTF-- int(1) int(0)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/032.solrdocument_fieldexists.phpt000066400000000000000000000006141374041537100250310ustar00rootroot00000000000000--TEST-- SolrDocument::fieldExists --FILE-- check = 1; var_dump($doc->fieldExists('check')); var_dump($doc->fieldExists('nonExistingField')); ?> --EXPECT-- bool(true) bool(false)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/033.solrdocument_sort.phpt000066400000000000000000000030441374041537100234760ustar00rootroot00000000000000--TEST-- SolrDocument::sort - Sort Document fields --FILE-- addField('z1', 'z1val'); $doc->addField('z1', 'z1val2'); $doc->addField('z1', 'z1val3'); $doc->addField('id', 334455); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Lucene'); separator('unsorted'); print_r($doc->getFieldNames()); separator('field ASC'); $doc->sort(SolrDocument::SORT_FIELD_NAME, SolrDocument::SORT_ASC); print_r($doc->getFieldNames()); separator('field DESC'); $doc->sort(SolrDocument::SORT_FIELD_NAME, SolrDocument::SORT_DESC); print_r($doc->getFieldNames()); separator('value ASC'); $doc->sort(SolrDocument::SORT_FIELD_VALUE_COUNT, SolrDocument::SORT_ASC); print_r($doc->getFieldNames()); separator('value DESC'); $doc->sort(SolrDocument::SORT_FIELD_VALUE_COUNT, SolrDocument::SORT_DESC); print_r($doc->getFieldNames()); ?> --EXPECT-- =================================== unsorted =================================== Array ( [0] => z1 [1] => id [2] => cat ) ================================== field ASC =================================== Array ( [0] => cat [1] => id [2] => z1 ) ================================== field DESC ================================== Array ( [0] => z1 [1] => id [2] => cat ) ================================== value ASC =================================== Array ( [0] => id [1] => cat [2] => z1 ) ================================== value DESC ================================== Array ( [0] => z1 [1] => cat [2] => id ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/034.solrdocument_deletefield.phpt000066400000000000000000000003721374041537100247570ustar00rootroot00000000000000--TEST-- SolrDocument::deleteField --FILE-- check = 1; var_dump($doc->getFieldCount()); $doc->deleteField('check'); var_dump($doc->getFieldCount()); ?> --EXPECTF-- int(1) int(0)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/035.solrdocument_getfieldnames.phpt000066400000000000000000000005021374041537100253140ustar00rootroot00000000000000--TEST-- SolrDocument::getFieldNames --FILE-- addField('id', 334455); $doc->addField('manu_id_s', 'apache'); $doc->addField('cat', 'Software'); print_r($doc->getFieldNames()); ?> --EXPECT-- Array ( [0] => id [1] => manu_id_s [2] => cat ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/036.solrdocument_array_access.phpt000066400000000000000000000020531374041537100251500ustar00rootroot00000000000000--TEST-- SolrDocument - Array Access --FILE-- addField('id', 334455); $doc->addField('manu_id_s', 'apache'); // set $doc['cat'] = 'Software'; // get var_dump($doc['cat']->values[0]); // exists var_dump(isset($doc['cat'])); // unset unset($doc['cat']); print_r($doc->toArray()); ?> --EXPECT-- string(8) "Software" bool(true) Array ( [document_boost] => 0 [field_count] => 2 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => 334455 ) ) [1] => SolrDocumentField Object ( [name] => manu_id_s [boost] => 0 [values] => Array ( [0] => apache ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/037.solrdocument_getfield.phpt000066400000000000000000000005461374041537100243020ustar00rootroot00000000000000--TEST-- SolrDocument::getField --FILE-- check = 1; var_dump($doc->getField('check') instanceof SolrDocumentField); ?> --EXPECT-- bool(true)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/040.solrobject_xmlresponse.phpt000066400000000000000000000050401374041537100245120ustar00rootroot00000000000000--TEST-- SolrObject - checking xml response digest --FILE-- --EXPECT-- SolrObject Object ( [responseHeader] => SolrObject Object ( [status] => 0 [QTime] => 72 ) [system] => SolrObject Object ( [threadCount] => SolrObject Object ( [current] => 15 [peak] => 15 [daemon] => 13 ) [threadDump] => SolrObject Object ( [thread] => SolrObject Object ( [id] => 1 [name] => main [state] => RUNNABLE [native] => 1 [cpuTime] => 3340.0000ms [userTime] => 3180.0000ms [stackTrace] => Array ( [0] => java.net.PlainSocketImpl.socketAccept(Native Method) [1] => java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384) [2] => java.net.ServerSocket.implAccept(ServerSocket.java:450) [3] => java.net.ServerSocket.accept(ServerSocket.java:421) [4] => org.apache.catalina.core.StandardServer.await(StandardServer.java:389) [5] => org.apache.catalina.startup.Catalina.await(Catalina.java:642) [6] => org.apache.catalina.startup.Catalina.start(Catalina.java:602) [7] => sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [8] => sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [9] => sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [10] => java.lang.reflect.Method.invoke(Method.java:585) [11] => org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) [12] => org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) ) ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/041.solrobject_illegal_operation.phpt000066400000000000000000000034371374041537100256350ustar00rootroot00000000000000--TEST-- SolrObject - checking illegal operation of modifying object --FILE-- email = "iekpo@php.net"; } catch (Exception $e) { var_dump($e->getCode()); var_dump($e->getMessage()); } try { $solrObject['usingOffset'] = 'test'; } catch (SolrIllegalOperationException $e) { echo sprintf("Exception %d: %s", $e->getCode(), $e->getMessage()) . PHP_EOL; } try { $solrObject['newprop2_dimension_access'] = 'test'; } catch (SolrIllegalOperationException $e) { echo sprintf("Exception %d: %s", $e->getCode(), $e->getMessage()) . PHP_EOL; } // unset try { unset($solrObject->responseHeader); } catch (SolrIllegalOperationException $e) { echo sprintf("Exception %d: %s", $e->getCode(), $e->getMessage()) . PHP_EOL; } try { unset($solrObject['responseHeader']); } catch (SolrIllegalOperationException $e) { echo sprintf("Exception %d: %s", $e->getCode(), $e->getMessage()) . PHP_EOL; } ?> --EXPECTF-- int(1006) string(83) "SolrObject instances are read-only. Properties cannot be added, updated or removed." Warning: main(): Attempting to set value for [usingOffset] property in a SolrObject instance in %s on line %d Exception 1006: SolrObject instances are read-only. Properties cannot be added, updated or removed. Warning: main(): Attempting to set value for [newprop2_dimension_access] property in a SolrObject instance in %s on line %d Exception 1006: SolrObject instances are read-only. Properties cannot be added, updated or removed. Exception 1006: SolrObject instances are read-only. Properties cannot be added, updated or removed. Warning: main(): Attempting to remove [responseHeader] property in a SolrObject instance in %s on line %d Exception 1006: SolrObject instances are read-only. Properties cannot be added, updated or removed. php-solr-2.5.1+2.4.0/solr-2.5.1/tests/042.solrobject_magic_property.phpt000066400000000000000000000023641374041537100251670ustar00rootroot00000000000000--TEST-- SolrObject - testing the magic property access --FILE-- system->threadDump->thread->stackTrace); ?> --EXPECT-- Array ( [0] => java.net.PlainSocketImpl.socketAccept(Native Method) [1] => java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384) [2] => java.net.ServerSocket.implAccept(ServerSocket.java:450) [3] => java.net.ServerSocket.accept(ServerSocket.java:421) [4] => org.apache.catalina.core.StandardServer.await(StandardServer.java:389) [5] => org.apache.catalina.startup.Catalina.await(Catalina.java:642) [6] => org.apache.catalina.startup.Catalina.start(Catalina.java:602) [7] => sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [8] => sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [9] => sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [10] => java.lang.reflect.Method.invoke(Method.java:585) [11] => org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) [12] => org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/043.solrobject_magic_properties.phpt000066400000000000000000000006251374041537100254760ustar00rootroot00000000000000--TEST-- SolrObject - test property access --FILE-- responseHeader; $system = $solrObject->system; var_dump(isset($solrObject['system'])); var_dump(property_exists($solrObject, 'system')); ?> --EXPECT-- bool(true) bool(true)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/044.solrobject_dimension_access_properties.phpt000066400000000000000000000044111374041537100277220ustar00rootroot00000000000000--TEST-- SolrObject - checking dimension access on properties. --FILE-- --EXPECT-- SolrObject Object ( [status] => 0 [QTime] => 72 ) SolrObject Object ( [threadCount] => SolrObject Object ( [current] => 15 [peak] => 15 [daemon] => 13 ) [threadDump] => SolrObject Object ( [thread] => SolrObject Object ( [id] => 1 [name] => main [state] => RUNNABLE [native] => 1 [cpuTime] => 3340.0000ms [userTime] => 3180.0000ms [stackTrace] => Array ( [0] => java.net.PlainSocketImpl.socketAccept(Native Method) [1] => java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384) [2] => java.net.ServerSocket.implAccept(ServerSocket.java:450) [3] => java.net.ServerSocket.accept(ServerSocket.java:421) [4] => org.apache.catalina.core.StandardServer.await(StandardServer.java:389) [5] => org.apache.catalina.startup.Catalina.await(Catalina.java:642) [6] => org.apache.catalina.startup.Catalina.start(Catalina.java:602) [7] => sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [8] => sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [9] => sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [10] => java.lang.reflect.Method.invoke(Method.java:585) [11] => org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) [12] => org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/045.solrobject_array_access.phpt000066400000000000000000000044071374041537100246050ustar00rootroot00000000000000--TEST-- SolrObject - checking dimension access on properties. --FILE-- --EXPECT-- SolrObject Object ( [status] => 0 [QTime] => 72 ) SolrObject Object ( [threadCount] => SolrObject Object ( [current] => 15 [peak] => 15 [daemon] => 13 ) [threadDump] => SolrObject Object ( [thread] => SolrObject Object ( [id] => 1 [name] => main [state] => RUNNABLE [native] => 1 [cpuTime] => 3340.0000ms [userTime] => 3180.0000ms [stackTrace] => Array ( [0] => java.net.PlainSocketImpl.socketAccept(Native Method) [1] => java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384) [2] => java.net.ServerSocket.implAccept(ServerSocket.java:450) [3] => java.net.ServerSocket.accept(ServerSocket.java:421) [4] => org.apache.catalina.core.StandardServer.await(StandardServer.java:389) [5] => org.apache.catalina.startup.Catalina.await(Catalina.java:642) [6] => org.apache.catalina.startup.Catalina.start(Catalina.java:602) [7] => sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [8] => sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [9] => sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [10] => java.lang.reflect.Method.invoke(Method.java:585) [11] => org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) [12] => org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/046.solrobject_getpropertynames.phpt000066400000000000000000000006751374041537100255620ustar00rootroot00000000000000--TEST-- SolrObject - SolrObject::getPropertyNames() --FILE-- getPropertyNames()); require_once "bootstrap.inc"; $xml_reponse = file_get_contents(EXAMPLE_RESPONSE_XML_1); $solrObject = SolrUtils::digestXMLResponse($xml_reponse); var_dump($solrObject->getPropertyNames()); ?> --EXPECT-- array(0) { } array(2) { [0]=> string(14) "responseHeader" [1]=> string(6) "system" } php-solr-2.5.1+2.4.0/solr-2.5.1/tests/047.solrobject_offsetExists.phpt000066400000000000000000000006731374041537100246370ustar00rootroot00000000000000--TEST-- SolrObject::offsetExists --FILE-- --EXPECT-- bool(false) bool(true) bool(false)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/050.solrinputdocument_addchilddocument_01.phpt000066400000000000000000000014411374041537100273600ustar00rootroot00000000000000--TEST-- SolrInputDocument::addChildDocument() - add child document --FILE-- addField('id', 1123); $doc->addField('features', "PHP Client Side"); $doc->addField('features', "Fast development cycles"); $doc->cat = 'Information Technology'; $secondDoc->addField('cat', 'Lucene Search'); $secondDoc->cat = 'Custom Search'; $doc->addChildDocument($secondDoc); var_dump($doc->hasChildDocuments(), $secondDoc->hasChildDocuments()); $childs = $doc->getChildDocuments(); print_r($childs[0]->getField('cat')); ?> --EXPECT-- bool(true) bool(false) SolrDocumentField Object ( [name] => cat [boost] => 0 [values] => Array ( [0] => Lucene Search ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/050.solrinputdocument_addchilddocument_02_error.phpt000066400000000000000000000014511374041537100305730ustar00rootroot00000000000000--TEST-- SolrInputDocument::addChildDocument()/SolrInputDocument::addChildDocuments() - Expected SolrIllegalArgumentException --FILE-- addField('id', 1123); $doc->addField('features', "PHP Client Side"); $doc->addField('features', "Fast development cycles"); $doc->cat = 'Information Technology'; try { $doc->addChildDocument($child1); } catch (SolrIllegalArgumentException $e) { echo $e->getMessage(). PHP_EOL; } $children = array($child1, $child2); try { $doc->addChildDocuments($children); } catch (SolrIllegalArgumentException $e) { echo $e->getMessage(). PHP_EOL; } ?> --EXPECT-- Child document has no fields SolrInputDocument number 1 has no fieldsphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/051.solrinputdocument_getchilddocuments.phpt000066400000000000000000000012651374041537100272770ustar00rootroot00000000000000--TEST-- SolrInputDocument::getChildDocuments() - test --FILE-- addField('id', 1123); $doc->addField('features', "PHP Client Side"); $doc->addField('features', "Fast development cycles"); $doc->cat = 'Information Technology'; $secondDoc->addField('cat', 'Lucene Search'); $secondDoc->cat = 'Custom Search'; $doc->addChildDocument($secondDoc); $childs = $doc->getChildDocuments(); print_r($childs[0]->getField('cat')); ?> --EXPECT-- SolrDocumentField Object ( [name] => cat [boost] => 0 [values] => Array ( [0] => Lucene Search ) )php-solr-2.5.1+2.4.0/solr-2.5.1/tests/052.solrinputdocument_haschilddocuments.phpt000066400000000000000000000011041374041537100272640ustar00rootroot00000000000000--TEST-- SolrInputDocument::hasChildDocuments() - test --FILE-- addField('id', 1123); $doc->addField('features', "PHP Client Side"); $doc->addField('features', "Fast development cycles"); $doc->cat = 'Information Technology'; $secondDoc->addField('cat', 'Lucene Search'); $secondDoc->cat = 'Custom Search'; $doc->addChildDocument($secondDoc); var_dump($doc->hasChildDocuments()); var_dump($secondDoc->hasChildDocuments()); ?> --EXPECT-- bool(true) bool(false)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/053.solrinputdocument_getchilddocumentscount.phpt000066400000000000000000000011121374041537100303410ustar00rootroot00000000000000--TEST-- SolrInputDocument::getChildDocumentsCount() - test --FILE-- addField('id', 1123); $doc->addField('features', "PHP Client Side"); $doc->addField('features', "Fast development cycles"); $doc->cat = 'Information Technology'; $secondDoc->addField('cat', 'Lucene Search'); $secondDoc->cat = 'Custom Search'; $doc->addChildDocument($secondDoc); var_dump($doc->getChildDocumentsCount()); var_dump($secondDoc->getChildDocumentsCount()); ?> --EXPECT-- int(1) int(0)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/054.solrinputdocument_addchilddocuments.phpt000066400000000000000000000013271374041537100272520ustar00rootroot00000000000000--TEST-- SolrInputDocument::addChildDocuments() - add child documents --FILE-- addField('id', 1123); $doc->addField('features', "PHP Client Side"); $doc->addField('features', "Fast development cycles"); $doc->cat = 'Information Technology'; $doc2->addField('cat', 'Lucene Search'); $doc2->cat = 'Custom Search'; $doc2->addField('cat', 'Lucene Search'); $doc2->cat = 'Custom Search'; $doc3->addField('cat', 'Lucene Search'); $doc3->cat = 'Custom Search'; $docs = array($doc2, $doc3); $doc->addChildDocuments($docs); var_dump($doc->getChildDocumentsCount()); ?> --EXPECT-- int(2)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/055.solrinputdocument_serialization.phpt000066400000000000000000000004521374041537100264500ustar00rootroot00000000000000--TEST-- SolrInputDocument - serialize/unserialize Exception --FILE-- getMessage().PHP_EOL; } ?> --EXPECT-- SolrInputDocument objects cannot be serialized or unserializedphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/056.solrinputdocument_toArray.phpt000066400000000000000000000016111374041537100252130ustar00rootroot00000000000000--TEST-- SolrInputDocument::toArray - Array conversion --FILE-- addField('field_1', 4, 3.4); $doc->addField('field_2', 1); print_r($doc->toArray()); ?> --EXPECT-- Array ( [document_boost] => 0 [field_count] => 2 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => field_1 [boost] => 3.4 [values] => Array ( [0] => 4 ) ) [1] => SolrDocumentField Object ( [name] => field_2 [boost] => 0 [values] => Array ( [0] => 1 ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/057.solrinputdocument_clone.phpt000066400000000000000000000033771374041537100247060ustar00rootroot00000000000000--TEST-- SolrInputDocument - clone --FILE-- setBoost(4); $doc->addField('id', 334455); $doc->addField('cat', 'Software', 4); $doc->addField('cat', 'Lucene'); $doc2 = clone $doc; $doc2->deleteField('id'); $doc2->addField('id', '88', 8); print_r($doc->toArray()); print_r($doc2->toArray()); ?> --EXPECTF-- Array ( [document_boost] => 4 [field_count] => 2 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => 334455 ) ) [1] => SolrDocumentField Object ( [name] => cat [boost] => 4 [values] => Array ( [0] => Software [1] => Lucene ) ) ) ) Array ( [document_boost] => 4 [field_count] => 2 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => cat [boost] => 4 [values] => Array ( [0] => Software [1] => Lucene ) ) [1] => SolrDocumentField Object ( [name] => id [boost] => 8 [values] => Array ( [0] => 88 ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/058.solrinputdocument_deletefield.phpt000066400000000000000000000020621374041537100260430ustar00rootroot00000000000000--TEST-- SolrInputDocument::deleteField - Delete a field from SolrInputDocument --FILE-- addField('id', 334455); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Lucene'); $doc->addField('deleteme', 'Lucene'); $doc->deleteField('deleteme'); print_r($doc->toArray()); ?> --EXPECT-- Array ( [document_boost] => 0 [field_count] => 2 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => 334455 ) ) [1] => SolrDocumentField Object ( [name] => cat [boost] => 0 [values] => Array ( [0] => Software [1] => Lucene ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/059.solrinputdocument_clear.phpt000066400000000000000000000006611374041537100246670ustar00rootroot00000000000000--TEST-- SolrInputDocument::clear - Clear document fields --FILE-- addField('id', 334455); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Lucene'); $doc->addField('z1', 'z1val'); $doc->clear(); var_dump($doc->toArray()); ?> --EXPECT-- array(3) { ["document_boost"]=> float(0) ["field_count"]=> int(0) ["fields"]=> array(0) { } } php-solr-2.5.1+2.4.0/solr-2.5.1/tests/059.solrinputdocument_fieldexists.phpt000066400000000000000000000004041374041537100261170ustar00rootroot00000000000000--TEST-- SolrInputDocument::fieldExists --FILE-- addField('id', 1123); var_dump($doc->fieldExists('id')); var_dump($doc->fieldExists('features')); ?> --EXPECT-- bool(true) bool(false)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/059.solrinputdocument_getboost.phpt000066400000000000000000000003231374041537100254220ustar00rootroot00000000000000--TEST-- SolrInputDocument::getBoost - Test document fieldnames --FILE-- setBoost(4); var_dump($doc->getBoost()); ?> --EXPECT-- float(4)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/059.solrinputdocument_getfield.phpt000066400000000000000000000006661374041537100253710ustar00rootroot00000000000000--TEST-- SolrInputDocument::getField --FILE-- addField('id', 123); $doc->addField('cat', 'Software'); var_dump($doc->getField('id')); var_dump($doc->getField('non_existing_field')); ?> --EXPECT-- object(SolrDocumentField)#2 (3) { ["name"]=> string(2) "id" ["boost"]=> float(0) ["values"]=> array(1) { [0]=> string(3) "123" } } bool(false) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/059.solrinputdocument_getfieldcount.phpt000066400000000000000000000004761374041537100264410ustar00rootroot00000000000000--TEST-- SolrInputDocument::getFieldCount --FILE-- addField('id', 123); $doc->addField('cat', 'Software'); $doc->addField('cat', 'Search Server'); $doc->addField('features', 'Software'); var_dump($doc->getFieldCount()); ?> --EXPECT-- int(3)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/059.solrinputdocument_getfieldnames.phpt000066400000000000000000000005471374041537100264130ustar00rootroot00000000000000--TEST-- SolrInputDocument::getFieldNames - Test document fieldnames --FILE-- addField('id', 334455); $doc->addField('manu_id_s', 'apache'); $doc->addField('cat', 'Software'); print_r($doc->getFieldNames()); ?> --EXPECT-- Array ( [0] => id [1] => manu_id_s [2] => cat ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/059.solrinputdocument_merge.phpt000066400000000000000000000065041374041537100247020ustar00rootroot00000000000000--TEST-- SolrInputDocument::merge - Merge 2 docs --FILE-- addField('id', 1123); $doc->addField('features', "PHP Client Side", 4); $doc->addField('features', "Fast development cycles"); $doc->addField('cat', 'Information Technology'); separator('original document'); print_r($doc->toArray()); $doc2 = new SolrInputDocument(); $doc2->addField('cat', 'Lucene Search'); $doc2->merge($doc, true); // merge doc into doc2, overwrite cat separator('merge overwrite (cat field merged ?)'); print_r($doc->getField('cat')->values); var_dump($doc->fieldExists('features')); print_r($doc2->toArray()); $doc3 = new SolrInputDocument(); $doc3->addField('manu_s_id', 'apache'); $doc3->addField('id', '124'); $doc3->merge($doc, false); // do not overwrite separator('merge without overwrite'); print_r($doc3->getField('id')->values); separator('END'); ?> --EXPECT-- ============================== original document =============================== Array ( [document_boost] => 0 [field_count] => 3 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => 1123 ) ) [1] => SolrDocumentField Object ( [name] => features [boost] => 4 [values] => Array ( [0] => PHP Client Side [1] => Fast development cycles ) ) [2] => SolrDocumentField Object ( [name] => cat [boost] => 0 [values] => Array ( [0] => Information Technology ) ) ) ) ===================== merge overwrite (cat field merged ?) ===================== Array ( [0] => Information Technology ) bool(true) Array ( [document_boost] => 0 [field_count] => 3 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => cat [boost] => 0 [values] => Array ( [0] => Information Technology ) ) [1] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => 1123 ) ) [2] => SolrDocumentField Object ( [name] => features [boost] => 4 [values] => Array ( [0] => PHP Client Side [1] => Fast development cycles ) ) ) ) =========================== merge without overwrite ============================ Array ( [0] => 124 ) ===================================== END ======================================php-solr-2.5.1+2.4.0/solr-2.5.1/tests/059.solrinputdocument_set_getfieldboost.phpt000066400000000000000000000004301374041537100273000ustar00rootroot00000000000000--TEST-- SolrInputDocument::getFieldBoost --FILE-- addField('id', 123); $doc->addField('cat', 'Software'); $doc->setFieldBoost('cat', 2.1); var_dump($doc->getFieldBoost('cat')); ?> --EXPECT-- float(2.1)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/059.solrinputdocument_setversion.phpt000066400000000000000000000015311374041537100257770ustar00rootroot00000000000000--TEST-- SolrInputDocument::setVersion - Set document version --SKIPIF-- --FILE-- addField('id', 'IW-02'); $doc->setVersion(SolrInputDocument::VERSION_ASSERT_EXISTS); var_dump($doc->getVersion()); $doc->setVersion(SolrInputDocument::VERSION_ASSERT_NOT_EXISTS); var_dump($doc->getVersion()); $doc->setVersion(SolrInputDocument::VERSION_ASSERT_NONE); var_dump($doc->getVersion()); $doc->setVersion(1498562624496861184); var_dump($doc->getVersion()); try { $doc->setVersion('AAAA-3333'); } catch (SolrIllegalArgumentException $e) { echo $e->getMessage(); } catch (TypeError $e) { echo $e->getMessage(); } ?> --EXPECTF-- int(1) int(-1) int(0) int(1498562624496861184) %slrInputDocument::setVersion()%s, string given php-solr-2.5.1+2.4.0/solr-2.5.1/tests/059.solrinputdocument_sort.phpt000066400000000000000000000042211374041537100245640ustar00rootroot00000000000000--TEST-- SolrInputDocument::sort - Sort Document fields --FILE-- addField('z1', 'z1val', 1); $doc->addField('z1', 'z1val2'); $doc->addField('z1', 'z1val3'); $doc->addField('id', 334455, 2); $doc->addField('cat', 'Software', 3); $doc->addField('cat', 'Lucene'); printf("---------------- %s --------------------\n", 'unsorted'); print_r($doc->getFieldNames()); printf("---------------- %s --------------------\n", 'field ASC'); $doc->sort(SolrDocument::SORT_FIELD_NAME, SolrDocument::SORT_ASC); print_r($doc->getFieldNames()); printf("---------------- %s --------------------\n", 'field DESC'); $doc->sort(SolrDocument::SORT_FIELD_NAME, SolrDocument::SORT_DESC); print_r($doc->getFieldNames()); printf("---------------- %s --------------------\n", 'boost ASC'); $doc->sort(SolrDocument::SORT_FIELD_BOOST_VALUE, SolrDocument::SORT_ASC); print_r($doc->getFieldNames()); printf("---------------- %s --------------------\n", 'boost DESC'); $doc->sort(SolrDocument::SORT_FIELD_BOOST_VALUE, SolrDocument::SORT_DESC); print_r($doc->getFieldNames()); printf("---------------- %s --------------------\n", 'value ASC'); $doc->sort(SolrDocument::SORT_FIELD_VALUE_COUNT, SolrDocument::SORT_ASC); print_r($doc->getFieldNames()); printf("---------------- %s --------------------\n", 'value DESC'); $doc->sort(SolrDocument::SORT_FIELD_VALUE_COUNT, SolrDocument::SORT_DESC); print_r($doc->getFieldNames()); ?> --EXPECT-- ---------------- unsorted -------------------- Array ( [0] => z1 [1] => id [2] => cat ) ---------------- field ASC -------------------- Array ( [0] => cat [1] => id [2] => z1 ) ---------------- field DESC -------------------- Array ( [0] => z1 [1] => id [2] => cat ) ---------------- boost ASC -------------------- Array ( [0] => z1 [1] => id [2] => cat ) ---------------- boost DESC -------------------- Array ( [0] => cat [1] => id [2] => z1 ) ---------------- value ASC -------------------- Array ( [0] => id [1] => cat [2] => z1 ) ---------------- value DESC -------------------- Array ( [0] => z1 [1] => cat [2] => id ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/060.solrquery_comon_query_params.phpt000066400000000000000000000030331374041537100257370ustar00rootroot00000000000000--TEST-- SolrQuery - testing CommonQueryParameters --FILE-- getQuery(), $query->getTimeAllowed(), $query->getStart(), $query->getRows(), $query->getFields(), $query->getFilterQueries(), $query->getSortFields() ); $nullOutput = ob_get_clean(); $query->setParam('a', 1); $query->setParam('b', 2); $query->setParam('c', 3); $query->setStart(4)->setQuery('solr')->setTimeAllowed(500)->setRows(17); $query->addField('israel')->addField('joshua')->addField('june'); $query->addSortField('cat', SolrQuery::ORDER_ASC); $query->addFilterQuery('solr')->addFilterQuery('solr1')->addFilterQuery('solr2'); $query ->setShowDebugInfo(true) ->setExplainOther('id:SOL*') ->setOmitHeader(false) ->setEchoHandler(true) ->setEchoParams('all') ; echo $query . PHP_EOL . PHP_EOL; var_dump( $query->getQuery(), $query->getTimeAllowed(), $query->getStart(), $query->getRows(), $query->getFields(), $query->getFilterQueries(), $query->getSortFields() ); echo $nullOutput; ?> --EXPECT-- a=1&b=2&c=3&start=4&q=solr&timeAllowed=500&rows=17&fl=israel,joshua,june&sort=cat asc&fq=solr&fq=solr1&fq=solr2&debugQuery=true&explainOther=id:SOL*&omitHeader=false&echoHandler=true&echoParams=all string(4) "solr" int(500) int(4) int(17) array(3) { [0]=> string(6) "israel" [1]=> string(6) "joshua" [2]=> string(4) "june" } array(3) { [0]=> string(4) "solr" [1]=> string(5) "solr1" [2]=> string(5) "solr2" } array(1) { [0]=> string(7) "cat asc" } NULL NULL NULL NULL NULL NULL NULLphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/061.solrquery_simpleFacetParameters.phpt000066400000000000000000000036351374041537100263250ustar00rootroot00000000000000--TEST-- SolrQuery - testing SimpleFacetParameters --FILE-- setFacet(0); $query->addFacetField('israel')->addFacetField('israel2'); $query->addFacetQuery('silk')->addFacetQuery('name:june'); $query->setFacetPrefix('A')->setFacetPrefix('C', 'june'); $query->setFacetSort(1)->setFacetSort(0, 'june'); $query->setFacetLimit(98)->setFacetLimit(44, 'june'); $query->setFacetOffset(110)->setFacetOffset(12, 'june'); $query->setFacetMinCount(4)->setFacetMinCount(30, 'june'); $query->setFacetMissing(1)->setFacetMissing(0, 'june'); $query->setFacetMethod('enum')->setFacetMethod('fc', 'june'); $query->setFacetEnumCacheMinDefaultFrequency(25); echo $query . PHP_EOL . PHP_EOL; var_dump( $query->getFacet(), $query->getFacetFields(), $query->getFacetQueries(), $query->getFacetPrefix(), $query->getFacetPrefix('june'), $query->getFacetSort(), $query->getFacetSort('june'), $query->getFacetLimit(), $query->getFacetLimit('june'), $query->getFacetOffset(), $query->getFacetOffset('june'), $query->getFacetMinCount(), $query->getFacetMinCount('june'), $query->getFacetMissing(), $query->getFacetMissing('june'), $query->getFacetMethod(), $query->getFacetMethod('june') ); ?> --EXPECTF-- facet=false&facet.field=israel&facet.field=israel2&facet.query=silk&facet.query=name:june&facet.prefix=A&f.june.facet.prefix=C&facet.sort=count&f.june.facet.sort=index&facet.limit=98&f.june.facet.limit=44&facet.offset=110&f.june.facet.offset=12&facet.mincount=4&f.june.facet.mincount=30&facet.missing=true&f.june.facet.missing=false&facet.method=enum&f.june.facet.method=fc&facet.enum.cache.minDf=25 bool(false) array(2) { [0]=> string(6) "israel" [1]=> string(7) "israel2" } array(2) { [0]=> string(4) "silk" [1]=> string(9) "name:june" } string(1) "A" string(1) "C" int(1) int(0) int(98) int(44) int(110) int(12) int(4) int(30) bool(true) bool(false) string(4) "enum" string(2) "fc" php-solr-2.5.1+2.4.0/solr-2.5.1/tests/062.solrquery_date_facet_parameters.phpt000066400000000000000000000037041374041537100263450ustar00rootroot00000000000000--TEST-- SolrQuery - Testing Date facet parameters --FILE-- getFacetDateFields(), $query->getFacetDateStart(), $query->getFacetDateStart('june'), $query->getFacetDateEnd(), $query->getFacetDateEnd('israel'), $query->getFacetDateGap(), $query->getFacetDateGap('june'), $query->getFacetDateHardEnd(), $query->getFacetDateHardEnd('june'), $query->getFacetDateOther(), $query->getFacetDateOther('june') ); $nullOutput = ob_get_clean(); $query->addFacetDateField('israel') ->addFacetDateField('israel') ->removeFacetDateField('israel') ; $query->setFacetDateStart('January')->setFacetDateStart('Feb', 'june'); $query->setFacetDateEnd('Jan')->setFacetDateEnd('Febr', 'israel'); $query->setFacetDateGap('AOL')->setFacetDateGap('YAHOO', 'june'); $query->setFacetDateHardEnd(1)->setFacetDateHardEnd(0,'june'); $query->addFacetDateOther('Google') ->addFacetDateOther('Yahoos','june') ->addFacetDateOther('removeme') ->removeFacetDateOther('removeme'); echo $query. PHP_EOL . PHP_EOL; var_dump( $query->getFacetDateFields(), $query->getFacetDateStart(), $query->getFacetDateStart('june'), $query->getFacetDateEnd(), $query->getFacetDateEnd('israel'), $query->getFacetDateGap(), $query->getFacetDateGap('june'), $query->getFacetDateHardEnd(), $query->getFacetDateHardEnd('june'), $query->getFacetDateOther(), $query->getFacetDateOther('june') ); echo $nullOutput; ?> --EXPECTF-- facet.date=israel&facet.date.start=January&f.june.facet.date.start=Feb&facet.date.end=Jan&f.israel.facet.date.end=Febr&facet.date.gap=AOL&f.june.facet.date.gap=YAHOO&facet.date.hardend=true&f.june.facet.date.hardend=false&f.june.facet.date.other=Yahoos array(1) { [0]=> string(6) "israel" } string(7) "January" string(3) "Feb" string(3) "Jan" string(4) "Febr" string(3) "AOL" string(5) "YAHOO" bool(true) bool(false) NULL array(1) { [0]=> string(6) "Yahoos" } NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULLphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/063.solrquery_HighlightingParameters.phpt000066400000000000000000000115731374041537100265000ustar00rootroot00000000000000--TEST-- SolrQuery - testing HighlightingParameters --FILE-- getHighlight(), $query->getHighlightFields(), $query->getHighlightSnippets(), $query->getHighlightSnippets('june'), $query->getHighlightFragsize(), $query->getHighlightFragsize('june'), $query->getHighlightMergeContiguous(), $query->getHighlightMergeContiguous('june'), $query->getHighlightRequireFieldMatch(), $query->getHighlightMaxAnalyzedChars(), $query->getHighlightAlternateField(), $query->getHighlightAlternateField('june'), $query->getHighlightMaxAlternateFieldLength(), $query->getHighlightMaxAlternateFieldLength('june'), $query->getHighlightFormatter(), $query->getHighlightFormatter('june'), $query->getHighlightSimplePre(), $query->getHighlightSimplePre('june'), $query->getHighlightSimplePost(), $query->getHighlightSimplePost('june'), $query->getHighlightFragmenter(), $query->getHighlightFragmenter('june'), $query->getHighlightUsePhraseHighlighter(), $query->getHighlightHighlightMultiTerm(), $query->getHighlightRegexSlop(), $query->getHighlightRegexPattern(), $query->getHighlightRegexMaxAnalyzedChars() ); $nullOutput = ob_get_clean(); $query->setHighlight(0); $query->addHighlightField('a')->addHighlightField('a')->addHighlightField('a') ->addHighlightField('b'); $query->removeHighlightField('a')->removeHighlightField('a')->removeHighlightField('a'); $query->setHighlightSnippets(4)->setHighlightSnippets(5, 'june'); $query->setHighlightFragsize(41)->setHighlightFragsize(52, 'june'); $query->setHighlightMergeContiguous(true)->setHighlightMergeContiguous(false, 'june'); $query->setHighlightRequireFieldMatch(true); $query->setHighlightMaxAnalyzedChars(44)->setHighlightMaxAnalyzedChars(53); $query->setHighlightAlternateField('pizza')->setHighlightAlternateField('bread', 'june'); $query->setHighlightAlternateField('blue')->setHighlightAlternateField('red','june'); $query->setHighlightAlternateField('a')->setHighlightAlternateField('b','june'); $query->setHighlightMaxAlternateFieldLength(300)->setHighlightMaxAlternateFieldLength(335, 'june'); $query->setHighlightFormatter('F')->setHighlightFormatter('G', 'june'); $query->setHighlightSimplePre('OO')->setHighlightSimplePre('PP', 'june'); $query->setHighlightSimplePost('ZZ')->setHighlightSimplePost('YY', 'june'); $query->setHighlightFragmenter('gap')->setHighlightFragmenter('space', 'june'); $query->setHighlightUsePhraseHighlighter(false); $query->setHighlightHighlightMultiTerm(1); $query->setHighlightRegexSlop(0.0025); $query->setHighlightRegexPattern("israel")->setHighlightRegexPattern("ekpo"); $query->setHighlightRegexMaxAnalyzedChars(444)->setHighlightRegexMaxAnalyzedChars(5.0); echo $query . PHP_EOL . PHP_EOL; var_dump( $query->getHighlight(), $query->getHighlightFields(), $query->getHighlightSnippets(), $query->getHighlightSnippets('june'), $query->getHighlightFragsize(), $query->getHighlightFragsize('june'), $query->getHighlightMergeContiguous(), $query->getHighlightMergeContiguous('june'), $query->getHighlightRequireFieldMatch(), $query->getHighlightMaxAnalyzedChars(), $query->getHighlightAlternateField(), $query->getHighlightAlternateField('june'), $query->getHighlightMaxAlternateFieldLength(), $query->getHighlightMaxAlternateFieldLength('june'), $query->getHighlightFormatter(), $query->getHighlightFormatter('june'), $query->getHighlightSimplePre(), $query->getHighlightSimplePre('june'), $query->getHighlightSimplePost(), $query->getHighlightSimplePost('june'), $query->getHighlightFragmenter(), $query->getHighlightFragmenter('june'), $query->getHighlightUsePhraseHighlighter(), $query->getHighlightHighlightMultiTerm(), $query->getHighlightRegexSlop(), $query->getHighlightRegexPattern(), $query->getHighlightRegexMaxAnalyzedChars() ); echo PHP_EOL.$nullOutput; ?> --EXPECT-- hl=false&hl.fl=b&hl.snippets=4&f.june.hl.snippets=5&hl.fragsize=41&f.june.hl.fragsize=52&hl.mergeContiguous=true&f.june.hl.mergeContiguous=false&hl.requireFieldMatch=true&hl.maxAnalyzedChars=53&hl.alternateField=a&f.june.hl.alternateField=b&hl.maxAlternateFieldLength=300&f.june.hl.maxAlternateFieldLength=335&hl.formatter=F&f.june.hl.formatter=G&hl.simple.pre=OO&f.june.hl.simple.pre=PP&hl.simple.post=ZZ&f.june.hl.simple.post=YY&hl.fragmenter=gap&f.june.hl.fragmenter=space&hl.usePhraseHighlighter=false&hl.highlightMultiTerm=true&hl.regex.slop=0.0025&hl.regex.pattern=ekpo&hl.regex.maxAnalyzedChars=5 bool(false) array(1) { [0]=> string(1) "b" } int(4) int(5) int(41) int(52) bool(true) bool(false) bool(true) int(53) string(1) "a" string(1) "b" int(300) int(335) string(1) "F" string(1) "G" string(2) "OO" string(2) "PP" string(2) "ZZ" string(2) "YY" string(3) "gap" string(5) "space" bool(false) bool(true) float(0.0025) string(4) "ekpo" int(5) NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL php-solr-2.5.1+2.4.0/solr-2.5.1/tests/064.solrquery_StatsComponent.phpt000066400000000000000000000015401374041537100250220ustar00rootroot00000000000000--TEST-- SolrQuery - testing StatsComponent --FILE-- getStats(), $query->getStatsFields(), $query->getStatsFacets() ); $nullOutput = ob_get_clean(); $query->setStats(0); $query ->addStatsField('hello') ->removeStatsField('hello') ->addStatsField('june') ->addStatsField('july') ; $query ->addStatsFacet('world') ->removeStatsFacet('world') ->addStatsFacet('pear') ->addStatsFacet('pecl') ; echo $query . PHP_EOL . PHP_EOL; var_dump( $query->getStats(), $query->getStatsFields(), $query->getStatsFacets() ); echo $nullOutput; ?> --EXPECTF-- stats=false&stats.field=june&stats.field=july&stats.facet=pear&stats.facet=pecl bool(false) array(2) { [0]=> string(4) "june" [1]=> string(4) "july" } array(2) { [0]=> string(4) "pear" [1]=> string(4) "pecl" } NULL NULL NULLphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/065.solrquery_MoreLikeThis.phpt000066400000000000000000000034641374041537100244100ustar00rootroot00000000000000--TEST-- SolrQuery - testing MoreLikeThis component --FILE-- getMlt(), $query->getMltCount(), $query->getMltFields(), $query->getMltQueryFields(), $query->getMltMinTermFrequency(), $query->getMltMinDocFrequency(), $query->getMltMinWordLength(), $query->getMltMaxWordLength(), $query->getMltMaxNumTokens(), $query->getMltMaxNumQueryTerms(), $query->getMltBoost() ); $nullOutput = ob_get_clean(); $query->setMlt(1); $query->setMltCount(55)->setMltCount(90); $query->addMltField('june')->addMltField('joshua')->addMltField('mom')->removeMltField('joshua'); $query->addMltQueryField('june', 0.0)->addMltQueryField('israel', 9.558) ->addMltQueryField('removeme', 0.0) ->removeMltQueryField('removeme') ; $query->setMltMinTermFrequency(9); $query->setMltMinDocFrequency(5); $query->setMltMinWordLength(8); $query->setMltMaxWordLength(99); $query->setMltMaxNumTokens(6); $query->setMltMaxNumQueryTerms(2); $query->setMltBoost(true); echo $query . PHP_EOL . PHP_EOL; var_dump( $query->getMlt(), $query->getMltCount(), $query->getMltFields(), $query->getMltQueryFields(), $query->getMltMinTermFrequency(), $query->getMltMinDocFrequency(), $query->getMltMinWordLength(), $query->getMltMaxWordLength(), $query->getMltMaxNumTokens(), $query->getMltMaxNumQueryTerms(), $query->getMltBoost() ); echo $nullOutput; ?> --EXPECTF-- mlt=true&mlt.count=90&mlt.fl=june,mom&mlt.qf=june^0 israel^9.558&mlt.mintf=9&mlt.mindf=5&mlt.minwl=8&mlt.maxwl=99&mlt.maxntp=6&mlt.maxqt=2&mlt.boost=true bool(true) int(90) array(2) { [0]=> string(4) "june" [1]=> string(3) "mom" } array(2) { [0]=> string(6) "june^0" [1]=> string(12) "israel^9.558" } int(9) int(5) int(8) int(99) int(6) int(2) bool(true) NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULLphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/066.solrquery_TermsComponent.phpt000066400000000000000000000034571374041537100250310ustar00rootroot00000000000000--TEST-- SolrQuery - testing TermsComponent --FILE-- getTerms(), $query->getTermsField(), $query->getTermsLowerBound(), $query->getTermsUpperBound(), $query->getTermsIncludeLowerBound(), $query->getTermsIncludeUpperBound(), $query->getTermsMinCount(), $query->getTermsMaxCount(), $query->getTermsPrefix(), $query->getTermsLimit(), $query->getTermsReturnRaw(), $query->getTermsSort() ); }; ob_start(); $dumpVars(); $nullOutput = ob_get_clean(); $query->setTerms(true); $query->setTermsField('israel'); $query->setTermsLowerBound('june'); $query->setTermsUpperBound('joshua'); $query->setTermsIncludeLowerBound(false); $query->setTermsIncludeUpperBound(0); $query->setTermsMinCount(50); $query->setTermsMaxCount(200); $query->setTermsPrefix('A'); $query->setTermsLimit(45); $query->setTermsReturnRaw(false); $query->setTermsSort(SolrQuery::TERMS_SORT_INDEX); echo $query . PHP_EOL . PHP_EOL; $dumpVars(); $query->setTermsSort(SolrQuery::TERMS_SORT_COUNT); echo PHP_EOL . $query . PHP_EOL . PHP_EOL; var_dump( $query->getTermsSort() ); echo $nullOutput; ?> --EXPECTF-- terms=true&terms.fl=israel&terms.lower=june&terms.upper=joshua&terms.lower.incl=false&terms.upper.incl=false&terms.mincount=50&terms.maxcount=200&terms.prefix=A&terms.limit=45&terms.raw=false&terms.sort=index bool(true) string(6) "israel" string(4) "june" string(6) "joshua" bool(false) bool(false) int(50) int(200) string(1) "A" int(45) bool(false) int(0) terms=true&terms.fl=israel&terms.lower=june&terms.upper=joshua&terms.lower.incl=false&terms.upper.incl=false&terms.mincount=50&terms.maxcount=200&terms.prefix=A&terms.limit=45&terms.raw=false&terms.sort=count int(1) NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL php-solr-2.5.1+2.4.0/solr-2.5.1/tests/067.solrquery__construct.phpt000066400000000000000000000004671374041537100242360ustar00rootroot00000000000000--TEST-- SolrQuery::_construct - Throws exception on illegal Argument --FILE-- getMessage(); } catch (TypeError $e) { echo $e->getMessage(); } ?> --EXPECTF-- SolrQuery::__construct()%s string, %s given php-solr-2.5.1+2.4.0/solr-2.5.1/tests/068.solrquery_parameters_error.phpt000066400000000000000000000014231374041537100254210ustar00rootroot00000000000000--TEST-- SolrQuery - Invalid Parameters thorws exception Throws exception on illegal Argument --FILE-- setQuery(''); }catch (SolrIllegalArgumentException $e) { echo $e->getMessage().PHP_EOL; try { // simple list $query->addField(''); } catch (SolrIllegalArgumentException $e) { echo $e->getMessage().PHP_EOL; try { // argument list $query->addSortField(''); } catch (SolrIllegalArgumentException $e) { echo $e->getMessage().PHP_EOL; try { $params->addParam('',1); } catch (Exception $e) { echo $e->getMessage().PHP_EOL; } } } } ?> --EXPECT-- Invalid parameter value Invalid parameter value Invalid parameter value Invalid parameter name php-solr-2.5.1+2.4.0/solr-2.5.1/tests/069.solrquery_GroupParameters.phpt000066400000000000000000000044401374041537100251700ustar00rootroot00000000000000--TEST-- SolrQuery - Result Grouping (Group Parameters) --FILE-- setGroup(true); $query->addGroupField('category')->addGroupField('featured'); $query->addGroupFunction('ceil(internalScore)'); $query->addGroupQuery('silk')->addGroupQuery('name:june'); $query->setGroupLimit(98); $query->setGroupOffset(110); $query->addGroupSortField('count', SolrQuery::ORDER_ASC); $query->addGroupSortField('name', SolrQuery::ORDER_DESC); $query->setGroupFormat('simple'); $query->setGroupMain(false); $query->setGroupNGroups(false); $query->setGroupTruncate(true); $query->setGroupFacet(true); $query->setGroupCachePercent(100); echo PHP_EOL . "-- Query String --".PHP_EOL; echo $query.PHP_EOL; echo PHP_EOL . "-- Integer --".PHP_EOL; var_dump($query->getGroupOffset(), $query->getGroupLimit(), $query->getGroupCachePercent(0)); echo PHP_EOL . "-- String --".PHP_EOL; var_dump($query->getGroupFormat()); echo PHP_EOL . "-- Array --".PHP_EOL; var_dump($query->getGroupFields()); var_dump($query->getGroupFunctions()); var_dump($query->getGroupQueries()); var_dump($query->getGroupSortFields()); echo PHP_EOL . "-- BOOL --".PHP_EOL; var_dump($query->getGroup(), $query->getGroupMain(), $query->getGroupNGroups(), $query->getGroupTruncate(), $query->getGroupFacet()); echo PHP_EOL; try { $query->setGroupCachePercent(-1); } catch (SolrIllegalArgumentException $e) { echo sprintf("Exception Caught %d: %s", $e->getCode(), $e->getMessage()).PHP_EOL; } ?> --EXPECTF-- -- Query String -- group=true&group.field=category&group.field=featured&group.func=ceil(internalScore)&group.query=silk&group.query=name:june&group.limit=98&group.offset=110&group.sort=count asc,name desc&group.format=simple&group.main=false&group.ngroups=false&group.truncate=true&group.facet=true&group.cache.percent=100 -- Integer -- int(110) int(98) int(100) -- String -- string(6) "simple" -- Array -- array(2) { [0]=> string(8) "category" [1]=> string(8) "featured" } array(1) { [0]=> string(19) "ceil(internalScore)" } array(2) { [0]=> string(4) "silk" [1]=> string(9) "name:june" } array(2) { [0]=> string(9) "count asc" [1]=> string(9) "name desc" } -- BOOL -- bool(true) bool(false) bool(false) bool(true) bool(true) Exception Caught 4000: Group cache percent must be between 0 and 100php-solr-2.5.1+2.4.0/solr-2.5.1/tests/070.solrquery_collapse.phpt000066400000000000000000000004671374041537100236470ustar00rootroot00000000000000--TEST-- SolrQuery::collapse - Collapse Using a SolrCollapseFunction --FILE-- setMax(5); $query->collapse($collapseFunction); echo $query; ?> --EXPECTF-- q=lucene&fq={!collapse field=ISBN max=5} php-solr-2.5.1+2.4.0/solr-2.5.1/tests/071.solrquery_collapse_exception.phpt000066400000000000000000000006441374041537100257230ustar00rootroot00000000000000--TEST-- SolrQuery::collapse - throws SolrMissingMandatoryParameterException --FILE-- collapse($collapseFunction); } catch (SolrMissingMandatoryParameterException $e) { echo PHP_EOL.sprintf('Exception %d: %s', $e->getCode(), $e->getMessage()); } ?> --EXPECTF-- Exception 4100: Mandatory parameter Missing: field php-solr-2.5.1+2.4.0/solr-2.5.1/tests/072.solrquery_expand.phpt000066400000000000000000000021771374041537100233260ustar00rootroot00000000000000--TEST-- SolrQuery - Expand Component --FILE-- setExpand(true); $query->setExpandRows(50); $query->setExpandQuery('text:product'); $query->addExpandFilterQuery('manu:apple')->addExpandFilterQuery('inStock:true'); $query->addExpandSortField('score', SolrQuery::ORDER_DESC)->addExpandSortField('title', SolrQuery::ORDER_ASC); // removal test $query->addExpandFilterQuery('extra')->removeExpandFilterQuery('extra'); $query->addExpandSortField('extra', SolrQuery::ORDER_ASC)->removeExpandSortField('extra'); echo $query.PHP_EOL; var_dump($query->getExpand()).PHP_EOL; var_dump($query->getExpandRows()).PHP_EOL; var_dump($query->getExpandQuery()).PHP_EOL; var_dump($query->getExpandFilterQueries()).PHP_EOL; var_dump($query->getExpandSortFields()).PHP_EOL; ?> --EXPECTF-- q=lucene&expand=true&expand.rows=50&expand.q=text:product&expand.fq=manu:apple&expand.fq=inStock:true&expand.sort=score desc,title asc bool(true) int(50) string(12) "text:product" array(2) { [0]=> string(10) "manu:apple" [1]=> string(12) "inStock:true" } array(2) { [0]=> string(5) "score" [1]=> string(5) "title" } php-solr-2.5.1+2.4.0/solr-2.5.1/tests/080.solrutils_escapequerychars.phpt000066400000000000000000000005231374041537100254010ustar00rootroot00000000000000--TEST-- SolrUtils::escapeQueryChars() - Testing Lucene Reserved Characters --FILE-- --EXPECTF-- \+a \- q\{ \} \[\^test\] \|| \&& \(\) \^ \" \~ \* \? \: \\ \/php-solr-2.5.1+2.4.0/solr-2.5.1/tests/081.solrutils_digest_json_response.phpt000066400000000000000000000064061374041537100262670ustar00rootroot00000000000000--TEST-- SolrUtils::digestJsonResponse() - Digest JSON Response --FILE-- response->docs[0]->_version_ == 1460602453694087168); ?> --EXPECTF-- bool(true) object(SolrObject)#%d (2) { ["responseHeader"]=> object(SolrObject)#4 (3) { ["status"]=> int(0) ["QTime"]=> int(1) ["params"]=> object(SolrObject)#5 (4) { ["indent"]=> string(2) "on" ["wt"]=> string(4) "json" ["q"]=> string(6) "lucene" ["version"]=> string(3) "2.2" } } ["response"]=> object(SolrObject)#%d (3) { ["numFound"]=> int(1) ["start"]=> int(0) ["docs"]=> array(1) { [0]=> object(SolrObject)#%d (11) { ["id"]=> string(8) "SOLR1000" ["name"]=> string(34) "Solr, the Enterprise Search Server" ["manu"]=> string(26) "Apache Software Foundation" ["cat"]=> array(2) { [0]=> string(8) "software" [1]=> string(6) "search" } ["features"]=> array(7) { [0]=> string(51) "Advanced Full-Text Search Capabilities using Lucene" [1]=> string(37) "Optimized for High Volume Web Traffic" [2]=> string(46) "Standards Based Open Interfaces - XML and HTTP" [3]=> string(44) "Comprehensive HTML Administration Interfaces" [4]=> string(64) "Scalability - Efficient Replication to other Solr Search Servers" [5]=> string(56) "Flexible and Adaptable with XML configuration and Schema" [6]=> string(61) "Good unicode support: hello (hello with an accent over the e)" } ["price"]=> float(0) ["price_c"]=> string(5) "0,USD" ["popularity"]=> int(10) ["inStock"]=> bool(true) ["incubationdate_dt"]=> string(20) "2006-01-17T00:00:00Z" ["_version_"]=> %s } } } } bool(true)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/082.solrutils_getsolrversion.phpt000066400000000000000000000003301374041537100251150ustar00rootroot00000000000000--TEST-- SolrUtils::getSolrVersion() - Returns solr dotted version --FILE-- --EXPECTF-- %d.%d.%d %d.%d.%dphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/083.solrutils_getsolrstats.phpt000066400000000000000000000013521374041537100245740ustar00rootroot00000000000000--TEST-- SolrUtils::getSolrStats() - Get Statistics about number of documents/clients..etc --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient ( $options ); $solrDoc = new SolrInputDocument(); $params = new SolrModifiableParams(); var_dump(SolrUtils::getSolrStats()); ?> --EXPECT-- array(3) { ["document_count"]=> int(0) ["client_count"]=> int(0) ["params_count"]=> int(0) } array(3) { ["document_count"]=> int(1) ["client_count"]=> int(1) ["params_count"]=> int(1) } php-solr-2.5.1+2.4.0/solr-2.5.1/tests/084.solrutils_queryphrase.phpt000066400000000000000000000003051374041537100244040ustar00rootroot00000000000000--TEST-- SolrUtils::queryPhrase() - Escapes a query phrase --FILE-- --EXPECT-- "Book Title\: Apache Solr Server" php-solr-2.5.1+2.4.0/solr-2.5.1/tests/090.solrserverexception_xml.phpt000066400000000000000000000015141374041537100247210ustar00rootroot00000000000000--TEST-- SolrServerException (xml) - Throw Exception on solr server exception using xml response writer --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, // 'wt' => 'xml' ); $client = new SolrClient ( $options ); $query = new SolrQuery ( "lucene\\" ); try { $response = $client->query ( $query ); } catch ( SolrServerException $e ) { echo sprintf("code: %d", $e->getCode()).PHP_EOL; echo sprintf("message: %s", $e->getMessage()).PHP_EOL; print_r($e->getInternalInfo()); } ?> --EXPECTF-- code: %d message: %s Array ( [sourceline] => %d [sourcefile] => %s [zif_name] => %s ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/091.solrserverexception_json.phpt000066400000000000000000000013651374041537100250770ustar00rootroot00000000000000--TEST-- SolrServerException (json) - Throw Exception on solr server exception using json response writer --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt' => 'json' ); $client = new SolrClient ( $options ); $query = new SolrQuery ( "lucene\\" ); try { $response = $client->query ( $query ); print_r ( $response ); } catch ( SolrServerException $e ) { echo sprintf("code: %d", $e->getCode()).PHP_EOL; echo sprintf("message: %s", $e->getMessage()).PHP_EOL; } ?> --EXPECTF-- code: %d message: %sphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/092.solrserverexception_php.phpt000066400000000000000000000013651374041537100247160ustar00rootroot00000000000000--TEST-- SolrServerException (phps) - Throw Exception on solr server exception using phps response writer --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt' => 'phps' ); $client = new SolrClient ( $options ); $query = new SolrQuery ( "lucene\\" ); try { $response = $client->query ( $query ); print_r ( $response ); } catch ( SolrServerException $e ) { echo sprintf("code: %d", $e->getCode()).PHP_EOL; echo sprintf("message: %s", $e->getMessage()).PHP_EOL; } ?> --EXPECTF-- code: %d message: %sphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/100.solrresponse_json.phpt000066400000000000000000000011151374041537100234700ustar00rootroot00000000000000--TEST-- SolrResponse::getResponse - JSON response writer --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt' => 'json' ); $client = new SolrClient ( $options ); $query = new SolrQuery ( "lucene" ); $response = $client->query ( $query ); $x = $response->getResponse(); var_dump($x instanceof SolrObject); ?> --EXPECTF-- bool(true)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/101.solrresponse_parseMode.phpt000066400000000000000000000012001374041537100244320ustar00rootroot00000000000000--TEST-- SolrResponse - ParseMode --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt' => 'xml' ); $client = new SolrClient ( $options ); $query = new SolrQuery ( "lucene" ); $response = $client->query ( $query ); $response->setParseMode(SolrResponse::PARSE_SOLR_DOC); $x = $response->getResponse(); var_dump($x->response->docs[0] instanceof SolrDocument); ?> --EXPECTF-- bool(true)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/102.solrresponse_phps.phpt000066400000000000000000000011151374041537100234730ustar00rootroot00000000000000--TEST-- SolrResponse::getResponse - PHPS response writer --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt' => 'phps' ); $client = new SolrClient ( $options ); $query = new SolrQuery ( "lucene" ); $response = $client->query ( $query ); $x = $response->getResponse(); var_dump($x instanceof SolrObject); ?> --EXPECTF-- bool(true)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/103.solrresponse_get_array_response.phpt000066400000000000000000000014641374041537100264240ustar00rootroot00000000000000--TEST-- SolrResponse::getArrayResponse - For All response writers --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient ( $options ); $testArrayResponse = function ($writer) use ($client){ $client->setResponseWriter($writer); $q = new SolrQuery("lucene"); $response = $client->query ( $q ); $arrayResponse = $response->getArrayResponse(); return is_array($arrayResponse); }; var_dump($testArrayResponse('phps')); var_dump($testArrayResponse('xml')); var_dump($testArrayResponse('json')); ?> --EXPECTF-- bool(true) bool(true) bool(true)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/104.solrresponse_get_response_maxscore.phpt000066400000000000000000000024201374041537100271210ustar00rootroot00000000000000--TEST-- SolrResponse::getResponse() - maxScore --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt'=> 'xml' ); $client = new SolrClient ( $options ); $q = new SolrQuery("lucene"); $q->addField('score'); $response = $client->query ( $q ); $arrayResponse = $response->getArrayResponse(); var_dump($arrayResponse['response']['maxScore']); var_dump($response->getResponse()->response->maxScore); var_dump($response->getResponse()->response->start); var_dump($response->getResponse()->response->numFound); var_dump(is_array($response->getResponse()->response->docs)); echo "------ W/O maxScore ------".PHP_EOL; $q->removeField('score'); $response = $client->query ( $q ); var_dump($response->getResponse()->response->start); var_dump($response->getResponse()->response->numFound); var_dump(is_array($response->getResponse()->response->docs)); var_dump(property_exists($response->getResponse()->response, 'maxScore')); ?> --EXPECTF-- float(%f) float(%f) int(%d) int(%d) bool(true) ------ W/O maxScore ------ int(0) int(1) bool(true) bool(false)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/105.solrresponse_child_doc_response.phpt000066400000000000000000000033261374041537100263600ustar00rootroot00000000000000--TEST-- Response - Response with child documents --FILE-- --EXPECT-- SolrObject Object ( [response] => SolrObject Object ( [numFound] => 3 [start] => 0 [docs] => Array ( [0] => SolrObject Object ( [id] => parent_1 [_childDocuments_] => Array ( [0] => SolrObject Object ( [id] => CHILD_1_1 ) ) ) [1] => SolrObject Object ( [id] => parent_2 [_childDocuments_] => Array ( [0] => SolrObject Object ( [id] => CHILD_2_1 ) [1] => SolrObject Object ( [id] => CHILD_2_2 ) ) ) [2] => SolrObject Object ( [id] => not_a_parent_1 ) ) ) ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/106.solrresponse_child_doc_response_solrdoc.phpt000066400000000000000000000056241374041537100301110ustar00rootroot00000000000000--TEST-- SolrDocument - Response parsed as SolrDocument with child documents --FILE-- response->docs as $doc) { echo '--- doc start ---'.PHP_EOL; print_r($doc->toArray()); if ($doc->hasChildDocuments()) { foreach ($doc->getChildDocuments() as $child) { print_r($child->toArray()); } } echo '--- doc end ---'.PHP_EOL; } ?> --EXPECT-- --- doc start --- Array ( [document_boost] => 0 [field_count] => 1 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => parent_1 ) ) ) ) Array ( [document_boost] => 0 [field_count] => 1 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => CHILD_1_1 ) ) ) ) --- doc end --- --- doc start --- Array ( [document_boost] => 0 [field_count] => 1 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => parent_2 ) ) ) ) Array ( [document_boost] => 0 [field_count] => 1 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => CHILD_2_1 ) ) ) ) Array ( [document_boost] => 0 [field_count] => 1 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => CHILD_2_2 ) ) ) ) --- doc end --- --- doc start --- Array ( [document_boost] => 0 [field_count] => 1 [fields] => Array ( [0] => SolrDocumentField Object ( [name] => id [boost] => 0 [values] => Array ( [0] => not_a_parent_1 ) ) ) ) --- doc end --- php-solr-2.5.1+2.4.0/solr-2.5.1/tests/107.solrresponse_getrawresponseheaders.phpt000066400000000000000000000015061374041537100271360ustar00rootroot00000000000000--TEST-- SolrResponse::getRawResponseHeaders() - Get Raw Response Headers --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setQuery('lucene'); $query->setStart(0); $query->setRows(50); $query->addField('cat')->addField('features')->addField('id')->addField('timestamp'); $query_response = $client->query($query); $headers = $query_response->getRawResponseHeaders(); print_r($headers); ?> --EXPECT-- HTTP/1.1 200 OK Content-Type: application/xml; charset=UTF-8 Transfer-Encoding: chunkedphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/108.solrresponse_getdigestedresponse.phpt000066400000000000000000000034451374041537100266060ustar00rootroot00000000000000--TEST-- SolrResponse::getDigestedResponse() - Get Raw Response Headers --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setQuery('lucene'); $query->setStart(0); $query->setRows(50); $query->addField('cat')->addField('features')->addField('id')->addField('timestamp'); $query_response = $client->query($query); var_dump($query_response->getDigestedResponse()); $tmp = $query_response->getResponse(); $digestedResponse = $query_response->getDigestedResponse(); print_r($digestedResponse); ?> --EXPECTF-- string(1) " " O:10:"SolrObject":2:{s:14:"responseHeader";O:10:"SolrObject":3:{s:6:"status";i:0;s:5:"QTime";i:%d;s:%d:"params";O:10:"SolrObject":7:{s:1:"q";s:6:"lucene";s:6:"indent";s:2:"on";s:2:"fl";s:25:"cat,features,id,timestamp";s:5:"start";s:1:"0";s:4:"rows";s:2:"50";s:7:"version";s:3:"2.2";s:2:"wt";s:3:"xml";}}s:8:"response";O:10:"SolrObject":3:{s:8:"numFound";i:1;s:5:"start";i:0;s:4:"docs";a:1:{i:0;O:10:"SolrObject":3:{s:2:"id";s:8:"SOLR1000";s:3:"cat";a:2:{i:0;s:8:"software";i:1;s:6:"search";}s:8:"features";a:7:{i:0;s:51:"Advanced Full-Text Search Capabilities using Lucene";i:1;s:37:"Optimized for High Volume Web Traffic";i:2;s:46:"Standards Based Open Interfaces - XML and HTTP";i:3;s:44:"Comprehensive HTML Administration Interfaces";i:4;s:64:"Scalability - Efficient Replication to other Solr Search Servers";i:5;s:56:"Flexible and Adaptable with XML configuration and Schema";i:6;s:62:"Good unicode support: héllo (hello with an accent over the e)";}}}}}php-solr-2.5.1+2.4.0/solr-2.5.1/tests/109.solrresponse_gethttpstatus.phpt000066400000000000000000000014231374041537100254550ustar00rootroot00000000000000--TEST-- SolrResponse::getHttpStatus() - getHttpStatusMessage() --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setQuery('lucene'); $query->setStart(0); $query->setRows(50); $query->addField('cat')->addField('features')->addField('id')->addField('timestamp'); $query_response = $client->query($query); var_dump($query_response->getHttpStatus()); var_dump($query_response->getHttpStatusMessage()); ?> --EXPECTF-- int(200) string(1) " "php-solr-2.5.1+2.4.0/solr-2.5.1/tests/109.solrresponse_getrequesturl.phpt000066400000000000000000000014131374041537100254440ustar00rootroot00000000000000--TEST-- SolrResponse::getRequestUrl() - Get Raw Response Headers --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setQuery('lucene'); $query->setStart(0); $query->setRows(50); $query->addField('cat')->addField('features')->addField('id')->addField('timestamp'); $query_response = $client->query($query); echo $query_response->getRequestUrl(); ?> --EXPECTF-- http://%s:8983/solr/collection1/select/?version=2.2&indent=on&wt=xmlphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/109.solrresponse_success.phpt000066400000000000000000000011111374041537100241740ustar00rootroot00000000000000--TEST-- SolrResponse::success() - Was the request successful --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, ); $client = new SolrClient($options); $query = new SolrQuery(); $query->setQuery('lucene'); $query_response = $client->query($query); var_dump($query_response->success()); ?> --EXPECTF-- bool(true)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/110.solrdismaxquery.phpt000066400000000000000000000040031374041537100231540ustar00rootroot00000000000000--TEST-- SolrDisMaxQuery - Methods --FILE-- addPhraseField('source', 55) ->addPhraseField('cat', 3, 1) ->addPhraseField('third', 4, 1) ->removePhraseField('third') ->addPhraseField('fourth', 0.5) ->addPhraseField('fifth',5.2, 7.8) ->setQueryAlt('*:*') ->addQueryField("price") ->addQueryField("location", 4) ->setPhraseSlop(2) ->setQueryPhraseSlop(3) ->setTieBreaker(0.5) ->setMinimumMatch(2) ; // reverse echo $dismaxQuery.PHP_EOL; $dismaxQuery = new SolrDisMaxQuery("lucene"); $dismaxQuery ->addQueryField("location", 4) ->addQueryField("price") ->addQueryField("sku") ->addQueryField("title",3.4) ->addPhraseField('cat', 3, 1) ->addPhraseField('third', 4, 1) ->addPhraseField('source', 55) ; echo $dismaxQuery.PHP_EOL; $dismaxQuery->setPhraseFields('source^55 cat~1^3'); echo $dismaxQuery.PHP_EOL; $dismaxQuery = new SolrDisMaxQuery('lucene'); $dismaxQuery->addPhraseField('first', 3, 1) ->addPhraseField('second', 4, 1) ->addPhraseField('cat', 55); echo $dismaxQuery. PHP_EOL; echo $dismaxQuery->removePhraseField('second').PHP_EOL; $dismaxQuery = new SolrDisMaxQuery('lucene'); $dismaxQuery->addQueryField('first', 3) ->addQueryField('second', 0.2) ->addQueryField('cat'); echo $dismaxQuery. PHP_EOL; echo $dismaxQuery->removeQueryField('second').PHP_EOL; $dismaxQuery = new SolrDisMaxQuery('lucene'); $dismaxQuery->setPhraseSlop(4); echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- q=lucene&defType=%s&pf=source^55 cat~1^3 fourth^0.5 fifth~7.8^5.2&q.alt=*:*&qf=price location^4&ps=2&qs=3&tie=0.5&mm=2 q=lucene&defType=%s&qf=location^4 price sku title^3.4&pf=cat~1^3 third~1^4 source^55 Notice: SolrDisMaxQuery::setPhraseFields(): Parameter pf value(s) was overwritten by this call in %s on line %d q=lucene&defType=%s&qf=location^4 price sku title^3.4&pf=source^55 cat~1^3 q=lucene&defType=%s&pf=first~1^3 second~1^4 cat^55 q=lucene&defType=%s&pf=first~1^3 cat^55 q=lucene&defType=%s&qf=first^3 second^0.2 cat q=lucene&defType=%s&qf=first^3 cat q=lucene&defType=%s&ps=4php-solr-2.5.1+2.4.0/solr-2.5.1/tests/111.solrdismaxquery_boostquery.phpt000066400000000000000000000012511374041537100254530ustar00rootroot00000000000000--TEST-- SolrDisMaxQuery - Boost Query --FILE-- addBoostQuery('cat', 'electronics', 5.1) ->addBoostQuery('cat', 'hard drive') ; // reverse echo $dismaxQuery.PHP_EOL; $dismaxQuery ->removeBoostQuery('cat'); echo $dismaxQuery.PHP_EOL; $dismaxQuery->setBoostQuery('cat:electronics manu:local^2'); echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- q=lucene&defType=edismax&bq=cat:electronics^5.1 cat:hard drive q=lucene&defType=edismax&bq=cat:hard drive Notice: SolrDisMaxQuery::setBoostQuery(): Parameter bq value(s) was overwritten by this call in %s on line %d q=lucene&defType=edismax&bq=cat:electronics manu:local^2 php-solr-2.5.1+2.4.0/solr-2.5.1/tests/112.solrdismaxquery_query_parser.phpt000066400000000000000000000005611374041537100257640ustar00rootroot00000000000000--TEST-- SolrDisMaxQuery - QueryParser Switch --FILE-- useDisMaxQueryParser(); echo $dismaxQuery.PHP_EOL; $dismaxQuery->useEDisMaxQueryParser(); echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- q=hard drive&defType=edismax q=hard drive&defType=dismax q=hard drive&defType=edismaxphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/113.solrdismaxquery_bigramfields.phpt000066400000000000000000000015311374041537100256720ustar00rootroot00000000000000--TEST-- SolrDisMaxQuery - BigramFields and slop (addBigramPhraseField, removeBigramPhraseField, setBigramPhraseFields) --FILE-- addBigramPhraseField('cat', 2, 5.1) ->addBigramPhraseField('feature', 4.5) ; echo $dismaxQuery.PHP_EOL; // reverse $dismaxQuery ->removeBigramPhraseField('cat'); echo $dismaxQuery.PHP_EOL; $dismaxQuery->setBigramPhraseFields("cat~5.1^2 feature^4.5"); echo $dismaxQuery.PHP_EOL; $dismaxQuery->setBigramPhraseSlop(2); echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- q=lucene&defType=%s&pf2=cat~5.1^2 feature^4.5 q=lucene&defType=%s&pf2=feature^4.5 Notice: SolrDisMaxQuery::setBigramPhraseFields(): Parameter pf2 value(s) was overwritten by this call in %s on line %d q=lucene&defType=%s&pf2=cat~5.1^2 feature^4.5 q=lucene&defType=%s&pf2=cat~5.1^2 feature^4.5&ps2=2 php-solr-2.5.1+2.4.0/solr-2.5.1/tests/114.solrdismaxquery_trigramfields.phpt000066400000000000000000000015431374041537100261020ustar00rootroot00000000000000--TEST-- SolrDisMaxQuery - TrigramFields and slop (addTrigramPhraseField, removeTrigramPhraseField, setTrigramPhraseFields) --FILE-- addTrigramPhraseField('cat', 2, 5.1) ->addTrigramPhraseField('feature', 4.5) ; echo $dismaxQuery.PHP_EOL; // reverse $dismaxQuery ->removeTrigramPhraseField('cat'); echo $dismaxQuery.PHP_EOL; $dismaxQuery->setTrigramPhraseFields('cat~5.1^2 feature^4.5'); echo $dismaxQuery.PHP_EOL; $dismaxQuery->setTrigramPhraseSlop(2); echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- q=lucene&defType=%s&pf3=cat~5.1^2 feature^4.5 q=lucene&defType=%s&pf3=feature^4.5 Notice: SolrDisMaxQuery::setTrigramPhraseFields(): Parameter pf3 value(s) was overwritten by this call in %s on line %d q=lucene&defType=%s&pf3=cat~5.1^2 feature^4.5 q=lucene&defType=%s&pf3=cat~5.1^2 feature^4.5&ps3=2 php-solr-2.5.1+2.4.0/solr-2.5.1/tests/115.solrdismaxquery_userfields.phpt000066400000000000000000000012031374041537100254050ustar00rootroot00000000000000--TEST-- SolrDisMaxQuery - UserFields (uf parameter) (addUserField) --FILE-- addUserField('cat') ->addUserField('text') ->addUserField('*_dt') ; echo $dismaxQuery.PHP_EOL; // // reverse $dismaxQuery ->removeUserField('text'); echo $dismaxQuery.PHP_EOL; $dismaxQuery->setUserFields('field1 field2 *_txt'); echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- q=lucene&defType=%s&uf=cat text *_dt q=lucene&defType=%s&uf=cat *_dt Notice: SolrDisMaxQuery::setUserFields(): Parameter uf value(s) was overwritten by this call in %s on line %d q=lucene&defType=edismax&uf=field1 field2 *_txtphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/116.solrdismaxquery_boostfunction.phpt000066400000000000000000000005251374041537100261430ustar00rootroot00000000000000--TEST-- SolrDisMaxQuery - setBoostFunction --FILE-- setBoostFunction($boostRecentDocsFunction); echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- q=lucene&defType=%s&bf=recip(ms(NOW,mydatefield),3.16e-11,1,1)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/130.parameters_simple_list_separator.phpt000066400000000000000000000006251374041537100265400ustar00rootroot00000000000000--TEST-- simple_list_parameter type - Use of default, non-default separator --FILE-- addField("te")->addField("te2"); echo $query.PHP_EOL; $dismaxQuery = new SolrDisMaxQuery(); $dismaxQuery ->addUserField('cat') ->addUserField('text') ->addUserField('*_dt') ; echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- fl=te,te2 defType=edismax&uf=cat text *_dtphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/150.solrcollapsefunction.phpt000066400000000000000000000015311374041537100241600ustar00rootroot00000000000000--TEST-- SolrCollapseFunction - string conversion --FILE-- setField('field2'); $func->setMax('max'); $func->setMin('min'); $func->setSize(1000); $func->setHint('hint'); $func->setNullPolicy(SolrCollapseFunction::NULLPOLICY_EXPAND); var_dump($func->getField()); var_dump($func->getMax()); var_dump($func->getMin()); var_dump($func->getSize()); var_dump($func->getHint()); var_dump($func->getNullPolicy()); var_dump((string)$func); $func->setMax('with space'); var_dump((string)$func); ?> --EXPECTF-- string(6) "field2" string(3) "max" string(3) "min" string(4) "1000" string(4) "hint" string(6) "expand" string(78) "{!collapse field=field2 max=max min=min size=1000 hint=hint nullPolicy=expand}" string(87) "{!collapse field=field2 max='with space' min=min size=1000 hint=hint nullPolicy=expand}" php-solr-2.5.1+2.4.0/solr-2.5.1/tests/151.solrcollapsefunction_illegal_operations.phpt000066400000000000000000000013671374041537100301240ustar00rootroot00000000000000--TEST-- SolrCollapseFunction - Illegal Operations --SKIPIF-- --FILE-- getCode(), $e->getMessage()).PHP_EOL; } $func->setMax('max'); try { // known issue, object corruption $tmp = serialize($func); } catch (SolrIllegalOperationException $e) { echo PHP_EOL . sprintf('Code %d: %s', $e->getCode(), $e->getMessage()).PHP_EOL; } ?> --EXPECTF-- Code 4001: Cloning of SolrCollapseFunction objects is currently not supported Code 1001: Serialization of SolrCollapseFunction objects is currently not supported php-solr-2.5.1+2.4.0/solr-2.5.1/tests/160.solr_update_document_block.phpt000066400000000000000000000042461374041537100253100ustar00rootroot00000000000000--TEST-- Solr - Fetch and Update nested documents --SKIPIF-- --FILE-- getChildDocuments(); $child = $children[0]; $child->deleteField('inventory_i'); $child->addField('inventory_i', $inventory); $document->deleteField('_version_'); }; $getInventory = function ($response) { return (int) current($response->response->docs[0]->getChildDocuments()[0]['inventory_i']->values); }; $options = array ( 'hostname' => SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_STORE_PATH, 'wt' => 'xml' ); $client = new SolrClient ( $options ); $query = new SolrQuery ('id:1 AND {!parent which=$parentFilter}'); $query->setParam ( 'parentFilter', 'content_type_s:product' ); $query->addFilterQuery('{!parent which=$parentFilter}'); $query->addField ( '*' ); $query->addField ( '[child parentFilter=$parentFilter]' ); $query->setStart ( 0 ); $query->setRows ( 1 ); // query existing inventory $queryResponse = $client->query ( $query ); $queryResponse->setParseMode(SolrResponse::PARSE_SOLR_DOC); $response = $queryResponse->getResponse(); $existingInventory = $getInventory($response); // update inventory to 300 $document = $response->response->docs[0]->getInputDocument(); $updateInventory($document, 300); $client->addDocument($document); $client->commit(); // fetch the document again after the update $queryResponse = $client->query ( $query ); $queryResponse->setParseMode(SolrResponse::PARSE_SOLR_DOC); $response = $queryResponse->getResponse(); $newInventory = $getInventory($response); assert($newInventory == 300); echo "------EXISTING------" . PHP_EOL; var_dump($existingInventory); echo "----AFTER UPDATE----" . PHP_EOL; var_dump($newInventory); // cleanup: restore document's original state $document = $response->response->docs[0]->getInputDocument(); $updateInventory($document, $existingInventory); $client->addDocument($document); $client->commit(); ?> --EXPECT-- ------EXISTING------ int(200) ----AFTER UPDATE---- int(300)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/180.solrdocumentfield_construct.phpt000066400000000000000000000003471374041537100255450ustar00rootroot00000000000000--TEST-- SolrDocumentField::__construct --FILE-- --EXPECT-- SolrDocumentField Object ( [name] => [boost] => 0 [values] => ) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/181.solrdocumentfield_write_property.phpt000066400000000000000000000006221374041537100266140ustar00rootroot00000000000000--TEST-- SolrDocumentField - exception - on write property --FILE-- myIllegalProperty = 1; } catch (SolrIllegalOperationException $e) { printf("Exception %d: %s", $e->getCode(), $e->getMessage()); } ?> --EXPECT-- Exception 1007: SolrDocumentField instances are read-only. Properties cannot be updated or removed. php-solr-2.5.1+2.4.0/solr-2.5.1/tests/182.solrdocumentfield_unset_property.phpt000066400000000000000000000006101374041537100266160ustar00rootroot00000000000000--TEST-- SolrDocumentField - exception - on unset property --FILE-- name); } catch (SolrIllegalOperationException $e) { printf("Exception %d: %s", $e->getCode(), $e->getMessage()); } ?> --EXPECT-- Exception 1007: SolrDocumentField instances are read-only. Properties cannot be updated or removed.php-solr-2.5.1+2.4.0/solr-2.5.1/tests/190.solrparams_setparam.phpt000066400000000000000000000003431374041537100237730ustar00rootroot00000000000000--TEST-- SolrParams::setParam() --FILE-- setParam('q', 'lucene') ->setParam('start', 0) ->setParam('rows', 10) ; echo $params; ?> --EXPECTF-- q=lucene&start=0&rows=10 php-solr-2.5.1+2.4.0/solr-2.5.1/tests/191.solrparams_addparam.phpt000066400000000000000000000003551374041537100237340ustar00rootroot00000000000000--TEST-- SolrParams::addParam() --FILE-- addParam('fq', 'popularity:[10 TO *]') ->addParam('fq', 'section:0') ; echo $params; ?> --EXPECTF-- fq=popularity:[10 TO *]&fq=section:0 php-solr-2.5.1+2.4.0/solr-2.5.1/tests/192.solrparams_getparam.phpt000066400000000000000000000005651374041537100237670ustar00rootroot00000000000000--TEST-- SolrParams::getParam() --FILE-- set('q', 'lucene') ->addParam('fq', 'popularity:[10 TO *]') ->addParam('fq', 'section:0') ; var_dump($params->get('fq')); var_dump($params->get('q')); ?> --EXPECT-- array(2) { [0]=> string(20) "popularity:[10 TO *]" [1]=> string(9) "section:0" } string(6) "lucene"php-solr-2.5.1+2.4.0/solr-2.5.1/tests/193.solrparams_getparams.phpt000066400000000000000000000006501374041537100241460ustar00rootroot00000000000000--TEST-- SolrParams::getParams() --FILE-- set('q', 'lucene') ->addParam('fq', 'popularity:[10 TO *]') ->addParam('fq', 'section:0') ; var_dump($params->getParams()); ?> --EXPECT-- array(2) { ["q"]=> array(1) { [0]=> string(6) "lucene" } ["fq"]=> array(2) { [0]=> string(20) "popularity:[10 TO *]" [1]=> string(9) "section:0" } }php-solr-2.5.1+2.4.0/solr-2.5.1/tests/194.solrparams_getpreparedparams.phpt000066400000000000000000000005731374041537100256760ustar00rootroot00000000000000--TEST-- SolrParams::getPreparedParams() --FILE-- set('q', 'lucene') ->addParam('fq', 'popularity:[10 TO *]') ->addParam('fq', 'section:0') ; var_dump($params->getPreparedParams()); ?> --EXPECT-- array(2) { ["q"]=> string(8) "q=lucene" ["fq"]=> string(50) "fq=popularity%3A%5B10%20TO%20%2A%5D&fq=section%3A0" } php-solr-2.5.1+2.4.0/solr-2.5.1/tests/195.solrparams_tostring.phpt000066400000000000000000000007161374041537100240410ustar00rootroot00000000000000--TEST-- SolrParams::toString() --FILE-- setParam('q', 'lucene') ->setParam('start', 0) ->setParam('rows', 10) ->addParam('fq', 'popularity:[10 TO *]') ->addParam('fq', 'section:0') ; echo $params->toString().PHP_EOL; echo $params->toString(true); ?> --EXPECTF-- q=lucene&start=0&rows=10&fq=popularity:[10 TO *]&fq=section:0 q=lucene&start=0&rows=10&fq=popularity%3A%5B10%20TO%20%2A%5D&fq=section%3A0php-solr-2.5.1+2.4.0/solr-2.5.1/tests/196.solrparams_serialize.phpt000066400000000000000000000020541374041537100241550ustar00rootroot00000000000000--TEST-- SolrParams::serialize() - serialize params --FILE-- setParam('q', 'lucene') ->setParam('start', 0) ->setParam('rows', 10) ->addParam('fq', 'popularity:[10 TO *]') ->addParam('fq', 'section:0') ; echo serialize($params); ?> --EXPECTF-- C:20:"SolrModifiableParams":727:{ lucene 0 10 popularity:[10 TO *] section:0 } php-solr-2.5.1+2.4.0/solr-2.5.1/tests/197.solrparams_unserialize.phpt000066400000000000000000000006771374041537100245320ustar00rootroot00000000000000--TEST-- SolrParams::unserialize() --FILE-- setParam('q', 'lucene') ->setParam('start', 0) ->setParam('rows', 10) ->addParam('fq', 'popularity:[10 TO *]') ->addParam('fq', 'section:0') ; $serializedString = serialize($params); $unserializedObject = unserialize($serializedString); echo $unserializedObject; ?> --EXPECTF-- q=lucene&start=0&rows=10&fq=popularity:[10 TO *]&fq=section:0 php-solr-2.5.1+2.4.0/solr-2.5.1/tests/198.solrparams_clone.phpt000066400000000000000000000007741374041537100232770ustar00rootroot00000000000000--TEST-- SolrParams - clone [exception] --FILE-- setParam('q', 'lucene') ->setParam('start', 0) ->setParam('rows', 10) ->addParam('fq', 'popularity:[10 TO *]') ->addParam('fq', 'section:0') ; try { $params2 = clone $params; } catch (SolrIllegalOperationException $e) { echo sprintf("Exception %d: %s", $e->getCode(), $e->getMessage()).PHP_EOL; } ?> --EXPECTF-- Exception 4001: Cloning of SolrParams object instances is currently not supported php-solr-2.5.1+2.4.0/solr-2.5.1/tests/200.solrextractrequest_clone.phpt000066400000000000000000000006471374041537100250560ustar00rootroot00000000000000--TEST-- SolrExtractRequest - clone [exception] --FILE-- getCode(), $e->getMessage()).PHP_EOL; } ?> --EXPECTF-- Exception 4001: Cloning of SolrExtractRequest objects is currently not supported php-solr-2.5.1+2.4.0/solr-2.5.1/tests/201.solrextractrequest_serialize.phpt000066400000000000000000000006541374041537100257440ustar00rootroot00000000000000--TEST-- SolrExtractRequest - serialize [exception] --FILE-- getCode(), $e->getMessage()).PHP_EOL; } ?> --EXPECTF-- Exception 4001: SolrExtractRequest objects cannot be serialized or unserialized php-solr-2.5.1+2.4.0/solr-2.5.1/tests/bootstrap.inc000066400000000000000000000004141374041537100212160ustar00rootroot00000000000000getCode(), $e->getMessage()). PHP_EOL; } php-solr-2.5.1+2.4.0/solr-2.5.1/tests/bug_59511_error.phpt000066400000000000000000000013151374041537100221360ustar00rootroot00000000000000--TEST-- Solr bug #59511 - SolrClient::query() Timeout shall throw a SolrClientException --SKIPIF-- --FILE-- 'anyhost', 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'timeout' => 2 ); $client = new SolrClient($options); $query = new SolrQuery("lucene"); try { $query_response = $client->query($query); } catch (SolrClientException $e) { echo $e->getMessage().PHP_EOL; echo $e->getCode().PHP_EOL; } ?> --EXPECTF-- Solr HTTP Error %d: '%s' 1004php-solr-2.5.1+2.4.0/solr-2.5.1/tests/bug_61836_error.phpt000066400000000000000000000010621374041537100221400ustar00rootroot00000000000000--TEST-- Solr bug #61836 - Extending SolrDocument --SKIPIF-- --FILE-- addField('testname', true); ?> --EXPECTF-- Fatal error: Class Model_SolrDocument may not inherit from final class (SolrDocument) in %s on line %dphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/bug_67394.phpt000066400000000000000000000012501374041537100207330ustar00rootroot00000000000000--TEST-- Solr Bug #67394 - Unable to parse response with NaN --FILE-- stats->stats_fields->date->stddev); $xmlFixture = file_get_contents(ROOT_DIRECTORY . '/files/bug67394.xml'); if (!json_decode($fixture)) { echo "PHP JSON DECODE failed with: ". json_last_error_msg().PHP_EOL; } $response = SolrUtils::digestXmlResponse($xmlFixture); var_dump($response->response->stats->stats_fields->currentPrice->mean); ?> --EXPECTF-- string(3) "NaN" float(NAN)php-solr-2.5.1+2.4.0/solr-2.5.1/tests/bug_68179.phpt000066400000000000000000000005251374041537100207410ustar00rootroot00000000000000--TEST-- Solr Bug #68179 - Solr Params (Argument list) separator disappears --FILE-- addSortField('price', SolrQuery::ORDER_ASC); $dismaxQuery->addSortField('score', SolrQuery::ORDER_DESC); echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- q=score&defType=%s&sort=price asc,score descphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/bug_68181.phpt000066400000000000000000000011011374041537100207210ustar00rootroot00000000000000--TEST-- Solr Bug #68181 - Conflict occurs when using SolrDisMax::addBoostQuery and setBoostQuery --FILE-- setBoostQuery("failing:val^3") ->addBoostQuery('category','software',2) ->setBoostQuery("end:result^4"); echo $dismaxQuery.PHP_EOL; ?> --EXPECTF-- Notice: SolrDisMaxQuery::addBoostQuery(): Parameter bq value(s) was overwritten by this call in %s on line %d Notice: SolrDisMaxQuery::setBoostQuery(): Parameter bq value(s) was overwritten by this call in %s on line %d q=lucene&defType=%s&bq=end:result^4php-solr-2.5.1+2.4.0/solr-2.5.1/tests/bug_69156.phpt000066400000000000000000000012231374041537100207310ustar00rootroot00000000000000--TEST-- Solr Bug #69156 - segfault on 500 response from Solr --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => 'solr/collection44444', 'wt' => 'phps' ); $client = new SolrClient($options); $query = new SolrQuery("lucene"); try { $query_response = $client->query($query); } catch (Exception $e) { } ?> --EXPECTF-- Notice: SolrClient::query(): Unable to parse serialized php response in %s on line %d php-solr-2.5.1+2.4.0/solr-2.5.1/tests/bug_70482.phpt000066400000000000000000000017021374041537100207250ustar00rootroot00000000000000--TEST-- Solr Bug #70482 - Segmentation fault on server 500 response with no msg field XML RW --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt' => 'xml' ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $func = new SolrCollapseFunction('manu_id_s'); $func->setMax('sum(cscore(),field(manu_id_s))'); $func->setSize(100); $func->setNullPolicy(SolrCollapseFunction::NULLPOLICY_EXPAND); $query->collapse($func); try { $queryResponse = $client->query($query); } catch (SolrServerException $e) { printf("Exception code %d", $e->getCode()); assert(strlen($e->getMessage()) > 0, 'Exception message is empty'); echo PHP_EOL; } ?> OK --EXPECTF-- Exception code %d OKphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/bug_70495.phpt000066400000000000000000000017461374041537100207410ustar00rootroot00000000000000--TEST-- Solr Bug #70495 - Failed to parse 500 error response when Solr it lacks msg JSON RW --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt' => 'json' ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $func = new SolrCollapseFunction('manu_id_s'); $func->setMax('sum(cscore(),field(manu_id_s))'); $func->setSize(100); $func->setNullPolicy(SolrCollapseFunction::NULLPOLICY_EXPAND); $query->collapse($func); try { $queryResponse = $client->query($query); } catch (SolrServerException $e) { printf("Exception code %d", $e->getCode()); assert(strlen($e->getMessage()) > 0, 'Exception message is empty'); } ?> OK --EXPECTF-- Exception code 500 OKphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/bug_70496.phpt000066400000000000000000000016401374041537100207330ustar00rootroot00000000000000--TEST-- Solr Bug #70496 - Failed to parse 500 error response when Solr it lacks msg PHPS RW --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt' => 'phps' ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $func = new SolrCollapseFunction('manu_id_s'); $func->setMax('sum(cscore(),field(manu_id_s))'); $func->setNullPolicy(SolrCollapseFunction::NULLPOLICY_EXPAND); $query->collapse($func); try { $queryResponse = $client->query($query); } catch (SolrServerException $e) { printf("Exception code %d", $e->getCode()); assert(strlen($e->getMessage()) > 0, 'Exception message is empty'); } ?> OK --EXPECTF-- Exception code 500 OKphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/bug_72033.phpt000066400000000000000000000021051374041537100207150ustar00rootroot00000000000000--TEST-- Solr Bug #72033 - Real Time Get requests fails if it wasn't the first request --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 'some_id'); $doc->addField('field1', 'val1'); $client->addDocument($doc); $client->commit(); $response = $client->getById('some_id'); var_dump(isset($response->getArrayResponse()['doc'])).PHP_EOL; var_dump($response->getResponse()->doc->id) . PHP_EOL; // pointless request just to fill the request buffer $client->commit(); $response = $client->getByIds(['GB18030TEST', '6H500F0']); var_dump($response->getResponse()->response->docs[0]->id, $response->getResponse()->response->docs[1]->id); ?> --EXPECTF-- bool(true) string(7) "some_id" string(11) "GB18030TEST" string(7) "6H500F0" php-solr-2.5.1+2.4.0/solr-2.5.1/tests/bug_72740.phpt000066400000000000000000000054111374041537100207250ustar00rootroot00000000000000--TEST-- Solr Bug #72740 - addPhraseField return wrong query --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH ); $client = new SolrClient( $options ); $dismaxQuery = new SolrDisMaxQuery( '*:*' ); $dismaxQuery->addPhraseField( "phraseField1", 10, 5 ); $dismaxQuery->addPhraseField( "phraseField2", 5, 1 ); $dismaxQuery->addSortField('score', SolrQuery::ORDER_DESC); $dismaxQuery->addSortField('manufacturedate_dt', SolrQuery::ORDER_DESC); // Scenario 1: DisMax Query Parser - Adds Phrase Fields with both boost and slop. // Expect: // - pf parameter should list each phrase field with ~ and ^ prefix for slop and boost value respectively. $queryResponse = $client->query( $dismaxQuery ); print_r($queryResponse->getResponse()->responseHeader->params); // Scenario 2: Same as Scenario 1, now including explicit query fields too. // Expect: // - pf parameter should list each phrase field with ~ and ^ prefix for slop and boost value respectively. // - qf parameter should list each query field with a trailing ^ (no boost here). $dismaxQuery->addQueryField('score'); $dismaxQuery->addQueryField('manufacturedate_dt'); $queryResponse = $client->query( $dismaxQuery ); print_r($queryResponse->getResponse()->responseHeader->params); // Scenario 3: Same as Scenario 2, now including explicit boost value for the query fields. // Expect: // - pf parameter should list each phrase field with ~ and ^ prefix for slop and boost value respectively. // - qf parameter should list each query field with a ^ prefix for boost value. $dismaxQuery->removeQueryField('score'); $dismaxQuery->removeQueryField('manufacturedate_dt'); $dismaxQuery->addQueryField('score', 3); $dismaxQuery->addQueryField('manufacturedate_dt', 7); $queryResponse = $client->query( $dismaxQuery ); print_r($queryResponse->getResponse()->responseHeader->params); ?> --EXPECTF-- SolrObject Object ( [q] => *:* [defType] => edismax [indent] => on [pf] => phraseField1~5^10 phraseField2~1^5 [sort] => score desc,manufacturedate_dt desc [version] => 2.2 [wt] => xml ) SolrObject Object ( [q] => *:* [defType] => edismax [indent] => on [qf] => score^ manufacturedate_dt^ [pf] => phraseField1~5^10 phraseField2~1^5 [sort] => score desc,manufacturedate_dt desc [version] => 2.2 [wt] => xml ) SolrObject Object ( [q] => *:* [defType] => edismax [indent] => on [qf] => score^3 manufacturedate_dt^7 [pf] => phraseField1~5^10 phraseField2~1^5 [sort] => score desc,manufacturedate_dt desc [version] => 2.2 [wt] => xml )php-solr-2.5.1+2.4.0/solr-2.5.1/tests/bug_unknown.phpt000077500000000000000000000016421374041537100217460ustar00rootroot00000000000000--TEST-- Solr Bug #70496 - Failed to parse 500 error response when Solr it lacks msg PHPS RW --SKIPIF-- --FILE-- SOLR_SERVER_HOSTNAME, 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH, 'wt' => 'phps' ); $client = new SolrClient($options); $query = new SolrQuery('*:*'); $func = new SolrCollapseFunction('manu_id_s'); $func->setMax('sum(cscore(),field(manu_id_s))'); $func->setNullPolicy(SolrCollapseFunction::NULLPOLICY_EXPAND); $query->collapse($func); try { $queryResponse = $client->query($query); } catch (SolrServerException $e) { printf("Exception code %d", $e->getCode()); assert(strlen($e->getMessage()) > 0, 'Exception message is empty'); } ?> OK --EXPECTF-- Exception code 500 OKphp-solr-2.5.1+2.4.0/solr-2.5.1/tests/files/000077500000000000000000000000001374041537100176115ustar00rootroot00000000000000php-solr-2.5.1+2.4.0/solr-2.5.1/tests/files/bug67394.json000066400000000000000000000014351374041537100217010ustar00rootroot00000000000000{ "responseHeader": { "status": 0, "QTime": 5, "params": { "fl": "date", "indent": "true", "start": "0", "stats": "true", "stats.field": "date", "q": "bahruz", "_": "1402067668264", "wt": "json", "rows": "1" } }, "response": { "numFound": 1039, "start": 0, "docs": [ { "date": "2012-10-10T15:05:18Z" } ] }, "stats": { "stats_fields": { "date": { "min": "2011-10-20T11:16:34Z", "max": "2014-06-04T13:41:45Z", "count": 1039, "missing": 0, "sum": "47085-11-30T17:59:27.999Z", "mean": "2013-06-03T17:17:43.684Z", "sumOfSquares": -234260129500201700000, "stddev": "NaN", "facets": {} } } } } php-solr-2.5.1+2.4.0/solr-2.5.1/tests/files/bug67394.xml000066400000000000000000000012021374041537100215200ustar00rootroot00000000000000 0 72 0 0 0.0 0.0 NaN 0.0 php-solr-2.5.1+2.4.0/solr-2.5.1/tests/files/extract_file.1.pdf000066400000000000000000015175121374041537100231300ustar00rootroot00000000000000%PDF-1.3 %쏢 30 0 obj <> stream x}ݓ%mS%NUM&O7㛔]ql+Kr+ْ%/~={feYT /q88~ܷOz77o7'{<~?C%\ByLշK!_b^0o3K zES?~ ]rbCy>_r(~.m]2O\ņ/QK#:K/%-7L s  <.r)xKDgcNt"=AS,N,p D A Y/ OIBIT5%,\H!!Uov}n"a7hm *X(2lwaA/{f1o$L؊Š swSz=*L*CxfVD<Ƒ M#N̈ehRi5 vS,zHQ&^RASTcQi{OГO0X&Ld {'k `0`pJ B Wϣ?SkK.*X-- ƶr0WEa7\!FܱQ4q#ELO?mPwI+*J B4uL;f$nE` S~8@(j˟X!V1)Q]]/`#yɝvII~>{[% & AxM N0Mh_0)RWYeE_?aKWDIŰ U4b111ʚ0LfiAPEZ QQV6*{!%$܏MTF,آP"S{U΋;u;<1<\g[0](-bLF?A_ F~"@fW "0Qfh~d9٩DW\ KU C y/Iq .zT:]1u?J潋d ٚ  m$ŋ\ՑU$)Hi鱃YnΩ,Ro~K";x9(>+`A whFV4AL"xW&P/yۂy5 t^b!NvrRbmgh rq`ZKegLc ;xU4הIr] 91VAi&{4 3}6 W 3sWhew9 Jc;b<^vqZ_Ctպv.v@e*P Y$Y@:^l"`.Q +!*(PW+~$_"PxQTY,qvv0TZ I ,OB|6>o%[v>o%au[uuY+yyxty+*]yb<@:pOg筴q>o%w^^̤-2-^o(\z!ҳ#cۯ^o%d9ܛJ;,[cwPJ;pX}JQ[N @pvVK>8ax^K[!Kso@Zض CVӋu9KDlFJ BGm`G7H@\/^vT4#zY P^B)q'U waeN"AU3+$6#/LE.+u׳FtF@xh'͖F"V=,!. פhljH ts3E#xth !{OhE#LixhD椉hHgq@VI<4ZMFVɸAc9h.__c,dg[d튡#͌p,jmR\b$jOx4MC,TY"=5ðZG, щeEkaJMB.`\H%k>--HM1vy<0I *$iƈ΋G@}:ԣ/YͰOMr~甴 MIbc${s#Y[6]q[0`4\괂OM|1MTسN0Rj\#u_NX {S𓀅_畘72b5U*ը-ynS$,c1GTxZ $\D'" YlgVuC"~ՀP7PŻ33<<QDn$aa`8 s=VDę%QHsۚNb/f ҫPX0RT7Wb#ZHOzy҆b/1a6dOz] %=F~(l:"Nvs7Mc5Oр?q*c A.5I]="D/uhsiUޘ{_FFg[cB;N_K> .`iVTn8'pR)L.3L2n'4JPfyT۩/$AQfSjLR,uŬKZQDC#;,Bn!UJ[b-¸f,o)kJ@=i΃LksR棕IR e%->1aT$OEW=v533o&i[<7щD`]RNbNcia \!P?o> \[Kz\\n"6 $mmEӪ%q4jB,Sz/-\'ߴ+L{е+L~9!hvRI}.Tj!,@?DZ9h 2?\+{OljdB^K=J{X'D~"k*-Ya:p&ja~B.´+崭+a%E%M\Mܼ*fIΪnXlszALZ樊>RU sEp6[is 2bH1aJe{.NFׯ s@@HD4CIIŘiNۭZ.dVQyIxfF*<.3Z.r--\MlHŭCEDqm"DP1RD|xF*E`WQne ոX!L&P imdmR^XmI%XmmVʵ· _Tz܆F0eu cC5Ӕ>Xe ExZ; sARC5`Jf5TAϡDj,iƴѴ@b5Po6lY\\C5m=m#Vf{چ6N)K "`8]=Zd&|EniD[0# +^渿)R\+7IKjCV?'+8.guW-qTn2pin=Nue.r!+"u=;Qro ~nobp  'B4ͣs}1KH=ND'rЙ Ҏ' 8uah$z.z5ZiɼMORAjVA<9H4vq/!s/ΊH U͉0I7iNrmi[(sU4- ED4vy3Yl2m"y>iۭv9\PSe&5TJ~\ˉI=ar =#!? rGi;6w9=bEr))J&9'?5 yk+q&pRf2|#J}'IHj߂)9}2sMќ{ Kl}Mms8b il\J`A&cDž6p4HǥA4pr[CZ@tq) u4Ș QO2Ȉ7ɐh-glĩtq15yąA?eohm0Լ\ӣk`Mj 0Rs`Ȥ_Q GKcʊYz8E4XmS P*肙[}2 +6] GmyK,a$嫗`dYiԞ _K'm0\ i*7؂<&t"=Po~A' %=Rxnз䪎>p6wZ838*409s]yPUS7GqnZ |&H-4IppjQ(: H3wNR4iD޴,IIW}˜n]kRr-س JIMHN8e暂T՛۳BҸّ& 0r鎞C |JUgްX/ $ZN:U6a:8:JWNWlq h1Ss ҕRɩq9 HIqfdAo4;u`OSeUs\j .3Vf u-*02>86W06;g[d`#gY{_2Nֱ9ۇgP5a͞aIe3κB lmj4]G"rBS&FD褝t _T ɼ` $kd9r9U&ř>+IfJP(VdITI*U)$m863ܩ4AI13g&b g;3YfSU—PG<"M=̂6I Mbܽi,Xã7Eug5#;znsw.w01P\/YP#aǷhD,nd G r!T:nMx p2c _b kGxBT!=-j-ImVիfXUH)Z$UNe_n!:Ɏ7?nB|em%A͙<}m gx4NcW.Vm6F5Z8 ^Xez* ۊiνPc톢3t|A3}Sqd]ͷ,5ڀ@3AEC)35#X.pg8DO{X2VMA/#|,zi[IL"_e2H7uR\!k*ǫ.H*^7|~pg#2-r-|*f‰Փ 9e0owZ*E)sH`/ǽ9Yh**T僪gqstnq%qMjXDO֋TQS%u@Y4H;EU%Pma\MiZi--do¼(C;֢0MzS3C3\Ea@-Q&YctS1e1.>&2,*і 0KWB1̯h \*@| av,m54Tl!\z=>|O̚&kN9;4yrk@:Vi + GVm|Мs`qH9Ad̛#ݤ)(ݤȄI2jLsOp# (YX-+8Z-hx*Ӑ(^^dꃿ!\C4%+f+ r aħ: xC>9uN푊d[ `\+g*}- {7w+Tݨ˂DU:g7Q>aYܢNƊƧo ӸIz_M`v9Yy!|Wp}J`M-65$B4p-lVum^C[!A% 77NhsY,RA> ??]_ßG*N4f}_y_)r? "ʌ%FbAn{')F!yA>_ɋ)iTP_H~yO~iGbCsחT) s|1G_tPhqE(CfOAi~ta:-3$L܏cb?m#J̨Oc}' |} (e& ` }C' " b?Ƿ@:#Eݝ5>fOӆϘAArnc"g'c5u$Ц G74`!%UJb28h1!8֪φgb1T7^xƚ퉿 ޣzGb9b+Ԇ~Xc7S7ig`sE  ?j]".:^_(13O{"9cHoͨ=op::csekf~3<COPv1)- buy \~u56ֱWE7;&u;=LM]Ƣ2$@ Nhl߿hұ&/yE3|#|ck76w+\eIbor̃bi?7˱e,h'"?R21#" myDQw5I5s2nH:U_1q+`aJNg{78gcs fzڑ6ҿCst, GB[7tv?!p7XG!s_<3}=獄!$Fe䞉CcԳ@Z۵6~,3k(X 2nOSAJ`e"LtFnLȰ^cXoA۳iPsEgd";n.ߠ5CF+Xlxoױ˜l3@=īʘ L+sNCƶñnf5&8A]'Nz cq=ww:{ԁpm6oo֏ttNe)OՆK"-X7?MFc}$101m1rrDž+ͤcH-X~<֠9h|=[914t;bb:n 37v .Qc]ω{v/ܥ+t~%Y05cex/8_tG%h Ą/ggxOm%ͮ BԳ5qJBi=Щ(q lY?f 3MGFl#7T"zf_%λE>% [y5&41{Q+} Wc7cch<4֤bٯwCY/vyT35D`1z^,_n-Gj/ەKV6%[korƆyceOCO2"+њ&؃?Yj{ƲeLi)ì/6Ǯvp|E_/!g+}K"y,{ڪ%]DzncDݡ{W^eOgǝ#{tSBx7Ƈ1w~ p xŘX4fO7. n}ǪcL rgjߏZa; yMo Hj*'CßፅWA3c]0[ȡV=crϊ3~18@Kmw::v/m&R;V݄}ű{/2gnR}Xh[mK?R2֨ix7aGn=b3~C€^ p0UVJk376c] oƎ B}qUP8sKZ>|:,|Q%lҀW;^;fW{Ziisc>>qXcm㖰=rO39l;'y\jOߌ9]=~U'l,{ãc3Q =*c2Ca*ǷN=QmCLQyN?yگw6[ï)m~ड़,7OD~Cf$g{ >ts4\63l_ @)Ր0<ɞ_4Pb߷G1S /ﺹSP5vñ>#cwipun4a/1➕[#زzwP6:uFW4sAw\d4sŞ}ۧ. qmn`([3/~W~&M007^dA_2^x/So[XGIڻrKYgMb`!_u# vN !3PǴ`kA0]W?A!QccZnp̱፱qH8?ҳgY~ce Zzl ~X={ P,L{b6DX1ю 31?1/DZ-:+ٱwXpcˆ<?1 14-fۧ=f<y CPn2u r_( ZycѮ< αNk;!GZD_r((ck y^FW{IaulSCKS9}"N/Tq/c^\qMָk7oyzc*=]c᧡\Fb,Sf[;z {/v, . 咚sy0,؞l՘pX.#3$mlQ)Ŀ5GLt,;O]w֫U&]eN2Nٿ51m/Կp<>"0~9~W RǨoH[xƢC8^ W\_C Is\?aw~j̯0},<.WMϱnKgaY|j*ƚ c {RN>zKNT3cN{N!LkvUgϱ]itse|jgxٌi_Sܓ.X[M f~4/[Ozl{? +wUr5fcC/-0Bsc]BxS^N*uo) Y22қ$JeHXqSmk)ҘW]LЫ9koߡ>Lî_42%xӂ~,W)nOE&K6GhCkYaƒc3w}@9jLvR7b{wtzCDrߡBA׻+? ؈ǩc{UWi,mw,0Wwtwr;\Y%tkAqjJ?֘39)a'!!w+Of#MXh,= ) QժԘXL鞈1 ; K~X#=rچKg<{?m߱c~f-#nx ؆vW2icxP 'nӣtgg1֘| c?cp F5i2zUAo B%L2]nNgV{j >}:xs LHr61;ޯިJt0ޥt쨗&7*}{v#tLw/ntwu5L)JhF8liaceڱgt˹ ϗW^ely2Fg3!Tߚ n] ˦M;/cIMwdέ$2yr|Ynx{مNؚ;#70?v n]wMu'ݦpBNkq,<Ǜb+yM%8NvƴǚJc; %z0]Q}qgDq`,%|˚ڥqa }"a/a}{zN>glw?ER#O +-cLb8ܷ0K}ñOusloK6ޔԻң|\:mԟ_3=]cX1 ch9}>C>n*1Xs:~yGuޭ3q{J_<*jQl~B~m\m^ ٗMhye6N/G72V3Ih7i|)l~_rLK19>n{;{P_/KNġSraKi2fo "<} a_}И17"9:&`^Hc950(_i078_DC ~& KfbW!b:$#Aknj74XYe|`n.cfx,Yě-fendstream endobj 31 0 obj 14422 endobj 47 0 obj <> stream xI9&S 9'U/zQptf`Vo|pR1#p*IH?Ƿx?k*oe-om>.y(q?&_9ROޕ?oAf3RmY ~71kJ1t>s=c%LJSСtWgmb|JS}=+؞R?TS{O*?JY峧\'%4](㹴XRI3: e8vzKklw?s Zƶߤm(q4-=Cd?6{ղB)^Y9cg {}X(f%*;hϒ`QSzgɁyuۨܺ0~VO{[-|4JE Vaö,Q,YvV%/Xh|En9G:JN%k͛<8}#Jqn̂0YA1/#Ky^ǜǽ7ฏyz}0c*.wő%<͜7;18}#ZYҊ#o3lMh'\9^ˉC JZ&K=xY1aO[CA\} B"u 1DuzaE2= k[m>>i3߱g$0α-l;a6Td >mX(CIX"( 8I]'Ec& fuDvq1NX]ݝ 瀂%1|_Lx|q7XJ"kz^Q [Aټݛx(8O+OsH{Lcp -h^5\)ȅ>qbvtu|Wexөj}.(֬g8X2b]qK3:, 2(6hj( q#x]MlviMѽ b8v`4 zX ̢(.]T8ԅ.ܴ3?;Pè5`RY&T =iʕosf=+}KlƱr{\hC;_րZ.Vc,ŋe,,c;K7NS+? !:g_RVˡ $Cb8*u]ep- #%b1^$fHEWj}D|!NeY.؅mĪ|`0'nڐ~ayl\a50:ڿhF[1cs!'BOC[[u jA~8CTT˜7W*\{ ߖ,>^ǭ9}c iS,>a?SDylcۉ|֧٠' tҚ#顏}_91QGC}|!GUoYs C/w;ǿm9˿צoS >(}(>cFo],g̩霎(Ģ[)QKZ!5c\CkD8q[%0˪Ū968 hݩ(\ *\7.T_O;WvHV.X.~ö/Txcdq^']s6jJc0AҲwQ0R ' [A:ge^^,&~_Bޢ?i {aCpXƀS k^iʙkT!Q5=U'5JA~Y%c6O;]|һ_[.]m~~.lmmFDBw(s&~귴 $mI\m8*B gmِM %\J{mHw5~QsB[P9ˢRȥ5W>^+߮s%PXr3O8x2=txѧ˲xN$*lnKPx)!0sBDkf89y\bAK NXWI Ɔz^5=,]mQFEpeD9P%o.~`|7W,M+8EO%FI,I[2oD6YΣ[)%2rgD ؒY"L$AaL kNV9%u Ġ_sKY"ְM?MRЂ:̖|CPnηTؖ-DZ GqQВlUl&%UG۬%` qDj ) HJPb*zL۬)( "CXn*-Ԑõ@Q¯^lphx u>R]ARy?iMt!_,UWϟjk5KYplGXoS31f e V?j >0^K%8(yƃ8@Wod+Jj8Pt&1۴ [بxVW ٙm5a % =p2eO\*QLkh1YdB' O V<(:Q;@1`뜱/)à QR  ͢'kDAZRFY"nU=p 8Nހ6 0,x"0ζѶs(:U댌=㎆- P[#F:J`K'`f(Zl#:BcβFuC1ۂl:@#WL wȘ%݆F@*6mz gYG6lqfXE0:l`:`@6tb/.f_8'ǩћhq`Xp$kBpiGLm pluq~o~iVPLĎ!H(VCAUbfqcqD\}@`<1)D)8P4ZP܀S5؜;GWocCWɎ"38)lVL ł~bƆa",Gg(Q!TPɘX웲E蜮%X %O' {o(Q,SSZPD<ݸ qa)kb+Q ؜Zxی0Hƹ1mP\q[-ǽ7ฏ(qqa?sN_pq,6+꽟m;dtǑTL^8kcqeɦ1 UHq Up`≑w;͒PEő9]Kj;1<806*ȝ%%?f}˜LWoo\| bmh`.2L8ljG;TV>VɆ$~q*vSrih-LA0DžSxQ_{󫷏U.z Ѱ -h$\> g ׎6<9Wgo.J +QT~e:-gU{g /@ tq{xGMZ)܁c+l=2j%4QGіn+K!؇zs~ƫ{w-tߊeV׊E03#"]KqHFB=YD)<'WookLS^UZ}2KٛcD ]%Ín6ѳmSYR&Mv}էT@%ۙ:c?KS-4uX73%gcaS|R{/]ԵN q{/Ϛ2‹|+/6LtG4~^..pWƦtiz{t=DvM*\57bzU|-e.LեlzVf B8SuK =:TXx(F}V5*}ٸ +M m c8P#>VVn9*TS,x!Lu%ṁ`UqH:P8nHÌ%mQ#J|D6 SlņtjĞ.lˬ𒒶CƱ:n>zkPEzn0WZy?ym& 6sqPe#BNO/'!߭3Lrhwp8}굦f茰Be<Fy"]zn;zj7=6CϭbɳL`ю904mK!~ސqw >+sa 8gp#%|\ʵF`+jGjwnֿ{p{Ud=tslT,Ig˭y\ʷ;ǥbX}) f18dDQ]'h'GB䔸>]|7"Vv}y^qġ<5om L +IəC,f"heu-P#X=ƙi rXHFTU^JҴ Ϊހ>"sm1Ն"#iM'ﶂ / w,vw i#RmȬ-G3υW ;!(ͶKEzT,Kl^}]ý_7ʕqPiR> 2hn ];xD .PDn`h>a}lh#]I5޿&+Nj dpL:3!JѸfx슰f#2KL!Ht#,5ZaQbVhFfh%ioOţ.ϯ:M{fJ'sys{ɠ6aG bxKnPbÈyg %׾=c(8xoWhf}ã~WBXh#59c0wo ,s$s6@Ñ,DJUmy0]W/%  97fw>⇖d axQb3By^xhf*+8WPG6 2­ҿbuc~EԼz@OZ [wEYw)8ݣ7,61,l`Am>>Ɖ2N&cۅ̕c$E: ?Op{;~ȹk~4o3]L RRޝ뙋v_/%C~0^\,Y=8x]"L.`.2ۻ]Z'hۣzd7Yk߰s{Jjdf^"ZƝrZęY,ens*X6?8.r`d3R,{\y*EdLO%ur H))V3v D^穄yn̝%U8g 5VoYϚ|/T"ֻp,Y*ᩫMW%tUl%T8xgnUFz[i7O Wm3`N6*k7ߡڭFՈ7v#^+4BF5%>,#lIhNFW쐞AT*(&#^gAT|^5)^CZ)<@TI!+1פ)egf\ $F\ +8MA(saș>'ظlZdfvyhz4K*I›+9ʣݶ)%ix'%JAHp^ϐh:sS C M؃#̵|[gUӣIz=*6"[EKK[c)wċr%rx6j*P[Rna,n4OڥiM/9<+RAl,n_dpdpdp{E|M7ok2ػ.\~ѯ`&^owD!AtyM)aQ I"F+9;YJ:)2qҸ'I|WMv"S4dv&=S%QOpx1Mk u{;r~q GQ./^xDxD{&/_ޔrKO&O&a~?_uO6a꺿$aREO>^DDDQ)S{ /|lTu{Tuu^+?K3)(+1͜fimO/xoL0"-2$kf|F1>#fSP }IS1 xG.aۈga2oȯ.JA*i&L|dG~EhBQD-~aw'%rb^m6ԕp 1Օt+RWҭ,_6G9is492Mx3/uTWK]+Nq;SW̭ԕr AX_ v28bX ήk܋נh,X5mK1Aca>U4,͈kwв-%IɊvIcM\§U,G {HnK~V9ԇydgX;/$r'C}Ő(8-- :BL4z؊ޒ }v_9,.,XtsMbKg*u\U,bL_7/tV,bLgſ;.k +x3V)u83vVBΙ#v&M{dlQՄsR枣&iל sΕ0lh ف2 ɡH7kay2j%:s&9ȻC}$B`ჵhd%![+C>q\2@KEF殴`tC՘l 51m|~kםXCEdFK5.p043^oCj\D'ܵ3ŇE3-{5 fq>';ۃ/ONvZWhtü砑%3N녜zɦh jfY{bMl'mш\>\b㳉\o/юwyU))=Sjn'|,\Q,v M4:uwM:o!Ao$rt-7FA#NƲC8 z*hz9yE$6"BQ767N/}hZS_$]^H$E I ICpzB$z4UʖEg̟gLolQl,bQ 2 '"9S4to )jTWVb_ G&Gb̖SRz7`1KFQ&T/iL1g^>w>sV^iB?ylI[P \e )4(<ߦ #<M6{BL9Sz[QԬ(N{H28MVM* %tmfl>3̫y\낍R -.􊞢~K 㒅3qAQ>9.Yi觙Ot?xPQY , , |uBoA A)%)XYR[dF] yaLnwMdE9El,Y8+k$+kFI}O?g̜Ius {&$g=\hoɤۖi8da ļhV-K桹}Vނ?WuOɚĉAZC@aK}*Bx#?\M QI+%Qs#u!865JH!6]JcYфXb/O]GK3wm$\gr4O`Bï3 |zP!.8 P)4u] ksQo+~*7gIZR#& |C|Mo8]ӍI%\ibo'^(FsvpFH)2a@5rzhs*ٷu3br(ɫ.3)3%3%3ll,/"]"3_"%ޟ^5=m$wQ}LKu`J)wW3!paȇʼr|{"|.+ˋ'率dok|$XlQ[vعxN&%K^oe#RuK@dnu*JF!$>:/Sswe줛NK, ΗwȎ"plCn\PJĹg9)ZÁϐl%ФPc"<bSoC6 $gԩ@ Qtvj\fW~i0;)Ib|M.<;\Rʓ<ܓ'ƅf" O B/!kNƠ*`̂0 oi 'Gh`%xK6M2B_ǀOsf1h8b ͛?{`@&dĿ+@erRW: #屰d` |EI4K#⎩nv5Q#iUZ0 gqjigP_)@+fOnXkO"ƛsR<6է]vƇ5ZW3ԙfʻȎ|oT6M/ɅdyZZt;46덉Ӄ˕عvmzkyLxϯU:p*Wn?L~Q冩P^0~&L2ĩ?S06XKROV/HQg$uu!1Fxٷ?TW x~- ٢)#Z KWhIV cU씫 ,Q͟`<Eኪ<1L8sz|7ۇ;jW`dK\s#v:@6MIC"Vf:;VqZNH.>Cja/j,7D۷jpJt)ݢC'_+)&pYpNc]a5Y9^qjǕtfhL'囅|\fѻe~ܻ[ItW3ŜLg$0,Gp@RaTs֪#XTùTu '({83##rcK"=lT{5ك MLy n׸ܞx =ٚAa>+dbwLhsZ瞱+1s`q d$Zjf7V@ނR2 QVb uOAT0X̛q騞,Z)#f 93ٮGnh;tZ/3vIL! 6bIa?2ep҉Eڵ`z'\s@O('Z 49I.J̳v%j) -izK&ʡkĠI_Jz@( \p3wY,\s9g垳pY,̙~՜ehslpIyz-XDFl]l8efk}g~6CWMƱY " hoj3^gѦD?mTo-HN Gkj??m)3-֏o\so>e--jWE#ъvcTnF&At=:88𨆣|ZtA^]Cz${ \ g0h]`SP'lX|3Z{.|VY&5DG*~GOckb%/uTC\.ъ8"A,xkHSni(a&VR#İ zpoApgE ;$":ƃrTw Դn<NĒwHp8l}n=څ_L'>Gn2z DaY߁Ǯݽg%8 n4JQ"'F`qǮXݽ89]Xm>+yG6{8xہcZ6PC 8stJ [p8٥b8f9􆻳C~/;d^.:KQ=JXRY] \z_%z?au.GK̽6L)0Tؽwgo(%1%H;uh)DŽtϸ>:K|#|!IJ"HO"4BATG!J|  `;Dž~swvɑ2Xj qiMuĥWں؃a>jމ5kVd\@>)w2Keɫ7>0Uxk׈BEyGa_"зY[MFJۈAK}HQW%K̻hķ :Nh8ni6zX%wA X HLX柵 ̅aXg{";ը3Vy C)N{. qVA+zC.[}:+WL:D4`=Q`G7,N}tvGgjUJW[7C@quQYهqaq6ggo^UDw‘!?yC1f%l8?n<3h8wn/ D)YrXߔ]Otkj?b%ԭ'|+,zjdzT!/P BS# :>,y?KDJp'< aǰ-["FLNMz>JrypH \}RP3ωNu|/J`WoTѿz-S#TPk2w%](">buqO0ѻB mW-y?KvS83Z$sdD6+?pnKӉ%= cuFdLU=+w 5!,|UKN'84ի{DZ>AWE+ +jAWf^O=> GM%xlyBk:7 K$GX6kXYlJ&o瀠iqnQ9Wa5%gIhF;8ḷ":=,=r.C-y?KNsFo'ԨWmYԝɼQ~vsΈވ6,IfPw߉%gIyaϤ : fNV4:Bi&Ogj:SlS؉r3SIˊ)NY4f>Ik'M38m|Ng,{ I\Jr#h@ըS_׀P& S-1 s65B:1 lSn '5V<-̋k@!c+qΰ7 VXpzk%#e_ r" FTL;L;!m=Di잧"Tyl{ƪNbr{.LJ%Ű+ݯ %YFV`F,;Mj#ɨtj32/,533!* kC),79J`H}nQJo#3[GL/J"+CG56mWyoD߿]wf5yE wa˂޶VR<~`bU. M .L@}$%o{Y—mWm]W5PY!K^OiJXK}l@r.N ʣG70;hLݏp>z= ڶ>6 =IU|sZi7qҼYx u<9=:;rNQ= ~97oJh2YNt,rG~l]mYUU^\8[T+_T7xfѢdŊ + +'+*6IjAxs"N߄8|1bڞGb|lIn1 eB `e7V4e!$2-m]E\>~19<Wwe.o!{CK7]|aI.5HKaGo4O@:+/+O * lڇE^d zK&ay=)pCѨǎPGcg5hs >r3O-y~ٸT*\nsY>7֨n Sa^-*NV }u˾ZڂJ!7Rj9-3rb舟5*&ݝhL( KFzSn5kۉ?ik"V)5ʢ&볝 dZv:Zx/e}E?#% Wp24kl{B wkѡ[͎t4۶LwVG v&Ead[sr-hy`5rXL)[*o Oylr0O\ ԰OgN x[TըVYh i'7GWs,G3 y Lr0f 91&b uE?;HӾaߤǃ̈́=x7Zn%9t'N:"pN8;#/o m- ]`?%7w o4źŴ,;eԨsEvSuٟ-rSf-<@7]޻,<> #&IE!X *CUjTOpmed欑V\!A# fnJl!ԾW@bGfpF~O5z8q鞨1jhmɆQA,vjF5͓k)YÛipɟŶմ7x]ObӢni4`gYrЖitPNvR"Զ8Fwn78^PL#?O;np7(eF6A9[:Fa 狡k\V2.z"pQ9Dfv}(Qlpٷ% }1ZIXc@=&B<{z;X P=wS )f1>P-1a(LvP8:a 털æVi=K65ҜO p~ԚmwhFY |4B X^gΊ/~yr!/?N3>Bio>1TwCF<-9kĵ^-00Pvը 7괫E<68G[#[j( F&o6P_-*}V9ާx[\-"0`ī/ 9agj"k'wu1+ YՔ.lY fp~̹a۶sCÞy(z~RsUn;wy?*^yf JQK+AްT6g߻ ~])-PgB`sHEslG 1=ωM2-pQe"tI:WV B.Ԙ[n@^ +ĵ TGNjz1MX|>e-tC:+Ws..?󙪄Eog$[ 4ʿT5=Cƣ/ǡ*B48z09frc((> kBYe$EJe)٢FWLh523L;f֠j0a X-2̬EI[rcՠ ,GdPքˌ^uF?Ǩl}́1aܩ[r{f05`n!{UyWK3d 0֢B}w8=aSG"1Tl(WvЯ1Dƍݜp)2-|}:%e+Tp @UD3CRrȌu*)۱ۂa'ayOW*b9[xt9}[*bzw,hڗXX4+ԍ@MLM aybJ DqV:p`")%֭]&-Ĕ}p<(BĽϒIe/, 1M0tz(_V7:'v+?[tt Ύw@78BuJh *P|fBU.=cEb5$x>s4>DAw66ӸMeⓊ1qNW]}qUW/W]5vBS3\m$e@Lm[9DkV&UO t 3jEjdd OaZn5U  52`F +0܄ӎ$uG"`{•jH"VS.j%OփZŵO[\H|5::` JL'%oW&zz}m}*Ak=h7,6tL/ѭ^ۃZi!f1Ak=h~>N-U/jݯG &1sogX'$X,pggl^5|z=i%m|xr'Ik=i-% [xx9NLeC3׵5\# ޳޶9z-~5[r puLu9Lgu~D}X|l8K[,|;FԳxsPQV/)džgY9kYKoY>vl*#$D56% FAk[Ak)(Ե<d*9!2f%B\^/Z{^>nUS_q Ek ֜'S;^F۲h#Ik꨿Lgo%8?{_cɎc84^@4@< wߗ<eQYL#B82#"kh'Y)fS`_9E3fbz}bA@zѿ8M s4\NS>%S@f5ZҀ" vCHX½mp2>UpiM {&87Z$BbvbfՃ1ꟗ^@?%$Ȑaj{r%'￧_rթN=K>^%Ne-Q,/Mkm5xͅf t܊&W EqAEPvII+㔈 X[NF?w5D8 k+ y[(xn!+z0;tNI9o*PAY@Ë&PS##Њ[0=©7bb[_fsJX?TPoC\n5vhE-:L^C{;$H~ƀҡ5$?4* ЂH^^C`d-2!Oy}Jc|L&XӥϢ)694\B sho;tSHhAWv *Z4]qjPMZVc FP[,DzKD+J|4ա!?-4gȩ }Ez>ƶ]Ԁ?3vAZ d2p߇R˵D$ns^#%-q.Zf 5*>cCǡP5yhM[י"α(+{yDŽ Us[ 2෦(,(v_;~Hm;#s#g8)>S8]k [$.8Ᵽe V%v ʀ-]hܕ7h浵rV];);z8Z x%ף~د~y$Suw|D1ÆY NjVAii2=mu~QlSHU'tYKV 8 ^SNL=ᕐu0F# l Z6ʃZZTn٭]5VUqjpv+MO<33JVz;6#YRFfn TDtՐt~磅XSC4"-=C EZ|1FP5+<ִE5;-@`ɸAw Brwm'-iYWVG?t 7zjЛWLjzUJE֘igh{51߃}1cw"3驱$[d qTpނ&^EEp^hQ5ۙQjԌx)9V5ޢ_W@=V3QwE5glm5VJI[lzYc7F3jahڑ F׈|{RorPuo !W|CU{VlQ mbh-_5zނV=W}_[Fc)W5<EbcyϿ^w ,crJ ^.UU=Wu5 jӒ NVK# -dGvBӬ;Dy'NTi`pZ9#n 3[s-7u\Qt]4(CҿV҃K3)!6ɥM=Lri۹J>=[3^R&q2nL{Z$֘Itej2o<-B-D\[}§ri{FnO_FoRfd-+(э7(LaI{vpVcg=jtO<OAHx]xjP"6rSg )Xci8~RIb5&'; D0 ]j ė4]5{$s2~9aF蓰jnavʌ܋lqɩ] Z(b^TN(ªSNG\VN-~4~[3W#snqj95Z"%֭jWʪHOaa!Z|f\d3TI_QuԧdJ2MI \Ib}^SS13[jk+iGJxr:ێRNRxUmhb=QZt\ʍTV6I7D&q5CRGۚ ],"܍PSOUҫwX-Z-!9 G+`"3-޼ 3M|[ozRK/T}(փ%;N:2zuc̦8)%J%c!K!@GҋF+y7 fj]5^ь^-DPV5dŪ\eĀb 遖~S6ƛ&?uטCr8vjЋid_-=c5vhEFEC.MoQ>5N)[$?c$ (:xS+>X_N-8׼U%F3KEh0= ;}ZX}W'DzLGfPCpJN<(g[74P<Ѝ7wf4BF35̙@1~,wZj0ȡciƁ8RD􊫞T\VzNRRF|i!*0KHs z(54_; ryZ9MiQ絟U{ِ 0UA -Mwk7X8} -F'4_c=VpSa+7."W}RPvl!K[2$0.Xj[ bE"T o#.pI|RI3ߑj\z(%+[1UonJE"7pSL!oMD7Օb 8M)~T O0~TC,)ӌhxdOj>EZgl0ԐQE]Z"GZ 居*׀h9?4WBsj,(Zdʁ^,4ޮ'F eg[|@Ϩ|X9M8SoWĠhfbNͫK*LϤw$C5guWN ~α1'1'"k4ХBMsZjլFM@Su0Uq0Z 5C*VZdS%7 Qp^+L@Vw' [LƎ5vGjL -TFFk_k%8*֐48Ce:C-!;BC gCyqGSױ*oaD1DC*L*:yrWQsZ1{h*A󺈙4!RC2` _b.񊘴t_{w'zZR~PC PCU *T2_M ~V|+9@.ܓ+{U_oZl,ujHB\Bz!H dDlڨt -5%0qZN&ŻQBBg;b#֨)v[q ^-6bҭNlO ļ#wE_=eU4Va~!=M-f#T|8Oߟ`k^JFYWyW'̯67Ȍt?-æ@F9oՐQӵ62R ՘?VhZ$;yyo!LTl N.*>S8t -&\V49M`er5&bDn5s)\ abefxZdZĭFn.[<ᢌ6.׾s.H㢼AT+sQFkV*Eڙ(oaX^1R}ܛP< gkED*8Òw4Mڏ}|cpkҜq˛!fة@w)kS5lt#[wZHF٧z/ZTS|eY PN]-(Lb\+w Նqr-S!E7$2Wf#{gF>FTM 7<PzY5~c3tRu)u ~WJQRZV.YA̮80LcY1&EAS6uEɔ7U1gN12WvB[V*{]N:A%BT"jZJ4z,՜dNIWG,|AJ%f|iwR(]9Lm,fq]{![\I=>J'':؛p8u xM  :M{EvT+3BD^̳|چXXgARgֲu 1w^KtwĄmxI) p.²p ;tS.nc`HWĢ :@?K x%yk9H F r9 zXkh{VJ@ s)jz p+Mx\Pd,m D}ޅ4hY.*AVDaJb, z9e -{ɂXw[٪n:|򒋯po^k~gףFygk}\Z#{|=[_t-ף7SK9}<3l13Zc[~}=/g6 ݫP/׃͹WhkÏZ#-ʦ5Jw4N~FNIb8՗q[/ WgW*W_~^5R\>BZ3HIJ ,icħjb#n%)n ^ 7?\,QjaFiTLԆ́l51Lׇ&jijPHƔM 5!XCNHn!NջgjRW-pW']7iI/0x,0WA<|Aɠ;l RkI2#ƥ1 :NV 3/QqB &bk+-^B + 60@n5d1dH&BҾ,f%wH^=3KT۲[4Ng02i@sBrkYd6<7 _]o\T&+:h|a4 c Z~ N@4s*EaR"ѣkP42 [)Q),t(9-0(XSAq.ƺ[$8VUS-jj?iIT;cdN(^G2W?A訔 z %2lMɆt6uBy ۬\}.CyQxQrQ$W ^'||p=|ǜd4` (zHf>hZ -!.kR?MGEl;! Y>3:AF; Ѝ[VbSܙJ4/&#ǛyEWjx Z}HNo]1'={ovCxv􅆓U\;B D_ kHdn*m3~rK$qYqӦLa.k0Dw@@dM0{NtO6_@Db l\)zH Ԃ^GXO#y*3>Zb!g{()o>] NҸtL:7^8tOorϭ߸sƜ[uLMϏ]O=wVTr:)ǭ?]̸Uw^+Y0@(?SrdK]ǎ3 x^ _n侯t.la}F]ϭ펣V,d>8d- 2ۡu3 "gHR&R&mFj2aJ41V prgZJ)#k3(C8CSwdano/h٘>̄ld߅&ͫYeeVs a/,.aj,l.5?1=bf ']%*/b!ū>DF,2q8g=]d#vWZɸe_ۏiR*w3LNʋ,XH}'ffzCοX :ߎ.?Csx+tj ojgE |*>2bvU5zL!X8%hs$76*#ŕ M5ܑ_iE59 E|;]ֵo?QfV*v XآT?JP鑌2`G9#뢦WOu@k25H~e([& Hΐ(=[M;^e.aVj5:sjȥ~"`!LK~QCΏup 5֐3_tfNf5lZ,Vc7,5.xLB&dwP2gx )=#ѳQkA*V`Լк@>^pLSM8):8XhW E9\ z5}U TRՠfFuըkM*tkg cm0ƧS#Օ>y#CuVGrWA-.f؉ZoIsU6l+BrWpb+)u|m;pSŧ^#(  RUvVM;Ё/)BuzS XO{kEX0pqntSz1{uL֍Y _oVΰG; 5^7q*'=U17GU6kl`Fyɬ`6‘ )!L\ڎX]>/uëxݭb "be/~>䈆U\!hvXqPm˪F㩰94ad0^JV-F@rT w NQ2̋.F$U8 ңiuo$~ K1̋kCܐ%ZnB0pQ?d^Vס{ab.^Q6%"t69`έ8 ;<; *yTZp1jwvT,ZC$Hs՚-e.Lb̫D#xjR!3n]*3WØCuiZc+^乔-%7kp,"k,/@^VN᥂?)q3i` WnPEݳ1L2_*SuF1OŢ;ʢQ8tB0E{'OXU SQ3%1|aZ^ŭDouK6 Wt0K5)P?#,"wz/`T?2^3*#(3M IZ7a-ɆX 5CT)?G2KY׏EJ|"ЛF?c'о X-3A"TM&ɡ#0J4]z>#[MZK5 c |~-#kT Vήi EeKǁ br,1] TY҈`'?Z̓K ajIm U]ioЧIR/sz2tH]l^MLf5xt{Ն"JǕȒCHYٖ.'GW@nnR|˱Pdg&*,,S4]]1?1Λ+>6zxKNo5љх7e±F"tw@ {O Eump휭UP?@0ijsխ5cjA0TnM1&ͩYπ 58[٦"C67^ {/*q_wg?SLj,+.KQMU]@P"D;{x^gucoj_`Ln-S0L]2y^苚nZƝS~Eu1zRUqj{g\F2ZH7SS}^D? \dtNXIsD.i4 `\qp7dձv9( 'BQ6JP:X :yǴD&8ƄLLL,ri+NQCSy43Ij;r#7cN"$n,܊Xr Fdi N<-j(؝߆<\8lfU]L:w#6z(mֿiHRB Z-To(T Ҹ՞V܋zS>^fɱm^9Zٜ5,$Щb6}-LIC%Ov}`i͍1mvCwǏKF$U=~B!G<6/lY4:"VΎNX"`y9v1H 9 4Jքh2zou`0yh×!ᵡB̨:2:*O~Ffi s wWèf2ia|e#fRR# ($YTH9K4훩% bRA(;4Z&trR[b\c:I3kJ0{eLKXͩkS9!(b6P'˔)C:x̂1T &MKTuN"ê0cـl*ahoD4P2bSy-+Db.h _8Mx&^S`rOk0~eT U 'v2$AP>5<\D΂p^+йl4'<1@H!p5SGP/n|mwV##p;Հ~b >`[f2Z//SZu Oˆ9M6r5^lT\mX 3fw>r6u)PbcV,2."Džx^XdFbkp\aHʟ Ȍ>.ExY[iXd Džx(x=X!|,N!'ƈyWc؜"W X׍\GyXmPd-B}#=L9,~~͞o5u͆g;mFP!W7NB]6q)5jt RzML"+B@Ct()I((#o7:qis+;ۺ];Imna;Ut٢7isNmnwJǶy'֮FfwߑA[#[87C몝9)fBuEfTBj8_CZm`e!b ݢYF֨gxhlzH5$GztN8Ař_-,hǧDa!۝ε U"zX9-c|!e0N_6pm`~akƸDd e,<rJǣzi;mcdpUfCLIdR<z F+ڨ&ѠF]G2SżSX3bwW ^ԃU#=YfvcNƛ&b3Mqrv-ܓzQwҐENo%קԀޝ=-Ɔ.@^qE\hz)c*d1! ˠ%\$NŽCJ_bAs \ʦNExSMdkbq3fgeHUjG64 r3%}UY h YBэ z'jܲL):(\,6TߔաA3fNӜ{bkX>ֵ̦҃a ΢bv}7=nHX=>㄁+*0R1RHs2_#lGuJUڌ i<|pOMM4#3t^JpX-C1 4ƾXhVs4D: c_ѮKYB&z !VZp<<  SxoN,4ϠqM(R`=矸tcٶt,QmKҹSDRTj^;~c_UXOW/_U~U*#3z*+gw'Ի{~G?OD=JH~t "yLFh*UiPVhldٚz^ }5{DїlL ɟש365  |<S8xFs1i4%7֘pc9T0IK NŪ5+Rmtfʚ` Џ1avm/#)\T??[z'PW}k:Wo8x_?Tmߺ,)]Մ쾦\/ҋI|^d9?ZvMQ6k]zRQrЀ t#Z~r1yyӟOc[|z-!kEvM#n8G^H_^˱meޱ7w?L{xPzHI$ @*ٿǮ|K:mLX#kBƆ>HKO]1;膻in%Y2q7{-b/k=> _In[dirBny̟zSH %`Z4 \vcY;:덏a&} DAVNOyBØvluXly#?}ި}8uՉjͽHݣk葖H޺|cD?w޷RiQdO"vA-D'L INRd,/.$lOvgO.<_MU0wؒhx[{vlt4 J} b3EܘJ O=؃ˎex3xDpAz@M*:ˁtn2 A(xq܏kTEpY'TLiGgC9C8//e\6AzPfh @}B1PY諍.ʔvZ0!4r5ΎLh%:b+AVYu!t 1_1_㞯zMQ~ôi0mur0kӜ H 䐁IQZY3͠nǯ6n1aS8h ѳNliJwLfh)æ1 ӞURؤt:n2A ]hŞHҔ\oڂ/CɆeoYgNx61||DŽ/o±3ΌgNxzRCtz&2hء/BẐjO0Y۱V_-hK\L mIǭ=@?+~?\qn'xLh32&aW!@6IOcId=^NthZxez!BJ౞8 g/eccۗ_@rhؚ3 <2: 9Vm<3ՖN[1\Bgs,j*Ctعg_2m#?CLW:ws. |6js.1N3 >_ gZb9g*nůLs0z+l>;ەoC?)5B'Yeڱħ#j_,<\iЍq/V7;? 8U)|51ecܟ*}ka뺇؍KnN;e:dzR8nƂ-r/7̗N~vjz.1[{9؏9(߿c 0i?jh?OZexNYwPoIޚͦÏFAQ2s2 )*Ãfc ;ߕccpm v^q a!Zc{ G2&nDǑl@ᓗCpONX̅lF/}\H <@~&=]^,d%:gnjATԗrM -eWةdK=3@"ңMhevdw$re_$ zfrM%T,Ċo&k l]3c[;82]F(4S:;aMCrN}v~qzg$5c`"eDıv\͡e> S{Oj3Njq?pb1~uݝZojz(fuT%96U a>; 7ϥlu?PlPՆ ۿO||On]9H&@Ja8ӮiC߸;3AI+3w!_r Rp -#jB7Hi=kwco M>ߔP oUMpE,:Kc-t$U,9}Fh66/ev 7 ƑDqX2*C$c$rMk*‹ó*`OPI8:D0;]`sfjtwY bU\״3X2(Yc,CIA߿YVuyzLEy3[b@Gqzl{L>Sӆ-V̰$ %8(2}䖈3{h= =fREe]S-tjSа5uSij,PReI[TUX/^;]e,S|Ǥ=6UI˼{%Դd|A.vaX&&x;WK<*b&(+izoMɤwI/t05]sP4 CeR3S\s 'ɯ F$eno03QH轛i-:h\I{p37lDM#?<8/\m'J6e#XvBĤYs$7dH `"[CLͰ6r[`S_hnɅJـKř̮Vmڊ@?sھk҆]k fAKfMΩᠫr\,mblS5wiWc;Bӕ` a3v]- %.Ѯn3XA %Y*jk"KCAF&ڥTi01pf/^پ_\~wB{o;~ G.M^kә"[~ɤ pgҼ`hb7s;i!pbu߼Pz-CṜ+Ԩ0OZ]A'Cì'Ou/ 帑L42H-a)U2f;&5IC>Wm:ߟz?S囼^it A<3LW Y.,5?5#Kbn$NPv/ O*ĂBruSDN@@# k\^6 rakZ}0{.XXLBK&Jhl'r.HqSWѤޅ Dq^ ۠5&V+{7LY:\zi& 9,LY#h\ۭq?ָ〈x\Lӷ]f uj.BN I;Uu@)ֳ~,)&F]/#٤ٛ97*-B'MR'P4[w[C5wdДKv𵑽t2gdz:4ق;ΰx:laeFh" F 1TqL^9~-'SPAypOU*t$7p\#EV_2hOڰ/ Ra &G,ՐH4pCxbVV >J ׁ.\{ȱ4֞Z/Z}bLz1LTP2Jݨ-քp5}T$;<aG[Ls1'\M&\a5u(a2u C _2mm$#U 1;erؾl0vds i`J| K] kcy#D81Lx7*2il(rYf Xܴm=Vg~;>`$5ErݥY4*z(-ZMylHM>q[v?)?w t[?GdoZ&LLI]afE͈ Y( _ c =xFE8߾˔ʑ 濈> j`uvFQ6^3gǸۙMnl*P$$#'%5)Poε3|0]o:sƱcJJ5p0VW->Zp\,RVvRÐ]zG:%U6or c07(hh.. D%F|F>D Bo/ӆL $i~dOFj&apDB;2{_Wg<U"jV稯_অ=zCoek=rU?ļgh(2uW*ʏUUcX/z>L _((u _?4g6IMJ4s]&Omq<43/ v]uS) Hl.Ȝs2c*8r|a ^T:3RR~ >g3^pξ+8{4peiAR-;܋+0SC 8랑oJuAKFud>N(: e3n /7LNWCz> ] _;H杍+mVCtΔW:,;8lp.>?hv|E^nRi9ixHd7ؕ롔ч7![4(NhTvlv;q',2OpGi֤:ąqa?wFrBڕ \nXYH=3xבZ"µ Ӏm@JE;* f5 -q߅'|݇]݋GkDs -ná(ӣMW= WͳF|BZ)$ `-Yӯ_1PL_$H2QÓ|xQYt; ` ^w,,P =r"+^[GL@("0XuΖ"j9k3Ĝg*-x~\Ȃ*]}z@*Xˤ3h#J^OU_ ̒ 7 fڐ6uw94yH;8 ƏրxB |͸0ݢj`0O])4NB ť<^^?ml~GeM4^%Q^C?~ޢoxZAsTPCLOfSdn{g2=V\O|Ǐ[Jگg\=,6;>)_=ޞyݮ}x:z^6#ʼ%-U:Ku5C#nO/*}esM)m3 +R1L)C?Zi?oq0_ʧi=1u ހŞ|:now?\bi?o5n;mv#u裖 xFK^sN~ؾvs7~8qWkf FC|B&qv2JCfݿկުZD.zP5_|Q8L;TptI=ADHy>P"!Dh bi Mv_ta?/@IwM~*04ѷ@'*]۳?Gżf, w,$ҮE0f*H$Lqo_5[oXc!%ǃ+Z۰ӭzGv6L3S=%>GWh65{dO?~Of?0O_]]^xE7a mv 1єk7SW~ &z\GXVoz?;hwYOYv{*V'Q=w$y0%Wۭ3/?=½}{w6}(1>"GM<2Сyqqەi{]^̢İ\x9| k>][uUKkZ|ew]w ro}6 nѧUA$M?|| Pfz5y`\/C8\3 1 OyJF tn[]}HW7W"#ʇm!zӢ9H`j3ouI(IBa y :M?"%TTJXV" Th .kНʺӢ/?)-iͫ`46>6bFgBdMgT0\6yWS(7hgTЄ5YK {y7E-u U-k7(9XusܯC'[*$c)t;|e:+Yrz|zW^T%v&8Ǯ=3RSaN>=qzxdr#Tڲk %dzm{3ͳُ|VKu2xBK4x-ţВxMsDIBbKV@iᵄ@iEpV] FX;nX mW%#TL-۬lpȫsUW8EW C[|+mH-4% 9lJtlzYzCWYJ2ѧz2k,0tT{稢A(dԨkΡEҧUi-Q|Z`t@B3 k_餁fiji*jB ڝvQ aeU$,f,ry "%T\*⷏y$ܯym &\ʂS(%D>{ TV 8&W^7jV&9+]'lo(bT \ZWRi1WC;eP ʻ53E&dj;MX?#X)keYeh `z\\e/8^gnޚ}U\v9KZT;{WRx@t]  ڢڠo}DMı$J +SGh\Xhc! O4}*Nk=&ٳUVTX`+R*WZupdt-ue- I Q)]Ũ2;-߄)YGco7!k|;Griaڥ/mJk\<:ӊ&rz[ΙgEKUuqv[U-֚PR)nXKJZfʢX:w!&@ȕ߱x I-';7$XQeQsPoT.롥3'2S[u8rʘZJB[x4쵤ds1f<\=P5Ul:c'l}T'[Z]\;ya ڌoXE|%P(Ѷqj'(<+g mP_#Fy Fv5Fk'z|>`dk, OC4]4"D8UWS~LƜT u*X v&ЉUqf'*C18\ԯp3b\7םͫ%7ˤ*CU`_r89qLYc^uъ=<U2JwG<w8izU .$"LcHoM+Y>82Ž"%qczIV\iF_n<-WjՍAO=!d|/7_`p.$ Gҍr+_*q.:Fꅄ  2M\Z2BRy#R߬~ 5,ibvZb#58^&mv+eMuJ{Xy4ჷ[M D>&RlCdA$XB֤+&e!|Zr$M̵rTd_ z [iZ2))t(FP7A_8OG)i☳Cgȼ̉E<+3/\ ϘyEp x|,*mj-hƜ4PUvSl#7DvSX =*@vnL߸6&kNByHOM|61i yjؾ 1 \m\]\i@:4a ܲ}qWBy/"dBDPI4;`(%]MOJ-AD+B%>8#s뿊0+GW*K zN4Է_%uFGwgw*+'K?/Zl6A'WlTYԋeT>JY,IPFces}T^"H'g*ˬFYNsYrPR}0nzM`܊JVOH|$lB#+\Kv*lJ#* AHD53FksWlM5A(T 1NV9M(qE%S+U+m t Lo:yק% T8[\ \WKRrl{(d!b{r0Exk 3'raUBhQc hjB׎qm`}(B7a嘨x_cȂZ"AU[uC`HQL+^:\23  R0#j*ZUf#-Y1o_o ij3 Mx4U荃;9rXDzg\o DQJ&F-RƇZ/SuBó"(}ۣ"D!˒ z7KIKiڱO#kj`کw~ݣ;ك7GEm\XF%wiRgܕƼٶ6[}ܵɒ+adl|~+$/Un((F'>DDZa#e6-]t'RXb~{~<>S߉_ڗw!V\QOWaXH觋-ly<͗baTקFr^˕IeKk,ee)jB(I'Kߚ>RәdE`'==[tɫGo?K,sOHJжI[Y"X/N6-!u c}IkBa)*bz,a{z6'[u)3  ԺWyREC'!‘YeQ~MbfC޸xyrcr髈(.C.{~ԽzuaZn:%V]ZJbb l^ xf̭Ň,ƅ܍)$7UcO0+?JN'%|PUC!hU~Gqk 4U}>ZYD[ K/[^^gy}EEԟ3zM#+` &߸& ЎubNB;<[ʮc&Asn>@D/KUB@Pu&RpkE G6-*s*87-"`JfIm9d/ݚt[4MK4 Dj:U<\$kՍuM]a=}vV}d&/g bnr\aN4(w+{FOoZ}0>XW”)|0yL>=RR^vbdagNXΜ̡{RJ(RM[A+"C:2; RU2U~ I(M~IzТ(vK h R$t\XRK#(w!I2I̤W,yC,D$_9)Qӛ&U!_mIVGu?{=]{7ctwUJW˷Po_C|_ ̊XΑiI jڶ]7E֙]qȵd=Kt-]YU3_(eAPj~B~rbUErn,]3qt\9=QWẇ卫HЄ VfK|2{2X>2˿DА$tQw&z;h!EexBVðWP"ϘV"IF+soMrM nڤnuT{düԾYBǬGvq̒x:+;,PU<eZLyS*Q<4J*C4){v`s=3SgZI6FL ]|H zqTՓ̙m̭ͩ5Tvy)2K lb0 Z_*xO ͩD=cmq"͙F -}mCIzj+WP^\65@~{m۽vF ,.Ex0Nnf^63gT\zT i:Te#EŞXh^kkҿ*C ڵ99Uɍ T{֙vh*ғXYhͱLև>Drcc)ŲPGbTwcǺzbZNhy-/[?e7hN76ʸMg>hrwM']pD#x`Tp>6zYYX~n ڞ&W*՟:M*SܵP{#~3'̂Rm) \<]!}^4_;[BŅ'ei%!|ל Ei-B:xԓ9_-VtlxF7Wld9v>T >"+bֽy)UP Rz=EʞZ=/Vj}o2fY6{]ެbz=Xq1ȹqG}I7qB?ziʚ MtcyTl#^+NQ`@icq1yyM wы{,ko$GA?RI0~kP'Wsa?U=Ge['6ٸ; A=z;Y"+!HB%ݑt۹A:9jUU¦3];E5NE}8^+p^h13z&6sz-\%8, 5>EDqЎq'U֮OaQwP/}xUW/n@z)>5s6؁tq+i,2twDU;*7!SR[ ?<@TLf1Ƚ [;.߿yUY]?E +MLE |L(>&ʍ6Z,ˣ=!LeAs6RҗMI_&Je$ʭK+BLa1gsZlLneӈRuzݝκ;*TR>^+}Baۘq2܀{j#G[O^:$JWF~(;,۟^Ȃ"?"\T Uec\\iQa2A˨P29DF &c,o?YLSF9Ulpx J'0J4Uշbyq-:Ƹ?]S)231-kn4Z= K53PLj=:-#igSQI_fjQ,qvY-6u~fW㌅zJ> jXt:+]6.l>=ۀ?,Ve6IBb^kyB{D>Qz6bl=8gҜA:8k=QxV}n k 2wK= adnee >7/G^qDGSԳH_|6>lGnIǃSI]^K]Yx<-s\ kcn.1\%5]uTJe?w~CͬUm-5՞JN*csGJ~tH}%>; bٴk*lrֲMk٦5ݦU/2'B5#kZ돱ݚ: 1%UkUlrl=W巨.Ժ 3d}D+^y?aO0pmۖ^ݖޒLN<09""2@6 :IYS|Nb)QgRW@vTЫhW"/ɪ(e Li+V!\5K¤,eڳ+KUXڮUĭ5I<ke¸ϒ*VЁ tni?׌JCTsvJ.Tj W?sޠmoж7(7P 6! {xL Bx_/op[;̀(XM#$PI׳eRN\x>jd~<G-U$MާOŷLpBIPcZ,ʙzS]M?~?^pMm+Y'➟#ڤ(3h^ ,:7B\9'VIQ4L3!XV SϨݠm9PzBcJq;󱨮6j c]1mΪʴTǢڨ-<[|Y1 z|<@r=:HX-S[k))BQze2V3I @%+zp8OKm>] MrnKd_[\5/wO`y;ce;'w©NwYoVGυϦ;]^2g/bJvL~nK:+AF\Ԭu30rRS)Eό/xl,|,>7{RwS+<)q~?DCV^hX<7j}Do0|T%Yrm^Ibz=3Z@5Y66w{Zчf \7R򤨽YGAeC#( W@9-e#Su=NNh #|a:&L,zfDfYآY6j}o4ie-R ?ؑu~)Eόh,K4 A=z/,d^1/\P\Du6׸3F,,Xmjeo6JN"W WPza S=S(,9bY6&օR{#~Lı6 )>8U3R,n>#E=}oP HD"h|z;Oɢ> ~6MX JW= z$^i8 >wٚP8 u}KuZ̍ʟ daSXH|^')c)ypQ9^$mC7Dk2*EX0zzgN kI1D[PJ*NR/)ɤJN1Ced=_ϤnJjccQIm_ 9i m JA2idH%߫RtQ}'^;FjGTJUOPIiL]]#,qjvYW>F=ұL)EHšԓdZS`x2 Cc"EoaG$͡ } M&}TN]Q QꑜGٰ_$/RL%e莔De薔feG%OCPwv=bP.%~PG^GS堯,)]ya\%,Q+P%_FɆuW@r}Ez)8%eYx2S`A]]1+![di0yݯP ܤw<.I>gvIBu?:+PHPHmL,m4b~T*v#!u^2'r˓~hHHml,w=J gw{ znzTKZURzfDs6>aGby^Cg?WDJ*1GPI%/,."~m_.y\zJ>|TIgRI@\:EM̫8)3iHwv|!I\%RzfhDsh>6F͞br\凮"4P~Y)'RJRjbSJ_p߼IF]PW K~ *)c 1vyoL~Aҫ'&gK7PBskNY75Ud),]::tJY ^%+|ܥyN<ۀ bj&%xiĒK4BK2=aAluXh%M47I@pUat<8DVVU;h^!s!q|̦kQ7y] IqaG`>qXډ 621۾6Z:c @SƏ3+㤉AU6u1 GpԈau gjoUFgڥ6U;K~r#R(`"nA8&ezm}w{I G*Lɴn\Kfu<Hk,^"/6h@E"ÅנhtJGvz+U%1=wY̮S7J`;"oHd aSE EMebeۋax(WK{ h前&^E?hlgcD]ۊhh[x|hf6TTcN>•FKT+svPJ"hNk#{+?ch,󮁡Zg296}Rᝢ_! "(>\.Ohݴ ZԘR:nmymk1J:嶴vEq#1[X?u:..|l&q1 Rzug3k'p&O_p?>Nqa`SI-_p+)P9$3R[ZԖ!O]% WHy!v.nk[!YZ): FP ࢏9i8YF+ EFATɠn ^z>lN4W.{vWf K'^,*&{ܘX7LuYzK @ZW&IW/d}˙`vXϿ?n!T5oڤj,G,kNӽv>{d&B0KҭPX+ԹG{pu,41.#N9FjҮ8?ǻ LAsJ1]=1g'+ iy+PgI*/(-Qjxcz5sHnl,:*<r3E)ѷMՙI=.Q<^8W}˩R*tW~wxTvPש w -mt% &W,n}/w&y)#ΌHQa:ah:ͤ0>j'j}D!t/tnϑF/ztiPB(x|l8ut9:EeK{|l(G֑v%E+lW FZ:}{z]aGݖƈsMq&-B,tE(:K$_;ܟʌ<qLaVuPqØE~>(41,ZnKcA{SIdX/Ȍi G«av=sgcIJIb,cB0U7= Vw#PLQ쑘;_S7Gb@PvZ.t Mypbܹ؀ah6FK똵BSc[p""&jq cYl{OEHRN1 ZW7Ю!%d=#H*C2b07Z}ֻAY&UXjf1dܸL%01=,ud1 Iskex";TӛÁ'E` ̕_J/Ƚ}C^($=d7+b`,{B=>f5W8/]Kwsx3И,4qDS,uC*WCx>; 7ҋk4TX6S(AևWk [Hxͳt&ct|e>1EeTjᆬ{&hki= 'st`Gy IZ/צ(HxfDsկj&{4N$crOцwUm5#U4OTM4w>6҅kQ& x8p>ޥTG Hll 1̧eC% Y}u˺\,&=rQ=˘ eKj}DYs#=LJYH7˿4]hn̰ \C I.o I^10 (i3RE[n3S}r|/t6- "׽_9DD8Mؽ$]=_Տghht"0i@WY䚍,b2UYŝ*š:JG"FGx$̭g,>O1A]!9I{j7.sB45 Iuc7f YjY3ڪEqD`qCIO/<~^~1C'?\3mܧg:F/J}i^1z/ПLKәC uͯ1z"rG3Mw4wf-ӽg:HىQ3]skȆ;xg&칞bs1?LY }DKQ _נ=:pW80&L>W;gt!+A=6|{7\{lY0!7<}ꙞsУїgl!uo Zi+5C3ϋk{FcZk".odn6x#0~^pC&n5G4+H0E VMʍADtr&'stP{OI%EF-gs` 7˶-TiãJ3g8#kPi*jr=AKƁj3sxZoA=:i0.|虏P 4:xЩ &4Xx+(Zr"zL+h{@qPb"KB|dhuyi{M\o:eCǾGu\C31 bڍ cT)gk:(is,"}1kAlrZ= 5Rg>.c皩Խg1#㩫F1`>W[qL{};,txX0q>3Si^ -US֭{.t i3Lz=\΁3ə^x׋ ȕa'"F ܜcXmvV47јV*$5˖8Ѯ=Vk7|&"7'{*ҕ/Wf/+gu 3-dL1!C=ߜҲC<%4cE d%ym ҟFnי_hnl/J[aǭ{J;dg >\[vwsJ3߭F> tc}&/4ӺFsdL}jdkkjb{ϵk߇kictg>jjhQ9i]ḘdyAҢz[Sܡgx-˨\k?u]UGE4N~hZB ס*6]fkŚqh6~fV8=3yg ΀=sL8DDƉ2|f6(NǙٳp3s;g:3?n3z{bxiw/c{<zbbg{4|Ǐ=}^zƩy3q85\_hyj^~j,psӏP#im(\ňzʔkO֜~PH1lK4M$yW Z W7բ\=g{ڻu=*rl>LO%z虎_>7m>~GϵS =Qo}t<go_kw[cŽP|蹖Ts}O=c6km3õ4O&yʶ@M6cm|ɞ'Uc)y icϘԭ>S7?+c${NmɞgԽG5y!ky8Oc2w?_>W+5KxޒMZ| Ф"R a{'LlnpG684ȊI_C$?B8NU _h>+1$S1[cA;;zDS˲;v< SE(,BY=J̞F*ل獍?=xP3mdbHtY2Oj@$I4+8{ AKnD?"A ؍Imr*jg0sB~3R /85t̄sL\ud/I4'pucf3ʿ`&eZĐ OR3\4cT8 1NDajyɇ8@ApJEz:フS_RS]VK$?X$[9E ns/Xi,EI<\'a<}\4C ys7+)鯱qP]^]=)Z9 b௿r.fgdW_'CF1(쀦l c5/G%MDoOS 8OdIJ3*roVR_R]^.ۘGDX0C k>`F3+eSBb.Ld"1ә9D3,a63s$tf/q$MK07sm|ɿdI1EwCEǣLtl% Z\YT`d!|3T$SQ} OxeTnڐw=RU$q?۴3XyYĤdf!kf9;m*<'xqW q*ld.;+Y"{=  *>*#Be<9ہ\X暸_6SMlc=6T1B.hFT r-'_02t.b 7v فHⳭkڇ%3@TsR̵Ξ %$*?NeI;' d鼠QʌH,zyrqɭa//y\&$b|,00Vq`X_~fAm>lGx#"M-rO贩fϥAd1-a3/ge7̵݆:籂| >54o͓=@@23pY6 BLð4yes_8 #q72h.#Ô>/oXL!Z,~0\."zឭgdL~4{&y83 L#XhN:«)&q~tf/'MՋ1Y9?It G>/ JwjSYk 9e $+|t8Wx&ߐ~Y ea_ك">8-Vs:ms+DfC~a~!IrW?j1LPr0TE_I J/a]j~5'ZeDAۙ>rwCOs x9*K|xMy8@S9T^Ikb&} ħX6r7> ,kk/0/Lj%"U A`0TӯChYqZ×|$*es#r0AsFnm/=|yV$^gS.?_/d fΫ,z1l|GX hLͳ'lAUX̉a/91+j|+Uܡc5ۆȣ-}\T9"h'/ggp@6ؖzn(a |ЃLXRf'ȹ/`3SQC'L/2hh`:A ej[l-Lff8h{~`9fo\LPd`!Yp+c`O2=Z`4n8`vk8ڞmw=Т#2 -{l#{ Mus<L6sR꺤w겅W. g%,yCB̯ KX:YF[* ټCa),C̖CzgOii4I$`IS&{!H, ljr*S'{mMgDm;Ξ&veIײv}x¼NFQp!n:x|Z37HN=z Ǫy N;S Xgjj@詭/>73ld6 y Ipv[3'il rdR#U=XH8,[G~ :f`mB=LbivE2`~^V fRʄ)8t?*xѐ}@T.Le_Q!:r#e2>;2 m*WEf/*_UQQss[!=ZbEh=Gfq YˮkFL}bFq8$_t|/u4C.p&H4蓍Dc[eZs A(S^5yE ͂Cx0W#wPhtxkڊoĥKHyy:I(q gy.vZU}eEEH7t]r%l0'A1ӷ_Ԝ&\%E /a-\t 1,=QbY1,%r1C'<[*,S+q *}3+AHjP?APDiڞ0*Sbց{̟Ym*uV̩̰B,}aRYJ VB@嵂oBÇ\yϣ+wOxM n+TLq qKvi<lg >p7?@?Ҵ1 f!*uhZprc+-YY16p[yVl5z Iû@'jUtʞ>+,v$Uq1ϩ?9Q-]yJMe+g)#dS=@? OH 6aDڸ 48\qΤ0 sqv}zCEmǪkϩ7: 4G䏥`':7[@q;C_ # gL2>B_Q${ֶ GEe7?䛟Oϧ'>WG6Or7Ox)7Oy<}'l>q)7O}n>W';XVo^>o>>nqO||}|'||6ǯ.>}򉛗Oyg7;7?'~>6G9ԛO9'l>n>iu)m7Oto>6G99'>o>asO}O6WěOO'mԣؼ}w'}g)So>m>euק>DgO|}6G|'o~>a7?r'~>>в>~OyO=}'>v->o>esOO]}Tw7otI[}'ݼ}9ěO'n>LgD*"hmIupoG#j2 q+C:e wH utIgx.OG/نkD*?ޣ8 ?_(cVOU<㒱 }$/,iȨSP@:)/οn:rM7M_Wt/7[unS?J)ݦo7w|?mZiMnZio7iæϛ?ܴ?nZx?nj.tM67Y~?ߴ~UnZiaGYySUߥKnj+wq?/?p)O?ݔ/߭Z|?nZi7'JvSǛ?mJ)MoJ)7iݪ?o7e/Dw߯]wozwSMV]EK67i?4?m|?iݮw7\u]+~ҮO7˦wTqWU_6iM_f?NYn˦teM7ZI`3g4o;>]P|#Y_~ Cmؾ |>*_K9s܀+&ȋ: q`gz5_~p{~1%O fFQ7rV*5)kwa3"Xl+lO?E4<><>/d" ѲaUBG@*u !?*":b#<Ή=M@RJwkC%Vr!ז:;ZTϑYb?a5B?0 b) 9e'[; F}ʩcra~/dy2<}>Of'ϓdy2>tՙ`hNM©9y*uǔQջLL6:ve 8 LwV0cdFO0;} L(+(|= o-n|0pcRVZV% ݧ?0`?04/Hiw ')4!bbmTp.=Yq C::g(ppUm9}4ފvʷ`{ڨ+oUQڕC 9"P<: \ 5ރ8 <.8 <.8 /d!:(J@%@ȍ`͍:,eRBaL܋i)s& ҡ`.OOLHqa88a8OЭ?}#<"y0ga,-{͟vNSCņֆ O Ha' }i@' }i@?H;g$o^CV'M@)?΅Jf~ aT_!ZN5i#?7 r7$/^'պJi"EqdÌx`ݖ#l} 70CP8<5CP8<5CP'j҄6zA,J\+}Ov[r`|]YbҾC%"VBD})A%s >PAqi7  'sdIL{2[ [ؔiL,kk6(@? @?;L"QO xV"?GEᒣItJey}d8ѣ]`c{D^)qlUS֖g|MsXGѭ6{ν3\CZ jve+j`=iI%|=)̉(s*;hQ `> LP&އ wncsqLoCY)_$_K9xΉ>/:H9lqX;–y Ӧ+xSmwl4lH9H9H9H9H9S@X̲2yRYU]ayGJ,7KBS z E1PH2m0žB *m)`$CdyBS 'r9/zs̷-v~b_Ol?1Ol?1c'ًGQ'UU*I!o!jqy. # D ZeOEprn@pmC[]FY\fm*aB6Qdvy AIrWz/ߍRBvk Y[a"O̶tESģM6lwȷp7hnQFn&hnQDF&śhIFyM2d(Q܄|nY}&ģG~.ջ|Գt(nQGLay&|nQZ#z_R H& M@|M>r|7#&M> 7(䣰G~.APY$˚$$IH&!śTnRIHuf,*$Q&ZIIu.% Ie6ބ$6)lRRݤTVht&"m&xnQģG&xV(|M@򛀴' K7)R H& U@KlMBT6 nRIH&!IB*$՛v!)mBۄ|MHH&#UFTv l# Rfy=:AhUP#tUPLO|)ޑ@0i*13 rHdoEBcxcE]S|,Un$I+Nj#4o+;#".Ԯx'+Vg 0Yq!"|"L! Ӏoѷxmw~+jΝBgow}A/P} !Ӕ)63DۇYs96Tc*[ |N'mkV_7o7Zul p)\{-Ј."qډ^jsד+@q +G?zz4Mr6MIזeHqX9c`8L\TThlPܧ{ JO#%<{P cn47}O񴻁{<Oiwd V-+B|N]d{bWĻ;M,]THY Dv.00&}ίƏ?@OI)fJHyw?<_vз7&iʿ6=F 3-05)XJT5qZLTR) ?-z$ϖ Hڒ;Bh؍(vF3Qbgŵ\*UNZ(_q5LIw (0? idɕ0aBΊs+<ِJ1n1e@jk5.QqM_,8@!3D# -u+"ȪQAXj^z;Z!)#@J'U/CD5jm ď}Tݼw]d~T̏Q2?lQ3?L/C.ď((?zAV{e [qTb0AtYג-4QWR…M 2 R(♒l3RTg:#`!URUP2O4ϟ@fI 0H3x-CteIZ]PjܝP]*i>' d@Z:s*AVM& !Ē.sƒ1ŵr-Q8;|M9 =l--`5auI8N3JCP :rں)VF!T"qbW5"'gg47͸iMی> ?Kt F>ppQU2TY7w>`ihUAjRjULj:!#`N .V,5.Bmd#'9z@h͹&d0MNM~ϔ!gVa:DF9h$:*ݧFrmz f`4hFFUxbmP\³ omu3[RU1D UB&4gnTU߂=3D?`sʳIuEu'̌df$3#p$#b(cɏ姰N~ uc%hAP jhAׅ.gU4uj:ij3A dlt)دŖp'%8*]*J,d٫'B*V}] &hR[o0c3̘a 3~`aXJ9 Xpi,4Z jHj??T,*B#W;$s#ɢW`ԧ!A=O0F4>qpu_l4AzThMHDtқ@M 7# 2 u\2S2 N c'0QqOk4aIJӖB/8oC{0茣P;ay. 7f?YϺ_G]O5Az՛Qs{Mm+)X4vkPP=t{]aN/V;AD)WAg*I-wOeMe(S̕mibA᝔"SA ;JlbV:WȘ tKK'hUDS2Me+O*ƹsl%bQ*.D=+YϊxVij"~|(b`p̢h.ѫk0]ΉuoW0Nk?^dpjqFR5e`A(<@RyAZ6#|Xa'%fBe Q yf+aOXLqd;l@I lCV CГ"SO;PCa]/F~k = 3^s6yЭx֓#-V',xN[h^2TL"^r@v|˿CDU;@`)Qz~q_F N!mL+ZGI22p$J`"z(+kh'|Uz[QTdg+T GGoi^#G9"CRMYɰt¾W*#\ς}HC#K(T [G1Eb \CJ LB+4'5"b Eb_"6 T+AHwvlZVx؛H ?,z ]ba+eM&s0%]R#w,L I mIڦTǖ̘@*d %G )h\zzq*e2-0Q3K"LhrW@ĸ"Ju=3Zg" $.sC[Ň^Ԓ3аAbC#;anKI-# l#Fs`@2U7$%U-h/ቃD YZ}A ˏ0[ BH".(=HK H:YLڠC hE'^8ۄi; S{ ί4/E;K{$zJb}::~adh> BN68w E*@I#p@b( v U(~^{ Q00t V<&_S PJ(hI/AUt/Ђi.ZAGR;etW~qm0$%%yDIRf,ù2uF&fy` i,ԭF  ºxs<.l:_@n 8x9IF6-tS]OM~ZT ,5lkH$4 cQ] @ՠXdXTܥ4cI1C%F%~甪 W~n0a|'U39f EY!L&4&u$h#~LKH )Lf |V`u+ Sɖo )omIkPV ިPIbG,@]aKUo>:<a H6KD׭fMjSDa&#b$^Euk-C`pI@(gIH =%:/:%# ^|8}Q$3"fn-\…Z&~ ( A5 (\ID7*l`C+80!CT)~((8JZxƠYb}MBj;[/ϮiWi+Zqϗ8mrhVXp>Pk+9+4'&3~,[X8OjCm2y4???D^VxѶ>(ϙI¼l3Ƀ6F-m6ph) -tfbZ]ZPW 'tJPZU8|htnj2 &rEy 'H[-(,PpHǠO`PDK$#w%oh#,hXyɢ53Uu?֐ =BUQuMl E=#WUxBFWU!@$bv9 w4t842kpZ`ex+0<|UI9r{VU&ք휠N3Oؖ`M,eiZ :Xs@ PTy_f٠S%U#StlhϨ!mdF f,YEժB쿏A4yjOM?%,7tơs WK!^m0;2? eY !sGWICgn N ~, 7LtYwJ# <- *:$Z ^wPSBB_d*X ’cUgZ/eB0>C`Dr׎],^P i18Nh])g] A[ExjD[$Ca_QTK r!5)5JG_ٗ0`O笐dJ?+0faA!)4+8.cFS@x Wj:oaOb)%ձٺhR#Ax2h2`J1VQbk}Ay r͒%F@#T6B "%ɍ(ďtrXkE#&UKCzjKrf\prWT2(7)NXp !WXSjD;\&M fXߠm9P Y0.(jUo)ԝuڊ9Ml.@ciĒ J;"Ώ2djPjϤ >\'d'2PtsSZpسjAE!z!t1hlwd<+FvػF :3c2 FjuDK8*HaGS^RbSLr^4r>;2wt p0Й&魣G(UY4ֆBY!ܢLV}X39*q/CX :)&˖C= qOҮlc)Qg,dJ`!%9l˰~dD#{h P]؃Gn(nX,z,{,m;,ߤ%Z.,xz\:~:%8d8K w`5` W;W*4wWh^ZHgɍ+Z;—W}Rr)֎^qKvձOKX;~U:HI 7zRj*7Hio{á|KPDI 3pTQΠ``|΋vL/Qx׎;=q筧^}YrgkY^z)O~??a߳lk^s~O7]zL.<e+5]Xoh2eZwr⑽z.Į_ YeK W*.g*yF/V nRo߮ww2O}u,^z0*p@dpesF֧C8k3SWS/Z>s=ﶋ>z__C,f9Ku>](RR*Quݱ?=!n !3\Y\wױPJpn_Sk_\= }慿tӎ_WW_Z>OTEFA>?Xi9K5Ѳ&OFhDYy'W5Y.-z}{ʘ֞Ż_ Gwtӕuf&tU_~={.}_q顧^ pkuW֙S2qwGnyxͻ/oy·~Wݻsş|h• eftL:}{sǟKOٳ;wsZX'3S'a"{'4_uǯo51EUL+$>FظtʨjUh.;w>x#NJo_ήŇ>{nB\ZDKQ{M#h'7P?|ϹP__;/؛w->kW-y;L^w`W C7xq6AYQ)?bS{+98dUf4r׌G}/_OoP( Õyxȑ]v?y{Ϗ./]B%$!FG) %j[+TY?H:WL7W;Whds5ʄ+R]Ff*ς{O݋9ZTtՙzIfoޱC.~s 9dqH$KʞDSŸj2ɨ2C>~4%EvYSF-%Aw* ()ĪM mO烋~;I_d=|5̜R4P]z*7IgR=iyy˥zjl6[H=;ccօIjU F{[8o2;0$cPFN532n 6Yǡ`%7z~Nx?+`F0R&83S30NdH)m gHu) V\Wɭ:Ëcvg):]5¾_3/gD5g ^!!I4; Aߖ>?eiаKЮRbX,Rclq[0RS0zN(TVEuDٞ;]޶]{#Fm gILoGg+ҚCJV1yolZز 똰-ǘ֎Kiٰ Nt#y8 7:sM&Ec B\lN~6K(;XH>L!!;nv_m")H(n0}ǃTv&h3ltn3 c)7wa/"ЮehF!#gK|2ԷzXx>֪1j(qNO9aW0 nIg2Tc޵9eyo?)#J4F3)>=KeĈN@tmdX1ؼK *+9yDn'(i7M;!zl5~;1 (:>m8--8f OFR0[f_e%FpBVG\V:WkٜW1e9m%a tyCGk]Xe1 0lQ>6=4J0"s('"W x'DkPt6}N"lY'ͯpM|ecdU(fKVR_Xo/"\h4iVx/K>qOq-i\Joi>r@iSv]|ji̫':\X\BRRKXT*!;ƿ7ɷlTrɕjFUjw |o}˯xv7o_yqkBӧ3sѧ<]hzQ{ﺿxc~>?5᝻2w^k㽻/:VjZ$Ъy={ʛ߽щ+{.]|ySQ>S^Emc(oD_=uwYo]}%o[cY[h'>S[ev?OE{%޸{{]{k-[Z-XNWN*H(_]g^{sRFadw+ewʞUZ?q Swo^w8kPܻӢ]k+ l%,`Qv+1BDLm}Ϗ`(+*Uj[Y_Y\Jm=8tFtBUQ%L'%4Փ Kajeo^@tْ< -Е_ο,b]aT$QdT53/=md~grk}YBlrВ]57N9ɤ\ 23Ǫ|I]om:RlE 6Pc,!16fna3/Ȍ]!uG.-1~|:-"/eN2{+h#-{kvBQf"7Gra^YOлu|~<]p,k3dN 9fRLr+f͎EGln{}|dfse0q/Sꠙ7)|3Z'bh р7ʔ呢fB<0,0|֩8?zB f0Y MQ,SȠ8&׍ee$@Ad3lOqc, @fL"`{8Y;HڑT,"69J\9ƌ4:2|lJᱟL ibWo>x<aogeRVmRE$j&i\_HJLpwY!d3&CJӢgTVH䛆x3Sw/IW ͬPf^#Ocn/TnHOƴ5'gSO)ikp `I]ɝ3כxxJw`*yVGAiG03-Jicl't&W4J K@iv0)j1y{kD`:Íd1G؎-|`TbFӲk0*6&XAw+$ ("ci@,g<#ST cXcE[B$ (%6.PzWzJF4U2ꡳ#پF cNȵ|G21Vʼa \A7f+viYqT\CkMڏ .IfCJ0َ~zZ@-{J:&Øن9b6LM1oMA *0I^莣>tD#;vwnu-엫*~u٢nу*q )5[nPrG[8cG_L`{L>rMLtq_ʱcdĦm}k"]eSOE//FM_C SmaP Q󟞋 bTEyXXs 1iJj+l+ٯ .nԒY5u dEiV6h!c⋉I*7d\tGk=ׁck;_I==Wab !oxCOҥ* lm)ߓ 0ƢU8myh71ajf_ZXcz o$;zMm-5}I[ xS'>ri dN$yƌ߱s#imOy][%#k%*?29wZW.2hmZxåزZE 9YGjֺ!3YX֘Ykg 轉:[pJX׆AضmL^ Ԛg}]QX Ӻ1!L^.O6M+b"I (GצcB`֝J^eٱ`}XS¤2VnU 5ն1zQ?$PK g~L+>t'SxkYd9;m;kN49 D VIhSødVspcRZX FYц+l0 %a^ MפNM19O5;\OrQWcVjڮoe]#`7V`Ev~7L?..7-7eyΛc'a.dfΗ1Uv<ԗ;sıq@ۿRz Vv$J?l8j`>%#SPcؙl[`.ESG']blL d@pTrZiiX:6B #A;O<"J'1C1lcaݣ~i;Ҋ R^JOendstream endobj 48 0 obj 94837 endobj 62 0 obj <> stream xY9~W+Kme%{V>k,b^%߿JEqo`QSzgɁEkJ(n +szdB;#X,RhO|3 ,BmYXX-찭Kް}o%_c[,ٱջg{-|\3X;X0v>V|/8vc9o.<[%N4x}d7V"uƇ=?VXʠ4-gQ+N&CjYZes7v7 J+y9[[! CGɉ?%νcd7+y)d%H wYA)(~\nlK,p5?Ѓ6:$=a{-b{A) r͏6~LtvU'=*~|}\}׍`RSWAU:d i†NRȡIUt-!`PRn%zS_I;z}I霖xQ- P`Zvc:ullD}N8FduGԒX2˼n.FgE) X#3£ccx{aɘY78'8dͣy>7x}՜dz=GF,8 #!8dG% xyAq{ǡZ;-积cSGl6sxxGDũG5,W,ٚiNsu-'3(i,zeń ^?/VsIlQ2i1QK,_AQe0{d4ۼh!rl96m nW2%cnKݭB9GJA!.X8O":(_{5\n0%Ì8tXL0< ..yaf/&<8  V v( J prlxMpGSۀmCSEk^3Dq(%.U7t;;ةʒѽPA-jpJhZk鎦9 .^j*e;L5mfñaXdEq!¡.4vᦝK xa3;HeR)>)W)̙(A{,.oqZw?$  \X7LYt9Ytv 7?n45fL}(2wt4alVJ`>9]>؊b9Bz] SE,a$_Z #ƫ )P 0ռO=`ܠ?7p e,*Gw.o VÞPtm->qC]Ն|Cc aGG3ڢ$yD9z>ЬgPV+ ? 4p"]漩Vf 7UR&W]mdf2=nM/[NHgIc "cۮȨc=p u`|B RO!i09=ߙß}$84C9z˒+wxp"0p~Gxp}G=\w;mY 6 P}3j,`G10z2eqp)ewA"gf E*j mEjWCR,K]#^\x|V+ϕ@c˽ ms哿V^+}9W>+_ݽn+8^p9Zl'~{p> dp>E 4 F /:<L/A+ד"B\d,KΉcO Q[e!p-*;a]&1,Z {iPwEY"{c@Fhك}V~H_=h47@T=%$kpl@Xd;nzDʩ["b)bKJZdT#2 3.TQbc;uZ EƎ+u,MfXr4"Ck N m](t<֡dtz,tp*ĶtGRIqT-y@HH!V6N=iRRuԱZGƐʀY %4͚rZ b9&H 9\ 8n(1*h1hŖ]Q)$%skM/_#g*Xӈ.1,F]S>'q ~ΐy$9A"b2{zva-̱+NvU]˶TR[\%)v4I}`QC ߩihKSqwܧ[Տ\8a16/y ˑ"* *LK,SEnnpƄ 3 :Ԑ>=EjGnD$5a'MƸ1g0ԢHen9+:V9k,m&Hz9i1)~朌v1I)L"j4XL /@/ mq!W#9lxqֳ?19ĉP |]EM~O*یԒVCs MDgTj٩JJd~xMjes: ?N"8_3LY- -* 'nRv~|&m Fl 6]At.Ȱ<\ Ğ8a] 90(¶_z{uXP7;|;Fu-.whAEԪ+T/C5^P̓6GFZdd(WsawWI`̺~f(h%A`#{ƷlDžlZJG~5i`pUNUmremqA[ 7qhsX%OPD5`(:vjmZ\lT`c +60̆ 8'E.(&54,L2buo+~~Q (}@ ELZuؗa`()fQlA`5G Pu-Eo)k,8so#"V]:qt؋륁4n>Oxσ ccYRcqWqtGDXx Ghk>Fs g¡>N<ڡjouZ%yǩM Y`3IdOG=Tͯ^d1]a˝%AZ-H}Γtmxs^.J +QT~e:-gU{g /@ tq{{}#J}d1pd5K(hK7wB=fGDu&m諞}ģq%98Á.=[ Z6^ft&xS\>?$'zuq¯?56mKKݣ&k*P᪩pȽӭ3oa^8 j:T^k'$"}6 >I|tTE]c}<&h~vޖR n[}c]"m#A-BTMVTO-pKOUޢ?E/[vzμ)BldoĮYJ-Livx+QWOP.s5LUd.gS}ЫO >5cٟж[jQƪTC1%6"/l'®QEe0^i h3߅®aerQ9z%M4d a.iT |ꍣ䀝G@ҁ1u{GPFf,DnQ#ab+6P#taXf}&>/4'tcݷgI[-RGs齪ʳL|38/8um5Y@ zސ/sz-/tzzp.Е=a naz,pGȸǍޠ#~ԟU5=6Cge,xo<{н=Nؠ_k<ÄA(R6XQT.Z$GAto_yi 'SǨӕQϧ y})RqPmLaחGJc QMl&Y:BNZh&v[V߲Hl 93i6 =ZlDU$MK (Np}x 8#2׆MSmʚ; 2(|n+0Bpbgwgp6"Ѳ8\xŰ3jlAQDGŢʼQ3ŅL'MlAs[]^H),@I/).[yr>oa0R#BGLeGXCrGXn7j84" ŬЌB&J2fG]xzk-3ejK",AfLD ˪c(@'8xE-m,,f(Z%YwIo&ik}_uwo{fJsys{ɠ6aG bx-HEtъD(O1saVϺ]\?O^d 3oH9.dM %~y>NlbY1= ujŒ%3މCZhjWe)M}TRR !X\.Q*u\=G| Y<'ԭFޞof% -e)ܬE"jX6e;؍y!W aPp+QM< NH,kB_DԁXR '܀b%J>cJuJǪIqXy \Q3ǫgF-qVǦۺw'^Jx“_^r'a_\KLQ+Cȍ.c ebR˘VcFh7Mf%9ݦk"26*A:?sy ;'$$;!yЮUU$y(Dw5[eqzdOvQe>]+t;}pBXs6#;[c10d~fWv=i+_p22b7r &ƾj3}v]#m(9ɷB%rm>ϒ*tYLW%\.[MQ+wV5`7vp%F8d3Ү( IxC^Jmj[xo7IK#kĪQS2Fv$hxU9x+H2Qo2uFԛLU#<254hED1}~MLXvmH"i/2yQ2=+sR˦[IfJiWWlG3ѺR)J࿞.3aKM9lō\3a%ber8xS !;- Η no2828&|M{&%ѯ]55K-(#יn RsqX?I[hE"t'KI'S&N IoPjSi[D3{f.݄6ՠڣp]9j)N/inO|RO8^<>.~###hho<<MKЛ^.x $$L>&L]rޘ#Lʿ'H7Xb~27>1|2]}yozxOMnbnbNы|%gi&eӿu>, z-t֗4@U%^fdьax4Ǔw?9{Z[[oc_fe3u\|tV,fL_ҙ:,yFڙΊ;ެgxeڡ{EӰ`<gJ9siϒC-ꢚpNs$3s¹#7d]#;PF!9 f-_V9O&TDx$y}D81|$d }b'kT#h)HR"ܕT1?՘qZ8#;&@xTYDfTC3*9deA}][8S|hZ4W) hF|s=tۋ8j%{F7zY2~^~^) l:pKlf~% 4vju(<>5x(pWң>Şvryg-kP`DOS{wvJ.AAMrc h4rm,:כ]Oo.omu#h#y#F II5E卤I]$HtIt~;4 o$OסiMSK HlY+HzFYH}1$jfqϖζ"v+q-3U@CW`F}o*j{~<}? hr$l9-wS8!dĘh.`xMX!Z(X@{|k;'m?,my8 /h!CښdžIejUF{As|o ,m0“>4i,t3UE +ⴇi*3`d4b0Yb_M?SkݔY34SW=3!!m40ОH!1 C4,OJSBfVi|@Y3ch*<|ޝe >K.(.|ov@{hϾفVѳL<{elܱOL^HsP(ʩKbAO㜄 Լ(:oc{T$_9FOIhO) ۛ((d 9.Y8㒅~?NCop * [S吃[#oBBvqq r v f>7@x.FԤ 41Ϸ[/uH{#9;F͍8@ VT0h ul9=4ιn[o 1x;ysUa错Mf]fKd7./aOkyGu`J)wW3!paKweU9ݽ PmsC2淵k>cZ@B?`,]g6mu騭FWMLZ\ϦUvS.)ɓMB3U O B/!kNƠ*`̂0 oi 'Gh`%xK6M2B_ǀOsf1h8b ͛?{`@&dĿ+@erRW: #屰d` |EI4K#⎩nv5Q#iUZ0D=+ݸ 53Kxp3'{`j5pb~'I9)NO~;oL3 ~'RguHx7*nc&ۗB< ox:r?̈AJ\;6Nx<]e&C76Jca[j $ ^ŮHQ3.{:aGx MǗMO:yM0r JYnnЮ.=zvOw 1O8n)\p[F'\f(lJ34a=<̑Hy.Gkjͷh^h|]X@ KJfT.T(9,>XTEz^ b,u'5F*7`إ]g-[mD; Ok^{qj>63c{ZLãwSil?z>f} S ! 3i-I6X2戮JYƄQfǸݩ_baz,SsrzOA : s йsR%-h'.w󥹹ԙfd&Ki b]jʡ` gSxצ~XMVqlqeZ`;Sn/nkIf!Wb8{un}Ez_+.VR:=ջŌa1'm;S{767&跔o՜p.>{m% JȈؒnsG&_`?^t +HDSkǧFB5.0^BasOfwPCOxb0Yl5/ڜֹgnX\f;2Vtb}YPTlBqTŵXGݓC+=4f\:':iʈYaAk=Qn1Oޓ#Y~žQc_ό$&N6ݩ%l]zqͳXvy؏ DYa'3tbv0^Wi\e?ɲVa- FN(+dniR_󬶝D~EZ~J|a dl0鱾wΘTHo8n{PPy=OLtvƲa'x}4.資rŤ+jbWl&+1kM ZtΪ]/do9W*t?yQg<n̪Ѿp~!l ЛJ C;*4rǝ݀Svshm}s) 6q5;R;ؖ|PLt2_"4gSZ8f oAV ;f2#sp63^Σ_M*э&h d"I^ Jo"Dh!2"!z _]D0wٓAuWd`%f&"*7@oQ~LӾ߿W u>n[Az\W rJ>HLƮN) j)i XR&HNJOJV0J!9P} ~(OEjl_ɹ.pƺ&XI I?|*fW;'m'~]?(ql_Tp=s5gpYh眕{5g횳6g$,F+3gEEKk$ 6b:m͍)6[;So3Ĩ)86!=ؔuXMMm`ԫ,ڔhmꭅIY܉rhM 2bh5n> >zi WZ.Vlv͠5r5yn6G55TkԢ+2=%%ٳDObpT8 E*Xd+k![ &75vj6y0AD|w4*-VVK%=$U(/˂ϻ4F*fboU0zK q: Lį wHY^]C""ONo<(WHQѪ+ou;}Xtڝl$|DӬasC`W-^h~1 MfG73XIemdF|7wv,r44 nchh+D[buvplr޻C}%׹-Q 30S(W.{G:K|#|!IJ"HO"4zGӈ`_MjpK#%F} b?;{}~Br Zde.Cl\ZS_5b8|)pʏ9YFd%by/O S\"%{-q1Un<`=Y;1x{ʞ 'eNf,y5pاvWP#<(+`1^1K|K3Hc2hs3>~Z>$p1ɼ6K|˸t68)i*+%l7J@b:$zlH0$~gWg.4N:{YdTX-C7 D:ٺ(Y SHoyZ%7uVP-8hq)tfh6z[٣oXqGgjUJW[7C@quQYهqaq6gg{@v*CX";H퐟м@J 7[4爻 7u,9 ?Xߔ]Otkjҿ~b%ԭ'|+,z7jzo2L(`өhi|%"%v8Rc Lxe#p SQ&lpk%<8DžJ^e==6sG'nDSK8}^&(A=Tm?̝GɁbu}Hv5A]Ӈz:Lz[bUK>ϒfn405Ѩ*Ot%gIn>ئd]&FAS{ϻ ]eBM zՒG|?n<MqH'hhxa4PP-H^,K^A0KZ 'ϖ'DQ}Q̰$[@r䍅k>l./,Ŧd8Msʹ8`(y}WRZc 9ԧKTP7(F6;FkMQF4uJFa:bQLF183S޿TQ=ma~=.p'k, |pY{*7IAo6׋vwCɋ/-zRbȢ,ڭrA+4>Ԓo=,kT4FXCz EuҢi9Hױ=\5;9.{X3yoXE)tJ@ta65z*/}T׮!;VGEۯH}DN/RBS % O} !@RYJoӳ]$ۂ~ll F;|5 1  } x{G0űg9~s;8D)2I5Dʢ->Ifl.=r1\*Tꬅn!9z`(C*zJ Z07  K `қXHn\G%=2U^"3VlR9GȜgLFd.mhpwzS'% _8 R|%^/ٿK^Y{e_Q :GcC4k\M@WSPaIlAHfbS9:2zR59rt Wc1!aFnyn8*SIdbk:#s˫l*,W"⥳I<(LJQo ^/_تS)MU`HUv7ÌX]֔ 1^GM\:ezeA klezLs2v^ISY#>)s&<=!~p}{w$oYN+Qw>vn΄$6ЯQܴ*ł!Yy FM*U̴n30*L OPg[Ga]!~1Kkt!p  ,̒E- zZXIqNXȮn |͂URw7e'$Һ0%]S#`oe _ff>^u:^|>@e,5Kp{=*i`*.˹8m7( wSГG<1u?&?)`qOw&RœdyrLm#ՠ==zz}Ya/La>ҝ`)T O{oMBe"j:kl6K%d5:ijקVkX*[4EA 6tES;h챨 nK1>CLpovmpn#EGA4{j` nkۺ.Vp&9WIkVΦ . If)㑂N]tp~PpLkv5;fGٶw't*d1;C:=jЉȍveUU;h2{ p;oeDP|S !ΚGj;_+o(\($ω8} ؊]k{:O͋&70 y/pPBƂaXҔ8ȴȶu qE|>IᎀAU+s/D | IZHUAKpA?tv4Ft@٠}XOnˠwܤSu6,/S2#e/70pu(9x~A{[vA8`-w<󴅻9ΐ K{%=0G{opx5d_S\L+E?5WBqa C(nŶ/|c !CE%k{T S" 9?o0 U |[@K*K_9lprJᮔנ־Ziy[zx "V.8 FY߭p}kOH0"$ ۞PBZtV#z#=a> FӝB/bQٶ\aDG!Zd=X&S8-~y1 +yjS۱LEyS%wn5e7U5Uaf=ZBkՠQ B^,Bnk!m= BNp>HElǴp74`3aFMj5iI7݉0.具+B\.|[As[KDe.-jW=A͝ in1-53{A5d&lTFgY4(P#Of0voss),t(Y#NJ憶y>jr '-kzT7L,NF x@kqP&i RNSnf3C2wI&j3uZd8g ~_qꬹ^#P!2s8*Z$Bɛ .WJ0Ǻy!9)*WHym5D5jsGNl٢w@ݫCLG$CVs5z )|V&r7snXFpw}ǰGj^;ʽ\wmŅGݫE^W/;l޸»RԻ&RJl7,UyC._{jWG8Y"6\gEtR[g=őG nsb uK;vtYkeΕUBjp 5&–u5W qmѠ>^ lV&-`Y ݯΤ՜Kf>|*(t[Y%"I18UMPuq &<{#LX% #`€Pr s0IfkFD~&Ѯ1:t"#Ž1f:E5L0V(3A:a֢s\p,o5(~B8(oQ/52En1c@l!p_0s`Lw*gLf jHޢ}}UF^ YL9bFF1ztH [-U]=k q8o7&v{ `N83AI um'P{ Q񌺽Ő-2fFJv,8$`nIǾ&beբXy1<]1D u85Z$:p `a9N0a5*%tjm-:YyB08-lpQ## ޡ { uՂ֬`>^]cts"bp֢D1:ۗrm NPn-4< !0Pnս@;liX .MDН FG4qA"oL\%ӃUW\urUW).!W@'ISCVdbN<`(I)ǣFz`p­BnLwZdfYj&S[p~UíCf̥3؄j³&|NSāiPh~ؿ ynը8Yp)o쩶5*|7S+9ܱD5XVcVoY( Z+ɶc(fom-ß5-GZNHQd&R䎔tYn6_D(1njXeg;wQw( .wz /#"i.q9Db@h LaJ7Žbnpg Fh5\p=d 07#IgDݑ<؞p=Z4 V -%̕i-{Pm|Gbְmp]4[Tw.<_[UYL^kɜբ~;0?1p9ݿ}E&8d`Qh ATӚeJpJۈj_u)y5#F0O8 6}6hqu- ɚ40Ɠ o6!Bꐿ=Dž/}4EJx%f,@2 ߶6fllϙ`j<8)yf%E%_ X P/fg3VGMŪPj%OփZŵO[\H|5::` JL'%oW&zz}m}*Ak=h7,6tL/ѭ^ۃZi!f1Ak=h~>N-U/jݯG &1so_gX'$X,pggl^5|z=i%m|xr'Ik=i-% [xx9NLeC3׵5\# ޳޶9z-~5[r puLu9Lgu~D}X|l8K[,|;FԳxsPQV/)džWY9kYKoY>vl*#$D56% FAk[Ak)(Ե<d*9!2f%B\^/Z{^>nUS_q Ek ֜'S;^F۲h#Ik eJq~TIPS3kъNA! iͤp] f],c5 | AlL)ot جFrz!+e\,kD{3yyxL|q8S2>fP\9D3sfŕct~:y(9A Ksqsss ޟZ#ɢ`FpFr$Yq fr)׹yD:\,E ljy6k|x&XsE&컩tY f:nh}{k"H2!@Da K.Hj֢;=4ǹ[aHXy~NTc>m#06LjsJxNO"CMlƧFfC)-Pz݈]-J_nwj bJܧr}l 7אC=:4eaA7uj :(=4BCpOQ^"C32שa0ai2srYOy*a,CNAedC3%44mݠ -~jt qlѯMkTcjQ Seogl="]QbTM 9C Wkn UTz!X v<5 Y3~ žfrmۜLFK\?{vC ƄНVgw`y:O r>4h}D9V~eq|]#24"q/~k@Y7gQQjHU6Ă|#b? -%Q/?[G@*SE*&42s ϐ( L%榹Ҡo>gSx?tnz ؼ*6obؼyؼ&6~`L7O-;ĔSV0W`WT-oq;E*\-j-5W|cޣ]7XOxJګ^DScH<=4?)|jH"vrKgvLW._3t-VkL1NwE~Zl”&t>zTo`骱"Aמ3Vm1VmS{![GqjWeq& Z˵Ԯv8q_S;Zb\M̹ΩSSݮ--ٵoQURÜGS j׵P%YDQ?-$S$sڕdQY)WfjgRJ5u+b3O^-Δjj1u=VJWJ3ߓ;JqZLi(71Rl7d&q!m s6(aZ0xN JiZRr2VwVڼygH|[ozRKoT})֋Hv*rfs7rzugܦ8)- Q0 0#E <ށ&3k4W  XUN[ Zq 0h W sJ`ciSw7i)C̼lO yWc yx =EFe.ښExK9rGeAסŇZOa}Z lv*HUⴲT^zv ּ'{zLkDfP`JyH+oh`0B%xC7]LA]׼/5[uZ4y^i΂ -sj N>3iJ(uq j4Qz]/^*.oFz}]7yxY#-ia*0VzQj\1joh;5j!vhYu^8L AZТ_{TfsSaMSh1Z gTϋ=W8B:SSl1K[!aZ~L,#^d-!ASe8lS]$P  NM:W $s%VL՛H7nj])y]#rSMupSj _Ƞg}AWrPIfD1k#0TO!&'PaWulo}5-2G@1+*!󺄙4`HO1ia?̏{wx\Mg*V]*r/b򋡚bʛb$J.ܗ25rSN"nߦUA?wߝuM^/pO0W8="Mb X-#԰!!P'6Ȉڨ nix=5$0+6]LKoi`Wm 5>-q$@MgXbK JO캲N3Ծ&+L/`NL_4'xک!W%,tϫ+X:ShgȜrZ @Fn!Ukod 3вHNw1Qa6ZO bEykh1”qr~{,Q5Nd2{Zu}˜LԌYq۵8uZE9\b_pQN:u)j.uޣ D>LiXkCᡜn8确5;Vh}ܱ-wŮoBq>lm;#Cm:lRq+qpRrOs |< u<*$W0{mKGrKbM;h!d鏳 h@PCӹ0P!(+67=0p%5<$4ih@L-WL异 n=-+El^zO'H]X2FUWTy* ).-Ll!<ТkbI4|ߋ7 1q1z 7mr|Zl7x{8609iXa'reϫE_qjYQrR8:H+s۳ J5~ =.[~$}.2G!MFFywhN< Tj vRWƕخĚwpqD?Ip%Ӣ(Zk*kӒ[8a+Eţ,))v"h+v\y0Nʵɋ2>Z\LHLH3;u $?bvkAHzV.ebg]BR L #ure2 3-ŬӢL[1+k8b+9-K}b'û2A!*}3 "[M0"SM뤸b)X Z!(~0byc({$ TmR~?gϹLq* 'ҡk[&E=ċnǛ‡T2cC`.s (]DZeu1{> 69ѥ61ݼjkۈB|_.Pv v3x&ŎA7a!$(BPQԙ C.4aвOXKI Z'G47mDok-K ķV9; 7ў5mwfك kQ{p0aXARQZ N -%Th!xi[&߀NDТɹk8,ء -$5꼿aݢ kxZݜlyxZd|jPt?t]ifrj'V-:juz͸;qj$>NOU Ɩ4S҅Z s$aOF[h-ku\sk[}6?+e>9W#뇦zGv2XA`N/^8|c|4g<.o!j0i`;)=ܩK=5t[qM&{L޴&ɲ"xXwr=LHԨ-i=ԯִ)M_q Ů U-NMr F~0hX~er\ hZy^S2$ְ0Hۓw0:0MPn7VZ /L0@c\CC^Z4yI1 5(}jb !K5JLް#K M10~c'3tV¨u)u0~WծJpg,LK>,B:5/y,Ө"q6udƛB̙e ̕ݨжᔲqexf )^WP꣍S@+"jc3ce|s%x6> ۓ[nL:i,!Iln޲W_VBD>ܳ|نYYgTљDnvcz% # .vxA8tS. %49іN? l@4Nn /M2tp FE6\(e^L/ J` 16n`21I܂bL`"#`SJ% 6z ֠e`l@´IbmMz= -E&KgXnRd{i=nijb-@ ^#~ҥB|XТMAј)%R޻ETl ݇'NRQO"{N {Z$f{}jkT&Մq 5/p--Z4qǘLo#LlQD5랪,C{)쩊 R64)3}̫6kPuF^l7)O$Yp>-a;z6I59v=6Tc7ټF45:FԠ w{^^Wv C%Մ=a>sRt^,euT0oZWC뱆?w B C-]-X3꫅wzӤ"]:;-=nShdÔ-0Vv]THgS!LjNYO @ 4K-5_`R$-K0-{42Z>YI2</L #o(q9rX3kסܒiFBU:t5CtV3 Zs3 mxL"0y֙\[8%ʙ4dd_D;C(ءd&3I!IYj:6A6'܅Y7T~Qf @QӖU]4L,Dbl-4M=2@7ZY==33T#BUN ~4+t8ƂG1{7o!@F/Iwy臭o?|:%_׫׳}Q#{|Z5yz|=j~sok|=k<|VJ0>f[iX-R;k@'l;]? `cc~E0j1a.Qc[ul{S_i2tBc{X^n{UA}߬xDE2_F#-wEq󃱏?#Ib8՗tfW ujkSếY a73m:9޳f=?K aNL#w)ԘvH"s?kiSC-'5Z 5rchs[̇G ORv0S TX_X']Anғ/4x cQns/,smaI m:IeRи0!SȠ'8'Fxh ^ٙ~伲(b۠b`C9w=P!kNG'לa1-0QߣN=ߖ q2M8ɵUIC3̉ɭvg9m!񐧁x墺l>Dې[#0߰W΃p: إ߅ƍ^F~8%kK >请YcJݮE9n͒/pF;#EФ^B#2Yasd#L=33"oD@X'f$A+S6á(¼ ?&a8=OIo 5ߺ[7秪0T<1ҋrĉkSSф.Oq~wEw#vԩW Oz5N #4bLvq8jqi7E$N$fFrĉ؂ԇNrĉ=]4䉫E5ҳ`D~G^׿5Q&ͳ^C2iM3aLXTOQ8hJ'5b'ൾ&M\V08UqPGk|Z0e(N'`=-Lh-Q9AOf!bŽoM;NC¡K=xE&Q~´qTu_ jEQS5ʖlL(5^sU+iYzZ$y9ρ(S&P9`mP׵GP\>#j#vV㑶O5~c0HDzjU60~}#2/h<D:$lAg_q]w^-{4:Ofy65儖M02 Vܟ @ey2e_ L(|9\HրR|2vA0/ʇlr_Si9r-fNM00J)(qD.A[˷ ė ܙJ A4L&7H\dD3Q9]drM:u{F$ۍaM'"w~/*P Hn*m+~PY-8Nˆ.G}E;ؼf_  7- tɒc(I3$9[-~&FfR:zllzy<͓TY 1=>+[Wщͧ[A`E:;.YS9t?ɑ?=;̹W?9יּ(Wڮ_d{U?;aD:OKSNuq}q?]xq~xqYq'#{8)N9x8+Sc_O_(}_#]-Gd 9ߦfgcCk繟8b=ڊ$PX¿$ QySC&S:9§`%A Hg1mTkЫЦG{WxA'g&0+KH}xtʄdi3W4$C%|ǻ ~Iy)e=)dqߙ@ aoWJr>h(b`*RwߩMBqQwJGc3c O8() N#i1fw$pe7%@Ht΢=F Nq$pW[F5#ݾՠ.PqPeE-J=W k(=y QNQTO{F1`6jΓz=kjM@Cz>lZzck5w\ ƽ`JƈX#]Hk|6b#F[tM$aqzW k}ߟ=6~x 08nɺ&ؓ%,iPX=ODycȂ95qO1*5N%[ƪ8*U泠ƫD]Uͯ%.D9Y-0H0raE<- S$֨W cZ'^5(^MYc En6dXÐFͲ8Qo/J5v;%"dB>%; O8@OHflҚ}VP8i,4/+j1Or8F"tҩĬf@;tppK/s\xJeEBU_6 df[&F]k:Jr,1q2`ؠ}4Lt B^uP>J]y9u$h1+ "di'^zӎ`HCNv`39.F;^IÕ~lޡˠ]*>x0?6ƘX–Bۥ^cXevU\_6tzS XO@=#ElAz{9X7| dA^hIGѺ !h~ǚ 2|1͸;BcUc͆+Kf/{QULf!,|Eoƣ N( Y/>ZNqk\".K\*]Rp.w =ShXp䐲 eI# ߍ[a1ral8^JQ-Hjcą낭ڄDV?)=6[s֧c YJϺ>\,j %y *D~pCpݓ] Ӹ.r_.C"D,TՆrnee5P PK Lɋs ԯBVA _xMJpvtЂѳp;o+f5L\`eUq,C7"LhQ=1hPX94Y((B\U2)Bdqw,xn8^gkVjd[sA?/Ĺ=~\}$̲uM65n:rfq+D3MA~ %j,%JH?oKP#XKH͗5 bd̈́c45لt;rZjGd!=_-;x?cA:(5T=(5XQjl(5@Zk# ŋJ 0ԈkEY@ z>Wl߮!J#L-T,qQ]ڝeyE}ƈt:-HڠψMQVw>Z|kVʌks2#l`Q1(qQV(3ں_j:Ԣx0\ aM7i3uL͈V^t/ћÿQِmC"#@VOmS=<T=$C`5G#3- ?c4"=ߘQIR6W#[a.K9]ŘW)/FqxjyRa3n]>*ֈaˠzi/ym%~6jh.K3U(Y/,ESMxdO/EŹAm44Bl ӽ̗䨪h]Q̓q(uԈy`N;]rLQU^$,ĪgIgTAǥYcZЀ^ͭ7X c[UF߫:w gttK]*G&k&2e>C:Lp7jnBs{&M_[$"ST)?8WW2 ,я< J|&# []-wIǟc'о n,FѹD(BuEjjM(LM`]p!~rQKkQL ۣ&ܓn [9OkQR,Z0SyMEXqd)KRR.^h\B i&HBSe"oЧYRokC=k ^:MX_Gl ^-Lf5@b:=]R!?bd{<\帒0+?yr+1& ]P.7)"7JF3IiVaBa/v`}dIЖz DO~i̕lk8q'~T2&~f @>Y4:"g'', +x^]®iW[AWٞ͒Xw~_/F#M`E[M +bʊSV=z >OYbz &:&PHYfWrҗ <[-bRa('Vvhe'CӢD7L}Eĸtn@GJ4{JKX͉ z$~{N J Tɶd`HYx<4 f;܉d[kji^VEcpgYwO)Rd i bBPMF 0JA>c+4 hng XC+CM`TNnO>ק 2I5Kw.!),J5tnq7IO2t9! 7:Y3pM>z0}| >K- l_v_51EMYk|N$zE^jHqc1N83ݏ[y+acY#%]\Jkꈋ~ Ex^XdBEv7k1}Τ{\}Jm]wlnI-,7lnqPZr bQuv{nKGgAFvXt:]t[:iObfw `!׺jxO٭PGJQWuHW5,Zla<[4h[^-c e4ɑ^_-]-̾z1 hsW O5S,DѨ?C`My,UcS'BgVO G$IIz[(jv|#ZU-xB:QlEyk+k.ƋaiIV)=e#AFq>+}EhS<=l?S=5=^6GΘScD3Ef+Z#/wgIal.`yLPy: [h=1](\,LyP8&Maj {3L뾏.kӡS(0FdsɹB7Fp5gg Y=VHL?%PXL9 OGG4 b{h!;S&n۲cxޘh(֛rJѶh=߅6JH>R8:E:DLѺΏ@Tãs(^;|2L ګlt r2iԓ^Cbx8ȦH[ 7Qłt b?(yB x 5nyFIx c_+U%fM Ș9EOw^I%i^OcӃ̆wa΢fs!a!{'N\WA35_3TOT&gL354S5j>i4K~LMM2#+tJxY-c1ҍƾzA,2vӨ);BS>%s%f%u% Yi)l,X d,bOcWһ9:X$jġϤL(Rbi3_[gD-][Lt`^~coWGN\rU?UUFVUW6;S~"Qb\:K#.Z+љծ_5$6}'FXg&){O ~_l~oɳgѝ>AV_5/ubNf6#^8y>1Y@H ^8|.A, |N,zIsK[r\pcj7)h26^fԘIpAc9V_0E>?"zʗ d.q>9]fK{)#oOG;bxI,?6^#S%bɯW_G|'PO=F:_:8 jۖ6T$Lxbr~hJ&N/hc^\ xW>%>sdڬu /f}toh_!8O؛b((gGvUWȑI7#SDZu=}ȼ(n6 #>h#l$ A"='i_H^O>A~cd bo/6 nwޝt[Qp{/|&eL?K8Yqȭ,$'=mwJ2S2.'*7rC7/ŒadAw}C%|X͆:}޿Z/7"y)̩iܫȽyG^L\m'*1͒G,LZ!' t$g)2)!$Nl%Va<Ô\m h rwvh64; J}qf ܔ 7uT`I+hnԤ̯SiˇǟS)MeM@;JFnSCqP=6aUI\,0Zf9T*&13ڡCɤpu+Ȋ8dI{ZZqxx-WQeCذlujٸjCӝ `$sФhS="p 0#03ۧ"zM״_S8E%(q G4<0Ӫ^զ5S}c>AJ[{et>q[%Dê*tk +,;g|/5p>~rBnzʼnէ6c`'v!!|H|-zsT:EL;qa.zv->MJS1_nE<L[X_ptTuyoyo>_T[{+~tGz3]pNVyf7m.E;,Ry|IrM~kP߿xAנ[Z~}}GMҟǣjCQ &+Wreh|WB &L+V7muYLB׫,9 }h66/mu KƑ$qxGm|<a>:.*"{i^pُUS8`$Ir.<+ΙEwYvO ligre> b^2>+hw*稏Dn̞ꑦ_8A^GfyT>jl`Oǚ%)7 æ݋ӓ;0݀пnȉԛvJiKrK&d^Gؚ^֙n -S%%0"#dZb+K"6)_#Ra[(ΫĪre)V'R1d1'%jqk\}k\ȭ,j?4%>Mn.\.gydVM 3 mS!P~,)f]FvHw%r! oZU,ZDN[Z7P2w[Gr:)׹o\vװUeMYγVQN'MNngsgU <Ȉ${NvոZ4#ۘl|ܪr`\㖓z -(w;KMM֓dvbvd0_S}V=9㱬 cJUj`- Z}4͵8Yۆ 0$Gzt 9[l 1hw? qO좻MRbogH8A-ov,T䪫f'-{+?[~E#0\z^LW o8G}nߺ 7-5^m!Yv~ l?zɾgj(tw]_va<|:HVQa]ogh|oScҳvE .'Z<Y B=1 @1j\%o*9s@IowǛ nʽ*4hQ >C^ݤrHo+FVK86'ĴZjTS:Qm]I:Vј2=o[7:ӓǍ"k<k_|?˝iWm$sqgh&=3dѷMgc }ysN-PF$>]9l^u ^󇫓tB<#bny:XHD@=qpoF~?PL $L2ޘQ$iuZ] ߾=g&PE%jӡDu&G}9펫 N:f hc t>m`q8EЀŁpfw=-:9̫Ц+{.A_[/:u".nmڭ[[DNS d".ǩ` -x XNB9&__)u90vûW Q5Y0;}J=(V$;U)zCH̙xAq! Bxz}J4, "^IH1+|)7J21Y8|Y01F@t?|%;cw4uIr񭻀8 Oֈx{YqL"fp`1oktoh&5f x}f?x]h6 ܧ$_CGe]t^cT~0z+cJ_>/5@ӓTm~x̭?yT~⯿nͫTӷj>z"8k٩ǯ?N[vQX/ SFsDQB}*Y騫q4pk~kҗi.APvהf ;O$0'!o0V_/q0_ʧi=cz|87e\_rmǵHƈ6(~D;q>檫0~ԚYPwz0nԎ'_,hK_K CXj!IۤaǾFM:XR=v5s& exQ|ky}$P 7sDm!1 >MI81~|lÇ=R'^ۍѯo 8>hAr;k}/pL,<@&^K>}lHT5{?FŦGޓ^MXBgԣ"o[z{{'-oNR;ߩyPMWt^}j67ϝOɛ/w"wiC={g]IݕB8B_,&u.{QžKꝞ'Bu8)YCg u3?bC)佇{"l1kus'W<6WrV]ݐϛ|PP~ŹB6Ig!;+oS6>T~-dzdn`e!wR mjKdqDE{˧7 -_oaQg*9ڱA0^%34CݙdA Urc'1C>^!f&QКy{QMΤ8EZOD )psWR2ȔψY$jcM%iwβ?č|6dI{] _Y?j}g3(#۱Bt&<[=_gVpѳ]{5E&+rn J =\?gBi'Lvd qK ɲ^#}?BJ4_njAyE O4ѳ`$M-/JC2=LYYr y)޵_zWF)^Le=f 6e0Y+Q۟NC>u$$EIa,rHa|My׮~/>,]tt[xOU܇Ϙn78_/2Laˤ:;uv"th׽˼KyiQ^Cpoaӭ>wiԺa/;qk{{K_#it~\dT%9o@Du׷*I wԧsU:DdΔX2,K׾!/йmcq0 J2wo"3G~#iI\XJ'z(iܤ( qN҇¾0ɂɧq\%zKŒ,zQh9bOО]N*y<{ئ={XWozgIę1<6SȀ٣&rݱ=|JWD>œ|b+[7~~J=Ch A+U8M==Ǟ8._糨k:s|_=a2HO \?xf-~o-҃ /m?\oKl?>4:FezF4<ӽ=>O'q;hK (Ѹ ]!S+MH)C[3Fm]_'3'(3%(&q'}tqћ޳YbVRKޯ6KW}O-kfZ?.|[z{d=7zV%M. (I왠9~wM8.3zQr7>_gv<5˃՛^ݼbx2L?IQzާu%r}qzMw{z=FKrcbq\<~"Xu]Ot:ּy16*cLG2u$^!1o+>S9AFXq @etC7gBE\6ZRvn,E+uÖhu*cV60NVO>6U$/cj$:6e*1~.E)F?D[|&rl&"s]SmF"դ,HY8VRKgVTU`cb hแYm : +#Ͽ?m3AAM?SFdMR6Ϊ;6<|]@ gv҄-m׾ {g Ğ 6Y%6kv'ɥ]Kh&|?]pxkP3Y֢rٳt c'  ] hQ}7b?;8RL܏Ѹca4}x^eOS*pm uątu,7f!؊lԐ^堡{E3dj֕16g\Q1*@&`71xQ[Mnv; n\erv uiMg_wZA"u6saQqcaY-ٹn[5P2R)n%q)N۳yrյo,]::qDcf22` +L\tVumo ypSѕT]mHF{x4QYP_$툛&ݣ0.hBMgoRc>F8Ӣ`Cj?b/@Y9߰!6a{P6Gi \nQ7Q?#\n=o/(Yb]1Y*u`&N8xq,.;鈦K:x ]N@/\Mqh:',kBSAb*Z vfIUq7ډR.WcuK1־y$Uwy54Tkl̪txU8!ȯRQ:|`t^:7 $!Lk/t#m^\YY˹1<?m[W\J:\iNz&^_tX0aO8H7SZ9"V>6*|y.9FAVdaLSv*J&{ZQuB^DA?}3W.K OdFc1_bK])`}O&|va(Lc:CJRmh],hdҺ]ĚTĔ,h,@7!CZ%}q@pzL[iS(:k x#>7мnG+ѐ89! - }NnSd^x~+82 3hxU|m*A;j-hΜ4 P_%S6b̾iD`Lܪ߸6!ko"yۧ&zr>P"C^~.wao/%dž9WWwWnо%e{KBe"@pnt򫠼2]!bC\7hAvSi|S#W1[HcL._؇Èbwvmw9Sc/U;io7 JfF!?:]ʓͯ?.EMzV}2ɕ#x1,\S[Y)Ŗ$@ 0+~S#ngE|nά]YEY]uxKO =R7|&1nM%Rvk&߈0hfh?n/>ʖ4!AyFEd&!$61X[Rkgn׎Gç"I'Lq%? V]Tp?Q iLSdFqѭչ>$,T~oq/r]-QB VK!}<ݣ,HKM0rAZ]aEer*ţhChEkC`{}(~jN 7YTC!TиުZCŴ!q*S놎mq]-\-ipZ2+W!=h(n*tM3 )Fs{r7;$IBٰcWuν_d*n]ޱj_MKqR@jiK/Xդ_HucpS6[ΘJrRP 4Um{8" (hq(+<2=˰ٺ: QHseie*L&%&n3U; (Z@]p2l()%KРoZ8֕,EʦWf!} `(+ HE?-"1Vv`Yc7r9үeq<1}~*t5ӆd0%Ȕό"}X(vYO @ei{";|MP 6V',e!#猪)V QhaXҀ^&5$Z/TS,^M C5c8`("x W 69K:+t]De>dNaC4)z@Ȁ[ 5^9EEYO?}8lUodˢ.EpcBZڛgz𸉊P\6xRk"&j^Kth5]ٳMR[H3Y)s*Ͽ$8jҡMQV!%.Is$@T-N)-#:z{Co9%nG Cώ?b>8pW\qyv4*[sGzloA5ݻ@r@ep* S3KL*z҃R#4@/A؋6/ib|UK({W}c;4Sج}d/lUC^]lCQ=}K0,i1=DA+T(4y|).~LBز!e4g@k}rH|gQAԍ-,cm}uA.ZӚ-۳.t9+O(s :o_*p޾gد^lʀC器[@}u:Vod'PQ]-rDf$sE%-"z.B_'OJuӵ(2{$aU8A~= 1JѯI lV"1OnS.}VeȅsϽ0WO߽q}b|.L ]\[U PLkl]UŸ1jlaV9'ɛBY[?XnMɋ6I!M؈B 'tb,E*#=U){11bD2arҺ}] :!#R7 ì{6k!˥P C7ȥ=>G~H*|W4mmF V(Cqy2ͶU%pHs<0˽'T:$+\֕,K:.ڀgIwġ JRQy(jO>n]s!&]4u÷3'QK=Kccqrcl=6ssF@ A`zE7Dڱ.4[Li=4RhgGw+RuL3hmȚe*_U Qn~fErUgEL@ 4i-g?l%[n 8-MR:>q}1ڥE~Na :9m'+iuc3qO#^զ@ rźڶa$e;)0Hw}i:cр}(qF?}J+=c@>qߵxĹ"VN!`/6)Q1Md,+iOFWXdhrݬsGX-Ch#nM$ʞ[f;y( 0hJ,,nz>n:rp1~zOתY!:i9s3gb;s螔† + t+(TVЊH*&hNT `9Hf9J_^=:( ?Raz 3U*Kj1 Q@a,2 cz&{FuIq"w[QϞnaލ C:ح,]p-e%Ɨ,fׂ"+}nMV?PrA<ƮYv(&t<T{p}P6E(:Țz'+욢Zd܎R%_?ztExhD$SM)RQ6]FdqnWCc`ݛ;ig*[Qk/|yomoN\5[ISZ9l9uUǺ*4|}M\ 'le S2;uTLh_)%Wök3*YP\R #v`Dkr(AA}y7d|cRIêEdeG"uUCë‹?~H'?KWɳy5Uú5,}}hM1z T[>bQ0RIVY>NiV ~~eF.;-y%Ҽ\8]nq\n6uULBޫ!5jL)]őrT=BWe8Hoy2IovZ>%o~DШtL=br^ʴ4CQlYZ-ΫP wEyO Eme`2Sg8lG:B^\Un*v9sf[s*sk6UG^Jd57BniJ'Sws/k=_XuHs`IJwp)*gPR^zZ;J-*Tu=bͬ9^v]ˀ`1^::Y׮̙7:qChZNo9cوbQ'-caZkCvmNNUhŵDrccb5ծŀn^Aufkw$59VV?ksl*9.7{Zyr,Y.oV1 =,GĸGOPmܸR{#\O8o_gb4x{DeMM&TcNC*ssP/k(فr 4Y1޸sS<f DPII/K4fJԿcytKD=T9.R{}ҏ`qycG^ZٚqĢʂ~L8ih8kg⓪kWܧ(o>W뫎ukccuuB?Xa9jh@Mt8 ߕ4P BCUp*󛐩j)wm-cJMJI*&^TJ_4XDNe/)&R}8Z TtQé}Hô4sv4RO]gqSVM_] G *rpO͢3?M{EsKd1*}*q;(rDE`#C)@ۑ^kFJԂ;S)a(~k*%ƂN#(Z߿:ʹ2AZ3L!2j ^ vxM5CddiGŦb^PQ{m}XU,>UV[$sIc^Uy{~S{įH8k;y7BJ- N4ǦZz*¿uB;ZX-t|cYլq.h!RoޕG GHn6Į[]cֈC5B]Ӕ9nAxQ]KNS$dmiGi+,vG@L0OXHl?چ颶 \_3)i@RQť4bWX,*<٪PjUad>ai FF -~z2i9\S)˦/]%L2x%r!&0n3J9 -`c6&M7FMiD\NkgݝN*tq)A> !0m8n=Ryĭ'/Y+#evVOadAX.X1`j.^40 eTn("xE|1rQZ}Mf巟,DK*SKyqqZ[$-gyZ](G2I^+ccZ8ԧۥInmU4Q3Ny:͕EmNL=S_YmM"#Qzek#zL,: '1.G#3,& E%e-.dY~ӻ'<ݝڱړ; Sz7+ BLgӀz}.D~Ƴa;~?7%àWv#Y.j:e9WRТgF@ h<6>k=~q8Y\!~tNsl|,>7iz>,96$1Q=S@-,=Zw}3ҋ)yRެQp~LY^y+Ͳ{'U'4 K0zh=3YDsD,|l,>7{[^݊:Xf?U͢gF4hh%ʠ=}D2.K.ݺ{k#EXgf,6 27I%'C+ن+(UJЩ)EόX,B\Cu& XErꙂYf)TΏ`u7Gw̢>7{S$KyniW?TO@qܫd4KzlL i F46WŁE=٠2nROqRr$oo^,A!a=eMę夬tjG˚Yq"4JjW^h[dQOP?&,IKXI}t =E?/kNԻlMbn{xua>MS~l G*߀=e0),$v1JYR&>*Ec(HNl/` BJIP&̒2tGJ2tKJ2飒l҉;kv(ԃ?X/~v#˩rW<0.ݒRL_y(/dú+Zw ҢhBJՒz3TRY."&URꙴRv;[X;^JZ)=3R9R ZjGfOQ1S@J_FSCW@(?ڬC)%C)p)Vbmo$.~TRv~PrE 4R /Ģhp Q!ewݵJ@Or/BJ :+2RB*Ղ )L )=3R9R\ٓ"#T MRRzf(Ds(6>֭lʬRϤ¢-'G)R& )L )=R"9R Bj#"Y6) 2z )\ )=R84R뽲z}gȏaHgH%)rtz&z4etXJ Sۤ#C%%C'Vb}Ɵ31O>c׼1En;R<'kiۏm@eEA5qEK4bɥf%C{`zDC>~l/bȋB~H;GZݫT8-s3fM+2gEs`Cm_pr$WRB}O+{(tSJrO1 q׮TCH ɍ~^E4{~,E>09ʔöÝt7n9(V"mo:(/up8."l_;|bV5J+i"o= 2 #Î( |ⰴ/l{oeb}mt&63 SgV4I9m8b#5(^%1(Kc;mv,GDLQEܶq^-LpFf A:UYi3=عؕ_>yz9YD6_l8=rg-"J Dd Ař3o!WWFGVJbz6{й]PovE`APæA*MʶP=.b=c$MR{#~$bl8=t4XLmƈ|+5ɍҗlV4$ʉE$NfF_e ̻jdFJw݆20jGKpQ@o*_U%*oBa3 #so6ҫEبIC5(WoIc ̣"$H: LuHHd(_B= CGav -"1r7Ud%4J=O@s}AxX0t8AE2(>fp"F_dFSŮ$+lC'S%^o+xL;\XJu^=T3$.Y* l{`f7{Apcbݼ3f:/1j]$]GKO,gqErcc=VbK}o_iMNSUxB]6 \$ӕH#/\F^~eH^mC\:3"E5w_t?40ŸнЭODY ?GKZLI# ?ӕ[kcC >zY:2#At ;>߫/kQ[Gڕ88]6~u(kX:Ru[L|Orw[# ΙG6 Ǚ]CN]F#E/df|\lp"Rp *3D1YA!fIdc! 0۫İ8g6Ž'j-cMb N%Iaَ#3 53 I8̝ ')%{&[wd/Z dXW,X}H%T>C1EGbLl!jOt;B٭j^)4QJ=sbamRvROP= PBcX;nL.c^>v MAYnÉ#ɂ B[d=i#IE;Ť"7?h_Y,@B/|HvL>" ɬ+~h:ZeA_Tc񫫙=W f`v=scޣg2y o[K\+$͡op?v|P]Oojj'zf'0W{o(}P\#E {YdݬaTr Yxr\ t-@clP{AOݳԍ)\A)E{$,LJ/Z}PٓblNZ_zi<3l"97҉uOq RPi2z[i!@vn".s4сIٮ2&j|_#źa Vӈ2w;ٻr?EޱVuלFTSd?aR5؜Kj}D,IghC/{RY#5 ".d3t7dMAe/rEP,c&Ascs/]e΅cˏdd*gd#,tY]3> Â0s0]㡓Σҋ5)HnMgcշ)7>6ӉOytEt|? #גWrWg@4Annr#Vb0{߫q=QrLm 6#D7$}8fJ=hq)&cCĝ!w~< _ 2z  m$cЛ8& #{}0H)m`Oav@۴ b/8:\~ !4qctatU?u 7_Ӊ”j\s dOPfk6гgwWgiw.ng8(jN8L}4z} tg53qESoz?w-IvЈ -+Kv:F0u\,j=-]=' }ƿ"RfY4,Ñ90^YJ9{=?EKV{琧+ff7ď, TtXf:͕8L)Yn.hՓUt4DՓ 'Ci\`TT:5Ҟ1 l,١~`֠IoדL"Ɉ$Ҵv#}rGO fEΟzqwS/b CZSգ}=uO+"^-6U:igFO)Տ=f־F6ҽg<_D'|OSOEN<8 |Zh5^_X\Aajrs^0Jԓk#8z3xz{f/Q ckOL*AyQ]cEIg<֝ԣm9ˁ48sbcug= /@P?3c9wE>\Sf㤸Lg;MYGX{ϴZMvu:EP=1ǎ3>3-w}$q|ݸF> yԔ_3$ՍId5Ld1eЫghV鎃!%=!z!:z Tsʹq꧞(y蹾@3-Mg)w$5>{86<߽gO ug'rDwžE؎-#$bNz*#C4F3-^gJ@X-E%|]l]lØS0\ʓ庆ްsqegz*"CF_zȟƲʾ/hqzjr( 8?/ήsSio୏gz= T Ҕz##L4HZ5)75AșK{A)v=%&=燶́%OX,FTSF; ^ *\FbDC3z4'-lM8XgPj͗ Lg>B&wtA /`᙮h30կWPC4/ i:$&_m L5"rƾ :q] {|6ƀi7Ƃ4R jwǐ1iI(HkS91)A?MZ]@@bO=\Oz.zƌƼIg_m3S45SclsLy-TozN=[~M*S439oLr;үΈ'gz]/bW\& W})rsaUr X"n{FcZ5{f.[ G*f\|X皈ܐdLKW\[* h1DŽ |sNH X@ch[)등ރ+JZR=#^g~g _(nB)퐝6|sm{ڽZ{uXf+c8t=,[uL"qm2])E{iU =׮}zݧo,ѣE KY|vU3In!HjǢ=o 6O=os{wdzk0/sԽgvVݖ9Dp;i 5\f,tkơوiZ htf83{`˧3:0y?3]3'|fZ٠8gfgfNHLǞ@Oۛj"̿(ǏS/3Nȓ~ʧq=cS?ezqxSs̃1Ss9~y5|2.#FO?&Cwcb!bfp1қ#v;(S{?[s}@![d.GjZG4A]a*k}%\=4>Tr}Xgij}\ș]3=g:~|r=nO{{' 4fthFMeK|n~+>}ͧzm=>@ZR{<#4>z>z0<]*ͳ6hM}fgL%{TݏE0</80zŠ'c7&9{C˩$s} ̄Jer.8ti0ӯ1qՑ$yҜ9ALwPuL8w+iP#/C^,h>Ipь!KSz6`#;E&³>N)9VNIJE>NwYi,fF @bl5-nwV`d&'`suNq9|.x AwyQvh4DIn}9_03O;h_T Ơ#ɂռk_6=M!J.<%%(ͨ1>XIAJwync=aY4) [8̬d~O 2#33jl>Ng̰}'TΑ!g4/<ε9&&e2:V Ά2u9hAse}0RQXVPLcOG.h7Pq>ŢӦ=9@~_|z>NĴ8* \3:w` 6\L+:; 4Orx;qEHzg^+ᅭ0H0B5?ƚ-L_;9>Ц<{ Z )ڜT\YQl{ʤ51>z`,G9kX5s d P Rot*s 0@ Pסt,QL-yDTy>ǹB99 o?z#yO<,*pS CCNJz_I.(`Ec~Pz ؒ(vayݟ1KSnCsfi{NmHmKOX{ )&̙1@ Y %CuAL8s^`q`Tc=+Y1b*tC;";fȁ9C yBu{9&JL~8"Y ϏqGRnpB݅-K %7$DBz`gJ }ߛpb4\0&d O` <+D)/g Ul=cx6egH,ÅZPBٓT*,D_s֗KO>*O~PmCl>.*m}h4 C38 WHQng lKy=]rXdHF,)ܗrNn( iC]0cd2-r &D3 3e=?u37Z~&K(2V,LH'QcppN垃YyT}NfFSEn05Q m϶ԻFGJmehPovpw CO4v1G&9LnL8U d=dI"$=Jɦ9v ag9)Msh{D u]һnuB+3u[ fu<ڃEѡGF`W%,Kf,G-lޡCUҊ!ffKv !FF=4KL0ͤ)$ pl6 SxI9XH&3"6hs xgOg t2$kY>]a^'R(GLb<>-]itJ=\ScՋPe)ND3YOs5NtVq1(c՛MD{T }lpB2RRy3*^(O(ع ǹso-nTr#38e5V&>G1#w8/TUƺy١mVJmy8xi$pF2-9Džv UBPy,"KfAO!<+DA(GqA:Vw Yo5m7%v$<Ď$K\3c5Ԉv o[#ݍN-Yz\T~_Scr`/PE=ctk[`Gc1_!~.0`^m/?߷ 7xWg_y7_V7?|w7n?ސڐܐ!tCaCnC w7V_w6_ؿlؿ؟ /76_6_nvqquÐ:/76_7_v_om?o|C7nxy~ pCˎ77n?Pu no? Ûy oؿްab| ߰] ߑC! _V!wC7_66n݀ `^a/?T+R.c4$U*%[ۜBO#`mwJۜRŸ'}![DZ4jLXD;F찿| 84, ~>~7?rɛO|'|SVGsOnOy䛧OyO<}o>6Oym>qsq7Ggs񫓏ߝ|,+7/g7||'m>>>>o>>O\|W@>{'߼|훟O|v?zwIO}ѧ}6GpsI7G:yěOygs7Gzsq}}VGps7G9'>ދOh\}'\}'\}6Ql>O}o>zgw7o6wSV_C"'o>n~>7?ěOV?vGhYWOy'<}'>VOWzs7W'\}'ͮ>;{ԛOyǭ>n>uٜ}٧C7g&"LYp46$:8L7DGѸ!;$L :Wפ3z<lC5"Q_zΟU/n1?+*qXQH>BR4dh BM_7ۦ?tοn:zο:)Mwܔn;iM6ݴO7ڴyߴaMnZM7iM7?ljpSڿjiMoZiO7ܴ,)Rw7uMnzwSMWſ[]uSMnJrSMViM7ߴuǛ?)M6ڔ7ڔqSכݴnUMoj|S?jiv~|U]Wϻ?~Mw)ݦo"o4~MnpM6iMV4nW?.t iW?TeSEn۪/?4/O7ueM_o_$0Nʙ3@7U.(O?ά/?!㶇@l_X>SϯzH nsD8{V|R/?=k'3͛~JI{@»H[X,z6٧"vy}y}}`2\hٰP!d# Jyqc: ӐU in |X1HZ{NCԞf_ ~lu9ҐkK -Ȭ_P0KQKߔY2j` AԱHy2<}>Of'ϓdy2<}dfLL0&P|K\@7`X@ >N1 +URo?0`Ga@FΗF$;g υ1sǶ*8^鬸 !Go3u88R{Ķ>`}oEV|\~=m귀zE]{J`^ IS `xa [qy\pqy\pq\pCjP%ωRrD F]FV2)jsfl0܀ &|Ŵ9xPs0 'Wz&$迸Q00o'Va\<~^y=i;ȡbCkCf' ݰH>O H>O 37/@!d&BcTŒH%[ Tp3?}N0\ٯݐcHl4ؑy gdyWjj]4Je82aFra .1=e"~8K)K\k39EvcʣVƒg=!SBR5^^0݀^X W$OZD9el A nj0&IӋ BC;8&7!lb/vr/եl,_SG{@u}^eaeEL2=[+5.wCWb9ۖl?1ۯ'f~b'f~b1T*̤o58<ZJKZQّ{rc2^'J89l7 n6֡.N,t.360!Y(BфӠ$9vuF)iĄ-R0Ӌ 'ifd")J4K?A0{PfG{R!s¸!P:Ba9(铢,r qbL9g/ )TJ>xڦ05*\ElJP'Wkdlq=# =# =# =# =# Ai M8MH zbUjM>09ζnڪpk\Bhׁ,4\ [ΕO,0pMa2tGhSl9l'Ṇr}-a H `NvH_rUO˓Z E bvH* <_q/-g2x&Aq 8D8DGF0'줄cf[#GfCH<:/'N|7{GaM>J7(/)t& mQG&M>|TnGa&|oQ#Gy ,eM$xMB*7 )$IHin3w(-RRݤIIqMJڄ IToBoT6)nRMD*tUFHy6hM& M@ړv)p* %6KH&!]B*T7 )$p$!{lMHJ6!mBR I&$MHdx*#MF*XW)m *\ܑzgA('CLbRjJPQZXΉfZ.fM;)u5܀f̥](W6K +)w>xFmVLG̃O"eUFn@Ӆ(_5^b1Fz\Q~Yp#!>]~6'?䗃QS'2V:?76û5)طhtQi$I{ėG|yėG|yėG|yėG|yėG|s L[M.<vXõuo^UD&. (6W/OmU ?h$Dം#EDhɰrEmOHݞ0ƻ+ Ob=ݾ)E #PX(W66Zf_Ru ŏC!,ݼq SԹ[~<O{<O{<O? 4kډq9EnpBKjq$e 7Ddm1e1i"ᇮ)>{*7s$I'^e5Stem{|Z ijW_&F`vMinö;5FN!7JgO'ٓI?{ҟ=ϞgO?̔@Tb@Y ]ܶFWqV+H LM&'0pzaQ!!1, ^/eA{ 8tTٮΎq2X.Bom}>GfCB(Q؆LqiEڙLQcÀh -gnJ}'m ⓶?vYJ:6pjf_m`6L:o_$#҄W7k͛yέܹ/ OY:m^76o_ɹy6oRj6a[ݛuouھe`6[VQ}m9l [/0d 3NBÇ80wouB1Hq 7DS#hAg8yC^kCL1%y#~?lS(;\TT"(mǑY?k2$v# RwN;7Sg2|kkt` ERA,7ֆ&~2eZxfv CC._!f2"OPRh J^8e/jGp#=^=&~t9aڦk2$k|ʸ 10I&.^* J 46(S=Jݑp=(uF]17e>wix@ix=v?; DA !>'.\y LXF[b0aUAC^kIWomu~?!f"LH؞7~/?@KΕy?CY^bE=mj<)H%ϥi;p9]K!HC,_f Ul5!J5PA}Pb.(q}vhG}8eUpkxr@\і)%\om]DZ8$ .JE%X$vԦc%"q;&UFH%R+%TQBT7P, "*U *JxDy*0/gsc;;Jr{ϬYoz]GScn)aCVc#na}@f QbI5Z5"L@ay zX!}kBRCe*C%#j v1*ey.y5י*ì2?Bѯ3?*Cď$(\H?VAaT{f8@DaߣxXΌ h M0)ˊ+(~b`?!zB HuG;RݑTwTGU ;JW1@>cH?OMCg bhpYwVWչ ՑaIa]"l$>h鑂h4S& N= GlLFqmiyX~c1i0ފXJ`FY:Rl5XcDF umJ(2BДbKR;.Z".'S]gSfXs 9v?qts Ԛd0Mئg ZLg(7(w8J(>50G/[hF;0ځv`t.0JuDdP.gbNɉ tMBiR: ( f َ@#IsHQ9s!3"(@ͯI;\" o@:vLLN=E&4gnTolσ+Œ OXv>`IcKP'ۑ̎dv$#p$R(ȏIhaq\R78V,A&t](r֏Q׼~4L=U PWv\8YNp@%PܘÓ#Zf}0vLFՑ؃ G}o؉ paIPhH ,Mz YBÆ@:۶jj1= :$;+~p uݺQ8ƭ`P\z=  l0&ĉ,ĉсk{;8dvNgL@ O IWǠL;>laQHzxA70rɨ88' !@CR6,$2 s4(+h7|UF;NvFQCe& LZxqN88r*Hs39 DsRGYɰsa_xn=g50+6pJkz,2x*Ua& =!M6P,I6 z~84gG(vqmyukO(鼦#+ֹ+ SqK[y RGaX  I !m+ !0#eXD2F#JD48}$fJ[j>f0;5}  :A.D4{x)Zgj!.ހ* 6x%'abXb*@C#bS6=P^{(~`B h%)La(?zxC@m<(ȯXVb=;$`YБMD՛vx!.q pJĴ!2$o&2(3MS2{X[f !jXKz TހM v,ٴsH~7LR@WD,=5l뉏Ht$4 ctR]<@UV,wRQk>s`wP$/qG`ɀD8S4&4&{4H9ziR5=Y|au; oXÍ$6Kv& eKڨK8[4UTOd|q AYl.9&3 휥NAYGQݏ(4I7EkXPk+9[4'^&[q,[X8OjCc:{5M)} :}Q|IlRtGVl<"|l{b]IMFe"q۠`_69n(8( t\W 'tJP=ZU8|h3dbL䴀([i;_OmkV`u1h`=U=d m(Y@g zވQc ) %kbc@na{xBơ9@\X\~NJHar tÀ?g]B\+#_2r8mG,!VѭVi5ך ؉C#%X+KEV.@J!4'6+,tjd]=v|$+;,m`[T ,$ijǔjE~TKD;\9+tơs W"^2,e:)En>lecC^ۡy *XR ?40=:4Z ^wPSBiFmӳ%\!X"/ 9Vpp: R.A"wÆf \qa?$8v -ЖRϔ肢dh<5⬩["Ca_QTKᐚG 3k^`#|ʞNɔ:~`aA)x2Ρ(>Վ[cX:6w@"zTs(3O&MYAR) ԳaU"DuQY`ę4ɮA 3x& GTFĠ qS쀵Nb*jz^;$zkt.7>kV|7(?NTp!Xӑs 5Os5q&nEGm`PhN Y\ PqRaVKa[ӝ([d$#\`džH v U"z25)(ԃgRϤ'! =;,*ѹH- س@5V_|H>Ha.e@ v0Z$ȃY+dTvk33&``\G`H LHDzv=E(%)J0u$$༐Jw  k"J $=BB϶ cPK`kDKaeChg" sd>rX :)eK8SOBܓr{L0%ڸyL ,1Aݐ>ɼ g\ #rPG S@tBbLGDHL(h0ݏ$(hDv+h 3 aV=yk mhf@u[Yaqx^͔2c!h57WT/$>%{uQG\l;>Cu|kTדj7,'i8ǩi<K_a>2ՔΊ(KE S5FySs% ¤Lq2CX<yg<&[ۼx ȩ,DǨC7%Qc4 ca ^38|3q%][tXt`vf4@E5^˿ycbMsro #;= _tb`(ЋV禸:on'E 7)('; .6cA¸D~CnelTxuLq[plvkr-foIxFeER|p,#oIX%chnt{CnK#=kfXV=%aG{xG{xG{[m%-f{[v{[Go[O`I*2:8:Ŀ_N*^USG_8o^pZ"P*HZi={uxG>D>xiX|3? j. "州[z88϶9#ʊBK5h kYhݺɷƁJOʷ?#C?vDDMB[C߯FzGf6-,œ|ɫY6ȴt$%͜O p- ha9uCAu3@ȳM$MJ ՜uaL/V #euM&(,DGdA@‚{zȩi Cy%!Q *f<2dӅ@2r+jpj +t) 5 > @*=Q),E_Y eҗ6dN%VJh5a=.P'6W.s@͇0B ̿x0M.Z<.`myݧ/ ۲D{!ߐJ+cRF)m/وSyB,l>R;5yz0LA`; g7"w V$+&`cr̷FːC8x >bZB/ :R&Ǻun%mA㊒-.KBf]D㭙 {6=,",+kZ;:USX՜5uz֤D'FAT}.WJi|\iqN蘞lMپzqa8{G`Dئ'lf"x>F1,V*f[<7^X?V6PL}ӓ] j*u3t[)A![]IP:O 6%9)K\$b-YDLJ<.kd ֆ \O5e+`/$EU,@gI*X6dE]V B(Z5V"[w*d=BXHR@Bx@0uZr\GU]ۯeKKF䠝HY5 4MuXNE`aQ3a~nc;xUOm:%Ù bol`[RM#ʟU`r M+4ӦE7UnZE A 9(Q (g!R}oe ^d/Z67\.ضc06!|'%op'lNX cڢ/>RS٢A^tG6wO!ࠄ} ekNȧ(%&ZьPuvI)+yؼ"Pf !Zd>թ&ҌගCQK$lҝ(G5 Bwa+A0[%!i8z1 g|F~j${f'!5%՚yQǺ#S12R.Ln6J|f$>D$ ɴu Ζ=p[Ex(@F^^d˨ykQM9Kb5E<zL:F'f:Q[ょ1QB@ cI*Y=5$mem3$ 6G+VH3tN!Fw5hC oEE-.ҋH> hF|ZÒ-=T[?s8Ɩi *lU,@HOS$_8o3l4[bRkzl)E!Q6@nAĖCW*Rz#K| ԥXA/Y25U 7.7<ߘ; G 8a8K8u\7>|ÍOƓGuW_z\|/]">+_@: < rxgl~"ɮO֞:Y+LW_߼{_s ]wt̩;??o׾y߻ p׾ܵ'~ -t7lz53xfokț*!=N41MMk3W`pAT^I+HWL"umW Z'e"WO=D(P戩y([yKAjkWۢԯa{r!Xh?!m+TI@VL I\ψl[R϶h{8.gkC-0|uQYv>/+䜳BE Hݥt҅G#'-dDD0Q@;uPkiQ槓KHtI!Aӝ)RIU z5gvRji gּktz{.}>`pu'T$žKSQ9grBqc\h%pZ/1i2 NA9=l2md.ose݅!w K*v:y[+m2OUqS$嶔q幷Yr yĄH#em[ Vu+!B57e>endstream endobj 63 0 obj 93286 endobj 74 0 obj <> stream xY9~W+Kme%{V>k,b^%߿JEqo`QSzgɁEkJ(n +szdB;#X,RhO|3 ,BmYXX-찭Kް}o%_c[,ٱջg{-|\3X;X0v>V|/8vc9o.<[%N4x}d7V"uƇ=?VXʠ4-gQ+N&CjYZes7v7 J+y9[[! CGɉ?%νcd7+y)d%H wYA)(~\nlK,p5?Ѓ6:$=a{-b{A) r͏6~LtvU'=*~|}\}׍`RSWAU:d i†NRȡIUt-!`PRn%zS_I;z}I霖xQ- P`Zvc:ullD}N8FduGԒX2˼n.FgE) X#3£ccx{aɘY78'8dͣy>7x}՜dz=GF,8 #!8dG% xyAq{ǡZ;-积cSGl6sxxGDũG5,W,ٚiNsu-'3(i,zeń ^?/VsIlQ2i1QK,_AQe0{d4ۼh!rl96m nW2%cnKݭB9GJA!.X8O":(_{5\n0%Ì8tXL0< ..yaf/&<8  V v( J prlxMpGSۀmCSEk^3Dq(%.U7t;;ةʒѽPA-jpJhZk鎦9 .^j*e;L5mfñaXdEq!¡.4vᦝK xa3;HeR)>)W)̙(A{,.oqZw?$  \X7LYt9Ytv 7?n45fL}(2wt4alVJ`>9]>؊b9Bz] SE,a$_Z #ƫ )P 0ռO=`ܠ?7p e,*Gw.o VÞPtm->qC]Ն|Cc aGG3ڢ$yD9z>ЬgPV+ ? 4p"]漩Vf 7UR&W]mdf2=nM/[NHgIc "cۮȨc=p u`|B RO!i09=ߙß}$84C9z˒+wxp"0p~Gxp}G=\w;mY 6 P}3j\D1C10z2eqp)ewA"gf E*j mEjWCR,K]#^\x|V+ϕ@c˽ ms哿V^+}9W>+_ݽn+8^p9Zl'~{p> dp>E 4 F /:<L/A+ד"B\d,KΉcO Q[e!p-*;a]&1,Z {iPwEY"{c@Fhك}V~H_=h47@T=%$kpl@Xd;nzDʩ["b)bKJZdT#2 3.TQbc;uZ EƎ+u,MfXr4"Ck N m](t<֡dtz,tp*ĶtGRIqT-y@HH!V6N=iRRuԱZGƐʀY %4͚rZ b9&H 9\ 8n(1*h1hŖ]Q)$%skM/_#g*Xӈ.1,F]S>'q ~ΐy$9A"b2{zva-̱+NvU]˶TR[\%)v4I}`QC ߩihKSqwܧ[Տ\8a16/y ˑ"* *LK,SEnnpƄ 3 :Ԑ>=EjGnD$5a'MƸ1g0ԢHen9+:V9k,m&Hz9i1)~朌v1I)L"j4XL /@/ mq!W#9lxqֳ?19ĉP |]EM~O*یԒVCs MDgTj٩JJd~xMjes: ?N"8_3LY- -* 'nRv~|&m Fl 6]At.Ȱ<\ Ğ8a] 90(¶_z{uXP7;|;Fu-.whAEԪ+T/C5^P̓6GFZdd(WsawWI`̺~f(h%A`#{ƷlDžlZJG~5i`pUNUmremqA[ 7qhsX%OPD5`(:vjmZ\lT`c +60̆ 8'E.(&54,L2buo+~~Q (}@ ELZuؗa`()fQlA`5G Pu-Eo)k,8so#"V]:qt؋륁4n>Oxσ ccYRcqWqtGDXx Ghk>Fs g¡>N<ڡjouZ%yǩM Y`3IdOG=Tͯ^d1]a˝%AZ-H}Γtmxs^.J +QT~e:-gU{g /@ tq{{}#J}d1pd5K(hK7wB=fGDu&m諞}ģq%98Á.=[ Z6^ft&xS\>?$'zuq¯?56mKKݣ&k*P᪩pȽӭ3oa^8 j:T^k'$"}6 >I|tTE]c}<&h~vޖR n[}c]"m#A-BTMVTO-pKOUޢ?E/[vzμ)BldoĮYJ-Livx+QWOP.s5LUd.gS}ЫO >5cٟж[jQƪTC1%6"/l'®QEe0^i h3߅®aerQ9z%M4d a.iT |ꍣ䀝G@ҁ1u{GPFf,DnQ#ab+6P#taXf}&>/4'tcݷgI[-RGs齪ʳL|38/8um5Y@ zސ/sz-/tzzp.Е=a naz,pGȸǍޠ#~ԟU5=6Cge,xo<{н=Nؠ_k<ÄA(R6XQT.Z$GAto_yi 'SǨӕQϧ y})RqPmLaחGJc QMl&Y:BNZh&v[V߲Hl 93i6 =ZlDU$MK (Np}x 8#2׆MSmʚ; 2(|n+0Bpbgwgp6"Ѳ8\xŰ3jlAQDGŢʼQ3ŅL'MlAs[]^H),@I/).[yr>oa0R#BGLeGXCrGXn7j84" ŬЌB&J2fG]xzk-3ejK",AfLD ˪c(@'8xE-m,,f(Z%YwIo&ik}_uwo{fJsys{ɠ6aG bx-HEtъD(O1saVϺ]\?O^d 3oH9.dM %~y>NlbY1= ujŒ%3މCZhjWe)M}TRR !X\.Q*u\=G| Y<'ԭFޞof% -e)ܬE"jX6e;؍y!W aPp+QM< NH,kB_DԁXR '܀b%J>cJuJǪIqXy \Q3ǫgF-qVǦۺw'^Jx“_^r'a_\KLQ+Cȍ.c ebR˘VcFh7Mf%9ݦk"26*A:?sy ;'$$;!yЮUU$y(Dw5[eqzdOvQe>]+t;}pBXs6#;[c10d~fWv=i+_p22b7r &ƾj3}v]#m(9ɷB%rm>ϒ*tYLW%\.[MQ+wV5`7vp%F8d3Ү( IxC^Jmj[xo7IK#kĪQS2Fv$hxU9x+H2Qo2uFԛLU#<254hED1}~MLXvmH"i/2yQ2=+sR˦[IfJiWWlG3ѺR)J࿞.3aKM9lō\3a%ber8xS !;- Η no2828&|M{&%ѯ]55K-(#יn RsqX?I[hE"t'KI'S&N IoPjSi[D3{f.݄6ՠڣp]9j)N/inO|RO8^<>.~###hho<<MKЛ^.x $$L>&L]rޘ#Lʿ'H7Xb~27>1|2]}yozxOMnbnbNы|%gi&eӿu>, z-t֗4@U%^fdьax4Ǔw?9{Z[[oc_fe3u\|tV,fL_ҙ:,yFڙΊ;ެgxeڡ{EӰ`<gJ9siϒC-ꢚpNs$3s¹#7d]#;PF!9 f-_V9O&TDx$y}D81|$d }b'kT#h)HR"ܕT1?՘qZ8#;&@xTYDfTC3*9deA}][8S|hZ4W) hF|s=tۋ8j%{F7zY2~^~^) l:pKlf~% 4vju(<>5x(pWң>Şvryg-kP`DOS{wvJ.AAMrc h4rm,:כ]Oo.omu#h#y#F II5E卤I]$HtIt~;4 o$OסiMSK HlY+HzFYH}1$jfqϖζ"v+q-3U@CW`F}o*j{~<}? hr$l9-wS8!dĘh.`xMX!Z(X@{|k;'m?,my8 /h!CښdžIejUF{As|o ,m0“>4i,t3UE +ⴇi*3`d4b0Yb_M?SkݔY34SW=3!!m40ОH!1 C4,OJSBfVi|@Y3ch*<|ޝe >K.(.|ov@{hϾفVѳL<{elܱOL^HsP(ʩKbAO㜄 Լ(:oc{T$_9FOIhO) ۛ((d 9.Y8㒅~?NCop * [S吃[#oBBvqq r v f>7@x.FԤ 41Ϸ[/uH{#9;F͍8@ VT0h ul9=4ιn[o 1x;ysUa错Mf]fKd7./aOkyGu`J)wW3!paKweU9ݽ PmsC2淵k>cZ@B?`,]g6mu騭FWMLZ\ϦUvS.)ɓMB3U O B/!kNƠ*`̂0 oi 'Gh`%xK6M2B_ǀOsf1h8b ͛?{`@&dĿ+@erRW: #屰d` |EI4K#⎩nv5Q#iUZ0D=+ݸ 53Kxp3'{`j5pb~'I9)NO~;oL3 ~'RguHx7*nc&ۗB< ox:r?̈AJ\;6Nx<]e&C76Jca[j $ ^ŮHQ3.{:aGx MǗMO:yM0r JYnnЮ.=zvOw 1O8n)\p[F'\f(lJ34a=<̑Hy.Gkjͷh^h|]X@ KJfT.T(9,>XTEz^ b,u'5F*7`إ]g-[mD; Ok^{qj>63c{ZLãwSil?z>f} S ! 3i-I6X2戮JYƄQfǸݩ_baz,SsrzOA : s йsR%-h'.w󥹹ԙfd&Ki b]jʡ` gSxצ~XMVqlqeZ`;Sn/nkIf!Wb8{un}Ez_+.VR:=ջŌa1'm;S{767&跔o՜p.>{m% JȈؒnsG&_`?^t +HDSkǧFB5.0^BasOfwPCOxb0Yl5/ڜֹgnX\f;2Vtb}YPTlBqTŵXGݓC+=4f\:':iʈYaAk=Qn1Oޓ#Y~žQc_ό$&N6ݩ%l]zqͳXvy؏ DYa'3tbv0^Wi\e?ɲVa- FN(+dniR_󬶝D~EZ~J|a dl0鱾wΘTHo8n{PPy=OLtvƲa'x}4.資rŤ+jbWl&+1kM ZtΪ]/do9W*t?yQg<n̪Ѿp~!l ЛJ C;*4rǝ݀Svshm}s) 6q5;R;ؖ|PLt2_"4gSZ8f oAV ;f2#sp63^Σ_M*э&h d"I^ Jo"Dh!2"!z _]D0wٓAuWd`%f&"*7@oQ~LӾ߿W u>n[Az\W rJ>HLƮN) j)i XR&HNJOJV0J!9P} ~(OEjl_ɹ.pƺ&XI I?|*fW;'m'~]?(ql_Tp=s5gpYh眕{5g횳6g$,F+3gEEKk$ 6b:m͍)6[;So3Ĩ)86!=ؔuXMMm`ԫ,ڔhmꭅIY܉rhM 2bh5n> >zi WZ.Vlv͠5r5yn6G55TkԢ+2=%%ٳDObpT8 E*Xd+k![ &75vj6y0AD|w4*-VVK%=$U(/˂ϻ4F*fboU0zK q: Lį wHY^]C""ONo<(WHQѪ+ou;}Xtڝl$|DӬasC`W-^h~1 MfG73XIemdF|7wv,r44 nchh+D[buvplr޻C}%׹-Q 30S(W.{G:K|#|!IJ"HO"4zGӈ`_MjpK#%F} b?;{}~Br Zde.Cl\ZS_5b8|)pʏ9YFd%by/O S\"%{-q1Un<`=Y;1x{ʞ 'eNf,y5pاvWP#<(+`1^1K|K3Hc2hs3>~Z>$p1ɼ6K|˸t68)i*+%l7J@b:$zlH0$~gWg.4N:{YdTX-C7 D:ٺ(Y SHoyZ%7uVP-8hq)tfh6z[٣oXqGgjUJW[7C@quQYهqaq6gg{@v*CX";H퐟м@J 7[4爻 7u,9 ?Xߔ]Otkjҿ~b%ԭ'|+,z7jzo2L(`өhi|%"%v8Rc Lxe#p SQ&lpk%<8DžJ^e==6sG'nDSK8}^&(A=Tm?̝GɁbu}Hv5A]Ӈz:Lz[bUK>ϒfn405Ѩ*Ot%gIn>ئd]&FAS{ϻ ]eBM zՒG|?n<MqH'hhxa4PP-H^,K^A0KZ 'ϖ'DQ}Q̰$[@r䍅k>l./,Ŧd8Msʹ8`(y}WRZc 9ԧKTP7(F6;FkMQF4uJFa:bQLF183S޿TQ=ma~=.p'k, |pY{*7IAo6׋vwCɋ/-zRbȢ,ڭrA+4>Ԓo=,kT4FXCz EuҢi9Hױ=\5;9.{X3yoXE)tJ@ta65z*/}T׮!;VGEۯH}DN/RBS % O} !@RYJoӳ]$ۂ~ll F;|5 1  } x{G0űg9~s;8D)2I5Dʢ->Ifl.=r1\*Tꬅn!9z`(C*zJ Z07  K `қXHn\G%=2U^"3VlR9GȜgLFd.mhpwzS'% _8 R|%^/ٿK^Y{e_Q :GcC4k\M@WSPaIlAHfbS9:2zR59rt Wc1!aFnyn8*SIdbk:#s˫l*,W"⥳I<(LJQo ^/_تS)MU`HUv7ÌX]֔ 1^GM\:ezeA klezLs2v^ISY#>)s&<=!~p}{w$oYN+Qw>vn΄$6ЯQܴ*ł!Yy FM*U̴n30*L OPg[Ga]!~1Kkt!p  ,̒E- zZXIqNXȮn |͂URw7e'$Һ0%]S#`oe _ff>^u:^|>@e,5Kp{=*i`*.˹8m7( wSГG<1u?&?)`qOw&RœdyrLm#ՠ==zz}Ya/La>ҝ`)T O{oMBe"j:kl6K%d5:ijקVkX*[4EA 6tES;h챨 nK1>CLpovmpn#EGA4{j` nkۺ.Vp&9WIkVΦ . If)㑂N]tp~PpLkv5;fGٶw't*d1;C:=jЉȍveUU;h2{ p;oeDP|S !ΚGj;_+o(\($ω8} ؊]k{:O͋&70 y/pPBƂaXҔ8ȴȶu qE|>IᎀAU+s/D | IZHUAKpA?tv4Ft@٠}XOnˠwܤSu6,/S2#e/70pu(9x~A{[vA8`-w<󴅻9ΐ K{%=0G{opx5d_S\L+E?5WBqa C(nŶ/|c !CE%k{T S" 9?o0 U |[@K*K_9lprJᮔנ־Ziy[zx "V.8 FY߭p}kOH0"$ ۞PBZtV#z#=a> FӝB/bQٶ\aDG!Zd=X&S8-~y1 +yjS۱LEyS%wn5e7U5Uaf=ZBkՠQ B^,Bnk!m= BNp>HElǴp74`3aFMj5iI7݉0.具+B\.|[As[KDe.-jW=A͝ in1-53{A5d&lTFgY4(P#Of0voss),t(Y#NJ憶y>jr '-kzT7L,NF x@kqP&i RNSnf3C2wI&j3uZd8g ~_qꬹ^#P!2s8*Z$Bɛ .WJ0Ǻy!9)*WHym5D5jsGNl٢w@ݫCLG$CVs5z )|V&r7snXFpw}ǰGj^;ʽ\wmŅGݫE^W/;l޸»RԻ&RJl7,UyC._{jWG8Y"6\gEtR[g=őG nsb uK;vtYkeΕUBjp 5&–u5W qmѠ>^ lV&-`Y ݯΤ՜Kf>|*(t[Y%"I18UMPuq &<{#LX% #`€Pr s0IfkFD~&Ѯ1:t"#Ž1f:E5L0V(3A:a֢s\p,o5(~B8(oQ/52En1c@l!p_0s`Lw*gLf jHޢ}}UF^ YL9bFF1ztH [-U]=k q8o7&v{ `N83AI um'P{ Q񌺽Ő-2fFJv,8$`nIǾ&beբXy1<]1D u85Z$:p `a9N0a5*%tjm-:YyB08-lpQ## ޡ { uՂ֬`>^]cts"bp֢D1:ۗrm NPn-4< !0Pnս@;liX .MDН FG4qA"oL\%ӃUW\urUW).!W@'ISCVdbN<`(I)ǣFz`p­BnLwZdfYj&S[p~UíCf̥3؄j³&|NSāiPh~ؿ ynը8Yp)o쩶5*|7S+9ܱD5XVcVoY( Z+ɶc(fom-ß5-GZNHQd&R䎔tYn6_D(1njXeg;wQw( .wz /#"i.q9Db@h LaJ7Žbnpg Fh5\p=d 07#IgDݑ<؞p=Z4 V -%̕i-{Pm|Gbְmp]4[Tw.<_[UYL^kɜբ~;0?1p9ݿ}E&8d`Qh ATӚeJpJۈj_u)y5#F0O8 6}6hqu- ɚ40Ɠ o6!Bꐿ=Dž/}4EJx%f,@2 ߶6fllϙ`j<8)yf%E%_ X P/fg3VGMŪPj%OփZŵO[\H|5::` JL'%oW&zz}m}*Ak=h7,6tL/ѭ^ۃZi!f1Ak=h~>N-U/jݯG &1so_gX'$X,pggl^5|z=i%m|xr'Ik=i-% [xx9NLeC3׵5\# ޳޶9z-~5[r puLu9Lgu~D}X|l8K[,|;FԳxsPQV/)džWY9kYKoY>vl*#$D56% FAk[Ak)(Ե<d*9!2f%B\^/Z{^>nUS_q Ek ֜'S;^F۲h#Ik eJq~TIPS3kъNA! iͤp] f],c5 | AlL)ot جFrz!+e\,kD{3yyxL|q8S2>fP\9D3sfŕct~:y(9A KsqsssIe;, (lad+`@ %b(rG#~(RKϠ2J`SͳY;0{'-2&fMZ6#qE͞XA p" []2u@Ru<%&9b ӽD*λEshH9Fa-lGPfSs| !* 4hb 5>52lHi#<5F|]WlQZFvCVKW>cVٽѱE)԰ !/ScALD?{Ј d: 1N K#Ȃ |jW 4ddt *#{Q.Aho{Hh!WS Аc~mDW\=USט5Ѩ*{;c豇܄zhjȟT0"=_s[Ԡ?3Z0aȚe-5kXf0Z[tZe 5&ԇ*>cCץPyjȕD#-3 ͱ(+{1yǤ {[ʺ? RKUyKl5yCdzemY%J35¬`j })RZ-BYWʭH<-Zp,G|?^œbZdKR7E->%t~jtxy=4BN a=tU$CN-+wScݣiQWD_%vK?Cy!zE/_aIN%[i1rjP EyZ̢P5[iaG=k˱׽~> 3 5̄tcEbʼƾ&^-s3Q8^3L`-+A[w^Okf꧟5a5y(uW[0]l=6xv38uM80 {E+# -^'Eo-$KB-qd,hqWAL6ݽ:)Jvv$#Mbd5W(c^ Wx&~şqدbsAD*{nﴈ1}4O ]% ]gtY.@Kq)'MמJL:~ }Rf|l ul*/kG֢-_' +Ѝͣ+ir{h]ĥ\JHťMqi}W,|[>-LEkL`=r5ip6}V s->[Xb=#]Cu/T#ed-+(YM/iQ(UƊ}S^5"'݈C葤9-OSC[:`rA5wl$^cq.bK4ѣz%MW\8 rj#Xrncv܋8VJѮX);yjqW+WѮR:\_VJ՘VbU?>HgJG`'3 i[ ,D&( ӂSpbPzNՒ|Bƈ+ۨ?C}+֋/^~K^GS3K ӫ;;61NFhP\(f i4u\{WZ0VH5lBrb@Œy@[@wZcSMHkL!NK9Zde{jȋ̾[{ku?-ʤ5*=t<-*O[(O8* ľ->Ԋ} a -SA"4^=҃#=.ԓ4fj\#4#=dW4Cr_~C) *Sb: x"ͨТkrMs$Ph!Scv,LPBqV+zRqq}[5KKiO S1/"-ϵORQu0G۩Q C2:|Q6f -loB7u| k n*ζpBEWXhT8Ex^/BЙ >`Y qd` k *ma2"͇Z(0O|'vjԹP +зbE"7qSL1?vnR ,LE= j0JJ%4#=EY"mp3wjXvPQE=-:Z<5Lc (xֈd9hECXT68-#ȒOiy<5l8_jP.}Uj}:wxLttf}ZG=ƞc??Ts;==->o9ڌ|3PSj S׳'P3>+O ?XÙٙ"k 4KiQU5]aL=UT4jZ{FLU˵Ɍp6o=E0e=zZ|Xa-=ЧbTc{Y,Ո525vQF/zHxZ8G"Prt]\CuZkL* -C5sq4%zq]:-ܔxj 1N81P c{Ԩi9^Vay%܅ C0.X~%I a~ܻhFj:{TR~PC_ PCU '1Tr 7徔rzqS6AUk"z{)iWkVRgla - ɵ_- Y>AFFOpSq`U4^a}=]sZgT9O?N *9mf{^]ґB3ب>Gt"0m*O5uG 5]{#3`hPSEr?- +=r{Z4.*΃0]C).Wc`equZ&ŖkҸD`fȲ{ܮyu.i碞:wrҹӠNUpQNkWp&JaN :5^3}Ju9u׭yܱB}muhc=-v}.ひo>G㇛;\ې?GPg\fmt*L`+i)fŜMfڊYY=^YoYs';ޕ J QYu0زllZ'KJ2L(؇GLcTHcF#APj;8З;/Y=>{FfzfgF(PAo> Ϭnwp-OEDY"=&b,!5!Pϩ.1U[F+ rMS0%8(v R !A:|njoz/t& χ/}J\D-HLl?? al; #^=n!_\$MuفT,n0Yڃ 2@Vz%R=-\tjHth)B 5x s84\O0Ov" Mέ^a-Uh!'1Q lUH^Т(HdΓ"3SO$0S#>Jl!PCܮk?$߉S#tzҼ40Zl0u.A# {5ںE#Fh^[ "=_׎T\q-Ai^?4<C0 ;pz -kW9wi'~ qPA7O߉OqN]視pgغen28]c5A5Oúk,詧EfBF8thOa~ݷhO)n2@`.v[j thS4JƀA{+Cb@3b"ݿ!qEڞ Աn-Ňpbx `q r NYCĞ@SSSW؇YiWd]Yi?};YF3LvV;KgI%g eh$]a ̮90L~cFå|.( &S6bΜ.cdFa({;NoR*1 5 ' K:dn +K+0 ,_HUmZqwWY{/4+QXܞ7rcyOc yM" `pD"익$Ys62:άe%vcC;E?.X )Wp|RIr9V.9it"7`C'trF`xiu-O0RF(B.Z`^~a0Uhkiu[= IccKR*OջH@-cde5H>m;m)amD,5Y:>sŚ uK"#Nw;HT+HwhA̅].\-{h†mJRL-:ܞ0-jeS>߃} 2l|I ǐ\ ~O<~)o^-~_"Q΋׫EQ#{|xK|7_o~+]KGYR¼~q6ҜN0jX:`0>xY+ WYscbg_:LV{cez8t;ܫZtsGf-#R-ʖB5J?li=-}9NR LMkĉ6\W\i5\3k\}F\}fָyHq[!wDzVRR IzV|ڮ]uc X#Ńa\}F97KTZxƮS\ 4^Tnө́l5)^jfh-3Mp`PHƴC 5!XnHnaL=j8G2Đ*17u>Nݞ>‚L~pm=Y7r ~=Xq8*wc<|aɐ;m KRkI*#ƭ 1:F=8Y5:F &f#/@C ȹ1 pXtB>=k_XunIuY%P|,PiL}JB}|aNLnm;i &< WWǛ.u`'چdBtlD-sć'Ё\X..4nt7ù/Y[ZAE|FVv-ivk|yX7ܙ .J&jj #s!^eꙙ gykE%2:L6# ZJEm0A(A~J2~OP/R9?Uq䉑^d#NXÝꝊ&pyB5S<-{y 'NZxCѤXvRӽg<'TN(&qj$17:=#N4>t#Nq!O\-v ';4qMmIl:=/GeĊ=tzxZ|d-ߧES:9Q%;Y$5i⚷ƩՌ:Z"݇)Fq:)iaEkF xZ,7 yt(}kE߱p2z~]5MfGAcG#y<=,y%FW>`OˑkI7۞vj?aVόNF.=Ĉw|'r (]em d,U ry`2qYODZt媎'ۨ'Ɍ&ەkҩ3zȿ'Mn7.Kh:Y5]{1Tf-Ez%wSi[kʪ}oWwZ6t9 +ڙ-e]F0BwP`h]0{NEtO> Ήl16Y0:ťo4"'%1gcӣ_|$ .ҹt~tyt΢ΡMW?ܹHgνgEv=?"۫q&yr^ rÏ{ÎÌ{ËΊ|8qUqHQ6.\LqYɞD;z:F,Il9"[=y?6F]W5;gxZ;;7و _V$lje ?nP-_^"͛*"0Ͽ=>-;, R@@:Տo;|X^6d?Z| gCBS$ :<4n__B2ãeg W&d's]L݄ܵ+>\`#-8Is >,n54@ng0l>4Vn!P&/jGGs-x1HpZ5#强"5<55v 셊*p,jQJXC鑜c׈rgzzX3xqQct _S hbta bc_ j0kzOC^ESըϥOP-ʽMzp x>5!Q2F:`EuX#iv5nk% ˕kR}T>7fWc((8cT!2/υԇwn\u t!lVOfɽȦ"].6s+.Ύ.AZ*o=8UV ` O^T~-*BWToRy[4igbt+cRm`B!ȮEk.7EΡx ՟Ev@m}~ࢬrI"g폻di5s+u:[R'ۚy! Zc&a oQqi#O'6[!Il c(Q`)aTBxXZBzo%LH?&xl&$7x&&ۑ"h5P<" qjqܙƣJ AAR``G:(5"(5X#a|/^Tj %=_ FD__+j4@6bv Uaj҈dۍ,T3n/3FQoEoN5}Fnʌ^ PfX#-xԟӕq7`#=Y-FڌH״BֵRԡD)eFsoʌYLQc mFΏu{)]ʆto35yJOjFj!wQ=At oa,l5L9^B sYʑ^-ƼJLy1ŽWϳb KqzQF c./]LףMCE|Ԗc"X"_g0tS|Z㏒2`ʅyІ685mG-#K_𐖒p`ҔGJH3 FZGr-~>b֨}[#Q_SLi2:`J ."Sbs;v+R#túy/u:L-W(Ll z?%Mew-Gɩ?"FK=Wު| {3pVͦ\F2ZH7ݥjj /w\.rvf,%K{c*=G2:y@C:nJq[#j0[{Rn4Ii-nT{qU{wLKbcLĔKtm_ IbU?U+t-%&9po|΢RK_Č69%gN+O&9o\V+DtN.|tVPcR_ϣdweO9_kt IaIV's.hNzbtnɚtkxԃ[i?`mjwxA5aCP!^jo^`e򽤥\&(hZ3w&K-RC-q~ݢ8\ z)PR^PG\cV/,2.";-ya9{Džx:Yy DžxT#O"wDžx:Yq!Yx:=~X!Ywp:D{H#DEz SPdj{[5{(`=osٽ|0O0)"y7]{[Cؠ]v[X>3آ`q[jFqnt r=)(k44CZ},n#xB@y,1`X!@!l())((_#ct&Vls`sNlnaastբcC{6{Ts[= ҍt7$6Y+ZFa)!)x1}83Nٯ{WeC{CH=YlZ~+pZ6lQi_ͻ(BzuƖsp `@\(tbѻL[*W4JKSVNAY2L4D ΡR)#P\ sɩUgB0[Ϯ;#r@L }>CGqqwgAaK$ͯ&Y 9Ik|׮GzlO b#k{Pu}q~0t<`ߊK~3)d%nY"Qz쌋?EnGd!9!iP2?7 F2iv?qVqy/ d tz8g,:m64Uz_a1KaNM[^F%̣t8"J>fok>9;W7qh?J` dn7B>a3%9KN $u`d{.1ό< CjcFO\ؖhϼkCяQU?m6\/$V` 첝Y&j`iYfRK|Lg?M7],Ǜ9]W=vqh `:7G9Gh@5vTIߠ_y׬OZFO}/Mu?&g~N[>?T.J h*lQ2zpCLG_} RNze$\7ˡj,՘X7W1J&uĀ+[AVYD'COE7zz{{k\R,eSUڞ̜T#1C&E9>nnǟ>k:= )sEleJ wLehaK{SO[]ebU}6),M&MAVɠ̔j;Kd*Mz|J6-{̺e>k{;|[Z'YQFoY <ˋRzҢkG9Jb=d]rlJ' (hZK>LCAўo 퉟뉟ߞz矛7TWze YNaI0pR$Lz%?r7a+ˍՋVBW8X笟M^S߾M}M}{M}65)O,AK9; Fk %s)xdq [Fo[O avvny5pnW⟈btS,`*Tܪ|;83t{{{~7*?0u?Xa[?қ2̿lpu6;is)AvTg"K旫h_'m k ?k 0e?jd?TZ0<7,? ^I͗\-CxddERdU!w`Ucs8.Dſe%|.'Zך J x<ꦗ|tw&ڼ<̗`6 z{jyN\{OfX2C*#gȋEp!hϱ㊗Z= _Rҗr-$[ک[ <]zVP3DlD[ `> (UrU@M=Epr㛮Gx6Ccغ83Ysgz.a3J)N{HS{f\L~'?8ޙIs~ LN0@ި\oM5P21O9#?>)/K_>؟MҺuǝpfwt5\ Y"UIr[*0wVn8O`0sO||OrP-,iq ?ӧisweM2w1r Jt =#j&B7Hzi=z}J4a]Ji G&Bf^eY00F˴ }iStPX2$1<:os/{!1qVA#}H{~ 'C&It̰+v\(p,.˲C~J`˅xM;+KT8Z!YA߿[V=G}L'teĀT4r %J> SӦ-OONnXD^Y¾f:gz['O55p-j{K[U<2DwT_H-%jZT :'TXeIbM-ȪBs֝G+Y,:8^-6H%d qƳ07'󴤩[FkQet-͠)[T|" Wӵf~Wʹ)WɹąA F# a HY48;F;-tw;5fzNZvZx-lϵS޷lnH|\G6 <>(ϑDH "e7rI_g ڝgjS%܂rD@FRL}K.U \Tuk՗,W.۟Z⢹f?YGTe*$by9ÚΨIGEFğG`bo؟rqw q?ЦIuI#j ҂O=|kW l "57Mq{v?+Ʌ?wt{h0 h6q%4<# CV;"2lnB7}=YotK3xϏ'?QQ3η?eJLoh뿌#> 00H߄:$/YM%nlT$&$õzg\eMWW:RculQ0i%"6lp`!?xcLrecMHCA8X_X4}2e݅m{3>#>F<'U?t`a& }oy`"W]589hf[Yٺ+'x-Ubj~9w֥miatnɲk}duTA N=SCCfXex ѬӤ(gE2.z;C}{3`g6+RGThϽwh{뾗ٳJ _(1 pFRj5WSJ*o okZ?O L}eĴ0_SŕeN瑇;cn+F13g_\'NBٌ\!'_6yW*a~UH%UL;,8lpS%TAJ~z/&5S$Fz]0t=\yt9&RE'҉jߜRNұʝu'-,/(}ۺTG7љ pߘCΛvh! f5"xBak(KU?\l8~ct7cw# O{A|B%$ `?ykHXura6!ZuH>HˁC׶%j¯QȂ PtS$ALD(&"1EgOkWBb΄c 5 YS_|a7!L@ %^KAؾU͒~+Ȃ71+9]HK#oiM0~F,{7^4ϊc4󟸥Co?+a~k_^[~3@3 ~(4P\pv3E{7m>%":?*c}lx.އqE[sTyŇ:ghjC$dn[ruk^UYN}4=~qǏ8~j:z^6#ʼLjbcUJG]Gwx㥑[\c/Ls6kx"y>AySqWozR>͗M+S XѨ)_/5o;m>F0FA #w91W]_=._ߍCqv<>=v=N߫ZpuuL 뜩FR5__RGG0hh:-,3Wԃz~f_bA{g^X:LV M& ;5oŒ!p6W(ãGХx[L%ፆZ(F$hcI4hN2!8fK>=I*&p8n~}k@F \~ΆkfJgDh~65ZcDY?7-6=ķng= 5b3^ߓ=i~sϐNL`v,cj37x tWy|J,ǿ3o3O;KLdqb 7tQ:,UO_W|?)<M-(PGǡMqȪl:WaCVJ!=A,fi^C;ɧaD—ӥ%䳇6d*,)H: y]y%zw$($o1>%sS.k !jhSv^"##*[>IhC>SP֎bQ_, .T$kJN k=-<򉽮@ 13وr3]Èj*v&Y].jzJ$j`O{rAxF "vVn*O<_puI&/%nl  K:uU:}W]?FYMَ>3?{Մ-#7,6YwgP½ A=S"O<`KO'#d^gHD_WR)krS +_}%#i,VozoYOUv IT7dz͒kVưϋoO/һ7Me:(1Kg@].1Zz_$eev#%,J `5C l7=kϻvaz (@><~t)q?lwozg X&%٩+C{8X}^K+w~z{ 4enGuK |]ޣ[M[檀&*y"oUaH*^ؿ>fczG'r's<ƒaAt_%yHm#ӅIЇ|U{~sQ>GtIOKP"=CN &=5FI u>A4HvNbc~zepKީ(7ѩ@\!XI/Th/XHo\R=-:|NNg^/~f|h^ Z9Ws7]RpqE޻烼ZB;XpDkzs&ry?}=^M~M :LUpBu=xDNGr>u^b,n_FJ=ޣpW_=E]t[6i|!JF}*N>xb-N=^/dqЃBtU6xxZz?Kr'ΌQ%g0D5cw=A\嫯ߧ$0VR?l |Jo~=zޣWgzE[وzf$-*qa&" ek[لpz$ͼVBhX_DZmqa8q1~"8E͘X=!ߞ3̷]zq_qFzJB5/n{ oLxa%&@lCzXb1/#3:t0|:A[h@}d q_m"m}FO 17hz}ǔ8񞟙{(uk5_Wn̈́3ޣo{U1]k|ry1ƪz2\Ѱ͋Qc:Q%y,^An/#:Glp}iH(-Pot7?۱ym)łZX_$94=s_wqutD"#>N/("hx̗z{!ks|ߌ cu6W7 ~$~ =_ i\/ $&%x[Z}ރ癝I>(+mIyp=`kagaF89=ĹC1=˗՛S/~ž~^ hxq836{ ĵˣP~*2UUNqHhioGp{=P؀ ~[ I 2bKXx-;R92.`t4`9,·}_$FSqWυpz!"д(xqW%ᱲ/"+ Y J29zjl0`V{׬A&((J2k}jΡEBoUsڸF ~g z6),I*8w&@y;hY8,S1kw)M1Y&Uݲ3c ݖ0To$ܟumK 6Y&eA)Xb?{ +Ek@  j%gH`4^xME i jz6<8 ޠegh*A̰vV ܉A.(ge= &liM?#X kŶ*ѶY=I.ZB6 7[~D,iβΞ54];V`A꓾ىHı, ?`g~4ō x[8E'*|bVa[l ]0#.`1 Vd* C.E8%SѶl<㊪tQ2;mSRoRv\oPu (ӴKU_Nk< 9p; lylu0rvNq(){ 7PͼM?uޞK̀=}c)m';7$KXQe=˸rk+CW+;̥jCB6ãfΒ0חj %mGܬ5qCOl:{cS1BɞR}ʚ6ud?vNVZtLώᢷpCy[|A"R̮c4vsg|pX6gOG4]2&c"t2g~jG9fq\ʐ kV"hY3̍NҨj6LNrõdǯ[q\ ͫ%ˬD+/؇OnN^dcV휥 dŁFo&A~GC?7 X%XV d_Cx!,plʺdΊT]\΍ᑬ]hF6nۺownPfw-'dOw[=0v%X6 sRE^1V̋v1" dZۧUQ2bR"J߼~ 5n雹vYbx"4>46+[zH{X`2ᓷ[ KFerdR]lCbA%"֤'d!pGcy-&g-ԫ.fJGɔYH>ه|t;Z ޏ1 im)` MȼsrʬO&s3f^Y< ?\(\ACmS 9TlAsQ",-P;eMc5 J;e|eVMY[~C>u7|kDŽsc|c|9 /q?6̹p-,[*|džs/tF_彄 BwOtA J 2H-AB+fr9B>Fk@{MݤIS}KPR7ktw68x qQ7nR,l~=xq)*mC\ꓡO<eR>Jь.$NXÜbt<+x.⋴usf<,/7e#H]zbnf5qk*Bg޶^3F$lF3+`Eq Q 3}-%&3 qx,&=_;sS;v>>I:aR'gN,Qi%`oH DUN`%S5n=l]!dJ{;xjRR^ Ymm/?䱶8e+؛xoCwe"h(ca\SJ\JXYRO: o´^ EjM-F]"iU~S({^ңrAZLU3B''eqG:&ܶw8cv֥YǂYA 9ȣ&pa- _fk&vrx_K:,8?`=!]'5"*@ȌwJ`QgN0IIgLs4ȟ2 6$盾vZUCY7tlSCHojIЄY `tECywP!kI@M07s?ǜ/Խ!I*ʆL8u&SqsUlZӮR[L^5"&B>nfrVږNF8jY@ECY Ye7QE+K+Sa"5)!7qx9W@:ĕ!d#(FI)Y}ӧٷܿ e,W60S{FYIhDṷr@nX*$|Z wP-:M[9^㣋gEPqGDC%5n⭓p<9c%!GSa3Gwу}/L7:n΋ڸ95Jnӡ(ӤZ+ *ymmDHk %Wv&J Wn˟I^PPOhG}Fb 9G|mZ7OfT-N"=Ry4by|ؿB/C4.ұOm[fE :Ix0/.¨zOJ妽+ϓʬ&ҥYRՄP~%N^K-)n5}3ɖPO@!{-)z-=BW%F1޺Yb xf|c86nN!WtکH阅qBn8\|\`eKSfO]y⧣떏@ Wl }l OHJжI[Y"X/N6-!u c}IkBa)*bz,a{z6'[u)3  ԺWyREC'!‘YeQ~MbfC޸xyrcr髈(.C.{~ԽzuaZn:%V]ZJbb l^ xf̭Ň,ƅ܍)$7UcO0+?JN'%|PUC!hU~Gqk 4U}>ZYD[ K/[^^gy}EEԟ3zM#+` &߸& ЎubNB;<[ʮc&Asn>@D/KUB@Pu&RpkE G6-*s*87-"`JfIm9d/ݚt[iiȉ.-t y ̹,l;I@_O띉x6=BW+նM '.IAKCq39kW<]Yu(Wq;w&΅tBF{IImz `YqN,}$7z&+E'f;LN_@mBqÜh"QW4=OqC9`'|(=]/0\)ES2dayuawӑ0 ף}z V I˙dϜ9 ۙC69\Q ;<\A5VD UP td6Awe( mA2Q4ѡEQi"HR%^nGPBdR ѓIRYRx4Y +gI9PsS4ݣ6ӧ7MCq5Mے~u{n1 n=go|(+1`A7S$i]1#Ӓ4zմm'n3X_k/ZKCzh]ZtgL(Qlσn((LWML}-=W'*|Yf蚹rH#{uW_= ͖zedWבyH)=.h=&a+fѪJňJ-*σw MܻJ Ɗk"h &&m#K݋gOXp՜6kI9L,VG .IܯsMulClPh!x˜ɨ?_i'ZQ$EGh'(f}<}dC!-`IMwbwC @:*𰣅>+2VaE0?16_I)D&% W ĭ4rIoݰ2y}{Y?\U%t!]Wv pkGYy,˴" TyhU*hR|zf0/LϴRy9]a%N"v*AEx{(R_# FP%*,=$*mJ?5"&t戣vzzlYN;PW1^2^{{l{sJZaedcw:UY|+5oBd8eK.cX2ؑ `BJ)rXېŘqV)Ȋ(J"M& 5_E nc]!s LjV(&8mַX-> =^^C:9H&9] ^Nͣ=55f>w+FkSbؒJX=pMUo,S6tit .Jw㊞p{>ybOd^ .Vc2LU* *AUhd ~kIz},yS$BtFkfkRe%rb*b7hq^+*|Ưm@/j+K8fSe>y*r'W˙3ۚS[krhm|[^㿾nu x9(7~g5tIぉSIs]TgޣgaQ)+@k{\y*֫W"4YL[pB 0 J=o$Xrt=2{)2/Z~|l >ⷢ9nj㳗 ͞^s6* 8v> >"3SO|۶+[ұ^͇jR,_OR[;WC%Ju si*{kecX̓vfxuyi`9&=zǨn#ƕk ?xR$hy =<k#*k2h6a҅-{uzPzY8Ek>ɂŘ96-\=D/b3B*G̯d~(6AH%ON@$W_?$ Wo=lpܪkg4YX\8Zf-;@"Q8 ]tGMlnRp WWin eG~ku@UZ_uT^J ָTCcnz]c_Ȩ݅VI߄LUKnc oWj*<UJR1 *$lTV|""0w',{MI5zIԊPx NC*Qcz =İwjGZ'?P8._(t' /PϝS|j,!͏|l++X"U)wWcaEi |$*i}M؎x4X367HUʠؙJ C_S)a0vAIhM}% zpf QK:U5k*%ƝƮ"C$N;O7.6{LMo#(#8Ǫpf!zb' ELRZl\ʫk#~EzYIs 9VOVjpJ-`'sUW>6BH]kTjkfuAᰕz<V8Br_!v:xx=F=nq*誝AHts‹L]Dtuu."&kK;L[a82egr4d~Bb6OmIIK *.i?C0'P7ŒdQVe}w؆r-$4]V3% &1 HcX0(7dhk.o@3IyHI_6 '}*gZ+v/y 1qF!wCQah1i6jRM#JuwZ;tPK za9~ocpwcm&n=Y x鐜*]-vﰲXlz # rQ-jWkWsrIDe/ XtC3(.࣎Q k2(df1%O]MT]),+(mCWvTߎn.I#Cĵ[S_tMxȀblkjUX(.mt\4B1n08X1LFqg&}uE_xǍe#MPG_y#3(肨aeastٸl 8dnZL'Y =yҮa_c >[tGۈъ@4Isj+j}oDY%.1ȔE.,<Œ)K~-_߼L.y{MaCR£"AO~.k&ijL%uYx.ugضq%h2 XD$s$vQ(vAU 26#\TԠV{:ѦzEvFRa amsuQyd wjUDi/##1*5k ON3gӋǻ[ H%ub@*9M9*9‚!AW;G+hT*gۮӪyZmZ6etVȜMS׌Ȯi?vk@0kǔTUɱ'^ߢ26R*̐jOY:4nxU>Inko[zu[zK><09E|0戈#:Ht&eO%Bul:DI=^QBF^cʋf&3L2-ktX燈ruT:v*, ^iϮ,UciCV^V$$Tv* eNƤ&fO?E a%p8O=n9z< E=IZs$3>.-Mrkwr. qi|,j+ŵtjǴ=fꙚjk{,SG\9kgbYmԫFvy%D3+=1!a/4\,>vrQvQ(IMz=3Z@S౱xo_IM3cY69\L*9b^y.6^A酭R*NL,zfIJe٘XJ3Y,(T=;T̢gF0Kr~l|98`C/"Ѧ^sUMzzh$^$Yke#ngbpL[0YEŤ,-)qΐz͎C# x{}b ,h"('e͠S;]ROQz`WBD=P'l%-(6eqLa!{%lx٧!FPr{E =~\'nzʤBoJcj#뙟Izn.:)JI'l'mC*K8IL$J*9 $=F*E%Q{#*)%(ɤRFI#|J5F3dzl,kQq+U=AQ'Q"1 tuTW7ǩzڽfx\X4RH2G"MROJiMa/ 厉@6fNEb*ғ4J,8Qʒ2G4Q9u-bG74FGrRe6PH8RJ2g;R[RI< eC]NYCHAezCYNtQq閔dRG%Ca|5']ѺuF@Pee?YL=a?tum84nuC-$r^h`]󨿺&})f=$1V Q묐3C!%C!1'ӈ)S;]Y{ɜ5/O3C#%C#ލ{L*)5TRN:}fQ-kmVI陡͡X$kwH#y/|._=D*C%TRQ{#*quJ*8*Q%I%gr6>)61⤔RϤ#VP'~ppnJ陡͡ZR>7{R2ʝr=@fJ)QJM){m}&vA]/%(B`̥IiV&FWh )ET2z*}1Rz`(Do(6[@\嗤6R)PHgRH陡͡ژXJ͞$yT)RhஐRϤ3C!%C!neVfz&xm<?J!7PHgRH陮ɡZR>ȒI!eTHRH鑮šڸXk=CGE~~FJ=F*HH\skW\j N`ֽ1,gL}c)*ĜGv dѳy3uStJDܚW).h*CB# ͍G9e^T՞t&) g)lzz qpz9YK#~l*/m , +]jK.55O,#\ick|G^RCߑ<2^hđnS4Slz^FP=c.3j#ڇ{ u4i N Ȣsk^;.jGN5M1ŦJbGuov` ջ"E`{۠RF]bߥ8P,ՕESxzLI1a8k%_47>eBv)cXppMɼ\A+rFذGHƞCx:]9CA5 RT?{00xvm2BV@OHnoH_z'/(A=߷>c M(AT+tc)FIo{q5Gy9S\KdTMX F?v`}= azo띧9fﳤ?+B]l0XZ\-;eV{4M߳6̆ zh+Kr9VGu iVmLTnYYpI<5;Z\Hm]1 f3^Yk.=2]IL`.a/X5f:`T,@vO1СhCӭ9E֙8XF -}5<+vԀfԀ?+MMn_sy!iڕ,y"p,@;^ ._=S]$w.byBN*LW"vWp#x#ЀW(uer?<?r(@<*5.ypZ ҘĨ4ʝ@(Ƃ3bܼܿlخ]gGV笣Wr ,ec0#p wUޘWֿgZ!bZfGUmM:3c_nAK}LVV$Nq G]FǃCdeE]5챃%2hZl٩A~3'х0_livFQx`{+k391Q4e*?1NTInS`OGH֯1XpF/QeDqv]mSg!8"*e,jab] 67;(~T/ xԩ´˚L&)εĮlژXq̃[M͑%b遖;k QJX$";\x /Μ1~AJz4h?]Uӳ}Νu:*~ި(.vD 6UT _TTh: Vu XXokQ&vf;ƩL1ܥXؿNJffjCE5Fc/\iLnd;L2Ga'UN/"vz46b}Nx}mgt,Ce`50TL&'4&xt/=P S6ĕ04PC?^:Ňھ|WAyB5\ Cǭ]34P^m38s]Tܖ6(nd?frKN#\@ŅM5Q$N#QJlfD3G0).l*k.w!E*dSjKk:YR=})/M35{~K5$R 6e>D-1o=IbX곱i+bѓĖpn(Ki1gj8T4#t?9Q(z-'ZM7%K{+%<@H}[B#X3TBK>IŦᾩʐ9ٔI-E!ม1m*f.6B=SRIf燴= ZZ15)evMϬ D=]{e`*mnoڌT]=gГtI-AV?n?Ԥa~S.Qy )L8C~ݰѐ^}<,FMiD鿊~C%$xHX(fǫzd z&pQnJ*XS7^X̓h:)ͤNBzԏԮ"DOX('B'&ZNu{CTI Z(g-4-k 5=|^Tq[~V-)ZCO(ѕe^j$8ގ@<6ߝԖWY)!Ai$Hi/dCBL Cy ': 30mlQa褌"Xp=/Qy łG1*A\16128 G"K7(v%Ya:5(*z\Kg-߉źVb}졚!qRDU`ۋ@3{?~I6WOyP$L?_2X~`9.-MTVmStv2=cizcYC&zI*T~:(``Ẏ;fE|=بAMgxwTci0hZP{(T,hnU+҅N)RR졘;#lzY!vcri2Sh r̢vN\_5\8N!v`"mIȽI*r)&xA+ub<~C쵽g`]{Hf^S Fz7(  _]b0#=17 =@_~Z:L=R_!i}{l|sOsxzSs8PL=0;>`{C//bHkϚ'f] |zϗ[“jknO`e#}ꞥntH_ zH/#ggaWzzʞT+fs %4J#Ma ayNd3}=fȼJ[ݷ4C:O ps- qdH2?7v6P)] [hoUdFޝdL.)*4zJ& \P{# dO2'=CzΧݻ }aɝͽt!&4t`w!k.{YkwŤG.z`3A ;{B(w.4[~$'P9#kIf"񞋇BԨHuՕ^tTLG?pwGn?MNx#n+)lg zdu<3ts3ՔB#^#fcjn1x&%{77SAK1!S"<{FiT#gh#$ɅM]7i#%mFJh-uPO@nަe{]k 7 mܸN< P*S K}2\EL]=(Zz' YkIFThwhYL\0dQi9i%32;\4-áR{\)Z:;<=_13!~dI@OF"-ߤ2 i,fJrs@ugm=%'_A?ڐh<(H:4vWއwɸ=&h5$'cO5z=\ȃ nLR&۬a"Y-t^=`2 9~uF<9 z22DH} n 5qc4Ӫ3[FwR=U15j톏=D$sOeZrePaf@% =&dsr@Zv(UTǺFbH^4 ]APR<^ѭ`\: >ӭPE)]t+zOi Ǟkk{0[){ơ3\=gR}{fZhl8`隟OLp-sMCMbpv}-s-m>@}cQ-v0A_2˼Lp;/AZT=UxkQ|>~;;3 ]w[yk =k궜ȱ&M U:4[e٦lX3FLJ@3sǙ{8/X>Ly z8Q3z83{~fv?3{uBb?LgmWwO/~ZTaE9~ uP}yqB4'CXLV>`R=Z 8 S_/Zs=cO{WZEΜ§驄X=㗣vC3;a1G3ͽo.s]u\y|k>snv|칸ʘ=גO{gsѣmyd6PhFsl0[?c/~,:s1o!0\G3xjg}ẽdϩ-sLȵ4/dxB=6w_g|fiVQ[RSI8ATW R#,䂩 (RgqY3^kW 5Azvu#g%t*14fKpB#3hgG/hjsYvbζ}a~ŁEh8G0@2[8p =Dz@sr~x8"L .KIm$yg9}ɍǁV$=10"\N%qC fNϿ`&T*sǡN0~p%ϓ1b2b̬tf¹[̤L2~ybAIjf Yz Գp!/ؘ(">P0O5(vNWa\g|rJ V*vJc03vx^d+mq㽳rn7+%H79Þs$Gˁ}u!o`%%5V@5ˋB E+!ZLpW }|A*b4TMde]_i Qwa,)CiFEJ VVˋu|HaxpԨ`f%̰{V(YEݘLDPc3&q:3畨`%;ft%<;? qM10).3|xbp6Α-D +냑,$ܵzd{ %%/!ؤRWO1 3^WWkb3ՓЏ :mG0?syDD[Z)64⓬q"4lQQbې]{/Le z8f4+燳4.\.3X|1k $ĀdONs d/;+<{P*;uSV`nXlH\7:/$)V toָsQ(/;KUZyG?w1Ğhq mguܟJiG =́, 6TIORʊzmgS&уc99tP/?_+Dz`'K|0R |ΗhTI;,zHPMe ej; _&=΍exTp/#|^GdPÔȵJrJT"NtAq0+ZtcD +Đ!]څ5wĜ33NsjEj[rړnHG7aǐ-Y2LfJ, :wf _tCRXWFKY1ϊVy G 5C,%1Qb 9rX'}~;B׌t3.\o9}0_Z(9%  hF8Sބ ̈́11%c(|nY&xM~A5>m8`F`ijI/;Eb.Ԣ 27Ϟ,Ua1'jK\XJ}y tWys:.om"f qQqlFiHX=Cv p?P_`["<2$EB>F05bAH 羔u tLEGh0 HU8 m&+ n0k0!!X`V7/嘡q3^BdeB>~cs,j ϣs05*t٭Jh{5Zgk3=IiC&:V5p\tL/:P07,=2 3RO4,aX2+g9mDx4d= ^:V 13[ki42=Y 'di&M͇ qX73lgI;HBL-5Dsd;{Wlb "l(o-(~a%ẓA:j0HIxi[-TK)DG GC٣Q 3g0}Eȍ\(\es8q|UGyG]>mw{~kwuyǁd-29[|҅4mjVjsH#O6mi9.t@LzՀ{eY'7 z _&: B= aDwS@zi+.# !vt$w$]* $ڱjV}E#JUSw ȕB@Lz^~7SsBvp708a:0 sѭ3X'(vPzFacԊ=W?dOF@ʅnx lx`KcHN)ͬa =AP?Awi{p`#N*Y0fkZ:nJVr32 /W;JeO +!,[  36op=L%;?Kq7=( 'sP2%, ۙ`٫-(ux@?@ H0$D_jg֡%jɍ]ЮLde=lm5;Y|0 ?2P&:I{@T*{KO _TŹS? ̛f Dw+O45çR@|d=L@?@1?!M('$ڄUj. /`ƞ6bnr9€8 >FSx+<?&nMk/i Ϣ1b}PgY@e񛟏O|o~>SV?6G:_}r<}'<}ӧ<}7O 7Oyӧ<}n>ns􉛣9l~>_|cYW/ylN>Om>>n>>iW)7x\|v'n^>Sw/|l|7?ԻO}So>7G9O9ѧ'<}o>O9ԛ}Sn>6G:O9o>yw^<}B\}o>Sn>S7W4Qb!_}S7wxs7wۧl>Oyݧn>7_Y}n>y}V?wq7?'|ϧ/v?;@˺zӧn>n>a 7Ozԛէn>n>ivQۧ޼}'m>n7oto> vg9t09}aʪAp &a)%4|8 = %!a:Vn(ֹ5&<}kfn>8xkw_qCY ?UKjG :!OUFC-Nԯοl:M6to7]uuכοtmM_nJ+wֿݴWMnZi7iӦϛֿݴ?oZpoZiMnj7aS?eUMnZ|M_WieQM_W.] ?nztl*ݪ"?mJtSҿlJjM_nZi?ޔ(MoJ)ӦO7)Ӧҿޔw?lj|SڿyWM뿴*w޿mzM6[5w.4opniMnj˦wtqw!\]H?T/-wS]V4O758gˮ/?lz]7տTj% pWΜҼAV.tAy-qf1~i=b2p~~-EZp /&ꀬƁM޳ꕇ}@_?1EmSJpXԤޅDڊbг>Etq<><><>ϿDˆU !QQ0SNs\ÊɎ8'F St44I+߭ X=dˑ\[tngl0hQmOf'ϓ'3fUgE85 7S GUj01yؕf$0x~`Z%K?h13}w_x/C jq }HfXjZFx+t?0`? 4v4"Q9?Kx.wG=PRLg](9 x뜡W:#p{+ڵz+iTWE]+kWZ &?@ ^LL꜂Tpu;, {>Vr?.8 <.8 <.8 ο䂓4gT*|Nܖ'!7=67XIP 5cGL0s/̙&(K<]p>3!Aō>x8>AzMd Ü&γ6N9ME5Z23GG~PƠ|TORQm6eQ=P**gCU:̸Z; +$e Hi!nBMX*(P,Gh(v5@uV^@@dw^8Hr|zf4@{h:5h|<3?Bc˙`;q"w?gs#naU UU~>xNGRn@mOtC#uxZo\(]hCPEWw{>n9e3ҌCEp]!!@>49Ѵ`'%3#"Q<~`0E`BFx ~8xi}Lrv8JlvQ`]jфnt-7(mQģs.l#M<ʫx7(ģt"G&]>|& oR H& M@ʛoR Ha& t&M>r7h6oe#n‘߄M6F&M4rhnFi&ho&U2 7ȯQ3 GqM8e CrE:p&M< xTQv壸G&3M> |nQGi%~ H& 7iM>7mrM> |6(x&M>ʻ|Ae.k&!śoRIH&!MBJsDh&%MJoR&$MHdz|ۤIIun"RYE2MDʛGxn⑻Gy&śxTn[ţGQl7oҞ$, H& V.YB7 R$IH&!& cToBRڅ InMHJ7!nB&#śW)n2Re$\Ʋ$JlUBt;U B1=xGUfTCRTʏ`uN4jua$6n1N<$7c.=ByzY"`XNn4rm{b=g@)#67tp.,Gd/%6ҳ }/K9!~: )ޥH|tL@#rXO#I#<#<#<#<#<˟_`j tp$ͼ{2$b5)7vAzAnBNG#!Uy ( %BO+<~h{'D0]y ~)5O<.N`B22dz\(~5a浌8n:= x=`' x=`' xIO$Y^+HUlN<q.r̶\ʍV#)[!"cn w)I;p<n?tMܳ fWD &IH:* H-k#ܣ쌈dHSzПZUs)dō>8L01S< l2ODv1:w q}lU?{ҟ=ϞgO'ٓI?{ҟg\',t5Rrd:53,Z95@5xN`j09 UŅ 2vQ)aI@ԷZx) G Vqvuvp1zpr|kxxdU9 5*O@6dsOS.dmD#g PTP o9s'T8iGn` [ؿ1kR Ա6ؿU7kjCazԱol}5L&&ܾڽYwlތ;vnE|QdxRiy+7/JL͛yUi;Fe:,T}-۷]!l߲ڎ:8k#,UιEfsHhz'PM!)p>āѸ{DEBs`<>!b՘AFD :{\e .+[4faGهȮ7度ꯦEi;&^! 0]5܏܏܏wܙI0L8t0gg>…hw=Sq]K\k( f64,ӢS7cʰF`?w@ @v0ӕypB#^Pi'?.{]OP=2cpY@lV6a 6%][!_So`m瘏L2qRQNPR=XAq1P*=LA)C@6﯎)4o{<OO{(vAG;a.#r@߯E_{>8xMa.Y][Hq}_яvg7aX6Ӱw9KIUgXvve=OReee[!̴{ 9r079i+c9!#w@5vPOBpPRH7duffyJASy8}~^H~(îc~cB#o ?r]1n>®#>u*?mǸpʏqSa*)x.Յ4=7VUb.2 #ԇ;$`7-NeQ*;?'pjףNQP3>HF7RTYH5vYrh+yNU(Gn:VQ=`Rf`5;#qY=ՍjuBp:;]s#Ve X>@ ]*)4sFPJ7W WiI.ˁLy{Z>4'Sa<ېZx3hx>ȮtxjDP92VKa㦁ߞ5 ғ-4BZBk./'gl=r3z)74\KER>o7~pͲV)r`9 3#dֽqYѮ}RyYqNTt_o7| 1 $WF2DaP FgDj` {dv zk34 lHHBtr".r:'Vy7 #qɀh8=ڨ6P`VQ9G1>)tgԍV!$dꊳ oPcI M2X|fnS93Nkf=-D {':H,r)yT_ n`thGH)!zjs*C lˮbʼnFЈ!L5)$ WJvdnQ̨Qd~(g=u!_SjwWQDܐFFDS0~O_/(ؔ Wɮv}S$^3\П X;^{N+Ȓh"( s8M. " t6NnYjJdte7p+T=Ki vҵf%GUpPC|w̪-pke21e0eكMh7̸a 3nqÌo,(i<{4D3͠2~APO }شs@U:(O+ m,=*R%N},X 5q wTiғ"QC=LbM*o"$qCtu-2PgeZqcx2l^ǍbT<_QhD"ڳrEʖ3AXlN6 f^À0i'j/1$3 x3 D'Lg36-G=KeΤ(F;Vqʿqlb}@QN8YxNR;ɀLBI t`C ɪ3gxI7r[&˿|WgJL P$c#!ՇH[(M# Qv /Z،AQ9oـdԪ_J߼ o^Oi7GXVX,g)(_k1Gx$ϊ:}p_BeHgyj#6`"[HQkɁ\\lX @##gbMSlW>;n ܛ!Z&O[BTl#ZILsB^+h5jٱB&Gm3vIw(<3ySU`R#$ɔLi-)RҩnJ9f]qneQ$h 8⊈p%1eNpư J+,l  Q5,cG]Jlisd<FOrZ;b+s;5 ^~c\8P-YfTIX%I ,⠈3.%; d8J0D4.2o%+] IA/P:%g=HxEpĴ,,Jx ϓe~+w3~9kȌ_ TKD gOH 8AJd6*1ko:)(W '렕B4C~/m"JSPG}IH|&A ~nAGEL'[\<` K-Z@(en&eh* yUzuiE&HM!nfGic{ofjfZ2"# yd`!G{4!RZ`D1r`H>(4btV8.83NbDF1ʋN{$q mPaIZD`&|'ZHLD7sT> Q`Gf ߨ>Se6OzDI쩍Iޘ~0PI݊R1KP| z DHKrҟ<9)B>=Xq(B̊I,')0aMڜ"g7c: KT 6L]C^Vb? e/}Qэʖȕ5Y{I1qR-VbĜ 'H(O2 +1f u;k<[WQ/?(vV{c!F%=X)m\l6`[w9PaeGr  LVz;>y[%»yFԧE|K ~fwʝs!%x/?ß -p7ڽKi<|aow7zjQzk{,.cCܓ_ K[8&kSdJˠ}D}JK'tUE?pA2&H*  qvɂLSP>&1≈#X:Gù!О183m F=Ev  jCSQ'ݘQJD=6=L/8ik8|%';p,%W1lv٨=S3'=ƩT2$܅'.@ cc5[ζɤJv#4]#&>Fh=ߛ &n,/b*>n|x&ِj#Atĕ 8[xMB<'ug:˟J }Ra>v~7t6D"FT5ROeb2d qVcȜA*O#kCчpK:dEA؍Ry>h?<1r MS|FS<v v.ڨ-B B#FO3\Lx(-Gsg&ZYY8&-HJ^ nZ@.+/ #AsshGc6[mX(( kCBk$&jzd&#FLZ #VfZȘߜ|46CmJkY<*OΘ]c mf 12Ȃ)qJa8/ZÒ`X`ʔfp^`r k &M N#LeDKcvLetG'?lmhLJ=H ̌S!:ږh LLBI::S\B u |{YυD'Qp<%I@U {3 :LC,~ &?R1iN~o0)1NhD̤l#Y#@{d|e񒎅(UJxI, /1A|7R~`gފKs3h+FjKukh}jY7Y1R¼wYGV(O4O&%˕ Q4+hO6g`:JF|Ǯ#9_E eb!wBRvk 1oD$cdCb} pT`:9#Q-WLN̔Uv04>/ȝxt>;wѝxt'݉Gwѝxt'݉Gwѝx1;nݝx5tcv'}lN;c݉GN<Go~Te%4~7w |g$<~_ß儕A<=~ӇDԠh">̓z%O:BZx˲>}zo/-Oo?%iŊKrV ⥟K'ee8>J"tDy.PEqq?cß")西[]z7]JirI-K9:D,wObA_K$mMe/Tz4_gqwj !#drLki=TTy{ ( w!NVwvZ?XV7j qg^\VDIzDwd Jڨj_շRxҸ./dBJ+wƛ=߬|W '/>i,4.wY8Khɇz??{)ÊM6\o7{]{^4DOC7ěݏqwd]^N~'mfY$)/wiqcgۼGH4^O/Mo%Nko^?S]ReE[垔 hJ@;rQJ ~VVk81eڔr^}[A>`uǎN}i MhKB\Z˦|kixkH?+|6vqb@g_wײAK[߸f:2WVmBaփ;cW1ULgƗ~MtQ~=͗Nψ/l*>eMo8@' lYtGTx5lm Vɋ6^<&gBޕظfZ CW]1ooY}~Vfߜ"!`S}4d=,]{ ]mxH5ضa轟0r{6}󲎝owp5ñ~ Z\5zArR/@4 !/'apK##;8֎e[j( N9 -?gSRu\} x& 8 3 8cmus׿[+>]j|ҁs1 JJи!;aߓpuvhiy8*?;F른j𚋹:gnSò씻h`^tYmVA l|4섆KsI/>6$%0z@2vPbc{~ƙ?1A]j#ېW .{j,2m(KQf4[& ~1#T+TrA`0?p?ϻpPs^a56g 9;&W5BGTg\WI犠/4yirC7fy (_ q3bk''IfwVwW/x_IBW(ZEZeǧ#9=Oس%Fj? F}f72 TPqPeXc-M gg5A'ZȢa6nT{iG> 溔vx{-e5rsz`jV g;ɑTaNBgd]Knz)!2qNbԳv:i̕?}yL=}a]MYU5=D輳3OY]C̥/~kX?~PtHGZmu/]]-h7\-uzg_Z])CmT<֨=j7t? ߷heg4)v_ :>Y8.h5lQC4H^GϮb?Id jrxL} [co!FZPPo(3!.ן}ԬiD5\'+84Ҹ_=kT}_뵐{xFJڮ\@\xiI =$"l7jh0J T/֐EUZC'0AgMV3jn2/4>_$۔u:,,󠊡ae;G~Qa>p|,=AODFI}^mwبZov"mkLO\ x".}ۯ PZJuɭK{vJsvmMQmp@Ti/%58LbpM;Rf^%eUM|QT 3,sjpe%Y}cüjpYB`?\^݁݋B&'Mŕӎ#Еsw_ʹ<ֻ6.r.n|&%g&ǹMkGfƑju>KW`X',I~&_%_@Zd ԇ=Ӂ˸q8+M 9> stream xI9&S 9'U/zQptf`Vo|pR1#p*IH?Ƿx?k oe-om>.y(q?&_9ROޕ?oAf3RmY ~71kJ1t>s=c%LJSСtWgmb|JS}=+؞R?TS{O*?JY峧\'%4](㹴XRI3: e8vzKklw?s Zƶߤm(q4-=Cd?6{ղB)^Y9cg {}X(f%*;hϒ`QSzgɁyuۨܺ0~VO{[-|4JE Vaö,Q,YvV%/Xh|En9G:JN%k͛<8}#Jqn̂0YA1/#Ky^ǜǽ7ฏyz}0c*.wő%<͜7;18}#ZYҊ#o3lMh'\9^ˉC JZ&K=xY1aO[CA\} B"u 1DuzaE2= k[m>>i3߱g$0α-l;a6Td >mX(CIX"( 8I]'Ec& fuDvq1NX]ݝ 瀂%1|_Lx|q7XJ"kz^Q [Aټݛx(8O+OsH{Lcp -h^5\)ȅ>qbvtu|Wexөj}.(֬g8X2b]qK3:, 2(6hj( q#x]MlviMѽ b8v`4 zX ̢(.]T8ԅ.ܴ3?;Pè5`RY&T =iʕosf=+}KlƱr{\hC;_րZ.Vc,ŋe,,c;K7NS+? !:g_RVˡ $Cb8*u]ep- #%b1^$fHEWj}D|!NeY.؅mĪ|`0'nڐ~ayl\a50:ڿhF[1cs!'BOC[[u jA~8CTT˜7W*\{ ߖ,>^ǭ9}c iS,>a?SDylcۉ|֧٠' tҚ#顏}_91QGC}|!GUoYs C/w;ǿm9˿צoS >(}(>cFo],g̩霎(Ģ[)QKZ!5c\CkD8q[%0˪Ū968 hݩ(\ *\7.T_O;WvHV.X.~ö/Txcdq^']s6jJc0AҲwQ0R ' [A:ge^^,&~_Bޢ?i {aCpXƀS k^iʙkT!Q5=U'5JA~Y%c6O;]|һ_[.]m~~.lmmFDBw(s&~귴 $mI\m8*B gmِM %\J{mHw5~QsB[P9ˢRȥ5W>^+߮s%PXr3O8x2=txѧ˲xN$*lnKPx)!0sBDkf89y\bAK NXWI Ɔz^5=,]mQFEpeD9P%o.~`|7W,M+8EO%FI,I[2oD6YΣ[)%2rgD ؒY"L$AaL kNV9%u Ġ_sKY"ְM?MRЂ:̖|CPnηTؖ-DZ GqQВlUl&%UG۬%` qDj ) HJPb*zL۬)( "CXn*-Ԑõ@Q¯^lphx u>R]ARy?iMt!_,UWϟjk5KYplGXoS31f e V?j >0^K%8(yƃ8mɫ7qhsX%OPD5`(:vjmZ\lT`c +60̆ 8'E.(&54,L2buo+~~Q (}@ ELZuؗa`()fQlA`5G Pu-Eo)k,8so#"V]:qt؋륁4n 29^?-V"+)Zq#1ۺb0@b*٘U:T+"7\դG-Fzqj^1`ue `LMϿc&wpkZ"wXj;&V%8Xkz1HUg8 .FD]]lުS¼M8cj]_stjK[#ǒ 8Xp8XlDډh%q (M Qsk 'fSkGYUJlbf1{V>n^ 5:/$ j˼5;6i&INdXts; vv S\丮f0$φs?:˶0s;6s{'k rH %p$^ ML!%7јU +XZ2m5ZR<l 6Qw NU=j7q:K }D)3@mOLk#"am*+Q>fo#5WlVl:ɰh#M_Ev<&n[/mJ@_@cz `m9i!̘hӖA;kM/񈡳Eg ܒGcxzY_0nvf;Lb;%qY5ьɸqXMU$b`LL#L,qİ<[ 0tIDW~ n(-`(Ln}Gl#C~7! G|GͫdGn6؈bA?g1cA0p3O׀(*W(dL},M"tNx[hY,' S uB׈(ۋ)NPLXd-xz[q"Qdn\Sz80rAֵ~f1֊(vmsl`-m`$pȘ6z.pGpf G8ی08!`kܽ}DU#!1E>n-4C7~+^{˫E%)u\@v7M` `g q5b7f<*JR#6iֶa_#EϢŽ2?haW%sHFt8VK|&.T;e-ހ#8aw) G}w4!dߙ&m82LR<0S6.WƵܳ7XLweƪXRme=I2QWg"[ piѢ0 ?_S{cS2`bTȼdyb5tA. [[hw)̖$ex&rIM!;ᯉ^ٖȻonCK]h|MI2/渞(Q׳R&}2^Q,p|ga (m0 wk8WԶW㏷{t׮"-_K66{}d+ɏ'Co<{Woo /886ĝ}2H*qva&/518j᲋dy*8H|C*80 ȻR%aEf`(Ȝsv%~{`{M}ΒOݾeN{DuW[ppd6m40`|&ģ*VWodQ?8)9p4K4l c)p꯽*pLhrgm {EK4.h3kGƫ{@t%(*l2ѳ kC tS}#J}d1pd5K(hK7wB{wӏ4i.-ϕ%LCW=ɉG?y=⻖|lo2kEx"c}ҙtOsv%8I$ #!Ξ,"lB pv꫷{wMӎf&ک{c/*LB Q-mKz~>%EM1΁Ԯ]T{bY,H|‹D*L ZLu߱%:3ұK)b.}K'=t—QgM~~E GW^^|oOo?wZ+Scfi= i"  1=*>@>حC&|A"gh] nGGUT߅΁>èmk`mi=+`0݅.Ύ6n*d/P{MlФiQQO(xdQ-ShGgX@.Νx.tKFzBfuuy 2ZTMR}6t]3 h!`) mU*kJE<Sb#v>+^l\&61s](zVv ++cXohDCM&F[w8Jy$(Sweaƒw䶨%>")bx:5bO6eg mrxIIH!BzY[A7F}~fT5^"u =7ޫz<ǟ<ҌS6P 8 2BH ]ȐK9w;O{|x >IYZc3tFYv|2فGUih#< Cz\A7G=YӛV{1DYyh6%WoH߸; zmO蹍3L>.l#0O#;7 {i_J=ѽ*͞]d9?Yxzyփ<.R1>VRٿ2(ȋ.]4ϓ#m!PrJ\X|kz>Uk~Ljg <8Pbcoze7A6^_N&L!tB3۲}Ebgf(,GĞI̴y,b#*/%iZAqcgUwoq6ljPNGw[AA\ ;;ÿ;̴Gdֈ#ř+Tef%" =*e%6>ޮޯa8S\(4{T{)Ah4Įzܝ}"("7Ie4EuaQ0>6CNǮioqe_TDKR'{5]8&F%h\mvf3TOAAAs-O *d餐TkҔ`²3m3d}FI#}Y.i ȋi\URl\6J23PZNref 4=% C$p͕qnF ̔4gPr $8gHf4)L!wq &ArOdD3$kϞ-"%%-kES{wo9gto9A6a=e:E/ПLfNO6#\jO)|(̾z}#mɳ0UKWHv 4&F[L#c4(rU0K ޻҇9Q16Xt\J8Jԕt+VW/9erLue{M]&G`0Z4-BZV8IPzdTs"AK|#sWZ0SJPcjL6i예6Zz?5N"2Ex8P7!CE.C™CӢՖOG3Ҹd ͗V]'V^Q;-+4a^_sȒ'BNWpdY4c5^Re3,=iU϶hD{ЌG1D7hCO̔)LX^ >ny(_Z&|xػ&|CTt\]^_oAo'hcF!=pXޜE"||wtx!hAAnfLHo4/./$]N"B兤M兤ˡiM!xtM}h*]J@je"\A3`B3y&Q7}ԨXt}(_hŜ5*+}P1UWs / AN@#1f)n) HՈ%#ܨGwk Dg@3|n۹?hmai+yEOxA <6MjD-{(T{2ڃ|{[`oSQI=f!vN)= hЭ(jVMXi=LsU&aj:^?ל*Ny inD@ YhayT|:6OjpCbUA<.[qXuFYv) }eڣ@3x?,}ߍe -cg㎝)vgU 'ۤ+?Sk~ .x5g TOOe@T?V"x0 `j*ɠeƍhs*E&^nuTkuO{JI\sxq6܇ռK*ng$z z%ͬDe˼3568!-@\ ^qof 齙qzo f @@ JO͔vjiⰿr"ˋ8/0n]FZyo1q{]РY^Eʘ* @GXEUNu$\ ~7~$\oEykۃ% 1zJBxzEOQ^DaD% uq™ (,4LC': ri(,l N[[CS :Co!K7^ xy,-2q&7;&CW"ʜ"6ft,55RT¤3f$ĺ߹o^=d ڳwd.Ɗudm4p2[U0b^4MpIx>+WoAt+ֺdMD -!0%MN> U]!m.YG͆$z蕒VU% ]lk.a,lhB,A#% י6v9 J_H RFQ_!S> =DJd@ޮ59EЍgP~Bsi_ɳzQ[a>f>7@x.FԤ 41Ϸ[/uH{#9;F͍8@ VT0h ul9=4ιn[o 1x9yqUa错Ef]fKd./aOkxn0z%ERӻ+YZ^0_ZBCweU9ݽ PmsC2淵k>cZ@B?`,]g6mu騭FW MLZ\ϦUvS.)ɓMB3UӿKh!5bl'cOqEkfB_[򄷀h#F4%&M!/lsQcl p9]4p1SHʃMɟ=Gx r 2+BWjX`| e yA"$lqT7FّڴxY-k$D~gygN 3=;KQ,qNxٲ 1Tq1ZFT{1:RRSF b[$l3[g1@XSpkor^(OkT%3ܔPw2o %}w)^LY[^d++3]P+IcESqTd!y%Z>"ѷCW_X w.V~sųω++ ߃wܾpE/ZqmVa$Qa5x #FrPHPK$M-߄ jj/Zt:ϼì~Dٕ(hAD[ވBh6΄f`I8>h;Yhs=ml/ض_.Hw&LKҷ&!vh5YҸV- y.egN2"@r%U9S"9.q|?(Em1r*:!g?bW>=QYY(}qtؖ1&i͜&ݯ{ΟHwˉ07)O^dJLj$EŨ;;;oZ{#cуDO-t~YSwxOrCp-'FƈӠ63QөW=< i%?}J2iMp^Jp,ޝF ,9e"ƒu$XK<_J<$?3ݸ 53Kxp3'{`j5pb~'I9)NO~;oL3 ~'RguHx7*nc&ۗB< ox:r?̈AJ\;6Nx<]e&C76Jca[j $ ^ŮHQ3.{:aGx MǗMO:yM0r JYnnЮ.=zvOw 1O8n)\p[F'\f(lJ34a=<̑Hy.Gkj ͷh^h|]X@ KJfT.T(9,>XTEz^ b,u'5F*7`إ]g-[mD; Ok>ȡ|)llgyf6{~l𒵪XGzQ.,"3o&Oє/PA.$~oO8$p~]oݼe|\Oǻog1-sl0}wOmS_~5)!"p7=zp=ƿiףi[u ]yeFVH# J`m=b1l{CN5ȫC_0w%sعRF;zdM MѦS!sMl3r8t-'$!5IA^r lͨh;w\̋QV*J0/Fr6z>-U# w7h˗~{|Pь Hd$a}d}p 3nV]䭤tz:̫wIbNtv3 nlPo#8 Lo)߰9k,*\*}ۺKa=9%L~ArW&֎O Bk\na„l0Ĉa 1;k&_9s˕ݘ9v2e pk+boAxk+'{ *Wz i͸tTOuV-ҔÜlz棌b'G׳=>I3MlS-S[$&gC$Nf8"Za0ʌ eÈ[jQVҤ̿j%Ym;`c}17pҡ{\ejOc> i]Ϸg庋IWĮNMVb>;ךLu߻ -:i/U_HߘsU^3~vS}y.| U}C!7w`Y3vU0-i>_;G 'λ\FSlj^wx]w-7Z,?e!JEAiΦpڟ8>l\>>짷h w4ddSGllg~6? ӛwɝG?n='_i֛$Tu39:M -nD*,ד%<6!D hBne2DZC|1@  ?a'FR0 J6LD` ToVo ߢ>}#R+A }pR_A/p>HLƮN) j)i XR&HNJOJmwee>"E/N8Lc]i,礅~NZl/4%VЌ5bj _vVį%nQs .GvΙ,^s9 휳rY]s_Ldjβm9s6^TtQKI-a.C!Q=SR=Kd.G3 R.UM,>G `zCXc>Flσ^"x5Ui:\*!arhEi} \5u74LV0+x[bT@Y`ҷ ~^DzMI?sABbV叻jZIFb;J$8>7v/#pfKQ"ɰۈcގXNfpL m%(~k#cW ܮyIeDrY=UO&kÜDh%F6YgEؾr ۻp"(xZ .`L>T:,U!pI. C{U6^5uk8rL27 %}hQPZh^񻳏{wd:cBg\%>$%]a{xh'Y}}Gӈ`_MjpK#%F} b?;x|H,\Ȅ\ظ:%jxłq4S'sy덳0J4^A$#E KYJZcFmx0woog5`5+{\J2^. ;%^ha~*nw<5{o`kDt^"@󣰯x,-&l#%mDˠ>n$xv+%cI]Y[O_{ ǍIHm}⠁^}$Cf HIwv~}B䋰LU= T̝jT+Ѽp膡H=[8 ]z_qJ->V Gdp@wT+Z\ &Y"MzAV(#>:xǣ3CR*`%L+!ϸ,s8u{@v*CX";H퐟м@J 7[4爻 u,9 _oJ'o55?skZo=j5xm2L(`өhi%"%v8Rc Lxe#p SQ&lpk%<8DžJ>T{zlDNb:%yq07_LP){5Vw~;.Bb o1OkGgt]!֫%;Th-9`2kQTΕ87DQKϒ|Lc共MɺzMHB *wn ڻʄ%z'x="- @A +z }/˧V Nw&O YU@tmDSMTia$Z#oӉQC:3Sls E {U k܂RW}'#f N43uҪ u] DA\Kgӽs{: y#g羴c?#FuP42E8WQ,=P7eO+m e/k/k/ėνέpnh>~%+]}DQ ~SGvfׇ餱xNX% yT"~"W*5nʌZwyՄifP`? S)Iž?Q^\5sZtM^,}iѓGݼfyn],43ZɌ |?M^fi_1jU)J#m-pHs@U $ͦ|iXtvكǚ{*Nר.JVB SUyYvu 1=翶">*:~E vz:L/IxUUWz#"^ckwfk7ჭ f`}U1c@,3Dus=.8H!4&M6Iy$XWp %rT>n9LM 0c 'uXRTg-Tp'xC WS$e@t<Ԃ),X(XXb3^Bw=|-ɌDDs4F@1L t5QψdV+&={/']C*G{5Li@;Ɖ2%dM&6s_S_^dSfr7/}LĞGiGeR؍}#O?x)*V,G(HhbCrf=H6cumL^HXS7x7YsI&S(/Dt1Z)[3U̙ OGy&MeW9sܚzHvrtB$)4~H߲O4MW4Ç$}6&K9x.34'3Az)6)D)٤eŔo,HYFACω6itdaL3Y=F.xCSK4GjԩӯkU(_aw}Os)ؖLsO!nzN)eғa Z+Oxx~dE51a8g؃DpY}+ , /hDl#wlt*4 bvSpTeO7Iꑙ֭?#u&FQ%^ ~tS!#^Ҷ7X"f s.;3ΚYһeBo[ +) U` z￿XBP DQZd>~u7н,L܌6C[ه{ݫb\Gޫf n}4~~[% Xť>[sWt9#avSn zG4Xccz',Io.tR xrp2Ym$8#ڣpSO/+7 G\S5S,%0br\TDMWpMfz䒔&\xj1y KeH8<^FSX`j͝=5Aٍ|)F'C9z(;8)mԮmmhH=Ȟ~X lMqm[W$*_`9i-ٴؿ8i,EyS[qkmO牣y1>$F72!JX0 ²Qcٶ"[OR{xT2rH 7ސԽ%YT鋮K>తKA7{j'6âTOx2p[KrNU?ذLȌ~@Ehԇc#G1s k k ¹sEPot'-=n)@7pLXc]-遱>s|ëQ_ }MMp3M<*sW"Mk:60P`m_2oq;4B4K<DEs~`&Ur䦕]))}A}7E_yϲeο585ޥg~=@&ɬ9Ҭ/87dHƇc s쩮xP`ܖ<[lq* EMkT7ބ0'Ze_-mA%zah`9jtq \KI4&rϥgR) 7{ğ4W5BLeQ}2]pX;-<f[ҢHɑaꅫEH85=pƻЉFfGz|:mi;mpC_Ģ0m-9ˆmqC<{9MpZ-b ZC 7Vާ< c9 gܧJ.p jا3'o-jTF`,{y[׀Aɏ9 @XւY9XCC{Dm1|:Z٢$ioRif<ӛl-x jӒnax] oWrD']ɷ綖 i\ZԮzs;7bbZjfLsZ2 jL":i9)iQFBca)`mA'߬RXhQܙF 8 m-}(sA$pOX[ z~a) Kn8Xb"?^Lx`VLlkdm^y  7= pY-r>{S:[t| A<#2;$5"; .dgid:MNgLYԵȄqatYsFBdyV ~V#'Yfຏ LY=;ޭF6[ZU#=1$٠Z^Apg.]ww[s{QΤբnQޡ*Lc5Rnp22sT+ .ېڠS[3q 7G%oj+ fi#LA3kj=8tOT 5x`4Sdè Em;l`5HdVPIM48ObjZF'iQGEHڬF9hˇFZtXc(';mj[ ^V#ʻHf](EّJԟ'Nٝ_wY78L[ԲW#- WV0ū5}P=|^ڇyjE>(6ے¾$1{jC! ʽz,_ ]I;)D aN[ 0&f( vB0IvBaSgSo _i΃aj}?aj춎;f,Ek>X! jM,Ή T/3gip<[J9ߐgvvUσڙKX7R;@!#5́lpZjU\(WBjTuբSX #}p-TlHV#7\>OauBrHSSP _!PI ӫ9^|uLUQ"߷KDޏ-GcqїP Mxa=؇G39JFԅ5zA2a"c%flQMV]ctE&Gc&t[3kP5`QfV"t$ݭE1 XjP CpQ^\_2(keF/Y:PcTǀB6`0T-s \m30ՐE ֫r|kQ!f;c㩇h*ZFz"JFqnNMIA>>pg2*N*Au{!)k9[dZ XqHmݰ}M8Tz![gɊ2AUg&\:Z/n;R-:\gG:[dF$"o"n6g-[Bc59UvjɎ%ϸYwֈ; y l]X p-j}DIfuԯr&`an jTJZt9F`p[3 r$GG܏CAY|"<,HE4#EىDct1@߷/V6;i:[c%4bhxiB`(3ܪ{ wʱ"v]i9x}"փA;ȍrAi&2IEޘJF 媫;RV!]ɩC6N2 6ĜxPB+ SGBધ[:g݄l"l52L0[ - [ Kg Ղg M.' єAAVOQq4ᶯ7S\Mw7Sm-jGUol;Vrc%7ωjƱ> N6* QL;|3WmP.̜۾[?k6[ pߑȲM0)#3P\8ǡ_FzE\r+4  LoD{ &|jz4 0aniGΈ#y=J{lh$)n 9[1J+ 8[>[ĬaNh\:n x櫲`9En5v`0b$>#rjCK jLVg5p>v/BV~7Ѭuf75˔:ae3Պ;Z]}R\mZk*rGh`f p+4l:l2)[5iaT'lB./Bꐿ=Dž/}4EJx%f,@2 ߶6fllϙ`j<8)yf%E%_ X P/fg3VGMŪPu,ZAEk6Ǎg/Z[gۋp{Ž^AhEZcƧZmF֒wSǰ=n4>y:[/ZcAk Vϗ=]ѧZjAk-ڧ­?.$>{AkZkr[Γ`S7۫G`=h=JԾ>qك5GfoZkqxV l/Ak-ԁwك5Gf ?hfhh*WxRPd{֣ ޳FoeZGR,_r Գ36PKF>֒6>`\<9}ٓ5Gܞ-q<<'&X`2㡙Z{ gY[o{q{Z?-8N:&:_w&:?>n,>{Za6hx# |E9(Nz(րcC񜵎X笥޷a;j6ZMw΅gZ-ZҜ gO3{!q`Qގ=o/Z_{ ک/8Fb5Jkb/Zm_5u_Bٷsp"),ǒ?V+ph_ hy@/y)6hjyЊ[t2wHzqyCkH~h05zT ɡ5J34+,`1܇ZdB*bLXKESlPshDBv*Ђ^+AU>-h4ϡƬZ3X;DW hCCC~ZhΐSA0|mg살@hǩ!Țe-5kHFJ0Z]t=!n7jL5S;aU-}vM-6CЯkЕКD#-3EDc3'QV1"( eoMQօYPx)R h4!~VV2T<-VK8d$6dD43x3q%uSaW畇)8Vl^%mylt6͓5lS +3s[QNIV*35¬LBZ jܰj*\ !jibRln}W w^kKZOBB,I*pūԧFW/CêZ/ksНi1y6FIZVhAScݽ=v`KNV`^C#D/=LS5-U@ob^Co.Bz5ָc{vynf\jOW2zpsBɔY} =ZfX&r"F7l53 `-=A[w^Wk fߣu kdjq` |>vjb $-vGr?FϮqR,|p`[@)z!H\bqdcG+vK PK6Õ5Z +o5Rkk)uw/Fv S]-v<Hq<&XJدG _3kI&W-6Ncڇ |A*+1@'bkc{u7Vc>#zEfScQI)@ ;5tMFMwТk3ݩmSb sHjlE&Hy8{{f5Fkb!kFѓܛvn9^g(#=߯+8X#D; (XCآk"o5[7'jqN{d-w淌|(SP9k xF/&e 'Yڡ5\0R7.z &2@k6%̝F$ZȎr'ܧYwjUO&Ak lQ#lӐ=+rFܬAfZn)긢2iP3Oߥ#.fRB.mK{ҶsaM^}-{h?ff*hLd"ݙ.I1db54yZ[>5Ĺ2xIn!O t U'<ޔX# [,WQ2aonoQ( U<ƊTO;Z{0 x"z ?)鑨ԠDlLS.3p-VjL2NwA-6ՉVaR:/ijHBe7Zsª'aª08SL[1Pʩ\5PʩUEɩŕZiX=gFhԼsj۵DTKv[eBUTx XCx~͸*g, O *XdF5J(5RPcg+p+h?Vb=^-jj1u++edfz踔loLj 5YE4D SWZZBrVwEfZyg@J惗_xPz;E?Kv*2fu6);eNMq SJ$GK~C'sqlݧu؉AݟѦ8-ŜCWeUe1t}P6Aoy%& 2jvfhQH!S@$ԝ3UehD]hKQ]q`xCDzbUMNsQSmP) obΜ&cdaUt׻J D4 hh06'X9)-s=6LuY $K(\҆>P3sX2LCz6*|NnO ou7qN@3tܛ tͩVOgR%:0Ž汙g q ʃ άe%vjWbLZ RJ]e?6_)w֧\ )4:* OG.&J8r:B>Hr29 @!RlV<&ʛS+X"R [ Ti2 0\T”GrYNs@X[&S'XURuJyH5 uݜ&hjb&\h@`4j_ ZI952%"uhA=!e-jeCvzPTvi=V~UF' ^O|J02&\5"!WF?ch WYywB;=(){Q`ǰ*pAGL@ߡ yZt!i&GآtjF;Lx=rU^Rdv>UxIF թd:y㢃pJ9b*㱨Dmߝl#.!J59֨q13jkkKD. #  w{V^Gb-dN$rN)Մ5!>stV_,e88@z!"-BPC{b)~W)+&xj!bݢ^)&HgμE- Y-bbުݮJ١Dթ*Lj#ZGoy|q43ҌN`H3Ԁt[gbi2[կ@>?hyF7K xkw}҂%-8t3>M..Ǣ*r ՚)_p֍LGB ҡH\Äi[dhe-dL=32aoͨDpR8SX"Ps[`-Pױe9<_"]uHqح 6"-Z<*p~<ҒwL1|@Q^-Ο5dnc ;"?8Q)M*Jd U ?l ^=  NY6C]5T-*6Ij jͽLO& =l7z9iP|a!ZBt]פ~\vBڡ@ }ft7 tQك8}wAӷ ĦL3Ii^LF7H \d@9dbN:t{B${Ra 'Bw~/*@j^TfZUCe店HlM9 +\-f]ְa$( p3`L9/ "03m:'bi7)JAhR!.}A^A/764d$.]HDp'GfIXAbD=׆!KGaB Lȼ>&CU$p4 ]W $2m9JE6lsBu[qwxXw:TRy©cx\YkqU:^/6~lmYp;N+58Vb-Dkk 1>&ql& fdZ Qz֟-ܝjy߯AtPjzPjQjhqJ[j$ɋJ !BEU_dwY zvO{l߮.J# 4"YrF#]ڜeO<>cD:z-Ҹ9] T(3ʊg+cTct?)3jJz-F ڌHǰ2#vk@;IeFc/ʌXDQmڌX(u{*LEF^{mQ=o T\$kTF -fZ}?}"=XHR5[!.K9\ŘW(/FXq[ʀ+Yac<,8i1)I/IO@4 @ߠO9j_H7(ԯ1xe&4c<(̂k: 84ы> yE7Õ+% -]4OJܨ! ݤFc-~kɈLTZYXPibb7W I}H;,lȝ/o"jV3 o0Y˄cD2!&x3p#F2~-$9[˫b)o?*~R`<^[kƧ`ݚbLbS#/AXkpME:mn6=%RU^T0΂])~M;T#rYV\Lћg*$軀EL#wt+T  ԾZa4Td6p?(5ݴ;b, Mb\z2B5e,ot)~r=Ȟ$< V\h@G92n>$cB).s &Q<6oA~Oh߅I m t/tt~/iLq ۙYV2~; ifXvh,6;aGoƜ.Eh I;Y2NAɘӊݷA3 3xZJQ";'& y^3q0{б+.;EO u@bGaGl+MQӐDg='ZP_ѩ@#q9= :|j3̴cۼrz95jYHڡSX'?u]-lmrIdo[jK>97ӎs%.c&&8=Hz>#By\);l^ٲhtEDSYrb rdH+{i t Le`7@aH#X&/CkCљQ1ute)t,Ux^hOddZ  6F:8FPH*8fWr&ӗhѱ7SoK4Ĥ Q} ^.O"ˑ?oya}\5 4,|8.Ӱ EkAX*6PD 0 o.٨㗩3:BEJJeW(D a2_NqaŁʣ9=#Hrxj]Z_=)g# Sݡx)of1ȡSqk 5T^ti2dhB!xw 4,h;5sk,Dkݤeu3>ST :cBAK-|]TI9lJŊ5MgЋ񦚼\a)X3fl7$AʐՎli4f8Kt$/ɿANԸe1&1R3uPRYm&)Cf̜9/Ēװ|Sk?M;Ec%9nzܐz}> WUacҗJHekFjH T6R#,_#)Oϧx,hFf뽔&[,ch }Z,4iЉtN)ZǾ]Ca:MBxx6,2+FޜV]Y$hUA Q{?qҙmXږs-ԼvwRSѱ埜ϯ*_UxGfV[UW6 _Nw~o86{x8Wb JzUÞIE÷=,F#vk}x}VO/邝Dtb3ТUۡЂaȦ5+ j/60@H?Sglj^A,-  6y,zrKKp\ pcj7)h"6Knf1!&+3uYS _#7}M^_4DCrء .-?l_mֺ:rYGj7>%b6?'w.|-yZB׊V9 Gpc=8c/n6~z%W$HFT9AU]+Зul3ډ7F >M T}( bzw wEJ>5)d&nZ ^z|&9 JOY %? HRJ hb ^lwtO,7Mf%(ҝt1C n6ꦱWDF~aC ^ru!՞`.:cc%˓ Z81 Q7[{>ۗ+~Wڏ+~~㊟7N,U]4f;eMBîC mDƒ{uՃ2cB(c=q6u_1зз/CC?NQ1%Nf*5g&xZetr˭xRu;f-=His-"c Y~%';t\^m\c,]Hg-$}<ϴrT:_/qaa2W|}v+߆~rSkO'gj˴cOG3Xxv`5_ &CuowqSkc=˸Ǹ?9U~u`Nnw&t9Xe*/vͥpxR[^ !o/I?]E\b99/ssPڷ`~(~qK,rol\l&3.3=v2}x'# ,S"Pg!X6RM\B'_FIw7/r" oXU$ZNZ"N"5h6k)ǹ-=k#{R4e:JKtJ?iwrŝaW͛'#^u9/VjD@lcqșrr"'[N^!(<JߧTIo*.Fv93aw׃eОa_0YL厅+ܰj&=zf*i9#fїEkAPvZoU j@Ӎ[ O[{qщ a@ZfۇCPGѯzg/RdIv ,jO[x8W_Ec }ס d_I7e<1'if#Ǘw?ݿ0i& XX": *{w5DW30y_n^;{u Wo458|:FfttgAZ\x a  -ٛpW6d0^6otow/>iM{xhׁ[;颀vknom¾9-$vN-cnhi?/,`:g0z|$DR#omoH} ?zq# &}z0P lE`+&-Erg9TZ U8O{うUHIg7G훙%nʹ! ƧP?l&;r5iD[wqJG ,x?qD;NaE;Ʒ ~aZ-757Sh&6я&Kxf7ڳ/ڀ=%"z,h36K&އ~E>$yɇ:khlfdn}{RƏ敪[_ϸzXFMmv|F׏S{=V]O|t m4GyQK9[u:j8ُFVݚi^r?T4:Rp۬gWbJzS~<><`Oa zc={1t~FL>N_U1ԉÕ]u'MI9Cujpv44-(3W{"S8PJ֋/}=3/}ECLf-T ZW/><_.Ua07ho OTg/~>y XhU ;YhI]`T3; Iƙ81޾j߰.y"U1ÉvCSJWa[qE }=lf{K}(ЮqmRkxj*G=-4u[{b{ S7B Fa, z{}bɞ.5L`v,c*"ntW?y%O 7_z*;_Ȼ3q%F&u#ʳQgU7tx{ lCEF}aC&9dVs|;WZ7&ѭ&?{'YqZ̶6yr`OڂUcџGJ >{0nsRvtm"$ȎN j><_GAA7J&cY2ʔZi+{R mjK`~DEi6ZU%?L&G܃Y;9FJ>P2C8ԟGTχQ/P) zbY鎉^WEbF{yw#0*2QV/k\G뙔 02b`h%zm,g); gYO0y)aal8^ =}ǙhoYﺵe`5pu4zhrd;`6J.[g^tz {-?x m>YQb>|D^xdC7Z+Q~+)3&Ea(rH3MF׮}xK祤::n8'J{  ]ɃHӧMяb\,הc@gήH1|c~)݋ǵ:} IS;t|.b. Z7ǫN\rmܢO6IΛ"Z+R x8j<7YG_:5p2gJAc,Hc򐕌ܶc1 2woDF+i1C:Eq }ms0fނ%rNQƅ  y$ @v;#uc՛~zEpKީ07ЩÜ|z{b-i;8X(nU: ,Geׄ,Kg4ggϳkx;pf.GІƔ]D@{ {X>%re!.,9~=zHsyb+|>7Wg+DV\` 1[3tZ9V6"1[7~>lЖ!4)փW8MuW'p;`KSZTF:t]^K&HQm]Ͽn>e^N8g9P3$Zr TTHqx/%lxw@?9OݴfvG?.iy_Ѫ%)JHPwGiiy7L1;/ 6({]Ԓ5;nj>э˃4޺yYyeIJ4x?Zqxi?o-7yg#Wlw}U>j]kxDJac2Ft$\J9'9"8^C}(dMa;TחhZ Gi%aHxॿ^kK8D{JN^C-KE}ifGBãyJ("hخ!_ңcX9 ]cX_xQrc7YЂѣ@w}&~tח>;oc h=^B+͍XiKT*3Nzè /^n]6$vD<{8ƳPt09x{^j1g\.Ggy{y!eO d$PYaQE PP-ɨQCOӆ9ZW, N鴁sg ׾I^T;}MʪHXnYDȱnK:ToI_ lMd)PJJC|jZpL,nԬMrV:H5OP(?-3@AE?S}:$d b6|UwBˠbuwQkf="Mv6~F@]S୫&f .j-#oS_q ݼ5.$` sXwa<@EAZcI,4EWѸBhVUפy{>Mg í. 0#.`0 Vdk jUr.Z5ʚ1Zg=*+RQY dvZ SRoBvLwP5 (ôKQ_ЕָxuM|3 'Nb옷[5% S'P8E?tCL+=c1[gO0vn$+Iԣި]CKgNue q`Cѕ1P]mhkIGb%xC}z4%,G=Yk9 ^trn[-OL "N( u}w@Æ߰|K湡P6m4 \ OQxV" $G,э jN'|pX6'hhEIq^㫮`,Ǎ9LAU09JALs5īNTbpp%R_!\gMŸ Jo;9WKTUozI U`x"prj(9/G5z`}3xPeߝ,M yJ'p4E/_Z'\HDdnǐ 8V|ppe2{EJ*.cҦ @,ܶyd [5Gq/RG1g4m!hyxpWf^07죟1n BYi*vYT&S7[Ќ9i(|LpG0o2y*J{T22r+q)l+M֖.:ț \lcհ}c q6ȹ`M,Mu hcøeί^D4tһ6siw:QJJ 2.Zz%4VJ:}pFTWgra\Wnu-U;ho7DKFRw}/&;UW ~s 3w1O.~^xv),mЃ\7냡O`c˩|ѳXP;8$JE6OUY덲&t .^17`P H3 Nۭ^3F I؄FV:)ѹUGٔF%UAl .2kf2 ¯܉jQ@ b<:sf O)Q+ |8'#JVW4(.uCxh-I;a֜A*gNªPѢ"9ZԄhhEr4Qxn1QG0*M*DZ5:ͣV5 FuVeg,n;aFlf >UȵFZ5&pc0~˿,: Ogg@2}m!hwrfϸ 9yZwy,@e27u?@VētW6uѱGz<+e]%בdY  z=8>7MUGeTgU" #ڟvsX Pq1bJ)^fm@Ӻ^)(܋+7{;t饾ˢEY!U- }2БI#6,ytjE`] };xY*9GsIZ7tIwPU4 Of DQJ&F-RƇZ/SuBó"(}ۣ"D!˒ z7KIKiڱO#kj`کw~ݣ;ك7GEm\XF%wiRgܕƼٶ6[}ܵɒ+adl|~+$/Un((F'>DDZa#e6-]t'RXb~{~<>S߉_ڗw!V\QOWaXH觋-ly<͗baTקFr^˕IeKk,ee)jB(I'Kߚ>RәdE`'==[tɫGo?K,sOHJжI[Y"X/N6-!u c}IkBa)*bz,a{z6'[u)3  ԺWyREC'!‘YeQ~MbfC޸xyrcr髈(.C.{~ԽzuaZn:%V]ZJbb l^ xf̭Ň,ƅ܍)$7UcO0+?JN'%|PUC!hU~Gqk 4U}>ZYD[ K/[^^gy}EEԟ3zM#+` &߸& ЎubNB;<[ʮc&Asn>@D/KUB@Pu&RpkE G6-*s*87-"`JfIm9d/ݚt[4MK4 Dj:U<\$kՍuM]a=}vV}d&/g bnr\aN4(w+{FOoZ}0>XW”)|0yL>=RR^vbdagNXΜ̡{RJ(RM[A+"C:2; RU2U~ I(M~IzТ(vK h R$t\XRK#(w!I2I̤W,yC,D$_9)Qӛ&U!_mIVGu?{=]{7ctwUJW˷Po_C|_ ̊XΑiI jڶ]7E֙]qȵd=Kt-]YU3_(eAPj~B~rbUErn,]3qt\9=QWẇ卫HЄ VfK|2{2X>2˿DА$tQw&z;h!EexBVðWP"ϘV"IF+soMrM nڤnuT{düԾYBǬGvq̒x:+;,PU<eZLyS*Q<4J*C4){v`s=3SgZI6FL ]|H zqTՓ̙m̭ͩ5Tvy)2K lb0 Z_*xO ͩD=cmq"͙F -}mCIzj+WP^\65@~{m۽vF ,.Ex0Nnf^63gT\zT i:Te#EŞXh^kkҿ*C ڵ99Uɍ T{֙vh*ғXYhͱLև>Drcc)ŲPGbTwcǺzbZNhy-/[?e7hN76ʸMg>hrwM']pD#x`Tp>6zYYX~n ڞ&W*՟:M*SܵP{#~3'̂Rm) \<]!}^4_;[BŅ'ei%!|ל Ei-B:xԓ9_-VtlxF7Wld9v>T >"+bֽy)UP Rz=EʞZ=/Vj}o2fY6{]ެbz=Xq1ȹqG}I7qB?ziʚ MtcyTl#^+NQ`@icq1yyM wы{,ko$GA?RI0~kP'Wsa?U=Ge['6ٸ; A=z;Y"+!HB%ݑt۹A:9jUU¦3];E5NE}8^+p^h13z&6sz-\%8, 5>EDqЎq'U֮OaQwP/}xUW/n@z)>5s6؁tq+i,2twDU;*7!SR[ ?<@TLf1Ƚ [;.߿yUY]?E +MLE |L(>&ʍ6Z,ˣ=!LeAs6RҗMI_&Je$ʭK+BLa1gsZlLneӈRuzݝκ;*TR>^+}Baۘq2܀{j#G[O^:$JWF~(;,۟^Ȃ"?"\T Uec\\iQa2A˨P29DF &c,o?YLSF9Ulpx J'0J4Uշbyq-:Ƹ?]S)231-kn4Z= K53PLj=:-#igSQI_fjQ,qvY-6u~fW㌅zJ> jXt:+]6.l>=ۀ?,Ve6IBb^kyB{D>Qz6bl=8gҜA:8k=QxV}n k 2wK= adnee >7/G^qDGSԳH_|6>lGnIǃSI]^K]Yx<-s\ kcn.1\%5]uTJe?w~CͬUm-5՞JN*csGJ~tH}%>; bٴk*lrֲMk٦5ݦU/2'B5#kZ돱ݚ: 1%UkUlrl=W巨.Ժ 3d}D+^y?aO0pmۖ^ݖޒLN<09""2@6 :IYS|Nb)QgRW@vTЫhW"/ɪ(e Li+V!\5K¤,eڳ+KUXڮUĭ5I<ke¸ϒ*VЁ tni?׌JCTsvJ.Tj W?sޠmoж7(7P 6! {xL Bx_/op[;̀(XM#$PI׳eRN\x>jd~<G-U$MާOŷLpBIPcZ,ʙzS]M?~?^pMm+Y'➟#ڤ(3h^ ,:7B\9'VIQ4L3!XV SϨݠm9PzBcJq;󱨮6j c]1mΪʴTǢڨ-<[|Y1 z|<@r=:HX-S[k))BQze2V3I @%+zp8OKm>] MrnKd_[\5/wO`y;ce;'w©NwYoVGυϦ;]^2g/bJvL~nK:+AF\Ԭu30rRS)Eό/xl,|,>7{RwS+<)q~?DCV^hX<7j}Do0|T%Yrm^Ibz=3Z@5Y66w{Zчf \7R򤨽YGAeC#( W@9-e#Su=NNh #|a:&L,zfDfYآY6j}o4ie-R ?ؑu~)Eόh,K4 A=z/,d^1/\P\Du6׸3F,,Xmjeo6JN"W WPza S=S(,9bY6&օR{#~Lı6 )>8U3R,n>#E=}oP HD"h|z;Oɢ> ~6MX JW= z$^i8 >wٚP8 u}KuZ̍ʟ daSXH|^')c)ypQ9^$mC7Dk2*EX0zzgN kI1D[PJ*NR/)ɤJN1Ced=_ϤnJjccQIm_ 9i m JA2idH%߫RtQ}'^;FjGTJUOPIiL]]#,qjvYW>F=ұL)EHšԓdZS`x2 Cc"EoaG$͡ } M&}TN]Q QꑜGٰ_$/RL%e莔De薔feG%OCPwv=bP.%~PG^GS堯,)]ya\%,Q+P%_FɆuW@r}Ez)8%eYx2S`A]]1+![di0yݯP ܤw<.I>gvIBu?:+PHPHmL,m4b~T*v#!u^2'r˓~hHHml,w=J gw{ znzTKZURzfDs6>aGby^Cg?WDJ*1GPI%/,."~m_.y\zJ>|TIgRI@\:EM̫8)3iHwv|!I\%RzfhDsh>6F͞br\凮"4P~Y)'RJRjbSJ_p߼IF]PW K~ *)c 1vyoL~Aҫ'&gK7PBskNY75Ud),]::tJY ^%+|ܥyN<ۀ bj&%xiĒK4BK2=aAluXh%M47I@pUat<8DVVU;h^!s!q|̦kQ7y] IqaG`>qXډ 621۾6Z:c @SƏ3+㤉AU6u1 GpԈau gjoUFgڥ6U;K~r#R(`"nA8&ezm}w{I G*Lɴn\Kfu<Hk,^"/6h@E"ÅנhtJGvz+U%1=wY̮S7J`;"oHd aSE EMebeۋax(WK{ h前&^E?hlgcD]ۊhh[x|hf6TTcN>•FKT+svPJ"hNk#{+?ch,󮁡Zg296}Rᝢ_! "(>\.Ohݴ ZԘR:nmymk1J:嶴vEq#1[X?u:..|l&q1 Rzug3k'p&O_p?>Nqa`SI-_p+)P9$3R[ZԖ!O]% WHy!v.nk[!YZ): FP ࢏9i8YF+ EFATɠn ^z>lN4W.{vWf K'^,*&{ܘX7LuYzK @ZW&IW/d}˙`vXϿ?n!T5oڤj,G,kNӽv>{d&B0KҭPX+ԹG{pu,41.#N9FjҮ8?ǻ LAsJ1]=1g'+ iy+PgI*/(-Qjxcz5sHnl,:*<r3E)ѷMՙI=.Q<^8W}˩R*tW~wxTvPש w -mt% &W,n}/w&y)#ΌHQa:ah:ͤ0>j'j}D!t/tnϑF/ztiPB(x|l8ut9:EeK{|l(G֑v%E+lW FZ:}{z]aGݖƈsMq&-B,tE(:K$_;ܟʌ<qLaVuPqØE~>(41,ZnKcA{SIdX/Ȍi G«av=sgcIJIb,cB0U7= Vw#PLQ쑘;_S7Gb@PvZ.t Mypbܹ؀ah6FK똵BSc[p""&jq cYl{OEHRN1 ZW7Ю!%d=#H*C2b07Z}ֻAY&UXjf1dܸL%01=,ud1 Iskex";TӛÁ'E` ̕_J/Ƚ}C^($=d7+b`,{B=>f5W8/]Kwsx3И,4qDS,uC*WCx>; 7ҋk4TX6S(AևWk [Hxͳt&ct|e>1EeTjᆬ{&hki= 'st`Gy IZ/צ(HxfDsկj&{4N$crOцwUm5#U4OTM4w>6҅kQ& x8p>ޥTG Hll 1̧eC% Y}u˺\,&=rQ=˘ eKj}DYs#=LJYH7˿4]hn̰ \C I.o I^10 (i3RE[n3S}r|/t6- "׽_9DD8Mؽ$]=_Տghht"0i@WY䚍,b2UYŝ*š:JG"FGx$̭g,>O1A]!9I{j7.sB45 Iuc7f YjY3ڪEqD`qCIO/<~^~1C'?\3mܧg:F/J}i^1z/ПLKәC uͯ1z"rG3Mw4wf-ӽg:HىQ3]skȆ;xg&칞bs1?LY }DKQ _נ=:pW80&L>W;gt!+A=6|{7\{lY0!7<}ꙞsУїgl!uo Zi+5C3ϋk{FcZk".odn6x#0~^pC&n5G4+H0E VMʍADtr&'stP{OI%EF-gs` 7˶-TiãJ3g8#kPi*jr=AKƁj3sxZoA=:i0.|虏P 4:xЩ &4Xx+(Zr"zL+h{@qPb"KB|dhuyi{M\o:eCǾGu\C31 bڍ cT)gk:(is,"}1kAlrZ= 5Rg>.c皩Խg1#㩫F1`>W[qL{};,txX0q>3Si^ -US֭{.t i3Lz=\΁3ə^x׋ ȕa'"F ܜcXmvV47јV*$5˖8Ѯ=Vk7|&"7'{*ҕ/Wf/+gu 3-dL1!C=ߜҲC<%4cE d%ym ҟFnי_hnl/J[aǭ{J;dg >\[vwsJ3߭F> tc}&/4ӺFsdL}jdkkjb{ϵk߇kictg>jjhQ9i]ḘdyAҢz[Sܡgx-˨\k?u]UGE4N~hZB ס*6]fkŚqh6~fV8=3yg ΀=sL8DDƉ2|f6(NǙٳp3s;g:3?n3z{bxiw/c{<zbbg{4|Ǐ=}^zƩy3q85\_hyj^~j,psӏP#im(\ňzʔkO֜~PH1lK4M$yW Z W7բ\=g{ڻu=*rl>LO%z虎_>7m>~GϵS =Qo}t<go_kw[cŽP|蹖Ts}O=c6km3õ4O&yʶ@M6cm|ɞ'Uc)y icϘԭ>S7?+c${NmɞgԽG5y!ky8Oc2w?_>W+5KxޒMZ| Ф"R a{'LlnpG684ȊI_C$?B8NU _h>+1$S1[cA;;zDS˲;v< SE(,BY=J̞F*ل獍?=xP3mdbHtY2Oj@$I4+8{ AKnD?"A ؍Imr*jg0sB~3R /85t̄sL\ud/I4'pucf3ʿ`&eZĐ OR3\4cT8 1NDajyɇ8@ApJEz:フS_RS]VK$?X$[9E ns/Xi,EI<\'a<}\4C ys7+)鯱qP]^]=)Z9 b௿r.fgdW_'CF1(쀦l c5/G%MDoOS 8OdIJ3*roVR_R]^.ۘGDX0C k>`F3+eSBb.Ld"1ә9D3,a63s$tf/q$MK07sm|ɿdI1EwCEǣLtl% Z\YT`d!|3T$SQ} OxeTnڐw=RU$q?۴3XyYĤdf!kf9;m*<'xqW q*ld.;+Y"{=  *>*#Be<9ہ\X暸_6SMlc=6T1B.hFT r-'_02t.b 7v فHⳭkڇ%3@TsR̵Ξ %$*?NeI;' d鼠QʌH,zyrqɭa//y\&$b|,00Vq`X_~fAm>lGx#"M-rO贩fϥAd1-a3/ge7̵݆:籂| >54o͓=@@23pY6 BLð4yes_8 #q72h.#Ô>/oXL!Z,~0\."zឭgdL~4{&y83 L#XhN:«)&q~tf/'MՋ1Y9?It G>/ JwjSYk 9e $+|t8Wx&ߐ~Y ea_ك">8-Vs:ms+DfC~a~!IrW?j1LPr0TE_I J/a]j~5'ZeDAۙ>rwCOs x9*K|xMy8@S9T^Ikb&} ħX6r7> ,kk/0/Lj%"U A`0TӯChYqZ×|$*es#r0AsFnm/=|yV$^gS.?_/d fΫ,z1l|GX hLͳ'lAUX̉a/91+j|+Uܡc5ۆȣ-}\T9"h'/ggp@6ؖzn(a |ЃLXRf'ȹ/`3SQC'L/2hh`:A ej[l-Lff8h{~`9fo\LPd`!Yp+c`O2=Z`4n8`vk8ڞmw=Т#2 -{l#{ Mus<L6sR꺤w겅W. g%,yCB̯ KX:YF[* ټCa),C̖CzgOii4I$`IS&{!H, ljr*S'{mMgDm;Ξ&veIײv}x¼NFQp!n:x|Z37HN=z Ǫy N;S Xgjj@詭/>73ld6 y Ipv[3'il rdR#U=XH8,[G~ :f`mB=LbivE2`~^V fRʄ)8t?*xѐ}@T.Le_Q!:r#e2>;2 m*WEf/*_UQQss[!=ZbEh=Gfq YˮkFL}bFq8$_t|/u4C.p&H4蓍Dc[eZs A(S^5yE ͂Cx0W#wPhtxkڊoĥKHyy:I(q gy.vZU}eEEH7t]r%l0'A1ӷ_Ԝ&\%E /a-\t 1,=QbY1,%r1C'<[*,S+q *}3+AHjP?APDiڞ0*Sbց{̟Ym*uV̩̰B,}aRYJ VB@嵂oBÇ\yϣ+wOxM n+TLq qKvi<lg >p7?@?Ҵ1 f!*uhZprc+-YY16p[yVl5z Iû@'jUtʞ>+,v$Uq1ϩ?9Q-]yJMe+g)#dS=@? OH 6aDڸ 48\qΤ0 sqv}zCEmǪkϩ7: 4G䏥`':7[@q;C_ # gL2>B_Q${ֶ GEe7?䛟Oϧ'>WG6Or7Ox)7Oy<}'l>q)7O}n>W';XVo^>o>>nqO||}|'||6ǯ.>}򉛗Oyg7;7?'~>6G9ԛO9'l>n>iu)m7Oto>6G99'>o>asO}O6WěOO'mԣؼ}w'}g)So>m>euק>DgO|}6G|'o~>a7?r'~>>в>~OyO=}'>v->o>esOO]}Tw7otI[}'ݼ}9ěO'n>LgD*"hmIupoG#j2 q+C:e wH utIgx.OG/نkD*?ޣ8 ?_(cVOU<㒱 }$/,iȨSP@:)/οn:rM7M_Wt/7[unS?J)ݦo7w|?mZiMnZio7iæϛ?ܴ?nZx?nj.tM67Y~?ߴ~UnZiaGYySUߥKnj+wq?/?p)O?ݔ/߭Z|?nZi7'JvSǛ?mJ)MoJ)7iݪ?o7e/Dw߯]wozwSMV]EK67i?4?m|?iݮw7\u]+~ҮO7˦wTqWU_6iM_f?NYn˦teM7ZI`3g4o;>]P|#Y_~ Cmؾ |>*_K9s܀+&ȋ: q`gz5_~p{~1%O fFQ7rV*5)kwa3"Xl+lO?E4<><>/d" ѲaUBG@*u !?*":b#<Ή=M@RJwkC%Vr!ז:;ZTϑYb?a5B?0 b) 9e'[; F}ʩcra~/dy2<}>Of'ϓdy2>tՙ`hNM©9y*uǔQջLL6:ve 8 LwV0cdFO0;} L(+(|= o-n|0pcRVZV% ݧ?0`?04/Hiw ')4!bbmTp.=Yq C::g(ppUm9}4ފvʷ`{ڨ+oUQڕC 9"P<: \ 5ރ8 <.8 <.8 /d!:(J@%@ȍ`͍:,eRBaL܋i)s& ҡ`.OOLHqa88a8OЭ?}#<"y0ga,-{͟vNSCņֆ O Ha' }i@' }i@?H;g$o^CV'M@)?΅Jf~ aT_!ZN5i#?7 r7$/^'պJi"EqdÌx`ݖ#l} 70CP8<5CP8<5CP'j҄6zA,J\+}Ov[r`|]YbҾC%"VBD})A%s >PAqi7  'sdIL{2[ [ؔiL,kk6(@? @?;L"QO xV"?GEᒣItJey}d8ѣ]`c{D^)qlUS֖g|MsXGѭ6{ν3\CZ jve+j`=iI%|=)̉(s*;hQ `> LP&އ wncsqLoCY)_$_K9xΉ>/:H9lqX;–y Ӧ+xSmwl4lH9H9H9H9H9S@X̲2yRYU]ayGJ,7KBS z E1PH2m0žB *m)`$CdyBS 'r9/zs̷-v~b_Ol?1Ol?1c'ًGQ'UU*I!o!jqy. # D ZeOEprn@pmC[]FY\fm*aB6Qdvy AIrWz/ߍRBvk Y[a"O̶tESģM6lwȷp7hnQFn&hnQDF&śhIFyM2d(Q܄|nY}&ģG~.ջ|Գt(nQGLay&|nQZ#z_R H& M@|M>r|7#&M> 7(䣰G~.APY$˚$$IH&!śTnRIHuf,*$Q&ZIIu.% Ie6ބ$6)lRRݤTVht&"m&xnQģG&xV(|M@򛀴' K7)R H& U@KlMBT6 nRIH&!IB*$՛v!)mBۄ|MHH&#UFTv l# Rfy=:AhUP#tUPLO|)ޑ@0i*13 rHdoEBcxcE]S|,Un$I+Nj#4o+;#".Ԯx'+Vg 0Yq!"|"L! Ӏoѷxmw~+jΝBgow}A/P} !Ӕ)63DۇYs96Tc*[ |N'mkV_7o7Zul p)\{-Ј."qډ^jsד+@q +G?zz4Mr6MIזeHqX9c`8L\TThlPܧ{ JO#%<{P cn47}O񴻁{<Oiwd V-+B|N]ҎڼƆGD9(q)Zn0d DLfתr,PozFM6A"=oB1m.~Z(VksdGZ_ý7pӽ`\afaᇋq}c@\\_ bQ{4ȹDaH')ES yYy"!N62K E xưTOKTOKTOKe&U "U$(yާ^{ !5OJ|4X"g y+MIBFDeqz8I\TG~\e{3$sz[1 x4$OC4$OC4$dP'vLj7,^H !=a<-/m[^heɬy+ѩE‘N `:bAU TGm|+Lau:s$Wq NIlOEX( $M~6@7gn^>Wfs Bq\EqHsZyZyZYYz څ0,.WD.`{\ti5h\X Ȍb6]_v4 /&M:]) 42[1r\`5Х^^ LWwWP2Zkj) -I@M*8q${iХ`IFoE0zfjQh1'FK~Mː7ރy+P_$(,kcΊTkNxDw*U O4N4N4N6 G YDnsJzDJHeH\N3_R(D`0(+x__PdSjѝ[tiکdzKÞ#soDJ1%Кf+3FlT b 6qUbiii_'F9 8yj#QWVd$*t2M%5-FK+3vY4'@.\W rx2HZ>QK8=mi']x*ԩNm%x=Zx܅6q6"T.mւTqK3,fq$>3N鴛N鴛l7q},A\!J!A:jȑ2)]dKIZƛ5| l, N'-uZkЫc:um,YFM0"]l9Y괋:%Ao4'!Ԝ+qk"-%!4s1rguFM"vSr{$P(>E5lj}0: 0: 0: 5|W Ȭ=5W^NTR,x~Ϣ4)NV(_a4o[Q5g;\tL=PҊ#7fXzYtׂ+jIp.Dv19{iBh@'*"Uğ+ , ;fOTy6q)n]Jzr٫7evS>]&ϯLBEۧqq53RJi,&t,cK 7 ]]\(wFoLܿSz" Zl@a1Џ{j2=YH=r(ZgTiMlFfbndwZCr5y\)wԖt' sgcbs%5oŶ@rR _s"QK|`׀ʿ}D-/ 3>uOSЮ']71d8Grv;(9ԡeGj'X#q:K:˰_,[OЦaob83r~wQ4N"c EHŢGMm$g3A9!UK& 8Ll+VDLY+êxQا">OE|*CaBfU>ktk0C 7?iK -XrRS+SbzNzoiJQߦ 3P`nX-9lt$gH.T8fN7)j'"Y"Wo=AĬ1%#5LrSTz}W5g-\ˢ]fB̛$B)S<ʼn>AF,po%NTKԡSIē4#yсTfrlcDx-8(ڬ£zb6O$ >*؉X0)M)3'y(b;jDi!IA m_zDuI;+}H Kuݖp<0$==!3S/V`41'*BbDo!|68",xh']$2@ +c(DC_V"Ȫ$'o@jVL=/"M=Sw N11I8[Ź!Tj:%>zǂ<%]F&( !|JD_ @TcI`2%!S٭}"J[@IYdo@K3tF 1I"p<,Bf-3U\ HZS2eIz%RQI|dR$PYFS$6i%;9.Bļh)Pkzl/0<f B$43-R8X)&IaDK[B".XQd]SY|H |$jMKq"^|({ W;RN[1 cHFQ|j ""58OD*(`xn +HRz+I09!70S8Id:ŚO37< sR5L~%/ |_&#56jWMбM2ի;<Ӑ8K,1/&Gɲh- |F ,gEk7A Y* ~s<-OdJͤDKzAtyɎer.N68G i]R@L,2<7m뙏X,,4pc*M. @UQ,Zvq"+f$Ff%鷜SBKt΀"6z 0IɴıL-eb43hiّ9~vC#A,-D BWan|#f jLoYkP$o[XXފfT#.R d/ZaEx\F?s;knu?8PoxK40M)t8ӤNQ'ysBɌ|v)э7yUk(>D3F-?<"WҴV%e'8)epDO}. @\Eg(p`CKh2OzG*c=Q8jFgI:-qyиڎY6Ȱ8{|S&(x3_eorM4L["Ei5jP%gKp^xnQ<)UPmhzLOf֯W_ߜ2)-c''pm/A6>vӋ(>F~=Lj!ks|2&*ܒSI2$qj,RW %T *0untGaHE0"ɣդ .^S~XNqmk(WH1 E6FwwYt{쨼W6AdyWq Vijk⪁,%.H\y̿(G-Z-KB<O|"e&a3b!S0!Q.(D?oڔn@\i”+|ii`:4yȁ”+!t Wd,>sl0Iċ{ȁ1bQ\K0ò`|%XxCzY o' ul]A"zTH=h:hrRg R%a*\kKև4qaM-d,%|(b"E ɽ(mc- 1'H)t)WB۪ͶJo jKrw!@DТ$?o<8?Zq,QRqLǡĆWCs@%MC "7Zߐm噃WF"y&M;6jX ]Nl^?H2;38>7v`U#3zv5)Z LjBO'va)VJpӱZHԳנm?Q>>i.2 E~0^NKDF%-NԻF+>3eJttבRYX8~}`{Q+_0u,Upd0-4(\M D-#ʪ,-M}TV[I- A~ s)NeK瞄'y6p%ڼyp" l|P7~Ev"|8$lP'SBZqxfa"@2EΡ1~"%P'4Y(%y;4R$/aZGk m?'k&Q@:M8G>XcQE %,,Ǎw V;X>{"Z[xEY.r*Gu~B5~*G$uƯfްrK㰟Qqa<ᑿ#}d#3Pd JOf(?.jCd4m 'U ev'LV&5|KGjޙy+Mǀzɂ RmޔGUl>Fi<2L冋X ,;_٘MDM\z{̇aC`vfr/e:K'z86WC_z~Bd9mGkpisw.\([j7pX(#:T*SA~Bc8Nq۝.r;=f ¤X!͇R?=-KFNtOB{d]jf@p.+xxϗ(;R ~}n UD '!#-CN `XIDj^bH:Q% 049נmװJKNS-|c,j4Y3dĂGgљxt&Ggљxt&Ggѧ;vgOvz>Iٙx9ģOow&}r3L"NYE&J #Q:в9cs/2q2a# 543͌f~W*m}3E_U >/C,Z"à. g !;:ţ6aS&^HIj4YVHT}-)jbnD܆[5Mm7՗d5zsu/JVپ"dk !,nϙ mjꠝFi4~S*^?\[peuflo0Fj*SuNa+vҷ`iL:޵7R=-Myib7byGf>a^f w>0=׵FW%WHKU,G>Y:b$A/UP^?CjLT^7L oeF.fI?~uFӄ3 $<_y14Vf Wᩙ dV2~촋Ҷ)b=zz󨩐:I .r,V> h0 =>8Cm00@ֈ7ڪ#kkXyY-ҷhЌ)uk[ .R*w^[C:b(V['\ rym7 [ r#ھ^ rwzSc>ӼaB6X-qMtו[ ;pRrinԃ = m婻M}tO}^y'~ ̫ ̊kpy̼~B6`Y4f^x3@:uBļ=5wMjh6ua~;ǼivдnB6`ޙDwW 󢯰7=VȽLyb6SZ^ m婻M̴ԛ RdC:/ZqU4zNjůB~{ᇞF?ѽL֮ʇAք-]}nI6]vG!%`nnk,~ޮ4 ꤑ@:i̬4{IR5#ԫS/6ݦ^Q7u7KY-ܔFU &{ ~+O ?$Bo'ǮI]4ԧ]=zg|*[wDZz;3obu~O ~Or/Qs|jSҨN@SwzO,ZפQB~{WSެ9fUyS>!åO ԧx8wCN02GцO|Ǘ}CA,4Aa"|xJ N"JH}@u'uM}#V2E4d*"S2El"^MVQB ԝ+bCo'dvbaWHîB .{aWU>L'U97Ls~yGt3ռN K t"l.N**.p)O "pivM& z+O "v|A **rRQO "aɜEH&sD2{w74K%33_ Id<K$ɇ>14ҨٖxuRtP %R>%'2x=(p`Вn ll\䍹=YGw&.7is7d ZA蟐A E%2\.*h4@+NT<Ơv8&Jc\A6`M"/ry ȃ,<e p-U&sWZ31R/ bpMkE; ^l*&K(=f c䤩2JK[ɶ1A-my}ld[^$ ٖɶ1A-* ٖcQ*n0J׮8q**rZZT!OYsS Zʇ*ȥtO Di7#o_.FȥhtO <}*6R-:R 0{J 7q )CP~6eT!~#Cų7 MPjVbb$Q:rU<Cb(ـF(,#B 5c6;{8,2BMN}"oV heȟ?\@ U(pQMp5QXFU1ըǍUʸyV* I<[ѫrqԴ(RT;:t% QҍBE FD ݨ FzTtPQҍ FUH7 cPn5Y6JSW ҍ*e,n*UA`/̉ ѧ\ >-[+dG(OUe&\ߴR$o'n|~Xco늼|5"FXcoф=6A5oOMP`zDkmѠ`5H5{s5ֱw˨ֱwm;Yz'=APU_rqYt my)w*<\*Ģ7 1}yAkyRʙ՘_F[jW9oi ؽӤ#ghgvv`EX'͓5eaFX'c`eyl7:v*Q#cw/Xo;\}=ؑ+el5Φc`WlWzT*e/Wy=:FAt,rQ`\$g3J`42JgQ?)M/ =R!XS rQ)Eإ[-FZ-Zg#L\&Xziz~u 9"QSX)M]ktj8$OAe}*,1k>4*I$gb (jqldfqo0zҡB7 Nť7d\\Ccy}:Y5ޣ ,u>+<𤣊yБvky4ڗy[-%H]mJAwG `:Ӊ/$g.Vi~T?^Wd}_gón36*jv?p@t$|Yg,_39ny7^ z~;{ +b+jŗʳ갲U(4Q_ULB/7rHH+ zUcZ7Z'A5=uouŖ{2fjx`/7>M{6zHåou0"Q*Y48 O)LsR+M`cZ\Z- R í6vJfOц-?,άM93Z̬k}}llմ47 9Y+ȻSt[RAhoW@QofTIU޵! / l[]KWAˠ"C1NKüV WH<U_}'Y͒ e?C?Mkhy7z{Y\%zE2 ZcAzVhByCEl4ȥ{*ۉW$'ǩ:R "^ߘϕc2,K s+|’u@.=DSa?ܾ1+_cq@.=dOϕ q܎)K)1+_Y!҅ړ6&Hy ) W8B\ifў4Sc"O mIWc6k2c{iU =7tOWd>"X\xK<(бBtlSSBF+@>k(:QFU%2~T_wQU q5 Q\FՍ>nըimԏi߳H^> /Annots[13 0 R 14 0 R 15 0 R 16 0 R 17 0 R 18 0 R 19 0 R 20 0 R 21 0 R 22 0 R 23 0 R 24 0 R 25 0 R 26 0 R]/Contents 30 0 R >> endobj 7 0 obj <> /Annots[43 0 R]/Contents 47 0 R >> endobj 9 0 obj <> /Contents 62 0 R >> endobj 73 0 obj <> /Contents 74 0 R >> endobj 11 0 obj <> /Contents 83 0 R >> endobj 3 0 obj << /Type /Pages /Kids [ 4 0 R 7 0 R 9 0 R 73 0 R 11 0 R ] /Count 5 /Rotate 0>> endobj 5 0 obj << /Count 4 /First 6 0 R /Last 12 0 R >> endobj 1 0 obj <> endobj 6 0 obj << /Title(Introduction to the Pdf995 Suite) /Dest [4 0 R /FitH] /Parent 5 0 R /Next 8 0 R >> endobj 10 0 obj << /Title(Hierarchical bookmark to Stamped Document) /Dest [9 0 R /FitH] /Parent 8 0 R >> endobj 8 0 obj << /Title(Sample Word document with links) /Dest [7 0 R /FitH] /Count 1 /Parent 5 0 R /Prev 6 0 R /Next 12 0 R /First 10 0 R /Last 10 0 R >> endobj 13 0 obj <> /Subtype/Link>>endobj 14 0 obj <> /Subtype/Link>>endobj 15 0 obj <> /Subtype/Link>>endobj 16 0 obj <> /Subtype/Link>>endobj 17 0 obj <> /Subtype/Link>>endobj 18 0 obj <> /Subtype/Link>>endobj 19 0 obj <> /Subtype/Link>>endobj 20 0 obj <> /Subtype/Link>>endobj 21 0 obj <> /Subtype/Link>>endobj 22 0 obj <> /Subtype/Link>>endobj 23 0 obj <> /Subtype/Link>>endobj 24 0 obj <> /Subtype/Link>>endobj 25 0 obj <> /Subtype/Link>>endobj 26 0 obj <> /Subtype/Link>>endobj 29 0 obj <> endobj 41 0 obj <> endobj 42 0 obj <> endobj 28 0 obj <>stream xkhD endstream endobj 27 0 obj <>stream xc` endstream endobj 43 0 obj <> /Subtype/Link>>endobj 46 0 obj <> endobj 57 0 obj <> endobj 58 0 obj <> endobj 45 0 obj <>stream xkhD endstream endobj 44 0 obj <>stream xc` endstream endobj 61 0 obj <> endobj 68 0 obj <> endobj 69 0 obj <> endobj 60 0 obj <>stream xkhD endstream endobj 59 0 obj <>stream xc` endstream endobj 72 0 obj <> endobj 78 0 obj <> endobj 79 0 obj <> endobj 71 0 obj <>stream xkhD endstream endobj 70 0 obj <>stream xc` endstream endobj 82 0 obj <> endobj 87 0 obj <> endobj 88 0 obj <> endobj 81 0 obj <>stream xkhD endstream endobj 80 0 obj <>stream xc` endstream endobj 55 0 obj <> endobj 54 0 obj <>stream xUyXSWk;TRۼ7֪PeTEh%fBBB6^rHX=DW\P:ZꂊWt:>}f3|7{=;lTpƧ/HZ(.Mto,Ջ8f"y)y9}mzy<2~h VҘ9M??R9MNO];%..~Zcezrٳlo H29  BQR*}H}.EJ \*yҤ%%IJEi 29?FP*5VIzZK H1P9r2PAO *Yxpz^Sa7ܛ b;˿e͠-/RC-{2 ۰r4|P,_TKh[M5N)q.Ʋ5n9a*v*K'vY&Y [nFafiMf3H{ᓝW/SN#ڤ 6i!]CiAPw82k 0Wp |#+B;+Uw±]0h8)]c˜S2dlbg:j%g_`a٩Yv0H3E@4u,xQ[c2-4u ~ᢨ;6>L4*bE!c_ec5]*F-ˇ&fCaEn8D^υEoZ)NTqn8}hHĪ4xڬWe %!ͥLo𱰃͉07:>e|͐ox3OnNYV֐+S`6ݚ__' p!4 yiQz 5Gڶ~$LlTxc!39Ἲu uԁ(-)-./,^Wa""[lαbO@%X`ux؄1;J U& %nw"pqT0;?3Eģ' i7WR٢g{cm"9TtZnkL^> weomڶ5M-UEj_?õt&]|_WIznQ#s)9nɎP]mnW9zNf& ztrmr-|9{??O АE&FS ' ؙZ^yml%aWډ7Ϟpp3wV+)}RTsZ%c)zY- '. /?؛Q TʼMi}ߚEJlf(ĔKlv3suD C`ޫi,K\ʾ c4OiUZա,Cw>; Ę0jWo ~܍f-%f"ͱw)Mz+j~>\ Mn$c>`lU$ X6]ξhO'tVCzU\xYۨu34BsOypcL_g/Zhρ^܈~U,K2Ca,ZA ­zֶʍ"h}^vb6ZiЀwI8NXm3*cZ\Evt'bk~wά?p.De#}vk%FszKGlbk!-1bwk脨;ކi8 X5ϲ 5a&1 7yM b (0 endstream endobj 89 0 obj 2844 endobj 51 0 obj <> endobj 50 0 obj <>stream xV{Tgdj69YIdVj{Vo@V<&033!<~< /Ej[[mY=mo ힳ3s|{EqH$l*26PMz5"⦎㦅yOBa>)&aS."o/S!jwcfGFYa2g3tr|}Ť:\It?dRz@-sEZR(RG)rEtֵQɈQ)#ŨdLZOk 2lRgbH 16ٹXREfJC?QV e sH3hI%BiI}Vי̘xGŘX ah#Ƭ|g쎖EҼ4xOI!d͢,i!"4k֫QfBK>ddS*GW*Y=iQA&HFȍ0r0,|CQѤd6Bo^V70Ulb1*l3cb7X<{l#[Ea+E'6@UlqBT541){qj BhSdB, L0܅ &K%3SdSԺKemQrznlWEʮ=` 1bťNAHc6ƕ!yO©d(/,v8(.|ܘuP#@<܏*YUrTM*8 ώٚfrGQTW*˝NPEg}ΜN%v_Ңhiu| gs/7uvTa$3P P9Y SKmfNj݅@E>; KiᠪMH׷N9dެD8һxgVփnVw?\h)¸˜G5(Tj@wNR:<m{,ѽtph꬗+H0p\ǭ ʰ+A`X=ἐ7F\8؜o{`W|ImaNpQ8tErhmňox @1bAtmI_A_6[Cȣ61_npYu8+VqFLGSyN'?P?!\/Y bNÙp垁A%{Vn9/0.σ_N4Ճ5xbeAwRw1H$z<4n1f(A4/8)>[A%Ӟxc(.;XQ)`FotEf>; hqOE]W |חv$h/4"C*=]@;hέ;-DQ|BJWQ`&%u@3&u}gOf?Uek܄kŹufDZUJ_륃۷R5B08^ԟqtH4>,`\&7]v~yw\)hµsVr/\ЗYCޓ~kHe/mMC |ww6X'cVu{'^z;}`j'ˤ7g&ƥGOl=R]ުFb8;ךCC;EAQP$dpF^WRj%"יZgڍ K!Iy΀4BkH߱*^„u-j7pݵlgxtqumODr~St}m̽lN"lXϝL@r.;;lP*l@HǴ6o% qWbi/*m+.q Ƃ[pA*tz[pUy*]Z3'M_MT']uh*C"%8\L] &{S}Q݆$<4S TvՊ<ՊxVq%vS & -i aIPKE3ɠWfݞ梦" pbr}?$ٶc馭S|8?s0"_ Ըԕ-9\WPr;J4]pR>}JoUwHљ5ukxvD_+ B8Om9 +ܹ Yq^4nrViP ԌZ ~dOoGؖWJ(&?F]ҷr Գ`O d=եj^vVCm @piojj4E;_?VTfߟ𷁃 |?ǔ{O >c_6tZ*K7J[:Za/:-G=HbY2o6#ɢʞZ A}%Di?PQe#xҡ2>u-J'}}MB4#^)i ̖pGZ=uG*SE8y&VK`c@A!r:e75h2R֭W;NA^[>SZ8r#>[)zP;4GOn9{++x}u 0_bc}:`d8>A8ԻF_6>.u4m)#߅a}e8&  NIcؿh* endstream endobj 90 0 obj 2961 endobj 39 0 obj <> endobj 38 0 obj <>stream xyyXC:/ 3ZÌ!A.^dTJKOPZz0Z%pH"|2(ELO$*D¸DHyo@=ۅ nҢ€hqb?1F"-Iӄc)Di|p\%D1xH#ye4I\ (V Sb鱞qP&b1&vo b!J"V?.F&6pb#$b& ML#|9t›Db#d /9x9ka2^*aXy/`ZHOLiRؤ_dSOy25tikLܗOM_<93V̰pys挙ft|V,ŬY}^\|2l;߅gEȴTYv0ȂNv*5hy MZH)a996.$a P k*R ZJrQWh7 VD2#*yi,(ZK6Ր },9NIKxuZ'ۻ͍涫ߦר|aKᎅO[tJpퟕa QX1ʢY耒U]6QcH0W3uzD~$,;r}~ңty?#ArgQ".ǩ$VFO:_>IR?ݺcR[%ͲluG|?z6Wopn/,o B2bcɪ蜝:~/ tbsĐȥ 3hg1w/WUb 7g<:1; PφBLIZvŧN5@A>4^AwLhp YoftR㫋+uxظƾ \ O'o{l$l)|̄ύ\8T|@T uqEr@Th9)U೓ fN>yL /`2Uf1P~_iuϟ>*qlpg{C8'hHp;lz%ٛsf`7#Ǹ+كwMr=;;v>sq 3XlsF>dESv: X Ļ-hXֶlе~@/)U-;%~ ; 'ye;R'HjԵ*(1vSyy ӟVЯp+PǬƃ7 5%9k EJ!"&zp+F ʦA6cԏ9h.:c@ocsKʓk۫cê ڗmܟNS(B!p6}p/c0|$u|tEffC,N 6uq+a )n^<I_~1+o؜9J"x^YfV)ÐM^@;աAio=Ygq4p~{YR-O_0ŦSC3>f >i548જr0@?Mk.9$̖Nn͸ >ƴɍ) ;`T k7L2>24P6n^,8ITܤ]&U-eI }M588тe>i;+ *lolqv35AA!ln i@}ߩ\Xo5Xgܫ-]MjI56$u\7h9b^Hf fdR#s3} qYW= y䗠FSN:O>,c(ܲUu6w4I0Im5y9$ ` ن/=a6΂+ٜ)NrdixFT(5`ѿsh8Ugvлdfj>d=?|?t?tF'8<&C5s`<+mV,*ah>:yåmDpx . FjJ)5ѓ;Eqr~q~gK[7eMFQ𑈬<`2rgKŹ}]`j;rtoN2#MmL8Mx4$l4l$^Yc I32B*W6Է(Rp9NwӨ?jřC50GSNG\\yNJI~fh ':}TT+rjGM+/©| %WQ3j˄-izr|!~|v%j\.81';RpW_xzߌK#L( CIp v%Ti`Կ v {] FKhxځB 7^}1 7}Ȁ*|VN5y#)'4W5z b 85zCKwh! kO}s?8#9%gݕg<2J965N2|w?7TX9E6kPPFiLQ`T ڊ,} pk/a|\3F u] Dk5.@B6W5 T# ױƮh .e.j/0l :|l 6dgޟ:=r|W`kZzN#Pc1ϸŨfGTNep-ɨϧl1YrTe9e X8~IBH~N}\oG\.EӦe`ESouN2(.'[yFRf=_)NvE:Pn-9KX;-xaeЂlV>W,ҧf$9+ߍ 1iHWqHUW6 FI>4WXR7ނoG.L7~6-VRIbn NҿDo)G~ȸM=p9 .s58 L!đ.UӘ}+ܙ uBX)!=$Z[sDMI'(Pݹ|}imF1|^<ĒZkJ Q7ct".R/ddz ?AI4'PY(”vp,qa}Qe7nm'τl1Ȭ0k8VQsfnקsz.S;pحmEMuDs}DMI< $R{iw i#a <2%yJ G+|.5RyJjȊ2}4'Z)Erza PC XHpb0yIij mÀ\+x$L-jq&kRCˉ! H~}TL4k<&?0QYA/#ʊJP}QjR$ 3'? udgGS3bۿy>dl@9(E>XP]_heי]46.xv+˅ck:WQKO6xֳ<@IuzcXFa9O\eyxs>v>\Z<:0nvch \3F;>"3s )m~vg~p"3➿=}*~> 愖 ;*׃ul_9p<З1;L ՠb'۪0f @!(wt|HƝ Plx?Sm6`)Z}{gO]{3CA hR.E1Y#_W:O\ר3 '|N]rZTT)P[^fIƅ 0ٿ1p Y8x-IՕ{<"|s% XRP&?*؀bZ<m\X!KͰћ־+V^V!WY΅5oт(4^y5 ]Rpp"⢗V|{A@uy~4ZB$W(de8]"M<' 8 k\S(fSO !Qp_a,L8O/y]7c)yv,giɪʒZkM udA:)GGyRa\[e(M7ǙEoZű7O{<_7l}$7s._sǃ6jUe8VmO@HLQSI+8u2=^Y}G{.rץ7#|LיuD&>-M H5?S((lNq9= є~.g͇.}-gwW7Znu߻BMtӡnfMzR[Oj'O! ֒ endstream endobj 91 0 obj 6561 endobj 36 0 obj <> endobj 35 0 obj <>stream xWw\SrixQO:vRUEE]Ih H+2XVQXABW`Wa) OlEY|k۵a9~!Ӿ|ϙA@9"(T R?zZ%Oܹanx?K#T@.|bI,.zVXX 쵵K|-e(Www4]2)Yˎatl (RY'Ti)T'PdT)s". `E"=^Fd$2vRH(\Du:ԩrVNx6դ)dJȒ)6MhȚUjؤTBjլ2Uʐ~:U˦y 9!"FLӲcD@Pox-W$Ǭ:Hղ ͇3m2UjYZO+5ixKL+!dhI{銤tJ1 4Ψ6J}jDpeJB'jYDQ5_* Sg($F'iiC3WfM8lq)j$CPTH}F1#LH*rSxj5@-&RnT S^bl!,=5F )DPq)5F  Js췩&&wL%a;M@g-lVQX"~Zfcdf{W_1WKeCIDzk8),OIb_"i kgP'Zg ђp 658`sA=i6\m-Rȗdo٫oY}e-(,-=6vV = AXvMs;h%?D6]Wo\Z6KD`z/I#xH   &\F[<:W[`cmKCD^KGIk)dV16,Nr"80/OuvJUC-ͰƍfRC CQ- `^ؤs.ھ^, `쌳:Τ|`&J3b'?0l.`\/{pŐ䡽hjݺ.|Mq(:FwR,W!Z^j~kَ3]O{.լҫW~;ԲH 8'}qD^ʰQWڃ-{ޠ{_h;ԍN|=sVoH$pîN[N~E}X ֜@uB &oT@ D`z1cŠrlJБs7+ 'Da Ƙ[-C׸ ƻ>UE^ys3&vtT[`"H[o&m Lg`  8yR|HZ1%Nm4RџK>>6L@x 5p`m(3k$RB$X{v\/pЁۋ$0R)g+چfb1HNm/׍D_CM8b[%H`wl'c]<+.$&parIC;9S/'rDKL1g;. }nHcN~ OE`3.-=z|v$9L &IUEҢgW(cy(CLrfRhibDdpbӃ"^)j{`eq}WD}>pHKM.߹ќ-SpG+ PL!t*xcnOp'`wl&oϵ5յKmwohؘO\'Ccb( jR>n,x<#Qcm{{>@ݫ-oX?Ln؅ uAǿ9PP"ݟ[Z!!~K%rs F͚%;s^Orda'c? ېQ#PZpyO T ӐУc#wU|'W$3Sq 쀰uḯ4t(.^}R}1;*&ѕ_Bo )ZJDUVm8ZTUVOF+랃ߋ5aA|-g>8qqv/w%u1=Y4F^ki;)Fg dhNJ&){;1:[UAW5V7rkZx^)Ӊjӑ*0[6/>\Ws z F(:!v'`-hSNKֶ\\0%]` Is.<; :(wgٖP8,6&<4m<#ImZCeU{0;du/lz.w8(#i+m)W)/Ji03`ka#XXRqK endstream endobj 92 0 obj 3685 endobj 33 0 obj <> endobj 32 0 obj <>stream xWyTS1+2(M"XE@fgL`#&0VS9Z;jEQqhgh-A Ңj}'NB[۷"ܜ{ϰoW@ p(PWf-޼>!ijpeljFP;%vTpHG0JAgJҼ>Kʜ\,`ɲ%%?:eF6\*TyjF+KV(d\,[Rf'$EG<#Sd B+W XeBSeieK,._%/!J tJMΫ}dZE\RZPyoQU%ֹy֧_)TپJ,YNʒ9*EQ3K4o*˚H[͙M+ ΍.\S ;klϤq}M8IQ(w*J¨ɔ/Aͧpj5ש$* FSTHRTIP1T05JޠS^<*@ySoRq,j"FSIGR ʅPC){ʕr0ʑrSé!KרT$a4eCI&;1`Q|00RφoO1"h=@0'l6[6 X8v"[7P73DZQҿ#ҙLVS$H >tI0Gr_\lQ Z7;9HP.I SiՆRĆ.̘! i^/d6[GBJ κ'G7X1 s}w͐,.HEy{@olKGd@79~Y>q\wt삇Lk-GK-rn\[G#`\ gpK;^ a9&ߎ[\tmr~^^EJ'Tksh.$f֐~;pF~ b&ςjBpMO_:kb۞Bl 7a90מ2'+rfq=՚%-u%I4OAeUUYQ![EE7%pM[ Z<%_GwdHcТO2]ATI]}o9WO;b<Ӵ!$}/ -ʢ}ۖ v|FĚxUmV4ɠ-8:3~dYM'f!_MW!yB/OlOEh>iX 0C5$^чW èIxTX-NV_Mf+Bl-5R,tB'^d$Z~Q͞{zxQS$m3OG!D*_CWQwu*FРk ?{-g?cH>m-?ExԾ<gEocsЙ= fdcW%<3_KE"܆ZYDմ奠ˢ ̼7GhC$ٲm}P{Kjg@n3ɽ1 `)8Xk4Lu}n=UR YǑcZJ*Cun8{C!k->bH:ҩ-4_L߻ F+S1E2kVd&j|č KS2˕(AM,ٗc`&Lalt;HZoaМwjKو Ϫ y0$O% 3Z0"uzGF.h!q=~DVY/>?om/}Yze'4dJt鏿=h@yi^mWleVE>~Xysh'ڶc!CykKzj[鈍Qnl9h7ƾÝ#=i܇}14l'>U:O^#KBpv$ +DOhpzLx">727]nrT%}Yіqٱt|o$bhEm~v Y X|H8Y:%~3?1K ws=^)^~ L+!AaGx '҃/4L4SU]gpB9/Ť1'|8a- ZJДFqO؃sgrb 1ΥG!6qP: 5d4_'y=4w&yvQ(E-J*Vev৕_}w/%MO^:?6G7{N\*_n9#-e9tQ sSR՛d\Vy3ǝ0;R<}k8Lincz~_Eojޭ{*N%a_8#DTZ^\9 {BXE6c Hi5@HAW+ "6>df;{/&W endstream endobj 93 0 obj 4690 endobj 85 0 obj <> endobj 56 0 obj <> endobj 86 0 obj <> endobj 76 0 obj <> endobj 77 0 obj <> endobj 64 0 obj <> endobj 65 0 obj <> endobj 34 0 obj <> endobj 94 0 obj <> endobj 67 0 obj <> endobj 37 0 obj <> endobj 66 0 obj <> endobj 49 0 obj <> endobj 40 0 obj <> endobj 53 0 obj <> endobj 52 0 obj <> endobj 12 0 obj << /Title(Excel Chart and Spreadsheet) /Dest [11 0 R /FitH] /Parent 5 0 R /Prev 8 0 R >> endobj 2 0 obj <>endobj xref 0 95 0000000000 65535 f 0000387952 00000 n 0000431791 00000 n 0000387802 00000 n 0000386858 00000 n 0000387896 00000 n 0000388064 00000 n 0000387125 00000 n 0000388278 00000 n 0000387309 00000 n 0000388172 00000 n 0000387640 00000 n 0000431686 00000 n 0000388434 00000 n 0000388558 00000 n 0000388684 00000 n 0000388808 00000 n 0000388934 00000 n 0000389060 00000 n 0000389186 00000 n 0000389312 00000 n 0000389438 00000 n 0000389563 00000 n 0000389695 00000 n 0000389826 00000 n 0000389952 00000 n 0000390082 00000 n 0000390537 00000 n 0000390388 00000 n 0000390210 00000 n 0000000015 00000 n 0000014509 00000 n 0000411014 00000 n 0000410537 00000 n 0000422987 00000 n 0000406745 00000 n 0000406353 00000 n 0000425257 00000 n 0000399685 00000 n 0000399233 00000 n 0000428475 00000 n 0000390302 00000 n 0000390334 00000 n 0000390685 00000 n 0000391133 00000 n 0000390984 00000 n 0000390809 00000 n 0000014531 00000 n 0000109440 00000 n 0000427447 00000 n 0000396165 00000 n 0000395884 00000 n 0000430660 00000 n 0000429637 00000 n 0000392933 00000 n 0000392653 00000 n 0000416839 00000 n 0000390887 00000 n 0000390919 00000 n 0000391605 00000 n 0000391456 00000 n 0000391281 00000 n 0000109462 00000 n 0000202820 00000 n 0000420936 00000 n 0000421964 00000 n 0000426425 00000 n 0000424231 00000 n 0000391359 00000 n 0000391391 00000 n 0000392055 00000 n 0000391906 00000 n 0000391753 00000 n 0000387478 00000 n 0000202842 00000 n 0000293283 00000 n 0000418885 00000 n 0000419913 00000 n 0000391831 00000 n 0000391863 00000 n 0000392505 00000 n 0000392356 00000 n 0000392203 00000 n 0000293305 00000 n 0000386836 00000 n 0000415811 00000 n 0000417861 00000 n 0000392281 00000 n 0000392313 00000 n 0000395863 00000 n 0000399212 00000 n 0000406332 00000 n 0000410516 00000 n 0000415790 00000 n 0000424167 00000 n trailer << /Size 95 /Root 1 0 R /Info 2 0 R >> startxref 432014 %%EOF php-solr-2.5.1+2.4.0/solr-2.5.1/tests/files/response_xml.1.xml000066400000000000000000000250461374041537100232170ustar00rootroot00000000000000 07215151321http-8983-3WAITINGorg.apache.tomcat.util.net.JIoEndpoint$Worker@1bf68a960.0000ms40.0000msjava.lang.Object.wait(Native Method)java.lang.Object.wait(Object.java:474)org.apache.tomcat.util.net.JIoEndpoint$Worker.await(JIoEndpoint.java:416)org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:442)java.lang.Thread.run(Thread.java:595)20http-8983-2WAITINGorg.apache.tomcat.util.net.JIoEndpoint$Worker@1706eb70.0000ms0.0000msjava.lang.Object.wait(Native Method)java.lang.Object.wait(Object.java:474)org.apache.tomcat.util.net.JIoEndpoint$Worker.await(JIoEndpoint.java:416)org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:442)java.lang.Thread.run(Thread.java:595)19http-8983-1RUNNABLE160.0000ms160.0000mssun.management.ThreadImpl.getThreadInfo0(Native Method)sun.management.ThreadImpl.getThreadInfo(ThreadImpl.java:142)org.apache.solr.handler.admin.ThreadDumpHandler.handleRequestBody(ThreadDumpHandler.java:73)org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)org.apache.solr.core.SolrCore.execute(SolrCore.java:1299)org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:338)org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:241)org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)java.lang.Thread.run(Thread.java:595)17TP-MonitorTIMED_WAITINGorg.apache.tomcat.util.threads.ThreadPool$MonitorRunnable@74db2c0.0000ms0.0000msjava.lang.Object.wait(Native Method)org.apache.tomcat.util.threads.ThreadPool$MonitorRunnable.run(ThreadPool.java:565)java.lang.Thread.run(Thread.java:595)16TP-Processor4RUNNABLEtrue0.0000ms0.0000msjava.net.PlainSocketImpl.socketAccept(Native Method)java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)java.net.ServerSocket.implAccept(ServerSocket.java:450)java.net.ServerSocket.accept(ServerSocket.java:421)org.apache.jk.common.ChannelSocket.accept(ChannelSocket.java:306)org.apache.jk.common.ChannelSocket.acceptConnections(ChannelSocket.java:660)org.apache.jk.common.ChannelSocket$SocketAcceptor.runIt(ChannelSocket.java:870)org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)java.lang.Thread.run(Thread.java:595)15TP-Processor3WAITINGorg.apache.tomcat.util.threads.ThreadPool$ControlRunnable@1e164830.0000ms0.0000msjava.lang.Object.wait(Native Method)java.lang.Object.wait(Object.java:474)org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:662)java.lang.Thread.run(Thread.java:595)14TP-Processor2WAITINGorg.apache.tomcat.util.threads.ThreadPool$ControlRunnable@8ddb930.0000ms0.0000msjava.lang.Object.wait(Native Method)java.lang.Object.wait(Object.java:474)org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:662)java.lang.Thread.run(Thread.java:595)13TP-Processor1WAITINGorg.apache.tomcat.util.threads.ThreadPool$ControlRunnable@14ab51b0.0000ms0.0000msjava.lang.Object.wait(Native Method)java.lang.Object.wait(Object.java:474)org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:662)java.lang.Thread.run(Thread.java:595)12http-8983-Acceptor-0RUNNABLEtrue0.0000ms0.0000msjava.net.PlainSocketImpl.socketAccept(Native Method)java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)java.net.ServerSocket.implAccept(ServerSocket.java:450)java.net.ServerSocket.accept(ServerSocket.java:421)org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:61)org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:310)java.lang.Thread.run(Thread.java:595)11ContainerBackgroundProcessor[StandardEngine[Catalina]]TIMED_WAITING1400.0000ms920.0000msjava.lang.Thread.sleep(Native Method)org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1579)java.lang.Thread.run(Thread.java:595)10pool-1-thread-1WAITING100.0000ms100.0000mssun.misc.Unsafe.park(Native Method)java.util.concurrent.locks.LockSupport.park(LockSupport.java:118)java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1841)java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:359)java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:470)java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:674)java.lang.Thread.run(Thread.java:595)4Signal DispatcherRUNNABLE0.0000ms0.0000ms3FinalizerWAITINGjava.lang.ref.ReferenceQueue$Lock@1b82d690.0000ms0.0000msjava.lang.Object.wait(Native Method)java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:120)java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:136)java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)2Reference HandlerWAITINGjava.lang.ref.Reference$Lock@ad65130.0000ms0.0000msjava.lang.Object.wait(Native Method)java.lang.Object.wait(Object.java:474)java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)1mainRUNNABLEtrue3340.0000ms3180.0000msjava.net.PlainSocketImpl.socketAccept(Native Method)java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)java.net.ServerSocket.implAccept(ServerSocket.java:450)java.net.ServerSocket.accept(ServerSocket.java:421)org.apache.catalina.core.StandardServer.await(StandardServer.java:389)org.apache.catalina.startup.Catalina.await(Catalina.java:642)org.apache.catalina.startup.Catalina.start(Catalina.java:602)sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)java.lang.reflect.Method.invoke(Method.java:585)org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) php-solr-2.5.1+2.4.0/solr-2.5.1/tests/files/response_xml.2.xml000066400000000000000000000007061374041537100232140ustar00rootroot00000000000000 parent_1 CHILD_1_1 parent_2 CHILD_2_1 CHILD_2_2 not_a_parent_1 php-solr-2.5.1+2.4.0/solr-2.5.1/tests/files/response_xml.3.xml000066400000000000000000000016471374041537100232220ustar00rootroot00000000000000 parent_1 Solr adds block join support CHILD_1_1 SolrCloud supports it too! parent_2 CHILD_2_1 Cool features CHILD_2_2 Cool features parent_3 CHILD_3_1 Cool features php-solr-2.5.1+2.4.0/solr-2.5.1/tests/files/response_xml.4.xml000066400000000000000000000037211374041537100232160ustar00rootroot00000000000000 0 0 *:* 0 2 xml GB18030TEST Test with some GB18030 encoded characters No accents here 这是一个功能 This is a feature (translated) 这份文件是很有光泽 This document is very shiny (translated) 0.0 true 1513324811722424320 SP2514N Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133 Samsung Electronics Co. Ltd. samsung electronics hard drive 7200RPM, 8MB cache, IDE Ultra ATA-133 NoiseGuard, SilentSeek technology, Fluid Dynamic Bearing (FDB) motor 92.0 6 true 2006-02-13T15:26:37Z 35.0752,-97.032 1513324812366249984 php-solr-2.5.1+2.4.0/solr-2.5.1/tests/files/sample.html000077500000000000000000000003531374041537100217640ustar00rootroot00000000000000 Welcome to Solr

Here is some text

distinct
words

Here is some text in a div
php-solr-2.5.1+2.4.0/solr-2.5.1/tests/files/sample_1.xlsx000077500000000000000000000107511374041537100222410ustar00rootroot00000000000000PKzH _rels/.relsJ1}{wDdЛH}a70u}{ZI~7CfGFoZ+{kW#VJ$cʪl n0\QX^:`dd{m]_dhVFw^F9W-(F/3ODSUNl/w{N([qTuz_ydr| 4^5l[?/\- 'hpb0Tkɯ9//PKi>gPKzHdocProps/core.xmln0 {*6Mᰉ&M4[I$Px6qvlj=X'[]"(-JD<~D\Wi5]! w^H;*L[P%i>Ɔ/^4 <f$#l3*;L/^V rT ܴ}pr4v]t'xKݏJbũ*,pUY<,e)tOK@ɔfiu ccբ\Ƃ*n#S1[4)u8D}PKpYoL/LPKzHxl/_rels/workbook.xml.relsMk0 FIc8AQ6ֵ~.[ eГH4C vV͢h%؀I/Z8Y.b;]JNɺQ/IӜS[n+Psc _{0 r3Rb+/2m=?"#ʯR6w _fz o ۭP~$E|PKOz%PKzHxl/sharedStrings.xmleA 0E"ަH.OhɤfRooE{4SꎅC& .t\@x|̄иa5za5=&UK2cj {DIQz# mÇ8Igߎ}"˯ZϟPKPKzHxl/worksheets/sheet1.xmlUKs6W`xȩI9]bƕ&3f7XR_C:PoL>(96\yOr?>T2*y&~6% <(ndLT5%xT(JN2,)ApC9`i Z 2AxMr.,/a9PW=l~> :u&a{9MG!2vG3z'G.:nYOeIL+LԼ9Pju q' +2V Z~!-mAs`{ t})wJ rZ B@wJw2[ Hl?#*Un3*8FTx/|ZD;Fz> {E]õQM4w\%滯]<߻|KaL M'AwKcA8[  %/t GK3[,̦:^.|ȍxI-MD{6VM8..VVY"sJm^vuH$<[-s[Eob] **ͥ]W~I j0L .У<;WBcG.\]_9ة~ΦWkS3M|몮p*[]'7kcx=v[jo8صqkɧ rzNVo"%LnpFt۸"CN?Ҳؕgd~"W>xc CHxa4Q57}G?}Cp?a\7JoOm0 !:Nx+ yPKK PKzH xl/styles.xml]O0+,ߏ `t4!E4$NbvsiRv+Rl9c[u-GOTBLTd>%2%\I:5,[qzWPjKUR O20y`JMIj\0 ǁ L8s1֠Dͥ|=q<.U V]]_ݞA 2%WBD8@B.~|Nʈ`F-ÝIWy[!BZϪ*+a=CtI5u}P:]V/\I 7W,bqYk Z%qS{rہۧ?ۇ]doÌ%AFCz9gt-F+K[Z# Dns*uuҲI}1tao%5)g Ed2'gL>ԔLekq]$]-E)2pֵxY>b>TmʸQ-Ý>㝕^Eŵ Jj ,o.yLbV=1l0>j!_:EKP!tVɍ3hc 567x@HqNj`% 4`qlNgM#Cc}3Q9"%:;j PyH:2p/.hzDÿ!ZʺR}PKb4WPKzHf; _rels/.relsPKzHi>gdocProps/app.xmlPKzHpYoL/L9docProps/core.xmlPKzHOz%xl/_rels/workbook.xml.relsPKzHxl/sharedStrings.xmlPKzHK xl/worksheets/sheet1.xmlPKzH v xl/styles.xmlPKzHsgG xl/workbook.xmlPKzHb4W[Content_Types].xmlPK ?php-solr-2.5.1+2.4.0/solr-2.5.1/tests/files/solr-word.pdf000077500000000000000000000510741374041537100222460ustar00rootroot00000000000000%PDF-1.3 % 4 0 obj << /Length 5 0 R /Filter /FlateDecode >> stream xRN@ +渑`Nh> endobj 6 0 obj << /ProcSet [ /PDF /Text ] /ColorSpace << /Cs1 7 0 R >> /Font << /F1.0 8 0 R >> >> endobj 9 0 obj << /Length 10 0 R /N 3 /Alternate /DeviceRGB /Filter /FlateDecode >> stream xMHaї$T& R+SeL b}wg-E"u.VDNC:DuE^";cT03y|URcE4`λޘvztLUF\)s:k-iYj6|vP4*wd>,y vڴ=S԰79 ڸ@`ӋmvUl5`P=Gj)kP*}6~^/~.~a2 nײ0%f|U 9l7?j`l7"tiNf]?uhgM Zʲ4i[&LY_x {xO$̥߬S]%֧&7g̞>r=g8`候 8rʶ<dWT'<eL~.u"A=9뗚]>313X3-$e}u,gmg664$ыEzL*LZ_j_]Xy[?Xs N/ ]|msϚƫk_WfȸA2)oz-di2|m٣j|5ԥej8ɮeE7[Q|IM%ײxf)|6\ k`Ҳ䍐.> endobj 11 0 obj << /Type /Catalog /Pages 3 0 R >> endobj 12 0 obj << /Length 13 0 R /Length1 24324 /Filter /FlateDecode >> stream x |\U?~νwΚ̞ٗL2IICI%.$t MYJ BiJK (A+Z/P}XyUH=wR(~?w~Yx߸z?!/Z/8%B4(]q7%x֭Zτ@ȅ=xi"I·#pV}^ف0cMkV{8!6U )"5^WnKoDfhӖF~hY14ntD !&+(%. Y9#G?HVYreW?"N6>yD;O@¤#mӧ4ay/Qc1 !I[S0ȷ>v^Gτa B*ULUcA4i ?B Md/ r79@@'/_7{BChj@ݭ.<' %{j< +rq@Q"p䶾O9;iАƬ|zx.+񬢫<B?O(?oGh/'w2} w`˸wiB}ķs2VB 7+!iv ŃmŃIP8YXջ9P;3 +4(>$W`Mq{w;_$z Hpq0I />KߤGbN*q: $Zdž8;p'FJ%\OyMki&_?;؊wb#OH H=y0x;q#t-O+I-ж]pU]Zʚ )t3 ށg-Gn/H7u\MZѾ!!V7㍯N/ O(Gvs{DZ %Ҏ|s2P~|)YO^#Md[H /Gwo/ oEϷ9g^W_&'H5Fh5ir53m?Ar!PEG%y#=#įxK˗I9n)4jjl岵t&Ǣpu(YY-fd4uZZTI`+iͤ`DG88NW^ ;}Ҥ_"GeP/;:%:,۾ao`G&MuLW Us:[qDm@KpGgƫ(vZ[깨 e%ھ&DsKՔ%\MzCJOs\$Sᵫ.-PFgɜBO;? pK{S=NAyҁz{b%7w*Ե4[zKVTd`}n] ^,is^9q-wnXqw. JEOoUxat}:%>$+zh {a+iO|]<($ђ0̬udf ?~}ob>(i-EZRDpp ?<ާcV( KdP1@fJjj1h9ܘIoJ!1Gz0ZPMY@iJ8HV{ƈMA2q.žK0)y`/cMڹDuᮋV;lײO*l@1nHʋ-) W쯈 w^1K m,Y{yrQKW+z,!J chp^I\P4^>ޒO^s%5ӫJK?T{eN\ײ{j?6xoy༽{WGVbx1; U3wxJCW69GؾwIQl p*)OEw[LjBO*9BKTCpk^GE,}\_qttJT`R[Q -&{>bFL&r~j_2?I-jTrn66cj2\klh;657kT*]bkj~}=VƦi2}|n֑%RKQ#4t栆ܪzékC].*RV[=ٮJ` :HRΣ&~Q.n>`Q4[l>?\B xHZB᪐+0 +pBE-9dQXo5喅4(i0L§|8TZUz,kK/rtHի#J0Ų-ۭ$3B!˵n.Fm1ɻ| 걺VTM7ts1_n&+ R|=1ί8%y.}/<_Zٙ[B[bw}eîE;| b 9ȎS4+I#h,ԋ_~(| )T#>>Zp^?NcAQP2q,&(#qzD%Fy|I2V}$H4Er*k"Kk$ibj!DO"dLD-`uVcPeK&"" J5 5)8 t?=NSAș y2JVNs24+UasU:*|V!DnOywt ]>U4=qfħySڸ*N>pٮv^~}mҟ[V_E+Щ9{%UjX[[鿊^]ʯΆ/yS9-)N3CwGgqő.V,Vv;H=>֨ ꅴKPkV{ .ѭݪE{δq ܠ:OZkgD_8)5![E7ǀ|Peg^з:˯II]9]Nyc@ǹVC2#.ӈqIfAW;( Gt=NCFcDёhTgHFE),QK5PD`d u*X`eDŋ*zFE{j~Mu<vyauVsS3ԨjNVsF]!H>XKó/iV7icX Ee  TMMMjqRl xޱ-~=De稱0+3甤A] Y0ڄFfԝQY1i7*(l'h7?i卛4]0Y']qX4[mI[.k_Jwwh^|flnEd̊d`nnmSZ븇҃4}^4k?D>Ϲ?%W5iT8a>z}j x,P,T$V$qCY&@*% k]&,U,U.Szz2z);f*W8{ƒAvw.y&w0|'?TԩY.#8>V90L7a0Oʉ!: q$$h@ Bƶ野F6f+0GjI]=s0 xp~hXG~7uSd9ĩ *sJIPWP o^2?yjsLJ''7cϰyeI.m6a577~9xx3G(("Cb\inJ@*p5G" k7JlYY{EY}zSۯQ%l̾=_o~^ |лE0^TJ#j#QL]:8Y|35AMЇ С A!0 ژL&K I99W+L̐:T{"?QdQLdϟߐebna0{pb0=ȪH#YG=\\,u 4]_x@V5=A =xu/n ^OWSXq}o6k:!mG-t.Qzbt8:c9Q }z~}׌sp?Ddfmr]6WĿO~DN*LܱGcdX U4Hk 0T .C8d3veģtZ7!O;Gwm :)5gL!'>Sl]Ligϻ_o_[C|9%ZP{Ï~+g.Kг;g`:vDoH9 G/G2OtYETSd6axW7l=u:b\TLMdOL0t;@I8kiN=r}ռ艺>V7,9d1(FYK4Kc6-ڌ}d~8DFlDA[dI6@̤O) }2{ǘ:FTM.LFc38 Ky*!O%m&4]t\As##}*+R*lGC` a7ڵWޚ |/8>]k֭k ~xKoY W]Mys~s$ZES=ؾj?"|^|x,c&5NEɐHR,m2à RqŊ] 5)qxҨ4JhcVv)lϑ>+NZ,/kmn-Nao)S K4nsĢXԑ-L* bC`('Ǒ9ܘ3#Ɨ&>Y:f2156{d- @ V+yO=2RD Z|w[Gj[/77f\Ԛ2ivDl NxNIz9krTXD,А׃qex_OXx>x.o h''N2K5h@LDD8YdB,Qٕj],jCoڂPޥ+B*E;Ӷ"#Uze8T aI{t9upq*coˁ5TtnA**buX?keuf욚7ڦk=MMqKh= (ݭ/.Sd{ o g*x¤Pk+j&W-I2 mVMR)F R.qvè~H???WC)[gp!2g3~}0XuNwL͊>l[g2A <^(Ldۨ69 THIe\g\-ϸ!CY8Gc >e\O.—)}R&IXu<Ͽ$-+%I\J: W 00&bԫib6+z}>Ǧ0q:.:bC\^'U7E2R0! ]rb$ee>9''22/{X4{%ll+oiW72ʟkiljmTd*JRFHG'yڑ*L@2,V'Ea_0u񚶜KyyD#dV9"Q5- Ղ1d ${Li$9,%y6!il`C`BWyBTϱj} 4 @|5Ӯtuusg[Vh[rvkzm^8oDm)n{]+ZoqI%S7vM>O$2-]7â<֙8Jy2˲B pzaxy$+lBN(#UD@EY>7{`-dE,RqBƼ`kPx,,d[Nˈ>8C5JtqVzfu* 7 @dhIP}5T7!p PIf0*DϺqDzvØTW) + ;"L<[_{sC׿+9/"*y/ &D1.iʘd uCS eUKa f>(RA2o)^orcsW v+ H^UTgƙJSU5;]@Vj򮗯_Ksnb>?w|^V|Mug.sz `-N \ %g˧㱭 lE|*`kP>$_2G2ޅd`)`TjY56)Uq    + \Y@R& 6#t ~ԗ?:^`rtrvv Z'íUƑVH%0$ "WBi21:6E%b|GQ; B3p[Ngw?|ezzyGêwr{} i6ͪDb &۪I3&PwO:8K* be-p,mԹvT jGOA$֞`:qS9Q[Qf=b- S)(2? fUu!墍 `5M RW<'f`˶Ky91J9"8o LlΩ[s{拏oz|QS5t͊[bk\tԛF;Vmɯ첛2^Cԡ[˯9ncBeF= XN#3!Y2e" P f9l 3d<?Kf)dFAa !@Ep= vB󷒱;)+* 0Ol_ĘO@:(.w7ivA8h fx-6rx(3#K'$'NŇ@ zI *js_u[8՘mA ETC()e%H ґh#A1X NSL>z8eUd?̡Iz3\Q#egP]vnw{4D—-Lj;g:5ڥU@8R;g?kOǛ:m˦.FbC+oV(Y[>R'4KW{# P~$4iP O#ǣ y={GM,t>ǏG#̾ZҫM;lJzh~%xOΒ2$ҋuҷ ̿ޫO;h45FEjdq]7ALKt}-Ht).; ?!s FɎm,XJ-/Bq&Lt4d57IUPSuzƇ#q>Ź34HiPʲ)v>Q|YXN0N#OL A n:b 9ھnmkR99{614Td (B=#`y2b DPxF-蛀Cfz>?0-mOs/FQϨ/g`bRPSll8#WҊ>tN2'&*PI[`䘶sBri JFR4Bq"'l3ٹ6@- =u9fN*A&w@xl/PH1 ,OȬƆ0aY@(+ eU SoF9) sص[ l[1d2BWw^jL+mZ7=pG\(ӜH_n:λ.*t^6RdU&{r[\ЩIm>Gz**29:'/%NOBaZ`@:qE\۟wq7T` ߝ/ڝq';]n29@y{ Z-Rxhl8}OJAzɞ&qV )i!8X%̆e)viKc:PjEj>cG:j{k0kK*)0ySL^Xm9X[Gn4d=*3pi 1!Ct S5sdf%,2 'd3 ҩ ̻c^սZFTݔ.n^m5ljX47NJBCe[6/-Nt5H-+\+=-Tt]]]U_Tu>&d6bH'ɪlVlYY"̨D0bَ_ieeG%EYd1@QN耫\|sd!Hk:ltSxaWϼL=흍QPE]*U1jklx.z85|<5gcN-oP5Ldk4l 8>->JwX ׳:L6[9,q|"cr%gbȴ<fL}1YjknVܪ4ER5);X"$kMF|k<שwhwuo\ޣ㺟ܯԳdaFJkjT f$]5-1uvj6dHRچ+5nU kV 8]$#Zφ >SCU yi3LD1 D;ǹTHԫ 5c߹o MbK b\|ֈOo>=u^ع_A,: 6 VW"qC.T"ԡr#`*"*̠YV==žmO3'*uuDNk^<+*$M!X}zd¢{W2?;5yiN~p6qlҪ?sS1 mo>}΅TnL gD#g xO$í-Ts+ <50_P-$S 3"'<' a t]=N7p szN4#koC |0_ V]T{M qjmߵJ۰/_`7Ȱh&-~jwar]q-MWgerW&F$=qukX-oknZtpC bg|ʟe 7;;qZK$돱1;o'Q,cܹ3pMm(Eoo-֟i3 7BB&)pD8)̿>^3Q1Nܲud&amtR2$)30?Jv9#LOO},&}0Y??_O@vw7:q9? \v |%{a~q&&u=o6?҃09{Cw/B6ŵU[ȝcg" ƷZnWGut%݄NQRN(O*O)(z!rz t#:^u9)p[&- `0O`D🂫@Ȅ|&3!քXb l33Rtar0`(aH5"H8" 2 I#PSj`KͤU~U,MṏU$-%$MRV/UÂ@x :xXݔv'b(>,@& p H->//oZk1? Swx, :#c.w,Sl 3{?0<>.>H0EM0wvbon7f,QȾ>ΣO0,wwP/>%wfV>; J"_BކAɰ0C0a~%KKoy{*ʆ:{TjVm" c}llG$" ]dm!>n vHҵj3tmVEB vV2I/d 2-dkaspA5p61W1{lp]ŀᒀaVfR̕ml{MSa"g &Zkm pZ{~4XtN҅4@6.%p\ iQk2_'jCގq#{_KF_K@_ ,חҧ{Xz^9Zh3O 9w r%gj\7"F*zk&Q7c W+ܗXD`HZQ D7ӅEYSr(㉣ MY>mRZ7XP]ʫ2ljZTJ^D/0NI)ٔ[ m\ %EFlEvJVZ:,]kҬT׸|q>J,eu7fA>@iCG ~ۮҵ:X`)heI$Eg2\?Xr`yilf9}ꙧ*g-:;qC=F6w^}gò&,l՝aLߣ Y&LLͬ 'gL'$f0/t(E}iX}fEPt'a9#,1\'Cz*E$*y3y857(^ktp:78K#Ck%K|lp ]uU{-y K^8Dt.=FZ1JZ^w]]ku kgu="bɏX]]GG人.Kzz\v"qà'7!͑F3@=4ui˴$NdDi&yLhsx.IglٲmRnc`ц3ZKOOCmJ/rZwkzUmv$/Ws՛wU_}Z.=*K5 DɪBpgИ-[*JRpVVMրۥ3,\0y0 }ؿOf|0\EjCpGo\c=W]^qVֶz1֏6oJc7`/_˅׷l1ݶmLfY[R[q zΆ{3`'z"<#t6A&9~ { us?v{U endstream endobj 13 0 obj 17764 endobj 14 0 obj << /Type /FontDescriptor /Ascent 891 /CapHeight 670 /Descent -216 /Flags 32 /FontBBox [-568 -307 2029 1006] /FontName /NHHCFL+TimesNewRomanPSMT /ItalicAngle 0 /StemV 0 /Leading 42 /MaxWidth 2000 /XHeight 454 /FontFile2 12 0 R >> endobj 15 0 obj [ 250 0 0 0 0 0 0 0 0 0 0 0 250 0 250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 722 0 556 0 0 0 0 0 0 0 0 0 556 0 0 556 611 0 0 944 0 0 0 0 0 0 0 0 0 444 0 444 500 444 333 0 500 278 0 0 278 0 500 500 500 0 333 389 278 0 0 0 500 500 ] endobj 8 0 obj << /Type /Font /Subtype /TrueType /BaseFont /NHHCFL+TimesNewRomanPSMT /FontDescriptor 14 0 R /Widths 15 0 R /FirstChar 32 /LastChar 121 /Encoding /MacRomanEncoding >> endobj 1 0 obj << /Title (solr-word) /Author (Grant Ingersoll) /Subject (solr word) /AAPL:Keywords [ (solr, word, pdf) ] /Keywords (solr, word, pdf) /Creator (Microsoft Word) /Producer (Mac OS X 10.5.5 Quartz PDFContext) /CreationDate (D:20081113133551Z00'00') /ModDate (D:20081113133551Z00'00') >> endobj xref 0 16 0000000000 65535 f 0000020275 00000 n 0000000437 00000 n 0000001588 00000 n 0000000022 00000 n 0000000418 00000 n 0000000541 00000 n 0000001553 00000 n 0000020093 00000 n 0000000639 00000 n 0000001533 00000 n 0000001671 00000 n 0000001721 00000 n 0000019576 00000 n 0000019598 00000 n 0000019843 00000 n trailer << /Size 16 /Root 11 0 R /Info 1 0 R /ID [ <6b8708c3178614e61c264756c0036b1a> <6b8708c3178614e61c264756c0036b1a> ] >> startxref 20574 %%EOF php-solr-2.5.1+2.4.0/solr-2.5.1/tests/skip.if.server_not_configured.inc000066400000000000000000000001661374041537100251420ustar00rootroot00000000000000 php-solr-2.5.1+2.4.0/solr-2.5.1/tests/test.config.inc000066400000000000000000000037061374041537100214330ustar00rootroot00000000000000