Closed borsi closed 7 years ago
const query = new Query(q =>
q.TypeIs<ContentTypes.Task>(ContentTypes.Task) // adds '+TypeIs:Document' and Typescript type cast
.And
.Equals('DisplayName', 'Unicorn') // adds +Title:Unicorn (TBD: fuzzy/Proximity)
.And
.Between('ModificationDate', '2017-01-01T00:00:00', '2017-02-01T00:00:00')
.Or
.Query(sub => sub //Grouping
.NotEquals('Approvable', true)
.And
.NotEquals('Description', '*alma*') //Contains with wildcards
)
.Sort('DisplayName')
.Top(5) // adds .TOP:5
.Skip(10) // adds .SKIP:10
);
// fires the request
query.Exec(repository, path, {
select: ['Id', 'Path', 'Name', 'DisplayName'],
expand: 'Owner'
})
.subscribe(docs => {
console.log('Query result:', docs)
})
The query.toString()
should return with the content query string:
TypeIs:Task AND DisplayName:'Unicorn' AND ModificationDate:{'2017-01-01T00\:00\:00' TO '2017-02-01T00\:00\:00'} OR (NOT(Approvable:'true') AND NOT(Description:'*alma*')) .SORT:'DisplayName' .TOP:5 .SKIP:10
On client side, we have the fields and the means of querying. So instead of building query strings, we should have an Query API.
ToDo: