Navigation Menu

Skip to content

Commit

Permalink
Show facet
Browse files Browse the repository at this point in the history
only showing at this time
  • Loading branch information
darashi committed Aug 15, 2012
1 parent 1589399 commit 69f7960
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
3 changes: 2 additions & 1 deletion lib/server.js
Expand Up @@ -29,7 +29,7 @@ app.use(function(error, request, response, next){

// helpers
function search(query, callback) {
var url = 'http://' + searchNode + '/2011-02-01/search?size=100&q=' + encodeURIComponent(query);
var url = 'http://' + searchNode + '/2011-02-01/search?size=100&facet=path&q=' + encodeURIComponent(query);
var buffer = '';
var request = http.get(url, function(response) {
if (response.statusCode !== 200) {
Expand Down Expand Up @@ -72,6 +72,7 @@ app.get('/search', function(request, response, next) {
query: query,
records: results.hits.hit,
num_found: results.hits.found,
path_facets: results.facets.path.constraints,
from: results.hits.start + 1,
to: results.hits.start + results.hits.hit.length,
num_showing: results.hits.hit.length
Expand Down
48 changes: 31 additions & 17 deletions views/search.jade
@@ -1,22 +1,36 @@
extends layout

block content
if records.length > 0
.alert.alert-info
| Found #{num_found} entries.
| Showing #{from} - #{to} (#{num_showing} entries).
.row
.span12
if records.length > 0
.alert.alert-info
| Found #{num_found} entries.
| Showing #{from} - #{to} (#{num_showing} entries).
else
.alert.alert-info
| No entry found.
.row
.span9
if records.length > 0
each record, index in records
.record
h2 #{record.data.title}
p.path
each title, pathIndex in record.data.path
span.label.label-inverse
= title
if pathIndex != record.data.path.length - 1
span »

each record, index in records
.record
h2 #{record.data.title}
p.path
each title, pathIndex in record.data.path
span.label.label-inverse
= title
if pathIndex != record.data.path.length - 1
span »
!{record.data.desc}

!{record.data.desc}
else
.alert.alert-info
| No entry found.
.span3
.well(style="padding: 8px 0;")
ul.nav.nav-list
each facet, index in path_facets
li
a
= facet.value
|
span.badge.badge-info= facet.count

0 comments on commit 69f7960

Please sign in to comment.