Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagegroovy
router.GET('topics/search/{srchFor}') {
   strategy(DOCUMENTS_BY_SEARCH_FT_PAGED) {
     ftQuery('srchFor') //Available since Beta 4 
   }
   mapJson 'id', json:'id', type:'STRING', isformula:true, formula:'@DocumentUniqueID'
   mapJson "date", json:'date_created',type:'DATETIME',isformula:true, formula:'@Created'
   mapJson "topic", json:'topic', type:'STRING'
   mapJson "author", json:'author', type:'STRING',isformula:true,formula:'@Name([CN]; @Author)'
}

For GET we are you can define ftQuery placeholder like shown above and use URL like http://server.name/path-to/db.nsf/xsp/.xrest/topics/search/10000* or you can be passing the search parameter in the URL like this http://server.name/path-to/db.nsf/xsp/.xrest/topics/search?start=1&count=5&search=10000*In this case do not include the placeholder in the router path definition, ie. router.GET('topics/search')

Note: ftQuery takes precedence, so if you add ?search= to the URL, it will be ignored.

Format of the returned JSON is identical as for POST variant.

...