lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: setBoost(float) in org.apache.lucene.document.Field cannot be applied to (double)???
Date Sun, 07 Aug 2005 17:23:32 GMT
A Lucene Highlighter Jar is included in the Lucene in Action code.
The link to downloadable code is at http://lucenebook.com/

Otis

--- Riccardo Daviddi <rdaviddi@gmail.com> wrote:

> I don't know where I am wrong...
> 
> I just do this:
> 
> IndexWriter writer = new IndexWriter(indexDir, new
> StandardAnalyzer(),
>                                           
> !IndexReader.indexExists(indexDir));
> writer.setUseCompoundFile(true);
> Document document = new Document();
> document.add(Field.Keyword("DocId", Integer.toString(docId)));
> Field f = Field.Text("boostfield", "text");
> f.setBoost(3.0f);
> document.add(f);
> writer.addDocument(document);
>         writer.optimize();
>         writer.close();
> 
> if then i try to get the boost factor of the boostfield 
> 
>
System.out.println(IndexReader.open(indexDir).document(0).getField("boostfield").getBoost());
> 
> for the only one document indexed I get 1.0 instead of 3.0!
> 
> where is the error?
> 
> thx
> 
> On 8/4/05, Otis Gospodnetic <otis_gospodnetic@yahoo.com> wrote:
> > Yes. use 1.2f there.  That method accepts floats, not doubles. 
> That
> > could be an error in the Lucene book.
> > 
> > Otis
> > 
> > 
> > --- Riccardo Daviddi <rdaviddi@gmail.com> wrote:
> > 
> > > Why I got this error by writing for example:
> > >
> > > Field senderNameField = Field.Text("senderName", senderName);
> > > Field subjectField = Field.Text("subject", subject);
> > > subjectField.setBoost(1.2);
> > >
> > > as in the manual lucene in action??
> > >
> > > 1.2 is a double, but the method wants a float?
> > > --
> > > Riccardo Daviddi
> > >
> > >
> ---------------------------------------------------------------------
> > > 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
> > 
> > 
> 
> 
> -- 
> Riccardo Daviddi
> University of Siena - Information Engeneering
> rdaviddi@gmail.com
> 
> ---------------------------------------------------------------------
> 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