Sorting result first which come first in sentance
Hi all, I need suggetion: I Hi all, I need suggetion: I have many title like: 1 bomb blast in kabul 2 kabul bomb blast 3 3 people killed in serial bomb blast in kabul I want 2nd result should come first while user search by kabul. Because kabul is on 1st postion in that sentance. Similarly 1st result should come on 2nd and 3rd should come last. Please suggest me hot to implement this.. Regard Jonty
Re: Sorting result first which come first in sentance
as for version below 4.0, it's not possible because lucene's score model. position information is stored, but only used to support phrase query. it just tell us whether a document is matched, but we can boost a document. The similar problem is : how to implement proximity boost. for 2 search terms, we need return all docs that contains this 2 terms. but if they are phrase, we give it a largest boost. if there is a word between them, we give it a smaller one. if there are 2 words between them, we will give it smaller score. all this ranking algorithm need more flexible score model. I don't know whether the latest trunk take this into consideration. On Fri, May 4, 2012 at 3:43 AM, Jonty Rhods jonty.rh...@gmail.com wrote: Hi all, I need suggetion: I Hi all, I need suggetion: I have many title like: 1 bomb blast in kabul 2 kabul bomb blast 3 3 people killed in serial bomb blast in kabul I want 2nd result should come first while user search by kabul. Because kabul is on 1st postion in that sentance. Similarly 1st result should come on 2nd and 3rd should come last. Please suggest me hot to implement this.. Regard Jonty
Re: Sorting result first which come first in sentance
I am using solr version 3.4
Re: Sorting result first which come first in sentance
for this version, you may consider using payload for position boost. you can save boost values in payload. I have used it in lucene api where anchor text should weigh more than normal text. but I haven't used it in solr. some searched urls: http://wiki.apache.org/solr/Payloads http://digitalpebble.blogspot.com/2010/08/using-payloads-with-dismaxqparser-in.html On Fri, May 4, 2012 at 9:51 AM, Jonty Rhods jonty.rh...@gmail.com wrote: I am using solr version 3.4
Re: Sorting result first which come first in sentance
: 1 bomb blast in kabul : : 2 kabul bomb blast : : 3 3 people killed in serial bomb blast in kabul ... : I want 2nd result should come first while user search by kabul. : : Because kabul is on 1st postion in that sentance. Similarly 1st result : should come on 2nd and 3rd should come last. One way to implement this would be with a SpanFirstQuery but I don't beleive there are any QParsers in Solr (out of hte box) that produce SpanFirstQueries, so you'd have to customize. An alternative appraoch that people have been doing since long before Span Queries have existed, is to index a special marker token (that won't ever appera in your text) at the begining of your field values, and then search for a slopy phrase containing your marker token and the word your user is looking for -- because sloppy phrase queries inherently score documents higher the closer the terms are to eachother So if you choose $^$^$ as your marker token, your three sentences would become... 1: $^$^$ bomb blast in kabul 2: $^$^$ kabul bomb blast 3: $^$^$ 3 people killed in serial bomb blast in kabul And your query would be something like $^$^$ kabul~1000 -Hoss
Re: Sorting result first which come first in sentance
A Lucene SpanFirstQuery (with a boost) would do it, but you'd have to find a query parse that supports it and most don't. You could also keep a copy of the title as a string field and then use a trailing wildcard to check if the title began with a term and boost it. title_s:Kabul*^2.0 -- Jack Krupansky -Original Message- From: Jonty Rhods Sent: Thursday, May 03, 2012 3:43 PM To: solr-user@lucene apache org Subject: Sorting result first which come first in sentance Hi all, I need suggetion: I Hi all, I need suggetion: I have many title like: 1 bomb blast in kabul 2 kabul bomb blast 3 3 people killed in serial bomb blast in kabul I want 2nd result should come first while user search by kabul. Because kabul is on 1st postion in that sentance. Similarly 1st result should come on 2nd and 3rd should come last. Please suggest me hot to implement this.. Regard Jonty