Errors

Opensolr Errors — find answers to your questions

Slow Solr Queries Debugging

Understanding and Fixing Slow Drupal Solr Queries

Your Drupal site is slow when searching. You check the Solr debug output and discover that the query itself runs in 200-300ms — but faceting takes 1,500-2,000ms or more. The bottleneck is not Solr's search — it is all the extra work Drupal asks Solr to do.

WHERE THE TIME GOES IN A DRUPAL SOLR QUERYQuery: 278ms (fast)Faceting: 1,704ms (SLOW — 86% of total time)Other: 18msThe query is fine. The facets are the bottleneck.


Why Drupal Queries Are Slow

1. The *:* Query Pattern

Drupal often sends {!boost b=boost_document} *:* — meaning "match every single document." Even with filter queries narrowing results, Solr still has to evaluate the entire index first.

2. Too Many Facets

Drupal's Facet API requests facet counts for every active facet field. Each facet must count every term across every matching document. With 10+ facets and facet.limit=-1 (return all values), this is the main performance killer.

3. FCS Method (Slow)

Solr's default FieldCache Scanning (FCS) method scans the entire field value space. Modern alternatives like JSON facets or streaming facets are much faster.

4. Excessive Filters

Dozens of fq parameters — especially negations like (*:* -field:value) and range queries — each add cost.


Fixes in Drupal

A. Reduce Active Facets

Go to Configuration > Search API > View Modes and disable facets that are not visible on the page. Every active facet triggers Solr work, even if Drupal does not render it.

B. Limit Facet Results

In Facet API settings, change facet.limit from -1 (return everything) to a reasonable number:

facet.limit = 50
facet.mincount = 1

C. Use the JSON Facet API

If your Solr version is 7.x or newer, switch Drupal's Search API backend to use the JSON Facet API. It is faster, parallelized, and supports streaming facet counts.

D. Enable Caching

Enable Drupal's Search API query cache and facet cache to avoid recomputing identical facets for repeated queries.


Fixes in Solr

A. Enable DocValues on Facet Fields

Ensure all fields used for faceting have docValues="true" in your schema:

<field name="field_category" type="string" stored="true"
       indexed="true" docValues="true"/>

DocValues make faceting dramatically faster.

B. Use facet.threads

Parallelize facet computation:

facet.threads=4

C. Enable Filter Cache

In solrconfig.xml, ensure you have a properly sized filter cache:

<filterCache class="solr.FastLRUCache" size="512"
             initialSize="512" autowarmCount="128"/>

D. Switch to JSON Facets

Replace classic facet.field parameters with JSON facets:

json.facet={
  categories: { type: "terms", field: "field_category", limit: 50 },
  formats: { type: "terms", field: "field_format", limit: 50 }
}

Optimization Checklist

Area Action Typical Gain
Reduce facet count Disable unused facets in Drupal 60-80% faster
Set facet.limit Change from -1 to 50 Major
Enable DocValues Add docValues="true" to facet fields Major
Use JSON facets Modern Solr API 2-5x faster
Enable caching Drupal + Solr caches Significant
facet.threads=4 Parallelize computation 20-40% faster
Remove facet.missing Unless needed by UX 5-15% faster

Before vs After

Before (slow):

q={!boost b=boost_document} *:*&facet.limit=-1&facet.field=field_a&facet.field=field_b...

After (fast):

q=*:*&fq=available:true&facet.limit=50&facet.threads=4&
json.facet={
  categories:{type:terms,field:field_category,limit:50},
  formats:{type:terms,field:field_format,limit:50}
}
Read Full Answer

Drupal - Can not get additional data from Solr timeout after...

Complete Drupal Setup Guide

New to Drupal + Opensolr? Start here.

Our comprehensive guide covers all 3 integration options (Opensolr Search module, Search API Opensolr, Search API Solr manual setup), credential configuration, the Security tab pitfalls, and everything you need for a working Drupal integration.

The Problem

Your Drupal site shows this warning:

Solr was unable to retrieve additional data about the server.

And in your logs you see cURL error 28 — a timeout while Drupal tries to reach /admin/luke on your Solr server.


What Is Actually Happening

Drupal's search_api_solr module periodically calls Solr's /admin/luke endpoint to discover what fields exist in the index, check capabilities, and verify the server is healthy. The Luke handler is like asking Solr to give you a complete X-ray of the entire index — every field, every term count, everything.

On large indexes, this response can be megabytes of data and take several seconds to generate. If it takes longer than Drupal's PHP timeout, the request fails.

WHY /admin/luke CAUSES TIMEOUTSDrupalasks /admin/lukeLuke HandlerScans ENTIRE index...fields, terms, stats...10+ secondstoo slow!TIMEOUTcURL error 28The Fix: Replace Luke with a fast Ping handlerDrupalasks /admin/lukePing HandlerJust says "I am OK!"200 OKinstant!


The Fix

Replace Solr's heavy Luke handler with a lightweight Ping handler at the same URL. Drupal only needs a "yes, I am alive" response — it does not actually need the full Luke data dump.

Add this to your solrconfig.xml:

<requestHandler name="/admin/luke" class="solr.PingRequestHandler">
  <lst name="defaults">
    <str name="q">*:*</str>
  </lst>
</requestHandler>

Step-by-Step for Opensolr Users

  1. Log in to your Opensolr Dashboard
  2. Open your Index Settings for the affected Opensolr Index
  3. Go to Config Files Editor and edit solrconfig.xml
  4. Find any existing /admin/luke request handler block and replace it with the snippet above
  5. Save your changes — Opensolr reloads the config automatically

Verify It Works

curl -sS -u user:pass -w '%{http_code}
' \
  "https://your-cluster.opensolr.com/solr/your_core/admin/luke?wt=json"

You should get an instant 200 response with a small JSON payload.


Alternative: Skip Schema Check in Drupal

If you cannot modify Solr configs, you can tell Drupal to stop calling Luke entirely:

// settings.php
$settings['search_api_solr']['skip_schema_check'] = TRUE;
$settings['search_api_solr']['timeout'] = 3;
$settings['search_api_solr']['connect_timeout'] = 1;

This disables schema introspection. Search and indexing continue to work normally.


Trade-offs

Approach Pros Cons
Replace Luke with Ping (recommended) Instant response, Drupal is happy Luke introspection disabled at that URL
Skip schema check in Drupal No Solr config changes needed Drupal cannot detect schema mismatches
Increase PHP timeout No changes to Solr or Drupal Still slow, just delays the problem

Quick Checklist

  • Replace /admin/luke handler with PingRequestHandler in solrconfig.xml
  • Save and let Opensolr reload the config
  • Verify with a quick cURL call that /admin/luke responds instantly
  • Optionally clear Drupal caches with drush cr
  • If you cannot edit Solr configs, use skip_schema_check in Drupal settings.php
Read Full Answer

Cannot change field from DOCS_AND_FREQS_AND_POSITIONS DOCS_A...

The Error

You reload your Opensolr Index or try to index documents and Solr throws:

cannot change field "field_name" from index options=DOCS_AND_FREQS_AND_POSITIONS
to inconsistent index options=DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS

This means the field was originally indexed with one set of "index options," and now your schema (or application) is trying to use a different set. Solr will not allow mixing two different formats in the same index.


What Are Index Options? (The Simple Version)

When Solr indexes a word in a field, it can store different levels of detail about that word:

LEVELS OF DETAIL IN INDEX OPTIONSDOCS"Which documentscontain this word?"+ FREQS"How many timesdoes it appear?"+ POSITIONS"Where in the textis each occurrence?"+ OFFSETS"Exact characterstart and end?"Basic searchRelevancy scoringPhrase queriesFast highlightingOld documents: POSITIONS New documents: POSITIONS + OFFSETSSolr cannot mix these two formats in the same index segmentThe fix: make the field definition consistent and re-index everything.


Why This Happens

Schema Change Without Re-indexing

You (or a module like Drupal Search API) changed the field definition — for example, adding storeOffsetsWithPositions="true" for faster highlighting. The new definition requires OFFSETS, but old documents were indexed without them. Solr cannot mix both.

Drupal Search API Solr

This is especially common with Drupal. The Search API Solr module may set storeOffsetsWithPositions="true" on certain fields automatically when you enable highlighting features. The module generates the schema, and if the generated schema differs from what was previously indexed, you get this error.


How to Fix It

Step 1: Decide Which Index Options You Want

  • DOCS_AND_FREQS_AND_POSITIONS — standard, good for most use cases
  • DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS — needed for fast highlighting (term vectors with offsets)

Step 2: Update Your Schema

Make the field definition consistent. If you want offsets for highlighting:

<field name="your_field" type="text_general" indexed="true"
       stored="true" storeOffsetsWithPositions="true"/>

If you do not need offsets, make sure storeOffsetsWithPositions is false or absent.

Step 3: Reset and Re-Index

After changing the schema, you must clear and rebuild the entire index:

  1. Reset your index from the Opensolr control panel (remove all data)
  2. Reload the Opensolr Index
  3. Re-index all documents from your application

There is no shortcut — old documents with the old format must be replaced.


Quick Reference

Step Action
1. Check field definition Look for storeOffsetsWithPositions in schema
2. Make it consistent Either add or remove offsets — pick one
3. Reload schema Click Reload in Opensolr control panel
4. Wipe the index Reset/delete all indexed documents
5. Re-index Rebuild from your application or CMS
6. Check Drupal settings If using Drupal, verify Search API module options match

Quick Checklist

  • Check your schema for storeOffsetsWithPositions on the affected field
  • Make the field definition consistent — old and new must match
  • Reset your index and re-index all data after the schema change
  • If using Drupal, check the Search API Solr module highlighting settings
  • Always reload the Opensolr Index after schema changes
Read Full Answer

Loading more articles...