tags:

views:

36

answers:

1

ok guys, say in my Schema I have 4 fields:

<field name="SiteIdentifier" type="string" indexed="true" stored="true" required="true"/>
<field name="Title" type="text" indexed="true" stored="true"/>
<field name="Content" type="text" indexed="true" stored="true"/>
<field name="URL" type="text" indexed="true" stored="true"/>

Is there some kind of built in FieldType in SOLR where I can return only a limited amount of text from one of my fields above.

So, say in my Index the field "Content" has 500 characters in it. I search for the word "subscribe". Say the word "subscribe" appears twice or more in a particular "Content" field.

Now, in this case, I only want to return, no matter what, 100 characters form the content field.

First of all, is this possible and simple, by just using a FieldType I'm not aware of?

if so, can also specify that it returns the 100 characters that contain AT LEAST ONE occurrence of the search term?

cool, thank you!

+3  A: 

I think you're looking for a feature called "hit highlighting", which allows you to highlight text that matches the query.

See the docs and sample1, sample2.

Mauricio Scheffer
thanks dude, I'll check it out and get back to you, cheers!
andy