Skip to content

Add phrase_limit to highlighting #2959

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 19, 2017
Merged

Conversation

russcam
Copy link
Contributor

@russcam russcam commented Dec 15, 2017

  • Change order from string to HighlighterOrder?
  • Change TagsSchema from string to HighlighterTagsSchema?
  • Remove BoundaryMaxSize
  • Change Encoder to HighlighterEncoder?
  • Remove encoder from highlight fields as it is only valid on the top level highlighter
  • Add Encoder and PhraseLimit to integration test

Requires backporting to 5.x and 2.x in a non-binary breaking way.

Closes #2851

- Change order from string to HighlighterOrder?
- Change TagsSchema from string to HighlighterTagsSchema?
- Remove BoundaryMaxSize
- Change Encoder to HighlighterEncoder?
- Remove encoder from highlight fields as it is only valid on the top level highlighter
- Add Encoder and PhraseLimit to integration test

Closes #2851
Copy link
Contributor

@codebrain codebrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM aside from some very minor questions...

@@ -215,13 +206,13 @@ public class HighlightDescriptor<T> : DescriptorBase<HighlightDescriptor<T> ,IHi
);

// <inheritdoc/>
public HighlightDescriptor<T> TagsSchema(string schema = "styled") => Assign(a => a.TagsSchema = schema);
public HighlightDescriptor<T> TagsSchema(HighlighterTagsSchema? schema) => Assign(a => a.TagsSchema = schema);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No default value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can make it the default, but the client generally doesn't have default values for nullable enums. I suspect this had a default value more as a hint for the accepted string value.


// <inheritdoc/>
public HighlightDescriptor<T> RequireFieldMatch(bool requireFieldMatch) => Assign(a => a.RequireFieldMatch = requireFieldMatch);
public HighlightDescriptor<T> RequireFieldMatch(bool requireFieldMatch = true) => Assign(a => a.RequireFieldMatch = requireFieldMatch);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New default of true changes behaviour - is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's intentional. Where methods take a bool parameter and the calling of the method is a positive intent (i.e. enables something), a default parameter value of true should be passed. I thought we had a test for this, but the test is for bool?:

public void DescriptorMethodsAcceptNullableBoolsForQueriesWithNullableBoolProperties()

This should be updated to accept bool?. I think we also need a sweep before release to ensure we're adhering to this convention.

@@ -238,7 +241,7 @@ public class HighlightFieldDescriptor<T> : DescriptorBase<HighlightFieldDescript
public HighlightFieldDescriptor<T> AllField() => this.Field("_all");

/// <inheritdoc/>
public HighlightFieldDescriptor<T> TagsSchema(string schema = "styled") => Assign(a => a.TagsSchema = schema);
public HighlightFieldDescriptor<T> TagsSchema(HighlighterTagsSchema? schema) => Assign(a => a.TagsSchema = schema);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can make it the default, but the client generally doesn't have default values for nullable enums. I suspect this had a default value more as a hint for the accepted string value.

@russcam
Copy link
Contributor Author

russcam commented Dec 18, 2017

Changed the parameter to a bool? with a default value. @codebrain would you mind taking another quick look please?

@russcam russcam merged commit b018a97 into master Dec 19, 2017
@russcam
Copy link
Contributor Author

russcam commented Dec 19, 2017

Ported to:

@russcam russcam deleted the fix/highlighting-phrase-limit branch December 19, 2017 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants