Re: Is it possible to do an "if" statement in a Solr query?
: Hello Hoss! : The case here would be: "if total result set contains any original medicines : X, : then remove all generic medicines Y such that Y is a generic form of X." : : In your example and in my case, the result should be Vaxidrop + Generipill then wunder's suggestion of grouping on the family, with a group.sort that puts the "originals" first, is the simplest idea i can think of OOTB. You'll still have to look at each group and "ingnore" the generics if the first item in the group is an "original" -- which of course means things like "numFound" won't really be accurate. An alternative solution using multiple requests wold simple be to do the query once with an "fq=type:original" filter, and if you get any results, then re-issue the query using all of the docids returned in some new "fq=-generic_of:(...)" filter to exclude any docs that are generics of hte matching originals. That logic could also be encapsulated i na custom component -- you could look at the "exclude" logic QueryElevationComponent for inspiration. the crux of the differnece between that while QEC gets it's excludes from a config file, you would get them from a (Query->DocSet)+FilterCache lookup -Hoss
Re: Is it possible to do an "if" statement in a Solr query?
Hello Hoss! The case here would be: "if total result set contains any original medicines X, then remove all generic medicines Y such that Y is a generic form of X." In your example and in my case, the result should be Vaxidrop + Generipill -- View this message in context: http://lucene.472066.n3.nabble.com/Is-it-possible-to-do-an-if-statement-in-a-Solr-query-tp4007311p4007853.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Is it possible to do an "if" statement in a Solr query?
: But when i search for some medicine, following my business rules, i have to : verify if the result of my search contains any Original medicine, if there : is any, then i wouldn't show the generics of this respective medicine, on : the other hand, if there wasnt any original product in the result i would : have to return its generics. : Im currently returning the original and generics, is there a way to do this : kind of "checking" in solr? Think carefully about what you really want here, because there is a subtlety in your description that is a bit ambiguious. Do you want the logic to be "if total result set contains any original medicines, then remove all generic medicines from the result set" or is the logic you need "if total result set contains any original medicines X, then remove all generic medicines Y such that Y is a generic form of X." Those are very different. Imagine Vaxidrop and Vaxipill are both original meds, while Generidrop and Generipill are the corrisponding generics. If i do a search that (unaltered) matches the following docs... * Vaxidrop * Generidrop * Generipill ...then what should the result set be after your biz rules? just Vaxidrop, or Vaxidrop + Generipill? -Hoss
Re: Is it possible to do an "if" statement in a Solr query?
Walter Underwood wrote > > You may be able to do this with grouping. Group on the medicine "family", > and only show the Original if there are multiple items in the family. > > wunder > > On Sep 12, 2012, at 2:09 PM, Gustav wrote: > >> Hello everyone, I'm working on an e-commerce website and using Solr as my >> Search Engine, im really enjoying its funcionality and the search >> options/performance. >> But i am stucky in a kinda tricky cenario... That what happens: >> >> I Have a medicine web-store, where i indexed all necessary products in >> my >> Index Solr. >> But when i search for some medicine, following my business rules, i have >> to >> verify if the result of my search contains any Original medicine, if >> there >> is any, then i wouldn't show the generics of this respective medicine, on >> the other hand, if there wasnt any original product in the result i would >> have to return its generics. >> Im currently returning the original and generics, is there a way to do >> this >> kind of "checking" in solr? >> >> Thanks! :) >> > Hum.. i havent thought about this, its a really good idea! i've never used grouping on Solr before, will do some searching and try it out. Thanks Walter! Jack Krupansky-2 wrote > > You could implement a custom "search component" with that logic, if you > don't mind the complexity of writing Java code that runs inside the Solr > environment. Otherwise, just implement that logic in your app. Or, or > implement an "app server" which sits between Solr and your app. > > http://wiki.apache.org/solr/SearchComponent > > -- Jack Krupansky > > That would be a little too advanced to me, i dont think i have enough knowledge in java to do a custom Search component... I could do that in my app, but just wanted to know if its possible with Solr. App server? Will search about it! Thank you Jack, Amit Nithian wrote > > If the fact that it's "original" vs "generic" is a field "is_original" > 0/1 can you sort by is_original? Similarly, could you put a huge boost > on is_original in the dismax so that document matches on is_original > score higher than those that aren't original? Or is your goal to not > show generics *at all*? > > > On Wed, Sep 12, 2012 at 2:47 PM, Walter Underwood <wunder@> wrote: >> You may be able to do this with grouping. Group on the medicine "family", >> and only show the Original if there are multiple items in the family. >> >> wunder >> >> On Sep 12, 2012, at 2:09 PM, Gustav wrote: >> >>> Hello everyone, I'm working on an e-commerce website and using Solr as >>> my >>> Search Engine, im really enjoying its funcionality and the search >>> options/performance. >>> But i am stucky in a kinda tricky cenario... That what happens: >>> >>> I Have a medicine web-store, where i indexed all necessary products in >>> my >>> Index Solr. >>> But when i search for some medicine, following my business rules, i have >>> to >>> verify if the result of my search contains any Original medicine, if >>> there >>> is any, then i wouldn't show the generics of this respective medicine, >>> on >>> the other hand, if there wasnt any original product in the result i >>> would >>> have to return its generics. >>> Im currently returning the original and generics, is there a way to do >>> this >>> kind of "checking" in solr? >>> >>> Thanks! :) > >> > I have tought doing this Amit, but in this specific case,i would not be able to show generics at all. a But i appreciate the help! -- View this message in context: http://lucene.472066.n3.nabble.com/Is-it-possible-to-do-an-if-statement-in-a-Solr-query-tp4007311p4007468.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Is it possible to do an "if" statement in a Solr query?
If the fact that it's "original" vs "generic" is a field "is_original" 0/1 can you sort by is_original? Similarly, could you put a huge boost on is_original in the dismax so that document matches on is_original score higher than those that aren't original? Or is your goal to not show generics *at all*? On Wed, Sep 12, 2012 at 2:47 PM, Walter Underwood wrote: > You may be able to do this with grouping. Group on the medicine "family", and > only show the Original if there are multiple items in the family. > > wunder > > On Sep 12, 2012, at 2:09 PM, Gustav wrote: > >> Hello everyone, I'm working on an e-commerce website and using Solr as my >> Search Engine, im really enjoying its funcionality and the search >> options/performance. >> But i am stucky in a kinda tricky cenario... That what happens: >> >> I Have a medicine web-store, where i indexed all necessary products in my >> Index Solr. >> But when i search for some medicine, following my business rules, i have to >> verify if the result of my search contains any Original medicine, if there >> is any, then i wouldn't show the generics of this respective medicine, on >> the other hand, if there wasnt any original product in the result i would >> have to return its generics. >> Im currently returning the original and generics, is there a way to do this >> kind of "checking" in solr? >> >> Thanks! :) >> > > > >
Re: Is it possible to do an "if" statement in a Solr query?
You could implement a custom "search component" with that logic, if you don't mind the complexity of writing Java code that runs inside the Solr environment. Otherwise, just implement that logic in your app. Or, or implement an "app server" which sits between Solr and your app. http://wiki.apache.org/solr/SearchComponent -- Jack Krupansky -Original Message- From: Gustav Sent: Wednesday, September 12, 2012 5:09 PM To: solr-user@lucene.apache.org Subject: Is it possible to do an "if" statement in a Solr query? Hello everyone, I'm working on an e-commerce website and using Solr as my Search Engine, im really enjoying its funcionality and the search options/performance. But i am stucky in a kinda tricky cenario... That what happens: I Have a medicine web-store, where i indexed all necessary products in my Index Solr. But when i search for some medicine, following my business rules, i have to verify if the result of my search contains any Original medicine, if there is any, then i wouldn't show the generics of this respective medicine, on the other hand, if there wasnt any original product in the result i would have to return its generics. Im currently returning the original and generics, is there a way to do this kind of "checking" in solr? Thanks! :) -- View this message in context: http://lucene.472066.n3.nabble.com/Is-it-possible-to-do-an-if-statement-in-a-Solr-query-tp4007311.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Is it possible to do an "if" statement in a Solr query?
You may be able to do this with grouping. Group on the medicine "family", and only show the Original if there are multiple items in the family. wunder On Sep 12, 2012, at 2:09 PM, Gustav wrote: > Hello everyone, I'm working on an e-commerce website and using Solr as my > Search Engine, im really enjoying its funcionality and the search > options/performance. > But i am stucky in a kinda tricky cenario... That what happens: > > I Have a medicine web-store, where i indexed all necessary products in my > Index Solr. > But when i search for some medicine, following my business rules, i have to > verify if the result of my search contains any Original medicine, if there > is any, then i wouldn't show the generics of this respective medicine, on > the other hand, if there wasnt any original product in the result i would > have to return its generics. > Im currently returning the original and generics, is there a way to do this > kind of "checking" in solr? > > Thanks! :) >
Is it possible to do an "if" statement in a Solr query?
Hello everyone, I'm working on an e-commerce website and using Solr as my Search Engine, im really enjoying its funcionality and the search options/performance. But i am stucky in a kinda tricky cenario... That what happens: I Have a medicine web-store, where i indexed all necessary products in my Index Solr. But when i search for some medicine, following my business rules, i have to verify if the result of my search contains any Original medicine, if there is any, then i wouldn't show the generics of this respective medicine, on the other hand, if there wasnt any original product in the result i would have to return its generics. Im currently returning the original and generics, is there a way to do this kind of "checking" in solr? Thanks! :) -- View this message in context: http://lucene.472066.n3.nabble.com/Is-it-possible-to-do-an-if-statement-in-a-Solr-query-tp4007311.html Sent from the Solr - User mailing list archive at Nabble.com.