Can not query all data in Solr

Errors

The Problem

You have indexed documents into your Opensolr Index, but when you query with q=*:* you do not get all your data back, or you get unexpected results. Some documents seem to be missing.


What Is Actually Happening

The most common cause is a default /select request handler defined in a file called search.xml that ships with new Opensolr Indexes. This request handler may include default filter queries, row limits, or field lists that do not match your data.

Think of it like ordering food at a restaurant, but the waiter already has a pre-set order for you. You say "bring me everything" but the pre-set order says "only salads, maximum 10 items." You need to remove that pre-set order so you get what you actually asked for.

HOW search.xml OVERRIDES YOUR QUERIESYour Queryq=*:*search.xmlDefault /select handlerAdds hidden defaults!Wrong ResultsFiltered / limitedAfter removing the unwanted filters:Your Queryq=*:*No hidden filters leftAll ResultsComplete data


How to Fix It

Step 1: Open search.xml

Open your Opensolr Index in the Control Panel → Configuration → select search.xml. Your solrconfig.xml pulls it in through the &search; line near its end.

Step 2: Look at the /select Handler

The appends list adds its filters to every query, whatever your application sends:

<lst name="appends">
    <str name="fq">-uri_s:*/section/*</str>
    <str name="fq">-uri_s:*/category/*</str>
</lst>

The defaults list sets values your query can override, such as df.

Step 3: Remove What You Do Not Want

Delete the fq lines that hide documents you need, then save. Saving reloads the index, and the next query returns everything that matches. Keep the &search; line in solrconfig.xml: search.xml is also where the /select handler, the spellchecker and the /autocomplete handler are defined.


Other Common Reasons for Missing Data

Problem Fix
rows parameter too low Default is 10 rows. Add &rows=100 or higher to your query
Filter queries hiding docs Check for fq parameters in your request handler defaults
Documents not committed Send a commit after indexing: ?commit=true
Wrong core/index Verify you are querying the correct Opensolr Index
start parameter offset Pagination offset might skip documents

Quick Checklist

  • Check the appends list of /select in search.xml and remove the filters you do not want
  • Verify your total document count with q=*:*&rows=0
  • Check for default fq parameters in your /select request handler
  • Make sure you are sending commits after indexing
  • Increase the rows parameter if you need more than 10 results