Presentation is loading. Please wait.

Presentation is loading. Please wait.

Supported by EU projects 12/12/2013 Athens, Greece Open Data in Agriculture Hands-on with data infrastructures that can power your agricultural data products.

Similar presentations


Presentation on theme: "Supported by EU projects 12/12/2013 Athens, Greece Open Data in Agriculture Hands-on with data infrastructures that can power your agricultural data products."— Presentation transcript:

1 Supported by EU projects 12/12/2013 Athens, Greece Open Data in Agriculture Hands-on with data infrastructures that can power your agricultural data products

2 Mathioudakis Theodore Agro-Know Technologies How to use the search-API at the front-end

3 Contents ๏ The search-API ๏ Useful calls for search-API ๏ The response ๏ Tutorial on how to build finder over the search- API 3

4 Contents ๏ The search-API ๏ Useful calls for search-API ๏ The response ๏ Tutorial on how to build finder over the search- API 4

5 search-api

6 Requests The base URL of the API is: http://54.228.180.124:8080/search-api/v1/ Resource Types When you formulate a REST query, you have to decide which resource type you want. AKIF or AGRIF 6

7 search-api akif The akif type is a data model to represent educational resources related to agriculture and biodiversity. The RESTful URL to request data from the akif resource begins: http://54.228.180.124:8080/search-api/v1/akif/ agrif The agrif type is a data model to represent bibliographic references on agricultural research and technology. The RESTful URL to request data from the agrif resource begins: http://54.228.180.124:8080/search-api/v1/agrif/ 7

8 Contents ๏ The search-API ๏ Useful calls for search-API ๏ The response ๏ Tutorial : how to build finder over the search-API 8

9 1. Simple search http:// /v1/akif ?q=fossil ( items with fossil anywhere in any field) http:// /v1/akif ?q=* (all items) 2. Search within specific field http:// /v1/akif?languageBlock.en.description=fossil (all items that has fossil in description ) 9 useful calls for search-api

10 2. Search within specific field (cont’) …/akif? languageBlock.en.description=fossil&language=en (all items that has element fossil in description and language = en) 3. Faceted Search (Facets tell you the most common values for certain fields in a collection of items) …/akif ?facets=set,language (We define “set” and “language” as facets) 10 useful calls for search-api

11 4. Other calls Pagination Page Size Sorting Results Limit facets Combine all the previous :) Fetching specific items Full documentation: http://54.228.180.124:8080/search-api/ 11 useful calls for search-api

12 Contents ๏ The search-API ๏ Useful calls for search-API ๏ The response ๏ Tutorial on how to build finder over the search- API 12

13 let’s say we make the following request../akif?q=dove&facets=set&set=oeorganiceprints &page_size=10&page=1 13 the response

14 14 the response Response : { "total" : 1, "time" : 5, "page" : 1, "pageSize" : 10, "sortOrder" : "asc", "facets" : { "set" : { "_type" : "terms", "missing" : 0, "total" : 1, "other" : 0, "terms" : [ { "term" : "oeorganiceprints", "count" : 1 } ] } }, "results" : [ { "creationDate" : "2013-04-17", "lastUpdateDate" : "2

15 Contents ๏ The search-API ๏ Useful calls for search-API ๏ The response ๏ Tutorial : how to build a finder over the search-API 15

16 Choice 1: Use javascript(ajax) to call the API. Create a UI to show the json response. 16 tutorial : how to build a finder over search-api

17 Choice 2: Use our code to easily implement a simple finder on your server. Follows the tutorial 17 tutorial : how to build a finder over search-api

18 18 What are we going to create? tutorial : how to build a finder over search-api

19 19 Step 1 Download the source code from github https://github.com/agroknow/ak-finder tutorial : how to build a finder over search-api

20 20 tutorial : how to build a finder over search-api Step 2 Understand the structure MVC model using Angular JS /app/controllers : contains the controllers /assets : contains images e.t.c /config : contains configuration and mapping files /css : contains the css(.less) files /finder : contains the html files for search page and view item page

21 21 tutorial : how to build a finder over search-api Step 2 (cont) Understand the structure *advanced Magic happens in controllers files and conf.json file. …/controllers/search : controllers for search page …/controllers/view_item : controllers for view_item

22 22 tutorial : how to build a finder over search-api Step 2 (cont) Understand the structure *for the rest of us Magic happens in /config/conf.json file :)

23 23 tutorial : how to build a finder over search-api Step 3 The conf.json file "baseUrl": "http://54.228.180.124:8080/search-api/v1/akif?", "enableFacets": true, "enablePaginationBottom": false, "enablePaginationTop": false, "facets": ["set","language"], "limitPagination": 10, "limit_facets": { "set":["oeintute","aglrgfsp"] },

24 24 tutorial : how to build a finder over search-api Step 3(cont) The conf.json file "limit_facets_number": 4, "mappings_file": "../config/facets_mappings.json", "maxTextLength": 300, "pageSize": 20, "selectedLanguage": "en", "snippetElements": [“title", “description", "languageBlocks.en.keywords"]

25 25 tutorial : how to build a finder over search-api Step 4 Configure the finder : configuration + UI

26 26 tutorial : how to build a finder over search-api Step 4 Configure the finder : configuration + UI

27 27 tutorial : how to build a finder over search-api Step 5 Match it with your style :)

28 28 tutorial : how to build a finder over search-api Step 5 Match it with your style :) All you need to do is to change the colours in the css(.less) file and find the combination you like. Of course you are all free to create and change the code in any way you like.

29 Thank you! Mathioudakis Theodore Agro-Know Technologies mathiou@agroknow.gr


Download ppt "Supported by EU projects 12/12/2013 Athens, Greece Open Data in Agriculture Hands-on with data infrastructures that can power your agricultural data products."

Similar presentations


Ads by Google