Skip to content

Equal terms DocTransformer #3317

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

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Conversation

dsmiley
Copy link
Contributor

@dsmiley dsmiley commented Apr 9, 2025

JIRA TODO: https://issues.apache.org/jira/browse/SOLR-XXXXX

This is a sketch of a DocTransformer that emits a boolean field on the returned doc based on a document field being equal to an input stream, as compared by the analyzed text.
fl=id,isEqual:[equalterms field=subject value='John Smith']

I need this for work but looking for feedback on inclusion in Solr and naming and other things.

/**
* Gets the string field value, or null if not present or if found a list of values other than 1.
*/
private String getFieldValue(SolrDocument doc) {
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 don't love the instance checks here... I wish there was a better typed API contract on the expected types.

@@ -365,26 +366,45 @@ private SolrInputDocument addRandomDocument(final int docId)

final SolrInputDocument doc =
sdoc(
"id", "" + docId,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the newline placements are unfortunate; I can try to restore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant