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 SOLRCLIENT_H 20 #define SOLRCLIENT_H 21 22 /* #define SOLR_MEM_DEBUG 1 */ 23 24 #include <main/php.h> 25 26 #ifdef HAVE_CONFIG_H 27 #include "config.h" 28 #endif 29 30 #ifdef HAVE_SOLR 31 32 #include <time.h> 33 #include <locale.h> 34 35 #include <main/php_ini.h> 36 #include <main/SAPI.h> 37 #include <main/snprintf.h> 38 39 #include <ext/standard/info.h> 40 #include <ext/standard/url.h> 41 #include <ext/standard/php_var.h> 42 #include <ext/standard/php_string.h> 43 #include <ext/standard/base64.h> 44 #include <ext/pcre/php_pcre.h> 45 46 47 #include <Zend/zend_extensions.h> 48 #include <Zend/zend_exceptions.h> 49 #include <Zend/zend_interfaces.h> 50 #include <Zend/zend_modules.h> 51 #include <Zend/zend_API.h> 52 53 #include <libxml/parser.h> 54 #include <libxml/parserInternals.h> 55 #include <libxml/tree.h> 56 #include <libxml/xpath.h> 57 #include <libxml/xpathInternals.h> 58 #include <libxml/xmlstring.h> 59 60 #include <pecl-compat/compat.h> 61 62 extern zend_module_entry solr_module_entry; 63 64 #define phpext_solr_ptr &solr_module_entry 65 66 /* {{{ Startup, Shutdown, Activation, Deactivation and Info functions */ 67 PHP_MINIT_FUNCTION(solr); /* Module Startup Function */ 68 PHP_MSHUTDOWN_FUNCTION(solr); /* Module Shutdown Function */ 69 PHP_RINIT_FUNCTION(solr); /* Request Activation Function */ 70 PHP_RSHUTDOWN_FUNCTION(solr); /* Request Deactivation Function */ 71 PHP_MINFO_FUNCTION(solr); /* Module Information Display Function */ 72 /* }}} */ 73 74 #ifdef ZTS 75 #include <TSRM/TSRM.h> 76 #endif 77 78 /* List of constants */ 79 #include "solr_constants.h" 80 81 /* List of types */ 82 #include "solr_types.h" 83 84 #ifdef ZTS 85 # define SOLR_GLOBAL(v) TSRMG(solr_globals_id, zend_solr_globals *, v) 86 #else 87 # define SOLR_GLOBAL(v) (solr_globals.v) 88 #endif 89 90 #include <ext/json/php_json.h> 91 92 #include "php_solr_api.h" 93 94 95 /* {{{ Variables declared elsewhere */ 96 ZEND_EXTERN_MODULE_GLOBALS(solr) 97 /* ZEND_EXTERN_MODULE_GLOBALS(json) */ 98 99 extern zend_class_entry *solr_ce_SolrObject; 100 extern zend_class_entry *solr_ce_SolrInputDocument; 101 extern zend_class_entry *solr_ce_SolrDocument; 102 extern zend_class_entry *solr_ce_SolrDocumentField; 103 extern zend_class_entry *solr_ce_SolrClient; 104 extern zend_class_entry *solr_ce_SolrParams; 105 extern zend_class_entry *solr_ce_SolrModifiableParams; 106 extern zend_class_entry *solr_ce_SolrCollapseFunction; 107 extern zend_class_entry *solr_ce_SolrQuery; 108 extern zend_class_entry *solr_ce_SolrResponse; 109 extern zend_class_entry *solr_ce_SolrQueryResponse; 110 extern zend_class_entry *solr_ce_SolrUpdateResponse; 111 extern zend_class_entry *solr_ce_SolrPingResponse; 112 extern zend_class_entry *solr_ce_SolrGenericResponse; 113 extern zend_class_entry *solr_ce_SolrUtils; 114 extern zend_class_entry *solr_ce_SolrException; 115 extern zend_class_entry *solr_ce_SolrIllegalOperationException; 116 extern zend_class_entry *solr_ce_SolrIllegalArgumentException; 117 extern zend_class_entry *solr_ce_SolrClientException; 118 extern zend_class_entry *solr_ce_SolrServerException; 119 extern zend_class_entry *solr_ce_SolrMissingMandatoryParameterException; 120 121 extern ZEND_API zend_class_entry *zend_ce_serializable; 122 extern ZEND_API zend_class_entry *zend_ce_arrayaccess; 123 extern ZEND_API zend_class_entry *zend_ce_iterator; 124 125 /* {{{ Aliases for external class entries */ 126 #define solr_ce_Serializable zend_ce_serializable 127 #define solr_ce_ArrayAccess zend_ce_arrayaccess 128 #define solr_ce_Iterator zend_ce_iterator 129 #define solr_ce_Exception zend_exception_get_default() 130 /* }}} */ 131 132 extern zend_object_handlers solr_object_handlers; 133 extern zend_object_handlers solr_document_field_handlers; 134 extern zend_object_handlers solr_input_document_object_handlers; 135 extern zend_object_handlers solr_client_object_handlers; 136 extern zend_object_handlers solr_response_object_handlers; 137 extern zend_object_handlers solr_collapse_function_object_handlers; 138 /* }}} */ 139 140 /******************************************************************************/ 141 /** DECLARATIONS FOR EXTENSION METHODS AND FUNCTIONS **/ 142 /******************************************************************************/ 143 144 /* {{{ Extension functions */ 145 PHP_FUNCTION(solr_get_version); 146 /* }}} */ 147 148 /* {{{ SolrObject methods */ 149 PHP_METHOD(SolrObject, __construct); 150 PHP_METHOD(SolrObject, __destruct); 151 PHP_METHOD(SolrObject, __set); 152 PHP_METHOD(SolrObject, __get); 153 PHP_METHOD(SolrObject, __isset); 154 PHP_METHOD(SolrObject, __unset); 155 PHP_METHOD(SolrObject, offsetSet); 156 PHP_METHOD(SolrObject, offsetGet); 157 PHP_METHOD(SolrObject, offsetExists); 158 PHP_METHOD(SolrObject, offsetUnset); 159 PHP_METHOD(SolrObject, getPropertyNames); 160 /* }}} */ 161 162 /* {{{ SolException object methods */ 163 PHP_METHOD(SolrException, getInternalInfo); 164 PHP_METHOD(SolrClientException, getInternalInfo); 165 PHP_METHOD(SolrIllegalOperationException, getInternalInfo); 166 PHP_METHOD(SolrIllegalArgumentException, getInternalInfo); 167 PHP_METHOD(SolrServerException, getInternalInfo); 168 /* }}} */ 169 170 /* {{{ SolrDocument methods declarations */ 171 PHP_METHOD(SolrDocument, __construct); 172 PHP_METHOD(SolrDocument, __destruct); 173 PHP_METHOD(SolrDocument, __clone); 174 PHP_METHOD(SolrDocument, __get); 175 PHP_METHOD(SolrDocument, __set); 176 PHP_METHOD(SolrDocument, __isset); 177 PHP_METHOD(SolrDocument, __unset); 178 179 /* Methods from Serializable */ 180 PHP_METHOD(SolrDocument, serialize); 181 PHP_METHOD(SolrDocument, unserialize); 182 183 /* Methods from ArrayAccess */ 184 PHP_METHOD(SolrDocument, offsetExists); 185 PHP_METHOD(SolrDocument, offsetGet); 186 PHP_METHOD(SolrDocument, offsetSet); 187 PHP_METHOD(SolrDocument, offsetUnset); 188 189 /* Methods from Iterator */ 190 PHP_METHOD(SolrDocument, current); 191 PHP_METHOD(SolrDocument, key); 192 PHP_METHOD(SolrDocument, next); 193 PHP_METHOD(SolrDocument, rewind); 194 PHP_METHOD(SolrDocument, valid); 195 196 PHP_METHOD(SolrDocument, clear); 197 PHP_METHOD(SolrDocument, addField); 198 PHP_METHOD(SolrDocument, getFieldNames); 199 PHP_METHOD(SolrDocument, getFieldCount); 200 PHP_METHOD(SolrDocument, getField); 201 PHP_METHOD(SolrDocument, toArray); 202 PHP_METHOD(SolrDocument, fieldExists); 203 PHP_METHOD(SolrDocument, deleteField); 204 PHP_METHOD(SolrDocument, sort); 205 PHP_METHOD(SolrDocument, merge); 206 PHP_METHOD(SolrDocument, getInputDocument); 207 PHP_METHOD(SolrDocument, hasChildDocuments); 208 PHP_METHOD(SolrDocument, getChildDocuments); 209 PHP_METHOD(SolrDocument, getChildDocumentsCount); 210 /* }}} */ 211 212 /* {{{ SolrExtractRequest methods */ 213 PHP_METHOD(SolrExtractRequest, __construct); 214 PHP_METHOD(SolrExtractRequest, createFromFile); 215 PHP_METHOD(SolrExtractRequest, createFromStream); 216 PHP_METHOD(SolrExtractRequest, __destruct); 217 PHP_METHOD(SolrExtractRequest, __clone); 218 PHP_METHOD(SolrExtractRequest, __sleep); 219 PHP_METHOD(SolrExtractRequest, __wakeup); 220 221 /* }}} */ 222 223 /* {{{ SolrDocumentField methods */ 224 PHP_METHOD(SolrDocumentField, __construct); 225 PHP_METHOD(SolrDocumentField, __destruct); 226 /* }}} */ 227 228 /* {{{ SolrInputDocument methods declarations */ 229 PHP_METHOD(SolrInputDocument, __construct); 230 PHP_METHOD(SolrInputDocument, __destruct); 231 PHP_METHOD(SolrInputDocument, __clone); 232 PHP_METHOD(SolrInputDocument, __sleep); 233 PHP_METHOD(SolrInputDocument, __wakeup); 234 PHP_METHOD(SolrInputDocument, setBoost); 235 PHP_METHOD(SolrInputDocument, getBoost); 236 PHP_METHOD(SolrInputDocument, clear); 237 PHP_METHOD(SolrInputDocument, addField); 238 PHP_METHOD(SolrInputDocument, updateField); 239 PHP_METHOD(SolrInputDocument, setFieldBoost); 240 PHP_METHOD(SolrInputDocument, getFieldBoost); 241 PHP_METHOD(SolrInputDocument, getFieldNames); 242 PHP_METHOD(SolrInputDocument, getFieldCount); 243 PHP_METHOD(SolrInputDocument, getField); 244 PHP_METHOD(SolrInputDocument, toArray); 245 PHP_METHOD(SolrInputDocument, fieldExists); 246 PHP_METHOD(SolrInputDocument, deleteField); 247 PHP_METHOD(SolrInputDocument, sort); 248 PHP_METHOD(SolrInputDocument, merge); 249 PHP_METHOD(SolrInputDocument, addChildDocument); 250 PHP_METHOD(SolrInputDocument, getChildDocuments); 251 PHP_METHOD(SolrInputDocument, hasChildDocuments); 252 PHP_METHOD(SolrInputDocument, getChildDocumentsCount); 253 PHP_METHOD(SolrInputDocument, addChildDocuments); 254 PHP_METHOD(SolrInputDocument, setVersion); 255 PHP_METHOD(SolrInputDocument, getVersion); 256 /* }}} */ 257 258 /* {{{ SolrClient methods declarations */ 259 PHP_METHOD(SolrClient, __construct); 260 PHP_METHOD(SolrClient, __destruct); 261 PHP_METHOD(SolrClient, __sleep); 262 PHP_METHOD(SolrClient, __wakeup); 263 PHP_METHOD(SolrClient, __clone); 264 PHP_METHOD(SolrClient, query); 265 PHP_METHOD(SolrClient, getOptions); 266 PHP_METHOD(SolrClient, getDebug); 267 PHP_METHOD(SolrClient, addDocument); 268 PHP_METHOD(SolrClient, addDocuments); 269 PHP_METHOD(SolrClient, setServlet); 270 PHP_METHOD(SolrClient, setResponseWriter); 271 PHP_METHOD(SolrClient, request); 272 PHP_METHOD(SolrClient, sendUpdateStream); 273 PHP_METHOD(SolrClient, ping); 274 PHP_METHOD(SolrClient, system); 275 PHP_METHOD(SolrClient, threads); 276 PHP_METHOD(SolrClient, deleteById); 277 PHP_METHOD(SolrClient, deleteByIds); 278 PHP_METHOD(SolrClient, deleteByQuery); 279 PHP_METHOD(SolrClient, deleteByQueries); 280 PHP_METHOD(SolrClient, getById); 281 PHP_METHOD(SolrClient, getByIds); 282 PHP_METHOD(SolrClient, optimize); 283 PHP_METHOD(SolrClient, commit); 284 PHP_METHOD(SolrClient, rollback); 285 /* }}} */ 286 287 /* {{{ SolrParams methods declarations */ 288 PHP_METHOD(SolrParams, setParam); /* Parameter can only accept one value */ 289 PHP_METHOD(SolrParams, addParam); /* Parameter can accept more than one value */ 290 PHP_METHOD(SolrParams, getParams); /* Retrieves the parameters and their values */ 291 PHP_METHOD(SolrParams, getParam); /* Retrieves a parameter value */ 292 PHP_METHOD(SolrParams, __toString); /* Returns a string representation of the object */ 293 PHP_METHOD(SolrParams, toString); /* Returns a string representation of the object */ 294 PHP_METHOD(SolrParams, getPreparedParams); /* Returns the prepared parameters */ 295 PHP_METHOD(SolrParams, serialize); /* used by serialize() */ 296 PHP_METHOD(SolrParams, unserialize); /* used by unserialize() */ 297 PHP_METHOD(SolrParams, __clone); /* Used to enforce the cloning of SolrParams is currently unsupported */ 298 /* }}} */ 299 300 /* {{{ SolrModifiableParams methods declarations */ 301 PHP_METHOD(SolrModifiableParams, __construct); 302 PHP_METHOD(SolrModifiableParams, __destruct); 303 /* }}} */ 304 305 /* {{{ SolrQuery methods declarations */ 306 307 /* Constructor and Destructor */ 308 PHP_METHOD(SolrQuery, __construct); 309 PHP_METHOD(SolrQuery, __destruct); 310 311 /* CommonQueryParameters */ 312 PHP_METHOD(SolrQuery, setQuery); 313 PHP_METHOD(SolrQuery, getQuery); 314 PHP_METHOD(SolrQuery, setStart); 315 PHP_METHOD(SolrQuery, getStart); 316 PHP_METHOD(SolrQuery, setRows); 317 PHP_METHOD(SolrQuery, getRows); 318 PHP_METHOD(SolrQuery, addField); 319 PHP_METHOD(SolrQuery, removeField); 320 PHP_METHOD(SolrQuery, getFields); 321 PHP_METHOD(SolrQuery, addSortField); 322 PHP_METHOD(SolrQuery, removeSortField); 323 PHP_METHOD(SolrQuery, getSortFields); 324 PHP_METHOD(SolrQuery, addFilterQuery); 325 PHP_METHOD(SolrQuery, removeFilterQuery); 326 PHP_METHOD(SolrQuery, getFilterQueries); 327 PHP_METHOD(SolrQuery, setShowDebugInfo); 328 PHP_METHOD(SolrQuery, setExplainOther); 329 PHP_METHOD(SolrQuery, setTimeAllowed); 330 PHP_METHOD(SolrQuery, getTimeAllowed); 331 PHP_METHOD(SolrQuery, setOmitHeader); 332 333 /* CoreQueryParameters */ 334 PHP_METHOD(SolrQuery, setEchoHandler); 335 PHP_METHOD(SolrQuery, setEchoParams); 336 337 /* SimpleFacetParameters */ 338 PHP_METHOD(SolrQuery, setFacet); 339 PHP_METHOD(SolrQuery, getFacet); 340 PHP_METHOD(SolrQuery, addFacetField); 341 PHP_METHOD(SolrQuery, removeFacetField); 342 PHP_METHOD(SolrQuery, getFacetFields); 343 PHP_METHOD(SolrQuery, addFacetQuery); 344 PHP_METHOD(SolrQuery, removeFacetQuery); 345 PHP_METHOD(SolrQuery, getFacetQueries); 346 PHP_METHOD(SolrQuery, setFacetPrefix); 347 PHP_METHOD(SolrQuery, getFacetPrefix); 348 PHP_METHOD(SolrQuery, setFacetSort); 349 PHP_METHOD(SolrQuery, getFacetSort); 350 PHP_METHOD(SolrQuery, setFacetLimit); 351 PHP_METHOD(SolrQuery, getFacetLimit); 352 PHP_METHOD(SolrQuery, setFacetOffset); 353 PHP_METHOD(SolrQuery, getFacetOffset); 354 PHP_METHOD(SolrQuery, setFacetMinCount); 355 PHP_METHOD(SolrQuery, getFacetMinCount); 356 PHP_METHOD(SolrQuery, setFacetMissing); 357 PHP_METHOD(SolrQuery, getFacetMissing); 358 PHP_METHOD(SolrQuery, setFacetMethod); 359 PHP_METHOD(SolrQuery, getFacetMethod); 360 PHP_METHOD(SolrQuery, setFacetEnumCacheMinDefaultFrequency); 361 362 /* Date facet parameters */ 363 PHP_METHOD(SolrQuery, addFacetDateField); 364 PHP_METHOD(SolrQuery, removeFacetDateField); 365 PHP_METHOD(SolrQuery, getFacetDateFields); 366 PHP_METHOD(SolrQuery, setFacetDateStart); 367 PHP_METHOD(SolrQuery, getFacetDateStart); 368 PHP_METHOD(SolrQuery, setFacetDateEnd); 369 PHP_METHOD(SolrQuery, getFacetDateEnd); 370 PHP_METHOD(SolrQuery, setFacetDateGap); 371 PHP_METHOD(SolrQuery, getFacetDateGap); 372 PHP_METHOD(SolrQuery, setFacetDateHardEnd); 373 PHP_METHOD(SolrQuery, getFacetDateHardEnd); 374 PHP_METHOD(SolrQuery, addFacetDateOther); 375 PHP_METHOD(SolrQuery, removeFacetDateOther); 376 PHP_METHOD(SolrQuery, getFacetDateOther); 377 378 /* GroupParameters */ 379 PHP_METHOD(SolrQuery, setGroup); 380 PHP_METHOD(SolrQuery, getGroup); 381 PHP_METHOD(SolrQuery, addGroupField); 382 PHP_METHOD(SolrQuery, getGroupFields); 383 PHP_METHOD(SolrQuery, addGroupFunction); 384 PHP_METHOD(SolrQuery, getGroupFunctions); 385 PHP_METHOD(SolrQuery, addGroupQuery); 386 PHP_METHOD(SolrQuery, getGroupQueries); 387 PHP_METHOD(SolrQuery, setGroupLimit); 388 PHP_METHOD(SolrQuery, getGroupLimit); 389 PHP_METHOD(SolrQuery, setGroupOffset); 390 PHP_METHOD(SolrQuery, getGroupOffset); 391 PHP_METHOD(SolrQuery, addGroupSortField); 392 PHP_METHOD(SolrQuery, getGroupSortFields); 393 PHP_METHOD(SolrQuery, setGroupFormat); 394 PHP_METHOD(SolrQuery, getGroupFormat); 395 PHP_METHOD(SolrQuery, setGroupMain); 396 PHP_METHOD(SolrQuery, getGroupMain); 397 PHP_METHOD(SolrQuery, setGroupNGroups); 398 PHP_METHOD(SolrQuery, getGroupNGroups); 399 PHP_METHOD(SolrQuery, setGroupTruncate); 400 PHP_METHOD(SolrQuery, getGroupTruncate); 401 PHP_METHOD(SolrQuery, setGroupFacet); 402 PHP_METHOD(SolrQuery, getGroupFacet); 403 PHP_METHOD(SolrQuery, setGroupCachePercent); 404 PHP_METHOD(SolrQuery, getGroupCachePercent); 405 406 /* Collapse */ 407 PHP_METHOD(SolrQuery, collapse); 408 409 /* Expand Parameters */ 410 PHP_METHOD(SolrQuery, setExpand); 411 PHP_METHOD(SolrQuery, getExpand); 412 PHP_METHOD(SolrQuery, addExpandSortField); 413 PHP_METHOD(SolrQuery, removeExpandSortField); 414 PHP_METHOD(SolrQuery, getExpandSortFields); 415 PHP_METHOD(SolrQuery, setExpandRows); 416 PHP_METHOD(SolrQuery, getExpandRows); 417 PHP_METHOD(SolrQuery, setExpandQuery); 418 PHP_METHOD(SolrQuery, getExpandQuery); 419 PHP_METHOD(SolrQuery, addExpandFilterQuery); 420 PHP_METHOD(SolrQuery, removeExpandFilterQuery); 421 PHP_METHOD(SolrQuery, getExpandFilterQueries); 422 423 /* HighlightingParameters */ 424 PHP_METHOD(SolrQuery, setHighlight); 425 PHP_METHOD(SolrQuery, getHighlight); 426 PHP_METHOD(SolrQuery, addHighlightField); 427 PHP_METHOD(SolrQuery, removeHighlightField); 428 PHP_METHOD(SolrQuery, getHighlightFields); 429 PHP_METHOD(SolrQuery, setHighlightSnippets); 430 PHP_METHOD(SolrQuery, getHighlightSnippets); 431 PHP_METHOD(SolrQuery, setHighlightFragsize); 432 PHP_METHOD(SolrQuery, getHighlightFragsize); 433 PHP_METHOD(SolrQuery, setHighlightMergeContiguous); 434 PHP_METHOD(SolrQuery, getHighlightMergeContiguous); 435 PHP_METHOD(SolrQuery, setHighlightRequireFieldMatch); 436 PHP_METHOD(SolrQuery, getHighlightRequireFieldMatch); 437 PHP_METHOD(SolrQuery, setHighlightMaxAnalyzedChars); 438 PHP_METHOD(SolrQuery, getHighlightMaxAnalyzedChars); 439 PHP_METHOD(SolrQuery, setHighlightAlternateField); 440 PHP_METHOD(SolrQuery, getHighlightAlternateField); 441 PHP_METHOD(SolrQuery, setHighlightMaxAlternateFieldLength); 442 PHP_METHOD(SolrQuery, getHighlightMaxAlternateFieldLength); 443 PHP_METHOD(SolrQuery, setHighlightFormatter); 444 PHP_METHOD(SolrQuery, getHighlightFormatter); 445 PHP_METHOD(SolrQuery, setHighlightSimplePre); 446 PHP_METHOD(SolrQuery, getHighlightSimplePre); 447 PHP_METHOD(SolrQuery, setHighlightSimplePost); 448 PHP_METHOD(SolrQuery, getHighlightSimplePost); 449 PHP_METHOD(SolrQuery, setHighlightFragmenter); 450 PHP_METHOD(SolrQuery, getHighlightFragmenter); 451 PHP_METHOD(SolrQuery, setHighlightUsePhraseHighlighter); 452 PHP_METHOD(SolrQuery, getHighlightUsePhraseHighlighter); 453 PHP_METHOD(SolrQuery, setHighlightHighlightMultiTerm); 454 PHP_METHOD(SolrQuery, getHighlightHighlightMultiTerm); 455 PHP_METHOD(SolrQuery, setHighlightRegexSlop); 456 PHP_METHOD(SolrQuery, getHighlightRegexSlop); 457 PHP_METHOD(SolrQuery, setHighlightRegexPattern); 458 PHP_METHOD(SolrQuery, getHighlightRegexPattern); 459 PHP_METHOD(SolrQuery, setHighlightRegexMaxAnalyzedChars); 460 PHP_METHOD(SolrQuery, getHighlightRegexMaxAnalyzedChars); 461 462 /* StatsComponent */ 463 PHP_METHOD(SolrQuery, setStats); 464 PHP_METHOD(SolrQuery, getStats); 465 PHP_METHOD(SolrQuery, addStatsField); 466 PHP_METHOD(SolrQuery, removeStatsField); 467 PHP_METHOD(SolrQuery, getStatsFields); 468 PHP_METHOD(SolrQuery, addStatsFacet); 469 PHP_METHOD(SolrQuery, removeStatsFacet); 470 PHP_METHOD(SolrQuery, getStatsFacets); 471 472 /* MoreLikeThis */ 473 PHP_METHOD(SolrQuery, setMlt); 474 PHP_METHOD(SolrQuery, getMlt); 475 PHP_METHOD(SolrQuery, setMltCount); 476 PHP_METHOD(SolrQuery, getMltCount); 477 PHP_METHOD(SolrQuery, addMltField); 478 PHP_METHOD(SolrQuery, removeMltField); 479 PHP_METHOD(SolrQuery, getMltFields); 480 PHP_METHOD(SolrQuery, addMltQueryField); 481 PHP_METHOD(SolrQuery, removeMltQueryField); 482 PHP_METHOD(SolrQuery, getMltQueryFields); 483 PHP_METHOD(SolrQuery, setMltMinTermFrequency); 484 PHP_METHOD(SolrQuery, getMltMinTermFrequency); 485 PHP_METHOD(SolrQuery, setMltMinDocFrequency); 486 PHP_METHOD(SolrQuery, getMltMinDocFrequency); 487 PHP_METHOD(SolrQuery, setMltMinWordLength); 488 PHP_METHOD(SolrQuery, getMltMinWordLength); 489 PHP_METHOD(SolrQuery, setMltMaxWordLength); 490 PHP_METHOD(SolrQuery, getMltMaxWordLength); 491 PHP_METHOD(SolrQuery, setMltMaxNumTokens); 492 PHP_METHOD(SolrQuery, getMltMaxNumTokens); 493 PHP_METHOD(SolrQuery, setMltMaxNumQueryTerms); 494 PHP_METHOD(SolrQuery, getMltMaxNumQueryTerms); 495 PHP_METHOD(SolrQuery, setMltBoost); 496 PHP_METHOD(SolrQuery, getMltBoost); 497 498 /* TermsComponent */ 499 PHP_METHOD(SolrQuery, setTerms); 500 PHP_METHOD(SolrQuery, getTerms); 501 PHP_METHOD(SolrQuery, setTermsField); 502 PHP_METHOD(SolrQuery, getTermsField); 503 PHP_METHOD(SolrQuery, setTermsLowerBound); 504 PHP_METHOD(SolrQuery, getTermsLowerBound); 505 PHP_METHOD(SolrQuery, setTermsUpperBound); 506 PHP_METHOD(SolrQuery, getTermsUpperBound); 507 PHP_METHOD(SolrQuery, setTermsIncludeLowerBound); 508 PHP_METHOD(SolrQuery, getTermsIncludeLowerBound); 509 PHP_METHOD(SolrQuery, setTermsIncludeUpperBound); 510 PHP_METHOD(SolrQuery, getTermsIncludeUpperBound); 511 PHP_METHOD(SolrQuery, setTermsMinCount); 512 PHP_METHOD(SolrQuery, getTermsMinCount); 513 PHP_METHOD(SolrQuery, setTermsMaxCount); 514 PHP_METHOD(SolrQuery, getTermsMaxCount); 515 PHP_METHOD(SolrQuery, setTermsPrefix); 516 PHP_METHOD(SolrQuery, getTermsPrefix); 517 PHP_METHOD(SolrQuery, setTermsLimit); 518 PHP_METHOD(SolrQuery, getTermsLimit); 519 PHP_METHOD(SolrQuery, setTermsReturnRaw); 520 PHP_METHOD(SolrQuery, getTermsReturnRaw); 521 PHP_METHOD(SolrQuery, setTermsSort); 522 PHP_METHOD(SolrQuery, getTermsSort); 523 524 /* TODO : TermVectorComponent */ 525 /* {{{ TermVectorComponent methods not yet defined */ 526 PHP_METHOD(SolrQuery, setTermVector); 527 PHP_METHOD(SolrQuery, setTermVectorTermFrequency); 528 PHP_METHOD(SolrQuery, setTermVectorDocFrequency); 529 PHP_METHOD(SolrQuery, setTermVectorPositions); 530 PHP_METHOD(SolrQuery, setTermVectorOffsets); 531 PHP_METHOD(SolrQuery, setTermVectorTfIdfProduct); 532 PHP_METHOD(SolrQuery, setTermVectorAll); 533 PHP_METHOD(SolrQuery, addTermVectorField); 534 PHP_METHOD(SolrQuery, addTermVectorLuceneDocId); 535 /* }}} */ 536 537 /* }}} */ 538 539 /* {{{ SolrResponse methods declarations */ 540 PHP_METHOD(SolrResponse, getHttpStatus); 541 PHP_METHOD(SolrResponse, getHttpStatusMessage); 542 PHP_METHOD(SolrResponse, success); 543 PHP_METHOD(SolrResponse, getRequestUrl); 544 PHP_METHOD(SolrResponse, getRawRequestHeaders); 545 PHP_METHOD(SolrResponse, getRawRequest); 546 PHP_METHOD(SolrResponse, getRawResponseHeaders); 547 PHP_METHOD(SolrResponse, getRawResponse); 548 PHP_METHOD(SolrResponse, getDigestedResponse); 549 PHP_METHOD(SolrResponse, setParseMode); 550 PHP_METHOD(SolrResponse, getArrayResponse); 551 PHP_METHOD(SolrResponse, getResponse); 552 /* }}} */ 553 554 /* {{{ SolrQueryResponse methods */ 555 PHP_METHOD(SolrQueryResponse, __construct); 556 PHP_METHOD(SolrQueryResponse, __destruct); 557 /* }}} */ 558 559 /* {{{ SolrUpdateResponse methods */ 560 PHP_METHOD(SolrUpdateResponse, __construct); 561 PHP_METHOD(SolrUpdateResponse, __destruct); 562 /* }}} */ 563 564 /* {{{ SolrPingResponse methods declarations */ 565 PHP_METHOD(SolrPingResponse, __construct); 566 PHP_METHOD(SolrPingResponse, __destruct); 567 PHP_METHOD(SolrPingResponse, getResponse); 568 /* }}} */ 569 570 /* {{{ SolrGenericResponse methods */ 571 PHP_METHOD(SolrGenericResponse, __construct); 572 PHP_METHOD(SolrGenericResponse, __destruct); 573 /* }}} */ 574 575 /* {{{ SolrCollapseFunction methods */ 576 PHP_METHOD(SolrCollapseFunction, __construct); 577 PHP_METHOD(SolrCollapseFunction, __destruct); 578 PHP_METHOD(SolrCollapseFunction, setField); 579 PHP_METHOD(SolrCollapseFunction, getField); 580 581 PHP_METHOD(SolrCollapseFunction, setMin); 582 PHP_METHOD(SolrCollapseFunction, getMin); 583 584 PHP_METHOD(SolrCollapseFunction, setMax); 585 PHP_METHOD(SolrCollapseFunction, getMax); 586 587 PHP_METHOD(SolrCollapseFunction, setNullPolicy); 588 PHP_METHOD(SolrCollapseFunction, getNullPolicy); 589 590 PHP_METHOD(SolrCollapseFunction, setHint); 591 PHP_METHOD(SolrCollapseFunction, getHint); 592 593 PHP_METHOD(SolrCollapseFunction, setSize); 594 PHP_METHOD(SolrCollapseFunction, getSize); 595 PHP_METHOD(SolrCollapseFunction, __toString); 596 597 PHP_METHOD(SolrCollapseFunction, __sleep); 598 PHP_METHOD(SolrCollapseFunction, __wakeup); 599 600 /* }}} */ 601 602 /* {{{ SolrUtils methods declarations */ 603 PHP_METHOD(SolrUtils, escapeQueryChars); 604 PHP_METHOD(SolrUtils, queryPhrase); 605 PHP_METHOD(SolrUtils, digestXmlResponse); 606 PHP_METHOD(SolrUtils, digestJsonResponse); 607 PHP_METHOD(SolrUtils, getSolrVersion); 608 PHP_METHOD(SolrUtils, getSolrStats); 609 /* }}} */ 610 611 /******************************************************************************/ 612 /** DECLARATIONS FOR HELPERS AND EXTENSION-SPECIFIC FUNCTIONS **/ 613 /******************************************************************************/ 614 615 /* {{{ HTTP request function declarations */ 616 size_t solr_curl_write(solr_char_t *data, size_t size, size_t nmemb, void *ctx); 617 size_t solr_curl_write_header(solr_char_t *data, size_t size, size_t nmemb, void *ctx); 618 int solr_curl_debug_callback(CURL *curl_handle, curl_infotype infotype, solr_char_t *debug_data, size_t size, void *ctx); 619 620 PHP_SOLR_API int solr_init_options(solr_client_options_t *options); 621 PHP_SOLR_API int solr_init_handle(solr_curl_t *sch, solr_client_options_t *options); 622 PHP_SOLR_API int solr_make_request(solr_client_t *client, solr_request_type_t request_type); 623 PHP_SOLR_API int solr_make_update_stream_request(solr_client_t *client, solr_ustream_t* stream_data, solr_string_t *request_params); 624 PHP_SOLR_API void solr_free_handle(solr_curl_t *sch); 625 PHP_SOLR_API void solr_free_option(solr_client_options_t *options); 626 627 /* }}} */ 628 629 PHP_SOLR_API void solr_extension_register_constants(int type, int module_number); 630 PHP_SOLR_API void solr_document_register_class_constants(zend_class_entry *ce); 631 PHP_SOLR_API void solr_extract_register_class_constants(zend_class_entry *ce); 632 PHP_SOLR_API void solr_client_register_class_constants(zend_class_entry *ce); 633 PHP_SOLR_API void solr_query_register_class_constants(zend_class_entry *ce); 634 PHP_SOLR_API void solr_collapse_function_register_class_constants(zend_class_entry *ce); 635 PHP_SOLR_API void solr_response_register_class_properties(zend_class_entry *ce); 636 PHP_SOLR_API void solr_response_register_class_constants(zend_class_entry *ce); 637 PHP_SOLR_API void solr_exception_register_class_properties(zend_class_entry *ce); 638 PHP_SOLR_API void solr_input_document_register_class_constants(zend_class_entry *ce); 639 640 PHP_SOLR_API void solr_set_response_object_properties(zend_class_entry *scope, zval *response_object, const solr_client_t *client, const solr_string_t *request_url, zend_bool success); 641 PHP_SOLR_API void solr_throw_exception_ex(zend_class_entry *exception_ce, long code, const char *filename, int file_line, const char *function_name, char *format, ...); 642 PHP_SOLR_API void solr_throw_exception(zend_class_entry *exception_ce, char *message, long code, const char *filename, int file_line, const char *function_name); 643 PHP_SOLR_API void solr_throw_solr_server_exception(solr_client_t *client,const char *requestType); 644 645 /* {{{ init functions called in constructors - allocate/initialize params_t */ 646 PHP_SOLR_API int solr_params_obj_ctor(zval *obj); 647 PHP_SOLR_API void solr_params_obj_dtor(zval *obj); 648 PHP_SOLR_API int solr_init_params(solr_params_t *solr_params, long int index); 649 650 zend_object *solr_extract_create_object_handler(zend_class_entry *ce); 651 /* }}} */ 652 653 PHP_SOLR_API int solr_init_ustream(zval *obj); 654 PHP_SOLR_API void solr_destroy_ustream_ex(solr_ustream_t *stream); 655 PHP_SOLR_API void solr_destroy_ustream_zv(zval *obj); 656 PHP_SOLR_API int solr_fetch_ustream_entry(zval *objptr, solr_ustream_t **stream_entry); 657 658 #ifdef PHP_7 659 #define solr_destroy_ustream solr_destroy_ustream_zv 660 #else 661 #define solr_destroy_ustream solr_destroy_ustream_ex 662 #endif 663 664 /* {{{ solr_document_t based objects methods*/ 665 PHP_SOLR_API solr_document_t *solr_init_document(long int document_index); 666 PHP_SOLR_API solr_document_t *solr_input_doc_ctor(zval *objptr); 667 #if PHP_VERSION_ID < 80000 668 PHP_SOLR_API zend_object *solr_document_object_handler_clone(zval *zobject); 669 #else 670 PHP_SOLR_API zend_object *solr_document_object_handler_clone(zend_object *zobject); 671 #endif 672 /* }}} */ 673 674 /* {{{ zend_hash_free functions */ 675 PHP_SOLR_API void solr_destroy_field_list_ht_dtor(zval *zv_field_entry); 676 PHP_SOLR_API void solr_destroy_field_list(solr_field_list_t *field_entry); 677 PHP_SOLR_API void solr_destroy_client(zval *client); 678 679 680 PHP_SOLR_API void solr_destroy_document_zv(zval *document); 681 PHP_SOLR_API void solr_destroy_document_ex(solr_document_t *document); 682 683 #ifdef PHP_7 684 #define solr_destroy_document solr_destroy_document_zv 685 #else 686 #define solr_destroy_document solr_destroy_document_ex 687 #endif 688 689 PHP_SOLR_API void solr_destroy_params(zval *solr_params); 690 PHP_SOLR_API void solr_destroy_function(zval *solr_function); 691 PHP_SOLR_API void solr_destory_param_ht_dtor(zval *param_zv); 692 PHP_SOLR_API void solr_destroy_param(solr_param_t **param); 693 /* dead */ 694 PHP_SOLR_API void solr_destroy_param_value(solr_param_t *param, solr_param_value_t *param_value); 695 /* }}} */ 696 697 #ifdef PHP_7 698 #define field_copy_constructor field_copy_constructor_zv 699 #else 700 #define field_copy_constructor field_copy_constructor_ex 701 #endif 702 703 /* {{{ used for SolrDocument field manipulations */ 704 PHP_SOLR_API int solr_document_insert_field_value_ex(solr_field_list_t *queue, const solr_char_t *field_value, double field_boost, int modifier); 705 PHP_SOLR_API void field_copy_constructor_ex(solr_field_list_t **original_field_queue); 706 PHP_SOLR_API void field_copy_constructor_zv(zval *field_queue_zv); 707 708 /* }}} */ 709 710 /* {{{ Used for comparison of document fields */ 711 #if PHP_VERSION_ID < 80000 712 PHP_SOLR_API int solr_compare_field_name (const void *a, const void *b); 713 PHP_SOLR_API int solr_rcompare_field_name(const void *a, const void *b); 714 715 PHP_SOLR_API int solr_compare_field_value_count (const void *a, const void *b); 716 PHP_SOLR_API int solr_rcompare_field_value_count(const void *a, const void *b); 717 718 PHP_SOLR_API int solr_compare_field_boost_value (const void *a, const void *b); 719 PHP_SOLR_API int solr_rcompare_field_boost_value(const void *a, const void *b); 720 #else 721 PHP_SOLR_API int solr_compare_field_name (Bucket *a, Bucket *b); 722 PHP_SOLR_API int solr_rcompare_field_name(Bucket *a, Bucket *b); 723 724 PHP_SOLR_API int solr_compare_field_value_count (Bucket *a, Bucket *b); 725 PHP_SOLR_API int solr_rcompare_field_value_count(Bucket *a, Bucket *b); 726 727 PHP_SOLR_API int solr_compare_field_boost_value (Bucket *a, Bucket *b); 728 PHP_SOLR_API int solr_rcompare_field_boost_value(Bucket *a, Bucket *b); 729 #endif 730 /* }}} */ 731 732 /* {{{ Functions for SolrParams Parameters */ 733 PHP_SOLR_API solr_param_t *solr_create_new_param(const solr_char_t *param_name, size_t param_name_len, solr_param_type_t param_type, solr_bool allow_multiple, solr_param_value_equal_func_t value_equal_func, solr_param_fetch_func_t param_fetch_func, solr_param_value_free_func_t value_free_func, solr_char_t delimiter, solr_char_t arg_separator); 734 735 PHP_SOLR_API int solr_params_insert_param_value(solr_param_t *param, solr_param_value_t *param_value); 736 PHP_SOLR_API int solr_params_delete_param_value(solr_param_t *param, const solr_param_value_t *target_value); 737 PHP_SOLR_API int solr_delete_solr_parameter(zval *objptr, solr_char_t *name, int name_length); 738 739 PHP_SOLR_API int solr_add_or_set_normal_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, zend_bool allow_multiple); 740 PHP_SOLR_API int solr_add_simple_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length); 741 PHP_SOLR_API int solr_add_simple_list_param_ex(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *separator); 742 PHP_SOLR_API int solr_add_arg_list_param(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t delimiter, solr_char_t arg_separator); 743 PHP_SOLR_API int solr_add_arg_list_param_ex(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t delimiter, solr_char_t arg_separator, solr_char_t delimiter_override); 744 PHP_SOLR_API solr_param_value_t* create_parameter_value_arg_list(solr_char_t *pvalue, int pvalue_length, solr_char_t *avalue, int avalue_length, solr_char_t *delimiter_override, solr_bool delimiter_overriden); 745 746 #define solr_set_normal_param(objptr, pname, pname_length, pvalue, pvalue_length) solr_add_or_set_normal_param((objptr), (pname), (pname_length), (pvalue), (pvalue_length), 0) 747 #define solr_add_normal_param(objptr, pname, pname_length, pvalue, pvalue_length) solr_add_or_set_normal_param((objptr), (pname), (pname_length), (pvalue), (pvalue_length), 1) 748 749 PHP_SOLR_API int solr_normal_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b); 750 PHP_SOLR_API int solr_simple_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b); 751 PHP_SOLR_API int solr_arg_list_param_value_equal(const solr_param_value_t *a, const solr_param_value_t *b); 752 753 PHP_SOLR_API void solr_normal_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer); 754 PHP_SOLR_API void solr_simple_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer); 755 PHP_SOLR_API void solr_arg_list_param_value_fetch(solr_param_t *solr_param, solr_string_t *buffer); 756 757 PHP_SOLR_API void solr_normal_param_value_display(solr_param_t *solr_param, zval *param_value_array); 758 PHP_SOLR_API void solr_simple_list_param_value_display(solr_param_t *solr_param, zval *param_value_array); 759 PHP_SOLR_API void solr_arg_list_param_value_display(solr_param_t *solr_param, zval *param_value_array); 760 761 /* Used to display values where allow_multiple is false */ 762 PHP_SOLR_API void solr_normal_param_value_display_string(solr_param_t *solr_param, zval *param_value); 763 PHP_SOLR_API void solr_normal_param_value_display_integer(solr_param_t *solr_param, zval *param_value); 764 PHP_SOLR_API void solr_normal_param_value_display_double(solr_param_t *solr_param, zval *param_value); 765 PHP_SOLR_API void solr_normal_param_value_display_boolean(solr_param_t *solr_param, zval *param_value); 766 PHP_SOLR_API void solr_normal_param_value_display_sort_type(solr_param_t *solr_param, zval *param_value); 767 768 PHP_SOLR_API int solr_param_find(zval *objptr, solr_char_t *pname, int pname_length, solr_param_t **solr_param); 769 PHP_SOLR_API solr_string_t solr_params_to_string(solr_params_t * solr_params, zend_bool url_encode); 770 771 PHP_SOLR_API void solr_normal_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode); 772 PHP_SOLR_API void solr_simple_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode); 773 PHP_SOLR_API void solr_arg_list_param_value_tostring(solr_param_t *solr_param, solr_string_t *buffer, zend_bool url_encode); 774 775 PHP_SOLR_API void solr_normal_param_value_free(solr_param_value_t *param_value); 776 PHP_SOLR_API void solr_simple_list_param_value_free(solr_param_value_t *param_value); 777 PHP_SOLR_API void solr_arg_list_param_value_free(solr_param_value_t *param_value); 778 779 /* Used for removing parameter values from the list of values for that param */ 780 PHP_SOLR_API int solr_delete_normal_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length); 781 PHP_SOLR_API int solr_delete_simple_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length); 782 PHP_SOLR_API int solr_delete_arg_list_param_value(zval *objptr, solr_char_t *pname, int pname_length, solr_char_t *pvalue, int pvalue_length); 783 784 /* }}} */ 785 786 /* {{{ Debugging functions */ 787 /* Debug function used to print field values in the field queue */ 788 PHP_SOLR_API void solr_debug_print_fields(const solr_field_list_t *queue); 789 790 /* Used when debugging is enabled to run in verbose mode */ 791 PHP_SOLR_API void solr_debug_printf(const char *format, ...); 792 /* }}} */ 793 794 /* {{{ Document utility functions */ 795 PHP_SOLR_API void solr_generate_document_xml_from_fields(xmlNode *solr_doc_node, HashTable *document_fields); 796 PHP_SOLR_API void solr_create_document_field_object(solr_field_list_t *field_values, zval **field_obj); 797 PHP_SOLR_API void solr_add_doc_node(xmlNode *root_node, solr_document_t *doc_entry); 798 PHP_SOLR_API xmlDocPtr solr_xml_create_xml_doc(const xmlChar *root_node_name, xmlNode **root_node_ptr); 799 /* }}} */ 800 801 /* {{{ identical functions used on both SolrDocument and SolrInputDocument */ 802 PHP_SOLR_API void solr_document_get_field_names(INTERNAL_FUNCTION_PARAMETERS); 803 /* }}} */ 804 805 /* {{{ Utility functions */ 806 PHP_SOLR_API long solr_get_json_last_error(void); 807 PHP_SOLR_API solr_char_t *solr_get_json_error_msg(solr_json_error_codes_t error_code); 808 PHP_SOLR_API int solr_json_to_php_native(solr_string_t *buffer, const solr_char_t *json_string, int json_string_length); 809 PHP_SOLR_API int solr_is_supported_response_writer(const solr_char_t * response_writer, int length); 810 PHP_SOLR_API int solr_hashtable_get_new_index(HashTable *ht); 811 #if PHP_VERSION_ID < 80000 812 PHP_SOLR_API int solr_fetch_document_entry(zval *objptr, solr_document_t **doc_entry); 813 #else 814 PHP_SOLR_API int solr_fetch_document_entry(zend_object *objptr, solr_document_t **doc_entry); 815 #endif 816 PHP_SOLR_API int solr_fetch_client_entry(zval *objptr, solr_client_t **solr_client); 817 PHP_SOLR_API int solr_fetch_params_entry(zval *objptr, solr_params_t **solr_params); 818 PHP_SOLR_API int solr_fetch_function_entry(zval *objptr, solr_function_t **solr_params); 819 PHP_SOLR_API void solr_encode_generic_xml_response(solr_string_t *buffer, const solr_char_t *serialized, int size, long int parse_mode); 820 PHP_SOLR_API void solr_set_return_solr_params_object(zval *return_value_ptr, zval *current_objptr); 821 PHP_SOLR_API void solr_escape_query_chars(solr_string_t *sbuilder, solr_char_t *unescaped, long int unescaped_length); 822 823 /* serialized array to serialized SolrObject */ 824 PHP_SOLR_API int solr_sarray_to_sobject(solr_string_t *buffer); 825 PHP_SOLR_API int solr_sobject_to_sarray(solr_string_t *buffer); 826 PHP_SOLR_API void solr_response_get_response_impl(INTERNAL_FUNCTION_PARAMETERS, int return_array); 827 /* }}} */ 828 829 /* {{{ SolrFunction Helpers (solrfunc to avoid confusion with solr_function) */ 830 PHP_SOLR_API int solr_solrfunc_update_string(zval *obj, solr_char_t *key, int key_len, solr_char_t *value, int value_len); 831 PHP_SOLR_API int solr_solrfunc_fetch_string(zval *obj, solr_char_t *key, int key_len, solr_string_t **string); 832 PHP_SOLR_API int solr_solrfunc_return_string(zval *obj, solr_char_t *key, int key_len, zval **return_value); 833 PHP_SOLR_API void solr_solrfunc_to_string(solr_function_t *function, solr_string_t **dest); 834 PHP_SOLR_API int solr_solrfunc_display_string(zval *obj, solr_char_t *key, int key_len, zval **return_value); 835 836 #if PHP_VERSION_ID < 80000 837 zend_object *solr_collapse_function_object_handler_clone(zval *object); 838 #else 839 zend_object *solr_collapse_function_object_handler_clone(zend_object *object); 840 #endif 841 /* }}} */ 842 843 /* {{{ Solr Server Exception Handling */ 844 PHP_SOLR_API int solr_get_xml_error(solr_string_t buffer, solr_exception_t *exceptionData); 845 PHP_SOLR_API int solr_get_json_error(solr_string_t buffer, solr_exception_t *exceptionData); 846 PHP_SOLR_API int solr_get_phpnative_error(solr_string_t buffer, solr_exception_t *exceptionData); 847 PHP_SOLR_API int hydrate_error_zval(zval *response, solr_exception_t *exceptionData); 848 /* }}} */ 849 850 /* {{{ Solr Object Handlers */ 851 #if PHP_VERSION_ID < 80000 852 #define OBJ_FOR_PROP(zv) (zv) 853 854 #if PHP_VERSION_ID < 70400 855 PHP_SOLR_API void solr_object_write_property(zval *object, zval *member, zval *value, void **cache_slot); 856 PHP_SOLR_API void solr_document_field_write_property(zval *object, zval *member, zval *value, void **cache_slot); 857 #else 858 PHP_SOLR_API zval *solr_object_write_property(zval *object, zval *member, zval *value, void **cache_slot); 859 PHP_SOLR_API zval *solr_document_field_write_property(zval *object, zval *member, zval *value, void **cache_slot); 860 #endif 861 862 PHP_SOLR_API zval *solr_object_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv); 863 PHP_SOLR_API void solr_object_unset_property(zval *object, zval *member, void **cache_slot); 864 865 PHP_SOLR_API void solr_object_write_dimension(zval *object, zval *offset, zval *value); 866 PHP_SOLR_API void solr_object_unset_dimension(zval *object, zval *offset); 867 868 PHP_SOLR_API void solr_document_field_unset_property(zval *object, zval *member, void **cache_slot); 869 #else 870 #define OBJ_FOR_PROP(zv) Z_OBJ_P(zv) 871 872 PHP_SOLR_API zval *solr_document_field_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot); 873 PHP_SOLR_API zval *solr_object_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot); 874 875 PHP_SOLR_API zval *solr_object_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv); 876 PHP_SOLR_API void solr_object_unset_property(zend_object *object, zend_string *member, void **cache_slot); 877 878 PHP_SOLR_API void solr_object_write_dimension(zend_object *object, zval *offset, zval *value); 879 PHP_SOLR_API void solr_object_unset_dimension(zend_object *object, zval *offset); 880 881 PHP_SOLR_API void solr_document_field_unset_property(zend_object *object, zend_string *member, void **cache_slot); 882 #endif 883 /* }}} */ 884 885 int add_phrase_field(zval *obj, solr_char_t *pname, zval *boost, zval *slop, solr_char_t *field_name, COMPAT_ARG_SIZE_T field_name_len); 886 887 #include "solr_macros.h" 888 #include "php_solr_dismax_query.h" 889 890 #endif /* HAVE_SOLR */ 891 892 #endif /* SOLRCLIENT_H */ 893 894 /* 895 * Local variables: 896 * tab-width: 4 897 * c-basic-offset: 4 898 * End: 899 * vim600: fdm=marker 900 * vim: noet sw=4 ts=4 901 */ 902