Drupal 9 view on solr search query alter filter

Drupal 9
Apache SOLR
view uses SOLR search
Have a boolean field as exposed filter
The boolean field is not required and default is FALSE.
When added the boolean field, there were existing content with this field value NULL.
This exposed filter lists TRUE value record when selecting TRUE, and lists FALSE records
when selecting FALSE.
Now want to alter the filter to list FALSE and NULL value records when selecting FALSE.
Search API Solr provides hook_search_api_solr_query_alter
How to use this to query alter this exposed filter on boolean field?

Drupal 9 view solr search make boolean filter FALSE accept null

Drupal 9
Have content type Article.
Content type Article has a field, called “Need Further Review”, of boolean type.
This field is not required, default value FALSE.
The articles has value TRUE, FALSE, NULL for this field.
TRUE: select true
FALSE: select false
NULL: the previous articles still have no value for this field.

Have a view to list articles.
It uses SOLR search.

A filter criteria is this field “Need Further Review”, and is exposed.
It has options: Any, TRUE, FALSE.
When users select TRUE, it will list articles with TRUE value of this field.
When users select FALSE, it usually lists articles with FALSE value of this field.

Now I want to list articles with FALSE and NULL value of this field when selecting FALSE.
How to use SOLR search hook_search_api_solr_query_alter to do it?

jetty – Solr Service Running But Curl Request Connection refused

I have installed Solr 8.5.2 on Ubuntu 20.04 & have created some blank cores for testing.
I was able to access Admin UI at
But after I tried to upload a document from my desktop solrexamplefilmsfilms.csv it stopped responding.
I checked from terminal, solr service is active but when I tried
curl -X GET ""
I got following response: curl: (7) Failed to connect to port 8983: Connection refused.

Note I did not make any changes to core schema before uploading. Still after searching all logs, stackoverflow I could not find the reason. Please advise as to how to resolve this issue.
Following is solr.log:

2020-12-26 18:22:47.606 INFO  (main) (   ) o.e.j.u.log Logging initialized @2098ms to org.eclipse.jetty.util.log.Slf4jLog
2020-12-26 18:22:48.045 INFO  (main) (   ) o.e.j.s.Server jetty-9.4.24.v20191120; built: 2019-11-20T21:37:49.771Z; git: 363d5f2df3a8a28de40604320230664b9c793c16; jvm
2020-12-26 18:22:48.080 INFO  (main) (   ) o.e.j.d.p.ScanningAppProvider Deployment monitor (file:///opt/solr-8.5.2/server/contexts/) at interval 0
2020-12-26 18:22:48.758 INFO  (main) (   ) o.e.j.w.StandardDescriptorProcessor NO JSP Support for /solr, did not find org.apache.jasper.servlet.JspServlet
2020-12-26 18:22:48.783 INFO  (main) (   ) o.e.j.s.session DefaultSessionIdManager workerName=node0
2020-12-26 18:22:48.783 INFO  (main) (   ) o.e.j.s.session No SessionScavenger set, using defaults
2020-12-26 18:22:48.791 INFO  (main) (   ) o.e.j.s.session node0 Scavenging every 600000ms
2020-12-26 18:22:48.990 INFO  (main) (   ) o.a.s.s.SolrDispatchFilter Using logger factory org.apache.logging.slf4j.Log4jLoggerFactory
2020-12-26 18:22:48.999 INFO  (main) (   ) o.a.s.s.SolrDispatchFilter  ___      _       Welcome to Apache Solrâ„¢ version 8.5.2
2020-12-26 18:22:49.004 INFO  (main) (   ) o.a.s.s.SolrDispatchFilter / __| ___| |_ _   Starting in standalone mode on port 8983
2020-12-26 18:22:49.004 INFO  (main) (   ) o.a.s.s.SolrDispatchFilter __ / _  | '_|  Install dir: /opt/solr
2020-12-26 18:22:49.005 INFO  (main) (   ) o.a.s.s.SolrDispatchFilter |___/___/_|_|    Start time: 2020-12-26T18:22:49.005242Z
2020-12-26 18:22:49.118 INFO  (main) (   ) o.a.s.c.SolrResourceLoader Using system property solr.solr.home: /var/solr/data
2020-12-26 18:22:49.128 INFO  (main) (   ) o.a.s.c.SolrXmlConfig Loading container configuration from /var/solr/data/solr.xml
2020-12-26 18:22:49.281 INFO  (main) (   ) o.a.s.c.SolrXmlConfig MBean server found: com.sun.jmx.mbeanserver.JmxMBeanServer@33065d67, but no JMX reporters were configured - adding default JMX reporter.
2020-12-26 18:22:50.611 INFO  (main) (   ) o.a.s.h.c.HttpShardHandlerFactory Host whitelist initialized: WhitelistHostChecker (whitelistHosts=null, whitelistHostCheckingEnabled=true)
2020-12-26 18:22:50.981 WARN  (main) (   ) o.e.j.u.s.S.config Trusting all certificates configured for Client@1cb7936c(provider=null,keyStore=null,trustStore=null)
2020-12-26 18:22:50.982 WARN  (main) (   ) o.e.j.u.s.S.config No Client EndPointIdentificationAlgorithm configured for Client@1cb7936c(provider=null,keyStore=null,trustStore=null)
2020-12-26 18:22:51.458 WARN  (main) (   ) o.e.j.u.s.S.config Trusting all certificates configured for Client@35cd68d4(provider=null,keyStore=null,trustStore=null)
2020-12-26 18:22:51.458 WARN  (main) (   ) o.e.j.u.s.S.config No Client EndPointIdentificationAlgorithm configured for Client@35cd68d4(provider=null,keyStore=null,trustStore=null)
2020-12-26 18:22:51.504 WARN  (main) (   ) o.a.s.c.CoreContainer Not all security plugins configured!  authentication=disabled authorization=disabled.  Solr is only as secure as you make it. Consider configuring authentication/authorization before exposing Solr to users internal or external.  See https://s.apache.org/solrsecurity for more info
2020-12-26 18:22:51.890 INFO  (main) (   ) o.a.s.c.TransientSolrCoreCacheDefault Allocating transient cache for 2147483647 transient cores
2020-12-26 18:22:51.893 INFO  (main) (   ) o.a.s.h.a.MetricsHistoryHandler No .system collection, keeping metrics history in memory.
2020-12-26 18:22:52.080 INFO  (main) (   ) o.a.s.m.r.SolrJmxReporter JMX monitoring for 'solr.node' (registry 'solr.node') enabled at server: com.sun.jmx.mbeanserver.JmxMBeanServer@33065d67
2020-12-26 18:22:52.086 INFO  (main) (   ) o.a.s.m.r.SolrJmxReporter JMX monitoring for 'solr.jvm' (registry 'solr.jvm') enabled at server: com.sun.jmx.mbeanserver.JmxMBeanServer@33065d67
2020-12-26 18:22:52.101 INFO  (main) (   ) o.a.s.m.r.SolrJmxReporter JMX monitoring for 'solr.jetty' (registry 'solr.jetty') enabled at server: com.sun.jmx.mbeanserver.JmxMBeanServer@33065d67
2020-12-26 18:22:52.175 INFO  (main) (   ) o.a.s.c.CorePropertiesLocator Found 2 core definitions underneath /var/solr/data
2020-12-26 18:22:52.176 INFO  (main) (   ) o.a.s.c.CorePropertiesLocator Cores are: (mycollection, test_core)
2020-12-26 18:22:52.386 INFO  (coreLoadExecutor-9-thread-2) (   x:test_core) o.a.s.c.SolrConfig Using Lucene MatchVersion: 8.5.2
2020-12-26 18:22:52.389 INFO  (coreLoadExecutor-9-thread-1) (   x:mycollection) o.a.s.c.SolrConfig Using Lucene MatchVersion: 8.5.2
2020-12-26 18:22:52.539 INFO  (main) (   ) o.e.j.s.h.ContextHandler Started o.e.j.w.WebAppContext@7894f09b{/solr,file:///opt/solr-8.5.2/server/solr-webapp/webapp/,AVAILABLE}{/opt/solr-8.5.2/server/solr-webapp/webapp}
2020-12-26 18:22:52.595 INFO  (main) (   ) o.e.j.s.AbstractConnector Started ServerConnector@66fdec9{HTTP/1.1,(http/1.1, h2c)}{}
2020-12-26 18:22:52.595 INFO  (main) (   ) o.e.j.s.Server Started @7094ms
2020-12-26 18:22:52.985 INFO  (coreLoadExecutor-9-thread-1) (   x:mycollection) o.a.s.s.IndexSchema (mycollection) Schema name=default-config
2020-12-26 18:22:52.986 INFO  (coreLoadExecutor-9-thread-2) (   x:test_core) o.a.s.s.IndexSchema (test_core) Schema name=default-config

8 – Apache SOLR index or retrieve the node a file is attached to

I’m building a search engine with Apache SOLR (8.7.0) where PDF files are indexed and searched through, that part is working (with search_api_attachments in case you’re wondering). However, the client wants to show a link to the node where this file was referenced from. This is using plain file fields, no media library. Is there a way to either index the node ID with the file, or get this reference somehow in the view with a relationship or something? Spent a good day on it but couldn’t figure it out, maybe I’m just overlooking it. Or is this something that would require me writing a custom hook to add the field to the index? (it seems like quite a general use case to me though)

search – What is the difference between index all on a node and indexing that takes place after node save for a rendered html node on a solr index?

If a page containing panels is indexed as a rendered item, when indexing all the content of the panels is not included in the index. However if you save the node then the content of the panels is added to the index. What is the difference between the process of index all on a node vs indexing that occurs after node save?

8 – How to upgrade Apache solr

My predecessor set up Apache Solr 4.x with Tomcat years ago for a D7 site. Now, I want to upgrade Apache Solr to the latest version and I read that Apache Solr 8 doesn’t support Tomcat anymore.

I was wondering if someone can point me in the right direction on how to upgrade it? Do I have to kill my entire Apache Solr setup with Tomcat, then install Apache Solr 8?

Thank you!

unable to search SOLR index for pdf content

I setup SOLR in order to index pdf content. I followed this article: https://www.chapterthree.com/blog/indexing-pdfs-for-solr-search
I’m able to index pdf content using SOLR extractor instead of Tika. I can query solr using the SOLR web interface, and a query like ‘tm_X3b_fr_saa_field_media_document:(+”breyer”)^1’ returns appropriate results.
I created a page views, based on SOLR index. I added a full text search in the filter criteria, and added the field holding pdf content to the list of searched fields. If I search for a term that exists in a field other than the pdf content, it works. If I search for a term that only exists in the pdf content, I get no result.
I have no idea why SOLR doesn’t return the results. If I look at the query displayed in the box provided by the search API Solr devel module, I see that the query is formulated this way:
How does SOLR interpret the + sign between the fields ? Normally it should be a blank or “OR”, no? Because if I use this query by substituing + by a blank character it works.
Any idea?

Solr Schema advice in multitenant ecommerce site

I have a multitenant site, whose products are indexed in Solr, so visitors can search by product name, or any other product property.
Now, I would like to filter by product price.

There are two problems:

  1. Not all tentants have the same products on their website.
  2. The product price can differ from one customer to another, as each tenant can change the price of each of the product it uses.

So given a tenantId, I’d like to search for all products that tenant has, which are in a given price range.

I don’t think I can store a Map<CustomerId, Price> for each product and somehow query that, so I’m a bit stuck on how to design the schema. At the moment, I just have, for each product, a multivalued property called customer, so I can just filter by all products of a given tentant.

Any help appreciated, thanks!

d7 search api solr : partial keyword number + letter not working

We use Drupal 7.71 and use “search_api_solr”. Solr version :drupal-4.3-solr-4.x

Problem: we have an existing part of a node title: swf6p175

  • we can search for swf6p175
  • we can search for swf
  • issue: we can NOT search for swf6: : only combination of partial search term with letter + number does not work

This is schema.xml:


views – Search api Solr add fulltext search fields programmatically

I need to change fields in fulltext search fields programmatically.

I try this codes but nothing change:

function MY_MODULE_search_api_solr_query_alter(SolariumQueryInterface $solarium_query, QueryInterface $query) {

    $fields = $query->getFulltextFields();
    $fields() = 'field_competitor_code';


or this:

function MY_MODULE_search_api_solr_query_alter(SolariumQueryInterface $solarium_query, QueryInterface $query) {

    $query->setFulltextFields(('title_1', 'field_competitor_code'));


How can achieve this change?

Thanks in advance.