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 Mike Topper <mt...@riseup.net> on 2009/02/19 12:41:55 UTC

indexing entire text but only storing first N characters?

Hello,

In one of the fields in my schema I am sending somewhat large texts.  I
want to be able to index all of it since I want to search on the entire
text, but I only need the first N characters to be returned to me.  Is
there a way to do this with one field or would I just create two fields,
one that is indexed and not stored and one that is stored and not
indexed and only send the first N characters to the stored field?

-Mike

Re: indexing entire text but only storing first N characters?

Posted by revathy arun <re...@gmail.com>.
I have also done this and i used two separate fields like the ones you
mentioned


On 2/19/09, Mike Topper <mt...@riseup.net> wrote:
>
> Hello,
>
> In one of the fields in my schema I am sending somewhat large texts.  I
> want to be able to index all of it since I want to search on the entire
> text, but I only need the first N characters to be returned to me.  Is
> there a way to do this with one field or would I just create two fields,
> one that is indexed and not stored and one that is stored and not
> indexed and only send the first N characters to the stored field?
>
> -Mike
>

Re: indexing entire text but only storing first N characters?

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
Change the 'maxFieldLength' in solrconfig.xml to a large value.

On Thu, Feb 19, 2009 at 5:11 PM, Mike Topper <mt...@riseup.net> wrote:

> Hello,
>
> In one of the fields in my schema I am sending somewhat large texts.  I
> want to be able to index all of it since I want to search on the entire
> text, but I only need the first N characters to be returned to me.  Is
> there a way to do this with one field or would I just create two fields,
> one that is indexed and not stored and one that is stored and not
> indexed and only send the first N characters to the stored field?
>
> -Mike
>



-- 
Regards,
Shalin Shekhar Mangar.

Re: indexing entire text but only storing first N characters?

Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
Mike,

It will come with Solr 1.4, but if you visit SOLR-538, you can get a patch
for Solr 1.3 branch. I'm using the patch with Solr 1.3 on my production
site and works well so far.

https://issues.apache.org/jira/browse/SOLR-538

Note: you should use "maxLength" attribute instead of "maxChars" when
using the patch.

Koji


Mike Topper wrote:
> Cool, we are actually still on 1.2 but were planning on upgrading to 1.3
>
> is this a feature of 1.3 or just on the nightly builds?
>
> -Mike
>
> Koji Sekiguchi wrote:
>   
>> Mike Topper wrote:
>>     
>>> Hello,
>>>
>>> In one of the fields in my schema I am sending somewhat large texts.  I
>>> want to be able to index all of it since I want to search on the entire
>>> text, but I only need the first N characters to be returned to me.  Is
>>> there a way to do this with one field or would I just create two fields,
>>> one that is indexed and not stored and one that is stored and not
>>> indexed and only send the first N characters to the stored field?
>>>
>>> -Mike
>>>
>>>   
>>>       
>> If you are using a nigtly version, you can use maxChars attribute of
>> copyField feature
>> to implement your idea:
>>
>> <copyField source="indexedNotStored" dest="storedNotIndexed"
>> maxChars="2000" />
>>
>> Koji
>>
>>
>>     
>
>
>   


Re: indexing entire text but only storing first N characters?

Posted by Mike Topper <mt...@riseup.net>.
Cool, we are actually still on 1.2 but were planning on upgrading to 1.3

is this a feature of 1.3 or just on the nightly builds?

-Mike

Koji Sekiguchi wrote:
> Mike Topper wrote:
>> Hello,
>>
>> In one of the fields in my schema I am sending somewhat large texts.  I
>> want to be able to index all of it since I want to search on the entire
>> text, but I only need the first N characters to be returned to me.  Is
>> there a way to do this with one field or would I just create two fields,
>> one that is indexed and not stored and one that is stored and not
>> indexed and only send the first N characters to the stored field?
>>
>> -Mike
>>
>>   
>
> If you are using a nigtly version, you can use maxChars attribute of
> copyField feature
> to implement your idea:
>
> <copyField source="indexedNotStored" dest="storedNotIndexed"
> maxChars="2000" />
>
> Koji
>
>


Re: indexing entire text but only storing first N characters?

Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
Mike Topper wrote:
> Hello,
>
> In one of the fields in my schema I am sending somewhat large texts.  I
> want to be able to index all of it since I want to search on the entire
> text, but I only need the first N characters to be returned to me.  Is
> there a way to do this with one field or would I just create two fields,
> one that is indexed and not stored and one that is stored and not
> indexed and only send the first N characters to the stored field?
>
> -Mike
>
>   

If you are using a nigtly version, you can use maxChars attribute of 
copyField feature
to implement your idea:

<copyField source="indexedNotStored" dest="storedNotIndexed" 
maxChars="2000" />

Koji