Please see the answers below.

On Tue, Jan 16, 2018 at 8:40 AM, Mikhail Khludnev <m...@apache.org> wrote:

> On Tue, Jan 16, 2018 at 10:30 AM, Dariusz Wojtas <dwoj...@gmail.com>
> wrote:
>
> > Hello Mikhail,
> >
> > I've tried it and the query executes, but it does not treat strdist() as
> a
> > function to execute.
> > Looks like each part of the function - it's name and parameters - are
> > treated as keywords to search for against the default field.
> >
> Can you post the exact observations, rather than interpretation?
>

Yes,
Here is the output of the original query proposed, where I believe strdist
call is not treated as a function. keyword1 if the default search field:

<str name="parsedquery">
firstName:Adam AllParentsAware(ToParentBlockJoinQuery (type:address
keyword1:strdic (keyword1:shakespear keyword1:address.streeo
keyword1:edit)))
</str>
This is not a function interpretation call.


> If I try something different:
> >
> >    q=+firstName:Adam +{!parent which=type:record
> v=$chq}&chq=+type:address
> > +{!func}strdist('Shakespeare',address.street, edit)
> >
> > then I get exception:
> >   org.apache.solr.search.SyntaxError: Missing end to unquoted value
> > starting at 37 str='strdist('Shakespeare',address.street,'
> >
> This particular query failed because of the space. Here is my pet peeve in
> Solr: the syntax {!foo} captures whole string if it's in beginning of the
> string, but in the middle of the string it captures only substring until
> the first space.
> So, after removing space it should work fine. Another potential issues are:
> single quotes (do they it ever supported?), and the dot in the fieldname
> (you never know).



Yes, it's been about the space first, then about the dot in the name of the
nested field 'address.street'.
After many failed attempts with various escaping modes, I have executed it
with double parameter dereferencing, but have faced another issue:

q=+firstName:Adam + {!parent which='type:record' score='max' v=$chq1}
chq1=+type:address +{!func v='$chq2'}
chq2=strdist('Shakespeare',address.street,edit)

java.lang.IllegalStateException: Child query must not match same docs with
parent filter. Combine them as must clauses (+) to find a problem doc.
docId=5, class org.apache.lucene.search.DisjunctionSumScorer at
org.apache.lucene.search.join.ToParentBlockJoinQuery$BlockJoinScorer.setScoreAndFreq(ToParentBlockJoinQuery.java:327)
at
org.apache.lucene.search.join.ToParentBlockJoinQuery$BlockJoinScorer.score(ToParentBlockJoinQuery.java:286)
at
org.apache.lucene.search.BooleanScorer$OrCollector.collect(BooleanScorer.java:142)
at
org.apache.lucene.search.Weight$DefaultBulkScorer.scoreRange(Weight.java:208)
at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:195)
at
org.apache.lucene.search.BooleanScorer$BulkScorerAndDoc.score(BooleanScorer.java:61)
at
org.apache.lucene.search.BooleanScorer.scoreWindowIntoBitSetAndReplay(BooleanScorer.java:213)
at
org.apache.lucene.search.BooleanScorer.scoreWindowMultipleScorers(BooleanScorer.java:260)
at
org.apache.lucene.search.BooleanScorer.scoreWindow(BooleanScorer.java:305)
at org.apache.lucene.search.BooleanScorer.score(BooleanScorer.java:317) at
org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39) at
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:658) at
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:462) at
org.apache.solr.search.SolrIndexSearcher.buildAndRunCollectorChain(SolrIndexSearcher.java:215)
at
org.apache.solr.search.SolrIndexSearcher.getDocListNC(SolrIndexSearcher.java:1591)
at
org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1408)
at
org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:575)
at


Any hint now?
Mo goal is to return the result of the strdist() function on a nested
document field.

Best regards,
Dariusz Wojtas


>
> > Best regards,
> > Dariusz Wojtas
> >
> >
> >
> >
> > On Tue, Jan 16, 2018 at 4:04 AM, Mikhail Khludnev <m...@apache.org>
> wrote:
> >
> > > Hello, Dariusz.
> > >
> > > It should be something like
> > > q=+firstName:Adam +{!parent which=type:record
> > > v=$chq}&chq=+type:address +strdist('Shakespeare',
> > > address.street, edit)
> > > post exception if it doesn't work.
> > >
> > > On Tue, Jan 16, 2018 at 1:39 AM, Dariusz Wojtas <dwoj...@gmail.com>
> > wrote:
> > >
> > > > Hi,
> > > >
> > > > Is it possible to use the strdist() function to return distance on
> the
> > > > child document field?
> > > > Let's say I have:
> > > >
> > > > <doc>
> > > >    <str name="id">1</str>
> > > >    <str name="type">record</str>
> > > > <str name="firstName">Adam</str>
> > > > <doc>
> > > >       <str name="id">A1</str>
> > > >       <str name="type">address</str>
> > > >       <str name="address.type">business</str>
> > > >       <str name="address.street">Shakespeare</str>
> > > > </doc>
> > > > <doc>
> > > >       <str name="id">A2</str>
> > > >       <str name="type">address</str>
> > > >       <str name="address.type">correspondence</str>
> > > >       <str name="address.street">Baker Street</str>
> > > > </doc>
> > > > </doc>
> > > >
> > > > What I want to do is to search for documents:
> > > >   type:record
> > > >   firstName:Adam
> > > >   and return max strdist('Shakespeare', address.street, edit) as the
> > > > resulting score?
> > > >
> > > > or
> > > >   type:record
> > > >   firstName:Adam
> > > >   and return max strdist('Shakespeare', address.street, edit) of
> > > > "address.type:business" as the resulting score?
> > > >
> > > > I am trying with the {!parent} mode and {!function}, various
> > > combinations.
> > > > But I do not get what I'd expect.
> > > >
> > > > Best regards,
> > > > Dariusz Wojtas
> > > >
> > >
> > >
> > >
> > > --
> > > Sincerely yours
> > > Mikhail Khludnev
> > >
> >
>
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>

Reply via email to