温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

php7.2编译安装php-solr扩展

发布时间:2020-03-08 06:39:44 来源:网络 阅读:1655 作者:霜见 栏目:web开发

最近在用solr做一个高速的缓存系统,使用的php版本是7.2,我用的是本地mac系统,在使用homebrew安装php72-solr扩展的时候找不到这个包,没办法只能自己编译安装。
但是安装过程比较坎坷,solr的扩展在php7.2编译安装中有bug,踩了不少坑。

下载源码包

下载地址:

https://pecl.php.net/package/solr

我下载的是2.4.0版本,旧版本不支持php7.

编译过程

1.解压进入目录
2.执行phpize,生成configure配置文件
3.执行 ./configure 进行编译前配置
4.make && make install

坑就在这里

默认情况下如果是php7.2会报以下类似错误:

/bin/sh /Users/tal/Desktop/solr-2.4.0/solr-2.4.0/libtool --mode=compile cc  -I. -I/Users/tal/Desktop/solr-2.4.0/solr-2.4.0 -DPHP_ATOM_INC -I/Users/tal/Desktop/solr-2.4.0/solr-2.4.0/include -I/Users/tal/Desktop/solr-2.4.0/solr-2.4.0/main -I/Users/tal/Desktop/solr-2.4.0/solr-2.4.0 -I/usr/local/Cellar/php@7.2/7.2.13/include/php -I/usr/local/Cellar/php@7.2/7.2.13/include/php/main -I/usr/local/Cellar/php@7.2/7.2.13/include/php/TSRM -I/usr/local/Cellar/php@7.2/7.2.13/include/php/Zend -I/usr/local/Cellar/php@7.2/7.2.13/include/php/ext -I/usr/local/Cellar/php@7.2/7.2.13/include/php/ext/date/lib -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/libxml2  -I/usr/local/Cellar/php@7.2/7.2.13/include/php -I/usr/local/Cellar/php@7.2/7.2.13/include/php/main -I/usr/local/Cellar/php@7.2/7.2.13/include/php/TSRM -I/usr/local/Cellar/php@7.2/7.2.13/include/php/Zend -I/usr/local/Cellar/php@7.2/7.2.13/include/php/ext -I/usr/local/Cellar/php@7.2/7.2.13/include/php/ext/date/lib -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/libxml2 -DHAVE_CONFIG_H  -g -O2   -c /Users/tal/Desktop/solr-2.4.0/solr-2.4.0/src/php7/php_solr.c -o src/php7/php_solr.lo
 cc -I. -I/Users/tal/Desktop/solr-2.4.0/solr-2.4.0 -DPHP_ATOM_INC -I/Users/tal/Desktop/solr-2.4.0/solr-2.4.0/include -I/Users/tal/Desktop/solr-2.4.0/solr-2.4.0/main -I/Users/tal/Desktop/solr-2.4.0/solr-2.4.0 -I/usr/local/Cellar/php@7.2/7.2.13/include/php -I/usr/local/Cellar/php@7.2/7.2.13/include/php/main -I/usr/local/Cellar/php@7.2/7.2.13/include/php/TSRM -I/usr/local/Cellar/php@7.2/7.2.13/include/php/Zend -I/usr/local/Cellar/php@7.2/7.2.13/include/php/ext -I/usr/local/Cellar/php@7.2/7.2.13/include/php/ext/date/lib -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/libxml2 -I/usr/local/Cellar/php@7.2/7.2.13/include/php -I/usr/local/Cellar/php@7.2/7.2.13/include/php/main -I/usr/local/Cellar/php@7.2/7.2.13/include/php/TSRM -I/usr/local/Cellar/php@7.2/7.2.13/include/php/Zend -I/usr/local/Cellar/php@7.2/7.2.13/include/php/ext -I/usr/local/Cellar/php@7.2/7.2.13/include/php/ext/date/lib -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/libxml2 -DHAVE_CONFIG_H -g -O2 -c /Users/tal/Desktop/solr-2.4.0/solr-2.4.0/src/php7/php_solr.c  -fno-common -DPIC -o src/php7/.libs/php_solr.o
/Users/tal/Desktop/solr-2.4.0/solr-2.4.0/src/php7/php_solr.c:560:56: error: use of undeclared identifier
      'ZEND_ACC_CLONE'; did you mean 'ZEND_AST_CLONE'?
        PHP_ME(SolrDocument, __clone, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CLONE)
                                                              ^~~~~~~~~~~~~~
                                                              ZEND_AST_CLONE
/usr/local/Cellar/php@7.2/7.2.13/include/php/main/php.h:422:25: note: expanded from macro 'PHP_ME'
#define PHP_ME          ZEND_ME
                        ^
/usr/local/Cellar/php@7.2/7.2.13/include/php/Zend/zend_API.h:81:108: note: expanded from macro 'ZEND_ME'
#define ZEND_ME(classname, name, arg_info, flags)       ZEND_FENTRY(name, ZEND_MN(classname##_##name), arg_info, flags)
                                                                                                                 ^
/usr/local/Cellar/php@7.2/7.2.13/include/php/Zend/zend_API.h:70:157: note: expanded from macro 'ZEND_FENTRY'
  ...{ #zend_name, name, arg_info, (uint32_t) (sizeof(arg_info)/sizeof(struct _zend_internal_arg_info)-1), flags },
                                                                                                           ^
/usr/local/Cellar/php@7.2/7.2.13/include/php/Zend/zend_ast.h:76:2: note: 'ZEND_AST_CLONE' declared here
        ZEND_AST_CLONE,
        ^
/Users/tal/Desktop/solr-2.4.0/solr-2.4.0/src/php7/php_solr.c:603:61: error: use of undeclared identifier
      'ZEND_ACC_CLONE'; did you mean 'ZEND_AST_CLONE'?
        PHP_ME(SolrInputDocument, __clone, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CLONE)
                                                                   ^~~~~~~~~~~~~~
                                                                   ZEND_AST_CLONE
/usr/local/Cellar/php@7.2/7.2.13/include/php/main/php.h:422:25: note: expanded from macro 'PHP_ME'
#define PHP_ME          ZEND_ME
                        ^
/usr/local/Cellar/php@7.2/7.2.13/include/php/Zend/zend_API.h:81:108: note: expanded from macro 'ZEND_ME'
#define ZEND_ME(classname, name, arg_info, flags)       ZEND_FENTRY(name, ZEND_MN(classname##_##name), arg_info, flags)
                                                                                                                 ^
/usr/local/Cellar/php@7.2/7.2.13/include/php/Zend/zend_API.h:70:157: note: expanded from macro 'ZEND_FENTRY'
  ...{ #zend_name, name, arg_info, (uint32_t) (sizeof(arg_info)/sizeof(struct _zend_internal_arg_info)-1), flags },
                                                                                                           ^
/usr/local/Cellar/php@7.2/7.2.13/include/php/Zend/zend_ast.h:76:2: note: 'ZEND_AST_CLONE' declared here
        ZEND_AST_CLONE,
        ^
/Users/tal/Desktop/solr-2.4.0/solr-2.4.0/src/php7/php_solr.c:636:54: error: use of undeclared identifier
      'ZEND_ACC_CLONE'; did you mean 'ZEND_AST_CLONE'?
        PHP_ME(SolrClient, __clone, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CLONE)
                                                            ^~~~~~~~~~~~~~
                                                            ZEND_AST_CLONE
/usr/local/Cellar/php@7.2/7.2.13/include/php/main/php.h:422:25: note: expanded from macro 'PHP_ME'
#define PHP_ME          ZEND_ME
                        ^
/usr/local/Cellar/php@7.2/7.2.13/include/php/Zend/zend_API.h:81:108: note: expanded from macro 'ZEND_ME'
#define ZEND_ME(classname, name, arg_info, flags)       ZEND_FENTRY(name, ZEND_MN(classname##_##name), arg_info, flags)
                                                                                                                 ^
/usr/local/Cellar/php@7.2/7.2.13/include/php/Zend/zend_API.h:70:157: note: expanded from macro 'ZEND_FENTRY'
  ...{ #zend_name, name, arg_info, (uint32_t) (sizeof(arg_info)/sizeof(struct _zend_internal_arg_info)-1), flags },
                                                                                                           ^
/usr/local/Cellar/php@7.2/7.2.13/include/php/Zend/zend_ast.h:76:2: note: 'ZEND_AST_CLONE' declared here
        ZEND_AST_CLONE,
        ^
/Users/tal/Desktop/solr-2.4.0/solr-2.4.0/src/php7/php_solr.c:713:54: error: use of undeclared identifier
      'ZEND_ACC_CLONE'; did you mean 'ZEND_AST_CLONE'?
        PHP_ME(SolrParams, __clone, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CLONE)
                                                            ^~~~~~~~~~~~~~
                                                            ZEND_AST_CLONE
/usr/local/Cellar/php@7.2/7.2.13/include/php/main/php.h:422:25: note: expanded from macro 'PHP_ME'
#define PHP_ME          ZEND_ME
                        ^
/usr/local/Cellar/php@7.2/7.2.13/include/php/Zend/zend_API.h:81:108: note: expanded from macro 'ZEND_ME'
#define ZEND_ME(classname, name, arg_info, flags)       ZEND_FENTRY(name, ZEND_MN(classname##_##name), arg_info, flags)
                                                                                                                 ^
/usr/local/Cellar/php@7.2/7.2.13/include/php/Zend/zend_API.h:70:157: note: expanded from macro 'ZEND_FENTRY'
  ...{ #zend_name, name, arg_info, (uint32_t) (sizeof(arg_info)/sizeof(struct _zend_internal_arg_info)-1), flags },
                                                                                                           ^
/usr/local/Cellar/php@7.2/7.2.13/include/php/Zend/zend_ast.h:76:2: note: 'ZEND_AST_CLONE' declared here
        ZEND_AST_CLONE,
        ^
4 errors generated.
make: *** [src/php7/php_solr.lo] Error 1

百度根本搜不出来,谷歌了一下信息也非常少,但是也发现了蛛丝马迹,就在这个链接:

https://bugs.php.net/bug.php?id=74736

发现有人已经报出了这个bug,官方对文件进行了修复,但是并没有release新的包,所以导致下载的2.4.0存在bug。
进入底下的链接,发现针对php7.2修正了两个文件:

https://git.php.net/?p=pecl/search_engine/solr.git;a=commit;h=744e32915d5989101267ed2c84a407c582dc6f31
  • src/php7/php_solr.c
  • src/php7/solr_functions_helpers.c

分别查看这两个文件的diff,在自己下载的本地源码中修改这两个文件对应的位置,再make && make install就没问题了。

下面贴出两个文件修改后的源码:
src/php7/php_solr.c:

/*
   +----------------------------------------------------------------------+
   | 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 <iekpo@php.net>                                 |
   |          Omar Shaban <omars@php.net>                                 |
   +----------------------------------------------------------------------+
*/

/* $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)
    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)
    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)
    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)
    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
 */

src/php7/solr_functions_helpers.c:

/*
   +----------------------------------------------------------------------+
   | 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 <iekpo@php.net>                                 |
   |          Omar Shaban <omars@php.net>                                 |
   +----------------------------------------------------------------------+
*/

/* $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 <doc> 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);
    #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 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
 */
向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI