I’m trying to implement a solution for a web app’s using Solr which would receive the search request, send the query to the search server, receive its JSON response and pack this in the response directly as its JSON output. My main point being, the current implementation sends the query to the search server, receives the ids of the resources, instantiates each resource (loading it fully in memory) and then generates a desired JSON structure from each of them. So, I would like to spare this step and make the app a kind of proxy to the search server. I was thinking of using Solr, since it already provides JSON responses.
My only problem now is: there is a difference between the data using to populate the index and facilitate the search, and the data I want to output. In implementations of Solr I’ve seen, the indexed data is the data which gets JSON-output.
My question being: can one define two separate schemas: one of the data to index and another of the data to output? This would be a huge plus, since I’m not fan of the approach of indexing data I will not use to search. And can one say by query which of the “outputable” parameters one wants to output?
Also, I would like to know if one could format the data before output (like, take an integer which represents seconds and format it to a HH:MM format).
You can add indexed=true and stored=true attribute to the field(s) in the schema.xml . Then your field(s) will be indexed and stored, which means that you can get output as you want.