oceanduan / solr-php-client

Automatically exported from code.google.com/p/solr-php-client
Other
0 stars 0 forks source link

allow_url_fopen still required to extract URLs #59

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This is a feature request; priority is low, as an easy workaround exists.

What steps will reproduce the problem?
1. Attempt to call Service::extract() with $file set to a URL, e.g. 
http://www.google.com
2. If allow_url_fopen is enabled, the file_get_contents() call will retrieve 
the URL contents and index it; if not enabled, an 
Apache_Solr_InvalidArgumentException is thrown.

The workaround is to extract the URL contents and pass it in as a separate 
argument instead.

Original issue reported on code.google.com by liam.obo...@gmail.com on 3 Feb 2011 at 11:52

GoogleCodeExporter commented 8 years ago
The extract method works under the assumption of an actual file, so its just 
using file_get_contents. I have two-ish ideas for how to best address your 
request.

 1. Have extract use the instance's configured HTTP transport instance when it sees the file path starts with http:// or https://
 2. Keep extract as it is, but provide an additional extractFromUrl method, that always uses the configured HTTP transport instance.
 3. combine 1 and 2, provide a new Url specific extract method that always uses the http transport and have the extract method delegate to it when it detects and http:// or https:// file path.

I'm inclined towards 3, would that make sense for you?

Original comment by donovan....@gmail.com on 4 Feb 2011 at 2:54

GoogleCodeExporter commented 8 years ago
#3 sounds fine.  

As noted though, it's simple enough for the caller to just extract the URL 
contents themselves and pass it through to be indexed, so don't rush yourself - 
I'd prefer the patches on 51 and 43 be integrated so I can go back to using the 
trunk version of SPC :)

Original comment by liam.obo...@gmail.com on 5 Feb 2011 at 12:41

GoogleCodeExporter commented 8 years ago
Changes committed in r59

Original comment by donovan....@gmail.com on 8 Feb 2011 at 8:39

GoogleCodeExporter commented 8 years ago
Thanks, quick work!

Original comment by liam.obo...@gmail.com on 8 Feb 2011 at 11:23