From f72454f4659f43c9728acf4d00bd297852864eb8 Mon Sep 17 00:00:00 2001 From: carycheng Date: Thu, 4 Jan 2018 13:58:53 -0800 Subject: [PATCH] Search readme update (#506) --- doc/search.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/doc/search.md b/doc/search.md index 2093023b6..d709b48cc 100644 --- a/doc/search.md +++ b/doc/search.md @@ -4,3 +4,39 @@ Search Different examples of search which have been implemented in the example [SearchExamplesAsAppUser.java](https://github.com/box/box-java-sdk/blob/master/src/example/java/com/box/sdk/example/SearchExamplesAsAppUser.java) For more information refer [search documentation](https://developer.box.com/v2.0/reference#searching-for-content) + +* [Search](#search) + +Search +------ + +A search can be performed in your Box instance with specified starting position with +[`searchRange(long, long, BoxSearchParameters)`][search-with-offset] + +By passing in a specific Offset value this will allow you to determine a starting position to begin the search response. +By passing in a Limit value, this will allow you to determine how many response items you will get back. + +```java +Long offsetValue = 10; +Long limitValue = 10; +BoxSearch boxSearch = new BoxSearch(api); +searchParams.setType("file"); +PartialCollection searchResults = boxSearch.searchRange(offsetValue, limitValue, searchParams); +``` + +[search-with-offset]: https://box.github.io/box-java-sdk/javadoc/com/box/sdk/BoxSearch.html#searchRange(java.lang.Long, java.lang.Long, com.box.sdk.BoxSearchParameters) + +You can also construct a custom query param to locate the items you want with the BoxSearchParameters field +[`searchRange(long, long, BoxSearchParameters)`][search-with-params] + +```java +String query = "A query"; +BoxSearch boxSearch = new BoxSearch(api); +BoxSearchParameters searchParams = new BoxSearchParameters(); +searchParams.setQuery(query); +searchParams.setType("file"); +PartialCollection searchResults = boxSearch.searchRange(10, 10, searchParams); +``` + +[search-with-params]: https://box.github.io/box-java-sdk/javadoc/com/box/sdk/BoxSearch.html#searchRange(java.lang.Long, java.lang.Long, com.box.sdk.BoxSearchParameters) +