Lucene in Action book. Problems with first example

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Lucene in Action book. Problems with first example

Oleg Oltar
Hi!
I am starting to learn Lucene.
I am using Lucene in Action book for startup (It was recommended to me). I
tried to compile first example from that book, but my ide (I use eclipse,
shows there are some errors in my code). I am just the beginner here, and I
really need to compile at least few programs.... before I can solve problems
myself. So I decided to post here the whole code with my comments. Please
help me!!!


package org.main;


import java.io.File;

import java.io.FileReader;

import java.io.IOException;

import java.util.Date;


import org.apache.lucene.analysis.standard.StandardAnalyzer;

import org.apache.lucene.document.Document;

import org.apache.lucene.document.Field;

import org.apache.lucene.index.IndexWriter;




public class SimpleIndexer {

 /**

 * @param args

 */

public static void main(String[] args) throws Exception{

if (args.length !=2){

throw new Exception("Usage: java" + SimpleIndexer.class.getName() + "<indexDir>
<dataDir>");

}


 File indexDir = new File(args[0]);

File dataDir = new File(args[1]);

 long start = new Date().getTime();

int numIndexed = index(indexDir, dataDir);

long end = new Date().getTime();

System.out.println("Indexing " + numIndexed +" took " + (end - start) +
"milliseconds");

}


 @SuppressWarnings("deprecation")

public static int index(File indexDir, File dataDir) throws IOException {



 if (!dataDir.exists() || !dataDir.isDirectory()){

 throw new IOException(dataDir + " doesn't exist or not a directory");



 }

 IndexWriter writer = new IndexWriter(indexDir, new StandardAnalyzer(), true);
// Not sure why eclipse crosses this

 writer.setUseCompoundFile(false);



 indexDirectory(writer, dataDir);

 int numIndexed = writer.docCount(); // Not sure why eclipse crosses this

 writer.optimize();

 writer.close();





 return numIndexed;

}


 private static void indexDirectory(IndexWriter writer, File dir)
throwsIOException{

File[] files = dir.listFiles();

for (int i=0; i< files.length; i++){

File f = files[i];

if(f.isDirectory()){

indexDirectory(writer, f);

 } else if(f.getName().endsWith(".txt")){

indexFile(writer, f);

}

 }

}


 private static void indexFile(IndexWriter writer, File f) throwsIOException{

if(f.isHidden() || !f.exists() || !f.canRead()){

return;

}

System.out.println("Indexing " + f.getCanonicalPath());

 Document doc = new Document();

doc.add(Field.Text("contents", new FileReader(f))); // Eclipse says: The
method Text(String, FileReader) is undefined for the type Field

 doc.add(Field.Keyword("filename", f.getCanonicalPath())); // Eclipse says:The
method Keyword(String, String) is undefined for the type Field

writer.addDocument(doc);

 }





}

Please explain me why these errors are shown, and how to fix them. Maybe,
the version of lucene used by author of the book, contained needed methods?
So may it be that the book is outdated and can't be used for learning. If
so, please recommend me something that can help me to start with lucene.

Thanks in advance,
Oleg
Reply | Threaded
Open this post in threaded view
|

Re: Lucene in Action book. Problems with first example

Joseph.Syjuco

Hi,
What were the errors?
Just a guess ... it may be possible that you are using the wrong lucene version - the one in the book is not the most updated one avbl today

"XP is making a bet. It is betting that it is better to do a simple thing today and pay a little more tomorrow to change it if it needs it, than to do a more complicated thing today that may never be used anyway" - Extreme Programming Explained, Embrace Change

Best Regards,

Joseph F. Syjuco

Team Lead
M3 Alpha - e-Commerce
__________________________________
Lawson PSSC, Inc.
4th Floor, One World Square Building
Upper McKinley Road, Taguig City 1634
Philippines


Work: +63 (2) 976-3600 loc 79396
Mobile: +63 (917) 855-3436
Web:
http://www.lawson.com
Email:
joseph.syjuco@...

-------------------- Internet e-Mail Disclaimer --------------------

This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient you are notified that any use, disclosure, copying or distribution of the information is prohibited. In such case, you should destroy this message and kindly notify the sender by reply e-mail. The views expressed in this e-mail and any attachments are personal and, unless stated explicitly, do not represent the views of Lawson Software, Inc.


"Oleg Oltar" <[hidden email]>

12/16/2008 06:41 PM

Please respond to
[hidden email]

To
[hidden email]
cc
Subject
Lucene in Action book. Problems with first example





Hi!
I am starting to learn Lucene.
I am using Lucene in Action book for startup (It was recommended to me). I
tried to compile first example from that book, but my ide (I use eclipse,
shows there are some errors in my code). I am just the beginner here, and I
really need to compile at least few programs.... before I can solve problems
myself. So I decided to post here the whole code with my comments. Please
help me!!!


package org.main;


import java.io.File;

import java.io.FileReader;

import java.io.IOException;

import java.util.Date;


import org.apache.lucene.analysis.standard.StandardAnalyzer;

import org.apache.lucene.document.Document;

import org.apache.lucene.document.Field;

import org.apache.lucene.index.IndexWriter;




public class SimpleIndexer {

/**

* @param args

*/

public static void main(String[] args) throws Exception{

if (args.length !=2){

throw new Exception("Usage: java" + SimpleIndexer.class.getName() + "<indexDir>
<dataDir>");

}


File indexDir = new File(args[0]);

File dataDir = new File(args[1]);

long start = new Date().getTime();

int numIndexed = index(indexDir, dataDir);

long end = new Date().getTime();

System.out.println("Indexing " + numIndexed +" took " + (end - start) +
"milliseconds");

}


@SuppressWarnings("deprecation")

public static int index(File indexDir, File dataDir) throws IOException {



if (!dataDir.exists() || !dataDir.isDirectory()){

throw new IOException(dataDir + " doesn't exist or not a directory");



}

IndexWriter writer = new IndexWriter(indexDir, new StandardAnalyzer(), true);
// Not sure why eclipse crosses this

writer.setUseCompoundFile(false);



indexDirectory(writer, dataDir);

int numIndexed = writer.docCount(); // Not sure why eclipse crosses this

writer.optimize();

writer.close();





return numIndexed;

}


private static void indexDirectory(IndexWriter writer, File dir)
throwsIOException{

File[] files = dir.listFiles();

for (int i=0; i< files.length; i++){

File f = files[i];

if(f.isDirectory()){

indexDirectory(writer, f);

} else if(f.getName().endsWith(".txt")){

indexFile(writer, f);

}

}

}


private static void indexFile(IndexWriter writer, File f) throwsIOException{

if(f.isHidden() || !f.exists() || !f.canRead()){

return;

}

System.out.println("Indexing " + f.getCanonicalPath());

Document doc = new Document();

doc.add(Field.Text("contents", new FileReader(f))); // Eclipse says: The
method Text(String, FileReader) is undefined for the type Field

doc.add(Field.Keyword("filename", f.getCanonicalPath())); // Eclipse says:The
method Keyword(String, String) is undefined for the type Field

writer.addDocument(doc);

}





}

Please explain me why these errors are shown, and how to fix them. Maybe,
the version of lucene used by author of the book, contained needed methods?
So may it be that the book is outdated and can't be used for learning. If
so, please recommend me something that can help me to start with lucene.

Thanks in advance,
Oleg

Reply | Threaded
Open this post in threaded view
|

Re: Lucene in Action book. Problems with first example

Michael McCandless-2
In reply to this post by Oleg Oltar

Lucene in Action is based on the 1.4.x release of Lucene, which is  
quite old by now and unfortunately some of the APIs have since been  
removed.

We are working on the 2nd edition to fix this, but in the mean-time  
you need to migrate to the new APIs when you see the errors.

Eg, if you look in the 1.9 javadocs for Field, it will tell you what  
new API to use instead of Field.Keyword, Field.Text, etc:

   http://lucene.apache.org/java/1_9_1/api/org/apache/lucene/document/Field.html

Mike

Oleg Oltar wrote:

> Hi!
> I am starting to learn Lucene.
> I am using Lucene in Action book for startup (It was recommended to  
> me). I
> tried to compile first example from that book, but my ide (I use  
> eclipse,
> shows there are some errors in my code). I am just the beginner  
> here, and I
> really need to compile at least few programs.... before I can solve  
> problems
> myself. So I decided to post here the whole code with my comments.  
> Please
> help me!!!
>
>
> package org.main;
>
>
> import java.io.File;
>
> import java.io.FileReader;
>
> import java.io.IOException;
>
> import java.util.Date;
>
>
> import org.apache.lucene.analysis.standard.StandardAnalyzer;
>
> import org.apache.lucene.document.Document;
>
> import org.apache.lucene.document.Field;
>
> import org.apache.lucene.index.IndexWriter;
>
>
>
>
> public class SimpleIndexer {
>
> /**
>
> * @param args
>
> */
>
> public static void main(String[] args) throws Exception{
>
> if (args.length !=2){
>
> throw new Exception("Usage: java" + SimpleIndexer.class.getName() +  
> "<indexDir>
> <dataDir>");
>
> }
>
>
> File indexDir = new File(args[0]);
>
> File dataDir = new File(args[1]);
>
> long start = new Date().getTime();
>
> int numIndexed = index(indexDir, dataDir);
>
> long end = new Date().getTime();
>
> System.out.println("Indexing " + numIndexed +" took " + (end -  
> start) +
> "milliseconds");
>
> }
>
>
> @SuppressWarnings("deprecation")
>
> public static int index(File indexDir, File dataDir) throws  
> IOException {
>
>
>
> if (!dataDir.exists() || !dataDir.isDirectory()){
>
> throw new IOException(dataDir + " doesn't exist or not a directory");
>
>
>
> }
>
> IndexWriter writer = new IndexWriter(indexDir, new  
> StandardAnalyzer(), true);
> // Not sure why eclipse crosses this
>
> writer.setUseCompoundFile(false);
>
>
>
> indexDirectory(writer, dataDir);
>
> int numIndexed = writer.docCount(); // Not sure why eclipse crosses  
> this
>
> writer.optimize();
>
> writer.close();
>
>
>
>
>
> return numIndexed;
>
> }
>
>
> private static void indexDirectory(IndexWriter writer, File dir)
> throwsIOException{
>
> File[] files = dir.listFiles();
>
> for (int i=0; i< files.length; i++){
>
> File f = files[i];
>
> if(f.isDirectory()){
>
> indexDirectory(writer, f);
>
> } else if(f.getName().endsWith(".txt")){
>
> indexFile(writer, f);
>
> }
>
> }
>
> }
>
>
> private static void indexFile(IndexWriter writer, File f)  
> throwsIOException{
>
> if(f.isHidden() || !f.exists() || !f.canRead()){
>
> return;
>
> }
>
> System.out.println("Indexing " + f.getCanonicalPath());
>
> Document doc = new Document();
>
> doc.add(Field.Text("contents", new FileReader(f))); // Eclipse says:  
> The
> method Text(String, FileReader) is undefined for the type Field
>
> doc.add(Field.Keyword("filename", f.getCanonicalPath())); // Eclipse  
> says:The
> method Keyword(String, String) is undefined for the type Field
>
> writer.addDocument(doc);
>
> }
>
>
>
>
>
> }
>
> Please explain me why these errors are shown, and how to fix them.  
> Maybe,
> the version of lucene used by author of the book, contained needed  
> methods?
> So may it be that the book is outdated and can't be used for  
> learning. If
> so, please recommend me something that can help me to start with  
> lucene.
>
> Thanks in advance,
> Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Lucene in Action book. Problems with first example

Erik Hatcher
In reply to this post by Oleg Oltar
The first edition of Lucene in Action was written for Lucene 1.4.  
Lots has changed since then in the API, but the fundamentals are still  
sound.  The code can be easily updated to the newer API following the  
details I posted here:

    <http://markmail.org/message/4jupw4wnjn3gv7wh>

Do note that Lucene in Action 2nd edition is in progress and available  
through Manning's early access program here: <http://manning.com/hatcher3/ 
 >, and updated code is available there (it is coded to Lucene's  
2.9/3.0 API).

        Erik

On Dec 16, 2008, at 5:41 AM, Oleg Oltar wrote:

> Hi!
> I am starting to learn Lucene.
> I am using Lucene in Action book for startup (It was recommended to  
> me). I
> tried to compile first example from that book, but my ide (I use  
> eclipse,
> shows there are some errors in my code). I am just the beginner  
> here, and I
> really need to compile at least few programs.... before I can solve  
> problems
> myself. So I decided to post here the whole code with my comments.  
> Please
> help me!!!
>
>
> package org.main;
>
>
> import java.io.File;
>
> import java.io.FileReader;
>
> import java.io.IOException;
>
> import java.util.Date;
>
>
> import org.apache.lucene.analysis.standard.StandardAnalyzer;
>
> import org.apache.lucene.document.Document;
>
> import org.apache.lucene.document.Field;
>
> import org.apache.lucene.index.IndexWriter;
>
>
>
>
> public class SimpleIndexer {
>
> /**
>
> * @param args
>
> */
>
> public static void main(String[] args) throws Exception{
>
> if (args.length !=2){
>
> throw new Exception("Usage: java" + SimpleIndexer.class.getName() +  
> "<indexDir>
> <dataDir>");
>
> }
>
>
> File indexDir = new File(args[0]);
>
> File dataDir = new File(args[1]);
>
> long start = new Date().getTime();
>
> int numIndexed = index(indexDir, dataDir);
>
> long end = new Date().getTime();
>
> System.out.println("Indexing " + numIndexed +" took " + (end -  
> start) +
> "milliseconds");
>
> }
>
>
> @SuppressWarnings("deprecation")
>
> public static int index(File indexDir, File dataDir) throws  
> IOException {
>
>
>
> if (!dataDir.exists() || !dataDir.isDirectory()){
>
> throw new IOException(dataDir + " doesn't exist or not a directory");
>
>
>
> }
>
> IndexWriter writer = new IndexWriter(indexDir, new  
> StandardAnalyzer(), true);
> // Not sure why eclipse crosses this
>
> writer.setUseCompoundFile(false);
>
>
>
> indexDirectory(writer, dataDir);
>
> int numIndexed = writer.docCount(); // Not sure why eclipse crosses  
> this
>
> writer.optimize();
>
> writer.close();
>
>
>
>
>
> return numIndexed;
>
> }
>
>
> private static void indexDirectory(IndexWriter writer, File dir)
> throwsIOException{
>
> File[] files = dir.listFiles();
>
> for (int i=0; i< files.length; i++){
>
> File f = files[i];
>
> if(f.isDirectory()){
>
> indexDirectory(writer, f);
>
> } else if(f.getName().endsWith(".txt")){
>
> indexFile(writer, f);
>
> }
>
> }
>
> }
>
>
> private static void indexFile(IndexWriter writer, File f)  
> throwsIOException{
>
> if(f.isHidden() || !f.exists() || !f.canRead()){
>
> return;
>
> }
>
> System.out.println("Indexing " + f.getCanonicalPath());
>
> Document doc = new Document();
>
> doc.add(Field.Text("contents", new FileReader(f))); // Eclipse says:  
> The
> method Text(String, FileReader) is undefined for the type Field
>
> doc.add(Field.Keyword("filename", f.getCanonicalPath())); // Eclipse  
> says:The
> method Keyword(String, String) is undefined for the type Field
>
> writer.addDocument(doc);
>
> }
>
>
>
>
>
> }
>
> Please explain me why these errors are shown, and how to fix them.  
> Maybe,
> the version of lucene used by author of the book, contained needed  
> methods?
> So may it be that the book is outdated and can't be used for  
> learning. If
> so, please recommend me something that can help me to start with  
> lucene.
>
> Thanks in advance,
> Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Lucene in Action book. Problems with first example

Oleg Oltar
In reply to this post by Joseph.Syjuco
I posted errors as comments in the provided code..
Yes seems that the version in the book is a little bit old (as the book was
created in 2005)

So is there another manual which I can use to start? (Seems that examples in
the book, are carefully chosen for starters, and quite easy to understand)


Thanks,
Oleg
On Tue, Dec 16, 2008 at 12:44 PM, <[hidden email]> wrote:

>
> Hi,
> What were the errors?
> Just a guess ... it may be possible that you are using the wrong lucene
> version - the one in the book is not the most updated one avbl today
>
>  *"XP is making a bet. It is betting that it is better to do a simple
> thing today and pay a little more tomorrow to change it if it needs it, than
> to do a more complicated thing today that may never be used anyway" -
> Extreme Programming Explained, Embrace Change*
>
> Best Regards,
> *
> Joseph F. Syjuco*
> Team Lead
> M3 Alpha - e-Commerce
> __________________________________
> Lawson PSSC, Inc.
> 4th Floor, One World Square Building
> Upper McKinley Road, Taguig City 1634
> Philippines
>
> Work: +63 (2) 976-3600 loc 79396
> Mobile: +63 (917) 855-3436
> Web: *http://www.lawson.com* <http://www.lawson.com/>
> Email: *[hidden email]* <[hidden email]>
>
>  *-------------------- Internet e-Mail Disclaimer --------------------*
>
> This e-mail and any files transmitted with it are confidential and intended
> solely for the use of the individual or entity to which they are addressed.
> If you are not the intended recipient you are notified that any use,
> disclosure, copying or distribution of the information is prohibited. In
> such case, you should destroy this message and kindly notify the sender by
> reply e-mail. The views expressed in this e-mail and any attachments are
> personal and, unless stated explicitly, do not represent the views of Lawson
> Software, Inc.
>
>
>  *"Oleg Oltar" <[hidden email]>*
>
> 12/16/2008 06:41 PM
>  Please respond to
> [hidden email]
>
>   To
> [hidden email]  cc
>   Subject
> Lucene in Action book. Problems with first example
>
>
>
>
> Hi!
> I am starting to learn Lucene.
> I am using Lucene in Action book for startup (It was recommended to me). I
> tried to compile first example from that book, but my ide (I use eclipse,
> shows there are some errors in my code). I am just the beginner here, and I
> really need to compile at least few programs.... before I can solve
> problems
> myself. So I decided to post here the whole code with my comments. Please
> help me!!!
>
>
> package org.main;
>
>
> import java.io.File;
>
> import java.io.FileReader;
>
> import java.io.IOException;
>
> import java.util.Date;
>
>
> import org.apache.lucene.analysis.standard.StandardAnalyzer;
>
> import org.apache.lucene.document.Document;
>
> import org.apache.lucene.document.Field;
>
> import org.apache.lucene.index.IndexWriter;
>
>
>
>
> public class SimpleIndexer {
>
> /**
>
> * @param args
>
> */
>
> public static void main(String[] args) throws Exception{
>
> if (args.length !=2){
>
> throw new Exception("Usage: java" + SimpleIndexer.class.getName() +
> "<indexDir>
> <dataDir>");
>
> }
>
>
> File indexDir = new File(args[0]);
>
> File dataDir = new File(args[1]);
>
> long start = new Date().getTime();
>
> int numIndexed = index(indexDir, dataDir);
>
> long end = new Date().getTime();
>
> System.out.println("Indexing " + numIndexed +" took " + (end - start) +
> "milliseconds");
>
> }
>
>
> @SuppressWarnings("deprecation")
>
> public static int index(File indexDir, File dataDir) throws IOException {
>
>
>
> if (!dataDir.exists() || !dataDir.isDirectory()){
>
> throw new IOException(dataDir + " doesn't exist or not a directory");
>
>
>
> }
>
> IndexWriter writer = new IndexWriter(indexDir, new StandardAnalyzer(),
> true);
> // Not sure why eclipse crosses this
>
> writer.setUseCompoundFile(false);
>
>
>
> indexDirectory(writer, dataDir);
>
> int numIndexed = writer.docCount(); // Not sure why eclipse crosses this
>
> writer.optimize();
>
> writer.close();
>
>
>
>
>
> return numIndexed;
>
> }
>
>
> private static void indexDirectory(IndexWriter writer, File dir)
> throwsIOException{
>
> File[] files = dir.listFiles();
>
> for (int i=0; i< files.length; i++){
>
> File f = files[i];
>
> if(f.isDirectory()){
>
> indexDirectory(writer, f);
>
> } else if(f.getName().endsWith(".txt")){
>
> indexFile(writer, f);
>
> }
>
> }
>
> }
>
>
> private static void indexFile(IndexWriter writer, File f)
> throwsIOException{
>
> if(f.isHidden() || !f.exists() || !f.canRead()){
>
> return;
>
> }
>
> System.out.println("Indexing " + f.getCanonicalPath());
>
> Document doc = new Document();
>
> doc.add(Field.Text("contents", new FileReader(f))); // Eclipse says: The
> method Text(String, FileReader) is undefined for the type Field
>
> doc.add(Field.Keyword("filename", f.getCanonicalPath())); // Eclipse
> says:The
> method Keyword(String, String) is undefined for the type Field
>
> writer.addDocument(doc);
>
> }
>
>
>
>
>
> }
>
> Please explain me why these errors are shown, and how to fix them. Maybe,
> the version of lucene used by author of the book, contained needed methods?
> So may it be that the book is outdated and can't be used for learning. If
> so, please recommend me something that can help me to start with lucene.
>
> Thanks in advance,
> Oleg
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Lucene in Action book. Problems with first example

Erik Hatcher

On Dec 16, 2008, at 5:53 AM, Oleg Oltar wrote:
> So is there another manual which I can use to start? (Seems that  
> examples in
> the book, are carefully chosen for starters, and quite easy to  
> understand)

The API differences are all quite minor to adjust to the latest -  
hopefully the post I pointed you to will get you over the problems, or  
the new code download.  Feel free to ask with specifics when you  
encounter issues, either here or on the Manning forum for the book.

        Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Lucene in Action book. Problems with first example

Oleg Oltar
Thanks!!!
I didn't expect to get such quick answers. Just let me try to fix it :)

On Tue, Dec 16, 2008 at 12:56 PM, Erik Hatcher
<[hidden email]>wrote:

>
> On Dec 16, 2008, at 5:53 AM, Oleg Oltar wrote:
>
>> So is there another manual which I can use to start? (Seems that examples
>> in
>> the book, are carefully chosen for starters, and quite easy to understand)
>>
>
> The API differences are all quite minor to adjust to the latest - hopefully
> the post I pointed you to will get you over the problems, or the new code
> download.  Feel free to ask with specifics when you encounter issues, either
> here or on the Manning forum for the book.
>
>        Erik
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Lucene in Action book. Problems with first example

Oleg Oltar
Also maybe there are some free manuals/articles that you can recommend for
starters?

On Tue, Dec 16, 2008 at 1:08 PM, Oleg Oltar <[hidden email]> wrote:

> Thanks!!!
> I didn't expect to get such quick answers. Just let me try to fix it :)
>
>
> On Tue, Dec 16, 2008 at 12:56 PM, Erik Hatcher <[hidden email]
> > wrote:
>
>>
>> On Dec 16, 2008, at 5:53 AM, Oleg Oltar wrote:
>>
>>> So is there another manual which I can use to start? (Seems that examples
>>> in
>>> the book, are carefully chosen for starters, and quite easy to
>>> understand)
>>>
>>
>> The API differences are all quite minor to adjust to the latest -
>> hopefully the post I pointed you to will get you over the problems, or the
>> new code download.  Feel free to ask with specifics when you encounter
>> issues, either here or on the Manning forum for the book.
>>
>>        Erik
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Lucene in Action book. Problems with first example

Erik Hatcher

On Dec 16, 2008, at 6:57 AM, Oleg Oltar wrote:

> Also maybe there are some free manuals/articles that you can  
> recommend for
> starters?

There's a bunch of stuff listed here: <http://wiki.apache.org/lucene-java/Resources 
 >

Lucene has been changing so rapidly lately that I'm not aware of any  
articles that are entirely up-to-date API-wise, but again in general  
most of those API changes are pretty minor and actually well  
documented in Lucene's CHANGES.txt and deprecation warnings (upgrading  
from 1.4 to 1.9, for example, primed users with nice deprecation  
warnings with what was going to be removed).

        Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Lucene in Action book. Problems with first example

Oleg Oltar
I am trying to fix my code now. I am using the
http://markmail.org/message/4jupw4wnjn3gv7wh

Replace all Field.Keyword/UnStored/Text/UnIndexed with the enumerated types,
e.g.:

- doc.add(Field.Keyword("animal", animal));
+ doc.add(new Field("animal", animal, Field.Store.YES,
Field.Index.UN_TOKENIZED));

So I replaced correspondent code with
doc.add(new Field("filename", f.getCanonicalPath(), Field.Store.YES,
Field.Index.UN_TOKENIZED));

Can you please explain what is enumerated type.What should, I use  instead
of Field.Text or Field.UnIndexed. Is there any doc about it?


On Tue, Dec 16, 2008 at 3:04 PM, Erik Hatcher <[hidden email]>wrote:

>
> On Dec 16, 2008, at 6:57 AM, Oleg Oltar wrote:
>
>  Also maybe there are some free manuals/articles that you can recommend for
>> starters?
>>
>
> There's a bunch of stuff listed here: <
> http://wiki.apache.org/lucene-java/Resources>
>
> Lucene has been changing so rapidly lately that I'm not aware of any
> articles that are entirely up-to-date API-wise, but again in general most of
> those API changes are pretty minor and actually well documented in Lucene's
> CHANGES.txt and deprecation warnings (upgrading from 1.4 to 1.9, for
> example, primed users with nice deprecation warnings with what was going to
> be removed).
>
>
>        Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Lucene in Action book. Problems with first example

Ian Lea
A follow up message to the one you mention suggests that something be
added to the Lucene FAQ and it was, with a link to the 1.9 apidocs
which shows the deprecated methods and alternatives.

http://lucene.apache.org/java/1_9_1/api/


--
Ian.


On Tue, Dec 16, 2008 at 7:09 PM, Oleg Oltar <[hidden email]> wrote:

> I am trying to fix my code now. I am using the
> http://markmail.org/message/4jupw4wnjn3gv7wh
>
> Replace all Field.Keyword/UnStored/Text/UnIndexed with the enumerated types,
> e.g.:
>
> - doc.add(Field.Keyword("animal", animal));
> + doc.add(new Field("animal", animal, Field.Store.YES,
> Field.Index.UN_TOKENIZED));
>
> So I replaced correspondent code with
> doc.add(new Field("filename", f.getCanonicalPath(), Field.Store.YES,
> Field.Index.UN_TOKENIZED));
>
> Can you please explain what is enumerated type.What should, I use  instead
> of Field.Text or Field.UnIndexed. Is there any doc about it?
>
>
> On Tue, Dec 16, 2008 at 3:04 PM, Erik Hatcher <[hidden email]>wrote:
>
>>
>> On Dec 16, 2008, at 6:57 AM, Oleg Oltar wrote:
>>
>>  Also maybe there are some free manuals/articles that you can recommend for
>>> starters?
>>>
>>
>> There's a bunch of stuff listed here: <
>> http://wiki.apache.org/lucene-java/Resources>
>>
>> Lucene has been changing so rapidly lately that I'm not aware of any
>> articles that are entirely up-to-date API-wise, but again in general most of
>> those API changes are pretty minor and actually well documented in Lucene's
>> CHANGES.txt and deprecation warnings (upgrading from 1.4 to 1.9, for
>> example, primed users with nice deprecation warnings with what was going to
>> be removed).
>>
>>
>>        Erik
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]