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 "Turner, Robbin J" <Ro...@boeing.com> on 2010/01/28 00:19:15 UTC

Can Solr be forced to return all field tags for a document even if the field is empty?l

I have a field Title and Summary.  I've currently not set a default value for the Summary in my schema, it's just a text field with indexed=true and stored=true, but not required.  When the data is indexed sometimes the documents don't have a summary so then Solr doesn't index that field.

When a query is sent and we get the results for those documents returned, if they did not have a summary then there is no tagged in the xml for that field.

Is there a way to have the xml always return the field tags for each document in the result set even if the field has no data?

I apologize ahead of time if this has been answered, but after doing a bit of search have not been able to find the answer elsewhere.

Thanks
Robbin



Re: Can Solr be forced to return all field tags for a document even if the field is empty?l

Posted by Andrzej Bialecki <ab...@getopt.org>.
On 2010-01-28 03:21, Erick Erickson wrote:
> This is kind of an unusual request, what higher-level
> problem are you trying to solve here? Because the
> field just *isn't there* in the underlying Lucene index
> for that document.
>
> I suppose you could index a "not there" token and just
> throw those values out from the response...

You can also implement a SearchComponent that post-processes results and 
based on the schema if a field is missing then it adds an empty node to 
the result.


-- 
Best regards,
Andrzej Bialecki     <><
  ___. ___ ___ ___ _ _   __________________________________
[__ || __|__/|__||\/|  Information Retrieval, Semantic Web
___|||__||  \|  ||  |  Embedded Unix, System Integration
http://www.sigram.com  Contact: info at sigram dot com


Re: Can Solr be forced to return all field tags for a document even if the field is empty?l

Posted by Erik Hatcher <er...@gmail.com>.
You can use the Luke request handler to request all the fields in the  
index, in case that helps with your UI.  Solr's Schema Browser uses  
that request handler to introspect.  And Solr Flare also uses it to  
figure out which fields to show as facets.

	Erik

On Jan 28, 2010, at 10:08 AM, Turner, Robbin J wrote:

> We've been building a UI which displays the results in a tabular  
> formate, so each of the fields that are available for search are  
> presented to the user.  We still discussing where it's best to sort  
> this out in our overall system design, such as the UI or application  
> layer.  Given our current thought is to do it at the UI level, check  
> if the tag is returned or not, I still wanted to check if it's at  
> all possible to make Solr return empty field tags.
>
> We have several data sets within our index that we've fitted into  
> our schema, so that even though the field is indexed and stored,  
> documes may not have data for that field and may be empty when  
> indexed.
>
> So hence my query to the group.
>
> Robbin
>
> -----Original Message-----
> From: Erick Erickson [mailto:erickerickson@gmail.com]
> Sent: Wednesday, January 27, 2010 9:21 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Can Solr be forced to return all field tags for a  
> document even if the field is empty?l
>
> This is kind of an unusual request, what higher-level problem are  
> you trying to solve here? Because the field just *isn't there* in  
> the underlying Lucene index for that document.
>
> I suppose you could index a "not there" token and just throw those  
> values out from the response...
>
> Erick
>
> On Wed, Jan 27, 2010 at 6:19 PM, Turner, Robbin J < Robbin.J.Turner@boeing.com 
> > wrote:
>
>> I have a field Title and Summary.  I've currently not set a default
>> value for the Summary in my schema, it's just a text field with
>> indexed=true and stored=true, but not required.  When the data is
>> indexed sometimes the documents don't have a summary so then Solr  
>> doesn't index that field.
>>
>> When a query is sent and we get the results for those documents
>> returned, if they did not have a summary then there is no tagged in
>> the xml for that field.
>>
>> Is there a way to have the xml always return the field tags for each
>> document in the result set even if the field has no data?
>>
>> I apologize ahead of time if this has been answered, but after  
>> doing a
>> bit of search have not been able to find the answer elsewhere.
>>
>> Thanks
>> Robbin
>>
>>
>>


Re: Can Solr be forced to return all field tags for a document even if the field is empty?l

Posted by Erick Erickson <er...@gmail.com>.
OK, that makes sense. I'd deal with this on the UI side personally.
My reasoning is that it's poor design to make you search server
jump through hoops because you want to write client-side code
that can ignore edge cases. The UI changes and now you have
to go back to the search code to accommodate that change.

Change, repeat.

FWIW
Erick

On Thu, Jan 28, 2010 at 10:08 AM, Turner, Robbin J <
Robbin.J.Turner@boeing.com> wrote:

> We've been building a UI which displays the results in a tabular formate,
> so each of the fields that are available for search are presented to the
> user.  We still discussing where it's best to sort this out in our overall
> system design, such as the UI or application layer.  Given our current
> thought is to do it at the UI level, check if the tag is returned or not, I
> still wanted to check if it's at all possible to make Solr return empty
> field tags.
>
> We have several data sets within our index that we've fitted into our
> schema, so that even though the field is indexed and stored, documes may not
> have data for that field and may be empty when indexed.
>
> So hence my query to the group.
>
> Robbin
>
> -----Original Message-----
> From: Erick Erickson [mailto:erickerickson@gmail.com]
> Sent: Wednesday, January 27, 2010 9:21 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Can Solr be forced to return all field tags for a document
> even if the field is empty?l
>
> This is kind of an unusual request, what higher-level problem are you
> trying to solve here? Because the field just *isn't there* in the underlying
> Lucene index for that document.
>
> I suppose you could index a "not there" token and just throw those values
> out from the response...
>
> Erick
>
> On Wed, Jan 27, 2010 at 6:19 PM, Turner, Robbin J <
> Robbin.J.Turner@boeing.com> wrote:
>
> > I have a field Title and Summary.  I've currently not set a default
> > value for the Summary in my schema, it's just a text field with
> > indexed=true and stored=true, but not required.  When the data is
> > indexed sometimes the documents don't have a summary so then Solr doesn't
> index that field.
> >
> > When a query is sent and we get the results for those documents
> > returned, if they did not have a summary then there is no tagged in
> > the xml for that field.
> >
> > Is there a way to have the xml always return the field tags for each
> > document in the result set even if the field has no data?
> >
> > I apologize ahead of time if this has been answered, but after doing a
> > bit of search have not been able to find the answer elsewhere.
> >
> > Thanks
> > Robbin
> >
> >
> >
>

RE: Can Solr be forced to return all field tags for a document even if the field is empty?l

Posted by "Turner, Robbin J" <Ro...@boeing.com>.
We've been building a UI which displays the results in a tabular formate, so each of the fields that are available for search are presented to the user.  We still discussing where it's best to sort this out in our overall system design, such as the UI or application layer.  Given our current thought is to do it at the UI level, check if the tag is returned or not, I still wanted to check if it's at all possible to make Solr return empty field tags.

We have several data sets within our index that we've fitted into our schema, so that even though the field is indexed and stored, documes may not have data for that field and may be empty when indexed.

So hence my query to the group.

Robbin

-----Original Message-----
From: Erick Erickson [mailto:erickerickson@gmail.com] 
Sent: Wednesday, January 27, 2010 9:21 PM
To: solr-user@lucene.apache.org
Subject: Re: Can Solr be forced to return all field tags for a document even if the field is empty?l

This is kind of an unusual request, what higher-level problem are you trying to solve here? Because the field just *isn't there* in the underlying Lucene index for that document.

I suppose you could index a "not there" token and just throw those values out from the response...

Erick

On Wed, Jan 27, 2010 at 6:19 PM, Turner, Robbin J < Robbin.J.Turner@boeing.com> wrote:

> I have a field Title and Summary.  I've currently not set a default 
> value for the Summary in my schema, it's just a text field with 
> indexed=true and stored=true, but not required.  When the data is 
> indexed sometimes the documents don't have a summary so then Solr doesn't index that field.
>
> When a query is sent and we get the results for those documents 
> returned, if they did not have a summary then there is no tagged in 
> the xml for that field.
>
> Is there a way to have the xml always return the field tags for each 
> document in the result set even if the field has no data?
>
> I apologize ahead of time if this has been answered, but after doing a 
> bit of search have not been able to find the answer elsewhere.
>
> Thanks
> Robbin
>
>
>

Re: Can Solr be forced to return all field tags for a document even if the field is empty?l

Posted by Erick Erickson <er...@gmail.com>.
This is kind of an unusual request, what higher-level
problem are you trying to solve here? Because the
field just *isn't there* in the underlying Lucene index
for that document.

I suppose you could index a "not there" token and just
throw those values out from the response...

Erick

On Wed, Jan 27, 2010 at 6:19 PM, Turner, Robbin J <
Robbin.J.Turner@boeing.com> wrote:

> I have a field Title and Summary.  I've currently not set a default value
> for the Summary in my schema, it's just a text field with indexed=true and
> stored=true, but not required.  When the data is indexed sometimes the
> documents don't have a summary so then Solr doesn't index that field.
>
> When a query is sent and we get the results for those documents returned,
> if they did not have a summary then there is no tagged in the xml for that
> field.
>
> Is there a way to have the xml always return the field tags for each
> document in the result set even if the field has no data?
>
> I apologize ahead of time if this has been answered, but after doing a bit
> of search have not been able to find the answer elsewhere.
>
> Thanks
> Robbin
>
>
>