PATCH FOR THIS IS ATTACHED:

Use case:
The following warning and notices show up in watchdog when a date facet is not used: (facet by department or category for example, not date)

Warning: Missing argument 2 for date_facets_get_ranges(), called in modules/contrib/date_facets/lib/Drupal/Apachesolr/Facetapi/QueryType/DateRangeQueryType.php on line 100 and defined in date_facets_get_ranges() (line 91 of modules/contrib/date_facets/date_facets.module).

Undefined index: [2014-01-01T00:00:00Z TO 2015-01-01T00:00:00Z] in _date_facets_api_facet_create_label() (line 75 of modules/contrib/date_facets/date_facets.module).

Undefined index: index id in _date_facets_api_facet_create_label() (line 65 of modules/contrib/date_facets/date_facets.module).

Undefined index: field in _date_facets_api_facet_create_label() (line 65 of modules/contrib/date_facets/date_facets.module).

See attached patch.

Comments

joseph.olstad’s picture

StatusFileSize
new2.35 KB

Added patch with appropriate name.

Patches date_facets.module
and also lib/Drupal/Apachesolr/Facetapi/QueryType/DateRangeQueryType.php

joseph.olstad’s picture

Issue summary: View changes
joseph.olstad’s picture

Issue summary: View changes
joseph.olstad’s picture

Cleaned up debugging code
Please review this patch.

joseph.olstad’s picture

(formatting change to patch)
added a space after , and before NULL parameter

joseph.olstad’s picture

redid patch to make sure it works on latest dev build.

joseph.olstad’s picture

Assigned: joseph.olstad » Unassigned

I've been running this patch for a couple weeks, no issues.

eugene.ilyin’s picture

Hello

I'm using Search API

I cannot reproduce notices when I'm using this

Use case:
The following warning and notices show up in watchdog when a date facet is not used: (facet by department or category for example, not date)

eugene.ilyin’s picture

Status: Patch (to be ported) » Needs work
eugene.ilyin’s picture

Status: Needs work » Postponed (maintainer needs more info)
eugene.ilyin’s picture

I've tried to reproduce it again but I haven't any errors when I'm using other facets (facet by string in my case).
I'm closing this issue. Don't hesitate to open it again if you'll have problems.

eugene.ilyin’s picture

Status: Postponed (maintainer needs more info) » Fixed
joseph.olstad’s picture

Fixed as in "committed" or fixed as in "cannot reproduce"?

In my site, I have two languages and entity translation with field translation enabled. As well we're using the i18n module for string translations of labels and such. Might be the reason why we needed the patch.

If you look at the code of the patch, a couple isset calls , very low risk type of stuff.

eugene.ilyin’s picture

fixed as "cannot reproduce".

If you look at the code of the patch, a couple isset calls , very low risk type of stuff.

I agree, but we shouldn't use isset just to use it. Please provide step by step algorithm - how I can reproduce this problem.

joseph.olstad’s picture

Hi Eugene, unfortunately getting the steps to reproduce would be very difficult for me. I am no longer working on any sites that use date facets.

With that said, if no one else has responded, perhaps the issue is mitigated by recent improvements to the module or else perhaps just very few people are using date facets with multilingual drupal site configurations.

Either way, someone may stumble across this patch in the future.

The other likelihood is that most people ignore their watchdog and let their watchdog pile up with warning messages without dealing with them.

eugene.ilyin’s picture

Hi Joseph.

unfortunately getting the steps to reproduce would be very difficult for me.

For me too :)

So, I'll be happy if somebody will submit algorithm and patch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.