lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
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,  
Field.Index.UN_TOKENIZED));


Rename PhrasePrefixQuery -> MultiPhraseQuery

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

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


QueryParser subclasses adjusted for overridden getXXXQuery method  
signatures.

IndexReader.delete() updated to be  
IndexReader.deleteDocument/.deleteDocuments()

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  
RangeQuery.
   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:
> http://www.manning.com/hatcher2/
>
> When I am trying to compile first example (Indexer.java) it gives me
> the following error:
>
> LuceneInAction\src\lia\meetlucene\Indexer.java:80: cannot find symbol
> symbol  : method Text(java.lang.String,java.io.FileReader)
> 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: 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