View Javadoc

1   package com.atlassian.bonnie;
2   
3   import org.apache.lucene.document.Field;
4   
5   /**
6    * Helper class for getting rid of static calls to Field made obselete in Lucene 2.0. Rather than having to
7    * remember the translations for the static methods,  convert Field.text() to FieldUtil.text(), then have
8    * IDEA inline the method call for you.
9    *
10   * @deprecated You should only use this class as a helper for inlining, not for production code.
11   */
12  public class FieldUtil
13  {
14      public static Field Text(String name, String value)
15      {
16          return new Field(name, value, Field.Store.YES, Field.Index.TOKENIZED);
17      }
18  
19      public static Field Keyword(String name, String value)
20      {
21          return new Field(name, value, Field.Store.YES, Field.Index.UN_TOKENIZED);
22      }
23  
24      public static Field UnIndexed(String name, String value)
25      {
26          return new Field(name, value, Field.Store.YES, Field.Index.NO);
27      }
28  
29      public static Field UnStored(String name, String value)
30      {
31          return new Field(name, value, Field.Store.NO, Field.Index.TOKENIZED);
32      }
33  }