Hi Roopa,
that's clearer now, thanks.

I don't think there's any support for feature extraction from children when
calculating the feature vector of a parent.
It's an interesting feature though.
I would love to design and implement such functionality.
If you want to do that on your own I recommend working from the current
supported features implementations
(/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature)

Cheers
--------------------------
Alessandro Benedetti
Apache Lucene/Solr Committer
Director, R&D Software Engineer, Search Consultant

www.sease.io


On Tue, 22 Jun 2021 at 19:47, Roopa Rao <roop...@gmail.com> wrote:

> Hi Alessandro,
>
> Thanks for the response.
>
> I am using version Solr 6.6
>
> Basically, I have parent documents and multiple child documents for each
> parent.
> I am trying to create features and get feature scores on parent attributes
> (which is straightforward) and child attributes (which is what I am looking
> for examples).
> And then rerank documents based on an LTR model which will use these
> features (on both parent & child).
>
> Enclosing the parent-child structure and the query construction (where you
> can see I am using a child transformer) and also a sample feature, current
> sample features score output.
>
>
> <doc>
>     <str name="id">abc-1</str>
>     <str name="unique_id_s">feature-1281835650</str>
>     <str name="type">parent-docs</str>
>     <str name="title_s">Parent title1 text1 </str>
>     <str name="summary_s">Parent summary1 text2</str>
>
>     <doc>
>         <str name="id">child-doc-12345</str>
>         <str name="unique_id_s">feature-1281835650</str>
>         <str name="type">child-docs</str>
>         <str name="child_doc_resource_id_s">9735</str>
>         <str name="child_doc_resource_desc_s">A sample child doc desc</str>
>         <date name="child_doc_dt">2021-09-01T00:00:00Z</date>
>         <arr name="child_doc_product_s_mult">
>             <str>productA</str>
>             <str>productB</str>
>             <str>productC</str>
>         </arr>
>     </doc>
>     <doc>
>         <str name="id">child-doc-56788</str>
>         <str name="unique_id_s">feature-1281835650</str>
>         <str name="type">child-docs</str>
>         <str name="child_doc_resource_id_s">3426</str>
>         <str name="child_doc_resource_desc_s">A sample child doc desc -
> 2</str>
>         <date name="child_doc_dt">2021-09-02T00:00:00Z</date>
>         <arr name="child_doc_product_s_mult">
>             <str>productD</str>
>             <str>productE</str>
>             <str>productF</str>
>         </arr>
>     </doc>
> </doc>
>
> Query construction:
> Get documents based on search of parent document attributes - title,
> summary.
> Get the corresponding child document in the response, filtered by products
> eligible to, restrict to 1 (for display purposes).
> Rerank based on a model and get feature scores on both attributes on parent
> and attributes on child.
>
> https://localhost:8983/testhandler?q=trying to
>
> test&rows=100&start=0&q.op=AND&timeAllowed=20000&fl=id,score,title_s,summary_s,[features
> store=testFeatureStore],[explain]&fl=_childDocuments_&fl=[child
> parentFilter='type:parent-docs' childFilter='((type:(child-docs)) AND
> ({!terms f=child_doc_product_s_mult}productA,productD))'
> limit=1]&sort=score
>
> desc&fq=(type:(parent-docs))&defType=edismax&df=title_qf_default&q.alt=*:*&pf=title_qf_default^2.0
> title_qf_synonym^2.0&qf=title_qf_default^2.0
> summary_qf_default^1.0&sow=false&lowercaseOperators=false&tie=0.0&rq={!ltr
> model=testModel reRankDocs=100 efi.uq=$q}
>
> Here trying to create features for title_s match with uq (user query) -
> which works fine since it is on the parent.
> Sample feature:
> {
>     "name": "feature_title_match",
>     "class": "org.apache.solr.ltr.feature.SolrFeature",
>     "params": {
>     "q": "{!dismax qf=title_qf_default}${uq:none}"
>     },
>     "store": "testFeatureStore"
> }
>
> Similarly I need to create features for child_doc_resource_desc_s match
> with uq (user query) and a few more features on child_doc attributes.
>
> Right now I am getting scores on the parent attributes as expected.
>
> *However writing features on the child document attributes and getting
> feature scores for them is what I am looking for:*
> Current Sample output:
>
> <str
>
> name="[features]">originalScore=61.886406,feature_title_match=8.004536,feature_summary_match=3.340,feature_title_synonym_expansion=15.471601</str>
>
> Similarly want to build features: feature_child_doc_resource_desc which
> would give a feature score of user query matched with
> child_doc_resource_desc_s attribute of the child doc:
>
> So an output like this may be? or feature scores on child comes under each
> child document not sure
> <str
>
> name="[features]">originalScore=61.886406,feature_title_match=8.004536,feature_summary_match=3.340,feature_title_synonym_expansion=15.471601,feature_child_doc_resource_desc=value1</str>
>
>
> Thank you!
> Roopa
>
> On Tue, Jun 22, 2021 at 1:04 PM Alessandro Benedetti <a.benede...@sease.io
> >
> wrote:
>
> > Hi Roopa,
> > can you elaborate a bit better?
> > Child documents are documents nonetheless, so you can query them, rank
> them
> > and re0rank them.
> > So, what are you trying to do?
> > Are you using any block join related query parsers?
> > Do you want to combine it with learning to rank?
> > How?
> > Let us know and we can try to help!
> >
> > --------------------------
> > Alessandro Benedetti
> > Apache Lucene/Solr Committer
> > Director, R&D Software Engineer, Search Consultant
> >
> > www.sease.io
> >
> >
> > On Mon, 21 Jun 2021 at 19:12, Roopa Rao <roop...@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > Is there a way to get the feature score on fields on the childDocuments
> > in
> > > LTR.
> > > Note that there could be multiple childDocuments.
> > >
> > > If there are example features that can be provided which uses query on
> > the
> > > child documents will be helpful
> > >
> > > Thank you,
> > > Roopa
> > >
> >
>

Reply via email to