文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Lucene in Action examples compile problem

Lucene in Action examples compile problem

时间:2007-10-07  来源:linxh

本文转自: http://www.nabble.com/Lucene-in-Action-examples-complie-problem-tf2418478.html#a6743189
 
by Erik Hatcher Oct 11, 2006; 03:05am :: Rate this Message:    (use ratings to moderate[?])


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
>
>

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载