• Views
  • Iteration Report
  • My Iteration Report
  •  
OMERO.server
  • Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • ← Previous Changeset
  • Next Changeset →

Changeset 2507

Show
Ignore:
Timestamp:
06/17/08 15:37:52 (6 months ago)
Author:
jmoore
Message:

OmeroSearch : Added omero.search.excludes property

omero.search.excludes contains a list of comma-separated strings
which are passed to the EventLogLoader to be filtered out of the
EventLog.entityType field in the nextEventLog(long) method.

Location:
trunk
Files:
5 modified

  • components/server/resources/ome/services/service-ome.api.Search.xml (modified) (1 diff)
  • components/server/src/ome/services/fulltext/EventLogLoader.java (modified) (4 diffs)
  • components/server/src/ome/tools/hibernate/QueryBuilder.java (modified) (1 diff)
  • components/server/test/ome/server/itests/search/PersistentEventLogLoaderTest.java (modified) (2 diffs)
  • etc/omero.properties (modified) (1 diff)

Legend:

Unmodified
Added
Removed
  • trunk/components/server/resources/ome/services/service-ome.api.Search.xml

    r2495 r2507  
    8181    <property name="types" ref="internal:ome.api.ITypes"/> 
    8282    <property name="batchSize" value="${omero.search.batch}"/> 
     83    <property name="excludes" value="${omero.search.excludes}"/> 
    8384  </bean> 
    8485 
  • trunk/components/server/src/ome/services/fulltext/EventLogLoader.java

    r2495 r2507  
    99 
    1010import java.util.ArrayList; 
     11import java.util.Arrays; 
    1112import java.util.Collections; 
    1213import java.util.Iterator; 
    … …  
    1819import ome.parameters.Filter; 
    1920import ome.parameters.Parameters; 
     21import ome.tools.hibernate.QueryBuilder; 
    2022 
    2123/** 
    … …  
    6769    private EventLog log; 
    6870 
     71    /** 
     72     * Array of class types which will get excluded from indexing. 
     73     */ 
     74    protected List<String> excludes = Collections.emptyList(); 
     75 
     76    /** 
     77     * Spring injector 
     78     */ 
     79    public void setExcludes(String[] excludes) { 
     80        this.excludes = Collections.unmodifiableList(Arrays.asList(excludes)); 
     81    } 
     82 
    6983    protected IQuery queryService; 
    7084 
     85    /** 
     86     * Spring injector 
     87     */ 
    7188    public void setQueryService(IQuery queryService) { 
    7289        this.queryService = queryService; 
    … …  
    150167     * Returns the {@link EventLog} with the next id after the given argument or 
    151168     * null if none exists. This method will only return "true" {@link EventLog} 
    152      * instances, with a valid id. 
     169     * instances, with a valid id. The {@link #excludes} list is used to filter 
     170     * out unwanted {@link EventLog} isntances. 
    153171     */ 
    154172    public final EventLog nextEventLog(long id) { 
    155         return queryService.findByQuery("select el from EventLog el " 
    156                 + "where el.id > :id order by id", new Parameters(new Filter() 
    157                 .page(0, 1)).addId(id)); 
     173        List<String> copy = excludes; // Instead of synchronizing 
     174        QueryBuilder qb = new QueryBuilder(); 
     175        qb.select("el"); 
     176        qb.from("EventLog", "el"); 
     177        qb.where(); 
     178        qb.and("el.id > " + id); 
     179        if (copy != null) { 
     180            for (String exclude : copy) { 
     181                qb.and("el.entityType != '" + exclude + "'"); 
     182            } 
     183        } 
     184        qb.order("id", true); 
     185        String query = qb.queryString(); 
     186 
     187        return queryService.findByQuery(query, new Parameters(new Filter() 
     188                .page(0, 1))); 
    158189    } 
    159190 
  • trunk/components/server/src/ome/tools/hibernate/QueryBuilder.java

    r2109 r2507  
    257257    } 
    258258 
     259    /** 
     260     * Returns the current query as a String. As opposed to {@link #toString()}, 
     261     * this method should return parseable HQL. 
     262     */ 
     263    public String queryString() { 
     264        return sb.toString(); 
     265    } 
     266 
    259267    @Override 
    260268    public String toString() { 
  • trunk/components/server/test/ome/server/itests/search/PersistentEventLogLoaderTest.java

    r2141 r2507  
    3838        ome.model.meta.Session s = sm.create(new Principal("root", "system", 
    3939                "FullText")); 
     40        final boolean[] result = new boolean[1]; 
    4041        ex.execute(new Principal(s.getUuid(), "system", "FullText"), 
    4142                new Executor.Work() { 
    … …  
    5152                            } 
    5253                        } 
    53                         assertTrue(ll.getCurrentId() > 0); 
     54                        result[0] = ll.getCurrentId() > 0; 
     55                        return null; 
     56                    } 
     57                }); 
     58        assertTrue(result[0]); 
     59    } 
     60 
     61    public void testTestExcludes() throws Exception { 
     62        ome.model.meta.Session s = sm.create(new Principal("root", "system", 
     63                "FullText")); 
     64        ex.execute(new Principal(s.getUuid(), "system", "FullText"), 
     65                new Executor.Work() { 
     66                    public Object doWork(TransactionStatus status, 
     67                            Session session, ServiceFactory sf) { 
     68                        ll.nextEventLog(0); 
    5469                        return null; 
    5570                    } 
  • trunk/etc/omero.properties

    r2505 r2507  
    6262# Maximum number of OR-clauses to which a single search can expand 
    6363omero.search.maxclause=4096 
     64 
     65# Indexing takes place on all EventLogs as the occur in the database. 
     66# The types listed here will be skipped if they appear in the "entityType" 
     67# field of the EventLog table. 
     68omero.search.excludes=ome.model.core.PlaneInfo,ome.model.meta.Session 
    6469 
    6570# Extra bridge classes, comma-separated, to be invoked on each indexing. 

Download in other formats:

  • Unified Diff
  • Zip Archive

Trac Powered

Powered by Trac 0.11
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/