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 sy...@web.de on 2012/09/12 01:03:28 UTC

solr.StrField with stored="true" useless or bad?

Hi,

I have a StrField to store an URL. The field definition looks like this:
<field name="link" type="string" indexed="true" stored="true" required="true" />

Type "string" is defined as usual:
<fieldType name="string" class="solr.StrField" sortMissingLast="true" />

Then I realized that a StrField doesn't execute any analyzers and stored data verbatim. The data is just a single token.

The purpose of stored="true" is to store the raw string data besides the analyzed/transformed data for displaying purposes. This is fine for an analyzed solr.TextField, but for an StrField both values are the same. So is there any reason to apply stored="true" on a StrField as well?

I ask, because I found a lot of sites and tutorials applying stored="true" on StrFields as well. Do they all to it wrong or am I missing something here?

Re: solr.StrField with stored="true" useless or bad?

Posted by Amit Nithian <an...@gmail.com>.
This is great thanks for this post! I was curious about the same thing
and was wondering why "fl" couldn't return the "indexed"
representation of a field if that field were only indexed but not
stored. My thoughts were return something than nothing but I didn't
pay attention to the fact that getting even the "indexed"
representation of a field given a document is not fast.

Thanks
Amit

On Tue, Sep 11, 2012 at 4:03 PM,  <sy...@web.de> wrote:
> Hi,
>
> I have a StrField to store an URL. The field definition looks like this:
> <field name="link" type="string" indexed="true" stored="true" required="true" />
>
> Type "string" is defined as usual:
> <fieldType name="string" class="solr.StrField" sortMissingLast="true" />
>
> Then I realized that a StrField doesn't execute any analyzers and stored data verbatim. The data is just a single token.
>
> The purpose of stored="true" is to store the raw string data besides the analyzed/transformed data for displaying purposes. This is fine for an analyzed solr.TextField, but for an StrField both values are the same. So is there any reason to apply stored="true" on a StrField as well?
>
> I ask, because I found a lot of sites and tutorials applying stored="true" on StrFields as well. Do they all to it wrong or am I missing something here?

Re: solr.StrField with stored="true" useless or bad?

Posted by Yonik Seeley <yo...@lucidworks.com>.
On Tue, Sep 11, 2012 at 7:03 PM,  <sy...@web.de> wrote:
> The purpose of stored="true" is to store the raw string data besides the analyzed/transformed data for displaying purposes. This is fine for an analyzed solr.TextField, but for an StrField both values are the same. So is there any reason to apply stored="true" on a StrField as well?

You're over-thinking things a bit ;-)

if you want to search on it: index it
If you want to return it in search results: store it
Those are two orthogonal things (even for StrField).

Why?  Indexed means full-text inverted index: words (terms) point to
documents.  It's not easy/fast for a given document to find out what
terms point to it.  Stored fields are all stored together and can be
retrieved together given a document id.  Hence search finds lists of
document ids (via indexed fields), and can then return any of the
stored fields for those document ids.

-Yonik
http://lucidworks.com

Re: solr.StrField with stored="true" useless or bad?

Posted by Ahmet Arslan <io...@yahoo.com>.
> The purpose of stored="true" is to store the raw string data
> besides the analyzed/transformed data for displaying
> purposes. This is fine for an analyzed solr.TextField, but
> for an StrField both values are the same. So is there any
> reason to apply stored="true" on a StrField as well?

If you don't store it, you cannot retrieve it (displaying purposes) via &fl= parameter. You can access indexed values via faceting, terms component etc.