Re: help with a schema design problem
Hi, I haven't read everything thoroughly but have you considered creating fields for each of your (I think what you call) "party value"? So that you can query like "client:Pramod". You would then be able to facet on client and supplier. Cheers, Chantal On Fri, 2010-07-23 at 23:23 +0200, Geert-Jan Brits wrote: > Multiple rows in the OPs example are combined to form 1 solr-document (e.g: > row 1 and 2 both have documentid=1) > Because of this combine, it would match p_value from row1 with p_type from > row2 (or vice versa) > > > 2010/7/23 Nagelberg, Kallin > > > > > > When i search > > > > > p_value:"Pramod" AND p_type:"Supplier" > > > > > > > > > > it would give me result as document 1. Which is incorrect, since in > > > > > document > > > > > 1 Pramod is a Client and not a Supplier. > > > > Would it? I would expect it to give you nothing. > > > > -Kal > > > > > > > > -Original Message- > > From: Geert-Jan Brits [mailto:gbr...@gmail.com] > > Sent: Friday, July 23, 2010 5:05 PM > > To: solr-user@lucene.apache.org > > Subject: Re: help with a schema design problem > > > > > Is there any way in solr to say p_value[someIndex]="pramod" > > And p_type[someIndex]="client". > > No, I'm 99% sure there is not. > > > > > One way would be to define a single field in the schema as p_value_type = > > "client pramod" i.e. combine the value from both the field and store it in > > a > > single field. > > yep, for the use-case you mentioned that would definitely work. Multivalued > > of course, so it can contain "Supplier Raj" as well. > > > > > > 2010/7/23 Pramod Goyal > > > > >In my case the document id is the unique key( each row is not a unique > > > document ) . So a single document has multiple Party Value and Party > > Type. > > > Hence i need to define both Party value and Party type as mutli-valued. > > Is > > > there any way in solr to say p_value[someIndex]="pramod" And > > > p_type[someIndex]="client". > > >Is there any other way i can design my schema ? I have some solutions > > > but none seems to be a good solution. One way would be to define a single > > > field in the schema as p_value_type = "client pramod" i.e. combine the > > > value > > > from both the field and store it in a single field. > > > > > > > > > On Sat, Jul 24, 2010 at 12:18 AM, Geert-Jan Brits > > > wrote: > > > > > > > With the usecase you specified it should work to just index each "Row" > > as > > > > you described in your initial post to be a seperate document. > > > > This way p_value and p_type all get singlevalued and you get a correct > > > > combination of p_value and p_type. > > > > > > > > However, this may not go so well with other use-cases you have in mind, > > > > e.g.: requiring that no multiple results are returned with the same > > > > document > > > > id. > > > > > > > > > > > > > > > > 2010/7/23 Pramod Goyal > > > > > > > > > I want to do that. But if i understand correctly in solr it would > > store > > > > the > > > > > field like this: > > > > > > > > > > p_value: "Pramod" "Raj" > > > > > p_type: "Client" "Supplier" > > > > > > > > > > When i search > > > > > p_value:"Pramod" AND p_type:"Supplier" > > > > > > > > > > it would give me result as document 1. Which is incorrect, since in > > > > > document > > > > > 1 Pramod is a Client and not a Supplier. > > > > > > > > > > > > > > > > > > > > > > > > > On Fri, Jul 23, 2010 at 11:52 PM, Nagelberg, Kallin < > > > > > knagelb...@globeandmail.com> wrote: > > > > > > > > > > > I think you just want something like: > > > > > > > > > > > > p_value:"Pramod" AND p_type:"Supplier" > > > > > > > > > > > > no? > > > > > > -Kallin Nagelberg > > > > > > > > > > > > -Original Message- > > > > > > From: Pramod Goyal [mailto:pramod.go...@gmail.com] > > > > > > Sent: Friday, July 23, 2010 2:17 PM > > > > > > To: solr-user@lucene.apache.org > > > > > > Subject: help with a schema design problem > > > > > > > > > > > > Hi, > > > > > > > > > > > > Lets say i have table with 3 columns document id Party Value and > > > Party > > > > > > Type. > > > > > > In this table i have 3 rows. 1st row Document id: 1 Party Value: > > > Pramod > > > > > > Party Type: Client. 2nd row: Document id: 1 Party Value: Raj Party > > > > Type: > > > > > > Supplier. 3rd row Document id:2 Party Value: Pramod Party Type: > > > > Supplier. > > > > > > Now in this table if i use SQL its easy for me find all document > > with > > > > > Party > > > > > > Value as Pramod and Party Type as Client. > > > > > > > > > > > > I need to design solr schema so that i can do the same in Solr. If > > i > > > > > create > > > > > > 2 fields in solr schema Party value and Party type both of them > > multi > > > > > > valued > > > > > > and try to query +Pramod +Supplier then solr will return me the > > first > > > > > > document, even though in the first document Pramod is a client and > > > not > > > > a > > > > > > supplier > > > > > > Thanks, > > > > > > Pramod Goyal > > > > > > > > > > > > > > > > > > > >
Re: help with a schema design problem
: > Is there any way in solr to say p_value[someIndex]="pramod" : And p_type[someIndex]="client". : No, I'm 99% sure there is not. it's possibly in code, by utilizing positions and FieldMaskingSpanQuery... http://lucene.apache.org/java/2_9_0/api/all/org/apache/lucene/search/spans/FieldMaskingSpanQuery.html ...but there is no QParser or RequestHandler with syntax for exposing it to clients. it would have to be a custom plugin. -Hoss
Re: help with a schema design problem
Multiple rows in the OPs example are combined to form 1 solr-document (e.g: row 1 and 2 both have documentid=1) Because of this combine, it would match p_value from row1 with p_type from row2 (or vice versa) 2010/7/23 Nagelberg, Kallin > > > > When i search > > > > p_value:"Pramod" AND p_type:"Supplier" > > > > > > > > it would give me result as document 1. Which is incorrect, since in > > > > document > > > > 1 Pramod is a Client and not a Supplier. > > Would it? I would expect it to give you nothing. > > -Kal > > > > -Original Message- > From: Geert-Jan Brits [mailto:gbr...@gmail.com] > Sent: Friday, July 23, 2010 5:05 PM > To: solr-user@lucene.apache.org > Subject: Re: help with a schema design problem > > > Is there any way in solr to say p_value[someIndex]="pramod" > And p_type[someIndex]="client". > No, I'm 99% sure there is not. > > > One way would be to define a single field in the schema as p_value_type = > "client pramod" i.e. combine the value from both the field and store it in > a > single field. > yep, for the use-case you mentioned that would definitely work. Multivalued > of course, so it can contain "Supplier Raj" as well. > > > 2010/7/23 Pramod Goyal > > >In my case the document id is the unique key( each row is not a unique > > document ) . So a single document has multiple Party Value and Party > Type. > > Hence i need to define both Party value and Party type as mutli-valued. > Is > > there any way in solr to say p_value[someIndex]="pramod" And > > p_type[someIndex]="client". > >Is there any other way i can design my schema ? I have some solutions > > but none seems to be a good solution. One way would be to define a single > > field in the schema as p_value_type = "client pramod" i.e. combine the > > value > > from both the field and store it in a single field. > > > > > > On Sat, Jul 24, 2010 at 12:18 AM, Geert-Jan Brits > > wrote: > > > > > With the usecase you specified it should work to just index each "Row" > as > > > you described in your initial post to be a seperate document. > > > This way p_value and p_type all get singlevalued and you get a correct > > > combination of p_value and p_type. > > > > > > However, this may not go so well with other use-cases you have in mind, > > > e.g.: requiring that no multiple results are returned with the same > > > document > > > id. > > > > > > > > > > > > 2010/7/23 Pramod Goyal > > > > > > > I want to do that. But if i understand correctly in solr it would > store > > > the > > > > field like this: > > > > > > > > p_value: "Pramod" "Raj" > > > > p_type: "Client" "Supplier" > > > > > > > > When i search > > > > p_value:"Pramod" AND p_type:"Supplier" > > > > > > > > it would give me result as document 1. Which is incorrect, since in > > > > document > > > > 1 Pramod is a Client and not a Supplier. > > > > > > > > > > > > > > > > > > > > On Fri, Jul 23, 2010 at 11:52 PM, Nagelberg, Kallin < > > > > knagelb...@globeandmail.com> wrote: > > > > > > > > > I think you just want something like: > > > > > > > > > > p_value:"Pramod" AND p_type:"Supplier" > > > > > > > > > > no? > > > > > -Kallin Nagelberg > > > > > > > > > > -Original Message- > > > > > From: Pramod Goyal [mailto:pramod.go...@gmail.com] > > > > > Sent: Friday, July 23, 2010 2:17 PM > > > > > To: solr-user@lucene.apache.org > > > > > Subject: help with a schema design problem > > > > > > > > > > Hi, > > > > > > > > > > Lets say i have table with 3 columns document id Party Value and > > Party > > > > > Type. > > > > > In this table i have 3 rows. 1st row Document id: 1 Party Value: > > Pramod > > > > > Party Type: Client. 2nd row: Document id: 1 Party Value: Raj Party > > > Type: > > > > > Supplier. 3rd row Document id:2 Party Value: Pramod Party Type: > > > Supplier. > > > > > Now in this table if i use SQL its easy for me find all document > with > > > > Party > > > > > Value as Pramod and Party Type as Client. > > > > > > > > > > I need to design solr schema so that i can do the same in Solr. If > i > > > > create > > > > > 2 fields in solr schema Party value and Party type both of them > multi > > > > > valued > > > > > and try to query +Pramod +Supplier then solr will return me the > first > > > > > document, even though in the first document Pramod is a client and > > not > > > a > > > > > supplier > > > > > Thanks, > > > > > Pramod Goyal > > > > > > > > > > > > > > >
RE: help with a schema design problem
> > > When i search > > > p_value:"Pramod" AND p_type:"Supplier" > > > > > > it would give me result as document 1. Which is incorrect, since in > > > document > > > 1 Pramod is a Client and not a Supplier. Would it? I would expect it to give you nothing. -Kal -Original Message- From: Geert-Jan Brits [mailto:gbr...@gmail.com] Sent: Friday, July 23, 2010 5:05 PM To: solr-user@lucene.apache.org Subject: Re: help with a schema design problem > Is there any way in solr to say p_value[someIndex]="pramod" And p_type[someIndex]="client". No, I'm 99% sure there is not. > One way would be to define a single field in the schema as p_value_type = "client pramod" i.e. combine the value from both the field and store it in a single field. yep, for the use-case you mentioned that would definitely work. Multivalued of course, so it can contain "Supplier Raj" as well. 2010/7/23 Pramod Goyal >In my case the document id is the unique key( each row is not a unique > document ) . So a single document has multiple Party Value and Party Type. > Hence i need to define both Party value and Party type as mutli-valued. Is > there any way in solr to say p_value[someIndex]="pramod" And > p_type[someIndex]="client". >Is there any other way i can design my schema ? I have some solutions > but none seems to be a good solution. One way would be to define a single > field in the schema as p_value_type = "client pramod" i.e. combine the > value > from both the field and store it in a single field. > > > On Sat, Jul 24, 2010 at 12:18 AM, Geert-Jan Brits > wrote: > > > With the usecase you specified it should work to just index each "Row" as > > you described in your initial post to be a seperate document. > > This way p_value and p_type all get singlevalued and you get a correct > > combination of p_value and p_type. > > > > However, this may not go so well with other use-cases you have in mind, > > e.g.: requiring that no multiple results are returned with the same > > document > > id. > > > > > > > > 2010/7/23 Pramod Goyal > > > > > I want to do that. But if i understand correctly in solr it would store > > the > > > field like this: > > > > > > p_value: "Pramod" "Raj" > > > p_type: "Client" "Supplier" > > > > > > When i search > > > p_value:"Pramod" AND p_type:"Supplier" > > > > > > it would give me result as document 1. Which is incorrect, since in > > > document > > > 1 Pramod is a Client and not a Supplier. > > > > > > > > > > > > > > > On Fri, Jul 23, 2010 at 11:52 PM, Nagelberg, Kallin < > > > knagelb...@globeandmail.com> wrote: > > > > > > > I think you just want something like: > > > > > > > > p_value:"Pramod" AND p_type:"Supplier" > > > > > > > > no? > > > > -Kallin Nagelberg > > > > > > > > -Original Message- > > > > From: Pramod Goyal [mailto:pramod.go...@gmail.com] > > > > Sent: Friday, July 23, 2010 2:17 PM > > > > To: solr-user@lucene.apache.org > > > > Subject: help with a schema design problem > > > > > > > > Hi, > > > > > > > > Lets say i have table with 3 columns document id Party Value and > Party > > > > Type. > > > > In this table i have 3 rows. 1st row Document id: 1 Party Value: > Pramod > > > > Party Type: Client. 2nd row: Document id: 1 Party Value: Raj Party > > Type: > > > > Supplier. 3rd row Document id:2 Party Value: Pramod Party Type: > > Supplier. > > > > Now in this table if i use SQL its easy for me find all document with > > > Party > > > > Value as Pramod and Party Type as Client. > > > > > > > > I need to design solr schema so that i can do the same in Solr. If i > > > create > > > > 2 fields in solr schema Party value and Party type both of them multi > > > > valued > > > > and try to query +Pramod +Supplier then solr will return me the first > > > > document, even though in the first document Pramod is a client and > not > > a > > > > supplier > > > > Thanks, > > > > Pramod Goyal > > > > > > > > > >
Re: help with a schema design problem
> Is there any way in solr to say p_value[someIndex]="pramod" And p_type[someIndex]="client". No, I'm 99% sure there is not. > One way would be to define a single field in the schema as p_value_type = "client pramod" i.e. combine the value from both the field and store it in a single field. yep, for the use-case you mentioned that would definitely work. Multivalued of course, so it can contain "Supplier Raj" as well. 2010/7/23 Pramod Goyal >In my case the document id is the unique key( each row is not a unique > document ) . So a single document has multiple Party Value and Party Type. > Hence i need to define both Party value and Party type as mutli-valued. Is > there any way in solr to say p_value[someIndex]="pramod" And > p_type[someIndex]="client". >Is there any other way i can design my schema ? I have some solutions > but none seems to be a good solution. One way would be to define a single > field in the schema as p_value_type = "client pramod" i.e. combine the > value > from both the field and store it in a single field. > > > On Sat, Jul 24, 2010 at 12:18 AM, Geert-Jan Brits > wrote: > > > With the usecase you specified it should work to just index each "Row" as > > you described in your initial post to be a seperate document. > > This way p_value and p_type all get singlevalued and you get a correct > > combination of p_value and p_type. > > > > However, this may not go so well with other use-cases you have in mind, > > e.g.: requiring that no multiple results are returned with the same > > document > > id. > > > > > > > > 2010/7/23 Pramod Goyal > > > > > I want to do that. But if i understand correctly in solr it would store > > the > > > field like this: > > > > > > p_value: "Pramod" "Raj" > > > p_type: "Client" "Supplier" > > > > > > When i search > > > p_value:"Pramod" AND p_type:"Supplier" > > > > > > it would give me result as document 1. Which is incorrect, since in > > > document > > > 1 Pramod is a Client and not a Supplier. > > > > > > > > > > > > > > > On Fri, Jul 23, 2010 at 11:52 PM, Nagelberg, Kallin < > > > knagelb...@globeandmail.com> wrote: > > > > > > > I think you just want something like: > > > > > > > > p_value:"Pramod" AND p_type:"Supplier" > > > > > > > > no? > > > > -Kallin Nagelberg > > > > > > > > -Original Message- > > > > From: Pramod Goyal [mailto:pramod.go...@gmail.com] > > > > Sent: Friday, July 23, 2010 2:17 PM > > > > To: solr-user@lucene.apache.org > > > > Subject: help with a schema design problem > > > > > > > > Hi, > > > > > > > > Lets say i have table with 3 columns document id Party Value and > Party > > > > Type. > > > > In this table i have 3 rows. 1st row Document id: 1 Party Value: > Pramod > > > > Party Type: Client. 2nd row: Document id: 1 Party Value: Raj Party > > Type: > > > > Supplier. 3rd row Document id:2 Party Value: Pramod Party Type: > > Supplier. > > > > Now in this table if i use SQL its easy for me find all document with > > > Party > > > > Value as Pramod and Party Type as Client. > > > > > > > > I need to design solr schema so that i can do the same in Solr. If i > > > create > > > > 2 fields in solr schema Party value and Party type both of them multi > > > > valued > > > > and try to query +Pramod +Supplier then solr will return me the first > > > > document, even though in the first document Pramod is a client and > not > > a > > > > supplier > > > > Thanks, > > > > Pramod Goyal > > > > > > > > > >
Re: help with a schema design problem
In my case the document id is the unique key( each row is not a unique document ) . So a single document has multiple Party Value and Party Type. Hence i need to define both Party value and Party type as mutli-valued. Is there any way in solr to say p_value[someIndex]="pramod" And p_type[someIndex]="client". Is there any other way i can design my schema ? I have some solutions but none seems to be a good solution. One way would be to define a single field in the schema as p_value_type = "client pramod" i.e. combine the value from both the field and store it in a single field. On Sat, Jul 24, 2010 at 12:18 AM, Geert-Jan Brits wrote: > With the usecase you specified it should work to just index each "Row" as > you described in your initial post to be a seperate document. > This way p_value and p_type all get singlevalued and you get a correct > combination of p_value and p_type. > > However, this may not go so well with other use-cases you have in mind, > e.g.: requiring that no multiple results are returned with the same > document > id. > > > > 2010/7/23 Pramod Goyal > > > I want to do that. But if i understand correctly in solr it would store > the > > field like this: > > > > p_value: "Pramod" "Raj" > > p_type: "Client" "Supplier" > > > > When i search > > p_value:"Pramod" AND p_type:"Supplier" > > > > it would give me result as document 1. Which is incorrect, since in > > document > > 1 Pramod is a Client and not a Supplier. > > > > > > > > > > On Fri, Jul 23, 2010 at 11:52 PM, Nagelberg, Kallin < > > knagelb...@globeandmail.com> wrote: > > > > > I think you just want something like: > > > > > > p_value:"Pramod" AND p_type:"Supplier" > > > > > > no? > > > -Kallin Nagelberg > > > > > > -Original Message- > > > From: Pramod Goyal [mailto:pramod.go...@gmail.com] > > > Sent: Friday, July 23, 2010 2:17 PM > > > To: solr-user@lucene.apache.org > > > Subject: help with a schema design problem > > > > > > Hi, > > > > > > Lets say i have table with 3 columns document id Party Value and Party > > > Type. > > > In this table i have 3 rows. 1st row Document id: 1 Party Value: Pramod > > > Party Type: Client. 2nd row: Document id: 1 Party Value: Raj Party > Type: > > > Supplier. 3rd row Document id:2 Party Value: Pramod Party Type: > Supplier. > > > Now in this table if i use SQL its easy for me find all document with > > Party > > > Value as Pramod and Party Type as Client. > > > > > > I need to design solr schema so that i can do the same in Solr. If i > > create > > > 2 fields in solr schema Party value and Party type both of them multi > > > valued > > > and try to query +Pramod +Supplier then solr will return me the first > > > document, even though in the first document Pramod is a client and not > a > > > supplier > > > Thanks, > > > Pramod Goyal > > > > > >
Re: help with a schema design problem
With the usecase you specified it should work to just index each "Row" as you described in your initial post to be a seperate document. This way p_value and p_type all get singlevalued and you get a correct combination of p_value and p_type. However, this may not go so well with other use-cases you have in mind, e.g.: requiring that no multiple results are returned with the same document id. 2010/7/23 Pramod Goyal > I want to do that. But if i understand correctly in solr it would store the > field like this: > > p_value: "Pramod" "Raj" > p_type: "Client" "Supplier" > > When i search > p_value:"Pramod" AND p_type:"Supplier" > > it would give me result as document 1. Which is incorrect, since in > document > 1 Pramod is a Client and not a Supplier. > > > > > On Fri, Jul 23, 2010 at 11:52 PM, Nagelberg, Kallin < > knagelb...@globeandmail.com> wrote: > > > I think you just want something like: > > > > p_value:"Pramod" AND p_type:"Supplier" > > > > no? > > -Kallin Nagelberg > > > > -Original Message- > > From: Pramod Goyal [mailto:pramod.go...@gmail.com] > > Sent: Friday, July 23, 2010 2:17 PM > > To: solr-user@lucene.apache.org > > Subject: help with a schema design problem > > > > Hi, > > > > Lets say i have table with 3 columns document id Party Value and Party > > Type. > > In this table i have 3 rows. 1st row Document id: 1 Party Value: Pramod > > Party Type: Client. 2nd row: Document id: 1 Party Value: Raj Party Type: > > Supplier. 3rd row Document id:2 Party Value: Pramod Party Type: Supplier. > > Now in this table if i use SQL its easy for me find all document with > Party > > Value as Pramod and Party Type as Client. > > > > I need to design solr schema so that i can do the same in Solr. If i > create > > 2 fields in solr schema Party value and Party type both of them multi > > valued > > and try to query +Pramod +Supplier then solr will return me the first > > document, even though in the first document Pramod is a client and not a > > supplier > > Thanks, > > Pramod Goyal > > >
Re: help with a schema design problem
I want to do that. But if i understand correctly in solr it would store the field like this: p_value: "Pramod" "Raj" p_type: "Client" "Supplier" When i search p_value:"Pramod" AND p_type:"Supplier" it would give me result as document 1. Which is incorrect, since in document 1 Pramod is a Client and not a Supplier. On Fri, Jul 23, 2010 at 11:52 PM, Nagelberg, Kallin < knagelb...@globeandmail.com> wrote: > I think you just want something like: > > p_value:"Pramod" AND p_type:"Supplier" > > no? > -Kallin Nagelberg > > -Original Message- > From: Pramod Goyal [mailto:pramod.go...@gmail.com] > Sent: Friday, July 23, 2010 2:17 PM > To: solr-user@lucene.apache.org > Subject: help with a schema design problem > > Hi, > > Lets say i have table with 3 columns document id Party Value and Party > Type. > In this table i have 3 rows. 1st row Document id: 1 Party Value: Pramod > Party Type: Client. 2nd row: Document id: 1 Party Value: Raj Party Type: > Supplier. 3rd row Document id:2 Party Value: Pramod Party Type: Supplier. > Now in this table if i use SQL its easy for me find all document with Party > Value as Pramod and Party Type as Client. > > I need to design solr schema so that i can do the same in Solr. If i create > 2 fields in solr schema Party value and Party type both of them multi > valued > and try to query +Pramod +Supplier then solr will return me the first > document, even though in the first document Pramod is a client and not a > supplier > Thanks, > Pramod Goyal >
RE: help with a schema design problem
I think you just want something like: p_value:"Pramod" AND p_type:"Supplier" no? -Kallin Nagelberg -Original Message- From: Pramod Goyal [mailto:pramod.go...@gmail.com] Sent: Friday, July 23, 2010 2:17 PM To: solr-user@lucene.apache.org Subject: help with a schema design problem Hi, Lets say i have table with 3 columns document id Party Value and Party Type. In this table i have 3 rows. 1st row Document id: 1 Party Value: Pramod Party Type: Client. 2nd row: Document id: 1 Party Value: Raj Party Type: Supplier. 3rd row Document id:2 Party Value: Pramod Party Type: Supplier. Now in this table if i use SQL its easy for me find all document with Party Value as Pramod and Party Type as Client. I need to design solr schema so that i can do the same in Solr. If i create 2 fields in solr schema Party value and Party type both of them multi valued and try to query +Pramod +Supplier then solr will return me the first document, even though in the first document Pramod is a client and not a supplier Thanks, Pramod Goyal