|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Multiple values for custom fields provided in SOLR queryHi,
I have a requirement in which i need to have multiple values in my custom fields while forming the search query to SOLR. For example, fileID is my custom field. I have defined the fileID in schema.xml as <field name="fileID" type="string" indexed="true" stored="true" required="true" multiValued="true"/>. Now fileID can have multiple values like 111,222,333 etc. So will my query be of the form, q=+fileID:111+fileID:222+fileID:333+apple where apple is my search query string. I tried with the above query but it did not work. SOLR gave invalid query error. Basically the requirement is , if fileIDs are provided as search parameter then search should happen on the basis of fileID. Is my approach correct or i need to do something else? Please, if immediate help is provided then that would be great. Regards Suryasnat Das Infosys. |
|
|
Re: Multiple values for custom fields provided in SOLR queryI actually don't fully understand your question. q=+fileID:111+fileID:222+fileID:333+apple looks like a valid query to me. (not sure what that space encoded as + is, though) Also not sure what you mean by: > Basically the requirement is , if fileIDs are provided as search parameter > then search should happen on the basis of fileID. Do you mean "apple" should be ignored if a term (field name:field value) is provided? Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch ----- Original Message ---- > From: Suryasnat Das <suryaatwork@...> > To: solr-user@... > Sent: Monday, July 6, 2009 11:31:10 AM > Subject: Multiple values for custom fields provided in SOLR query > > Hi, > I have a requirement in which i need to have multiple values in my custom > fields while forming the search query to SOLR. For example, > fileID is my custom field. I have defined the fileID in schema.xml as > name="fileID" type="string" indexed="true" stored="true" required="true" > multiValued="true"/>. > Now fileID can have multiple values like 111,222,333 etc. So will my query > be of the form, > > q=+fileID:111+fileID:222+fileID:333+apple > > where apple is my search query string. I tried with the above query but it > did not work. SOLR gave invalid query error. > Basically the requirement is , if fileIDs are provided as search parameter > then search should happen on the basis of fileID. > > Is my approach correct or i need to do something else? Please, if immediate > help is provided then that would be great. > > Regards > Suryasnat Das > Infosys. |
|
|
Re: Multiple values for custom fields provided in SOLR queryHi Otis,
Thanks for replying to my query. My query is, if multiple values are provided for a custom field then how can it be represented in a SOLR query. So if my field is fileID and its values are 111, 222 and 333 and my search string is ‘product’ then how can this be represented in a SOLR query? I want to perform the search on basis of fileIDs *and* search string provided. If i provide the query in the format, q=fileID:111+fileID:222+fileID:333+product, then how will it actually search? Can you please provide me the correct format of the query? Regards Suryasnat Das On Mon, Jul 6, 2009 at 10:05 PM, Otis Gospodnetic < otis_gospodnetic@...> wrote: > > I actually don't fully understand your question. > q=+fileID:111+fileID:222+fileID:333+apple looks like a valid query to me. > (not sure what that space encoded as + is, though) > > Also not sure what you mean by: > > Basically the requirement is , if fileIDs are provided as search > parameter > > then search should happen on the basis of fileID. > > > Do you mean "apple" should be ignored if a term (field name:field value) is > provided? > > Otis > -- > Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch > > > > ----- Original Message ---- > > From: Suryasnat Das <suryaatwork@...> > > To: solr-user@... > > Sent: Monday, July 6, 2009 11:31:10 AM > > Subject: Multiple values for custom fields provided in SOLR query > > > > Hi, > > I have a requirement in which i need to have multiple values in my custom > > fields while forming the search query to SOLR. For example, > > fileID is my custom field. I have defined the fileID in schema.xml as > > name="fileID" type="string" indexed="true" stored="true" required="true" > > multiValued="true"/>. > > Now fileID can have multiple values like 111,222,333 etc. So will my > query > > be of the form, > > > > q=+fileID:111+fileID:222+fileID:333+apple > > > > where apple is my search query string. I tried with the above query but > it > > did not work. SOLR gave invalid query error. > > Basically the requirement is , if fileIDs are provided as search > parameter > > then search should happen on the basis of fileID. > > > > Is my approach correct or i need to do something else? Please, if > immediate > > help is provided then that would be great. > > > > Regards > > Suryasnat Das > > Infosys. > > |
|
|
Re: Multiple values for custom fields provided in SOLR querySuryasnat, I suggest you go to your Solr Admin page and run a few searches from there, using Lucene query syntax (link on Lucene site). e.g. fieldID:111 AND fieldID:222 AND fieldID:333 AND foo:product then eplace ANDs with ORs where appropriate That should give you an idea/feel about which query you need. Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch ----- Original Message ---- > From: Suryasnat Das <suryaatwork@...> > To: solr-user@... > Sent: Tuesday, July 7, 2009 12:16:30 PM > Subject: Re: Multiple values for custom fields provided in SOLR query > > Hi Otis, > > Thanks for replying to my query. > > My query is, if multiple values are provided for a custom field then how can > it be represented in a SOLR query. So if my field is fileID and its values > are 111, 222 and 333 and my search string is ‘product’ then how can this be > represented in a SOLR query? I want to perform the search on basis of > fileIDs *and* search string provided. > > If i provide the query in the format, > q=fileID:111+fileID:222+fileID:333+product, then how will it actually > search? Can you please provide me the correct format of the query? > > Regards > > Suryasnat Das > > On Mon, Jul 6, 2009 at 10:05 PM, Otis Gospodnetic < > otis_gospodnetic@...> wrote: > > > > > I actually don't fully understand your question. > > q=+fileID:111+fileID:222+fileID:333+apple looks like a valid query to me. > > (not sure what that space encoded as + is, though) > > > > Also not sure what you mean by: > > > Basically the requirement is , if fileIDs are provided as search > > parameter > > > then search should happen on the basis of fileID. > > > > > > Do you mean "apple" should be ignored if a term (field name:field value) is > > provided? > > > > Otis > > -- > > Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch > > > > > > > > ----- Original Message ---- > > > From: Suryasnat Das > > > To: solr-user@... > > > Sent: Monday, July 6, 2009 11:31:10 AM > > > Subject: Multiple values for custom fields provided in SOLR query > > > > > > Hi, > > > I have a requirement in which i need to have multiple values in my custom > > > fields while forming the search query to SOLR. For example, > > > fileID is my custom field. I have defined the fileID in schema.xml as > > > name="fileID" type="string" indexed="true" stored="true" required="true" > > > multiValued="true"/>. > > > Now fileID can have multiple values like 111,222,333 etc. So will my > > query > > > be of the form, > > > > > > q=+fileID:111+fileID:222+fileID:333+apple > > > > > > where apple is my search query string. I tried with the above query but > > it > > > did not work. SOLR gave invalid query error. > > > Basically the requirement is , if fileIDs are provided as search > > parameter > > > then search should happen on the basis of fileID. > > > > > > Is my approach correct or i need to do something else? Please, if > > immediate > > > help is provided then that would be great. > > > > > > Regards > > > Suryasnat Das > > > Infosys. > > > > |
| Free embeddable forum powered by Nabble | Forum Help |