You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Lindsey Hess <li...@yahoo.com> on 2007/07/25 06:30:30 UTC

What replaced org.apache.lucene.document.Field.Text?

I'm trying to get some relatively old Lucene code to compile (please see below), and it appears that Field.Text has been deprecated.  Can someone please suggest what I should use in its place?
   
  Thank you.
   
  Lindsey
   
   
   
  public static void main(String args[]) throws Exception
  {
  String indexDir =
  System.getProperty("java.io.tmpdir", "tmp") +
  System.getProperty("file.separator") + "address-book";
  Analyzer analyzer = new WhitespaceAnalyzer();
  boolean createFlag = true;
  
  IndexWriter writer = new IndexWriter(indexDir, analyzer, createFlag);
  Document contactDocument = new Document();
  contactDocument.add(Field.Text("type", "individual"));
  
  contactDocument.add(Field.Text("name", "Zane Pasolini"));
  contactDocument.add(Field.Text("address", "999 W. Prince St."));
  contactDocument.add(Field.Text("city", "New York"));
  contactDocument.add(Field.Text("province", "NY"));
  contactDocument.add(Field.Text("postalcode", "10013"));
  contactDocument.add(Field.Text("country", "USA"));
  contactDocument.add(Field.Text("telephone", "1-212-345-6789"));
  writer.addDocument(contactDocument);
  writer.close();
  }

       
---------------------------------
Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel and lay it on us.

Re: What replaced org.apache.lucene.document.Field.Text?

Posted by Lindsey Hess <li...@yahoo.com>.
Andy, Patrick,
   
  Thank you.  I replaced Field.Text with new Field("name", "value", Field.Store.YES, Field.Index.TOKENIZED); and it works just fine.
   
  Cheers,
   
  Lindsey

   
  

Patrick Kimber <ma...@gmail.com> wrote:
  Hi Andy

I think:
Field.Text("name", "value");

has been replaced with:
new Field("name", "value", Field.Store.YES, Field.Index.TOKENIZED);

Patrick

On 25/07/07, Liu_Andy2@emc.com 
wrote:
> Please reference How do I get code written for Lucene 1.4.x to work with
> Lucene 2.x?
> http://wiki.apache.org/lucene-java/LuceneFAQ#head-86d479476c63a2579e867b
> 75d4faa9664ef6cf4d
>
>
> Andy
> -----Original Message-----
> From: Lindsey Hess [mailto:lindseyhess83@yahoo.com]
> Sent: Wednesday, July 25, 2007 12:31 PM
> To: Lucene
> Subject: What replaced org.apache.lucene.document.Field.Text?
>
> I'm trying to get some relatively old Lucene code to compile (please see
> below), and it appears that Field.Text has been deprecated. Can someone
> please suggest what I should use in its place?
>
> Thank you.
>
> Lindsey
>
>
>
> public static void main(String args[]) throws Exception
> {
> String indexDir =
> System.getProperty("java.io.tmpdir", "tmp") +
> System.getProperty("file.separator") + "address-book";
> Analyzer analyzer = new WhitespaceAnalyzer();
> boolean createFlag = true;
>
> IndexWriter writer = new IndexWriter(indexDir, analyzer, createFlag);
> Document contactDocument = new Document();
> contactDocument.add(Field.Text("type", "individual"));
>
> contactDocument.add(Field.Text("name", "Zane Pasolini"));
> contactDocument.add(Field.Text("address", "999 W. Prince St."));
> contactDocument.add(Field.Text("city", "New York"));
> contactDocument.add(Field.Text("province", "NY"));
> contactDocument.add(Field.Text("postalcode", "10013"));
> contactDocument.add(Field.Text("country", "USA"));
> contactDocument.add(Field.Text("telephone", "1-212-345-6789"));
> writer.addDocument(contactDocument);
> writer.close();
> }
>
>
> ---------------------------------
> Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user
> panel and lay it on us.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org



       
---------------------------------
Boardwalk for $500? In 2007? Ha! 
Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.

Re: What replaced org.apache.lucene.document.Field.Text?

Posted by Patrick Kimber <ma...@gmail.com>.
Hi Andy

I think:
Field.Text("name", "value");

has been replaced with:
new Field("name", "value", Field.Store.YES, Field.Index.TOKENIZED);

Patrick

On 25/07/07, Liu_Andy2@emc.com <Li...@emc.com> wrote:
> Please reference How do I get code written for Lucene 1.4.x to work with
> Lucene 2.x?
> http://wiki.apache.org/lucene-java/LuceneFAQ#head-86d479476c63a2579e867b
> 75d4faa9664ef6cf4d
>
>
> Andy
> -----Original Message-----
> From: Lindsey Hess [mailto:lindseyhess83@yahoo.com]
> Sent: Wednesday, July 25, 2007 12:31 PM
> To: Lucene
> Subject: What replaced org.apache.lucene.document.Field.Text?
>
> I'm trying to get some relatively old Lucene code to compile (please see
> below), and it appears that Field.Text has been deprecated.  Can someone
> please suggest what I should use in its place?
>
>   Thank you.
>
>   Lindsey
>
>
>
>   public static void main(String args[]) throws Exception
>   {
>   String indexDir =
>   System.getProperty("java.io.tmpdir", "tmp") +
>   System.getProperty("file.separator") + "address-book";
>   Analyzer analyzer = new WhitespaceAnalyzer();
>   boolean createFlag = true;
>
>   IndexWriter writer = new IndexWriter(indexDir, analyzer, createFlag);
>   Document contactDocument = new Document();
>   contactDocument.add(Field.Text("type", "individual"));
>
>   contactDocument.add(Field.Text("name", "Zane Pasolini"));
>   contactDocument.add(Field.Text("address", "999 W. Prince St."));
>   contactDocument.add(Field.Text("city", "New York"));
>   contactDocument.add(Field.Text("province", "NY"));
>   contactDocument.add(Field.Text("postalcode", "10013"));
>   contactDocument.add(Field.Text("country", "USA"));
>   contactDocument.add(Field.Text("telephone", "1-212-345-6789"));
>   writer.addDocument(contactDocument);
>   writer.close();
>   }
>
>
> ---------------------------------
> Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user
> panel and lay it on us.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


RE: What replaced org.apache.lucene.document.Field.Text?

Posted by Li...@emc.com.
Please reference How do I get code written for Lucene 1.4.x to work with
Lucene 2.x?
http://wiki.apache.org/lucene-java/LuceneFAQ#head-86d479476c63a2579e867b
75d4faa9664ef6cf4d


Andy
-----Original Message-----
From: Lindsey Hess [mailto:lindseyhess83@yahoo.com] 
Sent: Wednesday, July 25, 2007 12:31 PM
To: Lucene
Subject: What replaced org.apache.lucene.document.Field.Text?

I'm trying to get some relatively old Lucene code to compile (please see
below), and it appears that Field.Text has been deprecated.  Can someone
please suggest what I should use in its place?
   
  Thank you.
   
  Lindsey
   
   
   
  public static void main(String args[]) throws Exception
  {
  String indexDir =
  System.getProperty("java.io.tmpdir", "tmp") +
  System.getProperty("file.separator") + "address-book";
  Analyzer analyzer = new WhitespaceAnalyzer();
  boolean createFlag = true;
  
  IndexWriter writer = new IndexWriter(indexDir, analyzer, createFlag);
  Document contactDocument = new Document();
  contactDocument.add(Field.Text("type", "individual"));
  
  contactDocument.add(Field.Text("name", "Zane Pasolini"));
  contactDocument.add(Field.Text("address", "999 W. Prince St."));
  contactDocument.add(Field.Text("city", "New York"));
  contactDocument.add(Field.Text("province", "NY"));
  contactDocument.add(Field.Text("postalcode", "10013"));
  contactDocument.add(Field.Text("country", "USA"));
  contactDocument.add(Field.Text("telephone", "1-212-345-6789"));
  writer.addDocument(contactDocument);
  writer.close();
  }

       
---------------------------------
Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user
panel and lay it on us.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org