lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack Krupansky" <>
Subject Re: search for docs where location not present
Date Wed, 05 Jun 2013 22:14:43 GMT
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 class="solr.RegexReplaceProcessorFactory">
    <str name="fieldName">has_location_b</str>
    <str name="pattern">[^\s]+</str>
    <str name="replacement">true</str>
  <processor class="solr.DefaultValueUpdateProcessorFactory">
    <str name="fieldName">has_location_b</str>
    <bool name="value">false</bool>
  <processor class="solr.LogUpdateProcessorFactory" />
  <processor class="solr.RunUpdateProcessorFactory" />

-- Jack Krupansky

-----Original Message----- 
From: kevinlieb
Sent: Wednesday, June 05, 2013 5:43 PM
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:
Sent from the Solr - User mailing list archive at 

View raw message