Skip to content

Commit

Permalink
Search readme update (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
carycheng authored and Matt Willer committed Jan 4, 2018
1 parent 42d4272 commit f72454f
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions doc/search.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<BoxItems.Info> 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<BoxItem.Info> 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)

0 comments on commit f72454f

Please sign in to comment.