Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2007 Daniel Spiewak
  * 
  * Licensed under the Apache License, Version 2.0 (the "License"); 
  * you may not use this file except in compliance with the License. 
  * You may obtain a copy of the License at
  * 
  *	    http://www.apache.org/licenses/LICENSE-2.0 
  * 
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.java.ao;

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(s):
Daniel Spiewak
See also:
SearchableEntityManager
public @interface Searchable {}
New to GrepCode? Check out our FAQ X