Hi Josh,
my bridge code looks like
- Code: Select all
public void set(final String name, final Object value,
final Document document, final LuceneOptions _opts) {
if (value instanceof Image) {
logger().info("Scheduling all Experiment Files of " + value + " for re-indexing");
// do some other thing
} else if (value instanceof DatasetImageLink) {
// run my python code
}
}
But everytime I import images through importer, it looks like it does not go into the DatasetImageLink block (rather, it goes into Image block).
In this case, could you tell me how to inherit the DatasetImageLink object from Image (value) object?
can I just cast it? like
- Code: Select all
public void set(final String name, final Object value,
final Document document, final LuceneOptions _opts) {
if (value instanceof Image) {
DatasetImageLink link = (DatasetImageLink) value;
}
}
(Updated: I think I figured out how to get dataset ID from Image instance. I could get it by unmodifiedDataset or something, which I don't remember now)
In addition, when I looked into the Indexer, it seems like the bridge was called twice (when I imported ONE image. is this common?
(I recognized that it was called twice, because the INFO "Scheduling all Experiment Files ..." was written twice at almost same time, which is included in my code.)
2011-04-18 12:29:32,355 INFO [.cmu.search.bridges.ExperimentFileBridge] (3-thread-2) Scheduling all Experiment Files of ome.model.core.Image:Id_8251 for re-indexing
2011-04-18 12:29:32,658 INFO [ ome.services.fulltext.EventBacklog] (3-thread-2) Added to backlog:ome.model.core.Image:Id_8251
2011-04-18 12:29:33,108 INFO [ ome.services.fulltext.FullTextIndexer] (3-thread-2) INDEXED 9 objects in 1 batch(es) [1085 ms.]
2011-04-18 12:29:36,033 INFO [.cmu.search.bridges.ExperimentFileBridge] (3-thread-5) Scheduling all Experiment Files of ome.model.core.Image:Id_8251 for re-indexing
2011-04-18 12:29:36,104 INFO [ ome.services.fulltext.FullTextIndexer] (3-thread-5) INDEXED 1 objects in 1 batch(es) [88 ms.]
2011-04-18 12:29:40,187 INFO [ ome.services.fulltext.FullTextIndexer] (3-thread-3) INDEXED 2 objects in 1 batch(es) [167 ms.]
Another question. (I'm really sorry that I have tons of stupid questions).
If I delete an image from OMERO DB, can I get the same event log? (such as "value instanceof Image" block).
In that case, how can I distinguish those cases between import and delete?
BK