From 8468338c50962c6a4bb0a04a823a008bfdc2fef7 Mon Sep 17 00:00:00 2001 From: omars Date: Tue, 20 May 2025 18:18:37 +0300 Subject: [PATCH 01/14] update docker images, solr v9 --- Dockerfile | 11 +++++++---- tests/docker/Dockerfile | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index a54c6162..c5bfa227 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,11 @@ -FROM php:8.4-cli +FROM php:8.4-cli-alpine3.20 -RUN apt update && apt install libxml2-dev libcurl4-gnutls-dev --yes +RUN apk add --no-cache libxml2-dev libcurl-dev \ + && docker-php-ext-install xml curl \ + && rm -rf /var/cache/apk/* -RUN apt install vim --yes +RUN apk add --no-cache vim \ + && rm -rf /var/cache/apk/* COPY .docker/entrypoint.sh /opt/ @@ -12,4 +15,4 @@ COPY ./ /opt/solr2 WORKDIR /opt/solr2 -ENTRYPOINT ["sh","/opt/entrypoint.sh"] +ENTRYPOINT ["sh","/opt/entrypoint.sh"] \ No newline at end of file diff --git a/tests/docker/Dockerfile b/tests/docker/Dockerfile index d2295aa4..6d06d7ea 100644 --- a/tests/docker/Dockerfile +++ b/tests/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM solr:6.3 +FROM bitnami/solr:9.8.1 COPY collections collections From 013673dc143ef7f8f42fa352919a87781b4da96c Mon Sep 17 00:00:00 2001 From: omars44 Date: Mon, 17 Nov 2025 09:33:56 +0200 Subject: [PATCH 02/14] docker: fix test setup --- docker-compose.yml | 4 +--- tests/docker/Dockerfile | 12 +++--------- tests/docker/init-solr.sh | 20 ++++++++++++++++++++ 3 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 tests/docker/init-solr.sh diff --git a/docker-compose.yml b/docker-compose.yml index 46e7e44c..770746e3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,5 @@ -version: '2.1' - services: solr: build: tests/docker/ ports: - - "8983:8983" + - "127.0.0.1:8983:8983" diff --git a/tests/docker/Dockerfile b/tests/docker/Dockerfile index 6d06d7ea..8c967453 100644 --- a/tests/docker/Dockerfile +++ b/tests/docker/Dockerfile @@ -1,11 +1,5 @@ -FROM bitnami/solr:9.8.1 +FROM solr:9.10.0-slim -COPY collections collections +COPY collections /opt/solr-configs -RUN solr start &&\ - solr create -c collection1 &&\ - solr create -c metal_store &&\ - solr create -c myfiles &&\ - curl 'http://localhost:8983/solr/collection1/update/json?commit=true' --data-binary @collections/collection1.json -H 'Content-type:application/json' &&\ - curl 'http://localhost:8983/solr/metal_store/update/json?commit=true' --data-binary @collections/metal_store.json -H 'Content-type:application/json' &&\ - solr stop +COPY --chmod=755 init-solr.sh /docker-entrypoint-initdb.d/init-solr.sh \ No newline at end of file diff --git a/tests/docker/init-solr.sh b/tests/docker/init-solr.sh new file mode 100644 index 00000000..0f73af30 --- /dev/null +++ b/tests/docker/init-solr.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +echo "Starting temporary Solr server for initialization..." +solr start + +echo "Solr server is running. Creating collections with default configs..." + +solr create -c collection1 +solr create -c metal_store +solr create -c myfiles + +echo "Collections created. Indexing data..." + +curl 'http://localhost:8983/solr/collection1/update/json?commit=true' --data-binary @/opt/solr-configs/collection1.json -H 'Content-type:application/json' +curl 'http://localhost:8983/solr/metal_store/update/json?commit=true' --data-binary @/opt/solr-configs/metal_store.json -H 'Content-type:application/json' + +echo "Data indexed. Stopping temporary Solr server..." +solr stop +echo "Solr initialization complete." \ No newline at end of file From f070c2ce44e5dc6bb4239302598bcc8ea5f1ffa4 Mon Sep 17 00:00:00 2001 From: omars44 Date: Mon, 17 Nov 2025 10:14:55 +0200 Subject: [PATCH 03/14] fix existing collection error --- README.INSTALLATION | 8 +++----- README.md | 29 ++++++++++++++++++++++++----- tests/docker/Dockerfile | 12 ++++++++++-- tests/docker/init-solr.sh | 30 ++++++++++++++++++++++-------- 4 files changed, 59 insertions(+), 20 deletions(-) diff --git a/README.INSTALLATION b/README.INSTALLATION index 2b9d18f1..41cb5449 100644 --- a/README.INSTALLATION +++ b/README.INSTALLATION @@ -2,7 +2,7 @@ PHP VERSION Dependencies ================================================================================ -PHP version 7.0 or later is needed +PHP version 8.0 or later is needed ================================================================================ Extension Dependencies @@ -224,10 +224,8 @@ http://windows.php.net/downloads/snaps/php-5.3/php-5.3-src-latest.zip How to Report Bugs ================================================================================ -Please report bugs to omars@php.net +Please report bugs to -You can also register bugs here - -http://pecl.php.net/bugs/report.php?package=solr +https://github.com/php/pecl-search_engine-solr/issues Thank you for using PHP diff --git a/README.md b/README.md index 4df7bf15..c4a9d157 100644 --- a/README.md +++ b/README.md @@ -31,15 +31,34 @@ For RHEL/Fedora/CentOS/Scientific linux Please make sure to install them before proceeding to the compilation process ```bash - phpize - ./configure - make - make test - sudo make install +phpize +./configure +make +make test +sudo make install ``` more details on README.INSTALLATION +Local Dev Environment +--------------------- + +```bash +docker-compose up -d +# OR +docker-compose up --build -d + +phpize +./configure +make + +export SOLR_SERVER_CONFIGURED=1 +php run-tests.php -q -d extension=$PWD/modules/solr.so --show-diff +# OR run a single test +php run-tests.php -q -d extension=$PWD/modules/solr.so --show-diff tests/004.solrclient_query_terms.phpt + +``` + Contributions ------------- All forms of contributions are welcome! Whether contributing to tests, or the source. diff --git a/tests/docker/Dockerfile b/tests/docker/Dockerfile index 8c967453..ad08d5fb 100644 --- a/tests/docker/Dockerfile +++ b/tests/docker/Dockerfile @@ -1,5 +1,13 @@ -FROM solr:9.10.0-slim +FROM solr:7-slim + +USER root + +RUN apt-get update && \ + apt-get install -y --no-install-recommends curl && \ + rm -rf /var/lib/apt/lists/* COPY collections /opt/solr-configs -COPY --chmod=755 init-solr.sh /docker-entrypoint-initdb.d/init-solr.sh \ No newline at end of file +COPY --chmod=755 init-solr.sh /docker-entrypoint-initdb.d/init-solr.sh + +USER solr \ No newline at end of file diff --git a/tests/docker/init-solr.sh b/tests/docker/init-solr.sh index 0f73af30..16a3a862 100644 --- a/tests/docker/init-solr.sh +++ b/tests/docker/init-solr.sh @@ -3,18 +3,32 @@ set -e echo "Starting temporary Solr server for initialization..." solr start +echo "Solr server is running." -echo "Solr server is running. Creating collections with default configs..." +create_and_index() { + COLLECTION_NAME=$1 + DATA_FILE=$2 -solr create -c collection1 -solr create -c metal_store -solr create -c myfiles + echo "Checking if collection '$COLLECTION_NAME' exists..." -echo "Collections created. Indexing data..." + if curl -s "http://localhost:8983/solr/admin/collections?action=LIST" | grep -q "\"$COLLECTION_NAME\""; then + echo "Collection '$COLLECTION_NAME' already exists. Skipping creation and indexing." + else + echo "Collection '$COLLECTION_NAME' not found. Creating..." + solr create -c "$COLLECTION_NAME" -curl 'http://localhost:8983/solr/collection1/update/json?commit=true' --data-binary @/opt/solr-configs/collection1.json -H 'Content-type:application/json' -curl 'http://localhost:8983/solr/metal_store/update/json?commit=true' --data-binary @/opt/solr-configs/metal_store.json -H 'Content-type:application/json' + if [ -n "$DATA_FILE" ] && [ -f "$DATA_FILE" ]; then + echo "Indexing data for '$COLLECTION_NAME' from $DATA_FILE..." + curl "http://localhost:8983/solr/$COLLECTION_NAME/update/json?commit=true" --data-binary @"$DATA_FILE" -H 'Content-type:application/json' + else + echo "No data file provided or found for '$COLLECTION_NAME'. Skipping indexing." + fi + fi +} -echo "Data indexed. Stopping temporary Solr server..." +create_and_index "collection1" "/opt/solr-configs/collection1.json" +create_and_index "metal_store" "/opt/solr-configs/metal_store.json" + +echo "Data initialization finished. Stopping temporary Solr server..." solr stop echo "Solr initialization complete." \ No newline at end of file From 6967ae8a0a90037c9b15fc60dcde4e7a7b5e19ea Mon Sep 17 00:00:00 2001 From: omars44 Date: Mon, 15 Jun 2026 11:56:34 +0300 Subject: [PATCH 04/14] fix type deduction errors --- src/solr_functions_params.c | 4 ++-- src/solr_string.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/solr_functions_params.c b/src/solr_functions_params.c index f6edc074..1d8d1bba 100644 --- a/src/solr_functions_params.c +++ b/src/solr_functions_params.c @@ -645,7 +645,7 @@ PHP_SOLR_API void solr_simple_list_param_value_fetch(solr_param_t *solr_param, s solr_param_value_t *current_ptr = solr_param->head; solr_char_t list_delimiter = ','; /* Comma 0x2C */ zend_ulong n_loops = solr_param->count - 1; - auto solr_string_t tmp_buffer; + solr_string_t tmp_buffer; zend_string *url_encoded_list = NULL; solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); @@ -935,7 +935,7 @@ PHP_SOLR_API void solr_simple_list_param_value_tostring(solr_param_t *solr_param solr_param_value_t *current_ptr = solr_param->head; solr_char_t list_delimiter = solr_param->delimiter; /* Comma 0x2C */ zend_ulong n_loops = solr_param->count - 1; - auto solr_string_t tmp_buffer; + solr_string_t tmp_buffer; zend_string *url_encoded_list = NULL; solr_string_appends(buffer, solr_param->param_name, solr_param->param_name_length); diff --git a/src/solr_string.c b/src/solr_string.c index ca273876..37d7af09 100644 --- a/src/solr_string.c +++ b/src/solr_string.c @@ -52,7 +52,7 @@ php_printf("solr_string_alloc() [Re]allocated %u bytes at %p in %s(), %s Line %d /* {{{ PHP_SOLR_API void solr_string_appends(solr_string_t *dest, const solr_char_t *src, size_t length SOLR_MEM_DEBUG_DC) */ PHP_SOLR_API void solr_string_appends_ex(solr_string_t *dest, const solr_char_t *src, size_t length SOLR_MEM_DEBUG_DC) { - auto size_t __new_length = 0U; + size_t __new_length = 0U; /* (Re)allocates memory and increases the capacity if necessary */ solr_string_alloc(dest, length, &__new_length SOLR_MEM_DEBUG_CC); @@ -71,7 +71,7 @@ PHP_SOLR_API void solr_string_appends_ex(solr_string_t *dest, const solr_char_t /* {{{ PHP_SOLR_API void solr_string_appendc(solr_string_t *dest, solr_char_t ch SOLR_MEM_DEBUG_DC) */ PHP_SOLR_API void solr_string_appendc_ex(solr_string_t *dest, solr_char_t ch SOLR_MEM_DEBUG_DC) { - auto size_t __new_length = 0U; + size_t __new_length = 0U; /* (Re)allocates memory and increases the capacity if necessary */ solr_string_alloc(dest, 1, &__new_length SOLR_MEM_DEBUG_CC); @@ -101,7 +101,7 @@ PHP_SOLR_API void solr_string_remove_last_char(solr_string_t *dest) /* {{{ PHP_SOLR_API void solr_string_append_long(solr_string_t *dest, long int long_val) */ PHP_SOLR_API void solr_string_append_long_ex(solr_string_t *dest, long int long_val SOLR_MEM_DEBUG_DC) { - auto size_t __new_length = 0U; + size_t __new_length = 0U; auto char tmp_buffer[SOLR_STRING_LONG_BUFFER_SIZE]; size_t length = 0; @@ -127,7 +127,7 @@ PHP_SOLR_API void solr_string_append_long_ex(solr_string_t *dest, long int long_ /* {{{ PHP_SOLR_API void solr_string_append_unsigned_long(solr_string_t *dest, unsigned long int long_val) */ PHP_SOLR_API void solr_string_append_unsigned_long_ex(solr_string_t *dest, unsigned long int long_val SOLR_MEM_DEBUG_DC) { - auto size_t __new_length = 0U; + size_t __new_length = 0U; auto char tmp_buffer[SOLR_STRING_UNSIGNED_LONG_BUFFER_SIZE]; size_t length = 0; From f011ee5742cc416bd3ebfeef4406b36697928a80 Mon Sep 17 00:00:00 2001 From: omars44 Date: Mon, 15 Jun 2026 20:42:30 +0300 Subject: [PATCH 05/14] fix SolrResponse::getDigestedResponse() test --- .../108.solrresponse_getdigestedresponse.phpt | 58 ++++++++++++++++--- 1 file changed, 51 insertions(+), 7 deletions(-) diff --git a/tests/108.solrresponse_getdigestedresponse.phpt b/tests/108.solrresponse_getdigestedresponse.phpt index d3619aa6..17e4418f 100644 --- a/tests/108.solrresponse_getdigestedresponse.phpt +++ b/tests/108.solrresponse_getdigestedresponse.phpt @@ -15,7 +15,7 @@ $options = array 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, - 'path' => SOLR_SERVER_PATH, + 'path' => 'solr/metal_store', ); @@ -23,21 +23,65 @@ $client = new SolrClient($options); $query = new SolrQuery(); -$query->setQuery('lucene'); +$query->setQuery('artist_s:Satyricon'); $query->setStart(0); $query->setRows(50); -$query->addField('cat')->addField('features')->addField('id')->addField('timestamp'); +$query->addField('name_s')->addField('artist_s')->addField('cat')->addField('id'); $query_response = $client->query($query); +// failing without getResponse first (bug) +$response = $query_response->getResponse(); + var_dump($query_response->getDigestedResponse()); -$tmp = $query_response->getResponse(); $digestedResponse = $query_response->getDigestedResponse(); -print_r($digestedResponse); +print_r(unserialize($digestedResponse)); ?> --EXPECTF-- -string(1) " " -O:10:"SolrObject":2:{s:14:"responseHeader";O:10:"SolrObject":3:{s:6:"status";i:0;s:5:"QTime";i:%d;s:%d:"params";O:10:"SolrObject":7:{s:1:"q";s:6:"lucene";s:6:"indent";s:2:"on";s:2:"fl";s:25:"cat,features,id,timestamp";s:5:"start";s:1:"0";s:4:"rows";s:2:"50";s:7:"version";s:3:"2.2";s:2:"wt";s:3:"xml";}}s:8:"response";O:10:"SolrObject":3:{s:8:"numFound";i:1;s:5:"start";i:0;s:4:"docs";a:1:{i:0;O:10:"SolrObject":3:{s:2:"id";s:8:"SOLR1000";s:3:"cat";a:2:{i:0;s:8:"software";i:1;s:6:"search";}s:8:"features";a:7:{i:0;s:51:"Advanced Full-Text Search Capabilities using Lucene";i:1;s:37:"Optimized for High Volume Web Traffic";i:2;s:46:"Standards Based Open Interfaces - XML and HTTP";i:3;s:44:"Comprehensive HTML Administration Interfaces";i:4;s:64:"Scalability - Efficient Replication to other Solr Search Servers";i:5;s:56:"Flexible and Adaptable with XML configuration and Schema";i:6;s:62:"Good unicode support: héllo (hello with an accent over the e)";}}}}} \ No newline at end of file +string(571) "O:10:"SolrObject":2:{s:14:"responseHeader";O:10:"SolrObject":3:{s:6:"status";i:0;s:5:"QTime";i:%d;s:6:"params";O:10:"SolrObject":7:{s:1:"q";s:18:"artist_s:Satyricon";s:6:"indent";s:2:"on";s:2:"fl";s:22:"name_s,artist_s,cat,id";s:5:"start";s:1:"0";s:4:"rows";s:2:"50";s:7:"version";s:3:"2.2";s:2:"wt";s:3:"xml";}}s:8:"response";O:10:"SolrObject":3:{s:8:"numFound";i:1;s:5:"start";i:0;s:4:"docs";a:1:{i:0;O:10:"SolrObject":4:{s:2:"id";s:1:"3";s:6:"name_s";s:26:"Satyricon - Nemesis Divina";s:8:"artist_s";s:9:"Satyricon";s:3:"cat";a:2:{i:0;s:4:"tops";i:1;s:7:"tshirts";}}}}}" +SolrObject Object +( + [responseHeader] => SolrObject Object + ( + [status] => 0 + [QTime] => %d + [params] => SolrObject Object + ( + [q] => artist_s:Satyricon + [indent] => on + [fl] => name_s,artist_s,cat,id + [start] => 0 + [rows] => 50 + [version] => 2.2 + [wt] => xml + ) + + ) + + [response] => SolrObject Object + ( + [numFound] => 1 + [start] => 0 + [docs] => Array + ( + [0] => SolrObject Object + ( + [id] => 3 + [name_s] => Satyricon - Nemesis Divina + [artist_s] => Satyricon + [cat] => Array + ( + [0] => tops + [1] => tshirts + ) + + ) + + ) + + ) + +) \ No newline at end of file From 9eaeae677622eb9365a5f82dca2df212872f0d32 Mon Sep 17 00:00:00 2001 From: omars44 Date: Tue, 16 Jun 2026 09:43:14 +0300 Subject: [PATCH 06/14] Revert "fix SolrResponse::getDigestedResponse() test" This reverts commit f011ee5742cc416bd3ebfeef4406b36697928a80. --- .../108.solrresponse_getdigestedresponse.phpt | 58 +++---------------- 1 file changed, 7 insertions(+), 51 deletions(-) diff --git a/tests/108.solrresponse_getdigestedresponse.phpt b/tests/108.solrresponse_getdigestedresponse.phpt index 17e4418f..d3619aa6 100644 --- a/tests/108.solrresponse_getdigestedresponse.phpt +++ b/tests/108.solrresponse_getdigestedresponse.phpt @@ -15,7 +15,7 @@ $options = array 'login' => SOLR_SERVER_USERNAME, 'password' => SOLR_SERVER_PASSWORD, 'port' => SOLR_SERVER_PORT, - 'path' => 'solr/metal_store', + 'path' => SOLR_SERVER_PATH, ); @@ -23,65 +23,21 @@ $client = new SolrClient($options); $query = new SolrQuery(); -$query->setQuery('artist_s:Satyricon'); +$query->setQuery('lucene'); $query->setStart(0); $query->setRows(50); -$query->addField('name_s')->addField('artist_s')->addField('cat')->addField('id'); +$query->addField('cat')->addField('features')->addField('id')->addField('timestamp'); $query_response = $client->query($query); -// failing without getResponse first (bug) -$response = $query_response->getResponse(); - var_dump($query_response->getDigestedResponse()); +$tmp = $query_response->getResponse(); $digestedResponse = $query_response->getDigestedResponse(); -print_r(unserialize($digestedResponse)); +print_r($digestedResponse); ?> --EXPECTF-- -string(571) "O:10:"SolrObject":2:{s:14:"responseHeader";O:10:"SolrObject":3:{s:6:"status";i:0;s:5:"QTime";i:%d;s:6:"params";O:10:"SolrObject":7:{s:1:"q";s:18:"artist_s:Satyricon";s:6:"indent";s:2:"on";s:2:"fl";s:22:"name_s,artist_s,cat,id";s:5:"start";s:1:"0";s:4:"rows";s:2:"50";s:7:"version";s:3:"2.2";s:2:"wt";s:3:"xml";}}s:8:"response";O:10:"SolrObject":3:{s:8:"numFound";i:1;s:5:"start";i:0;s:4:"docs";a:1:{i:0;O:10:"SolrObject":4:{s:2:"id";s:1:"3";s:6:"name_s";s:26:"Satyricon - Nemesis Divina";s:8:"artist_s";s:9:"Satyricon";s:3:"cat";a:2:{i:0;s:4:"tops";i:1;s:7:"tshirts";}}}}}" -SolrObject Object -( - [responseHeader] => SolrObject Object - ( - [status] => 0 - [QTime] => %d - [params] => SolrObject Object - ( - [q] => artist_s:Satyricon - [indent] => on - [fl] => name_s,artist_s,cat,id - [start] => 0 - [rows] => 50 - [version] => 2.2 - [wt] => xml - ) - - ) - - [response] => SolrObject Object - ( - [numFound] => 1 - [start] => 0 - [docs] => Array - ( - [0] => SolrObject Object - ( - [id] => 3 - [name_s] => Satyricon - Nemesis Divina - [artist_s] => Satyricon - [cat] => Array - ( - [0] => tops - [1] => tshirts - ) - - ) - - ) - - ) - -) \ No newline at end of file +string(1) " " +O:10:"SolrObject":2:{s:14:"responseHeader";O:10:"SolrObject":3:{s:6:"status";i:0;s:5:"QTime";i:%d;s:%d:"params";O:10:"SolrObject":7:{s:1:"q";s:6:"lucene";s:6:"indent";s:2:"on";s:2:"fl";s:25:"cat,features,id,timestamp";s:5:"start";s:1:"0";s:4:"rows";s:2:"50";s:7:"version";s:3:"2.2";s:2:"wt";s:3:"xml";}}s:8:"response";O:10:"SolrObject":3:{s:8:"numFound";i:1;s:5:"start";i:0;s:4:"docs";a:1:{i:0;O:10:"SolrObject":3:{s:2:"id";s:8:"SOLR1000";s:3:"cat";a:2:{i:0;s:8:"software";i:1;s:6:"search";}s:8:"features";a:7:{i:0;s:51:"Advanced Full-Text Search Capabilities using Lucene";i:1;s:37:"Optimized for High Volume Web Traffic";i:2;s:46:"Standards Based Open Interfaces - XML and HTTP";i:3;s:44:"Comprehensive HTML Administration Interfaces";i:4;s:64:"Scalability - Efficient Replication to other Solr Search Servers";i:5;s:56:"Flexible and Adaptable with XML configuration and Schema";i:6;s:62:"Good unicode support: héllo (hello with an accent over the e)";}}}}} \ No newline at end of file From a660de775ffdfc373ede05264f3eddac44f12863 Mon Sep 17 00:00:00 2001 From: omars44 Date: Tue, 16 Jun 2026 09:58:41 +0300 Subject: [PATCH 07/14] docker: fix init script compat solr 7, and force schema to tech products, resolves indexing defaults and changes between versions --- tests/docker/init-solr.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/docker/init-solr.sh b/tests/docker/init-solr.sh index 16a3a862..8596883c 100644 --- a/tests/docker/init-solr.sh +++ b/tests/docker/init-solr.sh @@ -6,22 +6,24 @@ solr start echo "Solr server is running." create_and_index() { - COLLECTION_NAME=$1 + CORE_NAME=$1 DATA_FILE=$2 - echo "Checking if collection '$COLLECTION_NAME' exists..." + echo "Checking if core '$CORE_NAME' exists..." - if curl -s "http://localhost:8983/solr/admin/collections?action=LIST" | grep -q "\"$COLLECTION_NAME\""; then - echo "Collection '$COLLECTION_NAME' already exists. Skipping creation and indexing." + if curl -s "http://localhost:8983/solr/admin/cores?action=STATUS&core=$CORE_NAME" | grep -q "uptime"; then + echo "Core '$CORE_NAME' already exists. Skipping creation and indexing." else - echo "Collection '$COLLECTION_NAME' not found. Creating..." - solr create -c "$COLLECTION_NAME" + echo "Core '$CORE_NAME' not found. Creating..." + + # Force use of the commons strict configset (schema-full not schemaless) + solr create -c "$CORE_NAME" -d /opt/solr/server/solr/configsets/sample_techproducts_configs/conf if [ -n "$DATA_FILE" ] && [ -f "$DATA_FILE" ]; then - echo "Indexing data for '$COLLECTION_NAME' from $DATA_FILE..." - curl "http://localhost:8983/solr/$COLLECTION_NAME/update/json?commit=true" --data-binary @"$DATA_FILE" -H 'Content-type:application/json' + echo "Indexing data for '$CORE_NAME' from $DATA_FILE..." + curl "http://localhost:8983/solr/$CORE_NAME/update/json?commit=true" --data-binary @"$DATA_FILE" -H 'Content-type:application/json' else - echo "No data file provided or found for '$COLLECTION_NAME'. Skipping indexing." + echo "No data file provided or found for '$CORE_NAME'. Skipping indexing." fi fi } From 163caaee0b1c2120413d1b2edac25f257fd1e487 Mon Sep 17 00:00:00 2001 From: omars44 Date: Tue, 16 Jun 2026 10:14:35 +0300 Subject: [PATCH 08/14] SolrClient::addDocumnt() test: add dynamic fields as per tech products schema dynamic fields spec --- tests/001.solrclient_addDocument_partial.phpt | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/tests/001.solrclient_addDocument_partial.phpt b/tests/001.solrclient_addDocument_partial.phpt index be92c400..749ce418 100644 --- a/tests/001.solrclient_addDocument_partial.phpt +++ b/tests/001.solrclient_addDocument_partial.phpt @@ -28,13 +28,14 @@ $client->commit(); $initialDoc = new SolrInputDocument(); +// multivalued str _ss, _s string, _i suffixes for dynamic fields for schema tech products $initialDoc->addField('id', 'testing_partials'); -$initialDoc->addField('field1', 'existing value'); -$initialDoc->addField('field1', 'remove me please'); -$initialDoc->addField('field1', '15/01/2007'); +$initialDoc->addField('field1_ss', 'existing value'); +$initialDoc->addField('field1_ss', 'remove me please'); +$initialDoc->addField('field1_ss', '15/01/2007'); $initialDoc->addField('field2_s', 'initialField'); $initialDoc->addField('field3_i', 0); -$initialDoc->addField('field4', 'val1'); +$initialDoc->addField('field4_ss', 'val1'); $initialDoc->addField('field5_s', 'unmodified field'); $client->addDocument($initialDoc); @@ -44,11 +45,11 @@ $printDocument(); $doc = new SolrInputDocument(); $doc->addField('id', 'testing_partials'); -$doc->updateField('field1', SolrInputDocument::UPDATE_MODIFIER_ADD, 'newly added value'); -$doc->updateField('field1', SolrInputDocument::UPDATE_MODIFIER_REMOVE, 'remove me please'); +$doc->updateField('field1_ss', SolrInputDocument::UPDATE_MODIFIER_ADD, 'newly added value'); +$doc->updateField('field1_ss', SolrInputDocument::UPDATE_MODIFIER_REMOVE, 'remove me please'); $doc->updateField('field3_i', SolrInputDocument::UPDATE_MODIFIER_INC, 5); $doc->updateField('field2_s', SolrInputDocument::UPDATE_MODIFIER_SET, 'updated string'); -$doc->updateField('field1', SolrInputDocument::UPDATE_MODIFIER_REMOVEREGEX, '[\d]{2}/[\d]{2}/[\d]{4}'); +$doc->updateField('field1_ss', SolrInputDocument::UPDATE_MODIFIER_REMOVEREGEX, '[\d]{2}/[\d]{2}/[\d]{4}'); $response = $client->addDocument($doc); $client->commit(); @@ -66,7 +67,7 @@ SolrObject Object [doc] => SolrObject Object ( [id] => testing_partials - [field1] => Array + [field1_ss] => Array ( [0] => existing value [1] => remove me please @@ -75,7 +76,7 @@ SolrObject Object [field2_s] => initialField [field3_i] => 0 - [field4] => Array + [field4_ss] => Array ( [0] => val1 ) @@ -90,9 +91,9 @@ SolrObject Object testing_partials - newly added value - remove me please - [\d]{2}/[\d]{2}/[\d]{4} + newly added value + remove me please + [\d]{2}/[\d]{2}/[\d]{4} 5 updated string @@ -103,7 +104,7 @@ SolrObject Object [doc] => SolrObject Object ( [id] => testing_partials - [field1] => Array + [field1_ss] => Array ( [0] => existing value [1] => newly added value @@ -111,7 +112,7 @@ SolrObject Object [field2_s] => updated string [field3_i] => 5 - [field4] => Array + [field4_ss] => Array ( [0] => val1 ) From c8ffe4d458b407f5cd18d7774b7c753bf84e43b5 Mon Sep 17 00:00:00 2001 From: omars44 Date: Tue, 16 Jun 2026 10:43:25 +0300 Subject: [PATCH 09/14] Terms component test: use terms lowercase, due to change in schema of name field --- tests/004.solrclient_query_terms.phpt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/004.solrclient_query_terms.phpt b/tests/004.solrclient_query_terms.phpt index 227b13f6..93353b2f 100644 --- a/tests/004.solrclient_query_terms.phpt +++ b/tests/004.solrclient_query_terms.phpt @@ -27,7 +27,9 @@ $query->setTerms(true); $query->setTermsField('name'); -$query->setTermsLowerBound('a'); +$query->setTermsLowerBound('c'); + +$query->setTermsUpperBound('d'); $query->setTermsSort(SolrQuery::TERMS_SORT_INDEX); @@ -39,7 +41,7 @@ print_r($query_response->getResponse()); ?> --EXPECTF-- -http://%s/solr/collection1/terms/?version=2.2&indent=on&wt=xml +http://127.0.0.1:8983/solr/collection1/terms/?version=2.2&indent=on&wt=xml SolrObject Object ( [responseHeader] => SolrObject Object @@ -52,7 +54,13 @@ SolrObject Object ( [name] => SolrObject Object ( - [iPod & iPod Mini USB 2.0 Cable] => %d + [cable] => %d + [canon] => %d + [card] => %d + [channel] => %d + [characters] => %d + [cord] => %d + [corsair] => %d ) ) From 31e6dbe012deaf22c806780cd86ddfac84e2862f Mon Sep 17 00:00:00 2001 From: omars44 Date: Tue, 16 Jun 2026 10:48:21 +0300 Subject: [PATCH 10/14] bug_72033 test: fix dynamic field suffix --- tests/bug_72033.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/bug_72033.phpt b/tests/bug_72033.phpt index 01645540..edde4b65 100644 --- a/tests/bug_72033.phpt +++ b/tests/bug_72033.phpt @@ -23,7 +23,7 @@ $client = new SolrClient($options); $doc = new SolrInputDocument(); $doc->addField('id', 'some_id'); -$doc->addField('field1', 'val1'); +$doc->addField('field1_s', 'val1'); $client->addDocument($doc); From 02a1bcb3b87ac575c170a0c5185b2de21dbf9c3d Mon Sep 17 00:00:00 2001 From: omars44 Date: Tue, 16 Jun 2026 10:50:15 +0300 Subject: [PATCH 11/14] Solr7 TechProducts schema reference --- tests/docker/solr7-techproducts-schema.xml | 1187 ++++++++++++++++++++ 1 file changed, 1187 insertions(+) create mode 100644 tests/docker/solr7-techproducts-schema.xml diff --git a/tests/docker/solr7-techproducts-schema.xml b/tests/docker/solr7-techproducts-schema.xml new file mode 100644 index 00000000..b6d3d165 --- /dev/null +++ b/tests/docker/solr7-techproducts-schema.xml @@ -0,0 +1,1187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 941d4df1aa28406199458873e947a9b2aff795dc Mon Sep 17 00:00:00 2001 From: omars44 Date: Wed, 17 Jun 2026 05:54:21 +0300 Subject: [PATCH 12/14] ci tests: show diff --- .github/workflows/linux-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux-tests.yml b/.github/workflows/linux-tests.yml index e601e331..d9b77461 100644 --- a/.github/workflows/linux-tests.yml +++ b/.github/workflows/linux-tests.yml @@ -41,7 +41,7 @@ jobs: - name: Run tests env: SOLR_SERVER_CONFIGURED: 1 - run: TEST_PHP_ARGS="$TEST_PHP_ARGS -q" make test + run: TEST_PHP_ARGS="$TEST_PHP_ARGS -q --show-diff" make test services: solr: From 469c0ab384b880ed2490714470e9bee8046a028e Mon Sep 17 00:00:00 2001 From: omars44 Date: Wed, 17 Jun 2026 06:11:05 +0300 Subject: [PATCH 13/14] ci: use solr7-slim image --- .github/workflows/linux-tests.yml | 2 +- docker-compose.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux-tests.yml b/.github/workflows/linux-tests.yml index d9b77461..f1d84529 100644 --- a/.github/workflows/linux-tests.yml +++ b/.github/workflows/linux-tests.yml @@ -45,6 +45,6 @@ jobs: services: solr: - image: omars44/pecl-solr-test:latest + image: omarskem/pecl-solr-server:solr7-slim ports: - 8983:8983 diff --git a/docker-compose.yml b/docker-compose.yml index 770746e3..24acbf36 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,6 @@ services: solr: + image: omarskem/pecl-solr-server:solr7-slim build: tests/docker/ ports: - "127.0.0.1:8983:8983" From 66a6776987b191b7003285bfa658c10dd2590946 Mon Sep 17 00:00:00 2001 From: omars44 Date: Wed, 17 Jun 2026 06:36:28 +0300 Subject: [PATCH 14/14] tests: fix sendUpdateStream reqs, add missing core myfiles --- tests/docker/init-solr.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/docker/init-solr.sh b/tests/docker/init-solr.sh index 8596883c..78b1c468 100644 --- a/tests/docker/init-solr.sh +++ b/tests/docker/init-solr.sh @@ -16,7 +16,7 @@ create_and_index() { else echo "Core '$CORE_NAME' not found. Creating..." - # Force use of the commons strict configset (schema-full not schemaless) + # Force use of the common strict configset (schema-full not schemaless) solr create -c "$CORE_NAME" -d /opt/solr/server/solr/configsets/sample_techproducts_configs/conf if [ -n "$DATA_FILE" ] && [ -f "$DATA_FILE" ]; then @@ -31,6 +31,8 @@ create_and_index() { create_and_index "collection1" "/opt/solr-configs/collection1.json" create_and_index "metal_store" "/opt/solr-configs/metal_store.json" +create_and_index "myfiles" "" + echo "Data initialization finished. Stopping temporary Solr server..." solr stop echo "Solr initialization complete." \ No newline at end of file