lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: understanding lucene
Date Sun, 08 Aug 2010 09:23:10 GMT
The example code you found is very old (seems to be from the Version 1.x of
Lucene), and is not working with Version 2.x or 3.x of Lucene (previously
deprecated "Hits" class is gone in 3.0, "static" Field constructors were
gone long time ago in 2.0, so you get compilation errors).

If you want to learn Lucene, buy the Book "Lucene in Action - 2nd Edition",
there is everything explained and lots of examples for everyday use with the
newest Version 3.0.2. See http://www.manning.com/hatcher2/ for ordering the
PDF version or go to your local bookstore.

In all cases, if you are new to Lucene don't use version 2.9.x or earlier,
use 3.0.x with its clean API. This makes it easier for beginners.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Yakob [mailto:jacobian@opensuse-id.org]
> Sent: Sunday, August 08, 2010 11:11 AM
> To: java-user@lucene.apache.org
> Subject: Re: understanding lucene
> 
> ok I had tried to run some sample lucene application I found on the
internet
> such this one from
> 
> http://javatechniques.com/blog/lucene-in-memory-text-search-example/
> 
> and this is the source code, I put it in pastebin so it will be easier to
edit.
> 
> http://pastebin.ca/1913109
> 
> but still when I tried to run it using --deprecated option I ran into some
errors
> that made me difficult to solve it. the errors is this.
> 
> C:\Users\Raden\Documents\lucene\lucenedd>javac -Xlint:deprecation
> InMemoryExampl e.java
> InMemoryExample.java:7: warning: [deprecation]
> org.apache.lucene.search.Hits in org.apache.lucene.search has been
> deprecated import org.apache.lucene.search.Hits;
>                                ^
> InMemoryExample.java:29: warning: [deprecation]
> IndexWriter(org.apache.lucene.st
> ore.Directory,org.apache.lucene.analysis.Analyzer,boolean) in
> org.apache.lucene.
> index.IndexWriter has been deprecated
>                 new IndexWriter(idx, new StandardAnalyzer(), true);
>                 ^
> InMemoryExample.java:82: cannot find symbol symbol  : method
> unIndexed(java.lang.String,java.lang.String)
> location: class org.apache.lucene.document.Field
>         doc.add(Field.UnIndexed("title", title));
>                      ^
> InMemoryExample.java:89: cannot find symbol symbol  : method
> text(java.lang.String,java.io.StringReader)
> location: class org.apache.lucene.document.Field
>         doc.add(Field.Text("content", new StringReader(content)));
>                      ^
> InMemoryExample.java:101: parse(java.lang.String) in
> org.apache.lucene.queryPars er.QueryParser cannot be applied to
> (java.lang.String,java.lang.String,org.apach
> e.lucene.analysis.standard.StandardAnalyzer)
>         Query query = QueryParser.parse(
>                                  ^
> InMemoryExample.java:105: warning: [deprecation]
> org.apache.lucene.search.Hits i n org.apache.lucene.search has been
> deprecated
>         Hits hits = searcher.search(query);
>         ^
> InMemoryExample.java:105: warning: [deprecation]
> search(org.apache.lucene.search
> .Query) in org.apache.lucene.search.Searcher has been deprecated
>         Hits hits = searcher.search(query);
>                             ^
> 3 errors
> 4 warnings
> 
> I use deprecated option because there is some java class that's already
> deprecated. but still there is some errors.
> 
> I was just wondering if I can get any tips of how to fix this errors or
else maybe
> I can get a link to other working lucene sample program.
> because it's a bit hard for me to learn lucene if I don't have any working
> program based on lucene.
> 
> any help would be greatly appreciated.
> --
> http://jacobian.web.id
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message