Hi Paul, Sorry I am not sure I understand your solution.
Because I would need to apply this scoring logic to all the different types of Queries. A search may consists of something like: +(term1 phrase2 wildcard*) +spanNear(term3 term4) [10/5/2] And this [10/5/2] ratio have to be applied to the whole search query before it. So I am not sure how would using just SpanFirstQuery with a separate field work in this situation. Anyway, I know my requirement is a bit strange, so it's ok if I can't do this in Lucene. I'll settle with using a ThreadLocal to store the [10/5/2] weighting and retrieve it in the Similarity.scorePayload(...) function. BTW, this problem I am facing now is different from the last one I asked here, which you have proposed with the Modified SpanFirstQuery solution =) But I am really grateful with all the helps I get here. Keep up the good work! Cheers, Cedric On Thu, Feb 14, 2008 at 2:58 PM, Paul Elschot <[EMAIL PROTECTED]> wrote: > Op Thursday 14 February 2008 02:11:24 schreef Cedric Ho: > > > I am using Lucene's Built-in query classes: TernQuery, PhraseQuery, > > WildcardQuery, BooleanQuery and many of the SpanQueries. > > > > The info I am going to pass in is just some weightings for different > > part of the indexed contents. For example if the payload indicate that > > a term is in the 2nd paragraph, then I'll take the weighting for the > > 2nd paragraph and multiply it by the score. > > > > So it seems without writing my own query there's no way to do it ? > > In case it is only positional information that is stored in the payload > (i.e. some integer number that does not decrease when tokenizing the > document), it is also possible to use an extra field and make sure the > position increment for that field is only positive when the number > (currently your payload) increases. > A SpanFirstQuery on this extra field would almost do, and you will > probably need https://issues.apache.org/jira/browse/LUCENE-1093 . > This will be somewhat slower than using a payload, because the search > will be done in two separate fields, but it will work. > > Regards, > Paul Elschot > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]