0

with Apache Solr Views, I created a view with some exposed filters (a textbox, and a bunch of checkboxes on 2 taxonomy vocabularies) to satisfy very picky specs.

When a user launches a text search (with or without checking the box of some taxonomy terms), the taxonomy term's labels that match the results must be highlighted so the user knows which taxonomy terms he can use to narrow his search. Also, the WHERE conditions must be OR, not AND. I was able to do that by creating the same query that is used in my view using template_preprocess_views_view__viewname, checking the facet count of the response and modifying the $variables['exposed'] value to put in bold the labels of the taxonomy terms that had results. I couldn't use the response of the query passed in the function parameters because its facet count only takes into account the first 10 results ... I needed all of them. I also modified the query in mymodule_apachesolr_query_prepare to change the query's WHERE condition from AND to OR.

So that works well enough.

Now I'm asked to, if a user launches a text search and he also checked the box of some taxonomy terms, to highlight the taxonomy term's labels as if the user had not also checked some taxonomy terms ... to let the user know in which taxonomy terms the text he's searching for was found, regardless of what taxonomy term checkboxes he selected.

So I created another query in template_preprocess_views_view__viewname and modified that query in mymodule_apachesolr_query_prepare so that it removes the filters on the taxonomy terms ... but the results of that query are always the same as the results of the first query I created in template_preprocess_views_view__viewname. I did a quick search and found this issue for apache solr views module : Problem with multiple views (or displays) in same page https://www.drupal.org/node/1766254, which tell me that having multiple queries must also be problematic.

I applied the patches suggested in that issue but my queries still return the same result and I don't know what to do ... any hints or suggestions are appreciated.

Thanks !

3
  • Have you tried the Facet API?
    – Darvanen
    Dec 10, 2014 at 23:41
  • The Facet API module is enabled. But it's not a dependency of the Apache Solr Views Integration module so I don't think it's related.
    – agodin
    Dec 11, 2014 at 15:00
  • Hmmm, and you need views specifically for your client's needs, that's difficult.
    – Darvanen
    Dec 11, 2014 at 22:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.