Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I find empty Solr document fields with lucene query

Tags:

solr

lucene

i have some documents like this:

<doc>
  <str name="navTitle"/>
  <str name="title">Word 1</str>
</doc>
<doc>
  <str name="navTitle">Word 2</str>
  <str name="title">Word 3</str>
</doc>

and i will find all documents with an emtpy "navTitle" field! How is the lucene query for this?

I trying " navTitle:'' " and I trying " navTitle:' ' ", but the Solr Admin Panal find nothing. Whats wrong at the query?

like image 787
Mario Naether Avatar asked Dec 13 '22 00:12

Mario Naether


1 Answers

In the SolrQuerySytax page they says that you can use the following query to find all empty queries.

-field:[* TO *] finds all documents without a value for field
like image 110
Parvin Gasimzade Avatar answered Feb 11 '23 08:02

Parvin Gasimzade