lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: Lucene in Action examples complie problem
Date Tue, 10 Oct 2006 19:05:41 GMT
I have long been meaning to publish an updated codebase for Lucene in  
Action compatible with Lucene 2.0.  I adjusted the code a while ago,  
but I haven't published it yet (and I think the plan is to wait until  
LIA2 is finished to do so).  I did make notes when I made these  
changes, and I'm pasting them below for all to benefit from.

Replace all BooleanQuery.add's, e.g.:

    -      subjectQuery.add(tq, false, false);
    +      subjectQuery.add(tq, BooleanClause.Occur.SHOULD);

Substitute RangeFilter for DateFilter usage, e.g.:

    -    DateFilter filter = new DateFilter("modified", jan1, dec31);
    +    RangeFilter filter = new RangeFilter("modified", jan1,  
dec31, true, true);

    NOTE: The dates are now String's generated by  
DateUtils.dateToString() and incompatible with DateField

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,  

Rename PhrasePrefixQuery -> MultiPhraseQuery

Use instance of QueryParser instead of static parse method, e.g.:

    -        Query query = QueryParser.parse(expression, "contents",  
    +        Query query = new QueryParser("contents", analyzer).parse 

QueryParser subclasses adjusted for overridden getXXXQuery method  

IndexReader.delete() updated to be  

IndexWriter internal configuration values now accessed through  
getters/setters rather than the fields directly, with minMergeDocs  
renamed as setMaxBufferedDocs().

QueryParser.setLowercaseWildcardTerms() replaced  
with .setLowercaseExpandedTerms()

QueryParser.getRangeQuery() still uses DateField when constructing a  
   If your index is built using DateTools, you will need to subclass  
and override, as shown in QueryParserTest.testRangeQuery().

On Oct 10, 2006, at 2:13 PM, Serhiy Polyakov wrote:

> Hi,
> I started to study Lucene following the book Lucene in Action.
> I am trying to compile book examples downloaded from the book site:
> When I am trying to compile first example ( it gives me
> the following error:
> LuceneInAction\src\lia\meetlucene\ cannot find symbol
> symbol  : method Text(java.lang.String,
> location: class org.apache.lucene.document.Field
>    doc.add(Field.Text("contents", new FileReader(f)));
> I know that file lucene-core-2.0.0.jar is in CLASSPATH and other  
> classes like
> org.apache.lucene.index.IndexWriter are working OK. The only class I
> am having problem with is org.apache.lucene.document.Field;
> Can you suggest something?
> Thanks,
> Serhiy
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message