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 javozzo <da...@gmail.com> on 2013/10/21 20:57:58 UTC

How to extract a field with a prefixed dimension?

Hi,
i'm new in solr.
i use the content field to extract the text of solr documents, but this
field is too long. 
Is there a way to extract only a substring of this field?
i make my query in java as follow:

SolrQuery querySolr = new SolrQuery();
querySolr.setQuery("*:*");
querySolr.setRows(3);
querySolr.setParam("wt", "json");
querySolr.addField("content");
querySolr.addField("title");
querySolr.addField("url");

any ideas?
Thanks
Danilo



--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-extract-a-field-with-a-prefixed-dimension-tp4096877.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to extract a field with a prefixed dimension?

Posted by javozzo <da...@gmail.com>.
Hi Upayavira,
this is an example of what i do.
i have in content field this string 
       "This is a text content in this document"
and i would to extract this
      "This is a text"
How can i do this?
Thanks
Danilo




--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-extract-a-field-with-a-prefixed-dimension-tp4096877p4096961.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to extract a field with a prefixed dimension?

Posted by Upayavira <uv...@odoko.co.uk>.
Not too sure what you're asking. Are you saying that you want to only
return a relevant part of a field in search results - i.e. a contextual
snippet?

If so, then you should look at the highlighting component, which can do
this.

http://wiki.apache.org/solr/HighlightingParameters

Upayavira

On Mon, Oct 21, 2013, at 07:57 PM, javozzo wrote:
> Hi,
> i'm new in solr.
> i use the content field to extract the text of solr documents, but this
> field is too long. 
> Is there a way to extract only a substring of this field?
> i make my query in java as follow:
> 
> SolrQuery querySolr = new SolrQuery();
> querySolr.setQuery("*:*");
> querySolr.setRows(3);
> querySolr.setParam("wt", "json");
> querySolr.addField("content");
> querySolr.addField("title");
> querySolr.addField("url");
> 
> any ideas?
> Thanks
> Danilo
> 
> 
> 
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/How-to-extract-a-field-with-a-prefixed-dimension-tp4096877.html
> Sent from the Solr - User mailing list archive at Nabble.com.