Skip to content

Switch to using refactored SortBuilder instead of using BytesReference in serialization#17205

Merged
cbuescher merged 4 commits intoelastic:masterfrom
cbuescher:sort-use-sortbuilders
Mar 23, 2016
Merged

Switch to using refactored SortBuilder instead of using BytesReference in serialization#17205
cbuescher merged 4 commits intoelastic:masterfrom
cbuescher:sort-use-sortbuilders

Conversation

@cbuescher
Copy link
Copy Markdown
Member

This is based on #17146 that needs to get in first. It moves the remaining parsing logic for the complete sort-element over to SortBuilder#fromXContent and moves further logic that used to be in SortParseElement concerned with building SortFields and populating the search context with it also to SortBuilder.
In a last step for the refactoring the current workaround of using opaque BytesReference lists in SearchSourceBuilder and similar places it removed and the refactored SortBuilders used instead.

Closes #17257

@cbuescher
Copy link
Copy Markdown
Member Author

@MaineC this is still WIP since it relies on first adding the build() methods to the SortBuilders (see linked PR), but I went ahead to see how much is missing to really cut over to using the refactored SortBuilders in the SearchSourceBuilder and was able to get it working by moving over most of the current parsing logic into SortBuilder. Unfortunately this makes it a quiet large PR, but half of the changes come from #17146 and should go away once that is in.

@cbuescher cbuescher force-pushed the sort-use-sortbuilders branch from df70b8a to 1987f98 Compare March 20, 2016 20:44
@cbuescher cbuescher force-pushed the sort-use-sortbuilders branch 3 times, most recently from 929ab51 to 6d127bb Compare March 23, 2016 12:14
@cbuescher cbuescher changed the title WIP: Use refactored SortBuilder, replace SortParseElement Switch to using refactored SortBuilder instead of using BytesReference in serialization Mar 23, 2016
@cbuescher cbuescher removed the WIP label Mar 23, 2016
…ewhere

Switching from using list of BytesReference to real SortBuilder list in
SearchSourceBuilder, TopHitsAggregatorBuilder and TopHitsAggregatorFactory.
Removing SortParseElement and related sort parsers.
@cbuescher cbuescher force-pushed the sort-use-sortbuilders branch from 6d127bb to 0acb373 Compare March 23, 2016 12:50
@cbuescher
Copy link
Copy Markdown
Member Author

@MaineC after merging the two related PRs, this PR should only contain the changes that where necessary to make the switch from List to List in SearchSourceBuilder and related similar places where we used List for the sort. Some IT tests failures revealed problems (like storing "missing" String as BytesRef in FieldSortBuilder) that are also addressed here. I think this is ready to take a look.

@cbuescher cbuescher force-pushed the sort-use-sortbuilders branch from 0acb373 to f8e7462 Compare March 23, 2016 13:11
 Conflicts:
	core/src/main/java/org/elasticsearch/common/io/stream/StreamInput.java
@MaineC
Copy link
Copy Markdown

MaineC commented Mar 23, 2016

Just went over the code. Really love the amount of code that goes away after this is merged. Also like the added tests, even if checks are kept simple at the moment. So here's my LGTM

Caveats: Didn't run the test suite here. Also we might want to add a ticket that describes where tests could be improved (like e.g. more assertions) so those don't get forgotten.

@cbuescher
Copy link
Copy Markdown
Member Author

@MaineC @colings86 I added the last commit to show that we can now again parse syntax mentioned in #17257

@cbuescher cbuescher merged commit a3fc4c0 into elastic:master Mar 23, 2016
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Search Refactoring labels Feb 14, 2018
@cbuescher cbuescher deleted the sort-use-sortbuilders branch March 20, 2024 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :Search/Search Search-related issues that do not fall into other categories v5.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants