Dimag Kharab
Dimag Kharab

Reputation: 4519

Remove underscore & Text after keywords from SOLR query response

Currently my response looks like this( using sitecore here)

 {
    "category_t": "Image"
 },

I cannot rename the field in Solr Schema, but I would like to strip the "_" & the text after it so basically my search response will become category: "image" from category_t: "image". Is there any way to achieve this ? Using Analyzer or Tokenenizer or may be response writer .

Upvotes: 0

Views: 220

Answers (1)

Alexandre Rafalovitch
Alexandre Rafalovitch

Reputation: 9789

You can use Field Name Alias to change the name of the field when you return it form a search.

Basically:

 fl=field1,field2,category:category_t

If you need to to this often or cannot change the search request itself easily, you can add the parameter as a default in the request handler (in the solrconfig.xml).

Upvotes: 1

Related Questions