>
> > > If you are using Solr via PHP and would like to see any new features in
> > the
> > > extension please feel free to send me a note.
>

I'm new to this list, but in seeing this thread - and using PHP SOLR - I
wanted to make a suggestion that - while minor - I think would greatly
improve the quality of the extension.

(I'm basing this mostly off of SolrQuery since that's where I've encountered
the issue, but this might be true elsewhere)

Whenever a method is supposed to return an array (i.e.,
SolrQuery::getFields(), SolrQuery::getFacets(), etc), if there is no data to
return, a null is returned. I think that this should be normalized across
the board to return an empty array. First, the documentation is
contradictory (http://us.php.net/manual/en/solrquery.getfields.php) in that
the method signature says that it returns an array (not mixed), while the
Return Values section says that it returns either an array or null.
Secondly, returning an array under any circumstance provides more
consistency and less logic; for example, let's say that I am looking for the
fields (as-is in its current state):

<?php
// .. assume a proper set up
if ($solrquery->getFields() !== null) {
    foreach ($solrquery->getFields() as $field) {
        // Do something
    }
}
?>

This is a minor request, I know. But, I feel that it would go a long way
toward polishing the extension up for general consumption.

Thank you,

Ken Stanley

PS. I apologize if this request has come through the pipes already; as I've
stated, I am new to this list; I have yet to find any reference to my
request. :)

Reply via email to