You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Khai Doan <kh...@gmail.com> on 2010/10/01 21:44:18 UTC

How to tell Solr to return all fields including empty fields?

Hello everyone,

Right now, I am using fl=*,score to get all fields from Solr.  However empty
fields are not returned.  Is there a way for me to tell Solr to return all
fields including empty fields?

Thanks,
Khai

Re: How to tell Solr to return all fields including empty fields?

Posted by Dennis Gearon <ge...@sbcglobal.net>.
One would think that a JSON output handler in Solr/Lucene would create a:

"fieldname": null

for missing fields. Is it possible to set that as a parameter to a json-requested output?

In PHP, NULL and missing are ALMOST the exact same thing. In databases, they actually are, in my limited experience.



Dennis Gearon

Signature Warning
----------------
EARTH has a Right To Life,
  otherwise we all die.

Read 'Hot, Flat, and Crowded'
Laugh at http://www.yert.com/film.php


--- On Sat, 10/2/10, Khai Doan <kh...@gmail.com> wrote:

> From: Khai Doan <kh...@gmail.com>
> Subject: Re: How to tell Solr to return all fields including empty fields?
> To: solr-user@lucene.apache.org
> Date: Saturday, October 2, 2010, 10:36 PM
> Thanks for replying.  I need to
> have the empty fields because if the field
> is not there, the Java library (
> http://www.json.org/javadoc/org/json/JSONObject.html)
> that I use to parse
> the result will throw an exception.  Quite
> inconvenient.
> 
> Thanks,
> Khai
> 
> On Fri, Oct 1, 2010 at 6:45 PM, Erick Erickson <er...@gmail.com>wrote:
> 
> > Nope. If a field is empty, it's just not in the
> document. You could index
> > an empty value (some unique value for empty) if you
> really need this.
> >
> > But a more interesting question is why you need this.
> What is it about
> > returning an empty field that's important? Couldn't
> you detect this through
> > the absence of the field?
> >
> > Best
> > Erick
> >
> > On Fri, Oct 1, 2010 at 3:44 PM, Khai Doan <kh...@gmail.com>
> wrote:
> >
> > > Hello everyone,
> > >
> > > Right now, I am using fl=*,score to get all
> fields from Solr.  However
> > > empty
> > > fields are not returned.  Is there a way for
> me to tell Solr to return
> > all
> > > fields including empty fields?
> > >
> > > Thanks,
> > > Khai
> > >
> >
> 

Re: How to tell Solr to return all fields including empty fields?

Posted by Khai Doan <kh...@gmail.com>.
Thanks for replying.  I need to have the empty fields because if the field
is not there, the Java library (
http://www.json.org/javadoc/org/json/JSONObject.html) that I use to parse
the result will throw an exception.  Quite inconvenient.

Thanks,
Khai

On Fri, Oct 1, 2010 at 6:45 PM, Erick Erickson <er...@gmail.com>wrote:

> Nope. If a field is empty, it's just not in the document. You could index
> an empty value (some unique value for empty) if you really need this.
>
> But a more interesting question is why you need this. What is it about
> returning an empty field that's important? Couldn't you detect this through
> the absence of the field?
>
> Best
> Erick
>
> On Fri, Oct 1, 2010 at 3:44 PM, Khai Doan <kh...@gmail.com> wrote:
>
> > Hello everyone,
> >
> > Right now, I am using fl=*,score to get all fields from Solr.  However
> > empty
> > fields are not returned.  Is there a way for me to tell Solr to return
> all
> > fields including empty fields?
> >
> > Thanks,
> > Khai
> >
>

Re: How to tell Solr to return all fields including empty fields?

Posted by Erick Erickson <er...@gmail.com>.
Nope. If a field is empty, it's just not in the document. You could index
an empty value (some unique value for empty) if you really need this.

But a more interesting question is why you need this. What is it about
returning an empty field that's important? Couldn't you detect this through
the absence of the field?

Best
Erick

On Fri, Oct 1, 2010 at 3:44 PM, Khai Doan <kh...@gmail.com> wrote:

> Hello everyone,
>
> Right now, I am using fl=*,score to get all fields from Solr.  However
> empty
> fields are not returned.  Is there a way for me to tell Solr to return all
> fields including empty fields?
>
> Thanks,
> Khai
>