Hi Shawn,
Thanks for the response.
In the problem example in the below email I had used a hypothetical example for
my query.
Actually, we are trying to search for the name and specialty combination(for
ex:- paul orthodontist) of the dentist sorted by the highest score and distance
(in case of same dentists matching the free text criteria).
Below are the Solr logs.
2018-01-05 00:13:05.835 INFO (qtp1348949648-14) [ x:provider_collection]
o.a.s.c.S.Request [provider_collection] webapp=/solr path=/select
params={q=distance:{!geofilt+sfield%3Dlocation+pt%3D37.564143,-122.004179+d%3D60.0}&fl=*,distance:mul(geodist(location,37.5641425,-122.004179),0.621371)&start=0&fq=facilityName:"orthodontist"+OR+facilityName:*orthodontist*+OR+facilityName:"paul"+OR+facilityName:*paul*+OR+facilityName:*paul+orthodontist*+OR+facilityName:"paul+orthodontist"+OR+firstName:"orthodontist"+OR+firstName:*orthodontist*+OR+firstName:"paul"+OR+firstName:*paul*+OR+firstName:*paul+orthodontist*+OR+firstName:"paul+orthodontist"+OR+fullName:"orthodontist"+OR+fullName:*orthodontist*+OR+fullName:"paul"+OR+fullName:*paul*+OR+fullName:*paul+orthodontist*+OR+fullName:"paul+orthodontist"+OR+groupPracticeNpi:"orthodontist"+OR+groupPracticeNpi:*orthodontist*+OR+groupPracticeNpi:"paul"+OR+groupPracticeNpi:*paul*+OR+groupPracticeNpi:*paul+orthodontist*+OR+groupPracticeNpi:"paul+orthodontist"+OR+keywords:"orthodontist"+OR+keywords:*orthodontist*+OR+keywords:"paul"+OR+keywords:*paul*+OR+keywords:*paul+orthodontist*+OR+keywords:"paul+orthodontist"+OR+lastName:"orthodontist"+OR+lastName:*orthodontist*+OR+lastName:"paul"+OR+lastName:*paul*+OR+lastName:*paul+orthodontist*+OR+lastName:"paul+orthodontist"+OR+licenseNumber:"orthodontist"+OR+licenseNumber:*orthodontist*+OR+licenseNumber:"paul"+OR+licenseNumber:*paul*+OR+licenseNumber:*paul+orthodontist*+OR+licenseNumber:"paul+orthodontist"+OR+npi:"orthodontist"+OR+npi:*orthodontist*+OR+npi:"paul"+OR+npi:*paul*+OR+npi:*paul+orthodontist*+OR+npi:"paul+orthodontist"+OR+officeName:"orthodontist"+OR+officeName:*orthodontist*+OR+officeName:"paul"+OR+officeName:*paul*+OR+officeName:*paul+orthodontist*+OR+officeName:"paul+orthodontist"+OR+practiceLocationLanguages:"orthodontist"+OR+practiceLocationLanguages:*orthodontist*+OR+practiceLocationLanguages:"paul"+OR+practiceLocationLanguages:*paul*+OR+practiceLocationLanguages:*paul+orthodontist*+OR+practiceLocationLanguages:"paul+orthodontist"+OR+practiceLocationNpi:"orthodontist"+OR+practiceLocationNpi:*orthodontist*+OR+practiceLocationNpi:"paul"+OR+practiceLocationNpi:*paul*+OR+practiceLocationNpi:*paul+orthodontist*+OR+practiceLocationNpi:"paul+orthodontist"+OR+providerLanguages:"orthodontist"+OR+providerLanguages:*orthodontist*+OR+providerLanguages:"paul"+OR+providerLanguages:*paul*+OR+providerLanguages:*paul+orthodontist*+OR+providerLanguages:"paul+orthodontist"+OR+specialty:"orthodontist"+OR+specialty:*orthodontist*+OR+specialty:"paul"+OR+specialty:*paul*+OR+specialty:*paul+orthodontist*+OR+specialty:"paul+orthodontist"&sort=geodist(location,37.564143,-122.004179)+asc,score+desc&rows=10&wt=javabin&version=2}
hits=577 status=0 QTime=284
2018-01-05 00:13:06.886 INFO (qtp1348949648-17) [ x:provider_collection]
o.a.s.c.S.Request [provider_collection] webapp=/solr path=/admin/ping
params={wt=javabin&version=2} hits=304592 status=0 QTime=0
2018-01-05 00:13:06.886 INFO (qtp1348949648-17) [ x:provider_collection]
o.a.s.c.S.Request [provider_collection] webapp=/solr path=/admin/ping
params={wt=javabin&version=2} status=0 QTime=0
2018-01-05 00:13:06.888 INFO (qtp1348949648-16) [ x:provider_collection]
o.a.s.c.S.Request [provider_collection] webapp=/solr path=/admin/ping
params={wt=javabin&version=2} hits=304592 status=0 QTime=0
2018-01-05 00:13:06.888 INFO (qtp1348949648-16) [ x:provider_collection]
o.a.s.c.S.Request [provider_collection] webapp=/solr path=/admin/ping
params={wt=javabin&version=2} status=0 QTime=0
2018-01-05 00:13:06.891 INFO (qtp1348949648-19) [ x:yelp_collection]
o.a.s.c.S.Request [yelp_collection] webapp=/solr path=/admin/ping
params={wt=javabin&version=2} hits=13 status=0 QTime=0
2018-01-05 00:13:06.891 INFO (qtp1348949648-19) [ x:yelp_collection]
o.a.s.c.S.Request [yelp_collection] webapp=/solr path=/admin/ping
params={wt=javabin&version=2} status=0 QTime=0
Request you to go through the above logs and provide us the recommendation to
go forward.
Regards,
Deepak
-----Original Message-----
From: Shawn Heisey [mailto:[email protected]]
Sent: Thursday, January 04, 2018 5:17 AM
To: [email protected]
Subject: Re: problem with Solr Sorting by score and distance together
On 1/3/2018 6:16 PM, Deepak Udapudi wrote:
> Assume that, I am searching for car care centers. Solr collection has the
> data for all the major car care centers. As an example I search for Firestone
> car care centers in a 5 miles radius. In the search results I am supposed to
> receive the firestone car care centers list within 5 miles from the specified
> location and the centers should be sorted in distance order.
>
> In the solr query handler I have specified the following.
>
> i) I have specified the query condition (q) to be based on
> distance parameter (basically search for records within a certain distance in
> miles).
>
> ii) I have specified the filter query conditions (fq)
> where fields accepting general text are matching free text input (for ex :-
> Firestone Carcare)
These should probably be the other way around -- so the q parameter contains
the user provided query and the distance is a filter. It's more in line with
the way I expect things to be done, and it would probably result in more
efficient performance of the filterCache. Also, filter queries do not affect
the score -- at all. So you're not getting any relevance information from the
query that your user is typing.
I don't know very much about spatial, but there is a lot of documentation I can
read.
> iii) I have specified the sort condition(sort ) to be based
> on score(calculated based on the filter query (fq) conditions applied in the
> 2nd item in the list) and distance. If there are duplicate records matching
> by score, then distance should be used to order the duplicate records.
Can you provide the entry from solr.log that shows the full query
request? Below is the kind of log entry I am talking about. This was
obtained by going to the admin UI query tab, typing in "example query", and
then executing that query.
2018-01-04 13:10:03.042 INFO (qtp1394336709-1102402) [ x:ncmain]
o.a.s.c.S.Request [ncmain] webapp=/solr path=/select
params={q=example+query&indent=on&wt=json&_=1515071388516} hits=2163
status=0 QTime=4473
Thanks,
Shawn
The information contained in this email message and any attachments is
confidential and intended only for the addressee(s). If you are not an
addressee, you may not copy or disclose the information, or act upon it, and
you should delete it entirely from your email system. Please notify the sender
that you received this email in error.