I'm using the Drupal ApacheSolr Multisite Module which due to it's dependency Apache Solr Search config currently only support Solr 5.x. I'm using Solr 7 and have update most of the config. I've got everything working except on /select. I believe this is because the query the module supplies (example shown below) features a "q" value which apparently causes it to fail. Is there a way in the solrconfig.xml to set q equal to "* . *" for all selects? I'd like to avoid code changes to the Drupal module itself if possible for deployment purposes.
Solar REST request example
http://localhost:8983/solr/drupal_multisite/select?start=0&rows=10&fq=%28hash%3A6qegyq%20OR%20access__all%3A0%29&fq=%28hash%3A6qegyq%29&spellcheck=true&q=test&fl=id%2Centity_id%2Centity_type%2Cbundle%2Cbundle_name%2Clabel%2Css_language%2Cis_comment_count%2Cds_created%2Cds_changed%2Cscore%2Cpath%2Curl%2Cis_uid%2Ctos_name%2Chash%2Csite&mm=1&pf=content%5E2.0&ps=15&hl=true&hl.fl=content&hl.snippets=3&hl.mergeContigious=true&f.content.hl.alternateField=teaser&f.content.hl.maxAlternateFieldLength=256&spellcheck.q=test&qf=content%5E40&qf=label%5E5.0&qf=tags_h1%5E5.0&qf=tags_h2_h3%5E3.0&qf=tags_h4_h5_h6%5E2.0&qf=tags_inline%5E1.0&qf=tos_content_extra%5E0.1&qf=tos_name%5E3.0&qf=ts_comments%5E20&wt=json&json.nl=map
solarconfig.xml example
<requestHandler name="/select" class="solr.SearchHandler">
<lst name="defaults">
<str name="df">text</str>
<str name="q">*:*</str>
<str name="q.alt">*:*</str>
</lst>
</requestHandler>
Thank you for any advice!
It is possible to alter the query from your own drupal module, Apache Solr Search module exposes a hook for this (hook_apachesolr_query_alter()
).
/**
* Implementation of hook_apachesolr_query_alter().
*
* @param DrupalSolrQueryInterface $query
* @see apachesolr.interface.inc
*/
function yourmodule_apachesolr_query_alter(DrupalSolrQueryInterface $query) {
$query->replaceParam('q', '*:*');
}
That being said, if you "got everything working except on /select", your issue could be related to your request dispatcher's handleSelect
parameter, an option that affects the behavior of requests such as /select?qt=XXX
(read SOLR mm and phrase queries not working after upgrading from SOLR 4 to SOLR 6 if you don't know what I mean).