Accessing Google App Engine's Search API from PHP

元气小坏坏 提交于 2020-01-24 18:50:48

问题


Is there anyway to do this? I've looked in the google-api-php-client library but it's not there yet. Is there any other way or am I out of luck?


回答1:


The search API is only enabled for Python Java and Go, as Mario pointed out.

I would look into the modules documentation and try to separate your logic. Your search API can be the only module that isn't in PHP. There is no other solution for your problem unfortunately.




回答2:


The team promised that a REST API would be made available at Google I/O 2011. I haven't been able to find any follow ups since.

https://www.youtube.com/watch?v=7B7FyU9wW8Y#t=2088




回答3:


You CAN now access the Search API natively from PHP.

The library is in alpha but should make its way to release fairly soon.

It uses the Google Protocol Buffers so it's the same level of abstraction as the Python/Java/Go SDKs

https://github.com/tomwalder/php-appengine-search

Feedback appreciated!

I ran into this problem previously, so wrote a sample PHP+Python module pair to allow access to search via URL fetch to a Python module.

https://github.com/tomwalder/phpne14-text-search




回答4:


I have a similar scenario as you. This might not be the best solution, but I've solved it as follows: I've created a Python module using Google Endpoints API to expose a set of methods capable of sending and receiving JSON formatted data via HTTP GET or POST. These methods allow me create Documents and Indexes or do queries. My PHP client, simply calls these urls and passes appropriate data. So effectively I have a wrapper around the search API and the python stuff is hidden inside.



来源:https://stackoverflow.com/questions/26005906/accessing-google-app-engines-search-api-from-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!