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 Veselin K <ve...@campbell-lange.net> on 2009/04/06 10:22:39 UTC

How could I limit a specific field size ?

Hello,

I'm trying to tune my Solr installation, specifically the search
results.

At present, my search queries return some standard fields like filename,
filepath and text of the matching file.

However the text field contains the full contents of the file, which is
not very efficient in my case.

I'd like to copy the "text" field to a field called "preview" and
then limit the "preview" field to just a few lines of text (or number of
terms). 

Then I could configure retrieving the "preview" field instead of "text"
upon search.

Is there a way to specify such size limits per field or something similar?


Thank you much.

Regards,
Veselin K

Re: How could I limit a specific field size ?

Posted by Veselin Kantsev <ve...@campbell-lange.net>.
Thank you very much Shalin.


Regards,
Veselin K

On Mon, Apr 06, 2009 at 02:19:05PM +0530, Shalin Shekhar Mangar wrote:
> On Mon, Apr 6, 2009 at 1:52 PM, Veselin K <ve...@campbell-lange.net>wrote:
> 
> >
> > I'd like to copy the "text" field to a field called "preview" and
> > then limit the "preview" field to just a few lines of text (or number of
> > terms).
> >
> > Then I could configure retrieving the "preview" field instead of "text"
> > upon search.
> >
> > Is there a way to specify such size limits per field or something similar?
> >
> >
> Yes, there is a maxLength attribute for a copyField which you can use:
> 
> <copyField source="text" dest="highlight" maxLength="30000" />
> 
> -- 
> Regards,
> Shalin Shekhar Mangar.

Re: How could I limit a specific field size ?

Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
Shalin Shekhar Mangar wrote:
> On Mon, Apr 6, 2009 at 1:52 PM, Veselin K <ve...@campbell-lange.net>wrote:
>
>   
>> I'd like to copy the "text" field to a field called "preview" and
>> then limit the "preview" field to just a few lines of text (or number of
>> terms).
>>
>> Then I could configure retrieving the "preview" field instead of "text"
>> upon search.
>>
>> Is there a way to specify such size limits per field or something similar?
>>
>>
>>     
> Yes, there is a maxLength attribute for a copyField which you can use:
>
> <copyField source="text" dest="highlight" maxLength="30000" />
>
>   
Correction. Use maxChars, not maxLength.

Koji



Re: How could I limit a specific field size ?

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Mon, Apr 6, 2009 at 1:52 PM, Veselin K <ve...@campbell-lange.net>wrote:

>
> I'd like to copy the "text" field to a field called "preview" and
> then limit the "preview" field to just a few lines of text (or number of
> terms).
>
> Then I could configure retrieving the "preview" field instead of "text"
> upon search.
>
> Is there a way to specify such size limits per field or something similar?
>
>
Yes, there is a maxLength attribute for a copyField which you can use:

<copyField source="text" dest="highlight" maxLength="30000" />

-- 
Regards,
Shalin Shekhar Mangar.