-
Notifications
You must be signed in to change notification settings - Fork 244
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
HSEARCH-5021 Improve support for custom value bridges for vector fields #3863
HSEARCH-5021 Improve support for custom value bridges for vector fields #3863
Conversation
...per/pojo/mapping/definition/annotation/processing/impl/AbstractFieldAnnotationProcessor.java
Outdated
Show resolved
Hide resolved
...per/pojo/mapping/definition/programmatic/impl/PropertyMappingVectorFieldOptionsStepImpl.java
Outdated
Show resolved
Hide resolved
9c8b8b0
to
ec08362
Compare
Hey @marko-bekhta is this ready for review? |
hmm, good question 😃, looking at the changes, I don't see something to add... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From https://hibernate.atlassian.net/browse/HSEARCH-5021:
At the moment (as of https://hibernate.atlassian.net/browse/HSEARCH-4948 ), if someone was to write a custom binder for vector fields with a custom field type:
- They need to know about the number of dimensions, because that’s a mandatory parameter of IndexFieldTypeFactory#asVector… but they don't have access to the number passed to
@VectorField#dimension
.- If they want to force the number of dimensions (because their bridge always produces vectors with a certain number of dimensions), users of the binder will still need to pass something to
@VectorField#dimension
in the mapping. Even though that value will never be used…
Does this PR addresses any of that? I'm honestly not sure :x
Perhaps it would be best to add/find an integration test for each of those:
- A custom bridge that turns for example a
List<Float>
into afloat[]
, and declares the field type explicitly as projectable by default, but doesn't know about the number of dimensions. Users must provide the number of dimensions in@VectorField
. - A custom bridge that turns for example a
Triplet<Float, Float, Float>
into afloat[]
, and declares the field type explicitly with dimensions=3. Users must not be forced to provide a number of dimensions in@VectorField
.
I think org.hibernate.search.integrationtest.mapper.pojo.mapping.definition.VectorFieldIT#customBridge_explicitFieldType
already addresses the second item.
I can't find something about the first, though... Which I guess makes sense, since org.hibernate.search.engine.backend.types.dsl.IndexFieldTypeFactory#asVector
forces you to pass a number of dimensions ATM?
Right. And the initial idea was to add annotation attributes ( Now if we want to allow calls like |
Thanks for your pull request! This pull request appears to follow the contribution rules. › This message was automatically generated. |
21b743a
to
fdf049c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now if we want to allow calls like
asVector()
without an initial dimension value ... I suppose we can do that
Thanks, looks like this addresses the issue completely! A few comments below.
but that would mean reverting the changes we've done in the other PR...
Yeah sorry about that. I guess I failed to consider this use case when I suggested that change in the initial PR...
the initial idea was to add annotation attributes (@Vectorfield ones in particular) to the parameters so that the user would have access to dimension value from the annotation and could pass it to asVector call ...
Right, and that created a few problems.
but then you were saying that that would be a users-writes-their-own-annotation-and-processor case so I assumed that that covers it and nothing to be done about it 😄...
Yeah I was just talking about the specific case where the binder needs to get the number of dimensions as a parameter. Not about cases where the binder doesn't need to know about the number of dimensions (because it's implied by input).
engine/src/main/java/org/hibernate/search/engine/backend/types/dsl/IndexFieldTypeFactory.java
Outdated
Show resolved
Hide resolved
engine/src/main/java/org/hibernate/search/engine/backend/types/dsl/IndexFieldTypeFactory.java
Outdated
Show resolved
Hide resolved
engine/src/main/java/org/hibernate/search/engine/backend/types/dsl/IndexFieldTypeFactory.java
Outdated
Show resolved
Hide resolved
backend/lucene/src/main/java/org/hibernate/search/backend/lucene/logging/impl/Log.java
Outdated
Show resolved
Hide resolved
backend/lucene/src/main/java/org/hibernate/search/backend/lucene/logging/impl/Log.java
Outdated
Show resolved
Hide resolved
fdf049c
to
32972ef
Compare
yeah, no worries 😃 and sorry that I didn't catch it that we should make these changes from your initial review 🙈 😃. I've applied your suggestions and cleaned up |
32972ef
to
ccf283a
Compare
...bernate/search/integrationtest/mapper/pojo/standalone/realbackend/mapping/VectorFieldIT.java
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
https://hibernate.atlassian.net/browse/HSEARCH-5021
This is just a draft for now so we can talk over the code 😃