Accessing Google App Engine's Search API from

2019-07-20 02:08发布

问题:

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.