unable to get basic view working in web console
I'm a newbie and I'm trying to figure out how to setup a view for my documents... The whole concept of a map() is pretty strange to me, so I decided to experiment with your beer-sample bucket. I decided to start simple: I just want to create a view that essentially lets me find a beer by name. However, I don't seem to be getting anywhere.
My first attempt at the view looks like this:
function (doc, meta)
{
if(doc.name)
{
emit(doc.name, null);
}
}
I hit "Save" button and then modified the "key" field in the "Filter Results" drop down to = "New Albanian Brewing". I then hit "Show results". I get back:
{"error":"bad_request","reason":"invalid UTF-8 JSON: {{error,{1,\"lexical error: invalid char in json text.\\n\"}},\n \"New Albanian Brewing\"}"}
I poked around the site and saw some posts about \r and windows boxes, and since I'm running on Windows 7(64x), I decided to take all of the carriage returns out of the function:
function (doc, meta) { if(doc.name) { emit(doc.name, null); } }
"Save" button and then "Show results". Same answer:
{"error":"bad_request","reason":"invalid UTF-8 JSON: {{error,{1,\"lexical error: invalid char in json text.\\n\"}},\n \"New Albanian Brewing\"}"}
What am I doing wrong?
NOTES:
> I'm running Version: 2.0.0 community edition (build-1723)
> using Firefox 14.0.1
> I've been a homebrewer for 10+ years and love the fact that this product uses Beer/brewing for it's samples and documentation.... awesome.
Thanks in advance,
-Steve
ok. found the issue... When you fill in the text box in the Filter Results drop down next to the keys field you MUST put in quotes around the value you are searching.
http:// localhost:8092/beer-sample/_design/dev_beertest/_view/name?key=%22Pyramid+Thunderhead+IPA%22&connection_timeout=60000&limit=10&skip=0
Not:
http:// localhost:8092/beer-sample/_design/dev_beertest/_view/name?key=Pyramid+Thunderhead+IPA&connection_timeout=60000&limit=10&skip=0
Now I can experiment away!