Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've worked for some time now with decomposing the "Libris Search" code into smaller and more appropriate classes. This is how far I've come and hopefully the classes make much more sense now. Extensive tests are still lacking; untangling the whole thing required more effort than I expected. Some unit tests are the only thing I've had time to add so far.
The functionality should be more or less the same, however many minor flaws and hard coding have been addressed along the way. For example we now load filters from definitions instead of declaring them in the code. See libris/definitions#490. (Note: Required!)
Except for more tests, TODOs in the code, naming etc. there are a couple of other things that probably should be addressed:
search2
inwhelk-core
just to keep them together. Exactly what parts should belong towhelk-core
and what should be in therest
module I'm not sure but it's something that needs to be figured out.Disambiguate
andQueryUtil
, where the former is supposed be used for operations requiring vocab resources while the latter is more for general methods that are either used by several classes or require aWhelk
instance. There is a bit of an overlap between these two classes however and I'm not sure that they make total sense.Even though it's far from perfect we should probably merge this ASAP before adding new features. There are of course no guarantees that it doesn't introduce new bugs but if that happens it should at least be a lot easier now to address them and to add tests preventing them from appearing again. I've tested fairly thoroughly by hand without finding any obvious (new) flaws. Adding new features in a sustainable way should hopefully also be a lot easier going forward.
This PR is huge, I know, sorry! But since it was so tangly to begin with it was really difficult to do this methodically piece by piece. Hence why there are only two commits; there were so many of the intermediate commits that didn't make sense in isolation so I figured it was better to just squash them all together.