1 /* 2 +----------------------------------------------------------------------+ 3 | Copyright (c) The PHP Group | 4 +----------------------------------------------------------------------+ 5 | This source file is subject to version 3.01 of the PHP license, | 6 | that is bundled with this package in the file LICENSE, and is | 7 | available through the world-wide-web at the following url: | 8 | http://www.php.net/license/3_01.txt | 9 | If you did not receive a copy of the PHP license and are unable to | 10 | obtain it through the world-wide-web, please send a note to | 11 | license@php.net so we can mail you a copy immediately. | 12 +----------------------------------------------------------------------+ 13 | Authors: | 14 | Israel Ekpo <iekpo@php.net> | 15 | Omar Shaban <omars@php.net> | 16 +----------------------------------------------------------------------+ 17 */ 18 19 #ifndef SOLR_CONSTANTS_H 20 #define SOLR_CONSTANTS_H 21 22 #include "php_solr_version.h" 23 24 #define SOLR_SPACE_STRING " " 25 26 /* {{{ Constants for the SolrClient with*/ 27 #define SOLR_DEFAULT_UPDATE_SERVLET "update" 28 #define SOLR_DEFAULT_EXTRACT_SERVLET "update/extract" 29 #define SOLR_DEFAULT_SEARCH_SERVLET "select" 30 #define SOLR_DEFAULT_THREADS_SERVLET "admin/threads" 31 #define SOLR_DEFAULT_PING_SERVLET "admin/ping" 32 #define SOLR_DEFAULT_TERMS_SERVLET "terms" 33 #define SOLR_DEFAULT_SYSTEM_SERVLET "admin/system" 34 #define SOLR_DEFAULT_GET_SERVLET "get" 35 36 #define SOLR_PHP_SERIALIZED_RESPONSE_WRITER "phps" 37 #define SOLR_PHP_NATIVE_RESPONSE_WRITER "phpnative" 38 #define SOLR_XML_RESPONSE_WRITER "xml" 39 #define SOLR_JSON_RESPONSE_WRITER "json" 40 41 #define SOLR_REQUEST_DEFAULT_HOST "localhost" 42 #define SOLR_REQUEST_DEFAULT_PATH "solr" 43 #define SOLR_REQUEST_DEFAULT_QS_DELIMITER "&" 44 #define SOLR_REQUEST_DEFAULT_PORT 8983L 45 46 #define SOLR_CURL_MAX_WRITE_SIZE CURL_MAX_WRITE_SIZE 47 #define SOLR_CURL_OPTIONS_LENGTH 512 48 /* }}} */ 49 50 /* {{{ Names of Objects */ 51 #define PHP_SOLR_OBJECT_CLASSNAME "SolrObject" 52 #define PHP_SOLR_DOCUMENT_CLASSNAME "SolrDocument" 53 #define PHP_SOLR_DOCUMENT_FIELD_CLASSNAME "SolrDocumentField" 54 #define PHP_SOLR_INPUT_DOCUMENT_CLASSNAME "SolrInputDocument" 55 #define PHP_SOLR_EXTRACTREQUEST_CLASSNAME "SolrExtractRequest" 56 #define PHP_SOLR_CLIENT_CLASSNAME "SolrClient" 57 #define PHP_SOLR_PARAMS_CLASSNAME "SolrParams" 58 #define PHP_SOLR_QUERY_CLASSNAME "SolrQuery" 59 #define PHP_SOLR_COLLAPSE_FUNCTION_CLASSNAME "SolrCollapseFunction" 60 #define PHP_SOLR_MODIFIABLE_PARAMS_CLASSNAME "SolrModifiableParams" 61 #define PHP_SOLR_RESPONSE_CLASSNAME "SolrResponse" 62 #define PHP_SOLR_QUERY_RESPONSE_CLASSNAME "SolrQueryResponse" 63 #define PHP_SOLR_UPDATE_RESPONSE_CLASSNAME "SolrUpdateResponse" 64 #define PHP_SOLR_PING_RESPONSE_CLASSNAME "SolrPingResponse" 65 #define PHP_SOLR_GENERIC_RESPONSE_CLASSNAME "SolrGenericResponse" 66 #define PHP_SOLR_UTILS_CLASSNAME "SolrUtils" 67 68 #define PHP_SOLR_EXCEPTION_CLASSNAME "SolrException" 69 #define PHP_SOLR_ILLEGAL_OPERATION_EXCEPTION_CLASSNAME "SolrIllegalOperationException" 70 #define PHP_SOLR_ILLEGAL_ARGUMENT_EXCEPTION_CLASSNAME "SolrIllegalArgumentException" 71 #define PHP_SOLR_CLIENT_EXCEPTION_CLASSNAME "SolrClientException" 72 #define PHP_SOLR_SERVER_EXCEPTION_CLASSNAME "SolrServerException" 73 #define PHP_SOLR_MISSING_MANDATORY_PARAMETER_EXCEPTION_CLASSNAME "SolrMissingMandatoryParameterException" 74 /* }}} */ 75 76 /* {{{ Informational constants */ 77 #define PHP_SOLR_EXTENSION_NAME "solr" 78 #define PHP_CURL_EXTENSION_NAME "curl" 79 #define PHP_LIBXML_EXTENSION_NAME "libxml" 80 #define PHP_JSON_EXTENSION_NAME "json" 81 82 /* }}} */ 83 84 /* {{{ Property names */ 85 #define SOLR_INDEX_PROPERTY_NAME "_hashtable_index" 86 #define SOLR_FIELD_NAME_PROPERTY_NAME "name" 87 #define SOLR_FIELD_BOOST_PROPERTY_NAME "boost" 88 #define SOLR_FIELD_VALUES_PROPERTY_NAME "values" 89 90 #define SOLR_SOURCELINE_NO_PROPERTY_NAME "sourceline" 91 #define SOLR_SOURCEFILE_PROPERTY_NAME "sourcefile" 92 #define SOLR_ZIFNAME_PROPERTY_NAME "zif_name" 93 94 #define SOLR_DISMAX_DEFAULT_PARSER "edismax" 95 96 #ifdef PHP_WIN32 97 #define __func__ __FUNCTION__ 98 #endif 99 100 #define SOLR_FILE_LINE_FUNC __FILE__, __LINE__, __func__ 101 /* }}} */ 102 103 /* {{{ Constants for Method/Function arguments and return styles */ 104 #define SOLR_ARG_PASS_BY_REF_FALSE 0 105 #define SOLR_ARG_PASS_BY_REF_TRUE 1 106 107 #define SOLR_ARG_PASS_REMAINING_BY_REF_FALSE 0 108 #define SOLR_ARG_PASS_REMAINING_BY_REF_TRUE 1 109 110 #define SOLR_ARG_ALLOW_NULL_FALSE 0 111 #define SOLR_ARG_ALLOW_NULL_TRUE 1 112 113 #define SOLR_METHOD_RETURN_REFERENCE_FALSE 0 114 #define SOLR_METHOD_RETURN_REFERENCE_TRUE 1 115 /* }}} */ 116 117 /* {{{ Constants for Sorting SolrDocument Fields */ 118 #define SOLR_SORT_ASC 1 119 #define SOLR_SORT_DESC 2 120 121 #define SOLR_SORT_FIELD_NAME 1 122 #define SOLR_SORT_FIELD_VALUE_COUNT 2 123 #define SOLR_SORT_FIELD_BOOST_VALUE 4 124 /* }}} */ 125 126 /* {{{ Constants for document encoding formats */ 127 #define SOLR_XML_ENCODE_OBJ 0L 128 #define SOLR_XML_ENCODE_DOC 1L 129 /* }}} */ 130 131 /** 132 * Setting this to 8 gets rid of the extra while loops in _zend_hash_init() 133 * 134 * _zend_hash_init loops 3 times to increase the value of the size to 8 135 */ 136 #define SOLR_INITIAL_HASH_TABLE_SIZE (1<<3) 137 138 /* {{{ Memory Allocation Related Constants */ 139 #define SOLR_HASHTABLE_PERSISTENT 0 140 #define SOLR_DOCUMENT_PERSISTENT 0 141 #define SOLR_DOCUMENT_FIELD_PERSISTENT 0 142 #define SOLR_CLIENT_PERSISTENT 0 143 #define SOLR_PARAMS_PERSISTENT 0 144 #define SOLR_FUNCTIONS_PERSISTENT 0 145 /* }}} */ 146 147 /* {{{ SolrException Codes : Internal and UserSpace */ 148 149 /* {{{ Error codes and messages */ 150 151 #define SOLR_ERROR_1000 1000L 152 #define SOLR_ERROR_1000_MSG "Error un-serializing response" 153 154 #define SOLR_ERROR_1001 1001L 155 #define SOLR_ERROR_1001_MSG "SolrClient objects cannot be serialized or unserialized" 156 157 #define SOLR_ERROR_1002 1002L 158 #define SOLR_ERROR_1002_MSG "The '%s' property cannot be removed or set to NULL. SolrObject properties cannot be unset or set to NULL." 159 160 #define SOLR_ERROR_1003 1003L 161 #define SOLR_ERROR_1003_MSG "Error building HTTP query from parameters" 162 163 #define SOLR_ERROR_1004 1004L 164 #define SOLR_ERROR_1004_MSG "Unsuccessful HTTP request" 165 166 #define SOLR_ERROR_1005 1005L 167 #define SOLR_ERROR_1005_MSG "SolrInputDocument objects cannot be serialized or unserialized" 168 169 #define SOLR_ERROR_1006 1006L 170 #define SOLR_ERROR_1006_MSG "SolrObject instances are read-only. Properties cannot be added, updated or removed." 171 172 #define SOLR_ERROR_1007 1007L 173 #define SOLR_ERROR_1007_MSG "SolrDocumentField instances are read-only. Properties cannot be updated or removed." 174 175 #define SOLR_ERROR_1008 1008L 176 #define SOLR_ERROR_1008_MSG "Internal Error 1008 generated from %s %d %s. The observed error is a possible side-effect of an illegal/unsupported operation in userspace. Please check the documentation and try again later." 177 178 #define SOLR_ERROR_1009 1009L 179 #define SOLR_ERROR_1009_MSG "The observed error is a possible side-effect of an illegal/unsupported operation in userspace. This object cannot be cloned. Cloning of this object type is not yet supported." 180 181 #define SOLR_ERROR_1010 1010L 182 #define SOLR_ERROR_1010_MSG "Unsuccessful %s request : Response Code %ld. %s" 183 184 #define SOLR_ERROR_4000 4000L 185 #define SOLR_ERROR_4000_MSG "Invalid argument" 186 187 #define SOLR_ERROR_4001 4001L 188 #define SOLR_ERROR_4001_MSG "Illegal Operation" 189 190 #define SOLR_ERROR_4002 4002L 191 #define SOLR_ERROR_4002_MSG "Return value requested without processing output" 192 193 #define SOLR_ERROR_4003 4003L 194 #define SOLR_ERROR_4003_MSG "Invalid field value modifier." 195 196 197 #define SOLR_ERROR_4004 4004L 198 #define SOLR_ERROR_4004_MSG "Cannot add and modify the same field." 199 200 /* }}} */ 201 202 /* {{{ UserSpace Errors */ 203 204 #define SOLR_ERROR_4100 4100L 205 #define SOLR_ERROR_4100_MSG "Mandatory parameter Missing: %s" 206 207 /* }}} */ 208 209 /* {{{ Compile time errors */ 210 211 /* }}} */ 212 213 /* }}} */ 214 215 #endif /* SOLR_CONSTANTS_H */ 216 217 /* 218 * Local variables: 219 * tab-width: 4 220 * c-basic-offset: 4 221 * End: 222 * vim600: fdm=marker 223 * vim: noet sw=4 ts=4 224 */ 225