Tinysou Java client
Download tinysou-java-v1.00.jar and import to your java project as a library
import com.tinysou.help.Collection;
import com.tinysou.help.Engine;
import com.tinysou.help.Document;
Engine engine = new Engine(AUTH_TOKEN);
List:
engine.list();
Create:
engine.create(ENGINE_NEME, DISPLAY_NAME);
Get:
engine.get(ENGINE_NEME);
Update:
engine.update(ENGINE_NEME,DISPLAY_NAME);
Delete:
engine.delete(ENGINE_NEME);
Collection collection = new Collection(AUTH_TOKEN, ENGINE_NEME);
List:
collection.list();
Create:
collection.create(COLLECTION_NAME, field_types);
Get:
collection.get(COLLECTION_NAME);
Delete:
collection.delete(COLLECTION_NAME);
Document document = new Document(AUTH_TOKEN, ENGINE_NEME, COLLECTION_NAME);
List:
document.list();
Create:
document.create(field_types);
Get:
document.get(documentId);
Update:
document.update(documentId,field_types);
Delete:
document.delete(documentId);
Search search = new Search(AUTH_TOKEN, ENGINE_NEME, "page");
JSONObject paramsBody = new JSONObject();
paramsBody.put("q", "搜索");
search.setParams(paramsBody);
search.doSearchSingleCollection(); //单collection搜索
paramsBody.put("c", "page1,page2");
search.doSearchMultiCollection(); //跨collection搜索
AutoComplete autoComplete = new AutoComplete(AUTH_TOKEN, ENGINE_NEME, "page");
JSONObject paramsBody = new JSONObject();
paramsBody.put("q", "搜索");
autoComplete.setParams(paramsBody);
autoComplete.doAutoCompleteSingleCollection(); //单collection自动补全
paramsBody.put("c", "page1,page2");
autoComplete.doAutoCompleteMultiCollection(); //跨collection自动补全
See examples
- Fork it ( https://github.com/tinysou/tinysou-java/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request