This does not seem to work:

 

db.documents.query(

    qb.where(

        qb.field( 'state', 'Washington'  )

    )

)

 

 

Results in

 

Error: subquery is not a query definition: object 
{"field":{"name":"state","collation":"Washington"}}

    at checkQuery 
(E:\Git\ExpressTest\node_modules\marklogic\lib\query-builder.js:133:11)

    at Object.where 
(E:\Git\ExpressTest\node_modules\marklogic\lib\query-builder.js:3340:20)

    at Object.<anonymous> (E:\Git\ExpressTest\testsearch.js:13:7)

    at Module._compile (module.js:460:26)

    at Object.Module._extensions..js (module.js:478:10)

    at Module.load (module.js:355:32)

    at Function.Module._load (module.js:310:12)

    at Function.Module.runMain (module.js:501:10)

    at startup (node.js:129:16)

    at node.js:814:3

 

Best Regards 

 

Martin

 

Von: [email protected] 
[mailto:[email protected]] Im Auftrag von David Ennis
Gesendet: Montag, 8. Juni 2015 17:49
An: MarkLogic Developer Discussion
Betreff: Re: [MarkLogic Dev General] Field Search?

 

HI.

 

Fields in MarkLogic is a way to group values form multiple elements into a 
single searchable unit. For instance, if I had 2 types of data in my system and 
I wanted to search either type of document based on postal codes:

I could define a field called postal-code and map two(or more) xpath 
expressions to it:

/some/path/to/pcode

/some/other/path/to/postal_code

 

In the end, it works very much like a word query (and even has the same 
defaults, I believe)

 

Details: https://docs.marklogic.com/guide/admin/fields

 

 

 

 

Regarding quer builder:

I cannot find a full example, but there is a test in github showing the use of 
a field.

https://github.com/marklogic/node-client-api/blob/1896935ca56c92d544d5a448b5ff39bc4f4c6af9/test-basic/query-builder.js

 

This would make me think that it is just qb.field('fieldname',   'value') 
-rather than qb.word()

 

 

 

Kind Regards,

David Ennis

 

 

David Ennis
Content Engineer

 <http://www.hinttech.com/>  
Mastering the value of content
creative | technology | content

Delftechpark 37i
2628 XJ Delft
The Netherlands
T: +31 88 268 25 00
M: +31 63 091 72 80 

 <http://www.hinttech.com>   <https://twitter.com/HintTech>   
<http://www.facebook.com/HintTech>   <http://www.linkedin.com/company/HintTech> 

 

On 8 June 2015 at 17:34, Martin Vollmix <[email protected] 
<mailto:[email protected]> > wrote:

Hi,

 

can anybody explain, what a “field search“ is or a „search title for a keyword“

and how this can be done using querybuilder in node.js

 

Thanks in advance

 

Martin

 


_______________________________________________
General mailing list
[email protected] <mailto:[email protected]> 
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general

 

_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to