You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Romita Saha <Ro...@sg.panasonic.com> on 2012/11/02 05:21:21 UTC

solr search issue

Hi,

I am trying to search a database . In my database I have a field level2.

My query: 
http://localhost:8983/solr/db/select/?defType=dismax&q=search%20level2&qf=data%20id^2%20&start=0&rows=11&fl=data,id

When I make the above query, I do not get any response. However I get the 
require the response when I do  the following query:

http://localhost:8983/solr/db/select/?defType=dismax&q=search%20level 
2&qf=data%20id^2%20&start=0&rows=11&fl=data,id 

The only difference in the two queries are: 

previous query: search for level2
new query: search for level 2 (whitespace between level and 2)

Note: My database has field name as level2 (no space between level and 2)

Could anybody please explain?

Thanks and regards,
Romita 

Re: solr search issue

Posted by Jack Krupansky <ja...@basetechnology.com>.
An id field simply uniquely identifies a row or document. It sounds like you 
are trying to use "id" as if it were a "type" field. Generally, one would 
not "search in id field" other than to select a specific row/document.

It is rather unhelpful to label a column/field as "data" - that conveys no 
useful information to the reader. Pick a term that DESCRIBES the purpose of 
the "data".

Finally, be aware that the default operator is "OR", so if your query has 
two or more terms (or is a composite term that gets split into two or more 
terms), then you will get ALL documents that match ANY of the terms. If you 
want ONLY the documents that match ALL of the terms, set the default query 
operator (q.op) to "AND".

-- Jack Krupansky

-----Original Message----- 
From: Romita Saha
Sent: Friday, November 02, 2012 4:01 AM
To: solr-user@lucene.apache.org
Subject: Re: solr search issue

Hi,

I am new to solr. Could you kindly explain a bit about defining free text
search.

In my database I have two columns. One is id another is data.
I want my query to spread across multiple fields. When i search for a
parameter from id filed, it searches it in both the fields. However
whenever I search a parameter from data field, it only searches in data.
Below is my query.

http://localhost:8983/solr/db/select/?defType=dismax&q=2&qf=data
id^2&start=0&rows=11&fl=data,id

In my table, id=2 for data=level2.
                       id=4 for data=cashier2.

When I search q=2&qf=data id, it searches for '2' in data field also and
gives me both the results i.e data=level2 and data=cashier2.
However, when i search for q=cashier2&qf=data id, it only gives me result
as data=cashier2 and not data=level2 (please note that id=2 for data =
level2. Ideally it should break the query into cashier+2 and search in id
field as well)


Thanks and regards,
Romita Saha

Panasonic R&D Center Singapore
Blk 1022 Tai Seng Avenue #06-3530
Tai Seng Ind. Est. Singapore 534415
DID: (65) 6550 5383 FAX: (65) 6550 5459
email: romita.saha@sg.panasonic.com



From:   Erick Erickson <er...@gmail.com>
To:     solr-user@lucene.apache.org,
Date:   11/02/2012 02:42 PM
Subject:        Re: solr search issue



First, define a "free text search". If what you're after is that your
terms
(i.e. q=term1 term2) get spread
across multiple fields, simply add them to your qf parameter
(qf=field1,field2). If you want the terms
bound to a particular field, it's just the usual q=field:term, in which
case any field term does NOT get
spread amongst all the fields in your qf parameter.

Best
Erick


On Fri, Nov 2, 2012 at 1:56 AM, Romita Saha
<Ro...@sg.panasonic.com>wrote:

> Hi,
>
> Thank you for your reply. What if I want to do a free text search?
>
> Thanks and regards,
> Romita
>
>
> From:   Gora Mohanty <go...@mimirtech.com>
> To:     solr-user@lucene.apache.org,
> Date:   11/02/2012 12:36 PM
> Subject:        Re: solr search issue
>
>
>
> On 2 November 2012 09:51, Romita Saha <Ro...@sg.panasonic.com>
> wrote:
> >
> > Hi,
> >
> > I am trying to search a database . In my database I have a field
level2.
> >
> > My query:
> >
>
>
http://localhost:8983/solr/db/select/?defType=dismax&q=search%20level2&qf=data%20id

> ^2%20&start=0&rows=11&fl=data,id
>
>
> Where did you get this syntax from? If you want to search just on the
> field level2, you should have:
> http://localhost:8983/solr/db/select/?q=term&defType=dismax&qf=level2
> where "term" is your search term. (I have omitted boosts, and extra
> parameters.)
>
> Regards,
> Gora
>
>


Re: solr search issue

Posted by Erick Erickson <er...@gmail.com>.
You really need to spend some time becoming familiar with
1> the results of putting &debugQuery=on in your queries in order to see
how your query terms are spread across various fields.
2> the admin/analysis page to understand field tokenization.

>From your message, it looks like you're confusing several issues, analysis
and query parsing in particular.

For instance, your "id" field is probably a string. Which is completely
unanalyzed. Your data field may well have
something called WordDelimiterFilterFactory in it, which splits numbers and
letters into two tokens that are treated
independently. Do you know if this is occurring? If you look at the debug
output, you'll start to get a feel for this.

Second. Edismax happily allows field qualification, so you can enter
something like q=data:level2 if that is what
you want.

Best
Erick


On Fri, Nov 2, 2012 at 4:01 AM, Romita Saha <Ro...@sg.panasonic.com>wrote:

> Hi,
>
> I am new to solr. Could you kindly explain a bit about defining free text
> search.
>
> In my database I have two columns. One is id another is data.
> I want my query to spread across multiple fields. When i search for a
> parameter from id filed, it searches it in both the fields. However
> whenever I search a parameter from data field, it only searches in data.
> Below is my query.
>
> http://localhost:8983/solr/db/select/?defType=dismax&q=2&qf=data
> id^2&start=0&rows=11&fl=data,id
>
> In my table, id=2 for data=level2.
>                        id=4 for data=cashier2.
>
> When I search q=2&qf=data id, it searches for '2' in data field also and
> gives me both the results i.e data=level2 and data=cashier2.
> However, when i search for q=cashier2&qf=data id, it only gives me result
> as data=cashier2 and not data=level2 (please note that id=2 for data =
> level2. Ideally it should break the query into cashier+2 and search in id
> field as well)
>
>
> Thanks and regards,
> Romita Saha
>
> Panasonic R&D Center Singapore
> Blk 1022 Tai Seng Avenue #06-3530
> Tai Seng Ind. Est. Singapore 534415
> DID: (65) 6550 5383 FAX: (65) 6550 5459
> email: romita.saha@sg.panasonic.com
>
>
>
> From:   Erick Erickson <er...@gmail.com>
> To:     solr-user@lucene.apache.org,
> Date:   11/02/2012 02:42 PM
> Subject:        Re: solr search issue
>
>
>
> First, define a "free text search". If what you're after is that your
> terms
> (i.e. q=term1 term2) get spread
> across multiple fields, simply add them to your qf parameter
> (qf=field1,field2). If you want the terms
> bound to a particular field, it's just the usual q=field:term, in which
> case any field term does NOT get
> spread amongst all the fields in your qf parameter.
>
> Best
> Erick
>
>
> On Fri, Nov 2, 2012 at 1:56 AM, Romita Saha
> <Ro...@sg.panasonic.com>wrote:
>
> > Hi,
> >
> > Thank you for your reply. What if I want to do a free text search?
> >
> > Thanks and regards,
> > Romita
> >
> >
> > From:   Gora Mohanty <go...@mimirtech.com>
> > To:     solr-user@lucene.apache.org,
> > Date:   11/02/2012 12:36 PM
> > Subject:        Re: solr search issue
> >
> >
> >
> > On 2 November 2012 09:51, Romita Saha <Ro...@sg.panasonic.com>
> > wrote:
> > >
> > > Hi,
> > >
> > > I am trying to search a database . In my database I have a field
> level2.
> > >
> > > My query:
> > >
> >
> >
>
> http://localhost:8983/solr/db/select/?defType=dismax&q=search%20level2&qf=data%20id
>
> > ^2%20&start=0&rows=11&fl=data,id
> >
> >
> > Where did you get this syntax from? If you want to search just on the
> > field level2, you should have:
> > http://localhost:8983/solr/db/select/?q=term&defType=dismax&qf=level2
> > where "term" is your search term. (I have omitted boosts, and extra
> > parameters.)
> >
> > Regards,
> > Gora
> >
> >
>
>

Re: solr search issue

Posted by Romita Saha <Ro...@sg.panasonic.com>.
Hi,

I am new to solr. Could you kindly explain a bit about defining free text 
search.

In my database I have two columns. One is id another is data.
I want my query to spread across multiple fields. When i search for a 
parameter from id filed, it searches it in both the fields. However 
whenever I search a parameter from data field, it only searches in data. 
Below is my query.

http://localhost:8983/solr/db/select/?defType=dismax&q=2&qf=data 
id^2&start=0&rows=11&fl=data,id

In my table, id=2 for data=level2.
                       id=4 for data=cashier2.

When I search q=2&qf=data id, it searches for '2' in data field also and 
gives me both the results i.e data=level2 and data=cashier2.
However, when i search for q=cashier2&qf=data id, it only gives me result 
as data=cashier2 and not data=level2 (please note that id=2 for data = 
level2. Ideally it should break the query into cashier+2 and search in id 
field as well)


Thanks and regards,
Romita Saha

Panasonic R&D Center Singapore
Blk 1022 Tai Seng Avenue #06-3530
Tai Seng Ind. Est. Singapore 534415
DID: (65) 6550 5383 FAX: (65) 6550 5459
email: romita.saha@sg.panasonic.com



From:   Erick Erickson <er...@gmail.com>
To:     solr-user@lucene.apache.org, 
Date:   11/02/2012 02:42 PM
Subject:        Re: solr search issue



First, define a "free text search". If what you're after is that your 
terms
(i.e. q=term1 term2) get spread
across multiple fields, simply add them to your qf parameter
(qf=field1,field2). If you want the terms
bound to a particular field, it's just the usual q=field:term, in which
case any field term does NOT get
spread amongst all the fields in your qf parameter.

Best
Erick


On Fri, Nov 2, 2012 at 1:56 AM, Romita Saha 
<Ro...@sg.panasonic.com>wrote:

> Hi,
>
> Thank you for your reply. What if I want to do a free text search?
>
> Thanks and regards,
> Romita
>
>
> From:   Gora Mohanty <go...@mimirtech.com>
> To:     solr-user@lucene.apache.org,
> Date:   11/02/2012 12:36 PM
> Subject:        Re: solr search issue
>
>
>
> On 2 November 2012 09:51, Romita Saha <Ro...@sg.panasonic.com>
> wrote:
> >
> > Hi,
> >
> > I am trying to search a database . In my database I have a field 
level2.
> >
> > My query:
> >
>
> 
http://localhost:8983/solr/db/select/?defType=dismax&q=search%20level2&qf=data%20id

> ^2%20&start=0&rows=11&fl=data,id
>
>
> Where did you get this syntax from? If you want to search just on the
> field level2, you should have:
> http://localhost:8983/solr/db/select/?q=term&defType=dismax&qf=level2
> where "term" is your search term. (I have omitted boosts, and extra
> parameters.)
>
> Regards,
> Gora
>
>


Re: solr search issue

Posted by Erick Erickson <er...@gmail.com>.
First, define a "free text search". If what you're after is that your terms
(i.e. q=term1 term2) get spread
across multiple fields, simply add them to your qf parameter
(qf=field1,field2). If you want the terms
bound to a particular field, it's just the usual q=field:term, in which
case any field term does NOT get
spread amongst all the fields in your qf parameter.

Best
Erick


On Fri, Nov 2, 2012 at 1:56 AM, Romita Saha <Ro...@sg.panasonic.com>wrote:

> Hi,
>
> Thank you for your reply. What if I want to do a free text search?
>
> Thanks and regards,
> Romita
>
>
> From:   Gora Mohanty <go...@mimirtech.com>
> To:     solr-user@lucene.apache.org,
> Date:   11/02/2012 12:36 PM
> Subject:        Re: solr search issue
>
>
>
> On 2 November 2012 09:51, Romita Saha <Ro...@sg.panasonic.com>
> wrote:
> >
> > Hi,
> >
> > I am trying to search a database . In my database I have a field level2.
> >
> > My query:
> >
>
> http://localhost:8983/solr/db/select/?defType=dismax&q=search%20level2&qf=data%20id
> ^2%20&start=0&rows=11&fl=data,id
>
>
> Where did you get this syntax from? If you want to search just on the
> field level2, you should have:
> http://localhost:8983/solr/db/select/?q=term&defType=dismax&qf=level2
> where "term" is your search term. (I have omitted boosts, and extra
> parameters.)
>
> Regards,
> Gora
>
>

Re: solr search issue

Posted by Romita Saha <Ro...@sg.panasonic.com>.
Hi,

Thank you for your reply. What if I want to do a free text search?

Thanks and regards,
Romita 


From:   Gora Mohanty <go...@mimirtech.com>
To:     solr-user@lucene.apache.org, 
Date:   11/02/2012 12:36 PM
Subject:        Re: solr search issue



On 2 November 2012 09:51, Romita Saha <Ro...@sg.panasonic.com> 
wrote:
>
> Hi,
>
> I am trying to search a database . In my database I have a field level2.
>
> My query:
> 
http://localhost:8983/solr/db/select/?defType=dismax&q=search%20level2&qf=data%20id^2%20&start=0&rows=11&fl=data,id


Where did you get this syntax from? If you want to search just on the
field level2, you should have:
http://localhost:8983/solr/db/select/?q=term&defType=dismax&qf=level2
where "term" is your search term. (I have omitted boosts, and extra
parameters.)

Regards,
Gora


Re: solr search issue

Posted by Gora Mohanty <go...@mimirtech.com>.
On 2 November 2012 09:51, Romita Saha <Ro...@sg.panasonic.com> wrote:
>
> Hi,
>
> I am trying to search a database . In my database I have a field level2.
>
> My query:
> http://localhost:8983/solr/db/select/?defType=dismax&q=search%20level2&qf=data%20id^2%20&start=0&rows=11&fl=data,id

Where did you get this syntax from? If you want to search just on the
field level2, you should have:
http://localhost:8983/solr/db/select/?q=term&defType=dismax&qf=level2
where "term" is your search term. (I have omitted boosts, and extra
parameters.)

Regards,
Gora