Closed (fixed)
Project:
Facet API
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
7 Oct 2011 at 18:36 UTC
Updated:
4 Jan 2014 at 01:11 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #1
cpliakas commentedAdding Facet API Integration tag.
Comment #2
acbramley commentedI can reproduce this using a custom date field facet.
Comment #3
acbramley commentedHas there been any progress on this? We desperately need this fixed.
Comment #4
nick_vhI've looked into this issue and found out I need more information from the facetapi guys.
These values come from facetapi.callbacks.inc
My question to the facetapi maintainers is : What is the expected format so the last value of a range is seen as a value of that range itself and not the whole range all over again?
On another note I adjusted some of the processing regarding the date ranges. When we had ranges of dates it took the previous date and added the next date as its end range. This had as effect that you were querying solr on more then 1 day (28/09/2011 till 30/09/2011)while you knew there was only a result in 28/09/2011 and 29/09/2011 and 30/09/2011 were completely irrelevant.
Comment #5
nick_vhFurther research :
Prooves that facetapi wants another syntax in the case of data from the last day of the month. It should detect it is only a day instead of a month?
Changing this seems to fix everything magically. I just need confirmation from you guys that this does not break anything in other implementations.
Comment #6
nick_vhAdding Solr Tag
Comment #7
nick_vhAnd better/cleaner patch
Comment #8
acbramley commentedAfter applying your patch I'm still getting the same problems in some cases :( What's really weird is I get a piece of content returned with a date of 1st December 2008 and my facet is showing November 2008 as an option (see screenshot).
Comment #9
acbramley commentedWhat version of facetapi is your patch in #4 for? Neither the --dev or beta7 have the file query_type_date.inc under plugins/facetapi
Comment #10
acbramley commentedAaaah never mind that patch was for solr.
Comment #11
cpliakas commentedThe patch in #7 seem to be logical, I just want to wrap my head around it to make sure it doesn't cause any regressions. I think it would be really helpful to write a unit test using a dummy adapter the test the dat range thing. I think that will be critical to make sure that dates remain solid going forward.
Comment #12
acbramley commented@cpliakas the patch in #7 did not fix the broken facets for me.
Comment #13
cpliakas commented@Zombienaute, thanks for testing.
Comment #14
cpliakas commentedSo I tested this out on my local instance and I cannot replicate this issue. I did a diff between the 7.x-1.0-beta7 and 7.x-1.0-beta10 release of Apache Solr, and this is the only change I found. Not sure why this would effect anything, but apply it and see if it works anyways.
A coupe of questions...
1) Has the content been reindexed lately?
2) This use to show up when we weren't handling tomezones correctly. Everything has to be normalized to GMT in the index and on display.
3) What versions of Facet API and Apache Solr are being used?
~Chris
Comment #15
cpliakas commentedWhat I am very interested in is the dsm() of the $build variable returned by ApacheSolrFacetapiDate::build(). That will ve very instrumental in narrowing down the root cause of the issue.
Comment #16
acbramley commented1) Currently developing this site so must've reindexed the content at least a dozen times in the past week with no change (index has over 1000 pieces of content in it).
2) The field in question is a Date (ISO Format) field using no time zone conversion because it only collects Year, Month, and Day with no end date and something in the date module doesn't let you save a date field with time zone conversion when it only collects those attributes.
3) I'm running beta10 of solr and the latest dev release of FacetAPI.
The attached file contains a dump of $build for 1 search (it seems to be called multiple times).
Comment #17
cpliakas commentedMarking as needs works since we haven't pinpointed this yet.
Comment #18
acbramley commentedAny progress on this? We desperately need this fixed.
Comment #19
cpliakas commentedUnfortunately I cannot replicate, so it is really hard to debug. This issue will be resolved as quickly as there are contributions. I would also take a look at the Apache Solr module, as that is where the data calculated are being calculated. Keep in mind that Facet API doesn't perform the facet calculations, it simply takes the data returned from the server and displays it via the widgets. Judging from the output provided above, Facet API is displaying exactly what is returned by the backend.
Comment #20
nick_vhZombienaute, please try following patch.
I was easily able to replicate and the following patch for apache solr search integration tries to fix it.
The reason it broke is that it did not have any mechanism to stop the date facetting when facetapi decided to stop facetting. Eg.: There is a limit in date filtering and it is set to minute. When this function did not return a new "gap (say, second)" it tried to query solr and break.
Anyway, let me know if it fixes this problem for you.
I also added some new logic so it would be more corresponding to the the actual filter .
This only filters for items within the real gap range, it used to filter for the current to the next item gap range.
ATTENTION: Patch is for apachesolr search integration. The patch in #4 is probably still valid as it solved a use case for me
Comment #21
acbramley commentedThat seemed to fix it, there's still some strange things going on but I think they're unrelated. Cheers!
Comment #22
nick_vhI guess we should commit #7 first to facetapi and then move this issue over to apachesolr search integration again
Comment #23
cpliakas commentedGive me a day or two to wrap my head around all this.
Thanks for everyone's work on this,
Chris
Comment #24
acbramley commentedSorry, the patch in #20 caused another couple of issues:
1) Dates that aren't part of the returned results are showing (see double-dates.png attachment, there's a filter labelled November 15 when the only result is one with November 16 as the date)
2) Drilling down to last facet loses all filtering (see no-filter.png, filtered down to 12:00AM, now all results are showing)
I've tested removing the patch and these issues go away, so setting back to needs work.
Comment #25
nick_vhI'm a bit in the dark here on how to solve this because the facetapi_get_timestamp_gap has a minimum gap of seconds and it seems like we can't change this. Maybe Chris can give us some guidelines on how to resolve the problem of keeping the facets available if the maximum gap is different then the default?
For this code we need to find a correct return value so the items that are selected stay in the date block and don't dissapear if there is nothing to facet for anymore.
Comment #26
acbramley commentedFurther to this:
Clicking the incorrect month (i.e content is set to 1st December and clicking the November facet) returns a Fatal error:
Comment #27
acbramley commentedApplying #7 seems to have stopped the fatals at least but still getting the extra facets that shouldn't be there.
Comment #28
cpliakas commentedSo I was able to replicate after generating 10,000 nodes. Debugging now and testing patches.
Comment #29
cpliakas commentedSo this is interesting... looking at the facet.date.include documentation for Solr it looks like both the upper and lower bounds are inclusive. This might mean that if you are filtering for January 01 to February 01, then dates from February 01 are returned. Trying out some different variations to get around this.
Comment #30
cpliakas commentedDisregard comment in #29, doesn't look like that has anything to do with this.
After some investigation, it looks like the issue here is in the gap calculation for date ranges on the last day of the month. When evaluating the date range "2011-01-31 TO 2011-02-01", the gap should be "DAY". Due to a logic error, it is evaluating to "MONTH" because the code checks for differences in the numeric representation of the month as opposed to the time. The attached patch calculates the number of seconds in a given month which fixes this issue.
Comment #31
acbramley commentedTested this patch and still getting the same issue of 2 months showing with 1 result.
Comment #32
cpliakas commentedIs the date field you are working with a date field or one of the core node created / published properties?
Comment #33
acbramley commentedA date field I've created using "Date (ISO format)" The field only uses Year Month Day components and no end date.
Comment #34
cpliakas commentedUseful information. Will try to replicate that setup.
Thanks,
Chris
Comment #35
nick_vhSome more information regarding this unlimited date issue
I was testing a patch regarding dates for apachesolr and I figured that this problem appears in Solr 3.x but it does NOT in Solr 1.4
For everyone involved in this issue I would recommend you to take a Solr 3.5 instance and test with this.
My guess is that Solr 3.5 offers a much wider range of dates to be filtered on and that somehow we misinterpret the range? When I can (Monday) I will make a dump of the whole process for the 1.4 and for the 3.4. This should get us closer to a resolution and maybe the patch will be in apachesolr, maybe in facetapi.
Comment #36
nick_vhPatch #20 on apachesolr.module and patch #30 on facetapi seem to fix this issue for me (Solr 1.4 and solr 3.4)
Comment #37
cpliakas commentedThanks, Nick. Still trying to replicate. I think the patch in #30 is still valid and a good change anyways, so could you possibly confirm that the changes you mentioned in #36 are compatible with it?
Thanks,
Chris
Comment #38
nick_vhNot sure if I understand your comments but the issues disappear when I apply both patches (#20 and #30) for Solr 3.4.
I would commit #30 for facetapi and then we can continue this issue in the apachesolr issue queue to see if this needs further work or committed as-is
Comment #39
cpliakas commentedYou don't understand my comment because after re-reading #37 doesn't make sense :-P. I misread your post. Disregard, and I will commit #30.
Thanks,
Chris
Comment #40
acbramley commentedI'm using Solr 3.1 and the problem doesn't seem to be fixed for me.
Comment #41
nick_vh@Zombienaute
Can you list all the specs of your setup again please, so we are able to replicate? Maybe even a dump of the data to fill the fields with? If we are not able to replicate, we are not able to fix your issue.
A summary of the information I obtained from the issue
Config
Issues
?
Data
See http://drupal.org/files/facetapi_dump.txt
Comment #42
acbramley commentedYup that's the correct config (I was using Solr 3.1 but just upgraded yesterday to 3.4)
The issues are that I'm getting 2 days/months when there are single result searches. For example, if I facet down to a piece of content that has a date of 1st of February 2011 then the facet will show go:
(-) 2011
January, 2011
February, 2011
You can see this in the screenshot.
I'm running apachesolr beta11 with patch #20 and facetapi 1.x-dev from 18th November with patch #30 applied.
Comment #43
cpliakas commentedThanks for the screenshot. That seems a little weird. This is a tough issue to replicate, and it seems the back and forth is unproductive. I we can't obtain a copy of the site then we are debugging in the dark, so we either need some help with the leg work in identifying / fixing the issue or need to be able to spin up a local copy of the site to replicate.
I am going to commit #30 because I think it it a positive change regardless.
Comment #44
cpliakas commentedCommitted #30 at 0980c36.
Comment #45
nick_vhThanks! Will commit patch #20 to the apachesolr project soon as well. Or should we move this issue back to that project?
Comment #46
cpliakas commentedI'm not sure. It is still unclear where the issue is, so I don't mind wither way.
Comment #47
cpliakas commentedChanging title to reflect the issues posted in this thread.
Comment #48
nick_vhFixed for facetapi, opened a new one for apachesolr
#1376278: Inconsistent behavior of data facets producing unlimited filtering, inconsistent counts, or gap mismatches
Comment #49
cpliakas commentedThanks, Nick!
Comment #50.0
(not verified) commentedUpdated issue summary.