Ok, seems to be configuration in the database.Now, it works !
Last question  :  Still using QBE interface, i want to do
- keyword search city:'Paris'
- (relevance) score ranking

I did not find any example about both of them with node.js (and QBE).
 I think its not possible to do binding search with qbe (which you cannot
mix with string query and structured query, too bad for me!).

But I'm sure score ranking is pretty simple, but could not find the a
proper syntax example.
Any example appreciated, here's my test, node.js +QBE:
var query = db
.query(
qb
.where(qb.byExample({ message : {$word : 'message '}}))
.orderBy(qb.sort('createdat', 'ascending'))
.slice(5, 10)
.calculate(
qb.facet("department", qb.facetOptions('item-frequency','descending'))
)
)

How to account for score and optionnaly queries like city:'Paris' ?

Thank you




Le dim. 26 juil. 2015 à 20:54, moshir mikael <[email protected]> a
écrit :

> Thank you.
> I have been one issue : doing  qb.byExample({message:{$word : 'mess'}}),
> this founds messages where 'mess' appears'
> Doing  qb.byExample({message:{$word : 'MESS'}}), nothing is returned.
>
> What am i doing wrong ?
>
>
> Le dim. 26 juil. 2015 à 17:02, Erik Hennum <[email protected]> a
> écrit :
>
>>  Hi, Mikael:
>>
>>  Good to hear that you had success with it.
>>
>>  The value of $word can contain multiple words to search for a phrase.
>>
>>  To search for the word or words anywhere in the document, use $word at
>> the top-level as in:
>>
>>      qb.byExample({$word: 'some phrase'})
>>
>>  You can also use $value when the entire value of a JSON property should
>> be one or more words.
>>
>>      qb.byExample({message:{$value: 'a complete value'}})
>>
>>  In fact, $value is the default operator, so the following query is an
>> equivalent shortcut:
>>
>>      qb.byExample({message:'a complete value'})
>>
>>  You can't, however, use $value at the top level.
>>
>>  To query on a datatyped value, create a range index on the JSON
>> property and use $eq, $lt, or one of the other comparison operators.
>>
>>
>>  Hoping that helps,
>>
>>
>>   Erik Hennum
>>
>>    *From:* [email protected] [
>> [email protected]] on behalf of moshir mikael [
>> [email protected]]
>> *Sent:* Saturday, July 25, 2015 4:04 PM
>> *To:* MarkLogic Developer Discussion
>> *Subject:* Re: [MarkLogic Dev General] (no subject)
>>
>>   Ok, Thank you
>>
>>  got it !
>> now, i have another question, maybe I should have posted it separately.
>> However, here it is
>> i'm using queryByExample({message : {$word : 'something'}}
>>
>>  This works fine.
>> I want to user queryByExample with term, but $term does not work.
>> And optionnaly, would be nice to use queryByExample with query string
>> like "cat and dog"
>>
>>  What's the good approach ?
>>
>>  Thank you
>>
>>  Le sam. 25 juil. 2015 à 15:23, Erik Hennum <[email protected]>
>> a écrit :
>>
>>>  Hi, Moshir:
>>>
>>>  One way to solve this problem is to model the data differently:  store
>>> each car as a separate document and store the agency id in each car
>>> document so it is easy to retrieve individual cars or all cars for an
>>> agency.
>>>
>>>  An alternative approach is to qualify the documents with the car nodes
>>> and extract the car nodes. Something like the following (untested) code
>>> should work:
>>>
>>>  db.documents.query(
>>>     qb.where(qb.byExample({size:'small'}))
>>>         .slice(qb.extract(['/cars[size eq "small"]']))
>>>     ).result(...)
>>>
>>>  For more information about extract, see:
>>>
>>>      http://docs.marklogic.com/guide/node-dev/search#id_17648
>>>
>>>  Extract paths have the same limitations as paths for range indexes:
>>>
>>>      http://docs.marklogic.com/guide/admin/range_index#id_40666
>>>
>>>  That said, modifying the model is usually the better approach in the
>>> long run.
>>>
>>>
>>>  Hoping that helps,
>>>
>>>
>>>   Erik Hennum
>>>
>>>    ------------------------------
>>> *From:* [email protected] [
>>> [email protected]] on behalf of moshir mikael [
>>> [email protected]]
>>> *Sent:* Saturday, July 25, 2015 3:17 AM
>>> *To:* [email protected]
>>> *Subject:* [MarkLogic Dev General] (no subject)
>>>
>>>       Hi,
>>>
>>>  I'm new to marklogic and I'm using node.js client.
>>> I have a very simple structure already loaded to database
>>> {
>>>    id : id of an agency,
>>>    cars : [ an array of cars ]
>>> }
>>> each car in the array has following properties
>>> [
>>>    type : type of car,
>>>    size : size of car
>>> ]
>>>
>>>  I want to use the node.js client api
>>> to query all cars with given type and/or size.
>>>
>>>  When I use
>>>  .db.documents.query(qb.byExample({size:'small'}))
>>>  it returns me all agencies with at least one small car (just
>>> guessing), but not cars
>>>
>>>  Any help really appreciated !
>>>
>>>
>>>
>>>     _______________________________________________
>>> General mailing list
>>> [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
>>
>
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to