Closed (fixed)
Project:
Search API Solr
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Jun 2014 at 15:01 UTC
Updated:
2 Jun 2015 at 10:32 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
drunken monkeyAttached is both a patch for these problems and a patch containing the test I've used. It just assumes there is a Solr server running at
http://localhost:8983/solr/and uses that for the tests.We probably shouldn't add the test case to the module, though, as it won't be usable for a lot of sites – especially, on drupal.org.
Comment #2
drunken monkeyComment #5
jaydub commentedI just tested out an upgrade of Search API Solr to the latest version and a previously working search with OR facets now results in a failed Solr search with errors in Solr log after upgrading to 1.6. I've narrowed the set of changes from 1.5 to 1.6 to this particular change. If I swap out the 1.5 and 1.6 versions of includes/service.inc I am able to go from working to non-working to working search with facets.
In my particular case I am searching on a string 'superbad' with a drupal node type OR facet. If I search with just one type facet (e.g. 'csm_review') I am fine. As soon as I apply a second type OR facet (e.g. 'csm_video') I get the failure. This particular set of steps works fine with the 1.5 version of service.inc and returns valid results.
URI of the request:
/search/superbad?f[0]=type%3Acsm_review&f[1]=type%3Acsm_video
That is the URL generated by Facet API.
I am running Search API 7.x-1.13, Facet API 7.x-1.5 against Solr 3.6.x
Here is what shows up in the logs:
And here is what looks like the full call to Solr in the logs:
INFO: [core2] webapp=/solr path=/select params={spellcheck=true&facet=true&f.im_field_reference_review_ent_prod$field_term_tv_networks.facet.limit=50&sort=score+desc,+ds_created+desc&facet.limit=10&f.im_field_reference_review_ent_prod$field_term_book_publishers.facet.limit=50&f.im_field_reference_review_ent_prod$field_term_music_labels.facet.limit=50&f.ss_field_reference_review_ent_prod$type.facet.limit=-1&fl=item_id,score&f.im_field_reference_review_ent_prod$field_term_movie_studios.facet.limit=50&f.ss_type.facet.limit=-1&f.im_field_reference_review_ent_prod$field_term_ent_prod_awards.facet.limit=50&f.ss_field_reference_review_ent_prod$type.facet.mincount=0&f.is_field_reference_review_ent_prod$field_term_app_publishers.facet.limit=20&facet.field=is_field_reference_review_ent_prod$field_term_game_publishers&facet.field=im_field_reference_review_ent_prod$field_term_movie_studios&facet.field=im_field_reference_review_ent_prod$field_term_tv_networks&facet.field=is_field_reference_review_ent_prod$field_term_app_publishers&facet.field=is_field_reference_review_ent_prod$field_term_book_type&facet.field=im_field_reference_review_ent_prod$field_term_book_publishers&facet.field=im_field_reference_review_ent_prod$field_term_music_labels&facet.field={!ex%3Dfacet:type}ss_type&facet.field={!ex%3Dfacet:field_reference_review_ent_prod:type}ss_field_reference_review_ent_prod$type&facet.field=im_field_reference_review_ent_prod$field_term_ent_prod_awards&fq=(({!tag%3Dfacet:type}ss_type:"csm_review")+OR+({!tag%3Dfacet:type}ss_type:"csm_video"))&fq=index_id:"site_search_index"&facet.missing=false&f.ss_type.facet.mincount=0&facet.mincount=1&qf=tm_body$value^1.0&qf=tm_field_any_good$value^1.0&qf=tm_field_blog_body$value^1.0&qf=tm_field_blog_subhead^1.0&qf=tm_field_ed_blog_body$value^1.0&qf=tm_field_ed_blog_subhead^1.0&qf=tm_field_editors_pick_description$value^1.0&qf=tm_field_family_topics$value^1.0&qf=tm_field_field_topic_intro$value^1.0&qf=tm_field_one_liner$value^1.0&qf=tm_field_parents_need_to_know$value^1.0&qf=tm_field_press_release_body$value^1.0&qf=tm_field_press_release_subtitle^1.0&qf=tm_field_reference_review_ent_prod$field_term_app_platforms$name^1.0&qf=tm_field_reference_review_ent_prod$field_term_book_authors$name^2.0&qf=tm_field_reference_review_ent_prod$field_term_book_illustrators$name^2.0&qf=tm_field_reference_review_ent_prod$field_term_game_platforms$name^1.0&qf=tm_field_reference_review_ent_prod$field_term_movie_actors$name^2.0&qf=tm_field_reference_review_ent_prod$field_term_movie_directors$name^2.0&qf=tm_field_reference_review_ent_prod$field_term_music_artists$name^2.0&qf=tm_field_reference_review_ent_prod$field_website_url$url^2.0&qf=tm_field_reference_review_ent_prod$title^5.0&qf=tm_field_reference_review_lr$field_how_parents_help$value^1.0&qf=tm_field_reference_review_lr$field_term_skills$name^1.0&qf=tm_field_reference_review_lr$field_term_skills$parent$name^1.0&qf=tm_field_reference_review_lr$field_term_subjects$name^1.0&qf=tm_field_reference_review_lr$field_term_subjects$parent$name^1.0&qf=tm_field_reference_review_lr$field_what_kids_learn$value^1.0&qf=tm_field_research_author^1.0&qf=tm_field_research_intro$value^1.0&qf=tm_field_research_teaser_txt^1.0&qf=tm_field_term_blog_tags$name^1.0&qf=tm_field_term_ed_blog_categories$name^1.0&qf=tm_field_term_video_topics$name^1.0&qf=tm_field_term_video_type$name^1.0&qf=tm_field_top_picks_content$field_reference_review_ent_prod$title^1.0&qf=tm_field_top_picks_intro_text$value^1.0&qf=tm_field_top_picks_teaser$value^1.0&qf=tm_field_topic_question_answer$value^1.0&qf=tm_field_video_teaser$value^1.0&qf=tm_field_what_is_story$value^1.0&qf=tm_title^5.0&json.nl=map&wt=json&rows=20&start=0&facet.sort=count&q=superbad&f.is_field_reference_review_ent_prod$field_term_book_type.facet.limit=50&f.is_field_reference_review_ent_prod$field_term_game_publishers.facet.limit=50} status=400 QTime=4
And the same full call output in the logs using 1.5:
INFO: [core2] webapp=/solr path=/select params={spellcheck=true&facet=true&f.im_field_reference_review_ent_prod$field_term_tv_networks.facet.limit=50&sort=score+desc,+ds_created+desc&facet.limit=10&f.im_field_reference_review_ent_prod$field_term_book_publishers.facet.limit=50&f.im_field_reference_review_ent_prod$field_term_music_labels.facet.limit=50&f.ss_field_reference_review_ent_prod$type.facet.limit=-1&fl=item_id,score&f.im_field_reference_review_ent_prod$field_term_movie_studios.facet.limit=50&f.ss_type.facet.limit=-1&f.im_field_reference_review_ent_prod$field_term_ent_prod_awards.facet.limit=50&f.ss_field_reference_review_ent_prod$type.facet.mincount=0&f.is_field_reference_review_ent_prod$field_term_app_publishers.facet.limit=20&facet.field=is_field_reference_review_ent_prod$field_term_game_publishers&facet.field=im_field_reference_review_ent_prod$field_term_movie_studios&facet.field=im_field_reference_review_ent_prod$field_term_tv_networks&facet.field=is_field_reference_review_ent_prod$field_term_app_publishers&facet.field=is_field_reference_review_ent_prod$field_term_book_type&facet.field=im_field_reference_review_ent_prod$field_term_book_publishers&facet.field=im_field_reference_review_ent_prod$field_term_music_labels&facet.field={!ex%3Dss_type}ss_type&facet.field={!ex%3Dss_field_reference_review_ent_prod$type}ss_field_reference_review_ent_prod$type&facet.field=im_field_reference_review_ent_prod$field_term_ent_prod_awards&fq={!tag%3Dss_type}((ss_type:"csm_review")+OR+(ss_type:"csm_video"))&fq=index_id:"site_search_index"&facet.missing=false&f.ss_type.facet.mincount=0&facet.mincount=1&qf=tm_body$value^1.0&qf=tm_field_any_good$value^1.0&qf=tm_field_blog_body$value^1.0&qf=tm_field_blog_subhead^1.0&qf=tm_field_ed_blog_body$value^1.0&qf=tm_field_ed_blog_subhead^1.0&qf=tm_field_editors_pick_description$value^1.0&qf=tm_field_family_topics$value^1.0&qf=tm_field_field_topic_intro$value^1.0&qf=tm_field_one_liner$value^1.0&qf=tm_field_parents_need_to_know$value^1.0&qf=tm_field_press_release_body$value^1.0&qf=tm_field_press_release_subtitle^1.0&qf=tm_field_reference_review_ent_prod$field_term_app_platforms$name^1.0&qf=tm_field_reference_review_ent_prod$field_term_book_authors$name^2.0&qf=tm_field_reference_review_ent_prod$field_term_book_illustrators$name^2.0&qf=tm_field_reference_review_ent_prod$field_term_game_platforms$name^1.0&qf=tm_field_reference_review_ent_prod$field_term_movie_actors$name^2.0&qf=tm_field_reference_review_ent_prod$field_term_movie_directors$name^2.0&qf=tm_field_reference_review_ent_prod$field_term_music_artists$name^2.0&qf=tm_field_reference_review_ent_prod$field_website_url$url^2.0&qf=tm_field_reference_review_ent_prod$title^5.0&qf=tm_field_reference_review_lr$field_how_parents_help$value^1.0&qf=tm_field_reference_review_lr$field_term_skills$name^1.0&qf=tm_field_reference_review_lr$field_term_skills$parent$name^1.0&qf=tm_field_reference_review_lr$field_term_subjects$name^1.0&qf=tm_field_reference_review_lr$field_term_subjects$parent$name^1.0&qf=tm_field_reference_review_lr$field_what_kids_learn$value^1.0&qf=tm_field_research_author^1.0&qf=tm_field_research_intro$value^1.0&qf=tm_field_research_teaser_txt^1.0&qf=tm_field_term_blog_tags$name^1.0&qf=tm_field_term_ed_blog_categories$name^1.0&qf=tm_field_term_video_topics$name^1.0&qf=tm_field_term_video_type$name^1.0&qf=tm_field_top_picks_content$field_reference_review_ent_prod$title^1.0&qf=tm_field_top_picks_intro_text$value^1.0&qf=tm_field_top_picks_teaser$value^1.0&qf=tm_field_topic_question_answer$value^1.0&qf=tm_field_video_teaser$value^1.0&qf=tm_field_what_is_story$value^1.0&qf=tm_title^5.0&json.nl=map&wt=json&rows=20&start=0&facet.sort=count&q=superbad&f.is_field_reference_review_ent_prod$field_term_book_type.facet.limit=50&f.is_field_reference_review_ent_prod$field_term_game_publishers.facet.limit=50} hits=31 status=0 QTime=6
Looks like more or less the difference are these two parameters:
1.5
1.6
Sorry if I'm not providing enough detail here but I'm not familiar with the changes in this patch and the concept of tags & filters.
Comment #6
drunken monkeyWow, thanks for providing so much detail and analysis! With that, it was very easy to see why this failed, and I could also easily reproduce it. The attached patch should fix the problem, please test!
The reason this previously slipped past me is probably that Solr 4.x seems to handle that error more gracefully, just ignoring the misplaced tags instead of throwing an exception (as 3.x seems to do). But I could still see that there were no more facets returned when more than one OR facet was active.
I also updated the module's (unofficial) test to check for this case.
Comment #7
jaydub commentedOk finally got time to test the patch in #6 and the page no longer WSOD and the search results with the multiple OR facets are correct and match to the behaviour in the previous release of the module.
Comment #8
Frederic wbase commentedI've also tested the patch from #6 and it works like a charm now!
Thanks for your hard work guys!
Comment #9
garrettc commentedI can also confirm that the patch from #6 fixed the issue for me on Solr 3.6.
Comment #10
spadxiii commentedJust applied this to 1.6 and it works like a charm!
My error was with node-type as a facet, I couldn't select more than 1 value.
Comment #11
drunken monkeyExcellent, good to hear. Thank you all for testing!
Committed.
Comment #14
Exploratus commentedThis problem was driving me CRAZY! Couldn't get Range facets to work with OR, and use multiple facets of the same field. Now I can! Thanks!
Comment #15
rp7 commentedI have a facet (called "document_type) using the OR operator (with only 1 active item allowed) because I would like the counts for the non-active items to remain visible. When upgrading to 7.x-1.6, this stopped working. The non-active items stopped appearing. Upgrading to the latest 7.x-1.x-dev didn't solve this either. I *think* this issue is what broke it, since the fq filter is not being tagged anymore.
If I compare the params sent to Solr:
facet.field > {!ex=facet:document_type}ss_document_type
fq > ss_document_type:"article"
When it should be:
facet.field > {!ex=facet:document_type}ss_document_type
fq > {!tag=facet:document_type}ss_document_type:"article"
Is this issue specific to my installation, or are other people seeing the same? Didn't have the time yet to test this on a clean installation, might do so if needed.
Comment #16
gaëlgTricky bug. This might deserve a new stable release. ;)
Comment #17
daluxz commentedI have the same issue as RaF7.
We have a facet using an OR-filter and since the update to 7.x-1.6 this facet stopped working correctly. Only active facet-links are shown. All other facet-links are not visible any more.
Reverting the code that was changed in the protected function getFacetParams in service.inc makes the facet-links visible again.
Comment #18
daluxz commentedAdded a patch that reverts the code as mentioned in #17.
Comment #19
daluxz commentedAnother search_api view had a similar problem, which needed even more code to be reverted.
See attached patch. Basically the same as #18, but with more code reverted.
Comment #20
drunken monkeyAre you maybe using an old version of Search API? I.e., older than 1.10? In that case, please update to keep this working for Solr.
Comment #21
daluxz commentedNo, the sites we are experiencing these problems with are all using the most recent version of Search API (currently 7.x-1.14)
Comment #22
drunken monkeyAnd you are using the latest dev version of Search API Solr?
Which Solr version are you using?
Can you provide more detailed instructions on how to reproduce?
I just tried again, setting the "Author" facet to "OR" on a node index, and it worked fine.
Comment #23
daluxz commentedWe are using Search API Solr 7.x-1.6.
Solr version 3.6.1
Taxonomy facet using OR on a node index.
I was pretty sure that the dev-version had the same problem, but a quick test proves me wrong. Using the dev-version the problem seems to be gone.
I now see that the patch in #6 got committed later (#12) and is missing from 1.6. Applying that patch on the 1.6-version fixes my problem.
Thanks for looking into this.