Closed eklem closed 4 years ago
*abvacidaromabitternesscodecolorcontainerSizecontainerTypecorkdescriptiondistrictfreshnessfullnessidimagemainCountrynamepricepricePerLiterproductSelectionproductTyperawMaterialstorablesugarsummarysweetnesstanninstastevintage
Yes, it would probably be better if you could ask for an array. I'll look into it...
Doesn't need to be an array, but now it's just one long string without anything to split up on =)
Have you tried doing it like this? https://github.com/fergiemcdowall/norch/blob/master/test/test.js#L72-L85
Either way- I think an array is a bit more accessible to people
Strange, this is the response I get from norch:
Anyway =)
Yes- this is a bit tricky because responses are streams. (I think) it is streaming the fieldnames and showing you the end result. An array would be easier
But, when thinking about it, I think you should keep it as a streaming interface but just wrap it as objects where the value is the string/field-name. One reason is that I now have two response processors. One for stream of objects and one for objects. Keeping it like that makes it clean.
Something like:
{"fieldname":"*"}
{"fieldname":"abv"}
{"fieldname":"acid"}
{"fieldname":"aroma"}
{"fieldname":"bitterness"}
{"fieldname":"code"}
{"fieldname":"color"}
{"fieldname":"containerSize"}
{"fieldname":"containerType"}
{"fieldname":"cork"}
{"fieldname":"description"}
{"fieldname":"district"}
{"fieldname":"freshness"}
{"fieldname":"fullness"}
{"fieldname":"id"}
{"fieldname":"image"}
{"fieldname":"mainCountry"}
...
Yes- that makes sense
I'll look into fixing this in search-index-searcher
@fergiemcdowall I manage to re-write the output to be key/value as suggested above, but how do I get to define Content-Type = application/JSON?
To ask in a different way. How do you get the other endpoints like /search
i.e. to return Content-Type = application/JSON?
Was thinking I should get a stream of objects back, but I get all the fields as one string. Is that correct?
http://test.klemespen.com:3030/availableFields
Indexed with latest search-index and latest norch server running.