Re: How to round solr score ?
Thanks for your replies. I am actually doing the frange approach for now. The only downside I see there is it makes the function call twice, calling createWeight() twice. And so my social connections are evaluated twice which is quite heavy operation. So I was thinking if I could get away with one additional call. 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 ?
On 17 September 2013 18:31, Mamta Thakur 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
Re: How to round solr score ?
: '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 ?
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 ?
On 18 January 2013 19:18, Gustav wrote: > Hey Gora, thanks for the fast answer! > > I Had tried the rint(score) function before(it would be perfect in my case) > but it didnt work out, i guess it only works with indexed fields, so i got > the "sort param could not be parsed as a query, and is not a field that > exists in the index: rint(score)" error, > > And with the query() function i didnt got any successful result... > > Im stuck in the same cenario as squaro. > > if two docs have score of 1.67989 and 1.6767, I would like to sort them by > price. > > My &sort rules ae something like: > &sort=score desc, price asc You have to use rint() in combination with query() If I understand your requirements correctly, something along the lines below should work: http://localhost:8983/solr/select/?defType=func&q=rint(query({!v="text:term"}))&fl=score,*&sort=score desc,price asc should work, where one is searching for "term" in the field "text". The score is displayed in the returned fields to demonstrate that it has been rounded off. Regards, Gora
Re: How to round solr score ?
Hey Gora, thanks for the fast answer! I Had tried the rint(score) function before(it would be perfect in my case) but it didnt work out, i guess it only works with indexed fields, so i got the "sort param could not be parsed as a query, and is not a field that exists in the index: rint(score)" error, And with the query() function i didnt got any successful result... Im stuck in the same cenario as squaro. if two docs have score of 1.67989 and 1.6767, I would like to sort them by price. My &sort rules ae something like: &sort=score desc, price asc -- View this message in context: http://lucene.472066.n3.nabble.com/How-to-round-solr-score-tp495198p4034551.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: How to round solr score ?
On 18 January 2013 18:26, Gustav wrote: > I have to bump this... is it possible to do it (round solr's score) with any > integrated query function?? Do not have a Solr index handy at the moment to check, but it should be possible to do this with function queries. Please see the rint() and query() function at http://wiki.apache.org/solr/FunctionQuery Regards, Gora
Re: How to round solr score ?
On Mon, Mar 30, 2009 at 11:10 PM, Shalin Shekhar Mangar < shalinman...@gmail.com> wrote: > On Mon, Mar 30, 2009 at 11:06 PM, Walter Underwood > wrote: > >> I think what you want to do is add in a function query that gives >> values in that range. >> > > The scale function won't work in this use-case because it will give you a > double in the given range. So you cannot do sort by score and price. For > this use-case you need to scale to an integer value in a discrete range. > Walter -- I think I misinterpreted your response. Sorry about that. You are indeed right. However, we can do scale(round(score, 2), 1, 10) or we can create a new scale function as you said. -- Regards, Shalin Shekhar Mangar.
Re: How to round solr score ?
On Mon, Mar 30, 2009 at 11:07 PM, Shalin Shekhar Mangar < shalinman...@gmail.com> wrote: > > Yonik added a way to use the score of a query in function queries with > SOLR-939. Look at the "query" function on the wiki. Some very cool things > are possible now :) > Sorry, that should have been SOLR-1046 -- Regards, Shalin Shekhar Mangar.
Re: How to round solr score ?
On Mon, Mar 30, 2009 at 11:06 PM, Walter Underwood wrote: > I think what you want to do is add in a function query that gives > values in that range. > The scale function won't work in this use-case because it will give you a double in the given range. So you cannot do sort by score and price. For this use-case you need to scale to an integer value in a discrete range. -- Regards, Shalin Shekhar Mangar.
Re: How to round solr score ?
On Mon, Mar 30, 2009 at 10:54 PM, Grant Ingersoll wrote: > > I don't there there is an existing way to round them. But it will be a >> useful contribution if you can write a function query for rounding. >> >> Look at http://wiki.apache.org/solr/FunctionQuery >> > > What did you have in mind, Shalin?It seems to me you would have to hook > into the HitCollector and/or implement your own sorting capability, as the > Func Query is just going to allow you to take price in as a scoring factor, > no? > Yonik added a way to use the score of a query in function queries with SOLR-939. Look at the "query" function on the wiki. Some very cool things are possible now :) -- Regards, Shalin Shekhar Mangar.
Re: How to round solr score ?
I think what you want to do is add in a function query that gives values in that range. There is no need to round the scores. That doesn't do anything but throw away information. wunder On 3/30/09 10:07 AM, "Shalin Shekhar Mangar" wrote: > On Mon, Mar 30, 2009 at 10:04 PM, squaro wrote: > >> >> Hello, >> >> I would like to cut solr score to 3 or 4 digits . >> Indeed I would like to be able to sort by score, then by another critria ( >> price for example). >> So if two docs have score of 1.67989 and 1.6767, I would like to sort them >> by price. >> >> Do you have any idea how I could do that ? > > > I don't there there is an existing way to round them. But it will be a > useful contribution if you can write a function query for rounding. > > Look at http://wiki.apache.org/solr/FunctionQuery
Re: How to round solr score ?
On Mar 30, 2009, at 1:07 PM, Shalin Shekhar Mangar wrote: On Mon, Mar 30, 2009 at 10:04 PM, squaro wrote: Hello, I would like to cut solr score to 3 or 4 digits . Indeed I would like to be able to sort by score, then by another critria ( price for example). So if two docs have score of 1.67989 and 1.6767, I would like to sort them by price. Do you have any idea how I could do that ? I don't there there is an existing way to round them. But it will be a useful contribution if you can write a function query for rounding. Look at http://wiki.apache.org/solr/FunctionQuery What did you have in mind, Shalin?It seems to me you would have to hook into the HitCollector and/or implement your own sorting capability, as the Func Query is just going to allow you to take price in as a scoring factor, no? -Grant
Re: How to round solr score ?
On Mon, Mar 30, 2009 at 10:04 PM, squaro wrote: > > Hello, > > I would like to cut solr score to 3 or 4 digits . > Indeed I would like to be able to sort by score, then by another critria ( > price for example). > So if two docs have score of 1.67989 and 1.6767, I would like to sort them > by price. > > Do you have any idea how I could do that ? I don't there there is an existing way to round them. But it will be a useful contribution if you can write a function query for rounding. Look at http://wiki.apache.org/solr/FunctionQuery -- Regards, Shalin Shekhar Mangar.
How to round solr score ?
Hello, I would like to cut solr score to 3 or 4 digits . Indeed I would like to be able to sort by score, then by another critria ( price for example). So if two docs have score of 1.67989 and 1.6767, I would like to sort them by price. Do you have any idea how I could do that ? -- View this message in context: http://www.nabble.com/How-to-round-solr-score---tp22787254p22787254.html Sent from the Solr - User mailing list archive at Nabble.com.