Sebastian Hofer
Sebastian Hofer

Reputation: 1

How do I facet for a field value OR field not filled in TYPO3 SOLR

My problem is the following:

I have some courses as solr documents and there I have a multi value field in solr, that contains degree requirements for those courses (requirements_stringM). In this field I have values like 'diploma', 'master', 'bachelor' etc.. So a course has listet all the possible requirements, which enable a user to take part. Beside this I have courses without any requirement -> the field is empty, so it doesn't exist in the certain course document.

Now I need to facet for the requirements in the way, that someone checks one or more of those requirements and in the result I have all the courses the user can attend. This means: All courses, where the selection meets the field values of requirements_stringM AND all courses without any requirement (means no requirements_stringM field in the solr document at all)!

In a plain SOLR query I would write it this way: -(-requirements_stringM:diploma -requirements_stringM:master requirements_stringM:*).

How can I achieve this with TYPO3 ext:solr?

PS: I wanted to write my own facet, but in the current version the composition of those facet filter values happens in the central Faceting modifier instead of within a special facet type class. So I would have to overwrite this modifier to change stuff this way.

Thank you for answers

TYPO3 v10 ext:solr v11.0.4 SOLR v8.5.2

Upvotes: 0

Views: 289

Answers (1)

Georg Ringer
Georg Ringer

Reputation: 7939

What about adding all variants to those documents which don't have any requirement? Additionally I would add a custom field which can be used in the template to differ between having requirements or not

Upvotes: 1

Related Questions