Either have your update client explicitly set a boolean field that indicates whether location is present, or use an update processor to set an explicit boolean field that means no location present:

<updateRequestProcessorChain name="location-present">
 <processor class="solr.CloneFieldUpdateProcessorFactory">
   <str name="source">location_field</str>
   <str name="dest">has_location_b</str>
 </processor>
 <processor class="solr.RegexReplaceProcessorFactory">
   <str name="fieldName">has_location_b</str>
   <str name="pattern">[^\s]+</str>
   <str name="replacement">true</str>
 </processor>
 <processor class="solr.DefaultValueUpdateProcessorFactory">
   <str name="fieldName">has_location_b</str>
   <bool name="value">false</bool>
 </processor>
 <processor class="solr.LogUpdateProcessorFactory" />
 <processor class="solr.RunUpdateProcessorFactory" />
</updateRequestProcessorChain>

-- Jack Krupansky

-----Original Message----- From: kevinlieb
Sent: Wednesday, June 05, 2013 5:43 PM
To: solr-user@lucene.apache.org
Subject: search for docs where location not present

I have a location-type field in my schema where I store lat / lon of a
document when this data is available.  In around half of my documents this
info is not available and I just don't store anything.

I am trying to find the documents where the location is not set but nothing
is working.
I tried q=location_field:* and get back no results
I tried q=-location_field:[* TO *] but got back an error
I even tried something like:
q=*:*&fq={!geofilt sfield=location_field}&pt=34.02093,-118.210755&d=25000
(distance set to a very large number)
but it returned fields even if they had no location_field set.

Can anyone think of a way to do this?

Thanks in advance!




--
View this message in context: http://lucene.472066.n3.nabble.com/search-for-docs-where-location-not-present-tp4068444.html Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to