I cannot get how to query my index for all the documents not having the optional field named "adm4".
Any suggestion?
I cannot get how to query my index for all the documents not having the optional field named "adm4".
Any suggestion?
Kludgy: Make sure the adm4
field is indexed and give it a default value in your schema.xml file. Then querying for that default value will return all documents that didn't get a "real" value for adm4
at index time. For example, if adm4
is an integer and 0 is not a meaningful value...
<field name="adm4" type="int" default="0" indexed="true" stored="true"/>
Much Better: Add -adm4:[* TO *]
to your query per SolrQuerySyntax docs. I found this after my first answer, but I'm editing rather than replacing or your comment wouldn't make sense. :)
EDIT: After more testing (Solr 4.3), it seems the range is unneeded and -adm4:*
yields the same result.