Re: Forced Top Document
: So for example, to pop one document to the top of the index, i just run: : : q=field: value; id_700390+desc, date+desc : : Works like a charm, even with multiple documents. : : q=field: value; id_700390+desc, id_604030+desc, date+desc be wary of this, sorting on a field (even a dynamic field) builds a large array for every item in your index ... if every query gets a sort on a different id_* field you could OOM fairly quickly. -Hoss
Re: Forced Top Document
: The typical use case, though, is for the featured document to be on top only : for certain queries. Like in an intranet where someone queries 401K or : retirement or similar, you want to feature a document about benefits that : would otherwise rank really low for that query. I have not be able to make : sorting strategies work very well. this type of question typically falls into two use cases: 1) targeted ads 2) sponsored results in the targeted ads case, the special matches aren't part of the normal flow of results, and don't fit into pagination -- they always appera at the top, or to the right, on every page, no matter what the sort this kind of usage doesn't really need any special logic, it can be solved as easily by a second Solr hit as it can by custom request handler logic. in the sponsored results use case, the special matches should appear in the normal flow of results as the #1 (2, 3, etc) matches, so that they don't appear on page#2 ... but that also means that it's extremely disconcerting for users if those matches are still at the top when the userse resort. if a user is looking at product listings, sorted by relevancy and the top 3 results all say they are sponsered that's fine ... but if the user sort by price and those 3 results are still at teh top of the list, even though they clearly aren't the chepest, that's just going to piss the user off. in my profesional opinion: don't fuck with your users. default to whatever order you want, but if the user specificly requests to sort the results by some option, do it. assuming you follow my professional opinion, then boosting docs to have an artifically high score will work fine. if you absolutely *MUST* have certain docs sorting before others, regardless of which sort option the user picks, then it is still possible do ... i'm hesitant to even say how, but if people insist on knowing... allways sort by score first, then by whatever field the user wants to sort by ... but when the user wants to sort on a specific field, move the users main query input into an fq (so it doesn't influence the score) ... and use an extremely low boost matchalldocs query along with your special doc matching query as the main (scoring) query param. the key being that even though your primary sort is on score, every doc except your special matches have identical scores. (this may not be possible with dismax because it's not trivial to move the query into an fq, it might work if you can use 0 as the boost on fields in the qf so it still dictates the matches but doesn't influence the score enough to throw off the sort) -Hoss
Re: Forced Top Document
On 10/25/07, Chris Hostetter [EMAIL PROTECTED] wrote: : The typical use case, though, is for the featured document to be on top only : for certain queries. Like in an intranet where someone queries 401K or : retirement or similar, you want to feature a document about benefits that : would otherwise rank really low for that query. I have not be able to make : sorting strategies work very well. this type of question typically falls into two use cases: 1) targeted ads 2) sponsored results in the targeted ads case, the special matches aren't part of the normal flow of results, and don't fit into pagination -- they always appera at the top, or to the right, on every page, no matter what the sort this kind of usage doesn't really need any special logic, it can be solved as easily by a second Solr hit as it can by custom request handler logic. in the sponsored results use case, the special matches should appear in the normal flow of results as the #1 (2, 3, etc) matches, so that they don't appear on page#2 ... but that also means that it's extremely disconcerting for users if those matches are still at the top when the userse resort. if a user is looking at product listings, sorted by relevancy and the top 3 results all say they are sponsered that's fine ... but if the user sort by price and those 3 results are still at teh top of the list, even though they clearly aren't the chepest, that's just going to piss the user off. in my profesional opinion: don't fuck with your users. default to whatever order you want, but if the user specificly requests to sort the results by some option, do it. assuming you follow my professional opinion, then boosting docs to have an artifically high score will work fine. if you absolutely *MUST* have certain docs sorting before others, regardless of which sort option the user picks, then it is still possible do ... i'm hesitant to even say how, but if people insist on knowing... allways sort by score first, then by whatever field the user wants to sort by ... but when the user wants to sort on a specific field, move the users main query input into an fq (so it doesn't influence the score) ... and use an extremely low boost matchalldocs query along with your special doc matching query as the main (scoring) query param. the key being that even though your primary sort is on score, every doc except your special matches have identical scores. That sorts by relevance for your sponsored results, right? What if you want absolute ordering based on dollars spent on that result, for example. (this may not be possible with dismax because it's not trivial to move the query into an fq Should be easier in trunk: fq=!dismaxfoo bar or fq=!dismax v=$userq -Yonik
Re: Forced Top Document
On 10/25/07 12:11 AM, Chris Hostetter [EMAIL PROTECTED] wrote: this type of question typically falls into two use cases: 1) targeted ads 2) sponsored results 3) Best bets (editorial results) The query house should return House, M.D. as the first hit, but that is rather hard to achieve with relevance tuning and synonyms. A manual fix is straightforward. wunder
Re: Forced Top Document
Thanks for your thoughts, Chris. I agree with you about the user's experience. Snooth doesn't serve any ads/sponsored results -- the goal here is to make sure that the most recent document the user has acted on shows up top in searches for recent activity. My aim is to forcibly preserve the sort order until the document can be reindexed/ updated. Since the dynamic field is too memory intensive, I'll try boosting on the date field -- and boosting more on the date field for the document that needs to be up top. If that doesn't end up working I'll just perform two queries and be done with it. Mark On Oct 25, 2007, at 3:11 AM, Chris Hostetter wrote: : The typical use case, though, is for the featured document to be on top only : for certain queries. Like in an intranet where someone queries 401K or : retirement or similar, you want to feature a document about benefits that : would otherwise rank really low for that query. I have not be able to make : sorting strategies work very well. this type of question typically falls into two use cases: 1) targeted ads 2) sponsored results in the targeted ads case, the special matches aren't part of the normal flow of results, and don't fit into pagination -- they always appera at the top, or to the right, on every page, no matter what the sort this kind of usage doesn't really need any special logic, it can be solved as easily by a second Solr hit as it can by custom request handler logic. in the sponsored results use case, the special matches should appear in the normal flow of results as the #1 (2, 3, etc) matches, so that they don't appear on page#2 ... but that also means that it's extremely disconcerting for users if those matches are still at the top when the userse resort. if a user is looking at product listings, sorted by relevancy and the top 3 results all say they are sponsered that's fine ... but if the user sort by price and those 3 results are still at teh top of the list, even though they clearly aren't the chepest, that's just going to piss the user off. in my profesional opinion: don't fuck with your users. default to whatever order you want, but if the user specificly requests to sort the results by some option, do it. assuming you follow my professional opinion, then boosting docs to have an artifically high score will work fine. if you absolutely *MUST* have certain docs sorting before others, regardless of which sort option the user picks, then it is still possible do ... i'm hesitant to even say how, but if people insist on knowing... allways sort by score first, then by whatever field the user wants to sort by ... but when the user wants to sort on a specific field, move the users main query input into an fq (so it doesn't influence the score) ... and use an extremely low boost matchalldocs query along with your special doc matching query as the main (scoring) query param. the key being that even though your primary sort is on score, every doc except your special matches have identical scores. (this may not be possible with dismax because it's not trivial to move the query into an fq, it might work if you can use 0 as the boost on fields in the qf so it still dictates the matches but doesn't influence the score enough to throw off the sort) -Hoss mark angelillo snooth inc. o: 646.723.4328 c: 484.437.9915 [EMAIL PROTECTED] snooth -- 1.8 million ratings and counting...
Re: Forced Top Document
I'd love to know this, as I just got a development request for this very feature. I'd rather not spend time on it if it already exists. ++ | Matthew Runo | Zappos Development | [EMAIL PROTECTED] | 702-943-7833 ++ On Oct 23, 2007, at 10:12 PM, mark angelillo wrote: Hi all, Is there a way to get a specific document to appear on top of search results even if a sorting parameter would push it further down? Thanks in advance, Mark mark angelillo snooth inc. o: 646.723.4328 c: 484.437.9915 [EMAIL PROTECTED] snooth -- 1.8 million ratings and counting...
RE: Forced Top Document
Do you know which document you want at the top? If so, I believe you could just add an OR clause to your query to boost that document very high, such as ?q=foo OR id:bar^1000 Tried this on my installation and it did, indeed push the document specified to the top. -Original Message- From: Matthew Runo [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 24, 2007 10:17 AM To: solr-user@lucene.apache.org Subject: Re: Forced Top Document I'd love to know this, as I just got a development request for this very feature. I'd rather not spend time on it if it already exists. ++ | Matthew Runo | Zappos Development | [EMAIL PROTECTED] | 702-943-7833 ++ On Oct 23, 2007, at 10:12 PM, mark angelillo wrote: Hi all, Is there a way to get a specific document to appear on top of search results even if a sorting parameter would push it further down? Thanks in advance, Mark mark angelillo snooth inc. o: 646.723.4328 c: 484.437.9915 [EMAIL PROTECTED] snooth -- 1.8 million ratings and counting...
RE: Forced Top Document
Yes, this will only work if the results are sorted by score (the default). One thing I thought of after I sent this out was that this will include the specified document even if it doesn't match your search criteria, which may not be what you want. -Original Message- From: mark angelillo [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 24, 2007 12:44 PM To: solr-user@lucene.apache.org Subject: Re: Forced Top Document Charlie, That's interesting. I did try something like this. Did you try your query with a sorting parameter? What I've read suggests that all the results are returned based on the query specified, but then resorted as specified. Boosting (which modifies the document's score) should not change the order unless the results are sorted by score. Mark On Oct 24, 2007, at 1:05 PM, Charlie Jackson wrote: Do you know which document you want at the top? If so, I believe you could just add an OR clause to your query to boost that document very high, such as ?q=foo OR id:bar^1000 Tried this on my installation and it did, indeed push the document specified to the top. -Original Message- From: Matthew Runo [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 24, 2007 10:17 AM To: solr-user@lucene.apache.org Subject: Re: Forced Top Document I'd love to know this, as I just got a development request for this very feature. I'd rather not spend time on it if it already exists. ++ | Matthew Runo | Zappos Development | [EMAIL PROTECTED] | 702-943-7833 ++ On Oct 23, 2007, at 10:12 PM, mark angelillo wrote: Hi all, Is there a way to get a specific document to appear on top of search results even if a sorting parameter would push it further down? Thanks in advance, Mark mark angelillo snooth inc. o: 646.723.4328 c: 484.437.9915 [EMAIL PROTECTED] snooth -- 1.8 million ratings and counting... mark angelillo snooth inc. o: 646.723.4328 c: 484.437.9915 [EMAIL PROTECTED] snooth -- 1.8 million ratings and counting...
RE: Forced Top Document
I'm going to be doing something similar, and I don't think I'll be sorting by score (although, that might be feasible). In my use-case though, we don't want to include something unless it is already matched by our filters. I'll probably end up just making two search hits, but it would be nice if solr could handle it for us. -Original Message- From: Charlie Jackson [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 24, 2007 10:57 AM To: solr-user@lucene.apache.org Subject: RE: Forced Top Document Yes, this will only work if the results are sorted by score (the default). One thing I thought of after I sent this out was that this will include the specified document even if it doesn't match your search criteria, which may not be what you want. -Original Message- From: mark angelillo [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 24, 2007 12:44 PM To: solr-user@lucene.apache.org Subject: Re: Forced Top Document Charlie, That's interesting. I did try something like this. Did you try your query with a sorting parameter? What I've read suggests that all the results are returned based on the query specified, but then resorted as specified. Boosting (which modifies the document's score) should not change the order unless the results are sorted by score. Mark On Oct 24, 2007, at 1:05 PM, Charlie Jackson wrote: Do you know which document you want at the top? If so, I believe you could just add an OR clause to your query to boost that document very high, such as ?q=foo OR id:bar^1000 Tried this on my installation and it did, indeed push the document specified to the top. -Original Message- From: Matthew Runo [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 24, 2007 10:17 AM To: solr-user@lucene.apache.org Subject: Re: Forced Top Document I'd love to know this, as I just got a development request for this very feature. I'd rather not spend time on it if it already exists. ++ | Matthew Runo | Zappos Development | [EMAIL PROTECTED] | 702-943-7833 ++ On Oct 23, 2007, at 10:12 PM, mark angelillo wrote: Hi all, Is there a way to get a specific document to appear on top of search results even if a sorting parameter would push it further down? Thanks in advance, Mark mark angelillo snooth inc. o: 646.723.4328 c: 484.437.9915 [EMAIL PROTECTED] snooth -- 1.8 million ratings and counting... mark angelillo snooth inc. o: 646.723.4328 c: 484.437.9915 [EMAIL PROTECTED] snooth -- 1.8 million ratings and counting...
Re: Forced Top Document
This method Charlie suggested will work just fine with a minor tweak. For relevancy sorting ?q=foo OR (foo AND id:bar) For nonrelevancy sorting, all you need is a multilevel sort. Just add a bogus field that only the important document contains. Then sort by bogus field in descending order before any other sorting criteria are applied. Either way, the document only appears when it matches the search criteria, and it will always be on top. kyle On 10/24/07, Charlie Jackson [EMAIL PROTECTED] wrote: Yes, this will only work if the results are sorted by score (the default). One thing I thought of after I sent this out was that this will include the specified document even if it doesn't match your search criteria, which may not be what you want. -Original Message- From: mark angelillo [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 24, 2007 12:44 PM To: solr-user@lucene.apache.org Subject: Re: Forced Top Document Charlie, That's interesting. I did try something like this. Did you try your query with a sorting parameter? What I've read suggests that all the results are returned based on the query specified, but then resorted as specified. Boosting (which modifies the document's score) should not change the order unless the results are sorted by score. Mark On Oct 24, 2007, at 1:05 PM, Charlie Jackson wrote: Do you know which document you want at the top? If so, I believe you could just add an OR clause to your query to boost that document very high, such as ?q=foo OR id:bar^1000 Tried this on my installation and it did, indeed push the document specified to the top. -Original Message- From: Matthew Runo [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 24, 2007 10:17 AM To: solr-user@lucene.apache.org Subject: Re: Forced Top Document I'd love to know this, as I just got a development request for this very feature. I'd rather not spend time on it if it already exists. ++ | Matthew Runo | Zappos Development | [EMAIL PROTECTED] | 702-943-7833 ++ On Oct 23, 2007, at 10:12 PM, mark angelillo wrote: Hi all, Is there a way to get a specific document to appear on top of search results even if a sorting parameter would push it further down? Thanks in advance, Mark mark angelillo snooth inc. o: 646.723.4328 c: 484.437.9915 [EMAIL PROTECTED] snooth -- 1.8 million ratings and counting... mark angelillo snooth inc. o: 646.723.4328 c: 484.437.9915 [EMAIL PROTECTED] snooth -- 1.8 million ratings and counting... -- -- Kyle Banerjee Digital Services Program Manager Orbis Cascade Alliance [EMAIL PROTECTED] / 541.359.9599
Re: Forced Top Document
On 24-Oct-07, at 10:56 AM, Charlie Jackson wrote: Yes, this will only work if the results are sorted by score (the default). One thing I thought of after I sent this out was that this will include the specified document even if it doesn't match your search criteria, which may not be what you want. If you use dismax, you can add the boost to the 'bq' parameter to affect scoring only (will not match the doc if it wouldn't have been matched anyway). -Mike
RE: Forced Top Document
Took the words right out my mouth! That second method would be particularly effective but will only work if you can identify these docs at index time. -Original Message- From: Kyle Banerjee [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 24, 2007 1:31 PM To: solr-user@lucene.apache.org Subject: Re: Forced Top Document This method Charlie suggested will work just fine with a minor tweak. For relevancy sorting ?q=foo OR (foo AND id:bar) For nonrelevancy sorting, all you need is a multilevel sort. Just add a bogus field that only the important document contains. Then sort by bogus field in descending order before any other sorting criteria are applied. Either way, the document only appears when it matches the search criteria, and it will always be on top. kyle On 10/24/07, Charlie Jackson [EMAIL PROTECTED] wrote: Yes, this will only work if the results are sorted by score (the default). One thing I thought of after I sent this out was that this will include the specified document even if it doesn't match your search criteria, which may not be what you want. -Original Message- From: mark angelillo [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 24, 2007 12:44 PM To: solr-user@lucene.apache.org Subject: Re: Forced Top Document Charlie, That's interesting. I did try something like this. Did you try your query with a sorting parameter? What I've read suggests that all the results are returned based on the query specified, but then resorted as specified. Boosting (which modifies the document's score) should not change the order unless the results are sorted by score. Mark On Oct 24, 2007, at 1:05 PM, Charlie Jackson wrote: Do you know which document you want at the top? If so, I believe you could just add an OR clause to your query to boost that document very high, such as ?q=foo OR id:bar^1000 Tried this on my installation and it did, indeed push the document specified to the top. -Original Message- From: Matthew Runo [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 24, 2007 10:17 AM To: solr-user@lucene.apache.org Subject: Re: Forced Top Document I'd love to know this, as I just got a development request for this very feature. I'd rather not spend time on it if it already exists. ++ | Matthew Runo | Zappos Development | [EMAIL PROTECTED] | 702-943-7833 ++ On Oct 23, 2007, at 10:12 PM, mark angelillo wrote: Hi all, Is there a way to get a specific document to appear on top of search results even if a sorting parameter would push it further down? Thanks in advance, Mark mark angelillo snooth inc. o: 646.723.4328 c: 484.437.9915 [EMAIL PROTECTED] snooth -- 1.8 million ratings and counting... mark angelillo snooth inc. o: 646.723.4328 c: 484.437.9915 [EMAIL PROTECTED] snooth -- 1.8 million ratings and counting... -- -- Kyle Banerjee Digital Services Program Manager Orbis Cascade Alliance [EMAIL PROTECTED] / 541.359.9599
Re: Forced Top Document
The typical use case, though, is for the featured document to be on top only for certain queries. Like in an intranet where someone queries 401K or retirement or similar, you want to feature a document about benefits that would otherwise rank really low for that query. I have not be able to make sorting strategies work very well. Our approach has been to create a separate index of featured items that are tagged by the desired query. And then the results are placed in a different hit list as featured results (sort of like sponsored results). On 10/24/07, mark angelillo [EMAIL PROTECTED] wrote: Charlie, That's interesting. I did try something like this. Did you try your query with a sorting parameter? What I've read suggests that all the results are returned based on the query specified, but then resorted as specified. Boosting (which modifies the document's score) should not change the order unless the results are sorted by score. Mark On Oct 24, 2007, at 1:05 PM, Charlie Jackson wrote: Do you know which document you want at the top? If so, I believe you could just add an OR clause to your query to boost that document very high, such as ?q=foo OR id:bar^1000 Tried this on my installation and it did, indeed push the document specified to the top. -Original Message- From: Matthew Runo [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 24, 2007 10:17 AM To: solr-user@lucene.apache.org Subject: Re: Forced Top Document I'd love to know this, as I just got a development request for this very feature. I'd rather not spend time on it if it already exists. ++ | Matthew Runo | Zappos Development | [EMAIL PROTECTED] | 702-943-7833 ++ On Oct 23, 2007, at 10:12 PM, mark angelillo wrote: Hi all, Is there a way to get a specific document to appear on top of search results even if a sorting parameter would push it further down? Thanks in advance, Mark mark angelillo snooth inc. o: 646.723.4328 c: 484.437.9915 [EMAIL PROTECTED] snooth -- 1.8 million ratings and counting... mark angelillo snooth inc. o: 646.723.4328 c: 484.437.9915 [EMAIL PROTECTED] snooth -- 1.8 million ratings and counting...
Re: Forced Top Document
The typical use case, though, is for the featured document to be on top only for certain queries. Like in an intranet where someone queries 401K or retirement or similar, you want to feature a document about benefits that would otherwise rank really low for that query. I have not be able to make sorting strategies work very well. Depending on how many of these certain queries you have, it seems like you could still use some variation of the strategy based on a bogus tag sort. If you place a dynamic field for each query term (e.g. foo_s, bar_s, etc) relevant to a document and then detect when one of the special query terms is detected, you can still sort on the appropriate dynamic field before applying the rest of the sort. kyle
Re: Forced Top Document
That's the ticket exactly, Kyle. What I have is the ID of my document, so I indexed a dynamic field with name id_*. Then I just set that field for each document with the proper ID. So for example, to pop one document to the top of the index, i just run: q=field: value; id_700390+desc, date+desc Works like a charm, even with multiple documents. q=field: value; id_700390+desc, id_604030+desc, date+desc Mark On Oct 24, 2007, at 4:15 PM, Kyle Banerjee wrote: The typical use case, though, is for the featured document to be on top only for certain queries. Like in an intranet where someone queries 401K or retirement or similar, you want to feature a document about benefits that would otherwise rank really low for that query. I have not be able to make sorting strategies work very well. Depending on how many of these certain queries you have, it seems like you could still use some variation of the strategy based on a bogus tag sort. If you place a dynamic field for each query term (e.g. foo_s, bar_s, etc) relevant to a document and then detect when one of the special query terms is detected, you can still sort on the appropriate dynamic field before applying the rest of the sort. kyle mark angelillo snooth inc. o: 646.723.4328 c: 484.437.9915 [EMAIL PROTECTED] snooth -- 1.8 million ratings and counting...