Warning: Can't synchronize with repository "(default)" (/home/git/ome.git does not appear to be a Git repository.). Look in the Trac log for more information.
Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

Task #9337 (closed)

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

Bug: Search returns results that it should not after removing tags

Reported by: sylittlewood Owned by: jamoore
Priority: major Milestone: OMERO-4.4
Component: General Version: n.a.
Keywords: n.a. Cc:
Resources: n.a. Referenced By: n.a.
References: n.a. Remaining Time: 0.0d
Sprint: n.a.

Description

An issue was found when removing tags from an image where they were still being returned from the search query even though the tag had been removed. Suspect that the search index is not being updated when the tag is removed. Waited a few hours and preformed the search again, image still coming back in search results.

  1. Search for [Tag] = no results
  2. Annotate an image with [Tag].
  3. Search for [Tag] = Image found
  4. Remove [Tag] from the image
  5. Search for [Tag] = Image still found

Change History (5)

comment:1 Changed 12 years ago by jmoore

After changes to the triggers, this script:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import time
def WAIT():
    print "Sleeping ",10
    time.sleep(10)

import sys
sys.path.insert(0, "dist/lib/python")

import omero
import omero.gateway

c = omero.client()
s = c.createSession()

g = omero.gateway.BlitzGateway(client_obj=c)
W = g._waitOnCmd

u = s.getUpdateService()
S = u.saveAndReturnObject

q = s.getQueryService()
F = q.findAllByFullText
Q = q.findAllByQuery

rt = omero.rtypes.rtime
rs = omero.rtypes.rstring

for i in Q("select i from Image i where i.name = 'foo'", None):
    print "Deleting image", i.id.val
    W(g.deleteObjects("/Image", [i.id.val], deleteAnns=True))

for c in Q("select c from CommentAnnotation c where c.textValue in ('bar', 'baz')", None):
    print "Deleting comment", c.id.val
    W(g.deleteObjects("/Annotation", [c.id.val], deleteAnns=True))

print "Creating image...",
i = omero.model.ImageI()
i.acquisitionDate = rt(0)
i.name = rs("foo")
i = S(i)
print i.id.val

print "Creating comment 'bar' and linking...",
c = omero.model.CommentAnnotationI()
c.textValue = rs("bar")
l = i.linkAnnotation(c)
l = S(l)
c = l.child
print c.id.val

def T(type, string, length=1):
    results = F(type, string, None)
    print "Found %s %s(s) for: '%s'" % (len(results), type, string)
    if len(results) != length:
        raise Exception("Found %s; Expected %s" % (len(results), length))


WAIT()

T("Image", "foo")
T("Image", "bar")
T("CommentAnnotation", "bar")
T("CommentAnnotation", "baz", length=0)

print "Changing to 'baz'..."
c.textValue = rs("baz")
c = S(c)

WAIT()

T("Image", "foo")
T("Image", "baz")
T("CommentAnnotation", "baz")

T("Image", "bar", length=0)
T("CommentAnnotation", "bar", length=0)

print "Changing to 'unlinking'..."
u.deleteObject(l)

WAIT()

T("Image", "foo")
T("CommentAnnotation", "baz")

T("Image", "baz", length=0)
T("Image", "bar", length=0)
T("CommentAnnotation", "bar", length=0)

is now passing:

$ ./find.py 
Deleting comment 122
Creating image... 151
Creating comment 'bar' and linking... 201
Sleeping  10
Found 1 Image(s) for: 'foo'
Found 1 Image(s) for: 'bar'
Found 1 CommentAnnotation(s) for: 'bar'
Found 0 CommentAnnotation(s) for: 'baz'
Changing to 'baz'...
Sleeping  10
Found 1 Image(s) for: 'foo'
Found 1 Image(s) for: 'baz'
Found 1 CommentAnnotation(s) for: 'baz'
Found 0 Image(s) for: 'bar'
Found 0 CommentAnnotation(s) for: 'bar'
Changing to 'unlinking'...
Sleeping  10
Found 1 Image(s) for: 'foo'
Found 1 CommentAnnotation(s) for: 'baz'
Found 0 Image(s) for: 'baz'
Found 0 Image(s) for: 'bar'
Found 0 CommentAnnotation(s) for: 'bar'

via the appropriate REINDEX eventlogs:

# select * from eventlog order by id desc limit 10;
  id  | action  | permissions | entityid |                entitytype                 | external_id | event 
------+---------+-------------+----------+-------------------------------------------+-------------+-------
 1178 | DELETE  |         -35 |      151 | ome.model.annotations.ImageAnnotationLink |             |  1729
 1177 | REINDEX |         -52 |      151 | ome.model.core.Image                      |             |  1729
 1176 | UPDATE  |         -35 |      201 | ome.model.annotations.CommentAnnotation   |             |  1728
 1175 | REINDEX |         -52 |      151 | ome.model.core.Image                      |             |  1728
 1174 | INSERT  |         -35 |      151 | ome.model.annotations.ImageAnnotationLink |             |  1727
 1173 | INSERT  |         -35 |      201 | ome.model.annotations.CommentAnnotation   |             |  1727
 1172 | INSERT  |         -35 |      151 | ome.model.core.Image                      |             |  1726

comment:2 Changed 12 years ago by jmoore

Code pushed to rc-thursday (https://github.com/openmicroscopy/openmicroscopy/pull/251). I'll apply a hot patch to howe for re-testing.

comment:3 Changed 12 years ago by jmoore

Confirmed by Elwood to be working now. Closing.

comment:4 Changed 12 years ago by jmoore

  • Resolution set to fixed
  • Status changed from new to closed

comment:5 Changed 12 years ago by jmoore <josh@…>

  • Remaining Time set to 0

(In [be5f96a6f46164db4b3376bc4fba76497a846fcc/ome.git] on branch develop) Fix delete triggers for annotation re-indexing (Fix #9337)

Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.65821 sec.)

We're Hiring!