Re: Negative boost query (bq) with edismax for lower scores with Solr 8
I didn't see any response so I wanted to check if my observation simply is not relevant for other people or if I missed to provide any required details. Thanks! -Original Message- Date: 05/09/2019 08:28 AM Subject: Negative boost query (bq) with edismax for lower scores with Solr 8 I find that the edismax boost query implementation is not quite logical. It does not allow selectively decreasing the relevancy score anymore. E.g. bq=color:red^2 can be added to increase the score of matching documents. But how can I decrease the score for documents with color:red? Before Solr 8 it could be done with bq=color:red^-1. But negative boosts are not supported by Lucene anymore (LUCENE-7996). Note that bq=color:red^0.1 does not lead to a lower score since other values will be treated like boost 0. If all potential values are known this would work: bq=color:red^0.1 color:green^1 color:blue^1. But what if not? I tried bq=color:*^1 -color:red^0.1. This sort of works but the boost seems to be ignored. When I write bq=color:*^1 -color:red^0.1 -color:green^0.5 the score is the same for documents with color:red and color:green. Any suggestion how I can decrease the score for documents with color:red a bit and a bit more for those with color:green after upgrading to Solr 8?
Negative boost query (bq) with edismax for lower scores with Solr 8
I find that the edismax boost query implementation is not quite logical. It does not allow selectively decreasing the relevancy score anymore. E.g. bq=color:red^2 can be added to increase the score of matching documents. But how can I decrease the score for documents with color:red? Before Solr 8 it could be done with bq=color:red^-1. But negative boosts are not supported by Lucene anymore (LUCENE-7996). Note that bq=color:red^0.1 does not lead to a lower score since other values will be treated like boost 0. If all potential values are known this would work: bq=color:red^0.1 color:green^1 color:blue^1. But what if not? I tried bq=color:*^1 -color:red^0.1. This sort of works but the boost seems to be ignored. When I write bq=color:*^1 -color:red^0.1 -color:green^0.5 the score is the same for documents with color:red and color:green. Any suggestion how I can decrease the score for documents with color:red a bit and a bit more for those with color:green after upgrading to Solr 8?
Using bq param for negative boost
Hi, I’m trying to boost all results using the bq param with edismax where termA and termB do not appear in the field, but if phraseC appears it doesn’t matter if termA and termB appear. The following works and boosts everything that doesn’t have termA and termB in myField so the effect is that all documents with termA and termB are pushed to the bottom of the result list. myField:(*:* -termA -termB)^1 How would you add the second part where if phraseC is present, then termA and termB can be present? Tried doing something like the following, but it is not working. myField:(*:* ((-termA -termB) OR +”phraseC”))^1 Thanks!
Negative boost
Hi all, I understand that the only way to simulate a negative boost is to positively boost the inverse. I have looked at http://wiki.apache.org/solr/SolrRelevancyFAQ but I think I am missing something on the formatting of my query. I am using: http://localhost:8983/solr/search?q=dogbq=(*:* -species:Sheltie)^1 In this case, I am trying to search for records about dog but to put records containing Sheltie closer to the bottom as I am not really interested in that. However, the following queries: http://localhost:8983/solr/search?q=dog http://localhost:8983/solr/search?q=dogbq=(*:* -species:Sheltie)^1 Return the exact same set of results with a record about a Sheltie as the top result each time. What am I doing incorrectly? Thanks, Brian Lamb
Re: Negative boost
I understand that the only way to simulate a negative boost is to positively boost the inverse. I have looked at http://wiki.apache.org/solr/SolrRelevancyFAQ but I think I am missing something on the formatting of my query. I am using: http://localhost:8983/solr/search?q=dogbq=(*:* -species:Sheltie)^1 In this case, I am trying to search for records about dog but to put records containing Sheltie closer to the bottom as I am not really interested in that. However, the following queries: http://localhost:8983/solr/search?q=dog http://localhost:8983/solr/search?q=dogbq=(*:* -species:Sheltie)^1 Return the exact same set of results with a record about a Sheltie as the top result each time. What am I doing incorrectly? bq parameter is specific to dismax query parser. If you want to benefit from bq, you need to use defType=dismax as well as other dismax's parameters http://wiki.apache.org/solr/DisMaxQParserPlugin
negative boost
Is it possible to give a negative in boost in dismax? For instance, field1^3 field2^0 field3^-0.1 Thanks, Jason
Re: negative boost
Jason, don't you want field1^3 • field2^1 • field3^0.9 ? As written in Lucene in action, it's all multiplied. So negative boost means boost under 1 (and probably elsewhere) paul PS: take the log and you get this negative. Le 29-mars-10 à 21:08, Jason Chaffee a écrit : Is it possible to give a negative in boost in dismax? For instance, field1^3 field2^0 field3^-0.1 Thanks, Jason
RE: negative boost
Unfortunately, my results aren't quite what I want unless I use 0 on the second field. Instead, if something matches in all the fields it is elevated to the top. I only want the first field match elevated to the top and I want all first field matches to have the same weight. Next, I want all field2 matches to have the same weight, and finally, I want all field3 matches to have the same weight. But I want field1 matches to be at the top, then field 2, and finally field3. I don't care if the term is all three fields or not. Does this make sense? -Original Message- From: Paul Libbrecht [mailto:p...@activemath.org] Sent: Monday, March 29, 2010 1:10 PM To: solr-user@lucene.apache.org Subject: Re: negative boost Jason, don't you want field1^3 * field2^1 * field3^0.9 ? As written in Lucene in action, it's all multiplied. So negative boost means boost under 1 (and probably elsewhere) paul PS: take the log and you get this negative. Le 29-mars-10 à 21:08, Jason Chaffee a écrit : Is it possible to give a negative in boost in dismax? For instance, field1^3 field2^0 field3^-0.1 Thanks, Jason
RE: negative boost
: Unfortunately, my results aren't quite what I want unless I use 0 on the : second field. Instead, if something matches in all the fields it is : elevated to the top. I only want the first field match elevated to the : top and I want all first field matches to have the same weight. Next, I : want all field2 matches to have the same weight, and finally, I want all : field3 matches to have the same weight. But I want field1 matches to be : at the top, then field 2, and finally field3. I don't care if the term : is all three fields or not. try qf=field1^1+field2^100+field3^1tie=0 : Does this make sense? it does, but it kind of defeats the point of dismax. what i cited should help -- the key is to make the boosts vastly differnet scales, and eliminate the tiebreaker value. -Hoss
RE: negative boost
I understand that it defeats the reason for dismax, at least the original reason for dismax. However, if I can do it this way without having to write my own handler because I need to search multiple fields and combine the results, then it is still preferable and thus another way to leverage dismax. Thanks for the tip. I will try it. Jason -Original Message- From: Chris Hostetter [mailto:hossman_luc...@fucit.org] Sent: Monday, March 29, 2010 5:06 PM To: solr-user@lucene.apache.org Subject: RE: negative boost : Unfortunately, my results aren't quite what I want unless I use 0 on the : second field. Instead, if something matches in all the fields it is : elevated to the top. I only want the first field match elevated to the : top and I want all first field matches to have the same weight. Next, I : want all field2 matches to have the same weight, and finally, I want all : field3 matches to have the same weight. But I want field1 matches to be : at the top, then field 2, and finally field3. I don't care if the term : is all three fields or not. try qf=field1^1+field2^100+field3^1tie=0 : Does this make sense? it does, but it kind of defeats the point of dismax. what i cited should help -- the key is to make the boosts vastly differnet scales, and eliminate the tiebreaker value. -Hoss
RE: negative boost
I think the key was change the tie to 0. I had it at 0.1. Getting exactly what I want now. Big thanks for the help. -Original Message- From: Jason Chaffee [mailto:jchaf...@ebates.com] Sent: Monday, March 29, 2010 5:20 PM To: solr-user@lucene.apache.org Subject: RE: negative boost I understand that it defeats the reason for dismax, at least the original reason for dismax. However, if I can do it this way without having to write my own handler because I need to search multiple fields and combine the results, then it is still preferable and thus another way to leverage dismax. Thanks for the tip. I will try it. Jason -Original Message- From: Chris Hostetter [mailto:hossman_luc...@fucit.org] Sent: Monday, March 29, 2010 5:06 PM To: solr-user@lucene.apache.org Subject: RE: negative boost : Unfortunately, my results aren't quite what I want unless I use 0 on the : second field. Instead, if something matches in all the fields it is : elevated to the top. I only want the first field match elevated to the : top and I want all first field matches to have the same weight. Next, I : want all field2 matches to have the same weight, and finally, I want all : field3 matches to have the same weight. But I want field1 matches to be : at the top, then field 2, and finally field3. I don't care if the term : is all three fields or not. try qf=field1^1+field2^100+field3^1tie=0 : Does this make sense? it does, but it kind of defeats the point of dismax. what i cited should help -- the key is to make the boosts vastly differnet scales, and eliminate the tiebreaker value. -Hoss
Re: weird behabiour when setting negative boost with bq using dismax
Generally speaking, by convention boosts in Lucene have unity at 1.0, not 0.0. So, a negative boost is usually done with boosts between 0 and 1. For this case, maybe a boost of 0.1 is what you want? I forgot to say I tried what you say aswell but didn't work. In the standard query parser, this means remove all entries in which field_a = 54. bq=-field_a:54^1 In DisMaxQueryParser bq is a boosting function. It should affect the boost of the results but not the number of it. I think what you mean is: fq=-field_a:54 Still stuck whit this... Lance Norskog-2 wrote: In the standard query parser, this means remove all entries in which field_a = 54. bq=-field_a:54^1 Generally speaking, by convention boosts in Lucene have unity at 1.0, not 0.0. So, a negative boost is usually done with boosts between 0 and 1. For this case, maybe a boost of 0.1 is what you want? On Mon, Feb 1, 2010 at 8:04 AM, Marc Sturlese marc.sturl...@gmail.com wrote: I already asked about this long ago but the answer doesn't seem to work... I am trying to set a negative query boost to send the results that match field_a: 54 to a lower position. I have tried it in 2 different ways: bq=(*:* -field_a:54^1) bq=-field_a:54^1 None of them seem to work. What seems to happen is that results that match field_a:54 are excluded. Just like doing: fq=-field_a:54 Any idea what could be happening? Has anyone experienced this behaviour before? Thnaks in advance -- View this message in context: http://old.nabble.com/weird-behabiour-when-setting-negative-boost-with-bq-using-dismax-tp27406614p27406614.html Sent from the Solr - User mailing list archive at Nabble.com. -- Lance Norskog goks...@gmail.com -- View this message in context: http://old.nabble.com/weird-behaviour-when-setting-negative-boost-with-bq-using-dismax-tp27406614p27449405.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: weird behabiour when setting negative boost with bq using dismax
: bq=(*:* -field_a:54^1) I think what you want there is bq=(*:* -field_a:54)^1 ...you are boosting things that don't match field_a:54 Thanks Hoss. I've updated the Wiki, the content of the bq param was wrong: http://wiki.apache.org/solr/SolrRelevancyFAQ#How_do_I_give_a_very_low_boost_to_documents_that_match_my_query hossman wrote: : bq=(*:* -field_a:54^1) I think what you want there is bq=(*:* -field_a:54)^1 ...you are boosting things that don't match field_a:54 adding a boost value ^1 to a negated clause doesn't do much (except maybe make hte queryNorm really wacky) -Hoss -- View this message in context: http://old.nabble.com/weird-behaviour-when-setting-negative-boost-with-bq-using-dismax-tp27406614p27461856.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: weird behabiour when setting negative boost with bq using dismax
In the standard query parser, this means remove all entries in which field_a = 54. bq=-field_a:54^1 Generally speaking, by convention boosts in Lucene have unity at 1.0, not 0.0. So, a negative boost is usually done with boosts between 0 and 1. For this case, maybe a boost of 0.1 is what you want? On Mon, Feb 1, 2010 at 8:04 AM, Marc Sturlese marc.sturl...@gmail.com wrote: I already asked about this long ago but the answer doesn't seem to work... I am trying to set a negative query boost to send the results that match field_a: 54 to a lower position. I have tried it in 2 different ways: bq=(*:* -field_a:54^1) bq=-field_a:54^1 None of them seem to work. What seems to happen is that results that match field_a:54 are excluded. Just like doing: fq=-field_a:54 Any idea what could be happening? Has anyone experienced this behaviour before? Thnaks in advance -- View this message in context: http://old.nabble.com/weird-behabiour-when-setting-negative-boost-with-bq-using-dismax-tp27406614p27406614.html Sent from the Solr - User mailing list archive at Nabble.com. -- Lance Norskog goks...@gmail.com
weird behabiour when setting negative boost with bq using dismax
I already asked about this long ago but the answer doesn't seem to work... I am trying to set a negative query boost to send the results that match field_a: 54 to a lower position. I have tried it in 2 different ways: bq=(*:* -field_a:54^1) bq=-field_a:54^1 None of them seem to work. What seems to happen is that results that match field_a:54 are excluded. Just like doing: fq=-field_a:54 Any idea what could be happening? Has anyone experienced this behaviour before? Thnaks in advance -- View this message in context: http://old.nabble.com/weird-behabiour-when-setting-negative-boost-with-bq-using-dismax-tp27406614p27406614.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Is negative boost possible?
Yonik Seeley wrote: On Mon, Oct 12, 2009 at 12:03 PM, Andrzej Bialecki a...@getopt.org wrote: Solr never discarded non-positive hits, and now Lucene 2.9 no longer does either. Hmm ... The code that I pasted in my previous email uses Searcher.search(Query, int), which in turn uses search(Query, Filter, int), and it doesn't return any results if only the first clause is present (the one with negative boost) even though it's a matching clause. I think this is related to the fact that in TopScoreDocCollector:48 the pqTop.score is initialized to 0, and then all results that have lower score that this are discarded. Perhaps this should be initialized to Float.MIN_VALUE? Hmmm, You're actually seeing this with Lucene 2.9? The HitQueue (subclass of PriorityQueue) is pre-populated with sentinel objects with scores of -Inf, not zero. Uhh, sorry, you are right - an early 2.9-dev version of the jar sneaked in on my classpath .. I verified now that 2.9.0 returns both positive and negative scores with the default TopScoreDocCollector. -- Best regards, Andrzej Bialecki ___. ___ ___ ___ _ _ __ [__ || __|__/|__||\/| Information Retrieval, Semantic Web ___|||__|| \| || | Embedded Unix, System Integration http://www.sigram.com Contact: info at sigram dot com
Re: Is negative boost possible?
Yonik Seeley wrote: On Sun, Oct 11, 2009 at 6:04 PM, Lance Norskog goks...@gmail.com wrote: And the other important thing to know about boost values is that the dynamic range is about 6-8 bits That's an index-time boost - an 8 bit float with 5 bits of mantissa and 3 bits of exponent. Query time boosts are normal 32 bit floats. To be more specific: index-time float encoding does not permit negative numbers (see SmallFloat), but query-time boosts can be negative, and they DO affect the score - see below. BTW, standard Collectors collect only results with positive scores, so if you want to collect results with negative scores as well then you need to use a custom Collector. --- BeanShell 2.0b4 - by Pat Niemeyer (p...@pat.net) bsh % import org.apache.lucene.search.*; bsh % import org.apache.lucene.index.*; bsh % import org.apache.lucene.store.*; bsh % import org.apache.lucene.document.*; bsh % import org.apache.lucene.analysis.*; bsh % tq = new TermQuery(new Term(a, b)); bsh % print(tq); a:b bsh % tq.setBoost(-1); bsh % print(tq); a:b^-1.0 bsh % q = new BooleanQuery(); bsh % tq1 = new TermQuery(new Term(a, c)); bsh % tq1.setBoost(10); bsh % q.add(tq1, BooleanClause.Occur.SHOULD); bsh % q.add(tq, BooleanClause.Occur.SHOULD); bsh % print(q); a:c^10.0 a:b^-1.0 bsh % dir = new RAMDirectory(); bsh % w = new IndexWriter(dir, new WhitespaceAnalyzer()); bsh % doc = new Document(); bsh % doc.add(new Field(a, b c d, Field.Store.YES, Field.Index.ANALYZED)); bsh % w.addDocument(doc); bsh % w.close(); bsh % r = IndexReader.open(dir); bsh % is = new IndexSearcher(r); bsh % td = is.search(q, 10); bsh % sd = td.scoreDocs; bsh % print(sd.length); 1 bsh % print(is.explain(q, 0)); 0.1373985 = (MATCH) sum of: 0.15266499 = (MATCH) weight(a:c^10.0 in 0), product of: 0.99503726 = queryWeight(a:c^10.0), product of: 10.0 = boost 0.30685282 = idf(docFreq=1, numDocs=1) 0.32427183 = queryNorm 0.15342641 = (MATCH) fieldWeight(a:c in 0), product of: 1.0 = tf(termFreq(a:c)=1) 0.30685282 = idf(docFreq=1, numDocs=1) 0.5 = fieldNorm(field=a, doc=0) -0.0152664995 = (MATCH) weight(a:b^-1.0 in 0), product of: -0.099503726 = queryWeight(a:b^-1.0), product of: -1.0 = boost 0.30685282 = idf(docFreq=1, numDocs=1) 0.32427183 = queryNorm 0.15342641 = (MATCH) fieldWeight(a:b in 0), product of: 1.0 = tf(termFreq(a:b)=1) 0.30685282 = idf(docFreq=1, numDocs=1) 0.5 = fieldNorm(field=a, doc=0) bsh % -- Best regards, Andrzej Bialecki ___. ___ ___ ___ _ _ __ [__ || __|__/|__||\/| Information Retrieval, Semantic Web ___|||__|| \| || | Embedded Unix, System Integration http://www.sigram.com Contact: info at sigram dot com
Re: Is negative boost possible?
On Mon, Oct 12, 2009 at 5:58 AM, Andrzej Bialecki a...@getopt.org wrote: BTW, standard Collectors collect only results with positive scores, so if you want to collect results with negative scores as well then you need to use a custom Collector. Solr never discarded non-positive hits, and now Lucene 2.9 no longer does either. -Yonik
Re: Is negative boost possible?
Yonik Seeley wrote: On Mon, Oct 12, 2009 at 5:58 AM, Andrzej Bialecki a...@getopt.org wrote: BTW, standard Collectors collect only results with positive scores, so if you want to collect results with negative scores as well then you need to use a custom Collector. Solr never discarded non-positive hits, and now Lucene 2.9 no longer does either. Hmm ... The code that I pasted in my previous email uses Searcher.search(Query, int), which in turn uses search(Query, Filter, int), and it doesn't return any results if only the first clause is present (the one with negative boost) even though it's a matching clause. I think this is related to the fact that in TopScoreDocCollector:48 the pqTop.score is initialized to 0, and then all results that have lower score that this are discarded. Perhaps this should be initialized to Float.MIN_VALUE? -- Best regards, Andrzej Bialecki ___. ___ ___ ___ _ _ __ [__ || __|__/|__||\/| Information Retrieval, Semantic Web ___|||__|| \| || | Embedded Unix, System Integration http://www.sigram.com Contact: info at sigram dot com
Re: Is negative boost possible?
On Mon, Oct 12, 2009 at 12:03 PM, Andrzej Bialecki a...@getopt.org wrote: Solr never discarded non-positive hits, and now Lucene 2.9 no longer does either. Hmm ... The code that I pasted in my previous email uses Searcher.search(Query, int), which in turn uses search(Query, Filter, int), and it doesn't return any results if only the first clause is present (the one with negative boost) even though it's a matching clause. I think this is related to the fact that in TopScoreDocCollector:48 the pqTop.score is initialized to 0, and then all results that have lower score that this are discarded. Perhaps this should be initialized to Float.MIN_VALUE? Hmmm, You're actually seeing this with Lucene 2.9? The HitQueue (subclass of PriorityQueue) is pre-populated with sentinel objects with scores of -Inf, not zero. -Yonik http://www.lucidimagination.com
Re: Is negative boost possible?
I've been told over and over what Koji said - the convention is that 1.0 is the default center of the boost axis. And the other important thing to know about boost values is that the dynamic range is about 6-8 bits, so use a range of 2.0 4.0 12.0 instead of 100.0 200.0 1200.0. Lance On Sat, Oct 10, 2009 at 9:07 PM, ragi raghuveer.kanche...@gmail.com wrote: If you dont want to do a pure negative query and just want boost a few documents down based on a matching criteria try to use linear function (one of the functions available in boost function) with a negative m (slope). We could solve our problem this way. We wanted to do negatively boost some documents based on certain keywords while Marc Sturlese wrote: :the only way to negative boost is to positively boost the inverse... : : (*:* -field1:value_to_penalize)^10 This will do the job aswell as bq supports pure negative queries (at least in trunk): bq=-field1:value_to_penalize^10 http://wiki.apache.org/solr/SolrRelevancyFAQ#head-76e53db8c5fd31133dc3566318d1aad2bb23e07e hossman wrote: : Use decimal figure less than 1, e.g. 0.5, to express less importance. but that's stil la positive boost ... it still increases the scores of documents that match. the only way to negative boost is to positively boost the inverse... (*:* -field1:value_to_penalize)^10 : I am looking for a way to assign negative boost to a term in Solr query. : Our use scenario is that we want to boost matching documents that are : updated recently and penalize those that have not been updated for a long : time. There are other terms in the query that would affect the scores as : well. For example we construct a query similar to this: : : *:* field1:value1^2 field2:value2^2 lastUpdateTime:[NOW/DAY-90DAYS TO *]^5 : lastUpdateTime:[* TO NOW/DAY-365DAYS]^-3 : : I notice it's not possible to simply use a negative boosting factor in the : query. Is there any way to achieve such result? : : Regards, : Shi Quan He : : -Hoss -- View this message in context: http://www.nabble.com/Is-negative-boost-possible--tp25025775p25840621.html Sent from the Solr - User mailing list archive at Nabble.com. -- Lance Norskog goks...@gmail.com
Re: Is negative boost possible?
On Sun, Oct 11, 2009 at 6:04 PM, Lance Norskog goks...@gmail.com wrote: And the other important thing to know about boost values is that the dynamic range is about 6-8 bits That's an index-time boost - an 8 bit float with 5 bits of mantissa and 3 bits of exponent. Query time boosts are normal 32 bit floats. -Yonik http://www.lucidimagination.com
Re: Is negative boost possible?
If you dont want to do a pure negative query and just want boost a few documents down based on a matching criteria try to use linear function (one of the functions available in boost function) with a negative m (slope). We could solve our problem this way. We wanted to do negatively boost some documents based on certain keywords while Marc Sturlese wrote: :the only way to negative boost is to positively boost the inverse... : :(*:* -field1:value_to_penalize)^10 This will do the job aswell as bq supports pure negative queries (at least in trunk): bq=-field1:value_to_penalize^10 http://wiki.apache.org/solr/SolrRelevancyFAQ#head-76e53db8c5fd31133dc3566318d1aad2bb23e07e hossman wrote: : Use decimal figure less than 1, e.g. 0.5, to express less importance. but that's stil la positive boost ... it still increases the scores of documents that match. the only way to negative boost is to positively boost the inverse... (*:* -field1:value_to_penalize)^10 : I am looking for a way to assign negative boost to a term in Solr query. : Our use scenario is that we want to boost matching documents that are : updated recently and penalize those that have not been updated for a long : time. There are other terms in the query that would affect the scores as : well. For example we construct a query similar to this: : : *:* field1:value1^2 field2:value2^2 lastUpdateTime:[NOW/DAY-90DAYS TO *]^5 : lastUpdateTime:[* TO NOW/DAY-365DAYS]^-3 : : I notice it's not possible to simply use a negative boosting factor in the : query. Is there any way to achieve such result? : : Regards, : Shi Quan He : : -Hoss -- View this message in context: http://www.nabble.com/Is-negative-boost-possible--tp25025775p25840621.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Is negative boost possible?
:the only way to negative boost is to positively boost the inverse... : : (*:* -field1:value_to_penalize)^10 This will do the job aswell as bq supports pure negative queries (at least in trunk): bq=-field1:value_to_penalize^10 http://wiki.apache.org/solr/SolrRelevancyFAQ#head-76e53db8c5fd31133dc3566318d1aad2bb23e07e hossman wrote: : Use decimal figure less than 1, e.g. 0.5, to express less importance. but that's stil la positive boost ... it still increases the scores of documents that match. the only way to negative boost is to positively boost the inverse... (*:* -field1:value_to_penalize)^10 : I am looking for a way to assign negative boost to a term in Solr query. : Our use scenario is that we want to boost matching documents that are : updated recently and penalize those that have not been updated for a long : time. There are other terms in the query that would affect the scores as : well. For example we construct a query similar to this: : : *:* field1:value1^2 field2:value2^2 lastUpdateTime:[NOW/DAY-90DAYS TO *]^5 : lastUpdateTime:[* TO NOW/DAY-365DAYS]^-3 : : I notice it's not possible to simply use a negative boosting factor in the : query. Is there any way to achieve such result? : : Regards, : Shi Quan He : : -Hoss -- View this message in context: http://www.nabble.com/Is-negative-boost-possible--tp25025775p25039059.html Sent from the Solr - User mailing list archive at Nabble.com.
Is negative boost possible?
Hi all, I am looking for a way to assign negative boost to a term in Solr query. Our use scenario is that we want to boost matching documents that are updated recently and penalize those that have not been updated for a long time. There are other terms in the query that would affect the scores as well. For example we construct a query similar to this: *:* field1:value1^2 field2:value2^2 lastUpdateTime:[NOW/DAY-90DAYS TO *]^5 lastUpdateTime:[* TO NOW/DAY-365DAYS]^-3 I notice it's not possible to simply use a negative boosting factor in the query. Is there any way to achieve such result? Regards, Shi Quan He
Re: Is negative boost possible?
Hi, Use decimal figure less than 1, e.g. 0.5, to express less importance. Koji Larry He wrote: Hi all, I am looking for a way to assign negative boost to a term in Solr query. Our use scenario is that we want to boost matching documents that are updated recently and penalize those that have not been updated for a long time. There are other terms in the query that would affect the scores as well. For example we construct a query similar to this: *:* field1:value1^2 field2:value2^2 lastUpdateTime:[NOW/DAY-90DAYS TO *]^5 lastUpdateTime:[* TO NOW/DAY-365DAYS]^-3 I notice it's not possible to simply use a negative boosting factor in the query. Is there any way to achieve such result? Regards, Shi Quan He
Re: Is negative boost possible?
: Use decimal figure less than 1, e.g. 0.5, to express less importance. but that's stil la positive boost ... it still increases the scores of documents that match. the only way to negative boost is to positively boost the inverse... (*:* -field1:value_to_penalize)^10 : I am looking for a way to assign negative boost to a term in Solr query. : Our use scenario is that we want to boost matching documents that are : updated recently and penalize those that have not been updated for a long : time. There are other terms in the query that would affect the scores as : well. For example we construct a query similar to this: : : *:* field1:value1^2 field2:value2^2 lastUpdateTime:[NOW/DAY-90DAYS TO *]^5 : lastUpdateTime:[* TO NOW/DAY-365DAYS]^-3 : : I notice it's not possible to simply use a negative boosting factor in the : query. Is there any way to achieve such result? : : Regards, : Shi Quan He : : -Hoss