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?


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


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