[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/search/annotations ...

Christian Bauer christian at hibernate.org
Tue Jun 12 08:30:00 EDT 2007


  User: cbauer  
  Date: 07/06/12 08:30:00

  Added:       examples/wiki/src/main/org/jboss/seam/wiki/core/search/annotations    
                        SearchableType.java CompositeSearchables.java
                        CompositeSearchable.java Searchable.java
  Log:
  Completed first iteration of search engine
  
  Revision  Changes    Path
  1.1      date: 2007/06/12 12:30:00;  author: cbauer;  state: Exp;jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/search/annotations/SearchableType.java
  
  Index: SearchableType.java
  ===================================================================
  package org.jboss.seam.wiki.core.search.annotations;
  
  /**
   * Enumeration of search types, influences UI and query building.
   * <p>
   * TODO: Refactor this into a type hierarchy that includes behavior (query building)
   * 
   * @author Christian Bauer
   */
  public enum SearchableType {
      PHRASE, PASTDATE, NUMRANGE
  }
  
  
  
  1.1      date: 2007/06/12 12:30:00;  author: cbauer;  state: Exp;jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/search/annotations/CompositeSearchables.java
  
  Index: CompositeSearchables.java
  ===================================================================
  package org.jboss.seam.wiki.core.search.annotations;
  
  import java.lang.annotation.Target;
  import java.lang.annotation.Retention;
  import java.lang.annotation.ElementType;
  import java.lang.annotation.RetentionPolicy;
  
  /**
   * Declare several grouped searchable properties on an entity class.
   *
   * @author Christian Bauer
   */
  @Target({ElementType.TYPE})
  @Retention(RetentionPolicy.RUNTIME)
  public @interface CompositeSearchables {
      CompositeSearchable[] value();
  }
  
  
  
  
  1.1      date: 2007/06/12 12:30:00;  author: cbauer;  state: Exp;jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/search/annotations/CompositeSearchable.java
  
  Index: CompositeSearchable.java
  ===================================================================
  package org.jboss.seam.wiki.core.search.annotations;
  
  import java.lang.annotation.Target;
  import java.lang.annotation.ElementType;
  import java.lang.annotation.Retention;
  import java.lang.annotation.RetentionPolicy;
  
  /**
   * Group several searchable properties into one UI option.
   * <p>
   * The name of the properties must be the same as the indexed field names.
   *
   * @author Christian Bauer
   */
  @Target({ElementType.TYPE})
  @Retention(RetentionPolicy.RUNTIME)
  public @interface CompositeSearchable {
      String description();
      SearchableType type() default SearchableType.PHRASE;
      String[] properties();
  }
  
  
  
  1.1      date: 2007/06/12 12:30:00;  author: cbauer;  state: Exp;jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/search/annotations/Searchable.java
  
  Index: Searchable.java
  ===================================================================
  package org.jboss.seam.wiki.core.search.annotations;
  
  import java.lang.annotation.Target;
  import java.lang.annotation.ElementType;
  import java.lang.annotation.Retention;
  import java.lang.annotation.RetentionPolicy;
  
  /**
   * Declare on entities or persistent properties to include them in the search feature.
   * <p>
   * If you place this annotation on an entity class that has also been indexed with
   * Hibernate Search, you will after startup find the entity searchable in the global
   * search mask with the given description. The <tt>type</tt> is ignored in this case.
   * <p>
   * If you place this annotation on a persistent property (field or getter method), the
   * property will be searchable individually as a search option. Use the appropriate
   * <tt>SearchableType</tt> in that case. The property name must be the same as the
   * name used for indexing. (TODO: make this more flexible)
   *
   * @author Christian Bauer
   */
  @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
  @Retention(RetentionPolicy.RUNTIME)
  public @interface Searchable {
      String description();
      SearchableType type() default SearchableType.PHRASE;
  }
  
  
  



More information about the jboss-cvs-commits mailing list