simple query help

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

simple query help

xdzgor1
Hi

Can someone please give me some help with a simple query.

If I search
q=skcode:2021051 and flength:368.0

I get 1 document returned (doc A)

If I search
q=skcode:2021049 and ent_no:1040970907

I get 1 document returned (doc B)


But if I search
q=skcode:2021051 and flength:368.0 or skcode:2021049 and ent_no:1040970907

I get no documents returned.

Shouldn't I get both docA and docB?

Thanks,
Peter

Reply | Threaded
Open this post in threaded view
|

Re: simple query help

András Bártházi
Hi,

You should use parantheses, have you tried that?
q=(skcode:2021051 and flength:368.0) or (skcode:2021049 and
ent_no:1040970907)

http://robotlibrarian.billdueber.com/solr-and-boolean-operators/

Bye,
  Andras

2012/5/15 Peter Kirk <[hidden email]>

> Hi
>
> Can someone please give me some help with a simple query.
>
> If I search
> q=skcode:2021051 and flength:368.0
>
> I get 1 document returned (doc A)
>
> If I search
> q=skcode:2021049 and ent_no:1040970907
>
> I get 1 document returned (doc B)
>
>
> But if I search
> q=skcode:2021051 and flength:368.0 or skcode:2021049 and ent_no:1040970907
>
> I get no documents returned.
>
> Shouldn't I get both docA and docB?
>
> Thanks,
> Peter
>
>
Reply | Threaded
Open this post in threaded view
|

RE: simple query help

xdzgor1
Hi - thanks for the response. Yes I have tried with parentheses, to group as you suggest.

It doesn't make a difference. But now I'm thinking there's something completely odd - and I wonder if it's necessary to use a special search-handler to achieve what  I want.

For example, if I execute
q=(skcode:2021051 AND flength:368.0)

I get no results. If I omit the parentheses, I get 1 result. (Let alone trying to combine several Boolean clauses).

/Peter


-----Original Message-----
From: András Bártházi [mailto:[hidden email]]
Sent: 15. maj 2012 12:51
To: [hidden email]
Subject: Re: simple query help

Hi,

You should use parantheses, have you tried that?
q=(skcode:2021051 and flength:368.0) or (skcode:2021049 and
ent_no:1040970907)

http://robotlibrarian.billdueber.com/solr-and-boolean-operators/

Bye,
  Andras

2012/5/15 Peter Kirk <[hidden email]>

> Hi
>
> Can someone please give me some help with a simple query.
>
> If I search
> q=skcode:2021051 and flength:368.0
>
> I get 1 document returned (doc A)
>
> If I search
> q=skcode:2021049 and ent_no:1040970907
>
> I get 1 document returned (doc B)
>
>
> But if I search
> q=skcode:2021051 and flength:368.0 or skcode:2021049 and ent_no:1040970907
>
> I get no documents returned.
>
> Shouldn't I get both docA and docB?
>
> Thanks,
> Peter
>
>

Reply | Threaded
Open this post in threaded view
|

RE: simple query help

iorixxx
> It doesn't make a difference. But now I'm thinking there's
> something completely odd - and I wonder if it's necessary to
> use a special search-handler to achieve what  I want.
>
> For example, if I execute
> q=(skcode:2021051 AND flength:368.0)
>
> I get no results. If I omit the parentheses, I get 1 result.
> (Let alone trying to combine several Boolean clauses).

Which query parser are you using?
Reply | Threaded
Open this post in threaded view
|

Re: simple query help

Péter Király
In reply to this post by András Bártházi
Hi,

it is AND (uppercase) not and (smallcase) (and OR instead of or).

Regards,
Peter

2012/5/15 András Bártházi <[hidden email]>:

> Hi,
>
> You should use parantheses, have you tried that?
> q=(skcode:2021051 and flength:368.0) or (skcode:2021049 and
> ent_no:1040970907)
>
> http://robotlibrarian.billdueber.com/solr-and-boolean-operators/
>
> Bye,
>  Andras
>
> 2012/5/15 Peter Kirk <[hidden email]>
>
>> Hi
>>
>> Can someone please give me some help with a simple query.
>>
>> If I search
>> q=skcode:2021051 and flength:368.0
>>
>> I get 1 document returned (doc A)
>>
>> If I search
>> q=skcode:2021049 and ent_no:1040970907
>>
>> I get 1 document returned (doc B)
>>
>>
>> But if I search
>> q=skcode:2021051 and flength:368.0 or skcode:2021049 and ent_no:1040970907
>>
>> I get no documents returned.
>>
>> Shouldn't I get both docA and docB?
>>
>> Thanks,
>> Peter
>>
>>



--
Péter Király
eXtensible Catalog
http://eXtensibleCatalog.org
http://drupal.org/project/xc
Reply | Threaded
Open this post in threaded view
|

RE: simple query help

xdzgor1
In reply to this post by iorixxx
Hi

If I understand the terms correctly, the search-handler was configured to use "edismax".

The start of the configuration in the solrconfig.xml looks like this:

<requestHandler name="/search" class="solr.SearchHandler" default="true">
    <lst name="defaults">
      <str name="defType">edismax</str>

In any case, when I commented-out the "deftype" entry, and restarted the solr webapp, things began to function as I expected.

But whether or not it was simply the act of restarting - I'm not sure. (I had also found out that "AND " and "OR" should be written in uppercase, but this made no difference until after I had restarted).


Thanks for your time,
Peter



-----Original Message-----
From: Ahmet Arslan [mailto:[hidden email]]
Sent: 15. maj 2012 13:25
To: [hidden email]
Subject: RE: simple query help

> It doesn't make a difference. But now I'm thinking there's something
> completely odd - and I wonder if it's necessary to use a special
> search-handler to achieve what  I want.
>
> For example, if I execute
> q=(skcode:2021051 AND flength:368.0)
>
> I get no results. If I omit the parentheses, I get 1 result.
> (Let alone trying to combine several Boolean clauses).

Which query parser are you using?


Reply | Threaded
Open this post in threaded view
|

Re: simple query help

Jack Krupansky-2
In reply to this post by xdzgor1
Are you using the edismax query parser (which permits lower case "and" and
"or" operators)? If so, there is a bug with parenthesized sub-queries. If
you have a left parenthesis immediately before a field name (which you do in
this case) the query fails. The short-term workaround is to place a space
between the left parenthesis and the field name.

See:
https://issues.apache.org/jira/browse/SOLR-3377

-- Jack Krupansky

-----Original Message-----
From: Peter Kirk
Sent: Tuesday, May 15, 2012 7:04 AM
To: [hidden email]
Subject: RE: simple query help

Hi - thanks for the response. Yes I have tried with parentheses, to group as
you suggest.

It doesn't make a difference. But now I'm thinking there's something
completely odd - and I wonder if it's necessary to use a special
search-handler to achieve what  I want.

For example, if I execute
q=(skcode:2021051 AND flength:368.0)

I get no results. If I omit the parentheses, I get 1 result. (Let alone
trying to combine several Boolean clauses).

/Peter


-----Original Message-----
From: András Bártházi [mailto:[hidden email]]
Sent: 15. maj 2012 12:51
To: [hidden email]
Subject: Re: simple query help

Hi,

You should use parantheses, have you tried that?
q=(skcode:2021051 and flength:368.0) or (skcode:2021049 and
ent_no:1040970907)

http://robotlibrarian.billdueber.com/solr-and-boolean-operators/

Bye,
  Andras

2012/5/15 Peter Kirk <[hidden email]>

> Hi
>
> Can someone please give me some help with a simple query.
>
> If I search
> q=skcode:2021051 and flength:368.0
>
> I get 1 document returned (doc A)
>
> If I search
> q=skcode:2021049 and ent_no:1040970907
>
> I get 1 document returned (doc B)
>
>
> But if I search
> q=skcode:2021051 and flength:368.0 or skcode:2021049 and ent_no:1040970907
>
> I get no documents returned.
>
> Shouldn't I get both docA and docB?
>
> Thanks,
> Peter
>
>

Reply | Threaded
Open this post in threaded view
|

RE: simple query help

iorixxx
In reply to this post by xdzgor1
> But whether or not it was simply the act of restarting - I'm
> not sure. (I had also found out that "AND " and "OR" should
> be written in uppercase, but this made no difference until
> after I had restarted).

By the way, there is a control parameter for this.

"lowercaseOperators A Boolean parameter indicating if lowercase "and" and "or" should be treated the same as operators "AND" and "OR". "

http://lucidworks.lucidimagination.com/display/solr/The+Extended+DisMax+Query+Parser
Reply | Threaded
Open this post in threaded view
|

Re: simple query help

Jack Krupansky-2
In reply to this post by xdzgor1
By removing the defType you reverted to using the traditional Solr/Lucene
query parser which supports the particular query syntax you used (as long as
"AND" is in upper-case) and without the parenthesis bug of edismax.

-- Jack Krupansky

-----Original Message-----
From: Peter Kirk
Sent: Tuesday, May 15, 2012 8:23 AM
To: [hidden email]
Subject: RE: simple query help

Hi

If I understand the terms correctly, the search-handler was configured to
use "edismax".

The start of the configuration in the solrconfig.xml looks like this:

<requestHandler name="/search" class="solr.SearchHandler" default="true">
    <lst name="defaults">
      <str name="defType">edismax</str>

In any case, when I commented-out the "deftype" entry, and restarted the
solr webapp, things began to function as I expected.

But whether or not it was simply the act of restarting - I'm not sure. (I
had also found out that "AND " and "OR" should be written in uppercase, but
this made no difference until after I had restarted).


Thanks for your time,
Peter



-----Original Message-----
From: Ahmet Arslan [mailto:[hidden email]]
Sent: 15. maj 2012 13:25
To: [hidden email]
Subject: RE: simple query help

> It doesn't make a difference. But now I'm thinking there's something
> completely odd - and I wonder if it's necessary to use a special
> search-handler to achieve what  I want.
>
> For example, if I execute
> q=(skcode:2021051 AND flength:368.0)
>
> I get no results. If I omit the parentheses, I get 1 result.
> (Let alone trying to combine several Boolean clauses).

Which query parser are you using?

Reply | Threaded
Open this post in threaded view
|

Re: simple query help

Jack Krupansky-2
In reply to this post by András Bártházi
Yes, the parentheses are needed to prioritize the operator precedence (do
the ANDs and then OR those results.) And, add a space after both left
parentheses to account for the edismax bug.

(https://issues.apache.org/jira/browse/SOLR-3377)

-- Jack Krupansky

-----Original Message-----
From: András Bártházi
Sent: Tuesday, May 15, 2012 6:50 AM
To: [hidden email]
Subject: Re: simple query help

Hi,

You should use parantheses, have you tried that?
q=(skcode:2021051 and flength:368.0) or (skcode:2021049 and
ent_no:1040970907)

http://robotlibrarian.billdueber.com/solr-and-boolean-operators/

Bye,
  Andras

2012/5/15 Peter Kirk <[hidden email]>

> Hi
>
> Can someone please give me some help with a simple query.
>
> If I search
> q=skcode:2021051 and flength:368.0
>
> I get 1 document returned (doc A)
>
> If I search
> q=skcode:2021049 and ent_no:1040970907
>
> I get 1 document returned (doc B)
>
>
> But if I search
> q=skcode:2021051 and flength:368.0 or skcode:2021049 and ent_no:1040970907
>
> I get no documents returned.
>
> Shouldn't I get both docA and docB?
>
> Thanks,
> Peter
>
>