telendt
Repos
22
Followers
55
Following
133

Coding challenge solution

0
0

Elasticsearch client for Go.

0
0

Coding challenge solution written in Kotlin + Spring Boot (WebFlux)

1
0

Backend Coding Challenge

0
0

Events

issue comment
SOLR-13219: Fix NPE in FieldLengthFeature with non-stored/missing fields

If would be wonderful if it could go to 9.1.0, that way we could probably skip patching ourselves (we need that in the place were I work). Either way, thank you for the review!

Created at 1 month ago
issue comment
SOLR-13219: Fix NPE in FieldLengthFeature with non-stored/missing fields

Does it look right?

Created at 1 month ago

Add a note to CHANGES.txt

Created at 1 month ago
issue comment
SOLR-13219: Fix NPE in FieldLengthFeature with non-stored/missing fields

Sure, can do. What's the rule? Should I put my name and yours as the reviewer?

Created at 1 month ago

Reformat changes with gradle tidy

Created at 1 month ago
issue comment
SOLR-13219: Fix NPE in FieldLengthFeature with non-stored/missing fields

Ouch, I see that some of the checks fail. Sorry about that, I only run tests. Will fix soon.

Created at 1 month ago
issue comment
SOLR-13219: Fix NPE in FieldLengthFeature with non-stored/missing fields

@cpoerschke: I would really appreciate if you could review this one as the original author of the code.

Created at 1 month ago
pull request opened
SOLR-13219: Fix NPE in FieldLengthFeature with non-stored/missing fields

This commit removes unnecessary check for omitNorms from FieldLengthFeatureScorer that otherwise causes NullPointerException in FieldLengthFeature for non-stored or missing fields.

https://issues.apache.org/jira/browse/SOLR-13219

Description

I recently encountered a problem with using FieldLengthFeature with non-stored fields where feature extraction/LTR reranking would result in NullPointerException. I check the FieldLengthFeature docs and briefly inspected implementation to check if for using this feature storing fields is really required. According to my expectations it's not required - the only required information are norms, that my field has enabled.

I search Solr Jira and found SOLR-13219 that seemed very similar in nature. Upon investigation I found that the two issues have indeed the same origin. The root cause seems to be the following line:

final IndexableField idxF = searcher.doc(0).getField(field);

That returns null for non-stored missing fields.

Honestly, I don't understand why FieldLengthFeatureScorer even checks whether the field omits norms or not. It's only used in FieldLengthFeature#scorer and this method already checks whether norms are there or not (and if they are missing a constant 0 ValueFeatureScorer is returned).

Solution

I removed the problematic code.

Tests

I modified title and description fields (stored="false") in schema.xml proving that existing tests still work as long as the problematic code is removed (without it TestFieldLength#testRanking is failing). With this change I also had to slightly change TestFeatureLogging#testGeneratedFeatures test, but without changing its logic.

I also added TestFieldLength#testRankingDynamicField test to prove that TestFieldLength works correctly with dynamic fields too, and doesn't fail if one (or more) documents from rerank candidate set lacks specific field.

Checklist

Please review the following and check all that apply:

  • [x] I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • [x] I have created a Jira issue and added the issue ID to my pull request title.
  • [x] I have given Solr maintainers access to contribute to my PR branch. (optional but recommended)
  • [x] I have developed this patch against the main branch.
  • [x] I have run ./gradlew check.
  • [x] I have added tests for my changes.
  • [ ] I have added documentation for the Reference Guide
Created at 1 month ago
create branch
telendt create branch jira/solr13219
Created at 1 month ago
Created at 1 month ago
issue comment
search_as_you_type, prefix queries and broken highligting

Yes, that's the workaround I used in the past.

Created at 2 months ago