Lijo Abraham
Lijo Abraham

Reputation: 881

How to remove dynamic field suffix like _i,_txt in solr while quering?

I am indexing data in solr with using dynamic field (Schemaless Feature). Like I have some fields like product_txt,id_i,category_txt etc..

I want the above mentioned fields to be product,id,category in response while selecting from solr. Like want to remove the suffix _txt, _i from fields while returning from solr.

Is this possible in SOLR itself?. If yes,Please help.

Upvotes: 1

Views: 278

Answers (2)

MatsLindh
MatsLindh

Reputation: 52892

You can use field aliasing, but it requires you to list the alias for each field in the fl parameter:

product_txt:product,id_i:id,category_txt:category

Upvotes: 2

Abhijit Bashetti
Abhijit Bashetti

Reputation: 8668

I think anything cannot be done at solr end for this ..

You have to manually add some code at client side to remove the extra thing i.e suffix in your case.

like at java end you can use

String responseString = "product_txt";

String result = responseString.substring(0, responseString.lastIndexOf("_")) ;

Upvotes: 0

Related Questions