1 / 29

Supported by EU projects

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

foster
Download Presentation

Supported by EU projects

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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

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

  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. search-api • 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. useful calls for search-api 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

  10. useful calls for search-api 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

  11. useful calls for search-api 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

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

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

  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 14

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

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

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

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

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

  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 20

  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 21

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

  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"] }, 23

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

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

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

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

  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. 28

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

More Related