supported by eu projects

29
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

Upload: foster

Post on 24-Feb-2016

31 views

Category:

Documents


0 download

DESCRIPTION

Open Data in Agriculture. Hands-on with data infrastructures that can power your agricultural data products. 12/12/2013 Athens, Greece. Supported by EU projects. How to use the search-API at the front-end. Mathioudakis Theodore Agro-Know Technologies. Contents. The search-API - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Supported by EU projects

Supported by EU projects

12/12/2013Athens, Greece

Open Data in AgricultureHands-on with data

infrastructures that can power your agricultural data products

Page 2: Supported by EU projects

Mathioudakis TheodoreAgro-Know Technologies

How to use the search-API at the front-end

Page 3: Supported by EU projects

Contents

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

search-API

3

Page 4: Supported by EU projects

Contents

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

search-API

4

Page 5: Supported by EU projects

search-api

Page 6: Supported by EU projects

search-api

RequestsThe base URL of the API is:http://54.228.180.124:8080/search-api/v1/

Resource TypesWhen you formulate a REST query, you have to decide which resource type you want.

AKIF or AGRIF

6

Page 7: Supported by EU projects

search-apiakif

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

Page 8: Supported by EU projects

Contents

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

search-API

8

Page 9: Supported by EU projects

1. Simple search http://<domain>/v1/akif?q=fossil (items with fossil anywhere in any field)

http://<domain>/v1/akif?q=* (all items)

2. Search within specific field http://<domain>/v1/akif?languageBlock.en.description=fossil (all items that has fossil in description )

9

useful calls for search-api

Page 10: Supported by EU projects

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

Page 11: Supported by EU projects

4. Other calls PaginationPage SizeSorting ResultsLimit facetsCombine all the previous :)

Fetching specific items

Full documentation:http://54.228.180.124:8080/search-api/

11

useful calls for search-api

Page 12: Supported by EU projects

Contents

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

search-API

12

Page 13: Supported by EU projects

let’s say we make the following request

../akif?q=dove&facets=set&set=oeorganiceprints&page_size=10&page=1

13

the response

Page 14: Supported by EU projects

14

the responseResponse: { "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

Page 15: Supported by EU projects

Contents

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

the search-API

15

Page 16: Supported by EU projects

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

Page 17: Supported by EU projects

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

Page 18: Supported by EU projects

18

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

Page 19: Supported by EU projects

19

Step 1Download the source code from githubhttps://github.com/agroknow/ak-finder

tutorial : how to build a finder over search-api

Page 20: Supported by EU projects

20

tutorial : how to build a finder over search-api

Step 2Understand 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

Page 21: Supported by EU projects

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

Page 22: Supported by EU projects

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 :)

Page 23: Supported by EU projects

23

tutorial : how to build a finder over search-api

Step 3The 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"] },

Page 24: Supported by EU projects

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"]

Page 25: Supported by EU projects

25

tutorial : how to build a finder over search-apiStep 4

Configure the finder : configuration + UI

Page 26: Supported by EU projects

26

tutorial : how to build a finder over search-apiStep 4

Configure the finder : configuration + UI

Page 27: Supported by EU projects

27

tutorial : how to build a finder over search-apiStep 5

Match it with your style :)

Page 28: Supported by EU projects

28

tutorial : how to build a finder over search-apiStep 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.

Page 29: Supported by EU projects

Thank you!

Mathioudakis TheodoreAgro-Know [email protected]