@@ -394,10 +394,11 @@ describe('query-builder', function() {
394394 assert . deepEqual (
395395 q . geospatial ( q . geoAttributePair ( 'parent' , 'latitude' , 'longitude' ) ,
396396 q . latlon ( 1.1 , 2.2 ) ,
397- q . fragmentScope ( 'documents' ) , q . geoOptions ( 'boundaries-included' ) ) ,
397+ q . weight ( 2 ) , q . fragmentScope ( 'documents' ) , q . geoOptions ( 'boundaries-included' ) ) ,
398398 { 'geo-attr-pair-query' :{ parent :{ name :'parent' } ,
399399 lat :{ name :'latitude' } , lon :{ name :'longitude' } ,
400400 point :[ { latitude :1.1 , longitude :2.2 } ] ,
401+ weight : 2 ,
401402 'fragment-scope' : 'documents' ,
402403 'geo-option' :[ 'boundaries-included' ] } }
403404 ) ;
@@ -451,11 +452,12 @@ describe('query-builder', function() {
451452 ) ;
452453 assert . deepEqual (
453454 q . geospatial ( q . geoElement ( 'parent' , 'element' ) ,
454- q . latlon ( 1.1 , 2.2 ) , q . fragmentScope ( 'documents' ) ,
455- q . geoOptions ( 'boundaries-included' ) ) ,
455+ q . latlon ( 1.1 , 2.2 ) , q . weight ( 2 ) ,
456+ q . fragmentScope ( 'documents' ) , q . geoOptions ( 'boundaries-included' ) ) ,
456457 { 'geo-elem-query' :{ parent :{ name :'parent' } ,
457458 element :{ name :'element' } ,
458459 point :[ { latitude :1.1 , longitude :2.2 } ] ,
460+ weight : 2 ,
459461 'fragment-scope' : 'documents' ,
460462 'geo-option' :[ 'boundaries-included' ] } }
461463 ) ;
@@ -491,10 +493,11 @@ describe('query-builder', function() {
491493 ) ;
492494 assert . deepEqual (
493495 q . geospatial ( q . geoElementPair ( 'parent' , 'latitude' , 'longitude' ) , q . latlon ( 1.1 , 2.2 ) ,
494- q . fragmentScope ( 'documents' ) , q . geoOptions ( 'boundaries-included' ) ) ,
496+ q . weight ( 2 ) , q . fragmentScope ( 'documents' ) , q . geoOptions ( 'boundaries-included' ) ) ,
495497 { 'geo-elem-pair-query' :{ parent :{ name :'parent' } ,
496498 lat :{ name :'latitude' } , lon :{ name :'longitude' } ,
497499 point :[ { latitude :1.1 , longitude :2.2 } ] ,
500+ weight : 2 ,
498501 'fragment-scope' : 'documents' ,
499502 'geo-option' :[ 'boundaries-included' ] } }
500503 ) ;
@@ -533,9 +536,10 @@ describe('query-builder', function() {
533536 ) ;
534537 assert . deepEqual (
535538 q . geospatial ( q . geoPath ( q . pathIndex ( 'foo' , { bar : 'baz' } ) ) , q . point ( 1.1 , 2.2 ) ,
536- q . fragmentScope ( 'documents' ) , q . geoOptions ( 'boundaries-included' ) ) ,
539+ q . weight ( 2 ) , q . fragmentScope ( 'documents' ) , q . geoOptions ( 'boundaries-included' ) ) ,
537540 { 'geo-path-query' :{ 'path-index' :{ text : 'foo' , namespaces : { bar : 'baz' } } ,
538541 point :[ { latitude :1.1 , longitude :2.2 } ] ,
542+ weight : 2 ,
539543 'fragment-scope' : 'documents' ,
540544 'geo-option' :[ 'boundaries-included' ] } }
541545 ) ;
@@ -585,11 +589,12 @@ describe('query-builder', function() {
585589 ) ;
586590 assert . deepEqual (
587591 q . geospatial ( q . geoProperty ( 'parent' , 'property1' ) ,
588- q . latlon ( 1.1 , 2.2 ) , q . fragmentScope ( 'documents' ) ,
589- q . geoOptions ( 'boundaries-included' ) ) ,
592+ q . latlon ( 1.1 , 2.2 ) , q . weight ( 2 ) ,
593+ q . fragmentScope ( 'documents' ) , q . geoOptions ( 'boundaries-included' ) ) ,
590594 { 'geo-json-property-query' :{ 'parent-property' :'parent' ,
591595 'json-property' :'property1' ,
592596 point :[ { latitude :1.1 , longitude :2.2 } ] ,
597+ weight : 2 ,
593598 'fragment-scope' : 'documents' ,
594599 'geo-option' :[ 'boundaries-included' ] } }
595600 ) ;
@@ -621,11 +626,12 @@ describe('query-builder', function() {
621626 ) ;
622627 assert . deepEqual (
623628 q . geospatial ( q . geoPropertyPair ( 'parent' , 'latitude' , 'longitude' ) ,
624- q . latlon ( 1.1 , 2.2 ) ,
629+ q . latlon ( 1.1 , 2.2 ) , q . weight ( 2 ) ,
625630 q . fragmentScope ( 'documents' ) , q . geoOptions ( 'boundaries-included' ) ) ,
626631 { 'geo-json-property-pair-query' :{ 'parent-property' :'parent' ,
627632 'lat-property' :'latitude' , 'lon-property' :'longitude' ,
628633 point :[ { latitude :1.1 , longitude :2.2 } ] ,
634+ weight : 2 ,
629635 'fragment-scope' : 'documents' ,
630636 'geo-option' :[ 'boundaries-included' ] } }
631637 ) ;
@@ -1154,6 +1160,15 @@ describe('query-builder', function() {
11541160 'range-option' :[ 'cached' ]
11551161 } }
11561162 ) ;
1163+ assert . deepEqual (
1164+ q . range ( 'foo' , 1 , q . weight ( 2 ) ) ,
1165+ { 'range-query' :{
1166+ 'json-property' : 'foo' ,
1167+ value : [ 1 ] ,
1168+ 'range-operator' : 'EQ' ,
1169+ weight : 2
1170+ } }
1171+ ) ;
11571172 } ) ;
11581173
11591174 it ( 'should create range options' , function ( ) {
@@ -1493,6 +1508,15 @@ describe('query-builder', function() {
14931508 'fragment-scope' : 'properties' } ,
14941509 name :'constraint1' }
14951510 ) ;
1511+ assert . deepEqual (
1512+ q . geospatial ( q . geoAttributePair ( 'parent' , 'latitude' , 'longitude' ) ,
1513+ q . bind ( 'constraint1' ) ,
1514+ q . weight ( 2 ) ) ,
1515+ { 'geo-attr-pair' :{ parent :{ name :'parent' } ,
1516+ lat :{ name :'latitude' } , lon :{ name :'longitude' } ,
1517+ weight : 2 } ,
1518+ name :'constraint1' }
1519+ ) ;
14961520 assert . deepEqual (
14971521 q . geospatial ( q . geoElement ( 'parent' , 'element' ) ,
14981522 q . bind ( 'constraint1' ) ) ,
@@ -1516,6 +1540,14 @@ describe('query-builder', function() {
15161540 'fragment-scope' : 'properties' } ,
15171541 name :'constraint1' }
15181542 ) ;
1543+ assert . deepEqual (
1544+ q . geospatial ( q . geoElement ( 'parent' , 'element' ) ,
1545+ q . bind ( 'constraint1' ) , q . weight ( 2 ) ) ,
1546+ { 'geo-elem' :{ parent :{ name :'parent' } ,
1547+ element :{ name :'element' } ,
1548+ weight : 2 } ,
1549+ name :'constraint1' }
1550+ ) ;
15191551 assert . deepEqual (
15201552 q . geospatial ( q . geoElementPair ( 'parent' , 'latitude' , 'longitude' ) ,
15211553 q . bind ( 'constraint1' ) ) ,
@@ -1539,6 +1571,14 @@ describe('query-builder', function() {
15391571 'fragment-scope' : 'properties' } ,
15401572 name :'constraint1' }
15411573 ) ;
1574+ assert . deepEqual (
1575+ q . geospatial ( q . geoElementPair ( 'parent' , 'latitude' , 'longitude' ) ,
1576+ q . bind ( 'constraint1' ) , q . weight ( 2 ) ) ,
1577+ { 'geo-elem-pair' :{ parent :{ name :'parent' } ,
1578+ lat :{ name :'latitude' } , lon :{ name :'longitude' } ,
1579+ weight : 2 } ,
1580+ name :'constraint1' }
1581+ ) ;
15421582 assert . deepEqual (
15431583 q . geospatial ( q . geoPath ( 'foo' ) , q . bind ( 'constraint1' ) ) ,
15441584 { 'geo-path' :{ 'path-index' :{ text : 'foo' , namespaces : '' } } ,
@@ -1558,6 +1598,13 @@ describe('query-builder', function() {
15581598 'fragment-scope' : 'properties' } ,
15591599 name :'constraint1' }
15601600 ) ;
1601+ assert . deepEqual (
1602+ q . geospatial ( q . geoPath ( 'foo' ) ,
1603+ q . bind ( 'constraint1' ) , q . weight ( 2 ) ) ,
1604+ { 'geo-path' :{ 'path-index' :{ text : 'foo' , namespaces : '' } ,
1605+ weight : 2 } ,
1606+ name :'constraint1' }
1607+ ) ;
15611608 assert . deepEqual (
15621609 q . range ( 'key1' , q . bind ( 'constraint1' ) ) ,
15631610 { range :{ 'json-property' : 'key1' , facet : false } ,
@@ -1573,6 +1620,11 @@ describe('query-builder', function() {
15731620 { range :{ 'json-property' : 'key1' , 'fragment-scope' : 'properties' , facet : false } ,
15741621 name :'constraint1' }
15751622 ) ;
1623+ assert . deepEqual (
1624+ q . range ( 'key1' , q . bind ( 'constraint1' ) , q . weight ( 2 ) ) ,
1625+ { range :{ 'json-property' : 'key1' , weight : 2 , facet : false } ,
1626+ name :'constraint1' }
1627+ ) ;
15761628 assert . deepEqual (
15771629 q . value ( 'key1' , q . bind ( 'constraint1' ) ) ,
15781630 { value :{ 'json-property' : 'key1' } ,
0 commit comments