net.java.ao
Annotation Type Searchable


@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface Searchable

Used to tag methods as being full-text searchable within a Lucene index. This annotation is only relevant when used in conjunction with an instance of SearchableEntityManager. Otherwise, it is ignored by ActiveObjects. Example:

public interface Post extends Entity {
     public String getTitle();
     public void setTitle(String title);
     
     @Searchable
     @SQLType(Types.BLOB)
     public String getBody();
     
     @Searchable
     @SQLType(Types.BLOB)
     public void setBody(String body);
 }
 
 // ...
 SearchableEntityManager manager = ...;
 manager.search(Post.class, "my search string");    // returns search results as Post[]

At the moment, it is impossible to specify the Lucene field and type which will be used in the index. By default, tablename.fieldname is utilized to determine the Lucene field. More features are planned for this annotation in future.

Author:
Daniel Spiewak
See Also:
SearchableEntityManager



Copyright © 2007-2013. All Rights Reserved.