1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | var focus = { lat: 51.5, lon: -0.06 };
|
9 |
|
10 | var query = require('../index'),
|
11 | vs = new query.Vars( query.defaults );
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | var q = new query.layout.FilteredBooleanQuery()
|
19 | .score( query.view.phrase )
|
20 | .score( query.view.focus( query.view.phrase ) );
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | vs.set({
|
28 | 'phrase:field': 'phrase.default',
|
29 | 'phrase:analyzer': 'standard',
|
30 | 'focus:function': 'gauss',
|
31 | 'focus:offset': '10km',
|
32 | 'focus:scale': '100km',
|
33 | 'focus:decay': 0.4
|
34 | });
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 | vs.var( 'input:name', 'union square' );
|
42 | vs.var('focus:point:lat', focus.lat);
|
43 | vs.var('focus:point:lon', focus.lon);
|
44 |
|
45 |
|
46 | var rendered = q.render( vs );
|
47 | console.log( JSON.stringify( rendered, null, 2 ) );
|