You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Vasily Ogar <og...@gmail.com> on 2019/11/11 10:19:08 UTC

sort by score in join with geodist()

Hello,
Is it possible to sort by score in join by geodist()? For instance,
something like this
q={!join from=site_id to=site_id fromIndex=stores score=max}
+{!func}gedist() +{!geofilt sfield=coordinates
pt=54.69738679999999,25.224815300000046 d=10}
sort=score desc
Thank you

Re: sort by score in join with geodist()

Posted by Vasily Ogar <og...@gmail.com>.
Wow, it's working as expected, thank you very much. I spent three weeks to
define Solr structure and build a query with expected results. Thanks again
because I am almost lost a hope to get what I want.

On Fri, Nov 15, 2019 at 6:05 AM Mikhail Khludnev <mk...@apache.org> wrote:

> Hm...
> q={!join param=param.. v=$g}&q={!bool must='{!geofilt}'
> should='{!func}geodist()'} ?
>
> On Thu, Nov 14, 2019 at 10:11 PM Vasily Ogar <og...@gmail.com>
> wrote:
>
> > I tried and this way also, but here is another error.
> > { "responseHeader":{ "status":400, "QTime":6, "params":{ "hl":"on", "pt":
> > "54.69738679999999,25.224815300000046", "fl":"score,*,store:[subquery
> > fromIndex=stores]", "store.rows":"1", "fq":"{!edismax qf=\"title
> > description\" v=\"iphone xr 64gb\" mm=3<90%}", "hl.simple.pre":"</em>", "
> > store.q":"{!terms f=site_id v=$row.site_id}",
> "store.sfield":"coordinates",
> > "hl.fl":"title description", "group.field":"site_id",
> "_":"1573559644298",
> > "
> > group":"true", "store.fq":"{!geofilt}", "d":"100", "group.limit":"2", "
> > store.d":"100", "store.pt":"54.69738679999999,25.224815300000046",
> > "store.fl
> > ":"*,score", "sort":"score desc", "sfield":"coordinates", "q":"{!join
> > from=site_id to=site_id fromIndex=stores score=max}+{!geofilt}
> > {!func}geodist() ", "hl.simple.post":"</em>", "hl.q":"{!edismax qf=$hl.fl
> > v=\"iphone xr 64gb\"}", "hl.method":"unified", "debugQuery":"on"}},
> > "error":{
> > "metadata":[ "error-class","org.apache.solr.common.SolrException",
> > "root-error-class","org.apache.solr.search.SyntaxError"],
> > "msg":"org.apache.solr.search.SyntaxError:
> > Expected ')' at position 8 in 'geodist('", "code":400}}
> >
> > On Thu, Nov 14, 2019 at 9:05 PM Mikhail Khludnev <mk...@apache.org>
> wrote:
> >
> > > Space matters. Check my snippet once again please.
> > >
> > > On Thu, Nov 14, 2019 at 9:56 PM Vasily Ogar <og...@gmail.com>
> > wrote:
> > >
> > > > I tried today with plus but always got same error.
> > > > { "responseHeader":{ "status":400, "QTime":2, "params":{ "hl":"on",
> > "pt":
> > > > "54.69738679999999,25.224815300000046", "fl":"score,*,store:[subquery
> > > > fromIndex=stores]", "store.rows":"1", "fq":"{!edismax qf=\"title
> > > > description\" v=\"iphone xr 64gb\" mm=3<90%}",
> > "hl.simple.pre":"</em>", "
> > > > store.q":"{!terms f=site_id v=$row.site_id}",
> > > "store.sfield":"coordinates",
> > > > "hl.fl":"title description", "group.field":"site_id",
> > > "_":"1573559644298",
> > > > "
> > > > group":"true", "store.fq":"{!geofilt}", "d":"100",
> "group.limit":"2", "
> > > > store.d":"100", "store.pt":"54.69738679999999,25.224815300000046",
> > > > "store.fl
> > > > ":"*,score", "sort":"score desc", "sfield":"coordinates", "q":"{!join
> > > > from=site_id to=site_id fromIndex=stores
> > > > score=max}+{!geofilt}{!func}geodist()", "hl.simple.post":"</em>",
> > > > "hl.q":"{!edismax
> > > > qf=$hl.fl v=\"iphone xr 64gb\"}", "hl.method":"unified",
> > > > "debugQuery":"on"}},
> > > > "error":{ "metadata":[
> > > > "error-class","org.apache.solr.common.SolrException",
> > > > "root-error-class","org.apache.solr.parser.ParseException"],
> > > > "msg":"org.apache.solr.search.SyntaxError:
> > > > Cannot parse '+{!geofilt}{!func}geodist()': Encountered \" \")\" \")
> > \"\"
> > > > at line 1, column 26.\nWas expecting one of:\n <EOF> \n <AND> ...\n
> > <OR>
> > > > ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n <BAREOPER> ...\n \"(\"
> ...\n
> > > > \"*\" ...\n \"^\" ...\n <QUOTED> ...\n <TERM> ...\n <PREFIXTERM>
> ...\n
> > > > <WILDTERM> ...\n <REGEXPTERM> ...\n \"[\" ...\n \"{\" ...\n <LPARAMS>
> > > ...\n
> > > > \"filter(\" ...\n <NUMBER> ...\n ", "code":400}}
> > > >
> > > > On Thu, Nov 14, 2019 at 8:45 PM Mikhail Khludnev <mk...@apache.org>
> > > wrote:
> > > >
> > > > > It should be like
> > > > > "q":"{!join from=site_id to=site_id fromIndex=stores
> > > > > score=max}+{!geofilt} {!func}geodist() ",
> > > > > post debugQuery
> > > > >
> > > > > On Thu, Nov 14, 2019 at 4:44 PM Vasily Ogar <ogar.vasily@gmail.com
> >
> > > > wrote:
> > > > >
> > > > > > I was glad too early because it can only sort or only filter, but
> > > can't
> > > > > do
> > > > > > together :(. It takes the only first argument, in my case it
> > geodist
> > > or
> > > > > > geofilt
> > > > > >
> > > > > > On Thu, Nov 14, 2019 at 11:11 AM Vasily Ogar <
> > ogar.vasily@gmail.com>
> > > > > > wrote:
> > > > > >
> > > > > > > Hello,
> > > > > > > I fixed it. If I need to sort by price:
> > > > > > > "q":"{!join from=site_id to=site_id fromIndex=stores}*:*",
> > > > > > > "fq":"{!edismax qf=\"title description\" v=\"iphone xr 64gb\"
> > > > > mm=3<90%}",
> > > > > > > "fl":"score,*,store:[subquery fromIndex=stores]",
> > > > > > > "store.q":"{!terms f=site_id v=$row.site_id}",
> "store.rows":"1",
> > > > > > "store.fl
> > > > > > > ":"*,score", "sort":"price_low desc",
> > > > > > > "hl":"on", "hl.simple.pre":"<strong>",
> > > "hl.simple.post":"</strong>",
> > > > > > > "hl.q":"{!edismax qf=$hl.fl v=\"iphone xr 64gb\"}",
> > "hl.fl":"title
> > > > > > > description", "hl.method":"unified", "group.field":"site_id",
> > > > "group":
> > > > > > > "true"
> > > > > > > "group.limit":"2",
> > > > > > >
> > > > > > > And if I need to sort by geodist:
> > > > > > > "q":"{!join from=site_id to=site_id fromIndex=stores
> > > > > > > score=max}{!func}geodist(){!geofilt}",
> > > > > > > "d":"100",
> > > > > > > "sfield":"coordinates",
> > > > > > > "pt":"54.69738679999999,25.224815300000046"
> > > > > > > "fq":"{!edismax qf=\"title description\" v=\"iphone xr 64gb\"
> > > > > mm=3<90%}",
> > > > > > > "fl":"score,*,store:[subquery fromIndex=stores]",
> > > > > > > "store.q":"{!terms f=site_id v=$row.site_id}",
> "store.rows":"1",
> > > > > > "store.fl
> > > > > > > ":"*,score",
> > > > > > > "store.fq":"{!geofilt}",
> > > > > > > "store.sfield":"coordinates",
> > > > > > > "store.d":"100", "store.pt
> > > ":"54.69738679999999,25.224815300000046",
> > > > > > "sort
> > > > > > > ":"score desc",
> > > > > > > "hl":"on", "hl.simple.pre":"<strong>",
> > > "hl.simple.post":"</strong>",
> > > > > > > "hl.q":"{!edismax qf=$hl.fl v=\"iphone xr 64gb\"}",
> > "hl.fl":"title
> > > > > > > description", "hl.method":"unified", "group.field":"site_id",
> > > > "group":
> > > > > > > "true"
> > > > > > > "group.limit":"2",
> > > > > > >
> > > > > > > On Tue, Nov 12, 2019 at 6:54 PM Vasily Ogar <
> > ogar.vasily@gmail.com
> > > >
> > > > > > wrote:
> > > > > > >
> > > > > > >> Thank you for advice, now it working as expected. Maybe you
> know
> > > how
> > > > > to
> > > > > > >> integrate with dismax?
> > > > > > >>
> > > > > > >> On Tue, Nov 12, 2019 at 6:10 PM Mikhail Khludnev <
> > mkhl@apache.org
> > > >
> > > > > > wrote:
> > > > > > >>
> > > > > > >>> tlrd;
> > > > > > >>> I noticed func under fq that make no sense. Only q or sort
> > yield
> > > > > > scores.
> > > > > > >>>
> > > > > > >>> On Tue, Nov 12, 2019 at 6:43 PM Vasily Ogar <
> > > ogar.vasily@gmail.com
> > > > >
> > > > > > >>> wrote:
> > > > > > >>>
> > > > > > >>> > First of all, thank you for your help.
> > > > > > >>> > Now it doesn't show any errors, but somehow score is based
> on
> > > the
> > > > > > >>> title and
> > > > > > >>> > description but not on the geodist.
> > > > > > >>> > "params":{ "hl":"on",
> > > > "pt":"54.69738679999999,25.224815300000046",
> > > > > > >>> > "fl":"score,*,store:[subquery
> > > > > > >>> > fromIndex=stores]", "store.rows":"1", "fq":"{!join
> > from=site_id
> > > > > > >>> to=site_id
> > > > > > >>> > fromIndex=stores score=max}{!func}geodist()",
> > > > > "store.sort":"geodist()
> > > > > > >>> asc",
> > > > > > >>> > "hl.simple.pre":"</em>", "store.q":"{!terms f=site_id
> > > > > > >>> v=$row.site_id}", "
> > > > > > >>> > store.sfield":"coordinates", "hl.fl":"title description",
> > > > > > >>> "group.field":
> > > > > > >>> > "site_id", "_":"1573559644298", "group":"true",
> > > > > > >>> "store.fq":"{!geofilt}", "d
> > > > > > >>> > ":"100", "{!geofilt}":"", "group.limit":"2",
> > "store.d":"100", "
> > > > > > >>> store.pt":
> > > > > > >>> > "54.69738679999999,25.224815300000046",
> "store.fl":"*,score",
> > > > > > >>> "sort":"score
> > > > > > >>> > desc", "sfield":"coordinates", "q":"title:\"iphone xr
> > 64gb\"",
> > > > > > >>> > "group.main":
> > > > > > >>> > "true", "hl.simple.post":"</em>", "debugQuery":"on"}
> > > > > > >>> >
> > > > > > >>> > Here is debug:
> > > > > > >>> > "debug":{ "rawquerystring":"title:\"iphone xr 64gb\"",
> > > > > > >>> > "querystring":"title:\"iphone
> > > > > > >>> > xr 64gb\"", "parsedquery":"PhraseQuery(title:\"iphon xr
> > > > 64gb\")", "
> > > > > > >>> > parsedquery_toString":"title:\"iphon xr 64gb\"",
> "explain":{
> > > > > > "product:
> > > > > > >>> >
> https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-yellow
> > > > > > >>> ":"\n3.9714882
> > > > > > >>> > =
> > > > > > >>> > weight(title:\"iphon xr 64gb\" in 568) [SchemaSimilarity],
> > > result
> > > > > > of:\n
> > > > > > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf,
> > sum
> > > > > of:\n
> > > > > > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n +
> > 0.5))
> > > > > > >>> from:\n 459
> > > > > > >>> > = n, number of documents containing term\n 1500 = N, total
> > > number
> > > > > of
> > > > > > >>> > documents with field\n 3.3156862 = idf, computed as log(1 +
> > (N
> > > -
> > > > n
> > > > > +
> > > > > > >>> 0.5) /
> > > > > > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing
> > > term\n
> > > > > 1500
> > > > > > >>> = N,
> > > > > > >>> > total number of documents with field\n 2.3686793 = idf,
> > > computed
> > > > as
> > > > > > >>> log(1 +
> > > > > > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of
> > documents
> > > > > > >>> containing
> > > > > > >>> > term\n 1500 = N, total number of documents with field\n
> > > > 0.5782502 =
> > > > > > tf,
> > > > > > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl))
> > > from:\n
> > > > > > 1.0 =
> > > > > > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n
> 0.75 =
> > > b,
> > > > > > length
> > > > > > >>> > normalization parameter\n 4.0 = dl, length of field\n
> > 8.384666
> > > =
> > > > > > avgdl,
> > > > > > >>> > average length of field\n", "product:
> > > > > > >>> > https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-white
> > > > > > ":"\n3.9714882
> > > > > > >>> =
> > > > > > >>> > weight(title:\"iphon xr 64gb\" in 569) [SchemaSimilarity],
> > > result
> > > > > > of:\n
> > > > > > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf,
> > sum
> > > > > of:\n
> > > > > > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n +
> > 0.5))
> > > > > > >>> from:\n 459
> > > > > > >>> > = n, number of documents containing term\n 1500 = N, total
> > > number
> > > > > of
> > > > > > >>> > documents with field\n 3.3156862 = idf, computed as log(1 +
> > (N
> > > -
> > > > n
> > > > > +
> > > > > > >>> 0.5) /
> > > > > > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing
> > > term\n
> > > > > 1500
> > > > > > >>> = N,
> > > > > > >>> > total number of documents with field\n 2.3686793 = idf,
> > > computed
> > > > as
> > > > > > >>> log(1 +
> > > > > > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of
> > documents
> > > > > > >>> containing
> > > > > > >>> > term\n 1500 = N, total number of documents with field\n
> > > > 0.5782502 =
> > > > > > tf,
> > > > > > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl))
> > > from:\n
> > > > > > 1.0 =
> > > > > > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n
> 0.75 =
> > > b,
> > > > > > length
> > > > > > >>> > normalization parameter\n 4.0 = dl, length of field\n
> > 8.384666
> > > =
> > > > > > avgdl,
> > > > > > >>> > average length of field\n", "product:
> > > > > > >>> > https://istore.lt/iphone-xr-64gb-blue.html":"\n3.9714882 =
> > > > > > >>> > weight(title:\"iphon xr 64gb\" in 28) [SchemaSimilarity],
> > > result
> > > > > > of:\n
> > > > > > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf,
> > sum
> > > > > of:\n
> > > > > > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n +
> > 0.5))
> > > > > > >>> from:\n 459
> > > > > > >>> > = n, number of documents containing term\n 1500 = N, total
> > > number
> > > > > of
> > > > > > >>> > documents with field\n 3.3156862 = idf, computed as log(1 +
> > (N
> > > -
> > > > n
> > > > > +
> > > > > > >>> 0.5) /
> > > > > > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing
> > > term\n
> > > > > 1500
> > > > > > >>> = N,
> > > > > > >>> > total number of documents with field\n 2.3686793 = idf,
> > > computed
> > > > as
> > > > > > >>> log(1 +
> > > > > > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of
> > documents
> > > > > > >>> containing
> > > > > > >>> > term\n 1500 = N, total number of documents with field\n
> > > > 0.5782502 =
> > > > > > tf,
> > > > > > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl))
> > > from:\n
> > > > > > 1.0 =
> > > > > > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n
> 0.75 =
> > > b,
> > > > > > length
> > > > > > >>> > normalization parameter\n 4.0 = dl, length of field\n
> > 8.384666
> > > =
> > > > > > avgdl,
> > > > > > >>> > average length of field\n", "product:
> > > > > > >>> > https://istore.lt/iphone-xr-64gb-coral.html":"\n3.9714882
> =
> > > > > > >>> > weight(title:\"iphon xr 64gb\" in 29) [SchemaSimilarity],
> > > result
> > > > > > of:\n
> > > > > > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf,
> > sum
> > > > > of:\n
> > > > > > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n +
> > 0.5))
> > > > > > >>> from:\n 459
> > > > > > >>> > = n, number of documents containing term\n 1500 = N, total
> > > number
> > > > > of
> > > > > > >>> > documents with field\n 3.3156862 = idf, computed as log(1 +
> > (N
> > > -
> > > > n
> > > > > +
> > > > > > >>> 0.5) /
> > > > > > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing
> > > term\n
> > > > > 1500
> > > > > > >>> = N,
> > > > > > >>> > total number of documents with field\n 2.3686793 = idf,
> > > computed
> > > > as
> > > > > > >>> log(1 +
> > > > > > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of
> > documents
> > > > > > >>> containing
> > > > > > >>> > term\n 1500 = N, total number of documents with field\n
> > > > 0.5782502 =
> > > > > > tf,
> > > > > > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl))
> > > from:\n
> > > > > > 1.0 =
> > > > > > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n
> 0.75 =
> > > b,
> > > > > > length
> > > > > > >>> > normalization parameter\n 4.0 = dl, length of field\n
> > 8.384666
> > > =
> > > > > > avgdl,
> > > > > > >>> > average length of field\n"}, "QParser":"LuceneQParser",
> > > > > > >>> > "filter_queries":["{!join
> > > > > > >>> > from=site_id to=site_id fromIndex=stores
> > > > > > score=max}{!func}geodist()"],
> > > > > > >>> "
> > > > > > >>> >
> > parsed_filter_queries":["OtherCoreJoinQuery(OtherCoreJoinQuery
> > > > > > >>> > [fromIndex=stores, fromCoreOpenTime=3373417389901342
> extends
> > > > > > >>> > SameCoreJoinQuery
> > > > > > >>> >
> > > > > > >>> >
> > > > > > >>>
> > > > > >
> > > > >
> > > >
> > >
> >
> [fromQuery=ShapeFieldCacheDistanceValueSource(org.apache.lucene.spatial.prefix.PointPrefixTreeFieldCacheProvider@2bfc8ad8
> > > > > > >>> > ,
> > > > > > >>> > Pt(x=25.224815300000046,y=54.69738679999999)),
> > > fromField=site_id,
> > > > > > >>> > toField=site_id, scoreMode=Max]])"], }
> > > > > > >>> >
> > > > > > >>> > On Tue, Nov 12, 2019 at 12:48 PM Mikhail Khludnev <
> > > > mkhl@apache.org
> > > > > >
> > > > > > >>> wrote:
> > > > > > >>> >
> > > > > > >>> > > Hello,
> > > > > > >>> > > It seems like I breached the limit on unconscious replies
> > in
> > > > > > mailing
> > > > > > >>> list
> > > > > > >>> > >   I'd rather start with this:
> > > > > > >>> > > q={!join from=site_id to=site_id fromIndex=stores
> > > > > > >>> > > score=max}+{!geofilt}
> > > > > > >>> > >
> > > > > > >>> > >
> > > > > > >>> >
> > > > > > >>>
> > > > > >
> > > > >
> > > >
> > >
> >
> {!func}geodist()&sfield=coordinates&pt=54.69738679999999,25.224815300000046&d=10
> > > > > > >>> > >
> > > > > > >>> > >
> > > > > > >>> > > On Mon, Nov 11, 2019 at 11:11 PM Mikhail Khludnev <
> > > > > mkhl@apache.org
> > > > > > >
> > > > > > >>> > wrote:
> > > > > > >>> > >
> > > > > > >>> > > > Is it something like
> > > > > > >>> https://issues.apache.org/jira/browse/SOLR-10673
> > > > > > >>> > ?
> > > > > > >>> > > >
> > > > > > >>> > > > On Mon, Nov 11, 2019 at 3:47 PM Vasily Ogar <
> > > > > > ogar.vasily@gmail.com
> > > > > > >>> >
> > > > > > >>> > > wrote:
> > > > > > >>> > > >
> > > > > > >>> > > >> it's show nothing because I got an error
> > > > > > >>> > > >> "metadata":[
> > > > > > "error-class","org.apache.solr.common.SolrException",
> > > > > > >>> > > >>
> > "root-error-class","org.apache.solr.search.SyntaxError"],
> > > > > > >>> > > >> "msg":"org.apache.solr.search.SyntaxError:
> > > > > > >>> > > >> geodist - not enough parameters:[]",
> > > > > > >>> > > >>
> > > > > > >>> > > >> If I set parameters then I got another error
> > > > > > >>> > > >> "metadata":[
> > > > > > "error-class","org.apache.solr.common.SolrException",
> > > > > > >>> > > >>
> > > "root-error-class","org.apache.solr.common.SolrException"],
> > > > > > >>> "msg":"A
> > > > > > >>> > > >> ValueSource isn't directly available from this field.
> > > > Instead
> > > > > > try
> > > > > > >>> a
> > > > > > >>> > > query
> > > > > > >>> > > >> using the distance as the score.",
> > > > > > >>> > > >>
> > > > > > >>> > > >> On Mon, Nov 11, 2019 at 1:36 PM Mikhail Khludnev <
> > > > > > mkhl@apache.org
> > > > > > >>> >
> > > > > > >>> > > wrote:
> > > > > > >>> > > >>
> > > > > > >>> > > >> > Hello, Vasily.
> > > > > > >>> > > >> > Why not? What have you got in debugQuery=true?
> > > > > > >>> > > >> >
> > > > > > >>> > > >> > On Mon, Nov 11, 2019 at 1:19 PM Vasily Ogar <
> > > > > > >>> ogar.vasily@gmail.com>
> > > > > > >>> > > >> wrote:
> > > > > > >>> > > >> >
> > > > > > >>> > > >> > > Hello,
> > > > > > >>> > > >> > > Is it possible to sort by score in join by
> > geodist()?
> > > > For
> > > > > > >>> > instance,
> > > > > > >>> > > >> > > something like this
> > > > > > >>> > > >> > > q={!join from=site_id to=site_id fromIndex=stores
> > > > > score=max}
> > > > > > >>> > > >> > > +{!func}gedist() +{!geofilt sfield=coordinates
> > > > > > >>> > > >> > > pt=54.69738679999999,25.224815300000046 d=10}
> > > > > > >>> > > >> > > sort=score desc
> > > > > > >>> > > >> > > Thank you
> > > > > > >>> > > >> > >
> > > > > > >>> > > >> >
> > > > > > >>> > > >> >
> > > > > > >>> > > >> > --
> > > > > > >>> > > >> > Sincerely yours
> > > > > > >>> > > >> > Mikhail Khludnev
> > > > > > >>> > > >> >
> > > > > > >>> > > >>
> > > > > > >>> > > >
> > > > > > >>> > > >
> > > > > > >>> > > > --
> > > > > > >>> > > > Sincerely yours
> > > > > > >>> > > > Mikhail Khludnev
> > > > > > >>> > > >
> > > > > > >>> > >
> > > > > > >>> > >
> > > > > > >>> > > --
> > > > > > >>> > > Sincerely yours
> > > > > > >>> > > Mikhail Khludnev
> > > > > > >>> > >
> > > > > > >>> >
> > > > > > >>>
> > > > > > >>>
> > > > > > >>> --
> > > > > > >>> Sincerely yours
> > > > > > >>> Mikhail Khludnev
> > > > > > >>>
> > > > > > >>
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Sincerely yours
> > > > > Mikhail Khludnev
> > > > >
> > > >
> > >
> > >
> > > --
> > > Sincerely yours
> > > Mikhail Khludnev
> > >
> >
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>

Re: sort by score in join with geodist()

Posted by Mikhail Khludnev <mk...@apache.org>.
Hm...
q={!join param=param.. v=$g}&q={!bool must='{!geofilt}'
should='{!func}geodist()'} ?

On Thu, Nov 14, 2019 at 10:11 PM Vasily Ogar <og...@gmail.com> wrote:

> I tried and this way also, but here is another error.
> { "responseHeader":{ "status":400, "QTime":6, "params":{ "hl":"on", "pt":
> "54.69738679999999,25.224815300000046", "fl":"score,*,store:[subquery
> fromIndex=stores]", "store.rows":"1", "fq":"{!edismax qf=\"title
> description\" v=\"iphone xr 64gb\" mm=3<90%}", "hl.simple.pre":"</em>", "
> store.q":"{!terms f=site_id v=$row.site_id}", "store.sfield":"coordinates",
> "hl.fl":"title description", "group.field":"site_id", "_":"1573559644298",
> "
> group":"true", "store.fq":"{!geofilt}", "d":"100", "group.limit":"2", "
> store.d":"100", "store.pt":"54.69738679999999,25.224815300000046",
> "store.fl
> ":"*,score", "sort":"score desc", "sfield":"coordinates", "q":"{!join
> from=site_id to=site_id fromIndex=stores score=max}+{!geofilt}
> {!func}geodist() ", "hl.simple.post":"</em>", "hl.q":"{!edismax qf=$hl.fl
> v=\"iphone xr 64gb\"}", "hl.method":"unified", "debugQuery":"on"}},
> "error":{
> "metadata":[ "error-class","org.apache.solr.common.SolrException",
> "root-error-class","org.apache.solr.search.SyntaxError"],
> "msg":"org.apache.solr.search.SyntaxError:
> Expected ')' at position 8 in 'geodist('", "code":400}}
>
> On Thu, Nov 14, 2019 at 9:05 PM Mikhail Khludnev <mk...@apache.org> wrote:
>
> > Space matters. Check my snippet once again please.
> >
> > On Thu, Nov 14, 2019 at 9:56 PM Vasily Ogar <og...@gmail.com>
> wrote:
> >
> > > I tried today with plus but always got same error.
> > > { "responseHeader":{ "status":400, "QTime":2, "params":{ "hl":"on",
> "pt":
> > > "54.69738679999999,25.224815300000046", "fl":"score,*,store:[subquery
> > > fromIndex=stores]", "store.rows":"1", "fq":"{!edismax qf=\"title
> > > description\" v=\"iphone xr 64gb\" mm=3<90%}",
> "hl.simple.pre":"</em>", "
> > > store.q":"{!terms f=site_id v=$row.site_id}",
> > "store.sfield":"coordinates",
> > > "hl.fl":"title description", "group.field":"site_id",
> > "_":"1573559644298",
> > > "
> > > group":"true", "store.fq":"{!geofilt}", "d":"100", "group.limit":"2", "
> > > store.d":"100", "store.pt":"54.69738679999999,25.224815300000046",
> > > "store.fl
> > > ":"*,score", "sort":"score desc", "sfield":"coordinates", "q":"{!join
> > > from=site_id to=site_id fromIndex=stores
> > > score=max}+{!geofilt}{!func}geodist()", "hl.simple.post":"</em>",
> > > "hl.q":"{!edismax
> > > qf=$hl.fl v=\"iphone xr 64gb\"}", "hl.method":"unified",
> > > "debugQuery":"on"}},
> > > "error":{ "metadata":[
> > > "error-class","org.apache.solr.common.SolrException",
> > > "root-error-class","org.apache.solr.parser.ParseException"],
> > > "msg":"org.apache.solr.search.SyntaxError:
> > > Cannot parse '+{!geofilt}{!func}geodist()': Encountered \" \")\" \")
> \"\"
> > > at line 1, column 26.\nWas expecting one of:\n <EOF> \n <AND> ...\n
> <OR>
> > > ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n <BAREOPER> ...\n \"(\" ...\n
> > > \"*\" ...\n \"^\" ...\n <QUOTED> ...\n <TERM> ...\n <PREFIXTERM> ...\n
> > > <WILDTERM> ...\n <REGEXPTERM> ...\n \"[\" ...\n \"{\" ...\n <LPARAMS>
> > ...\n
> > > \"filter(\" ...\n <NUMBER> ...\n ", "code":400}}
> > >
> > > On Thu, Nov 14, 2019 at 8:45 PM Mikhail Khludnev <mk...@apache.org>
> > wrote:
> > >
> > > > It should be like
> > > > "q":"{!join from=site_id to=site_id fromIndex=stores
> > > > score=max}+{!geofilt} {!func}geodist() ",
> > > > post debugQuery
> > > >
> > > > On Thu, Nov 14, 2019 at 4:44 PM Vasily Ogar <og...@gmail.com>
> > > wrote:
> > > >
> > > > > I was glad too early because it can only sort or only filter, but
> > can't
> > > > do
> > > > > together :(. It takes the only first argument, in my case it
> geodist
> > or
> > > > > geofilt
> > > > >
> > > > > On Thu, Nov 14, 2019 at 11:11 AM Vasily Ogar <
> ogar.vasily@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > Hello,
> > > > > > I fixed it. If I need to sort by price:
> > > > > > "q":"{!join from=site_id to=site_id fromIndex=stores}*:*",
> > > > > > "fq":"{!edismax qf=\"title description\" v=\"iphone xr 64gb\"
> > > > mm=3<90%}",
> > > > > > "fl":"score,*,store:[subquery fromIndex=stores]",
> > > > > > "store.q":"{!terms f=site_id v=$row.site_id}", "store.rows":"1",
> > > > > "store.fl
> > > > > > ":"*,score", "sort":"price_low desc",
> > > > > > "hl":"on", "hl.simple.pre":"<strong>",
> > "hl.simple.post":"</strong>",
> > > > > > "hl.q":"{!edismax qf=$hl.fl v=\"iphone xr 64gb\"}",
> "hl.fl":"title
> > > > > > description", "hl.method":"unified", "group.field":"site_id",
> > > "group":
> > > > > > "true"
> > > > > > "group.limit":"2",
> > > > > >
> > > > > > And if I need to sort by geodist:
> > > > > > "q":"{!join from=site_id to=site_id fromIndex=stores
> > > > > > score=max}{!func}geodist(){!geofilt}",
> > > > > > "d":"100",
> > > > > > "sfield":"coordinates",
> > > > > > "pt":"54.69738679999999,25.224815300000046"
> > > > > > "fq":"{!edismax qf=\"title description\" v=\"iphone xr 64gb\"
> > > > mm=3<90%}",
> > > > > > "fl":"score,*,store:[subquery fromIndex=stores]",
> > > > > > "store.q":"{!terms f=site_id v=$row.site_id}", "store.rows":"1",
> > > > > "store.fl
> > > > > > ":"*,score",
> > > > > > "store.fq":"{!geofilt}",
> > > > > > "store.sfield":"coordinates",
> > > > > > "store.d":"100", "store.pt
> > ":"54.69738679999999,25.224815300000046",
> > > > > "sort
> > > > > > ":"score desc",
> > > > > > "hl":"on", "hl.simple.pre":"<strong>",
> > "hl.simple.post":"</strong>",
> > > > > > "hl.q":"{!edismax qf=$hl.fl v=\"iphone xr 64gb\"}",
> "hl.fl":"title
> > > > > > description", "hl.method":"unified", "group.field":"site_id",
> > > "group":
> > > > > > "true"
> > > > > > "group.limit":"2",
> > > > > >
> > > > > > On Tue, Nov 12, 2019 at 6:54 PM Vasily Ogar <
> ogar.vasily@gmail.com
> > >
> > > > > wrote:
> > > > > >
> > > > > >> Thank you for advice, now it working as expected. Maybe you know
> > how
> > > > to
> > > > > >> integrate with dismax?
> > > > > >>
> > > > > >> On Tue, Nov 12, 2019 at 6:10 PM Mikhail Khludnev <
> mkhl@apache.org
> > >
> > > > > wrote:
> > > > > >>
> > > > > >>> tlrd;
> > > > > >>> I noticed func under fq that make no sense. Only q or sort
> yield
> > > > > scores.
> > > > > >>>
> > > > > >>> On Tue, Nov 12, 2019 at 6:43 PM Vasily Ogar <
> > ogar.vasily@gmail.com
> > > >
> > > > > >>> wrote:
> > > > > >>>
> > > > > >>> > First of all, thank you for your help.
> > > > > >>> > Now it doesn't show any errors, but somehow score is based on
> > the
> > > > > >>> title and
> > > > > >>> > description but not on the geodist.
> > > > > >>> > "params":{ "hl":"on",
> > > "pt":"54.69738679999999,25.224815300000046",
> > > > > >>> > "fl":"score,*,store:[subquery
> > > > > >>> > fromIndex=stores]", "store.rows":"1", "fq":"{!join
> from=site_id
> > > > > >>> to=site_id
> > > > > >>> > fromIndex=stores score=max}{!func}geodist()",
> > > > "store.sort":"geodist()
> > > > > >>> asc",
> > > > > >>> > "hl.simple.pre":"</em>", "store.q":"{!terms f=site_id
> > > > > >>> v=$row.site_id}", "
> > > > > >>> > store.sfield":"coordinates", "hl.fl":"title description",
> > > > > >>> "group.field":
> > > > > >>> > "site_id", "_":"1573559644298", "group":"true",
> > > > > >>> "store.fq":"{!geofilt}", "d
> > > > > >>> > ":"100", "{!geofilt}":"", "group.limit":"2",
> "store.d":"100", "
> > > > > >>> store.pt":
> > > > > >>> > "54.69738679999999,25.224815300000046", "store.fl":"*,score",
> > > > > >>> "sort":"score
> > > > > >>> > desc", "sfield":"coordinates", "q":"title:\"iphone xr
> 64gb\"",
> > > > > >>> > "group.main":
> > > > > >>> > "true", "hl.simple.post":"</em>", "debugQuery":"on"}
> > > > > >>> >
> > > > > >>> > Here is debug:
> > > > > >>> > "debug":{ "rawquerystring":"title:\"iphone xr 64gb\"",
> > > > > >>> > "querystring":"title:\"iphone
> > > > > >>> > xr 64gb\"", "parsedquery":"PhraseQuery(title:\"iphon xr
> > > 64gb\")", "
> > > > > >>> > parsedquery_toString":"title:\"iphon xr 64gb\"", "explain":{
> > > > > "product:
> > > > > >>> > https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-yellow
> > > > > >>> ":"\n3.9714882
> > > > > >>> > =
> > > > > >>> > weight(title:\"iphon xr 64gb\" in 568) [SchemaSimilarity],
> > result
> > > > > of:\n
> > > > > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf,
> sum
> > > > of:\n
> > > > > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n +
> 0.5))
> > > > > >>> from:\n 459
> > > > > >>> > = n, number of documents containing term\n 1500 = N, total
> > number
> > > > of
> > > > > >>> > documents with field\n 3.3156862 = idf, computed as log(1 +
> (N
> > -
> > > n
> > > > +
> > > > > >>> 0.5) /
> > > > > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing
> > term\n
> > > > 1500
> > > > > >>> = N,
> > > > > >>> > total number of documents with field\n 2.3686793 = idf,
> > computed
> > > as
> > > > > >>> log(1 +
> > > > > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of
> documents
> > > > > >>> containing
> > > > > >>> > term\n 1500 = N, total number of documents with field\n
> > > 0.5782502 =
> > > > > tf,
> > > > > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl))
> > from:\n
> > > > > 1.0 =
> > > > > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 =
> > b,
> > > > > length
> > > > > >>> > normalization parameter\n 4.0 = dl, length of field\n
> 8.384666
> > =
> > > > > avgdl,
> > > > > >>> > average length of field\n", "product:
> > > > > >>> > https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-white
> > > > > ":"\n3.9714882
> > > > > >>> =
> > > > > >>> > weight(title:\"iphon xr 64gb\" in 569) [SchemaSimilarity],
> > result
> > > > > of:\n
> > > > > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf,
> sum
> > > > of:\n
> > > > > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n +
> 0.5))
> > > > > >>> from:\n 459
> > > > > >>> > = n, number of documents containing term\n 1500 = N, total
> > number
> > > > of
> > > > > >>> > documents with field\n 3.3156862 = idf, computed as log(1 +
> (N
> > -
> > > n
> > > > +
> > > > > >>> 0.5) /
> > > > > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing
> > term\n
> > > > 1500
> > > > > >>> = N,
> > > > > >>> > total number of documents with field\n 2.3686793 = idf,
> > computed
> > > as
> > > > > >>> log(1 +
> > > > > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of
> documents
> > > > > >>> containing
> > > > > >>> > term\n 1500 = N, total number of documents with field\n
> > > 0.5782502 =
> > > > > tf,
> > > > > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl))
> > from:\n
> > > > > 1.0 =
> > > > > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 =
> > b,
> > > > > length
> > > > > >>> > normalization parameter\n 4.0 = dl, length of field\n
> 8.384666
> > =
> > > > > avgdl,
> > > > > >>> > average length of field\n", "product:
> > > > > >>> > https://istore.lt/iphone-xr-64gb-blue.html":"\n3.9714882 =
> > > > > >>> > weight(title:\"iphon xr 64gb\" in 28) [SchemaSimilarity],
> > result
> > > > > of:\n
> > > > > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf,
> sum
> > > > of:\n
> > > > > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n +
> 0.5))
> > > > > >>> from:\n 459
> > > > > >>> > = n, number of documents containing term\n 1500 = N, total
> > number
> > > > of
> > > > > >>> > documents with field\n 3.3156862 = idf, computed as log(1 +
> (N
> > -
> > > n
> > > > +
> > > > > >>> 0.5) /
> > > > > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing
> > term\n
> > > > 1500
> > > > > >>> = N,
> > > > > >>> > total number of documents with field\n 2.3686793 = idf,
> > computed
> > > as
> > > > > >>> log(1 +
> > > > > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of
> documents
> > > > > >>> containing
> > > > > >>> > term\n 1500 = N, total number of documents with field\n
> > > 0.5782502 =
> > > > > tf,
> > > > > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl))
> > from:\n
> > > > > 1.0 =
> > > > > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 =
> > b,
> > > > > length
> > > > > >>> > normalization parameter\n 4.0 = dl, length of field\n
> 8.384666
> > =
> > > > > avgdl,
> > > > > >>> > average length of field\n", "product:
> > > > > >>> > https://istore.lt/iphone-xr-64gb-coral.html":"\n3.9714882 =
> > > > > >>> > weight(title:\"iphon xr 64gb\" in 29) [SchemaSimilarity],
> > result
> > > > > of:\n
> > > > > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf,
> sum
> > > > of:\n
> > > > > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n +
> 0.5))
> > > > > >>> from:\n 459
> > > > > >>> > = n, number of documents containing term\n 1500 = N, total
> > number
> > > > of
> > > > > >>> > documents with field\n 3.3156862 = idf, computed as log(1 +
> (N
> > -
> > > n
> > > > +
> > > > > >>> 0.5) /
> > > > > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing
> > term\n
> > > > 1500
> > > > > >>> = N,
> > > > > >>> > total number of documents with field\n 2.3686793 = idf,
> > computed
> > > as
> > > > > >>> log(1 +
> > > > > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of
> documents
> > > > > >>> containing
> > > > > >>> > term\n 1500 = N, total number of documents with field\n
> > > 0.5782502 =
> > > > > tf,
> > > > > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl))
> > from:\n
> > > > > 1.0 =
> > > > > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 =
> > b,
> > > > > length
> > > > > >>> > normalization parameter\n 4.0 = dl, length of field\n
> 8.384666
> > =
> > > > > avgdl,
> > > > > >>> > average length of field\n"}, "QParser":"LuceneQParser",
> > > > > >>> > "filter_queries":["{!join
> > > > > >>> > from=site_id to=site_id fromIndex=stores
> > > > > score=max}{!func}geodist()"],
> > > > > >>> "
> > > > > >>> >
> parsed_filter_queries":["OtherCoreJoinQuery(OtherCoreJoinQuery
> > > > > >>> > [fromIndex=stores, fromCoreOpenTime=3373417389901342 extends
> > > > > >>> > SameCoreJoinQuery
> > > > > >>> >
> > > > > >>> >
> > > > > >>>
> > > > >
> > > >
> > >
> >
> [fromQuery=ShapeFieldCacheDistanceValueSource(org.apache.lucene.spatial.prefix.PointPrefixTreeFieldCacheProvider@2bfc8ad8
> > > > > >>> > ,
> > > > > >>> > Pt(x=25.224815300000046,y=54.69738679999999)),
> > fromField=site_id,
> > > > > >>> > toField=site_id, scoreMode=Max]])"], }
> > > > > >>> >
> > > > > >>> > On Tue, Nov 12, 2019 at 12:48 PM Mikhail Khludnev <
> > > mkhl@apache.org
> > > > >
> > > > > >>> wrote:
> > > > > >>> >
> > > > > >>> > > Hello,
> > > > > >>> > > It seems like I breached the limit on unconscious replies
> in
> > > > > mailing
> > > > > >>> list
> > > > > >>> > >   I'd rather start with this:
> > > > > >>> > > q={!join from=site_id to=site_id fromIndex=stores
> > > > > >>> > > score=max}+{!geofilt}
> > > > > >>> > >
> > > > > >>> > >
> > > > > >>> >
> > > > > >>>
> > > > >
> > > >
> > >
> >
> {!func}geodist()&sfield=coordinates&pt=54.69738679999999,25.224815300000046&d=10
> > > > > >>> > >
> > > > > >>> > >
> > > > > >>> > > On Mon, Nov 11, 2019 at 11:11 PM Mikhail Khludnev <
> > > > mkhl@apache.org
> > > > > >
> > > > > >>> > wrote:
> > > > > >>> > >
> > > > > >>> > > > Is it something like
> > > > > >>> https://issues.apache.org/jira/browse/SOLR-10673
> > > > > >>> > ?
> > > > > >>> > > >
> > > > > >>> > > > On Mon, Nov 11, 2019 at 3:47 PM Vasily Ogar <
> > > > > ogar.vasily@gmail.com
> > > > > >>> >
> > > > > >>> > > wrote:
> > > > > >>> > > >
> > > > > >>> > > >> it's show nothing because I got an error
> > > > > >>> > > >> "metadata":[
> > > > > "error-class","org.apache.solr.common.SolrException",
> > > > > >>> > > >>
> "root-error-class","org.apache.solr.search.SyntaxError"],
> > > > > >>> > > >> "msg":"org.apache.solr.search.SyntaxError:
> > > > > >>> > > >> geodist - not enough parameters:[]",
> > > > > >>> > > >>
> > > > > >>> > > >> If I set parameters then I got another error
> > > > > >>> > > >> "metadata":[
> > > > > "error-class","org.apache.solr.common.SolrException",
> > > > > >>> > > >>
> > "root-error-class","org.apache.solr.common.SolrException"],
> > > > > >>> "msg":"A
> > > > > >>> > > >> ValueSource isn't directly available from this field.
> > > Instead
> > > > > try
> > > > > >>> a
> > > > > >>> > > query
> > > > > >>> > > >> using the distance as the score.",
> > > > > >>> > > >>
> > > > > >>> > > >> On Mon, Nov 11, 2019 at 1:36 PM Mikhail Khludnev <
> > > > > mkhl@apache.org
> > > > > >>> >
> > > > > >>> > > wrote:
> > > > > >>> > > >>
> > > > > >>> > > >> > Hello, Vasily.
> > > > > >>> > > >> > Why not? What have you got in debugQuery=true?
> > > > > >>> > > >> >
> > > > > >>> > > >> > On Mon, Nov 11, 2019 at 1:19 PM Vasily Ogar <
> > > > > >>> ogar.vasily@gmail.com>
> > > > > >>> > > >> wrote:
> > > > > >>> > > >> >
> > > > > >>> > > >> > > Hello,
> > > > > >>> > > >> > > Is it possible to sort by score in join by
> geodist()?
> > > For
> > > > > >>> > instance,
> > > > > >>> > > >> > > something like this
> > > > > >>> > > >> > > q={!join from=site_id to=site_id fromIndex=stores
> > > > score=max}
> > > > > >>> > > >> > > +{!func}gedist() +{!geofilt sfield=coordinates
> > > > > >>> > > >> > > pt=54.69738679999999,25.224815300000046 d=10}
> > > > > >>> > > >> > > sort=score desc
> > > > > >>> > > >> > > Thank you
> > > > > >>> > > >> > >
> > > > > >>> > > >> >
> > > > > >>> > > >> >
> > > > > >>> > > >> > --
> > > > > >>> > > >> > Sincerely yours
> > > > > >>> > > >> > Mikhail Khludnev
> > > > > >>> > > >> >
> > > > > >>> > > >>
> > > > > >>> > > >
> > > > > >>> > > >
> > > > > >>> > > > --
> > > > > >>> > > > Sincerely yours
> > > > > >>> > > > Mikhail Khludnev
> > > > > >>> > > >
> > > > > >>> > >
> > > > > >>> > >
> > > > > >>> > > --
> > > > > >>> > > Sincerely yours
> > > > > >>> > > Mikhail Khludnev
> > > > > >>> > >
> > > > > >>> >
> > > > > >>>
> > > > > >>>
> > > > > >>> --
> > > > > >>> Sincerely yours
> > > > > >>> Mikhail Khludnev
> > > > > >>>
> > > > > >>
> > > > >
> > > >
> > > >
> > > > --
> > > > Sincerely yours
> > > > Mikhail Khludnev
> > > >
> > >
> >
> >
> > --
> > Sincerely yours
> > Mikhail Khludnev
> >
>


-- 
Sincerely yours
Mikhail Khludnev

Re: sort by score in join with geodist()

Posted by Vasily Ogar <og...@gmail.com>.
I tried and this way also, but here is another error.
{ "responseHeader":{ "status":400, "QTime":6, "params":{ "hl":"on", "pt":
"54.69738679999999,25.224815300000046", "fl":"score,*,store:[subquery
fromIndex=stores]", "store.rows":"1", "fq":"{!edismax qf=\"title
description\" v=\"iphone xr 64gb\" mm=3<90%}", "hl.simple.pre":"</em>", "
store.q":"{!terms f=site_id v=$row.site_id}", "store.sfield":"coordinates",
"hl.fl":"title description", "group.field":"site_id", "_":"1573559644298", "
group":"true", "store.fq":"{!geofilt}", "d":"100", "group.limit":"2", "
store.d":"100", "store.pt":"54.69738679999999,25.224815300000046", "store.fl
":"*,score", "sort":"score desc", "sfield":"coordinates", "q":"{!join
from=site_id to=site_id fromIndex=stores score=max}+{!geofilt}
{!func}geodist() ", "hl.simple.post":"</em>", "hl.q":"{!edismax qf=$hl.fl
v=\"iphone xr 64gb\"}", "hl.method":"unified", "debugQuery":"on"}}, "error":{
"metadata":[ "error-class","org.apache.solr.common.SolrException",
"root-error-class","org.apache.solr.search.SyntaxError"],
"msg":"org.apache.solr.search.SyntaxError:
Expected ')' at position 8 in 'geodist('", "code":400}}

On Thu, Nov 14, 2019 at 9:05 PM Mikhail Khludnev <mk...@apache.org> wrote:

> Space matters. Check my snippet once again please.
>
> On Thu, Nov 14, 2019 at 9:56 PM Vasily Ogar <og...@gmail.com> wrote:
>
> > I tried today with plus but always got same error.
> > { "responseHeader":{ "status":400, "QTime":2, "params":{ "hl":"on", "pt":
> > "54.69738679999999,25.224815300000046", "fl":"score,*,store:[subquery
> > fromIndex=stores]", "store.rows":"1", "fq":"{!edismax qf=\"title
> > description\" v=\"iphone xr 64gb\" mm=3<90%}", "hl.simple.pre":"</em>", "
> > store.q":"{!terms f=site_id v=$row.site_id}",
> "store.sfield":"coordinates",
> > "hl.fl":"title description", "group.field":"site_id",
> "_":"1573559644298",
> > "
> > group":"true", "store.fq":"{!geofilt}", "d":"100", "group.limit":"2", "
> > store.d":"100", "store.pt":"54.69738679999999,25.224815300000046",
> > "store.fl
> > ":"*,score", "sort":"score desc", "sfield":"coordinates", "q":"{!join
> > from=site_id to=site_id fromIndex=stores
> > score=max}+{!geofilt}{!func}geodist()", "hl.simple.post":"</em>",
> > "hl.q":"{!edismax
> > qf=$hl.fl v=\"iphone xr 64gb\"}", "hl.method":"unified",
> > "debugQuery":"on"}},
> > "error":{ "metadata":[
> > "error-class","org.apache.solr.common.SolrException",
> > "root-error-class","org.apache.solr.parser.ParseException"],
> > "msg":"org.apache.solr.search.SyntaxError:
> > Cannot parse '+{!geofilt}{!func}geodist()': Encountered \" \")\" \") \"\"
> > at line 1, column 26.\nWas expecting one of:\n <EOF> \n <AND> ...\n <OR>
> > ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n <BAREOPER> ...\n \"(\" ...\n
> > \"*\" ...\n \"^\" ...\n <QUOTED> ...\n <TERM> ...\n <PREFIXTERM> ...\n
> > <WILDTERM> ...\n <REGEXPTERM> ...\n \"[\" ...\n \"{\" ...\n <LPARAMS>
> ...\n
> > \"filter(\" ...\n <NUMBER> ...\n ", "code":400}}
> >
> > On Thu, Nov 14, 2019 at 8:45 PM Mikhail Khludnev <mk...@apache.org>
> wrote:
> >
> > > It should be like
> > > "q":"{!join from=site_id to=site_id fromIndex=stores
> > > score=max}+{!geofilt} {!func}geodist() ",
> > > post debugQuery
> > >
> > > On Thu, Nov 14, 2019 at 4:44 PM Vasily Ogar <og...@gmail.com>
> > wrote:
> > >
> > > > I was glad too early because it can only sort or only filter, but
> can't
> > > do
> > > > together :(. It takes the only first argument, in my case it geodist
> or
> > > > geofilt
> > > >
> > > > On Thu, Nov 14, 2019 at 11:11 AM Vasily Ogar <og...@gmail.com>
> > > > wrote:
> > > >
> > > > > Hello,
> > > > > I fixed it. If I need to sort by price:
> > > > > "q":"{!join from=site_id to=site_id fromIndex=stores}*:*",
> > > > > "fq":"{!edismax qf=\"title description\" v=\"iphone xr 64gb\"
> > > mm=3<90%}",
> > > > > "fl":"score,*,store:[subquery fromIndex=stores]",
> > > > > "store.q":"{!terms f=site_id v=$row.site_id}", "store.rows":"1",
> > > > "store.fl
> > > > > ":"*,score", "sort":"price_low desc",
> > > > > "hl":"on", "hl.simple.pre":"<strong>",
> "hl.simple.post":"</strong>",
> > > > > "hl.q":"{!edismax qf=$hl.fl v=\"iphone xr 64gb\"}", "hl.fl":"title
> > > > > description", "hl.method":"unified", "group.field":"site_id",
> > "group":
> > > > > "true"
> > > > > "group.limit":"2",
> > > > >
> > > > > And if I need to sort by geodist:
> > > > > "q":"{!join from=site_id to=site_id fromIndex=stores
> > > > > score=max}{!func}geodist(){!geofilt}",
> > > > > "d":"100",
> > > > > "sfield":"coordinates",
> > > > > "pt":"54.69738679999999,25.224815300000046"
> > > > > "fq":"{!edismax qf=\"title description\" v=\"iphone xr 64gb\"
> > > mm=3<90%}",
> > > > > "fl":"score,*,store:[subquery fromIndex=stores]",
> > > > > "store.q":"{!terms f=site_id v=$row.site_id}", "store.rows":"1",
> > > > "store.fl
> > > > > ":"*,score",
> > > > > "store.fq":"{!geofilt}",
> > > > > "store.sfield":"coordinates",
> > > > > "store.d":"100", "store.pt
> ":"54.69738679999999,25.224815300000046",
> > > > "sort
> > > > > ":"score desc",
> > > > > "hl":"on", "hl.simple.pre":"<strong>",
> "hl.simple.post":"</strong>",
> > > > > "hl.q":"{!edismax qf=$hl.fl v=\"iphone xr 64gb\"}", "hl.fl":"title
> > > > > description", "hl.method":"unified", "group.field":"site_id",
> > "group":
> > > > > "true"
> > > > > "group.limit":"2",
> > > > >
> > > > > On Tue, Nov 12, 2019 at 6:54 PM Vasily Ogar <ogar.vasily@gmail.com
> >
> > > > wrote:
> > > > >
> > > > >> Thank you for advice, now it working as expected. Maybe you know
> how
> > > to
> > > > >> integrate with dismax?
> > > > >>
> > > > >> On Tue, Nov 12, 2019 at 6:10 PM Mikhail Khludnev <mkhl@apache.org
> >
> > > > wrote:
> > > > >>
> > > > >>> tlrd;
> > > > >>> I noticed func under fq that make no sense. Only q or sort yield
> > > > scores.
> > > > >>>
> > > > >>> On Tue, Nov 12, 2019 at 6:43 PM Vasily Ogar <
> ogar.vasily@gmail.com
> > >
> > > > >>> wrote:
> > > > >>>
> > > > >>> > First of all, thank you for your help.
> > > > >>> > Now it doesn't show any errors, but somehow score is based on
> the
> > > > >>> title and
> > > > >>> > description but not on the geodist.
> > > > >>> > "params":{ "hl":"on",
> > "pt":"54.69738679999999,25.224815300000046",
> > > > >>> > "fl":"score,*,store:[subquery
> > > > >>> > fromIndex=stores]", "store.rows":"1", "fq":"{!join from=site_id
> > > > >>> to=site_id
> > > > >>> > fromIndex=stores score=max}{!func}geodist()",
> > > "store.sort":"geodist()
> > > > >>> asc",
> > > > >>> > "hl.simple.pre":"</em>", "store.q":"{!terms f=site_id
> > > > >>> v=$row.site_id}", "
> > > > >>> > store.sfield":"coordinates", "hl.fl":"title description",
> > > > >>> "group.field":
> > > > >>> > "site_id", "_":"1573559644298", "group":"true",
> > > > >>> "store.fq":"{!geofilt}", "d
> > > > >>> > ":"100", "{!geofilt}":"", "group.limit":"2", "store.d":"100", "
> > > > >>> store.pt":
> > > > >>> > "54.69738679999999,25.224815300000046", "store.fl":"*,score",
> > > > >>> "sort":"score
> > > > >>> > desc", "sfield":"coordinates", "q":"title:\"iphone xr 64gb\"",
> > > > >>> > "group.main":
> > > > >>> > "true", "hl.simple.post":"</em>", "debugQuery":"on"}
> > > > >>> >
> > > > >>> > Here is debug:
> > > > >>> > "debug":{ "rawquerystring":"title:\"iphone xr 64gb\"",
> > > > >>> > "querystring":"title:\"iphone
> > > > >>> > xr 64gb\"", "parsedquery":"PhraseQuery(title:\"iphon xr
> > 64gb\")", "
> > > > >>> > parsedquery_toString":"title:\"iphon xr 64gb\"", "explain":{
> > > > "product:
> > > > >>> > https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-yellow
> > > > >>> ":"\n3.9714882
> > > > >>> > =
> > > > >>> > weight(title:\"iphon xr 64gb\" in 568) [SchemaSimilarity],
> result
> > > > of:\n
> > > > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum
> > > of:\n
> > > > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
> > > > >>> from:\n 459
> > > > >>> > = n, number of documents containing term\n 1500 = N, total
> number
> > > of
> > > > >>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N
> -
> > n
> > > +
> > > > >>> 0.5) /
> > > > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing
> term\n
> > > 1500
> > > > >>> = N,
> > > > >>> > total number of documents with field\n 2.3686793 = idf,
> computed
> > as
> > > > >>> log(1 +
> > > > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> > > > >>> containing
> > > > >>> > term\n 1500 = N, total number of documents with field\n
> > 0.5782502 =
> > > > tf,
> > > > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl))
> from:\n
> > > > 1.0 =
> > > > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 =
> b,
> > > > length
> > > > >>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666
> =
> > > > avgdl,
> > > > >>> > average length of field\n", "product:
> > > > >>> > https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-white
> > > > ":"\n3.9714882
> > > > >>> =
> > > > >>> > weight(title:\"iphon xr 64gb\" in 569) [SchemaSimilarity],
> result
> > > > of:\n
> > > > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum
> > > of:\n
> > > > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
> > > > >>> from:\n 459
> > > > >>> > = n, number of documents containing term\n 1500 = N, total
> number
> > > of
> > > > >>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N
> -
> > n
> > > +
> > > > >>> 0.5) /
> > > > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing
> term\n
> > > 1500
> > > > >>> = N,
> > > > >>> > total number of documents with field\n 2.3686793 = idf,
> computed
> > as
> > > > >>> log(1 +
> > > > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> > > > >>> containing
> > > > >>> > term\n 1500 = N, total number of documents with field\n
> > 0.5782502 =
> > > > tf,
> > > > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl))
> from:\n
> > > > 1.0 =
> > > > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 =
> b,
> > > > length
> > > > >>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666
> =
> > > > avgdl,
> > > > >>> > average length of field\n", "product:
> > > > >>> > https://istore.lt/iphone-xr-64gb-blue.html":"\n3.9714882 =
> > > > >>> > weight(title:\"iphon xr 64gb\" in 28) [SchemaSimilarity],
> result
> > > > of:\n
> > > > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum
> > > of:\n
> > > > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
> > > > >>> from:\n 459
> > > > >>> > = n, number of documents containing term\n 1500 = N, total
> number
> > > of
> > > > >>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N
> -
> > n
> > > +
> > > > >>> 0.5) /
> > > > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing
> term\n
> > > 1500
> > > > >>> = N,
> > > > >>> > total number of documents with field\n 2.3686793 = idf,
> computed
> > as
> > > > >>> log(1 +
> > > > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> > > > >>> containing
> > > > >>> > term\n 1500 = N, total number of documents with field\n
> > 0.5782502 =
> > > > tf,
> > > > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl))
> from:\n
> > > > 1.0 =
> > > > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 =
> b,
> > > > length
> > > > >>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666
> =
> > > > avgdl,
> > > > >>> > average length of field\n", "product:
> > > > >>> > https://istore.lt/iphone-xr-64gb-coral.html":"\n3.9714882 =
> > > > >>> > weight(title:\"iphon xr 64gb\" in 29) [SchemaSimilarity],
> result
> > > > of:\n
> > > > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum
> > > of:\n
> > > > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
> > > > >>> from:\n 459
> > > > >>> > = n, number of documents containing term\n 1500 = N, total
> number
> > > of
> > > > >>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N
> -
> > n
> > > +
> > > > >>> 0.5) /
> > > > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing
> term\n
> > > 1500
> > > > >>> = N,
> > > > >>> > total number of documents with field\n 2.3686793 = idf,
> computed
> > as
> > > > >>> log(1 +
> > > > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> > > > >>> containing
> > > > >>> > term\n 1500 = N, total number of documents with field\n
> > 0.5782502 =
> > > > tf,
> > > > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl))
> from:\n
> > > > 1.0 =
> > > > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 =
> b,
> > > > length
> > > > >>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666
> =
> > > > avgdl,
> > > > >>> > average length of field\n"}, "QParser":"LuceneQParser",
> > > > >>> > "filter_queries":["{!join
> > > > >>> > from=site_id to=site_id fromIndex=stores
> > > > score=max}{!func}geodist()"],
> > > > >>> "
> > > > >>> > parsed_filter_queries":["OtherCoreJoinQuery(OtherCoreJoinQuery
> > > > >>> > [fromIndex=stores, fromCoreOpenTime=3373417389901342 extends
> > > > >>> > SameCoreJoinQuery
> > > > >>> >
> > > > >>> >
> > > > >>>
> > > >
> > >
> >
> [fromQuery=ShapeFieldCacheDistanceValueSource(org.apache.lucene.spatial.prefix.PointPrefixTreeFieldCacheProvider@2bfc8ad8
> > > > >>> > ,
> > > > >>> > Pt(x=25.224815300000046,y=54.69738679999999)),
> fromField=site_id,
> > > > >>> > toField=site_id, scoreMode=Max]])"], }
> > > > >>> >
> > > > >>> > On Tue, Nov 12, 2019 at 12:48 PM Mikhail Khludnev <
> > mkhl@apache.org
> > > >
> > > > >>> wrote:
> > > > >>> >
> > > > >>> > > Hello,
> > > > >>> > > It seems like I breached the limit on unconscious replies in
> > > > mailing
> > > > >>> list
> > > > >>> > >   I'd rather start with this:
> > > > >>> > > q={!join from=site_id to=site_id fromIndex=stores
> > > > >>> > > score=max}+{!geofilt}
> > > > >>> > >
> > > > >>> > >
> > > > >>> >
> > > > >>>
> > > >
> > >
> >
> {!func}geodist()&sfield=coordinates&pt=54.69738679999999,25.224815300000046&d=10
> > > > >>> > >
> > > > >>> > >
> > > > >>> > > On Mon, Nov 11, 2019 at 11:11 PM Mikhail Khludnev <
> > > mkhl@apache.org
> > > > >
> > > > >>> > wrote:
> > > > >>> > >
> > > > >>> > > > Is it something like
> > > > >>> https://issues.apache.org/jira/browse/SOLR-10673
> > > > >>> > ?
> > > > >>> > > >
> > > > >>> > > > On Mon, Nov 11, 2019 at 3:47 PM Vasily Ogar <
> > > > ogar.vasily@gmail.com
> > > > >>> >
> > > > >>> > > wrote:
> > > > >>> > > >
> > > > >>> > > >> it's show nothing because I got an error
> > > > >>> > > >> "metadata":[
> > > > "error-class","org.apache.solr.common.SolrException",
> > > > >>> > > >> "root-error-class","org.apache.solr.search.SyntaxError"],
> > > > >>> > > >> "msg":"org.apache.solr.search.SyntaxError:
> > > > >>> > > >> geodist - not enough parameters:[]",
> > > > >>> > > >>
> > > > >>> > > >> If I set parameters then I got another error
> > > > >>> > > >> "metadata":[
> > > > "error-class","org.apache.solr.common.SolrException",
> > > > >>> > > >>
> "root-error-class","org.apache.solr.common.SolrException"],
> > > > >>> "msg":"A
> > > > >>> > > >> ValueSource isn't directly available from this field.
> > Instead
> > > > try
> > > > >>> a
> > > > >>> > > query
> > > > >>> > > >> using the distance as the score.",
> > > > >>> > > >>
> > > > >>> > > >> On Mon, Nov 11, 2019 at 1:36 PM Mikhail Khludnev <
> > > > mkhl@apache.org
> > > > >>> >
> > > > >>> > > wrote:
> > > > >>> > > >>
> > > > >>> > > >> > Hello, Vasily.
> > > > >>> > > >> > Why not? What have you got in debugQuery=true?
> > > > >>> > > >> >
> > > > >>> > > >> > On Mon, Nov 11, 2019 at 1:19 PM Vasily Ogar <
> > > > >>> ogar.vasily@gmail.com>
> > > > >>> > > >> wrote:
> > > > >>> > > >> >
> > > > >>> > > >> > > Hello,
> > > > >>> > > >> > > Is it possible to sort by score in join by geodist()?
> > For
> > > > >>> > instance,
> > > > >>> > > >> > > something like this
> > > > >>> > > >> > > q={!join from=site_id to=site_id fromIndex=stores
> > > score=max}
> > > > >>> > > >> > > +{!func}gedist() +{!geofilt sfield=coordinates
> > > > >>> > > >> > > pt=54.69738679999999,25.224815300000046 d=10}
> > > > >>> > > >> > > sort=score desc
> > > > >>> > > >> > > Thank you
> > > > >>> > > >> > >
> > > > >>> > > >> >
> > > > >>> > > >> >
> > > > >>> > > >> > --
> > > > >>> > > >> > Sincerely yours
> > > > >>> > > >> > Mikhail Khludnev
> > > > >>> > > >> >
> > > > >>> > > >>
> > > > >>> > > >
> > > > >>> > > >
> > > > >>> > > > --
> > > > >>> > > > Sincerely yours
> > > > >>> > > > Mikhail Khludnev
> > > > >>> > > >
> > > > >>> > >
> > > > >>> > >
> > > > >>> > > --
> > > > >>> > > Sincerely yours
> > > > >>> > > Mikhail Khludnev
> > > > >>> > >
> > > > >>> >
> > > > >>>
> > > > >>>
> > > > >>> --
> > > > >>> Sincerely yours
> > > > >>> Mikhail Khludnev
> > > > >>>
> > > > >>
> > > >
> > >
> > >
> > > --
> > > Sincerely yours
> > > Mikhail Khludnev
> > >
> >
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>

Re: sort by score in join with geodist()

Posted by Mikhail Khludnev <mk...@apache.org>.
Space matters. Check my snippet once again please.

On Thu, Nov 14, 2019 at 9:56 PM Vasily Ogar <og...@gmail.com> wrote:

> I tried today with plus but always got same error.
> { "responseHeader":{ "status":400, "QTime":2, "params":{ "hl":"on", "pt":
> "54.69738679999999,25.224815300000046", "fl":"score,*,store:[subquery
> fromIndex=stores]", "store.rows":"1", "fq":"{!edismax qf=\"title
> description\" v=\"iphone xr 64gb\" mm=3<90%}", "hl.simple.pre":"</em>", "
> store.q":"{!terms f=site_id v=$row.site_id}", "store.sfield":"coordinates",
> "hl.fl":"title description", "group.field":"site_id", "_":"1573559644298",
> "
> group":"true", "store.fq":"{!geofilt}", "d":"100", "group.limit":"2", "
> store.d":"100", "store.pt":"54.69738679999999,25.224815300000046",
> "store.fl
> ":"*,score", "sort":"score desc", "sfield":"coordinates", "q":"{!join
> from=site_id to=site_id fromIndex=stores
> score=max}+{!geofilt}{!func}geodist()", "hl.simple.post":"</em>",
> "hl.q":"{!edismax
> qf=$hl.fl v=\"iphone xr 64gb\"}", "hl.method":"unified",
> "debugQuery":"on"}},
> "error":{ "metadata":[
> "error-class","org.apache.solr.common.SolrException",
> "root-error-class","org.apache.solr.parser.ParseException"],
> "msg":"org.apache.solr.search.SyntaxError:
> Cannot parse '+{!geofilt}{!func}geodist()': Encountered \" \")\" \") \"\"
> at line 1, column 26.\nWas expecting one of:\n <EOF> \n <AND> ...\n <OR>
> ...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n <BAREOPER> ...\n \"(\" ...\n
> \"*\" ...\n \"^\" ...\n <QUOTED> ...\n <TERM> ...\n <PREFIXTERM> ...\n
> <WILDTERM> ...\n <REGEXPTERM> ...\n \"[\" ...\n \"{\" ...\n <LPARAMS> ...\n
> \"filter(\" ...\n <NUMBER> ...\n ", "code":400}}
>
> On Thu, Nov 14, 2019 at 8:45 PM Mikhail Khludnev <mk...@apache.org> wrote:
>
> > It should be like
> > "q":"{!join from=site_id to=site_id fromIndex=stores
> > score=max}+{!geofilt} {!func}geodist() ",
> > post debugQuery
> >
> > On Thu, Nov 14, 2019 at 4:44 PM Vasily Ogar <og...@gmail.com>
> wrote:
> >
> > > I was glad too early because it can only sort or only filter, but can't
> > do
> > > together :(. It takes the only first argument, in my case it geodist or
> > > geofilt
> > >
> > > On Thu, Nov 14, 2019 at 11:11 AM Vasily Ogar <og...@gmail.com>
> > > wrote:
> > >
> > > > Hello,
> > > > I fixed it. If I need to sort by price:
> > > > "q":"{!join from=site_id to=site_id fromIndex=stores}*:*",
> > > > "fq":"{!edismax qf=\"title description\" v=\"iphone xr 64gb\"
> > mm=3<90%}",
> > > > "fl":"score,*,store:[subquery fromIndex=stores]",
> > > > "store.q":"{!terms f=site_id v=$row.site_id}", "store.rows":"1",
> > > "store.fl
> > > > ":"*,score", "sort":"price_low desc",
> > > > "hl":"on", "hl.simple.pre":"<strong>", "hl.simple.post":"</strong>",
> > > > "hl.q":"{!edismax qf=$hl.fl v=\"iphone xr 64gb\"}", "hl.fl":"title
> > > > description", "hl.method":"unified", "group.field":"site_id",
> "group":
> > > > "true"
> > > > "group.limit":"2",
> > > >
> > > > And if I need to sort by geodist:
> > > > "q":"{!join from=site_id to=site_id fromIndex=stores
> > > > score=max}{!func}geodist(){!geofilt}",
> > > > "d":"100",
> > > > "sfield":"coordinates",
> > > > "pt":"54.69738679999999,25.224815300000046"
> > > > "fq":"{!edismax qf=\"title description\" v=\"iphone xr 64gb\"
> > mm=3<90%}",
> > > > "fl":"score,*,store:[subquery fromIndex=stores]",
> > > > "store.q":"{!terms f=site_id v=$row.site_id}", "store.rows":"1",
> > > "store.fl
> > > > ":"*,score",
> > > > "store.fq":"{!geofilt}",
> > > > "store.sfield":"coordinates",
> > > > "store.d":"100", "store.pt":"54.69738679999999,25.224815300000046",
> > > "sort
> > > > ":"score desc",
> > > > "hl":"on", "hl.simple.pre":"<strong>", "hl.simple.post":"</strong>",
> > > > "hl.q":"{!edismax qf=$hl.fl v=\"iphone xr 64gb\"}", "hl.fl":"title
> > > > description", "hl.method":"unified", "group.field":"site_id",
> "group":
> > > > "true"
> > > > "group.limit":"2",
> > > >
> > > > On Tue, Nov 12, 2019 at 6:54 PM Vasily Ogar <og...@gmail.com>
> > > wrote:
> > > >
> > > >> Thank you for advice, now it working as expected. Maybe you know how
> > to
> > > >> integrate with dismax?
> > > >>
> > > >> On Tue, Nov 12, 2019 at 6:10 PM Mikhail Khludnev <mk...@apache.org>
> > > wrote:
> > > >>
> > > >>> tlrd;
> > > >>> I noticed func under fq that make no sense. Only q or sort yield
> > > scores.
> > > >>>
> > > >>> On Tue, Nov 12, 2019 at 6:43 PM Vasily Ogar <ogar.vasily@gmail.com
> >
> > > >>> wrote:
> > > >>>
> > > >>> > First of all, thank you for your help.
> > > >>> > Now it doesn't show any errors, but somehow score is based on the
> > > >>> title and
> > > >>> > description but not on the geodist.
> > > >>> > "params":{ "hl":"on",
> "pt":"54.69738679999999,25.224815300000046",
> > > >>> > "fl":"score,*,store:[subquery
> > > >>> > fromIndex=stores]", "store.rows":"1", "fq":"{!join from=site_id
> > > >>> to=site_id
> > > >>> > fromIndex=stores score=max}{!func}geodist()",
> > "store.sort":"geodist()
> > > >>> asc",
> > > >>> > "hl.simple.pre":"</em>", "store.q":"{!terms f=site_id
> > > >>> v=$row.site_id}", "
> > > >>> > store.sfield":"coordinates", "hl.fl":"title description",
> > > >>> "group.field":
> > > >>> > "site_id", "_":"1573559644298", "group":"true",
> > > >>> "store.fq":"{!geofilt}", "d
> > > >>> > ":"100", "{!geofilt}":"", "group.limit":"2", "store.d":"100", "
> > > >>> store.pt":
> > > >>> > "54.69738679999999,25.224815300000046", "store.fl":"*,score",
> > > >>> "sort":"score
> > > >>> > desc", "sfield":"coordinates", "q":"title:\"iphone xr 64gb\"",
> > > >>> > "group.main":
> > > >>> > "true", "hl.simple.post":"</em>", "debugQuery":"on"}
> > > >>> >
> > > >>> > Here is debug:
> > > >>> > "debug":{ "rawquerystring":"title:\"iphone xr 64gb\"",
> > > >>> > "querystring":"title:\"iphone
> > > >>> > xr 64gb\"", "parsedquery":"PhraseQuery(title:\"iphon xr
> 64gb\")", "
> > > >>> > parsedquery_toString":"title:\"iphon xr 64gb\"", "explain":{
> > > "product:
> > > >>> > https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-yellow
> > > >>> ":"\n3.9714882
> > > >>> > =
> > > >>> > weight(title:\"iphon xr 64gb\" in 568) [SchemaSimilarity], result
> > > of:\n
> > > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum
> > of:\n
> > > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
> > > >>> from:\n 459
> > > >>> > = n, number of documents containing term\n 1500 = N, total number
> > of
> > > >>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N -
> n
> > +
> > > >>> 0.5) /
> > > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n
> > 1500
> > > >>> = N,
> > > >>> > total number of documents with field\n 2.3686793 = idf, computed
> as
> > > >>> log(1 +
> > > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> > > >>> containing
> > > >>> > term\n 1500 = N, total number of documents with field\n
> 0.5782502 =
> > > tf,
> > > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n
> > > 1.0 =
> > > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b,
> > > length
> > > >>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 =
> > > avgdl,
> > > >>> > average length of field\n", "product:
> > > >>> > https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-white
> > > ":"\n3.9714882
> > > >>> =
> > > >>> > weight(title:\"iphon xr 64gb\" in 569) [SchemaSimilarity], result
> > > of:\n
> > > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum
> > of:\n
> > > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
> > > >>> from:\n 459
> > > >>> > = n, number of documents containing term\n 1500 = N, total number
> > of
> > > >>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N -
> n
> > +
> > > >>> 0.5) /
> > > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n
> > 1500
> > > >>> = N,
> > > >>> > total number of documents with field\n 2.3686793 = idf, computed
> as
> > > >>> log(1 +
> > > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> > > >>> containing
> > > >>> > term\n 1500 = N, total number of documents with field\n
> 0.5782502 =
> > > tf,
> > > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n
> > > 1.0 =
> > > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b,
> > > length
> > > >>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 =
> > > avgdl,
> > > >>> > average length of field\n", "product:
> > > >>> > https://istore.lt/iphone-xr-64gb-blue.html":"\n3.9714882 =
> > > >>> > weight(title:\"iphon xr 64gb\" in 28) [SchemaSimilarity], result
> > > of:\n
> > > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum
> > of:\n
> > > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
> > > >>> from:\n 459
> > > >>> > = n, number of documents containing term\n 1500 = N, total number
> > of
> > > >>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N -
> n
> > +
> > > >>> 0.5) /
> > > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n
> > 1500
> > > >>> = N,
> > > >>> > total number of documents with field\n 2.3686793 = idf, computed
> as
> > > >>> log(1 +
> > > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> > > >>> containing
> > > >>> > term\n 1500 = N, total number of documents with field\n
> 0.5782502 =
> > > tf,
> > > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n
> > > 1.0 =
> > > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b,
> > > length
> > > >>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 =
> > > avgdl,
> > > >>> > average length of field\n", "product:
> > > >>> > https://istore.lt/iphone-xr-64gb-coral.html":"\n3.9714882 =
> > > >>> > weight(title:\"iphon xr 64gb\" in 29) [SchemaSimilarity], result
> > > of:\n
> > > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum
> > of:\n
> > > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
> > > >>> from:\n 459
> > > >>> > = n, number of documents containing term\n 1500 = N, total number
> > of
> > > >>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N -
> n
> > +
> > > >>> 0.5) /
> > > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n
> > 1500
> > > >>> = N,
> > > >>> > total number of documents with field\n 2.3686793 = idf, computed
> as
> > > >>> log(1 +
> > > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> > > >>> containing
> > > >>> > term\n 1500 = N, total number of documents with field\n
> 0.5782502 =
> > > tf,
> > > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n
> > > 1.0 =
> > > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b,
> > > length
> > > >>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 =
> > > avgdl,
> > > >>> > average length of field\n"}, "QParser":"LuceneQParser",
> > > >>> > "filter_queries":["{!join
> > > >>> > from=site_id to=site_id fromIndex=stores
> > > score=max}{!func}geodist()"],
> > > >>> "
> > > >>> > parsed_filter_queries":["OtherCoreJoinQuery(OtherCoreJoinQuery
> > > >>> > [fromIndex=stores, fromCoreOpenTime=3373417389901342 extends
> > > >>> > SameCoreJoinQuery
> > > >>> >
> > > >>> >
> > > >>>
> > >
> >
> [fromQuery=ShapeFieldCacheDistanceValueSource(org.apache.lucene.spatial.prefix.PointPrefixTreeFieldCacheProvider@2bfc8ad8
> > > >>> > ,
> > > >>> > Pt(x=25.224815300000046,y=54.69738679999999)), fromField=site_id,
> > > >>> > toField=site_id, scoreMode=Max]])"], }
> > > >>> >
> > > >>> > On Tue, Nov 12, 2019 at 12:48 PM Mikhail Khludnev <
> mkhl@apache.org
> > >
> > > >>> wrote:
> > > >>> >
> > > >>> > > Hello,
> > > >>> > > It seems like I breached the limit on unconscious replies in
> > > mailing
> > > >>> list
> > > >>> > >   I'd rather start with this:
> > > >>> > > q={!join from=site_id to=site_id fromIndex=stores
> > > >>> > > score=max}+{!geofilt}
> > > >>> > >
> > > >>> > >
> > > >>> >
> > > >>>
> > >
> >
> {!func}geodist()&sfield=coordinates&pt=54.69738679999999,25.224815300000046&d=10
> > > >>> > >
> > > >>> > >
> > > >>> > > On Mon, Nov 11, 2019 at 11:11 PM Mikhail Khludnev <
> > mkhl@apache.org
> > > >
> > > >>> > wrote:
> > > >>> > >
> > > >>> > > > Is it something like
> > > >>> https://issues.apache.org/jira/browse/SOLR-10673
> > > >>> > ?
> > > >>> > > >
> > > >>> > > > On Mon, Nov 11, 2019 at 3:47 PM Vasily Ogar <
> > > ogar.vasily@gmail.com
> > > >>> >
> > > >>> > > wrote:
> > > >>> > > >
> > > >>> > > >> it's show nothing because I got an error
> > > >>> > > >> "metadata":[
> > > "error-class","org.apache.solr.common.SolrException",
> > > >>> > > >> "root-error-class","org.apache.solr.search.SyntaxError"],
> > > >>> > > >> "msg":"org.apache.solr.search.SyntaxError:
> > > >>> > > >> geodist - not enough parameters:[]",
> > > >>> > > >>
> > > >>> > > >> If I set parameters then I got another error
> > > >>> > > >> "metadata":[
> > > "error-class","org.apache.solr.common.SolrException",
> > > >>> > > >> "root-error-class","org.apache.solr.common.SolrException"],
> > > >>> "msg":"A
> > > >>> > > >> ValueSource isn't directly available from this field.
> Instead
> > > try
> > > >>> a
> > > >>> > > query
> > > >>> > > >> using the distance as the score.",
> > > >>> > > >>
> > > >>> > > >> On Mon, Nov 11, 2019 at 1:36 PM Mikhail Khludnev <
> > > mkhl@apache.org
> > > >>> >
> > > >>> > > wrote:
> > > >>> > > >>
> > > >>> > > >> > Hello, Vasily.
> > > >>> > > >> > Why not? What have you got in debugQuery=true?
> > > >>> > > >> >
> > > >>> > > >> > On Mon, Nov 11, 2019 at 1:19 PM Vasily Ogar <
> > > >>> ogar.vasily@gmail.com>
> > > >>> > > >> wrote:
> > > >>> > > >> >
> > > >>> > > >> > > Hello,
> > > >>> > > >> > > Is it possible to sort by score in join by geodist()?
> For
> > > >>> > instance,
> > > >>> > > >> > > something like this
> > > >>> > > >> > > q={!join from=site_id to=site_id fromIndex=stores
> > score=max}
> > > >>> > > >> > > +{!func}gedist() +{!geofilt sfield=coordinates
> > > >>> > > >> > > pt=54.69738679999999,25.224815300000046 d=10}
> > > >>> > > >> > > sort=score desc
> > > >>> > > >> > > Thank you
> > > >>> > > >> > >
> > > >>> > > >> >
> > > >>> > > >> >
> > > >>> > > >> > --
> > > >>> > > >> > Sincerely yours
> > > >>> > > >> > Mikhail Khludnev
> > > >>> > > >> >
> > > >>> > > >>
> > > >>> > > >
> > > >>> > > >
> > > >>> > > > --
> > > >>> > > > Sincerely yours
> > > >>> > > > Mikhail Khludnev
> > > >>> > > >
> > > >>> > >
> > > >>> > >
> > > >>> > > --
> > > >>> > > Sincerely yours
> > > >>> > > Mikhail Khludnev
> > > >>> > >
> > > >>> >
> > > >>>
> > > >>>
> > > >>> --
> > > >>> Sincerely yours
> > > >>> Mikhail Khludnev
> > > >>>
> > > >>
> > >
> >
> >
> > --
> > Sincerely yours
> > Mikhail Khludnev
> >
>


-- 
Sincerely yours
Mikhail Khludnev

Re: sort by score in join with geodist()

Posted by Vasily Ogar <og...@gmail.com>.
I tried today with plus but always got same error.
{ "responseHeader":{ "status":400, "QTime":2, "params":{ "hl":"on", "pt":
"54.69738679999999,25.224815300000046", "fl":"score,*,store:[subquery
fromIndex=stores]", "store.rows":"1", "fq":"{!edismax qf=\"title
description\" v=\"iphone xr 64gb\" mm=3<90%}", "hl.simple.pre":"</em>", "
store.q":"{!terms f=site_id v=$row.site_id}", "store.sfield":"coordinates",
"hl.fl":"title description", "group.field":"site_id", "_":"1573559644298", "
group":"true", "store.fq":"{!geofilt}", "d":"100", "group.limit":"2", "
store.d":"100", "store.pt":"54.69738679999999,25.224815300000046", "store.fl
":"*,score", "sort":"score desc", "sfield":"coordinates", "q":"{!join
from=site_id to=site_id fromIndex=stores
score=max}+{!geofilt}{!func}geodist()", "hl.simple.post":"</em>",
"hl.q":"{!edismax
qf=$hl.fl v=\"iphone xr 64gb\"}", "hl.method":"unified", "debugQuery":"on"}},
"error":{ "metadata":[ "error-class","org.apache.solr.common.SolrException",
"root-error-class","org.apache.solr.parser.ParseException"],
"msg":"org.apache.solr.search.SyntaxError:
Cannot parse '+{!geofilt}{!func}geodist()': Encountered \" \")\" \") \"\"
at line 1, column 26.\nWas expecting one of:\n <EOF> \n <AND> ...\n <OR>
...\n <NOT> ...\n \"+\" ...\n \"-\" ...\n <BAREOPER> ...\n \"(\" ...\n
\"*\" ...\n \"^\" ...\n <QUOTED> ...\n <TERM> ...\n <PREFIXTERM> ...\n
<WILDTERM> ...\n <REGEXPTERM> ...\n \"[\" ...\n \"{\" ...\n <LPARAMS> ...\n
\"filter(\" ...\n <NUMBER> ...\n ", "code":400}}

On Thu, Nov 14, 2019 at 8:45 PM Mikhail Khludnev <mk...@apache.org> wrote:

> It should be like
> "q":"{!join from=site_id to=site_id fromIndex=stores
> score=max}+{!geofilt} {!func}geodist() ",
> post debugQuery
>
> On Thu, Nov 14, 2019 at 4:44 PM Vasily Ogar <og...@gmail.com> wrote:
>
> > I was glad too early because it can only sort or only filter, but can't
> do
> > together :(. It takes the only first argument, in my case it geodist or
> > geofilt
> >
> > On Thu, Nov 14, 2019 at 11:11 AM Vasily Ogar <og...@gmail.com>
> > wrote:
> >
> > > Hello,
> > > I fixed it. If I need to sort by price:
> > > "q":"{!join from=site_id to=site_id fromIndex=stores}*:*",
> > > "fq":"{!edismax qf=\"title description\" v=\"iphone xr 64gb\"
> mm=3<90%}",
> > > "fl":"score,*,store:[subquery fromIndex=stores]",
> > > "store.q":"{!terms f=site_id v=$row.site_id}", "store.rows":"1",
> > "store.fl
> > > ":"*,score", "sort":"price_low desc",
> > > "hl":"on", "hl.simple.pre":"<strong>", "hl.simple.post":"</strong>",
> > > "hl.q":"{!edismax qf=$hl.fl v=\"iphone xr 64gb\"}", "hl.fl":"title
> > > description", "hl.method":"unified", "group.field":"site_id", "group":
> > > "true"
> > > "group.limit":"2",
> > >
> > > And if I need to sort by geodist:
> > > "q":"{!join from=site_id to=site_id fromIndex=stores
> > > score=max}{!func}geodist(){!geofilt}",
> > > "d":"100",
> > > "sfield":"coordinates",
> > > "pt":"54.69738679999999,25.224815300000046"
> > > "fq":"{!edismax qf=\"title description\" v=\"iphone xr 64gb\"
> mm=3<90%}",
> > > "fl":"score,*,store:[subquery fromIndex=stores]",
> > > "store.q":"{!terms f=site_id v=$row.site_id}", "store.rows":"1",
> > "store.fl
> > > ":"*,score",
> > > "store.fq":"{!geofilt}",
> > > "store.sfield":"coordinates",
> > > "store.d":"100", "store.pt":"54.69738679999999,25.224815300000046",
> > "sort
> > > ":"score desc",
> > > "hl":"on", "hl.simple.pre":"<strong>", "hl.simple.post":"</strong>",
> > > "hl.q":"{!edismax qf=$hl.fl v=\"iphone xr 64gb\"}", "hl.fl":"title
> > > description", "hl.method":"unified", "group.field":"site_id", "group":
> > > "true"
> > > "group.limit":"2",
> > >
> > > On Tue, Nov 12, 2019 at 6:54 PM Vasily Ogar <og...@gmail.com>
> > wrote:
> > >
> > >> Thank you for advice, now it working as expected. Maybe you know how
> to
> > >> integrate with dismax?
> > >>
> > >> On Tue, Nov 12, 2019 at 6:10 PM Mikhail Khludnev <mk...@apache.org>
> > wrote:
> > >>
> > >>> tlrd;
> > >>> I noticed func under fq that make no sense. Only q or sort yield
> > scores.
> > >>>
> > >>> On Tue, Nov 12, 2019 at 6:43 PM Vasily Ogar <og...@gmail.com>
> > >>> wrote:
> > >>>
> > >>> > First of all, thank you for your help.
> > >>> > Now it doesn't show any errors, but somehow score is based on the
> > >>> title and
> > >>> > description but not on the geodist.
> > >>> > "params":{ "hl":"on", "pt":"54.69738679999999,25.224815300000046",
> > >>> > "fl":"score,*,store:[subquery
> > >>> > fromIndex=stores]", "store.rows":"1", "fq":"{!join from=site_id
> > >>> to=site_id
> > >>> > fromIndex=stores score=max}{!func}geodist()",
> "store.sort":"geodist()
> > >>> asc",
> > >>> > "hl.simple.pre":"</em>", "store.q":"{!terms f=site_id
> > >>> v=$row.site_id}", "
> > >>> > store.sfield":"coordinates", "hl.fl":"title description",
> > >>> "group.field":
> > >>> > "site_id", "_":"1573559644298", "group":"true",
> > >>> "store.fq":"{!geofilt}", "d
> > >>> > ":"100", "{!geofilt}":"", "group.limit":"2", "store.d":"100", "
> > >>> store.pt":
> > >>> > "54.69738679999999,25.224815300000046", "store.fl":"*,score",
> > >>> "sort":"score
> > >>> > desc", "sfield":"coordinates", "q":"title:\"iphone xr 64gb\"",
> > >>> > "group.main":
> > >>> > "true", "hl.simple.post":"</em>", "debugQuery":"on"}
> > >>> >
> > >>> > Here is debug:
> > >>> > "debug":{ "rawquerystring":"title:\"iphone xr 64gb\"",
> > >>> > "querystring":"title:\"iphone
> > >>> > xr 64gb\"", "parsedquery":"PhraseQuery(title:\"iphon xr 64gb\")", "
> > >>> > parsedquery_toString":"title:\"iphon xr 64gb\"", "explain":{
> > "product:
> > >>> > https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-yellow
> > >>> ":"\n3.9714882
> > >>> > =
> > >>> > weight(title:\"iphon xr 64gb\" in 568) [SchemaSimilarity], result
> > of:\n
> > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum
> of:\n
> > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
> > >>> from:\n 459
> > >>> > = n, number of documents containing term\n 1500 = N, total number
> of
> > >>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n
> +
> > >>> 0.5) /
> > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n
> 1500
> > >>> = N,
> > >>> > total number of documents with field\n 2.3686793 = idf, computed as
> > >>> log(1 +
> > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> > >>> containing
> > >>> > term\n 1500 = N, total number of documents with field\n 0.5782502 =
> > tf,
> > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n
> > 1.0 =
> > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b,
> > length
> > >>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 =
> > avgdl,
> > >>> > average length of field\n", "product:
> > >>> > https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-white
> > ":"\n3.9714882
> > >>> =
> > >>> > weight(title:\"iphon xr 64gb\" in 569) [SchemaSimilarity], result
> > of:\n
> > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum
> of:\n
> > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
> > >>> from:\n 459
> > >>> > = n, number of documents containing term\n 1500 = N, total number
> of
> > >>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n
> +
> > >>> 0.5) /
> > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n
> 1500
> > >>> = N,
> > >>> > total number of documents with field\n 2.3686793 = idf, computed as
> > >>> log(1 +
> > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> > >>> containing
> > >>> > term\n 1500 = N, total number of documents with field\n 0.5782502 =
> > tf,
> > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n
> > 1.0 =
> > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b,
> > length
> > >>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 =
> > avgdl,
> > >>> > average length of field\n", "product:
> > >>> > https://istore.lt/iphone-xr-64gb-blue.html":"\n3.9714882 =
> > >>> > weight(title:\"iphon xr 64gb\" in 28) [SchemaSimilarity], result
> > of:\n
> > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum
> of:\n
> > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
> > >>> from:\n 459
> > >>> > = n, number of documents containing term\n 1500 = N, total number
> of
> > >>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n
> +
> > >>> 0.5) /
> > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n
> 1500
> > >>> = N,
> > >>> > total number of documents with field\n 2.3686793 = idf, computed as
> > >>> log(1 +
> > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> > >>> containing
> > >>> > term\n 1500 = N, total number of documents with field\n 0.5782502 =
> > tf,
> > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n
> > 1.0 =
> > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b,
> > length
> > >>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 =
> > avgdl,
> > >>> > average length of field\n", "product:
> > >>> > https://istore.lt/iphone-xr-64gb-coral.html":"\n3.9714882 =
> > >>> > weight(title:\"iphon xr 64gb\" in 29) [SchemaSimilarity], result
> > of:\n
> > >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum
> of:\n
> > >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
> > >>> from:\n 459
> > >>> > = n, number of documents containing term\n 1500 = N, total number
> of
> > >>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n
> +
> > >>> 0.5) /
> > >>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n
> 1500
> > >>> = N,
> > >>> > total number of documents with field\n 2.3686793 = idf, computed as
> > >>> log(1 +
> > >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> > >>> containing
> > >>> > term\n 1500 = N, total number of documents with field\n 0.5782502 =
> > tf,
> > >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n
> > 1.0 =
> > >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b,
> > length
> > >>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 =
> > avgdl,
> > >>> > average length of field\n"}, "QParser":"LuceneQParser",
> > >>> > "filter_queries":["{!join
> > >>> > from=site_id to=site_id fromIndex=stores
> > score=max}{!func}geodist()"],
> > >>> "
> > >>> > parsed_filter_queries":["OtherCoreJoinQuery(OtherCoreJoinQuery
> > >>> > [fromIndex=stores, fromCoreOpenTime=3373417389901342 extends
> > >>> > SameCoreJoinQuery
> > >>> >
> > >>> >
> > >>>
> >
> [fromQuery=ShapeFieldCacheDistanceValueSource(org.apache.lucene.spatial.prefix.PointPrefixTreeFieldCacheProvider@2bfc8ad8
> > >>> > ,
> > >>> > Pt(x=25.224815300000046,y=54.69738679999999)), fromField=site_id,
> > >>> > toField=site_id, scoreMode=Max]])"], }
> > >>> >
> > >>> > On Tue, Nov 12, 2019 at 12:48 PM Mikhail Khludnev <mkhl@apache.org
> >
> > >>> wrote:
> > >>> >
> > >>> > > Hello,
> > >>> > > It seems like I breached the limit on unconscious replies in
> > mailing
> > >>> list
> > >>> > >   I'd rather start with this:
> > >>> > > q={!join from=site_id to=site_id fromIndex=stores
> > >>> > > score=max}+{!geofilt}
> > >>> > >
> > >>> > >
> > >>> >
> > >>>
> >
> {!func}geodist()&sfield=coordinates&pt=54.69738679999999,25.224815300000046&d=10
> > >>> > >
> > >>> > >
> > >>> > > On Mon, Nov 11, 2019 at 11:11 PM Mikhail Khludnev <
> mkhl@apache.org
> > >
> > >>> > wrote:
> > >>> > >
> > >>> > > > Is it something like
> > >>> https://issues.apache.org/jira/browse/SOLR-10673
> > >>> > ?
> > >>> > > >
> > >>> > > > On Mon, Nov 11, 2019 at 3:47 PM Vasily Ogar <
> > ogar.vasily@gmail.com
> > >>> >
> > >>> > > wrote:
> > >>> > > >
> > >>> > > >> it's show nothing because I got an error
> > >>> > > >> "metadata":[
> > "error-class","org.apache.solr.common.SolrException",
> > >>> > > >> "root-error-class","org.apache.solr.search.SyntaxError"],
> > >>> > > >> "msg":"org.apache.solr.search.SyntaxError:
> > >>> > > >> geodist - not enough parameters:[]",
> > >>> > > >>
> > >>> > > >> If I set parameters then I got another error
> > >>> > > >> "metadata":[
> > "error-class","org.apache.solr.common.SolrException",
> > >>> > > >> "root-error-class","org.apache.solr.common.SolrException"],
> > >>> "msg":"A
> > >>> > > >> ValueSource isn't directly available from this field. Instead
> > try
> > >>> a
> > >>> > > query
> > >>> > > >> using the distance as the score.",
> > >>> > > >>
> > >>> > > >> On Mon, Nov 11, 2019 at 1:36 PM Mikhail Khludnev <
> > mkhl@apache.org
> > >>> >
> > >>> > > wrote:
> > >>> > > >>
> > >>> > > >> > Hello, Vasily.
> > >>> > > >> > Why not? What have you got in debugQuery=true?
> > >>> > > >> >
> > >>> > > >> > On Mon, Nov 11, 2019 at 1:19 PM Vasily Ogar <
> > >>> ogar.vasily@gmail.com>
> > >>> > > >> wrote:
> > >>> > > >> >
> > >>> > > >> > > Hello,
> > >>> > > >> > > Is it possible to sort by score in join by geodist()? For
> > >>> > instance,
> > >>> > > >> > > something like this
> > >>> > > >> > > q={!join from=site_id to=site_id fromIndex=stores
> score=max}
> > >>> > > >> > > +{!func}gedist() +{!geofilt sfield=coordinates
> > >>> > > >> > > pt=54.69738679999999,25.224815300000046 d=10}
> > >>> > > >> > > sort=score desc
> > >>> > > >> > > Thank you
> > >>> > > >> > >
> > >>> > > >> >
> > >>> > > >> >
> > >>> > > >> > --
> > >>> > > >> > Sincerely yours
> > >>> > > >> > Mikhail Khludnev
> > >>> > > >> >
> > >>> > > >>
> > >>> > > >
> > >>> > > >
> > >>> > > > --
> > >>> > > > Sincerely yours
> > >>> > > > Mikhail Khludnev
> > >>> > > >
> > >>> > >
> > >>> > >
> > >>> > > --
> > >>> > > Sincerely yours
> > >>> > > Mikhail Khludnev
> > >>> > >
> > >>> >
> > >>>
> > >>>
> > >>> --
> > >>> Sincerely yours
> > >>> Mikhail Khludnev
> > >>>
> > >>
> >
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>

Re: sort by score in join with geodist()

Posted by Mikhail Khludnev <mk...@apache.org>.
It should be like
"q":"{!join from=site_id to=site_id fromIndex=stores
score=max}+{!geofilt} {!func}geodist() ",
post debugQuery

On Thu, Nov 14, 2019 at 4:44 PM Vasily Ogar <og...@gmail.com> wrote:

> I was glad too early because it can only sort or only filter, but can't do
> together :(. It takes the only first argument, in my case it geodist or
> geofilt
>
> On Thu, Nov 14, 2019 at 11:11 AM Vasily Ogar <og...@gmail.com>
> wrote:
>
> > Hello,
> > I fixed it. If I need to sort by price:
> > "q":"{!join from=site_id to=site_id fromIndex=stores}*:*",
> > "fq":"{!edismax qf=\"title description\" v=\"iphone xr 64gb\" mm=3<90%}",
> > "fl":"score,*,store:[subquery fromIndex=stores]",
> > "store.q":"{!terms f=site_id v=$row.site_id}", "store.rows":"1",
> "store.fl
> > ":"*,score", "sort":"price_low desc",
> > "hl":"on", "hl.simple.pre":"<strong>", "hl.simple.post":"</strong>",
> > "hl.q":"{!edismax qf=$hl.fl v=\"iphone xr 64gb\"}", "hl.fl":"title
> > description", "hl.method":"unified", "group.field":"site_id", "group":
> > "true"
> > "group.limit":"2",
> >
> > And if I need to sort by geodist:
> > "q":"{!join from=site_id to=site_id fromIndex=stores
> > score=max}{!func}geodist(){!geofilt}",
> > "d":"100",
> > "sfield":"coordinates",
> > "pt":"54.69738679999999,25.224815300000046"
> > "fq":"{!edismax qf=\"title description\" v=\"iphone xr 64gb\" mm=3<90%}",
> > "fl":"score,*,store:[subquery fromIndex=stores]",
> > "store.q":"{!terms f=site_id v=$row.site_id}", "store.rows":"1",
> "store.fl
> > ":"*,score",
> > "store.fq":"{!geofilt}",
> > "store.sfield":"coordinates",
> > "store.d":"100", "store.pt":"54.69738679999999,25.224815300000046",
> "sort
> > ":"score desc",
> > "hl":"on", "hl.simple.pre":"<strong>", "hl.simple.post":"</strong>",
> > "hl.q":"{!edismax qf=$hl.fl v=\"iphone xr 64gb\"}", "hl.fl":"title
> > description", "hl.method":"unified", "group.field":"site_id", "group":
> > "true"
> > "group.limit":"2",
> >
> > On Tue, Nov 12, 2019 at 6:54 PM Vasily Ogar <og...@gmail.com>
> wrote:
> >
> >> Thank you for advice, now it working as expected. Maybe you know how to
> >> integrate with dismax?
> >>
> >> On Tue, Nov 12, 2019 at 6:10 PM Mikhail Khludnev <mk...@apache.org>
> wrote:
> >>
> >>> tlrd;
> >>> I noticed func under fq that make no sense. Only q or sort yield
> scores.
> >>>
> >>> On Tue, Nov 12, 2019 at 6:43 PM Vasily Ogar <og...@gmail.com>
> >>> wrote:
> >>>
> >>> > First of all, thank you for your help.
> >>> > Now it doesn't show any errors, but somehow score is based on the
> >>> title and
> >>> > description but not on the geodist.
> >>> > "params":{ "hl":"on", "pt":"54.69738679999999,25.224815300000046",
> >>> > "fl":"score,*,store:[subquery
> >>> > fromIndex=stores]", "store.rows":"1", "fq":"{!join from=site_id
> >>> to=site_id
> >>> > fromIndex=stores score=max}{!func}geodist()", "store.sort":"geodist()
> >>> asc",
> >>> > "hl.simple.pre":"</em>", "store.q":"{!terms f=site_id
> >>> v=$row.site_id}", "
> >>> > store.sfield":"coordinates", "hl.fl":"title description",
> >>> "group.field":
> >>> > "site_id", "_":"1573559644298", "group":"true",
> >>> "store.fq":"{!geofilt}", "d
> >>> > ":"100", "{!geofilt}":"", "group.limit":"2", "store.d":"100", "
> >>> store.pt":
> >>> > "54.69738679999999,25.224815300000046", "store.fl":"*,score",
> >>> "sort":"score
> >>> > desc", "sfield":"coordinates", "q":"title:\"iphone xr 64gb\"",
> >>> > "group.main":
> >>> > "true", "hl.simple.post":"</em>", "debugQuery":"on"}
> >>> >
> >>> > Here is debug:
> >>> > "debug":{ "rawquerystring":"title:\"iphone xr 64gb\"",
> >>> > "querystring":"title:\"iphone
> >>> > xr 64gb\"", "parsedquery":"PhraseQuery(title:\"iphon xr 64gb\")", "
> >>> > parsedquery_toString":"title:\"iphon xr 64gb\"", "explain":{
> "product:
> >>> > https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-yellow
> >>> ":"\n3.9714882
> >>> > =
> >>> > weight(title:\"iphon xr 64gb\" in 568) [SchemaSimilarity], result
> of:\n
> >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
> >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
> >>> from:\n 459
> >>> > = n, number of documents containing term\n 1500 = N, total number of
> >>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n +
> >>> 0.5) /
> >>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500
> >>> = N,
> >>> > total number of documents with field\n 2.3686793 = idf, computed as
> >>> log(1 +
> >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> >>> containing
> >>> > term\n 1500 = N, total number of documents with field\n 0.5782502 =
> tf,
> >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n
> 1.0 =
> >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b,
> length
> >>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 =
> avgdl,
> >>> > average length of field\n", "product:
> >>> > https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-white
> ":"\n3.9714882
> >>> =
> >>> > weight(title:\"iphon xr 64gb\" in 569) [SchemaSimilarity], result
> of:\n
> >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
> >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
> >>> from:\n 459
> >>> > = n, number of documents containing term\n 1500 = N, total number of
> >>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n +
> >>> 0.5) /
> >>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500
> >>> = N,
> >>> > total number of documents with field\n 2.3686793 = idf, computed as
> >>> log(1 +
> >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> >>> containing
> >>> > term\n 1500 = N, total number of documents with field\n 0.5782502 =
> tf,
> >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n
> 1.0 =
> >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b,
> length
> >>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 =
> avgdl,
> >>> > average length of field\n", "product:
> >>> > https://istore.lt/iphone-xr-64gb-blue.html":"\n3.9714882 =
> >>> > weight(title:\"iphon xr 64gb\" in 28) [SchemaSimilarity], result
> of:\n
> >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
> >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
> >>> from:\n 459
> >>> > = n, number of documents containing term\n 1500 = N, total number of
> >>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n +
> >>> 0.5) /
> >>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500
> >>> = N,
> >>> > total number of documents with field\n 2.3686793 = idf, computed as
> >>> log(1 +
> >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> >>> containing
> >>> > term\n 1500 = N, total number of documents with field\n 0.5782502 =
> tf,
> >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n
> 1.0 =
> >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b,
> length
> >>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 =
> avgdl,
> >>> > average length of field\n", "product:
> >>> > https://istore.lt/iphone-xr-64gb-coral.html":"\n3.9714882 =
> >>> > weight(title:\"iphon xr 64gb\" in 29) [SchemaSimilarity], result
> of:\n
> >>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
> >>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
> >>> from:\n 459
> >>> > = n, number of documents containing term\n 1500 = N, total number of
> >>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n +
> >>> 0.5) /
> >>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500
> >>> = N,
> >>> > total number of documents with field\n 2.3686793 = idf, computed as
> >>> log(1 +
> >>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> >>> containing
> >>> > term\n 1500 = N, total number of documents with field\n 0.5782502 =
> tf,
> >>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n
> 1.0 =
> >>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b,
> length
> >>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 =
> avgdl,
> >>> > average length of field\n"}, "QParser":"LuceneQParser",
> >>> > "filter_queries":["{!join
> >>> > from=site_id to=site_id fromIndex=stores
> score=max}{!func}geodist()"],
> >>> "
> >>> > parsed_filter_queries":["OtherCoreJoinQuery(OtherCoreJoinQuery
> >>> > [fromIndex=stores, fromCoreOpenTime=3373417389901342 extends
> >>> > SameCoreJoinQuery
> >>> >
> >>> >
> >>>
> [fromQuery=ShapeFieldCacheDistanceValueSource(org.apache.lucene.spatial.prefix.PointPrefixTreeFieldCacheProvider@2bfc8ad8
> >>> > ,
> >>> > Pt(x=25.224815300000046,y=54.69738679999999)), fromField=site_id,
> >>> > toField=site_id, scoreMode=Max]])"], }
> >>> >
> >>> > On Tue, Nov 12, 2019 at 12:48 PM Mikhail Khludnev <mk...@apache.org>
> >>> wrote:
> >>> >
> >>> > > Hello,
> >>> > > It seems like I breached the limit on unconscious replies in
> mailing
> >>> list
> >>> > >   I'd rather start with this:
> >>> > > q={!join from=site_id to=site_id fromIndex=stores
> >>> > > score=max}+{!geofilt}
> >>> > >
> >>> > >
> >>> >
> >>>
> {!func}geodist()&sfield=coordinates&pt=54.69738679999999,25.224815300000046&d=10
> >>> > >
> >>> > >
> >>> > > On Mon, Nov 11, 2019 at 11:11 PM Mikhail Khludnev <mkhl@apache.org
> >
> >>> > wrote:
> >>> > >
> >>> > > > Is it something like
> >>> https://issues.apache.org/jira/browse/SOLR-10673
> >>> > ?
> >>> > > >
> >>> > > > On Mon, Nov 11, 2019 at 3:47 PM Vasily Ogar <
> ogar.vasily@gmail.com
> >>> >
> >>> > > wrote:
> >>> > > >
> >>> > > >> it's show nothing because I got an error
> >>> > > >> "metadata":[
> "error-class","org.apache.solr.common.SolrException",
> >>> > > >> "root-error-class","org.apache.solr.search.SyntaxError"],
> >>> > > >> "msg":"org.apache.solr.search.SyntaxError:
> >>> > > >> geodist - not enough parameters:[]",
> >>> > > >>
> >>> > > >> If I set parameters then I got another error
> >>> > > >> "metadata":[
> "error-class","org.apache.solr.common.SolrException",
> >>> > > >> "root-error-class","org.apache.solr.common.SolrException"],
> >>> "msg":"A
> >>> > > >> ValueSource isn't directly available from this field. Instead
> try
> >>> a
> >>> > > query
> >>> > > >> using the distance as the score.",
> >>> > > >>
> >>> > > >> On Mon, Nov 11, 2019 at 1:36 PM Mikhail Khludnev <
> mkhl@apache.org
> >>> >
> >>> > > wrote:
> >>> > > >>
> >>> > > >> > Hello, Vasily.
> >>> > > >> > Why not? What have you got in debugQuery=true?
> >>> > > >> >
> >>> > > >> > On Mon, Nov 11, 2019 at 1:19 PM Vasily Ogar <
> >>> ogar.vasily@gmail.com>
> >>> > > >> wrote:
> >>> > > >> >
> >>> > > >> > > Hello,
> >>> > > >> > > Is it possible to sort by score in join by geodist()? For
> >>> > instance,
> >>> > > >> > > something like this
> >>> > > >> > > q={!join from=site_id to=site_id fromIndex=stores score=max}
> >>> > > >> > > +{!func}gedist() +{!geofilt sfield=coordinates
> >>> > > >> > > pt=54.69738679999999,25.224815300000046 d=10}
> >>> > > >> > > sort=score desc
> >>> > > >> > > Thank you
> >>> > > >> > >
> >>> > > >> >
> >>> > > >> >
> >>> > > >> > --
> >>> > > >> > Sincerely yours
> >>> > > >> > Mikhail Khludnev
> >>> > > >> >
> >>> > > >>
> >>> > > >
> >>> > > >
> >>> > > > --
> >>> > > > Sincerely yours
> >>> > > > Mikhail Khludnev
> >>> > > >
> >>> > >
> >>> > >
> >>> > > --
> >>> > > Sincerely yours
> >>> > > Mikhail Khludnev
> >>> > >
> >>> >
> >>>
> >>>
> >>> --
> >>> Sincerely yours
> >>> Mikhail Khludnev
> >>>
> >>
>


-- 
Sincerely yours
Mikhail Khludnev

Re: sort by score in join with geodist()

Posted by Vasily Ogar <og...@gmail.com>.
I was glad too early because it can only sort or only filter, but can't do
together :(. It takes the only first argument, in my case it geodist or
geofilt

On Thu, Nov 14, 2019 at 11:11 AM Vasily Ogar <og...@gmail.com> wrote:

> Hello,
> I fixed it. If I need to sort by price:
> "q":"{!join from=site_id to=site_id fromIndex=stores}*:*",
> "fq":"{!edismax qf=\"title description\" v=\"iphone xr 64gb\" mm=3<90%}",
> "fl":"score,*,store:[subquery fromIndex=stores]",
> "store.q":"{!terms f=site_id v=$row.site_id}", "store.rows":"1", "store.fl
> ":"*,score", "sort":"price_low desc",
> "hl":"on", "hl.simple.pre":"<strong>", "hl.simple.post":"</strong>",
> "hl.q":"{!edismax qf=$hl.fl v=\"iphone xr 64gb\"}", "hl.fl":"title
> description", "hl.method":"unified", "group.field":"site_id", "group":
> "true"
> "group.limit":"2",
>
> And if I need to sort by geodist:
> "q":"{!join from=site_id to=site_id fromIndex=stores
> score=max}{!func}geodist(){!geofilt}",
> "d":"100",
> "sfield":"coordinates",
> "pt":"54.69738679999999,25.224815300000046"
> "fq":"{!edismax qf=\"title description\" v=\"iphone xr 64gb\" mm=3<90%}",
> "fl":"score,*,store:[subquery fromIndex=stores]",
> "store.q":"{!terms f=site_id v=$row.site_id}", "store.rows":"1", "store.fl
> ":"*,score",
> "store.fq":"{!geofilt}",
> "store.sfield":"coordinates",
> "store.d":"100", "store.pt":"54.69738679999999,25.224815300000046", "sort
> ":"score desc",
> "hl":"on", "hl.simple.pre":"<strong>", "hl.simple.post":"</strong>",
> "hl.q":"{!edismax qf=$hl.fl v=\"iphone xr 64gb\"}", "hl.fl":"title
> description", "hl.method":"unified", "group.field":"site_id", "group":
> "true"
> "group.limit":"2",
>
> On Tue, Nov 12, 2019 at 6:54 PM Vasily Ogar <og...@gmail.com> wrote:
>
>> Thank you for advice, now it working as expected. Maybe you know how to
>> integrate with dismax?
>>
>> On Tue, Nov 12, 2019 at 6:10 PM Mikhail Khludnev <mk...@apache.org> wrote:
>>
>>> tlrd;
>>> I noticed func under fq that make no sense. Only q or sort yield scores.
>>>
>>> On Tue, Nov 12, 2019 at 6:43 PM Vasily Ogar <og...@gmail.com>
>>> wrote:
>>>
>>> > First of all, thank you for your help.
>>> > Now it doesn't show any errors, but somehow score is based on the
>>> title and
>>> > description but not on the geodist.
>>> > "params":{ "hl":"on", "pt":"54.69738679999999,25.224815300000046",
>>> > "fl":"score,*,store:[subquery
>>> > fromIndex=stores]", "store.rows":"1", "fq":"{!join from=site_id
>>> to=site_id
>>> > fromIndex=stores score=max}{!func}geodist()", "store.sort":"geodist()
>>> asc",
>>> > "hl.simple.pre":"</em>", "store.q":"{!terms f=site_id
>>> v=$row.site_id}", "
>>> > store.sfield":"coordinates", "hl.fl":"title description",
>>> "group.field":
>>> > "site_id", "_":"1573559644298", "group":"true",
>>> "store.fq":"{!geofilt}", "d
>>> > ":"100", "{!geofilt}":"", "group.limit":"2", "store.d":"100", "
>>> store.pt":
>>> > "54.69738679999999,25.224815300000046", "store.fl":"*,score",
>>> "sort":"score
>>> > desc", "sfield":"coordinates", "q":"title:\"iphone xr 64gb\"",
>>> > "group.main":
>>> > "true", "hl.simple.post":"</em>", "debugQuery":"on"}
>>> >
>>> > Here is debug:
>>> > "debug":{ "rawquerystring":"title:\"iphone xr 64gb\"",
>>> > "querystring":"title:\"iphone
>>> > xr 64gb\"", "parsedquery":"PhraseQuery(title:\"iphon xr 64gb\")", "
>>> > parsedquery_toString":"title:\"iphon xr 64gb\"", "explain":{ "product:
>>> > https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-yellow
>>> ":"\n3.9714882
>>> > =
>>> > weight(title:\"iphon xr 64gb\" in 568) [SchemaSimilarity], result of:\n
>>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
>>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
>>> from:\n 459
>>> > = n, number of documents containing term\n 1500 = N, total number of
>>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n +
>>> 0.5) /
>>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500
>>> = N,
>>> > total number of documents with field\n 2.3686793 = idf, computed as
>>> log(1 +
>>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
>>> containing
>>> > term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
>>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
>>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
>>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
>>> > average length of field\n", "product:
>>> > https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-white":"\n3.9714882
>>> =
>>> > weight(title:\"iphon xr 64gb\" in 569) [SchemaSimilarity], result of:\n
>>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
>>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
>>> from:\n 459
>>> > = n, number of documents containing term\n 1500 = N, total number of
>>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n +
>>> 0.5) /
>>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500
>>> = N,
>>> > total number of documents with field\n 2.3686793 = idf, computed as
>>> log(1 +
>>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
>>> containing
>>> > term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
>>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
>>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
>>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
>>> > average length of field\n", "product:
>>> > https://istore.lt/iphone-xr-64gb-blue.html":"\n3.9714882 =
>>> > weight(title:\"iphon xr 64gb\" in 28) [SchemaSimilarity], result of:\n
>>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
>>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
>>> from:\n 459
>>> > = n, number of documents containing term\n 1500 = N, total number of
>>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n +
>>> 0.5) /
>>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500
>>> = N,
>>> > total number of documents with field\n 2.3686793 = idf, computed as
>>> log(1 +
>>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
>>> containing
>>> > term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
>>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
>>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
>>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
>>> > average length of field\n", "product:
>>> > https://istore.lt/iphone-xr-64gb-coral.html":"\n3.9714882 =
>>> > weight(title:\"iphon xr 64gb\" in 29) [SchemaSimilarity], result of:\n
>>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
>>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5))
>>> from:\n 459
>>> > = n, number of documents containing term\n 1500 = N, total number of
>>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n +
>>> 0.5) /
>>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500
>>> = N,
>>> > total number of documents with field\n 2.3686793 = idf, computed as
>>> log(1 +
>>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
>>> containing
>>> > term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
>>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
>>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
>>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
>>> > average length of field\n"}, "QParser":"LuceneQParser",
>>> > "filter_queries":["{!join
>>> > from=site_id to=site_id fromIndex=stores score=max}{!func}geodist()"],
>>> "
>>> > parsed_filter_queries":["OtherCoreJoinQuery(OtherCoreJoinQuery
>>> > [fromIndex=stores, fromCoreOpenTime=3373417389901342 extends
>>> > SameCoreJoinQuery
>>> >
>>> >
>>> [fromQuery=ShapeFieldCacheDistanceValueSource(org.apache.lucene.spatial.prefix.PointPrefixTreeFieldCacheProvider@2bfc8ad8
>>> > ,
>>> > Pt(x=25.224815300000046,y=54.69738679999999)), fromField=site_id,
>>> > toField=site_id, scoreMode=Max]])"], }
>>> >
>>> > On Tue, Nov 12, 2019 at 12:48 PM Mikhail Khludnev <mk...@apache.org>
>>> wrote:
>>> >
>>> > > Hello,
>>> > > It seems like I breached the limit on unconscious replies in mailing
>>> list
>>> > >   I'd rather start with this:
>>> > > q={!join from=site_id to=site_id fromIndex=stores
>>> > > score=max}+{!geofilt}
>>> > >
>>> > >
>>> >
>>> {!func}geodist()&sfield=coordinates&pt=54.69738679999999,25.224815300000046&d=10
>>> > >
>>> > >
>>> > > On Mon, Nov 11, 2019 at 11:11 PM Mikhail Khludnev <mk...@apache.org>
>>> > wrote:
>>> > >
>>> > > > Is it something like
>>> https://issues.apache.org/jira/browse/SOLR-10673
>>> > ?
>>> > > >
>>> > > > On Mon, Nov 11, 2019 at 3:47 PM Vasily Ogar <ogar.vasily@gmail.com
>>> >
>>> > > wrote:
>>> > > >
>>> > > >> it's show nothing because I got an error
>>> > > >> "metadata":[ "error-class","org.apache.solr.common.SolrException",
>>> > > >> "root-error-class","org.apache.solr.search.SyntaxError"],
>>> > > >> "msg":"org.apache.solr.search.SyntaxError:
>>> > > >> geodist - not enough parameters:[]",
>>> > > >>
>>> > > >> If I set parameters then I got another error
>>> > > >> "metadata":[ "error-class","org.apache.solr.common.SolrException",
>>> > > >> "root-error-class","org.apache.solr.common.SolrException"],
>>> "msg":"A
>>> > > >> ValueSource isn't directly available from this field. Instead try
>>> a
>>> > > query
>>> > > >> using the distance as the score.",
>>> > > >>
>>> > > >> On Mon, Nov 11, 2019 at 1:36 PM Mikhail Khludnev <mkhl@apache.org
>>> >
>>> > > wrote:
>>> > > >>
>>> > > >> > Hello, Vasily.
>>> > > >> > Why not? What have you got in debugQuery=true?
>>> > > >> >
>>> > > >> > On Mon, Nov 11, 2019 at 1:19 PM Vasily Ogar <
>>> ogar.vasily@gmail.com>
>>> > > >> wrote:
>>> > > >> >
>>> > > >> > > Hello,
>>> > > >> > > Is it possible to sort by score in join by geodist()? For
>>> > instance,
>>> > > >> > > something like this
>>> > > >> > > q={!join from=site_id to=site_id fromIndex=stores score=max}
>>> > > >> > > +{!func}gedist() +{!geofilt sfield=coordinates
>>> > > >> > > pt=54.69738679999999,25.224815300000046 d=10}
>>> > > >> > > sort=score desc
>>> > > >> > > Thank you
>>> > > >> > >
>>> > > >> >
>>> > > >> >
>>> > > >> > --
>>> > > >> > Sincerely yours
>>> > > >> > Mikhail Khludnev
>>> > > >> >
>>> > > >>
>>> > > >
>>> > > >
>>> > > > --
>>> > > > Sincerely yours
>>> > > > Mikhail Khludnev
>>> > > >
>>> > >
>>> > >
>>> > > --
>>> > > Sincerely yours
>>> > > Mikhail Khludnev
>>> > >
>>> >
>>>
>>>
>>> --
>>> Sincerely yours
>>> Mikhail Khludnev
>>>
>>

Re: sort by score in join with geodist()

Posted by Vasily Ogar <og...@gmail.com>.
Hello,
I fixed it. If I need to sort by price:
"q":"{!join from=site_id to=site_id fromIndex=stores}*:*",
"fq":"{!edismax qf=\"title description\" v=\"iphone xr 64gb\" mm=3<90%}", "
fl":"score,*,store:[subquery fromIndex=stores]",
"store.q":"{!terms f=site_id v=$row.site_id}", "store.rows":"1", "store.fl":
"*,score", "sort":"price_low desc",
"hl":"on", "hl.simple.pre":"<strong>", "hl.simple.post":"</strong>",
"hl.q":"{!edismax qf=$hl.fl v=\"iphone xr 64gb\"}", "hl.fl":"title
description", "hl.method":"unified", "group.field":"site_id", "group":"true"
"group.limit":"2",

And if I need to sort by geodist:
"q":"{!join from=site_id to=site_id fromIndex=stores
score=max}{!func}geodist(){!geofilt}",
"d":"100",
"sfield":"coordinates",
"pt":"54.69738679999999,25.224815300000046"
"fq":"{!edismax qf=\"title description\" v=\"iphone xr 64gb\" mm=3<90%}", "
fl":"score,*,store:[subquery fromIndex=stores]",
"store.q":"{!terms f=site_id v=$row.site_id}", "store.rows":"1", "store.fl":
"*,score",
"store.fq":"{!geofilt}",
"store.sfield":"coordinates",
"store.d":"100", "store.pt":"54.69738679999999,25.224815300000046",
"sort":"score
desc",
"hl":"on", "hl.simple.pre":"<strong>", "hl.simple.post":"</strong>",
"hl.q":"{!edismax qf=$hl.fl v=\"iphone xr 64gb\"}", "hl.fl":"title
description", "hl.method":"unified", "group.field":"site_id", "group":"true"
"group.limit":"2",

On Tue, Nov 12, 2019 at 6:54 PM Vasily Ogar <og...@gmail.com> wrote:

> Thank you for advice, now it working as expected. Maybe you know how to
> integrate with dismax?
>
> On Tue, Nov 12, 2019 at 6:10 PM Mikhail Khludnev <mk...@apache.org> wrote:
>
>> tlrd;
>> I noticed func under fq that make no sense. Only q or sort yield scores.
>>
>> On Tue, Nov 12, 2019 at 6:43 PM Vasily Ogar <og...@gmail.com>
>> wrote:
>>
>> > First of all, thank you for your help.
>> > Now it doesn't show any errors, but somehow score is based on the title
>> and
>> > description but not on the geodist.
>> > "params":{ "hl":"on", "pt":"54.69738679999999,25.224815300000046",
>> > "fl":"score,*,store:[subquery
>> > fromIndex=stores]", "store.rows":"1", "fq":"{!join from=site_id
>> to=site_id
>> > fromIndex=stores score=max}{!func}geodist()", "store.sort":"geodist()
>> asc",
>> > "hl.simple.pre":"</em>", "store.q":"{!terms f=site_id v=$row.site_id}",
>> "
>> > store.sfield":"coordinates", "hl.fl":"title description", "group.field":
>> > "site_id", "_":"1573559644298", "group":"true",
>> "store.fq":"{!geofilt}", "d
>> > ":"100", "{!geofilt}":"", "group.limit":"2", "store.d":"100", "store.pt
>> ":
>> > "54.69738679999999,25.224815300000046", "store.fl":"*,score",
>> "sort":"score
>> > desc", "sfield":"coordinates", "q":"title:\"iphone xr 64gb\"",
>> > "group.main":
>> > "true", "hl.simple.post":"</em>", "debugQuery":"on"}
>> >
>> > Here is debug:
>> > "debug":{ "rawquerystring":"title:\"iphone xr 64gb\"",
>> > "querystring":"title:\"iphone
>> > xr 64gb\"", "parsedquery":"PhraseQuery(title:\"iphon xr 64gb\")", "
>> > parsedquery_toString":"title:\"iphon xr 64gb\"", "explain":{ "product:
>> > https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-yellow
>> ":"\n3.9714882
>> > =
>> > weight(title:\"iphon xr 64gb\" in 568) [SchemaSimilarity], result of:\n
>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:\n
>> 459
>> > = n, number of documents containing term\n 1500 = N, total number of
>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n +
>> 0.5) /
>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500 =
>> N,
>> > total number of documents with field\n 2.3686793 = idf, computed as
>> log(1 +
>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
>> containing
>> > term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
>> > average length of field\n", "product:
>> > https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-white":"\n3.9714882
>> =
>> > weight(title:\"iphon xr 64gb\" in 569) [SchemaSimilarity], result of:\n
>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:\n
>> 459
>> > = n, number of documents containing term\n 1500 = N, total number of
>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n +
>> 0.5) /
>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500 =
>> N,
>> > total number of documents with field\n 2.3686793 = idf, computed as
>> log(1 +
>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
>> containing
>> > term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
>> > average length of field\n", "product:
>> > https://istore.lt/iphone-xr-64gb-blue.html":"\n3.9714882 =
>> > weight(title:\"iphon xr 64gb\" in 28) [SchemaSimilarity], result of:\n
>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:\n
>> 459
>> > = n, number of documents containing term\n 1500 = N, total number of
>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n +
>> 0.5) /
>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500 =
>> N,
>> > total number of documents with field\n 2.3686793 = idf, computed as
>> log(1 +
>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
>> containing
>> > term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
>> > average length of field\n", "product:
>> > https://istore.lt/iphone-xr-64gb-coral.html":"\n3.9714882 =
>> > weight(title:\"iphon xr 64gb\" in 29) [SchemaSimilarity], result of:\n
>> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
>> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:\n
>> 459
>> > = n, number of documents containing term\n 1500 = N, total number of
>> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n +
>> 0.5) /
>> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500 =
>> N,
>> > total number of documents with field\n 2.3686793 = idf, computed as
>> log(1 +
>> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
>> containing
>> > term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
>> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
>> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
>> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
>> > average length of field\n"}, "QParser":"LuceneQParser",
>> > "filter_queries":["{!join
>> > from=site_id to=site_id fromIndex=stores score=max}{!func}geodist()"], "
>> > parsed_filter_queries":["OtherCoreJoinQuery(OtherCoreJoinQuery
>> > [fromIndex=stores, fromCoreOpenTime=3373417389901342 extends
>> > SameCoreJoinQuery
>> >
>> >
>> [fromQuery=ShapeFieldCacheDistanceValueSource(org.apache.lucene.spatial.prefix.PointPrefixTreeFieldCacheProvider@2bfc8ad8
>> > ,
>> > Pt(x=25.224815300000046,y=54.69738679999999)), fromField=site_id,
>> > toField=site_id, scoreMode=Max]])"], }
>> >
>> > On Tue, Nov 12, 2019 at 12:48 PM Mikhail Khludnev <mk...@apache.org>
>> wrote:
>> >
>> > > Hello,
>> > > It seems like I breached the limit on unconscious replies in mailing
>> list
>> > >   I'd rather start with this:
>> > > q={!join from=site_id to=site_id fromIndex=stores
>> > > score=max}+{!geofilt}
>> > >
>> > >
>> >
>> {!func}geodist()&sfield=coordinates&pt=54.69738679999999,25.224815300000046&d=10
>> > >
>> > >
>> > > On Mon, Nov 11, 2019 at 11:11 PM Mikhail Khludnev <mk...@apache.org>
>> > wrote:
>> > >
>> > > > Is it something like
>> https://issues.apache.org/jira/browse/SOLR-10673
>> > ?
>> > > >
>> > > > On Mon, Nov 11, 2019 at 3:47 PM Vasily Ogar <og...@gmail.com>
>> > > wrote:
>> > > >
>> > > >> it's show nothing because I got an error
>> > > >> "metadata":[ "error-class","org.apache.solr.common.SolrException",
>> > > >> "root-error-class","org.apache.solr.search.SyntaxError"],
>> > > >> "msg":"org.apache.solr.search.SyntaxError:
>> > > >> geodist - not enough parameters:[]",
>> > > >>
>> > > >> If I set parameters then I got another error
>> > > >> "metadata":[ "error-class","org.apache.solr.common.SolrException",
>> > > >> "root-error-class","org.apache.solr.common.SolrException"],
>> "msg":"A
>> > > >> ValueSource isn't directly available from this field. Instead try a
>> > > query
>> > > >> using the distance as the score.",
>> > > >>
>> > > >> On Mon, Nov 11, 2019 at 1:36 PM Mikhail Khludnev <mk...@apache.org>
>> > > wrote:
>> > > >>
>> > > >> > Hello, Vasily.
>> > > >> > Why not? What have you got in debugQuery=true?
>> > > >> >
>> > > >> > On Mon, Nov 11, 2019 at 1:19 PM Vasily Ogar <
>> ogar.vasily@gmail.com>
>> > > >> wrote:
>> > > >> >
>> > > >> > > Hello,
>> > > >> > > Is it possible to sort by score in join by geodist()? For
>> > instance,
>> > > >> > > something like this
>> > > >> > > q={!join from=site_id to=site_id fromIndex=stores score=max}
>> > > >> > > +{!func}gedist() +{!geofilt sfield=coordinates
>> > > >> > > pt=54.69738679999999,25.224815300000046 d=10}
>> > > >> > > sort=score desc
>> > > >> > > Thank you
>> > > >> > >
>> > > >> >
>> > > >> >
>> > > >> > --
>> > > >> > Sincerely yours
>> > > >> > Mikhail Khludnev
>> > > >> >
>> > > >>
>> > > >
>> > > >
>> > > > --
>> > > > Sincerely yours
>> > > > Mikhail Khludnev
>> > > >
>> > >
>> > >
>> > > --
>> > > Sincerely yours
>> > > Mikhail Khludnev
>> > >
>> >
>>
>>
>> --
>> Sincerely yours
>> Mikhail Khludnev
>>
>

Re: sort by score in join with geodist()

Posted by Vasily Ogar <og...@gmail.com>.
Thank you for advice, now it working as expected. Maybe you know how to
integrate with dismax?

On Tue, Nov 12, 2019 at 6:10 PM Mikhail Khludnev <mk...@apache.org> wrote:

> tlrd;
> I noticed func under fq that make no sense. Only q or sort yield scores.
>
> On Tue, Nov 12, 2019 at 6:43 PM Vasily Ogar <og...@gmail.com> wrote:
>
> > First of all, thank you for your help.
> > Now it doesn't show any errors, but somehow score is based on the title
> and
> > description but not on the geodist.
> > "params":{ "hl":"on", "pt":"54.69738679999999,25.224815300000046",
> > "fl":"score,*,store:[subquery
> > fromIndex=stores]", "store.rows":"1", "fq":"{!join from=site_id
> to=site_id
> > fromIndex=stores score=max}{!func}geodist()", "store.sort":"geodist()
> asc",
> > "hl.simple.pre":"</em>", "store.q":"{!terms f=site_id v=$row.site_id}", "
> > store.sfield":"coordinates", "hl.fl":"title description", "group.field":
> > "site_id", "_":"1573559644298", "group":"true", "store.fq":"{!geofilt}",
> "d
> > ":"100", "{!geofilt}":"", "group.limit":"2", "store.d":"100", "store.pt
> ":
> > "54.69738679999999,25.224815300000046", "store.fl":"*,score",
> "sort":"score
> > desc", "sfield":"coordinates", "q":"title:\"iphone xr 64gb\"",
> > "group.main":
> > "true", "hl.simple.post":"</em>", "debugQuery":"on"}
> >
> > Here is debug:
> > "debug":{ "rawquerystring":"title:\"iphone xr 64gb\"",
> > "querystring":"title:\"iphone
> > xr 64gb\"", "parsedquery":"PhraseQuery(title:\"iphon xr 64gb\")", "
> > parsedquery_toString":"title:\"iphon xr 64gb\"", "explain":{ "product:
> > https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-yellow
> ":"\n3.9714882
> > =
> > weight(title:\"iphon xr 64gb\" in 568) [SchemaSimilarity], result of:\n
> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:\n
> 459
> > = n, number of documents containing term\n 1500 = N, total number of
> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n +
> 0.5) /
> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500 =
> N,
> > total number of documents with field\n 2.3686793 = idf, computed as
> log(1 +
> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> containing
> > term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
> > average length of field\n", "product:
> > https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-white":"\n3.9714882
> =
> > weight(title:\"iphon xr 64gb\" in 569) [SchemaSimilarity], result of:\n
> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:\n
> 459
> > = n, number of documents containing term\n 1500 = N, total number of
> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n +
> 0.5) /
> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500 =
> N,
> > total number of documents with field\n 2.3686793 = idf, computed as
> log(1 +
> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> containing
> > term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
> > average length of field\n", "product:
> > https://istore.lt/iphone-xr-64gb-blue.html":"\n3.9714882 =
> > weight(title:\"iphon xr 64gb\" in 28) [SchemaSimilarity], result of:\n
> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:\n
> 459
> > = n, number of documents containing term\n 1500 = N, total number of
> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n +
> 0.5) /
> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500 =
> N,
> > total number of documents with field\n 2.3686793 = idf, computed as
> log(1 +
> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> containing
> > term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
> > average length of field\n", "product:
> > https://istore.lt/iphone-xr-64gb-coral.html":"\n3.9714882 =
> > weight(title:\"iphon xr 64gb\" in 29) [SchemaSimilarity], result of:\n
> > 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
> > 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:\n
> 459
> > = n, number of documents containing term\n 1500 = N, total number of
> > documents with field\n 3.3156862 = idf, computed as log(1 + (N - n +
> 0.5) /
> > (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500 =
> N,
> > total number of documents with field\n 2.3686793 = idf, computed as
> log(1 +
> > (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents
> containing
> > term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
> > computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
> > phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
> > normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
> > average length of field\n"}, "QParser":"LuceneQParser",
> > "filter_queries":["{!join
> > from=site_id to=site_id fromIndex=stores score=max}{!func}geodist()"], "
> > parsed_filter_queries":["OtherCoreJoinQuery(OtherCoreJoinQuery
> > [fromIndex=stores, fromCoreOpenTime=3373417389901342 extends
> > SameCoreJoinQuery
> >
> >
> [fromQuery=ShapeFieldCacheDistanceValueSource(org.apache.lucene.spatial.prefix.PointPrefixTreeFieldCacheProvider@2bfc8ad8
> > ,
> > Pt(x=25.224815300000046,y=54.69738679999999)), fromField=site_id,
> > toField=site_id, scoreMode=Max]])"], }
> >
> > On Tue, Nov 12, 2019 at 12:48 PM Mikhail Khludnev <mk...@apache.org>
> wrote:
> >
> > > Hello,
> > > It seems like I breached the limit on unconscious replies in mailing
> list
> > >   I'd rather start with this:
> > > q={!join from=site_id to=site_id fromIndex=stores
> > > score=max}+{!geofilt}
> > >
> > >
> >
> {!func}geodist()&sfield=coordinates&pt=54.69738679999999,25.224815300000046&d=10
> > >
> > >
> > > On Mon, Nov 11, 2019 at 11:11 PM Mikhail Khludnev <mk...@apache.org>
> > wrote:
> > >
> > > > Is it something like
> https://issues.apache.org/jira/browse/SOLR-10673
> > ?
> > > >
> > > > On Mon, Nov 11, 2019 at 3:47 PM Vasily Ogar <og...@gmail.com>
> > > wrote:
> > > >
> > > >> it's show nothing because I got an error
> > > >> "metadata":[ "error-class","org.apache.solr.common.SolrException",
> > > >> "root-error-class","org.apache.solr.search.SyntaxError"],
> > > >> "msg":"org.apache.solr.search.SyntaxError:
> > > >> geodist - not enough parameters:[]",
> > > >>
> > > >> If I set parameters then I got another error
> > > >> "metadata":[ "error-class","org.apache.solr.common.SolrException",
> > > >> "root-error-class","org.apache.solr.common.SolrException"], "msg":"A
> > > >> ValueSource isn't directly available from this field. Instead try a
> > > query
> > > >> using the distance as the score.",
> > > >>
> > > >> On Mon, Nov 11, 2019 at 1:36 PM Mikhail Khludnev <mk...@apache.org>
> > > wrote:
> > > >>
> > > >> > Hello, Vasily.
> > > >> > Why not? What have you got in debugQuery=true?
> > > >> >
> > > >> > On Mon, Nov 11, 2019 at 1:19 PM Vasily Ogar <
> ogar.vasily@gmail.com>
> > > >> wrote:
> > > >> >
> > > >> > > Hello,
> > > >> > > Is it possible to sort by score in join by geodist()? For
> > instance,
> > > >> > > something like this
> > > >> > > q={!join from=site_id to=site_id fromIndex=stores score=max}
> > > >> > > +{!func}gedist() +{!geofilt sfield=coordinates
> > > >> > > pt=54.69738679999999,25.224815300000046 d=10}
> > > >> > > sort=score desc
> > > >> > > Thank you
> > > >> > >
> > > >> >
> > > >> >
> > > >> > --
> > > >> > Sincerely yours
> > > >> > Mikhail Khludnev
> > > >> >
> > > >>
> > > >
> > > >
> > > > --
> > > > Sincerely yours
> > > > Mikhail Khludnev
> > > >
> > >
> > >
> > > --
> > > Sincerely yours
> > > Mikhail Khludnev
> > >
> >
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>

Re: sort by score in join with geodist()

Posted by Mikhail Khludnev <mk...@apache.org>.
tlrd;
I noticed func under fq that make no sense. Only q or sort yield scores.

On Tue, Nov 12, 2019 at 6:43 PM Vasily Ogar <og...@gmail.com> wrote:

> First of all, thank you for your help.
> Now it doesn't show any errors, but somehow score is based on the title and
> description but not on the geodist.
> "params":{ "hl":"on", "pt":"54.69738679999999,25.224815300000046",
> "fl":"score,*,store:[subquery
> fromIndex=stores]", "store.rows":"1", "fq":"{!join from=site_id to=site_id
> fromIndex=stores score=max}{!func}geodist()", "store.sort":"geodist() asc",
> "hl.simple.pre":"</em>", "store.q":"{!terms f=site_id v=$row.site_id}", "
> store.sfield":"coordinates", "hl.fl":"title description", "group.field":
> "site_id", "_":"1573559644298", "group":"true", "store.fq":"{!geofilt}", "d
> ":"100", "{!geofilt}":"", "group.limit":"2", "store.d":"100", "store.pt":
> "54.69738679999999,25.224815300000046", "store.fl":"*,score", "sort":"score
> desc", "sfield":"coordinates", "q":"title:\"iphone xr 64gb\"",
> "group.main":
> "true", "hl.simple.post":"</em>", "debugQuery":"on"}
>
> Here is debug:
> "debug":{ "rawquerystring":"title:\"iphone xr 64gb\"",
> "querystring":"title:\"iphone
> xr 64gb\"", "parsedquery":"PhraseQuery(title:\"iphon xr 64gb\")", "
> parsedquery_toString":"title:\"iphon xr 64gb\"", "explain":{ "product:
> https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-yellow":"\n3.9714882
> =
> weight(title:\"iphon xr 64gb\" in 568) [SchemaSimilarity], result of:\n
> 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
> 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:\n 459
> = n, number of documents containing term\n 1500 = N, total number of
> documents with field\n 3.3156862 = idf, computed as log(1 + (N - n + 0.5) /
> (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500 = N,
> total number of documents with field\n 2.3686793 = idf, computed as log(1 +
> (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents containing
> term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
> computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
> phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
> normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
> average length of field\n", "product:
> https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-white":"\n3.9714882 =
> weight(title:\"iphon xr 64gb\" in 569) [SchemaSimilarity], result of:\n
> 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
> 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:\n 459
> = n, number of documents containing term\n 1500 = N, total number of
> documents with field\n 3.3156862 = idf, computed as log(1 + (N - n + 0.5) /
> (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500 = N,
> total number of documents with field\n 2.3686793 = idf, computed as log(1 +
> (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents containing
> term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
> computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
> phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
> normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
> average length of field\n", "product:
> https://istore.lt/iphone-xr-64gb-blue.html":"\n3.9714882 =
> weight(title:\"iphon xr 64gb\" in 28) [SchemaSimilarity], result of:\n
> 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
> 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:\n 459
> = n, number of documents containing term\n 1500 = N, total number of
> documents with field\n 3.3156862 = idf, computed as log(1 + (N - n + 0.5) /
> (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500 = N,
> total number of documents with field\n 2.3686793 = idf, computed as log(1 +
> (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents containing
> term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
> computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
> phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
> normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
> average length of field\n", "product:
> https://istore.lt/iphone-xr-64gb-coral.html":"\n3.9714882 =
> weight(title:\"iphon xr 64gb\" in 29) [SchemaSimilarity], result of:\n
> 3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
> 1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:\n 459
> = n, number of documents containing term\n 1500 = N, total number of
> documents with field\n 3.3156862 = idf, computed as log(1 + (N - n + 0.5) /
> (n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500 = N,
> total number of documents with field\n 2.3686793 = idf, computed as log(1 +
> (N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents containing
> term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
> computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
> phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
> normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
> average length of field\n"}, "QParser":"LuceneQParser",
> "filter_queries":["{!join
> from=site_id to=site_id fromIndex=stores score=max}{!func}geodist()"], "
> parsed_filter_queries":["OtherCoreJoinQuery(OtherCoreJoinQuery
> [fromIndex=stores, fromCoreOpenTime=3373417389901342 extends
> SameCoreJoinQuery
>
> [fromQuery=ShapeFieldCacheDistanceValueSource(org.apache.lucene.spatial.prefix.PointPrefixTreeFieldCacheProvider@2bfc8ad8
> ,
> Pt(x=25.224815300000046,y=54.69738679999999)), fromField=site_id,
> toField=site_id, scoreMode=Max]])"], }
>
> On Tue, Nov 12, 2019 at 12:48 PM Mikhail Khludnev <mk...@apache.org> wrote:
>
> > Hello,
> > It seems like I breached the limit on unconscious replies in mailing list
> >   I'd rather start with this:
> > q={!join from=site_id to=site_id fromIndex=stores
> > score=max}+{!geofilt}
> >
> >
> {!func}geodist()&sfield=coordinates&pt=54.69738679999999,25.224815300000046&d=10
> >
> >
> > On Mon, Nov 11, 2019 at 11:11 PM Mikhail Khludnev <mk...@apache.org>
> wrote:
> >
> > > Is it something like  https://issues.apache.org/jira/browse/SOLR-10673
> ?
> > >
> > > On Mon, Nov 11, 2019 at 3:47 PM Vasily Ogar <og...@gmail.com>
> > wrote:
> > >
> > >> it's show nothing because I got an error
> > >> "metadata":[ "error-class","org.apache.solr.common.SolrException",
> > >> "root-error-class","org.apache.solr.search.SyntaxError"],
> > >> "msg":"org.apache.solr.search.SyntaxError:
> > >> geodist - not enough parameters:[]",
> > >>
> > >> If I set parameters then I got another error
> > >> "metadata":[ "error-class","org.apache.solr.common.SolrException",
> > >> "root-error-class","org.apache.solr.common.SolrException"], "msg":"A
> > >> ValueSource isn't directly available from this field. Instead try a
> > query
> > >> using the distance as the score.",
> > >>
> > >> On Mon, Nov 11, 2019 at 1:36 PM Mikhail Khludnev <mk...@apache.org>
> > wrote:
> > >>
> > >> > Hello, Vasily.
> > >> > Why not? What have you got in debugQuery=true?
> > >> >
> > >> > On Mon, Nov 11, 2019 at 1:19 PM Vasily Ogar <og...@gmail.com>
> > >> wrote:
> > >> >
> > >> > > Hello,
> > >> > > Is it possible to sort by score in join by geodist()? For
> instance,
> > >> > > something like this
> > >> > > q={!join from=site_id to=site_id fromIndex=stores score=max}
> > >> > > +{!func}gedist() +{!geofilt sfield=coordinates
> > >> > > pt=54.69738679999999,25.224815300000046 d=10}
> > >> > > sort=score desc
> > >> > > Thank you
> > >> > >
> > >> >
> > >> >
> > >> > --
> > >> > Sincerely yours
> > >> > Mikhail Khludnev
> > >> >
> > >>
> > >
> > >
> > > --
> > > Sincerely yours
> > > Mikhail Khludnev
> > >
> >
> >
> > --
> > Sincerely yours
> > Mikhail Khludnev
> >
>


-- 
Sincerely yours
Mikhail Khludnev

Re: sort by score in join with geodist()

Posted by Vasily Ogar <og...@gmail.com>.
First of all, thank you for your help.
Now it doesn't show any errors, but somehow score is based on the title and
description but not on the geodist.
"params":{ "hl":"on", "pt":"54.69738679999999,25.224815300000046",
"fl":"score,*,store:[subquery
fromIndex=stores]", "store.rows":"1", "fq":"{!join from=site_id to=site_id
fromIndex=stores score=max}{!func}geodist()", "store.sort":"geodist() asc",
"hl.simple.pre":"</em>", "store.q":"{!terms f=site_id v=$row.site_id}", "
store.sfield":"coordinates", "hl.fl":"title description", "group.field":
"site_id", "_":"1573559644298", "group":"true", "store.fq":"{!geofilt}", "d
":"100", "{!geofilt}":"", "group.limit":"2", "store.d":"100", "store.pt":
"54.69738679999999,25.224815300000046", "store.fl":"*,score", "sort":"score
desc", "sfield":"coordinates", "q":"title:\"iphone xr 64gb\"", "group.main":
"true", "hl.simple.post":"</em>", "debugQuery":"on"}

Here is debug:
"debug":{ "rawquerystring":"title:\"iphone xr 64gb\"",
"querystring":"title:\"iphone
xr 64gb\"", "parsedquery":"PhraseQuery(title:\"iphon xr 64gb\")", "
parsedquery_toString":"title:\"iphon xr 64gb\"", "explain":{ "product:
https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-yellow":"\n3.9714882 =
weight(title:\"iphon xr 64gb\" in 568) [SchemaSimilarity], result of:\n
3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:\n 459
= n, number of documents containing term\n 1500 = N, total number of
documents with field\n 3.3156862 = idf, computed as log(1 + (N - n + 0.5) /
(n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500 = N,
total number of documents with field\n 2.3686793 = idf, computed as log(1 +
(N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents containing
term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
average length of field\n", "product:
https://www.ideal.lt/iphone/iphone-xr/iphone-xr-64gb-white":"\n3.9714882 =
weight(title:\"iphon xr 64gb\" in 569) [SchemaSimilarity], result of:\n
3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:\n 459
= n, number of documents containing term\n 1500 = N, total number of
documents with field\n 3.3156862 = idf, computed as log(1 + (N - n + 0.5) /
(n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500 = N,
total number of documents with field\n 2.3686793 = idf, computed as log(1 +
(N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents containing
term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
average length of field\n", "product:
https://istore.lt/iphone-xr-64gb-blue.html":"\n3.9714882 =
weight(title:\"iphon xr 64gb\" in 28) [SchemaSimilarity], result of:\n
3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:\n 459
= n, number of documents containing term\n 1500 = N, total number of
documents with field\n 3.3156862 = idf, computed as log(1 + (N - n + 0.5) /
(n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500 = N,
total number of documents with field\n 2.3686793 = idf, computed as log(1 +
(N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents containing
term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
average length of field\n", "product:
https://istore.lt/iphone-xr-64gb-coral.html":"\n3.9714882 =
weight(title:\"iphon xr 64gb\" in 29) [SchemaSimilarity], result of:\n
3.9714882 = score(freq=1.0), product of:\n 6.8681135 = idf, sum of:\n
1.1837479 = idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:\n 459
= n, number of documents containing term\n 1500 = N, total number of
documents with field\n 3.3156862 = idf, computed as log(1 + (N - n + 0.5) /
(n + 0.5)) from:\n 54 = n, number of documents containing term\n 1500 = N,
total number of documents with field\n 2.3686793 = idf, computed as log(1 +
(N - n + 0.5) / (n + 0.5)) from:\n 140 = n, number of documents containing
term\n 1500 = N, total number of documents with field\n 0.5782502 = tf,
computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:\n 1.0 =
phraseFreq=1.0\n 1.2 = k1, term saturation parameter\n 0.75 = b, length
normalization parameter\n 4.0 = dl, length of field\n 8.384666 = avgdl,
average length of field\n"}, "QParser":"LuceneQParser",
"filter_queries":["{!join
from=site_id to=site_id fromIndex=stores score=max}{!func}geodist()"], "
parsed_filter_queries":["OtherCoreJoinQuery(OtherCoreJoinQuery
[fromIndex=stores, fromCoreOpenTime=3373417389901342 extends
SameCoreJoinQuery
[fromQuery=ShapeFieldCacheDistanceValueSource(org.apache.lucene.spatial.prefix.PointPrefixTreeFieldCacheProvider@2bfc8ad8,
Pt(x=25.224815300000046,y=54.69738679999999)), fromField=site_id,
toField=site_id, scoreMode=Max]])"], }

On Tue, Nov 12, 2019 at 12:48 PM Mikhail Khludnev <mk...@apache.org> wrote:

> Hello,
> It seems like I breached the limit on unconscious replies in mailing list
>   I'd rather start with this:
> q={!join from=site_id to=site_id fromIndex=stores
> score=max}+{!geofilt}
>
> {!func}geodist()&sfield=coordinates&pt=54.69738679999999,25.224815300000046&d=10
>
>
> On Mon, Nov 11, 2019 at 11:11 PM Mikhail Khludnev <mk...@apache.org> wrote:
>
> > Is it something like  https://issues.apache.org/jira/browse/SOLR-10673 ?
> >
> > On Mon, Nov 11, 2019 at 3:47 PM Vasily Ogar <og...@gmail.com>
> wrote:
> >
> >> it's show nothing because I got an error
> >> "metadata":[ "error-class","org.apache.solr.common.SolrException",
> >> "root-error-class","org.apache.solr.search.SyntaxError"],
> >> "msg":"org.apache.solr.search.SyntaxError:
> >> geodist - not enough parameters:[]",
> >>
> >> If I set parameters then I got another error
> >> "metadata":[ "error-class","org.apache.solr.common.SolrException",
> >> "root-error-class","org.apache.solr.common.SolrException"], "msg":"A
> >> ValueSource isn't directly available from this field. Instead try a
> query
> >> using the distance as the score.",
> >>
> >> On Mon, Nov 11, 2019 at 1:36 PM Mikhail Khludnev <mk...@apache.org>
> wrote:
> >>
> >> > Hello, Vasily.
> >> > Why not? What have you got in debugQuery=true?
> >> >
> >> > On Mon, Nov 11, 2019 at 1:19 PM Vasily Ogar <og...@gmail.com>
> >> wrote:
> >> >
> >> > > Hello,
> >> > > Is it possible to sort by score in join by geodist()? For instance,
> >> > > something like this
> >> > > q={!join from=site_id to=site_id fromIndex=stores score=max}
> >> > > +{!func}gedist() +{!geofilt sfield=coordinates
> >> > > pt=54.69738679999999,25.224815300000046 d=10}
> >> > > sort=score desc
> >> > > Thank you
> >> > >
> >> >
> >> >
> >> > --
> >> > Sincerely yours
> >> > Mikhail Khludnev
> >> >
> >>
> >
> >
> > --
> > Sincerely yours
> > Mikhail Khludnev
> >
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>

Re: sort by score in join with geodist()

Posted by Mikhail Khludnev <mk...@apache.org>.
Hello,
It seems like I breached the limit on unconscious replies in mailing list
  I'd rather start with this:
q={!join from=site_id to=site_id fromIndex=stores
score=max}+{!geofilt}
{!func}geodist()&sfield=coordinates&pt=54.69738679999999,25.224815300000046&d=10


On Mon, Nov 11, 2019 at 11:11 PM Mikhail Khludnev <mk...@apache.org> wrote:

> Is it something like  https://issues.apache.org/jira/browse/SOLR-10673 ?
>
> On Mon, Nov 11, 2019 at 3:47 PM Vasily Ogar <og...@gmail.com> wrote:
>
>> it's show nothing because I got an error
>> "metadata":[ "error-class","org.apache.solr.common.SolrException",
>> "root-error-class","org.apache.solr.search.SyntaxError"],
>> "msg":"org.apache.solr.search.SyntaxError:
>> geodist - not enough parameters:[]",
>>
>> If I set parameters then I got another error
>> "metadata":[ "error-class","org.apache.solr.common.SolrException",
>> "root-error-class","org.apache.solr.common.SolrException"], "msg":"A
>> ValueSource isn't directly available from this field. Instead try a query
>> using the distance as the score.",
>>
>> On Mon, Nov 11, 2019 at 1:36 PM Mikhail Khludnev <mk...@apache.org> wrote:
>>
>> > Hello, Vasily.
>> > Why not? What have you got in debugQuery=true?
>> >
>> > On Mon, Nov 11, 2019 at 1:19 PM Vasily Ogar <og...@gmail.com>
>> wrote:
>> >
>> > > Hello,
>> > > Is it possible to sort by score in join by geodist()? For instance,
>> > > something like this
>> > > q={!join from=site_id to=site_id fromIndex=stores score=max}
>> > > +{!func}gedist() +{!geofilt sfield=coordinates
>> > > pt=54.69738679999999,25.224815300000046 d=10}
>> > > sort=score desc
>> > > Thank you
>> > >
>> >
>> >
>> > --
>> > Sincerely yours
>> > Mikhail Khludnev
>> >
>>
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>


-- 
Sincerely yours
Mikhail Khludnev

Re: sort by score in join with geodist()

Posted by Mikhail Khludnev <mk...@apache.org>.
Is it something like  https://issues.apache.org/jira/browse/SOLR-10673 ?

On Mon, Nov 11, 2019 at 3:47 PM Vasily Ogar <og...@gmail.com> wrote:

> it's show nothing because I got an error
> "metadata":[ "error-class","org.apache.solr.common.SolrException",
> "root-error-class","org.apache.solr.search.SyntaxError"],
> "msg":"org.apache.solr.search.SyntaxError:
> geodist - not enough parameters:[]",
>
> If I set parameters then I got another error
> "metadata":[ "error-class","org.apache.solr.common.SolrException",
> "root-error-class","org.apache.solr.common.SolrException"], "msg":"A
> ValueSource isn't directly available from this field. Instead try a query
> using the distance as the score.",
>
> On Mon, Nov 11, 2019 at 1:36 PM Mikhail Khludnev <mk...@apache.org> wrote:
>
> > Hello, Vasily.
> > Why not? What have you got in debugQuery=true?
> >
> > On Mon, Nov 11, 2019 at 1:19 PM Vasily Ogar <og...@gmail.com>
> wrote:
> >
> > > Hello,
> > > Is it possible to sort by score in join by geodist()? For instance,
> > > something like this
> > > q={!join from=site_id to=site_id fromIndex=stores score=max}
> > > +{!func}gedist() +{!geofilt sfield=coordinates
> > > pt=54.69738679999999,25.224815300000046 d=10}
> > > sort=score desc
> > > Thank you
> > >
> >
> >
> > --
> > Sincerely yours
> > Mikhail Khludnev
> >
>


-- 
Sincerely yours
Mikhail Khludnev

Re: sort by score in join with geodist()

Posted by Vasily Ogar <og...@gmail.com>.
it's show nothing because I got an error
"metadata":[ "error-class","org.apache.solr.common.SolrException",
"root-error-class","org.apache.solr.search.SyntaxError"],
"msg":"org.apache.solr.search.SyntaxError:
geodist - not enough parameters:[]",

If I set parameters then I got another error
"metadata":[ "error-class","org.apache.solr.common.SolrException",
"root-error-class","org.apache.solr.common.SolrException"], "msg":"A
ValueSource isn't directly available from this field. Instead try a query
using the distance as the score.",

On Mon, Nov 11, 2019 at 1:36 PM Mikhail Khludnev <mk...@apache.org> wrote:

> Hello, Vasily.
> Why not? What have you got in debugQuery=true?
>
> On Mon, Nov 11, 2019 at 1:19 PM Vasily Ogar <og...@gmail.com> wrote:
>
> > Hello,
> > Is it possible to sort by score in join by geodist()? For instance,
> > something like this
> > q={!join from=site_id to=site_id fromIndex=stores score=max}
> > +{!func}gedist() +{!geofilt sfield=coordinates
> > pt=54.69738679999999,25.224815300000046 d=10}
> > sort=score desc
> > Thank you
> >
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>

Re: sort by score in join with geodist()

Posted by Mikhail Khludnev <mk...@apache.org>.
Hello, Vasily.
Why not? What have you got in debugQuery=true?

On Mon, Nov 11, 2019 at 1:19 PM Vasily Ogar <og...@gmail.com> wrote:

> Hello,
> Is it possible to sort by score in join by geodist()? For instance,
> something like this
> q={!join from=site_id to=site_id fromIndex=stores score=max}
> +{!func}gedist() +{!geofilt sfield=coordinates
> pt=54.69738679999999,25.224815300000046 d=10}
> sort=score desc
> Thank you
>


-- 
Sincerely yours
Mikhail Khludnev