BCLibraries / primo-services

MIT License
9 stars 4 forks source link

Various changes #18

Closed danmichaelo closed 8 years ago

danmichaelo commented 8 years ago

This replaces #17

1) Throw exception on error : Also added a sample error response that could be used in a test in the future (Afaics. the current PrimoServices.search method cannot be unit tested without refactoring).

2) Add a public method url() to get the URL for the query. Useful for debugging

3) Composer: Move phpunit to require-dev, and support 4.x

4) Query: Don't stringify query terms before needed, and add getters for terms and paramters. Useful e.g. when you need to check if you have added any terms yet or not.

danmichaelo commented 8 years ago

5) Added support for query_inc and query_exc. But it's not very elegant:

$queryTerm = new QueryTerm();
$queryTerm->set('facet_rtype', QueryTerm::EXACT, ['print-books', 'print-journals']);
$query->includeTerm($queryTerm);

Let me know what you think. I guess facet values are always exact? If so, perhaps a new class (with a shared interface) that could take multiple values could be an idea:

$facet= new Facet('rtype', ['print-books', 'print-journals]);
$query->includeFacet($facet);