Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] I found a problem with indexing field with value 0 #3900

Closed
taieb123 opened this issue Dec 1, 2023 · 2 comments · Fixed by #3901
Closed

[BUG] I found a problem with indexing field with value 0 #3900

taieb123 opened this issue Dec 1, 2023 · 2 comments · Fixed by #3901

Comments

@taieb123
Copy link

taieb123 commented Dec 1, 2023

Describe the bug
I have a field in the queue configuration with _boolS the value inside the field is 1 or 0 as boolean, the problem is the field was not added to the document when the field value is 0,

The problem inside ApacheSolrForTypo3\Solr\IndexQueue\AbstractIndexer with the function addDocumentFieldsFromTyposcript the problem comes from the condition !empty()

Expected behavior
It should also add the document to the value when the value field is 0

Screenshots
image

Used versions (please complete the following information):

  • TYPO3 Version: 12.4.8
  • EXT:solr Version: 12.0.1
  • Used Apache Solr Version: 9.3.1
  • PHP Version: 8.2.0
  • MySQL Version: 8.0.0
dkd-kaehm added a commit that referenced this issue Dec 3, 2023
AbstractIndexer::addDocumentFieldsFromTyposcript() disallows any PHPs empty value.
This change adds explicit checks for disallowed values:
* null
* empty string
* empty array

Fixes: #3900
@dkd-kaehm
Copy link
Collaborator

@taieb123
Thanks for reporting that issue, please review #3901.

@taieb-rekik-cr
Copy link

@dkd-kaehm
Thank you for the update, yes working fine for me.

dkd-kaehm added a commit that referenced this issue Dec 4, 2023
AbstractIndexer::addDocumentFieldsFromTyposcript() disallows any PHPs empty value.
This change adds explicit checks for disallowed values:
* null
* empty string
* empty array

Fixes: #3900
dkd-kaehm added a commit to dkd-kaehm/ext-solr that referenced this issue Mar 7, 2024
This change is a follow-up of TYPO3-Solr#3901, which was introduced to allow following values in Apache Solr fields:
* numeric 0
* boolean false
which lead to countless-unwanted numeric fields with 0 value in Apache Solr documents.
The background: TypoScript can return the strings only, and all empty values lead to numeric 0.

This change tries to avoid mispelled casting of numbers and lets the 
`AbstractIndexer::ensureFieldValueType()` return PHPs `null` if the value isn't a number. 

Relates: TYPO3-Solr#3900, TYPO3-Solr#3901
dkd-friedrich pushed a commit that referenced this issue Mar 7, 2024
This change is a follow-up of #3901, which was introduced to allow following values in Apache Solr fields:
* numeric 0
* boolean false
which lead to countless-unwanted numeric fields with 0 value in Apache Solr documents.
The background: TypoScript can return the strings only, and all empty values lead to numeric 0.

This change tries to avoid mispelled casting of numbers and lets the 
`AbstractIndexer::ensureFieldValueType()` return PHPs `null` if the value isn't a number. 

Relates: #3900, #3901
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants