openbudgets / rudolf

rudolf is the stepbrother of babbage for RDF datasets
1 stars 0 forks source link

Search-endpoint for Rudolf #22

Closed schmaluk closed 7 years ago

schmaluk commented 7 years ago

The Microsite is using the Search-Endpoint of OS-platform for context assist, for example: http://next.openspending.org/search/package?q=arag&size=10 i.e. http://next.openspending.org/search/package?q%3Daraq%26size%3D10

But in order to work with Rudolf, we would need filtered results returned by Rudolf: http://eis-openbudgets.iais.fraunhofer.de/search/package?q=arag&size=10 i.e. http://eis-openbudgets.iais.fraunhofer.de/search/package?q%3Daraq%26size%3D10

Would that be possible?

larjohn commented 7 years ago

This functionality has been implemented in a recent commit

schmaluk commented 7 years ago

The latest commit is deployed: 66a6c64c8fc78298cc387498a0aa818d7915e814 However the Endpoint http://eis-openbudgets.iais.fraunhofer.de/search/package?q%3Darag%26size%3D10 still returns also the results from Thessaloniki and not only the filtered results for Aragon. (Did a refresh of the Cache as well.)

schmaluk commented 7 years ago

Rudolf is returning: http://eis-openbudgets.iais.fraunhofer.de/search/package?size=10000 the only global cube but not all of them. So the Explorer doesnt show up all datasets but the just the global one.

larjohn commented 7 years ago

This will be resolved tonight

larjohn commented 7 years ago

Ctrl+F5 and it works as requested

schmaluk commented 7 years ago

Sorry, have deployed the latest commit of Rudolf 941f29ae1d7c588daebd3a3b0143104113711a41 but Rudolf still seems to behave bit different from the OS-API.

larjohn commented 7 years ago

http://eis-openbudgets.iais.fraunhofer.de/search/package?q=thess&size=10

now should work as expected. I am not sure why we need the escaped version.

larjohn commented 7 years ago

Another issue is that the empty request (just search/package) returns empty in the EIS server, while on mine it contains all the results. This is due to the query parsing of the servers. In my local apache server I get this $_SERVER variable:

array:56 [▼
  "REDIRECT_STATUS" => "200"
  "HTTP_HOST" => "ws307.math.auth.gr"
  "HTTP_CONNECTION" => "keep-alive"
  "HTTP_UPGRADE_INSECURE_REQUESTS" => "1"
  "HTTP_USER_AGENT" => "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"
  "HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
  "HTTP_ACCEPT_ENCODING" => "gzip, deflate, sdch"
  "HTTP_ACCEPT_LANGUAGE" => "en,el;q=0.8,en-US;q=0.6"
  "HTTP_COOKIE" => "_ga=GA1.2.1910467759.1459251749"
  "SERVER_SIGNATURE" => "<address>Apache/2.4.17 (Win64) PHP/7.0.0 Server at ws307.math.auth.gr Port 80</address>\n"
  "SERVER_SOFTWARE" => "Apache/2.4.17 (Win64) PHP/7.0.0"
  "SERVER_NAME" => "ws307.math.auth.gr"
  "SERVER_ADDR" => "155.207.126.2"
  "SERVER_PORT" => "80"
  "REMOTE_ADDR" => "77.49.22.60"
  "REQUEST_SCHEME" => "http"
  "CONTEXT_PREFIX" => ""
  "SERVER_ADMIN" => "admin@example.com"
  "REMOTE_PORT" => "55561"
  "REDIRECT_URL" => "http://ws307.math.auth.gr/rudolf/public/search/package"
  "GATEWAY_INTERFACE" => "CGI/1.1"
  "SERVER_PROTOCOL" => "HTTP/1.1"
  "REQUEST_METHOD" => "GET"
  "QUERY_STRING" => ""
  "REQUEST_URI" => "/rudolf/public/search/package"
  "SCRIPT_NAME" => "/rudolf/public/index.php"
  "PHP_SELF" => "/rudolf/public/index.php"
  "REQUEST_TIME_FLOAT" => 1490335477.577
  "REQUEST_TIME" => 1490335477
  "APP_ENV" => "local"
  "APP_DEBUG" => "true"
  "APP_KEY" => "VKcE8XiSzATwkVnSRUg98mnWL2KPTSEh"
  "DB_HOST" => "127.0.0.1"
  "DB_DATABASE" => "homestead"
  "DB_USERNAME" => "homestead"
  "DB_PASSWORD" => "secret"
  "CACHE_DRIVER" => "file"
  "SESSION_DRIVER" => "file"
  "QUEUE_DRIVER" => "sync"
  "REDIS_HOST" => "127.0.0.1"
  "REDIS_PASSWORD" => "null"
  "REDIS_PORT" => "6379"
  "MAIL_DRIVER" => "smtp"
  "MAIL_HOST" => "mailtrap.io"
  "MAIL_PORT" => "2525"
  "MAIL_USERNAME" => "null"
  "MAIL_PASSWORD" => "null"
  "MAIL_ENCRYPTION" => "null"
]

while on EIS nginx (?):

array:45 [▼
  "PHP_FILENAME" => "php-7.0.7.tar.xz"
  "PHP_EXTRA_CONFIGURE_ARGS" => "--enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data"
  "PHP_INI_DIR" => "/usr/local/etc/php"
  "HOSTNAME" => "4ef0163fcf96"
  "SHLVL" => "1"
  "OLDPWD" => "/"
  "HOME" => "/root"
  "PHP_VERSION" => "7.0.7"
  "GPG_KEYS" => "1A4E8B7277C42E53DBA9C7B9BCAA30EA9C0D5763"
  "PATH" => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
  "PWD" => "/var/www/rudolf"
  "PHPIZE_DEPS" => "autoconf \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkgconf \t\tre2c"
  "PHP_SHA256" => "9cc64a7459242c79c10e79d74feaf5bae3541f604966ceb600c3d2e8f5fe4794"
  "USER" => "root"
  "HTTP_ACCEPT_LANGUAGE" => "en,el;q=0.8,en-US;q=0.6"
  "HTTP_ACCEPT_ENCODING" => "gzip, deflate, sdch"
  "HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
  "HTTP_USER_AGENT" => "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"
  "HTTP_UPGRADE_INSECURE_REQUESTS" => "1"
  "HTTP_CACHE_CONTROL" => "max-age=0"
  "HTTP_CONNECTION" => "keep-alive"
  "HTTP_HOST" => "eis-openbudgets.iais.fraunhofer.de"
  "REDIRECT_STATUS" => "200"
  "SERVER_NAME" => "eis-openbudgets.iais.fraunhofer.de"
  "SERVER_PORT" => "80"
  "SERVER_ADDR" => "172.20.0.4"
  "REMOTE_PORT" => "55520"
  "REMOTE_ADDR" => "77.49.22.60"
  "SERVER_SOFTWARE" => "nginx/1.10.2"
  "GATEWAY_INTERFACE" => "CGI/1.1"
  "REQUEST_SCHEME" => "http"
  "SERVER_PROTOCOL" => "HTTP/1.1"
  "DOCUMENT_ROOT" => "/var/www/rudolf/public"
  "DOCUMENT_URI" => "/index.php"
  "REQUEST_URI" => "/search/package"
  "SCRIPT_NAME" => "/index.php"
  "CONTENT_LENGTH" => ""
  "CONTENT_TYPE" => ""
  "REQUEST_METHOD" => "GET"
  "QUERY_STRING" => "q=search/package"
  "SCRIPT_FILENAME" => "/var/www/rudolf/public/index.php"
  "FCGI_ROLE" => "RESPONDER"
  "PHP_SELF" => "/index.php"
  "REQUEST_TIME_FLOAT" => 1490335450.9192
  "REQUEST_TIME" => 1490335450
]

Notice the REQUEST_URI. It should be empty. This seems to be a URL rewriting issue. Can you take care of that?

liyakun commented 7 years ago

@larjohn thank you, I changed the URL rewriting, and http://eis-openbudgets.iais.fraunhofer.de/search/package works as expected now and the OS-explorer also works as expected. However the OS-viewer still has problem.

liyakun commented 7 years ago

@larjohn It seems "http://ws307.math.auth.gr:5001/budget-thessaloniki-expenditure-2015__fa25b" has the same problem with http://eis-openbudgets.iais.fraunhofer.de/viewer/budget-athens-expenditure-2007__5d543, do you may have any idea about why this happen? thanks.

larjohn commented 7 years ago

I suppose you mean the CORS policy issue:

HttpRequest cannot load http://next.openspending.org/user/check?next=http:%2F%2Feis-openbudgets.iais.fraunhofer.de%2Fviewer%2Fbudget-athens-expenditure-2007__5d543. Redirect from 'http://next.openspending.org/user/check?next=http:%2F%2Feis-openbudgets.iais.fraunhofer.de%2Fviewer%2Fbudget-athens-expenditure-2007__5d543' to 'https://next.openspending.org/user/check?next=http:%2F%2Feis-openbudgets.iais.fraunhofer.de%2Fviewer%2Fbudget-athens-expenditure-2007__5d543' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://eis-openbudgets.iais.fraunhofer.de' is therefore not allowed access.

I am not really sure on which side this should be resolved. @pwalsh do you have any idea?

liyakun commented 7 years ago

@larjohn thanks, yes, by accessing "https://next.openspending.org/user/check?next=http:%2F%2Feis-openbudgets.iais.fraunhofer.de%2Fviewer%2Faragon-2006-expenditure__a0a36", I got

{ "authenticated": false, "providers": { "google": { "url": "https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=791676150192-bc2q51rttplg10c82gcl7a62ckfaquuj.apps.googleusercontent.com&redirect_uri=https%3A%2F%2Fnext.openspending.org%2Foauth%2Fgoogle_callback&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&state=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuZXh0IjoiaHR0cDovL2Vpcy1vcGVuYnVkZ2V0cy5pYWlzLmZyYXVuaG9mZXIuZGUvdmlld2VyL2FyYWdvbi0yMDA2LWV4cGVuZGl0dXJlX19hMGEzNiIsInByb3ZpZGVyIjoiZ29vZ2xlIiwibmJmIjoxNDkzMTUyNDUyLCJleHAiOjE0OTMxNTMwNTJ9.CJO0iLXGY9hC1WPTCC8gYtXWyi9fv98jGm_wLixjxuI" } } }