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 Mamta Thakur <mt...@care.com> on 2013/09/17 15:01:07 UTC

Re: How to round solr score ?

Hi ,

As per this post here http://grokbase.com/t/lucene/solr-user/131jzcg3q2/how-to-round-solr-score.
I was able to use my custom fn in sort(defType=func&q=socialDegree(id,1)&fl=score,*&sort=score%20asc) - works,
but can't facet on the same(defType=func&q=socialDegree(id,1)&fl=score,*&facet=true&facet.field=score) - doesn't work.

Exception:
org.apache.solr.common.SolrException: undefined field: "score"
at org.apache.solr.schema.IndexSchema.getField(IndexSchema.java:965)
at org.apache.solr.request.SimpleFacets.getTermCounts(SimpleFacets.java:294)
at org.apache.solr.request.SimpleFacets.getFacetFieldCounts(SimpleFacets.java:423)
at org.apache.solr.request.SimpleFacets.getFacetCounts(SimpleFacets.java:205)
at org.apache.solr.handler.component.FacetComponent.process(FacetComponent.java:78)
at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:208)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1816)
at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:448)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:269)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)

Is there any way by which we can achieve this?

Thanks,
Mamta.




This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.

Re: How to round solr score ?

Posted by Chris Hostetter <ho...@fucit.org>.
: 'score' is a pseudo-field, i.e., it does not actually exist in
: the index, which is probably why it cannot be faceted on.
: Faceting on a rounded score seems like an unusual use
: case. What requirement are you trying to address?

agreed, more details would be helpful.

FWIW: the only way available to facet on functions is to use facet.query 
along with the {!frange} paser to create facet constraints based on ranges 
of function values that you specify.

there is no othe way i can think of to facet over function values -- there 
is an open issue where people were discussing it, but i don't think there 
wa ever a functional patch...

https://issues.apache.org/jira/browse/SOLR-1581






-Hoss

Re: How to round solr score ?

Posted by Gora Mohanty <go...@mimirtech.com>.
On 17 September 2013 18:31, Mamta Thakur <mt...@care.com> wrote:

> Hi ,
>
> As per this post here
> http://grokbase.com/t/lucene/solr-user/131jzcg3q2/how-to-round-solr-score.
> I was able to use my custom fn in
> sort(defType=func&q=socialDegree(id,1)&fl=score,*&sort=score%20asc) - works,
> but can't facet on the
> same(defType=func&q=socialDegree(id,1)&fl=score,*&facet=true&facet.field=score)
> - doesn't work.
>

'score' is a pseudo-field, i.e., it does not actually exist in
the index, which is probably why it cannot be faceted on.
Faceting on a rounded score seems like an unusual use
case. What requirement are you trying to address?

Regards,
Gora