HI !
Thank you for your help.
I think I don't use CustomScoreQuery correctly when I do a "search".

BooleanQuery combinedQuery = new BooleanQuery();
combinedQuery.add(textQuery, Occur.MUST);
combinedQuery.add(titleQuery, Occur.MUST);

CustomScoreQuery customQuery = new CustomScoreQuery(combinedQuery,new
FieldScoreQuery(BOOST_FIELD,Type.INT));

indexSearcher.search(..., customQuery, ....).

in order to index the BOOST_FIELD, I do that :
Field boostField = new Field(BOOST_FIELD, Integer.toString(boost),
Field.Store.YES, Field.Index.ANALYZED.NO);


Is that correct ?
Thank you




Uwe Schindler wrote:
> 
> It's CustomScoreQuery in 2.9 and 3.0.
> 
> Please wait for 2.9.2 and 3.0.1 for an important API change in this
> experimental query type to work correct with the new per-segment-search!
> You can test the release artifacts of both new versions here:
> http://people.apache.org/~uschindler/staging-area/lucene-292-301-take2-rev912433/
> 
> With e.g. ValueSourceQuery you can score your documents using a separate
> numeric field from your documents (it uses FieldCache).
> 
> Uwe
> 
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: u...@thetaphi.de
> 
>> -----Original Message-----
>> From: Ian Lea [mailto:ian....@gmail.com]
>> Sent: Monday, February 22, 2010 10:33 AM
>> To: java-user@lucene.apache.org
>> Subject: Re: Boost Problem (again), need example !
>> 
>> Can't you simply sort by descending score (your score, not lucene's)?
>> Seems to me that would give you what you are asking for.
>> 
>> The setBoost() method is unlikely to work consistently because it only
>> infuences the score rather than setting it.  If your John Mickeal doc
>> happens to have a higher lucene score, because of the normal
>> idf/tf/etc stuff, then the setBoost() with a higher value for John
>> Smith may well not be enough to force John Smith to the top.
>> 
>> I don't know enough about function queries to help you much there but
>> FieldScoreQuery might work.  I can't see any sign of class
>> FunctionQuery in the 3.0.0 core package so am not clear what that is.
>> 
>> 
>> --
>> Ian.
>> 
>> 
>> 
>> On Mon, Feb 22, 2010 at 8:54 AM, pdaures <patrick.dau...@gmail.com>
>> wrote:
>> >
>> > Hi,
>> > I know that there are many topics about scoring issues, but I didn't
>> find an
>> > answer in the topics.
>> > This is the problem :
>> > Imagine I'm a teacher, and I have to index all the results, comments
>> and
>> > score about students.
>> >
>> > Student :
>> > String name (eg : John Smith)
>> > String comments : (eg: John is a good student, but he needs to be
>> more self
>> > confident bla bla bla)
>> > float score (eg : 98)
>> >
>> > I have to index all the students and when I use the search class, I
>> want to
>> > get first the best students. So, if John Smith is a better student
>> than John
>> > Mickael, when I search "John" I want to have John Smith BEFORE John
>> Mickeal.
>> >
>> > To do that, I'm using BooleanQuery to search in name and comment
>> fields.
>> >
>> > First, I thought I could use the function Document.setBoost(float
>> boost)
>> > while indexing student, with boost = Student.score. But the result
>> was not
>> > what I was expected, it didn't work correctly.
>> >
>> > Then I thought I could use a FunctionQuery to search :
>> > FunctionQuery functionQuery = new FunctionQuery(new
>> > ReverseOrdFieldSource("score"));
>> > But the result was still incorrect.
>> >
>> > I don't know what I'm doing wrong. Could you help me to find a
>> solution ?
>> > Thank you :)
>> > --
>> > View this message in context: http://old.nabble.com/Boost-Problem-
>> %28again%29%2C-need-example-%21-tp27684388p27684388.html
>> > Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
>> > For additional commands, e-mail: java-user-h...@lucene.apache.org
>> >
>> >
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
>> For additional commands, e-mail: java-user-h...@lucene.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Boost-Problem-%28again%29%2C-need-example-%21-tp27684388p27685594.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to