fergiemcdowall / norch-bootstrap

A pluggable front-end for Forage based on Angular and Bootstrap
6 stars 0 forks source link

How to set specific facets always on? #27

Closed eklem closed 9 years ago

eklem commented 9 years ago

I got a search solution where I want to initially do a wildcard-search, showing all results and all facets. How do I get to always have the facet-part of the url present, no matter what I press or search for in the solution?

Example-URL:

http://localhost:3030/#/search?q=*&facets=user,type,tags

The part that I always want present:

&facets=user,type,tags

skjermbilde 2015-04-12 kl 21 21 37

eklem commented 9 years ago

What I want to achieve is that the user can click more than type. This will be good on phones and pads/tablets.

eklem commented 9 years ago

Added it as a bug since this probably has been working before.

eklem commented 9 years ago

As suggested, I tried to hardcode "&facets=user,type,tags" into the url variable in norch-app.js:

url += '&teaser=body&facets=user,type,tags';

First I get to see the three facets, but when I try to filter, I get an error message, and and empty search result. I removed the facets from norch-app.js and reloaded the page, and all was fine. Error messge:

{ query: { '*': [ 'googleforwork' ] },
  offset: '0',
  pageSize: '20',
  facets: [ 'user', 'type', 'tags' ],
  teaser: 'body' }
GET /search?q=googleforwork&offset=0&pagesize=20&teaser=body&facets=user,type,tags 304 - - 2.836 ms
GET /search?q=googleforwork&offset=0&pagesize=20&facets=user,type,tags&filter[user][]=eklem&teaser=body&facets=user,type,tags 500 1136 - 0.857 ms
TypeError: undefined is not a function
    at getQuery (/Users/eklem/node_modules/norch/lib/norch.js:170:41)
    at /Users/eklem/node_modules/norch/lib/norch.js:247:13
    at Layer.handle [as handle_request] (/Users/eklem/node_modules/norch/node_modules/express/lib/router/layer.js:82:5)
    at next (/Users/eklem/node_modules/norch/node_modules/express/lib/router/route.js:100:13)
    at Route.dispatch (/Users/eklem/node_modules/norch/node_modules/express/lib/router/route.js:81:3)
    at Layer.handle [as handle_request] (/Users/eklem/node_modules/norch/node_modules/express/lib/router/layer.js:82:5)
    at /Users/eklem/node_modules/norch/node_modules/express/lib/router/index.js:234:24
    at Function.proto.process_params (/Users/eklem/node_modules/norch/node_modules/express/lib/router/index.js:312:12)
    at /Users/eklem/node_modules/norch/node_modules/express/lib/router/index.js:228:12
    at Function.match_layer (/Users/eklem/node_modules/norch/node_modules/express/lib/router/index.js:295:3)
eklem commented 9 years ago

Found a good enough fix for demo purposes. Will move to a different frontend later. https://github.com/eklem/life-index/commit/5da5c35be392928e832f63af90e0e56ed0e15881