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
Index map annotations (Fix #12318) #3383
Conversation
In order for the name-value pairs attach to objects to be searchable by Lucene, a handler for the map annotations needed to be added.
if (nvs != null && nvs.size() > 0) { | ||
for (NamedValue nv : nvs) { | ||
if (nv != null) { | ||
logger().error("{}={}", nv.getName(), nv.getValue()); |
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.
"in progress" things to be removed before final merge, I guess
Thanks, @mtbc. Pushed. |
for (NamedValue nv : nvs) { | ||
if (nv != null) { | ||
logger().error("{}={}", nv.getName(), nv.getValue()); | ||
add(document, nv.getName(), nv.getValue(), opts); |
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.
I wonder if we want a standard prefix before map keys. (Even also using the map name, if it has a name?) So, they don't collide with other search field names.
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.
Happy to entertain concrete suggestions. My thinking was that even a collision would still return proper search results. A prefix will require users to know to add it. Shrugs Both perhaps?
2740a65
to
83dd361
Compare
Search works like expected. I just wonder what the "map.key" is about. |
Using
but
Is this useful? |
Ah ok, yes, I think it makes sense; one would expect to find something by just searching for a name/key only. |
Would "has_key:foo" be better/clearer? |
@dominikl @pwalczysko @jburel @will-moore : any thoughts on this? |
@joshmoore : Sorry, not sure about 2 things
|
If I search for |
Do we need any changes on the client side for this PR? Any changes in how we parse queries? |
I don't think so. The only thing you would need to decide is if you ever want to work with
Do you mean
The former is proper Lucene syntax. The second (if it works) is an odd by-product of our string parsing.
I'm not sure if that's allowed by the clients, but certainly on the CLI you could type this to find all images that have a certain key. (At the moment,
Yes, it's just the question of which name is most understandable.
I believe this to be the case, yes. |
@joshmoore : Thanks. |
Pushed. |
If I understood this right, the name "map.key" or "has_key" doesn't matter on the client side (just an issue on the backend), so there's nothing specific to test for that in the clients, right? |
Just to be clear: so there's currently no way to make use of "X:" from the clients at the momonet? i.e. it's parsed away? |
Yes, at the moment all non-alphanummeric characters (except _ are replaced with a space). Ok that actually means I didn't understand this right, "has_key:xxx" is an expression the user should be able to type in order to search for a specific key only? |
The expectation is that if "has_key:foo" is passed that this would only find fields with exactly that key. Though the LuceneQueryBuilder removes the ":", the queries still seem to work as expected.
For me all the tests are now green. I pushed a few more to looking into #3383 (comment) (namely joshmoore@9b22776) which all seem to be fine. (Minimal) documentation has been opened. Assuming we don't want to start indexing more in this PR, I'd say it's good to go once the next run of the integration tests are green unless there are any questions/objections on the client-side. |
NB: re: "Which other map columns to index?" -- the only other 2 objects which would be useful to index onto the image would be the GenericLightSource and ImagingEnvironment. At the moment, though, we haven't done anything with those objects, so likely that would be more effort than we want to expend. |
Comment fixed. As I said, my assumption is that all these tests are green. If it's better to have this in m4, I'm happy to handle any test adjustments in subsequent PRs. |
Index map annotations (Fix #12318)
In order for the name-value pairs attach to objects
to be searchable by Lucene, a handler for the map
annotations needed to be added.
To discuss/do:
To test:
--no-rebase