lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Sokolov <msoko...@gmail.com>
Subject Re: About custom score using Solr8/Lucene8
Date Mon, 06 Jul 2020 12:50:13 GMT
Did you read the DoubleValuesSource javadocs, and find they weren't enough?

On Sun, Jul 5, 2020 at 7:54 AM Vincenzo D'Amore <v.damore@gmail.com> wrote:
>
> Hi all,
>
> Finally I have a custom DoubleValuesSource that gives the expected results,
> but I'm a little worried about the lack of documentation.
>
> When you extend DoubleValuesSource there are a number of methods to write,
> for some of them it is not clear what they do and why they need to be
> implemented.
> Here I've listed the mandatory methods:
>
>     public abstract DoubleValues getValues(LeafReaderContext var1,
> DoubleValues var2) throws IOException;
>     public abstract boolean needsScores()
>     public abstract DoubleValuesSource rewrite(IndexSearcher var1) throws
> IOException;
>     public boolean isCacheable(LeafReaderContext ctx);
>     public abstract int hashCode();
>     public abstract boolean equals(Object var1);
>
> for some of them I could imagine why (hashCode() or equals()) but what
> about the others?
> As said, I wrote an implementation of getValues that returns the expected
> results (I've compared the results with the old version), but for many
> methods I've just mimed (copied) the code found in other implementations.
> So why does needsScores() always return false, how to implement
> correctly isCacheable() ?
> Anyone could write a short description of these methods and how they
> have to be implemented?
>
> Best regards,
> Vincenzo
>
> On Sat, Jul 4, 2020 at 3:29 AM Vincenzo D'Amore <v.damore@gmail.com> wrote:
>
> > Hi all, I did few steps forward but still struggling in how read the field
> > value inside my custom DoubleValuesSource
> >
> >                     final CustomValuesSource valuesSource = new
> > CustomValuesSource(data, req.getSchema().getField(field));
> >                     return FunctionScoreQuery.boostByValue(query,
> > valuesSource);
> >
> > CustomValuesSource extends DoubleValuesSource
> >
> > But, if I did right, I'm struggling with the getValues code.
> >
> > public DoubleValues getValues(LeafReaderContext ctx, DoubleValues scores)
> > throws IOException {
> >
> > The field I have to read is a binary field, and I can't find an example
> > how to read a binary field from LeafReaderContext
> >
> > Any help appreciated.
> >
> > Best regards,
> > Vincenzo
> >
> > On Thu, Jul 2, 2020 at 1:19 PM Vincenzo D'Amore <v.damore@gmail.com>
> > wrote:
> >
> >> Hi Mikhail, I was just trying to understand how to extend
> >> DoubleValuesSource class, now I'm looking around to find an inspiring
> >> example...
> >>
> >> On Thu, Jul 2, 2020 at 12:55 PM Mikhail Khludnev <mkhl@apache.org> wrote:
> >>
> >>> Hi, Vincenzo.
> >>>
> >>> Have you tried to implement DoubleValuesSource ?
> >>>
> >>> On Thu, Jul 2, 2020 at 9:58 AM Vincenzo D'Amore <v.damore@gmail.com>
> >>> wrote:
> >>>
> >>> > Again, @Federico Pici or anybody, did you figure out how to
> >>> > port CustomScoreQuery in Solr8?
> >>> >
> >>> > On Tue, Jul 23, 2019 at 1:05 AM Xiaofei <me@xiaofei.ca> wrote:
> >>> >
> >>> > > @Federico Pici, did you figure out on how to produce customized
> >>> score in
> >>> > > Solr
> >>> > > 8?
> >>> > >
> >>> > >
> >>> > >
> >>> > > --
> >>> > > Sent from:
> >>> > > http://lucene.472066.n3.nabble.com/Lucene-Java-Users-f532864.html
> >>> > >
> >>> > > ---------------------------------------------------------------------
> >>> > > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >>> > > For additional commands, e-mail: java-user-help@lucene.apache.org
> >>> > >
> >>> > >
> >>> >
> >>> > --
> >>> > Vincenzo D'Amore
> >>> >
> >>>
> >>>
> >>> --
> >>> Sincerely yours
> >>> Mikhail Khludnev
> >>>
> >>
> >>
> >> --
> >> Vincenzo D'Amore
> >>
> >>
> >
> > --
> > Vincenzo D'Amore
> >
> >
>
> --
> Vincenzo D'Amore

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