Keep in mind filters too... they can be much more efficient if used often: ?q=test&fq=field_b:[* TO *]
-Yonik On 6/20/07, Thiago Jackiw <[EMAIL PROTECTED]> wrote:
Hoss, > As an inverted index, the Lucene index Solr uses doesn't know when > documents have an "empty" value ... it stores the inverted mapping of > value=>documents, so there is no way to query for field_b:NULL, let alone > "NOT field_b:bull" I see what you mean. I guess searching for fields that require to have a value like the way you explained is a good way to go. Thanks! -- Thiago Jackiw acts_as_solr => http://acts-as-solr.railsfreaks.com On 6/20/07, Chris Hostetter <[EMAIL PROTECTED]> wrote: > : I'm not sure if this is possible or not, but, is there a way to do a > : search and reject fields that are empty or have null values like the > : pseudo code below? > > As an inverted index, the Lucene index Solr uses doesn't know when > documents have an "empty" value ... it stores the inverted mapping of > value=>documents, so there is no way to query for field_b:NULL, let alone > "NOT field_b:bull" > > you can however query forthings like: field_b:[* TO *] which requres > field_b to have some value (that seems to be the use case you are after) > > as a general rule, if you really want to be abel to support searches for > rhings like "find all docs wher there is no value in field X" the easiest > way to achieve something like that in Solr is to configure the field with > a default value in the schema ... something that would never normally > appear in your data (a placeholder for 'null' so to speak) and query on > that. > > > -Hoss > >