dismax 1.4.1 and pure negative queries

2011-03-17 Thread Jonathan Rochkind

Should 1.4.1 dismax query parser be able to handle pure negative queries
like:

q=-foo
q=-foo -bar

It kind of seems to me trying it out that it can NOT.  Can anyone else
verify?  The documentation I can find doesn't say one way or another.
Which is odd because the documentation for straight solr-lucene query
parser athttp://wiki.apache.org/solr/SolrQuerySyntax  suggests that
straight solr-lucene query parser_can_  handle pure negative.  That
seems odd that solr-lucene Q.P. can, but dismax can't? Maybe I'm
misinterpreting or misunderstanding my experimental results.




Re: dismax 1.4.1 and pure negative queries

2011-03-17 Thread Markus Jelsma
Hi,

It works just as expected, but not in a phrase query. Get rid of your quotes 
and you'll be fine.

Cheers,

 Should 1.4.1 dismax query parser be able to handle pure negative queries
 like:
 
 q=-foo
 q=-foo -bar
 
 It kind of seems to me trying it out that it can NOT.  Can anyone else
 verify?  The documentation I can find doesn't say one way or another.
 Which is odd because the documentation for straight solr-lucene query
 parser athttp://wiki.apache.org/solr/SolrQuerySyntax  suggests that
 straight solr-lucene query parser_can_  handle pure negative.  That
 seems odd that solr-lucene Q.P. can, but dismax can't? Maybe I'm
 misinterpreting or misunderstanding my experimental results.


Re: dismax 1.4.1 and pure negative queries

2011-03-17 Thread Jonathan Rochkind
My fault for putting in the quotes in the email, I actually don't have 
tests in my quotes, just tried again to make sure.


And I always get 0 results on a pure negative Solr 1.4.1 dismax query. I 
think it does not actually work?


On 3/17/2011 3:52 PM, Markus Jelsma wrote:

Hi,

It works just as expected, but not in a phrase query. Get rid of your quotes
and you'll be fine.

Cheers,


Should 1.4.1 dismax query parser be able to handle pure negative queries
like:

q=-foo
q=-foo -bar

It kind of seems to me trying it out that it can NOT.  Can anyone else
verify?  The documentation I can find doesn't say one way or another.
Which is odd because the documentation for straight solr-lucene query
parser athttp://wiki.apache.org/solr/SolrQuerySyntax  suggests that
straight solr-lucene query parser_can_  handle pure negative.  That
seems odd that solr-lucene Q.P. can, but dismax can't? Maybe I'm
misinterpreting or misunderstanding my experimental results.


Re: dismax 1.4.1 and pure negative queries

2011-03-17 Thread Markus Jelsma
Oh i see, i overlooked your first query. A query with one term that is negated 
will yield zero results, it doesn't return all documents because nothing 
matches. It's, if i remember correctly, the same as when you're looking for a 
field that doesn't have a value: q=-field:[* TO *].

 My fault for putting in the quotes in the email, I actually don't have
 tests in my quotes, just tried again to make sure.
 
 And I always get 0 results on a pure negative Solr 1.4.1 dismax query. I
 think it does not actually work?
 
 On 3/17/2011 3:52 PM, Markus Jelsma wrote:
  Hi,
  
  It works just as expected, but not in a phrase query. Get rid of your
  quotes and you'll be fine.
  
  Cheers,
  
  Should 1.4.1 dismax query parser be able to handle pure negative queries
  like:
  
  q=-foo
  q=-foo -bar
  
  It kind of seems to me trying it out that it can NOT.  Can anyone else
  verify?  The documentation I can find doesn't say one way or another.
  Which is odd because the documentation for straight solr-lucene query
  parser athttp://wiki.apache.org/solr/SolrQuerySyntax  suggests that
  straight solr-lucene query parser_can_  handle pure negative.  That
  seems odd that solr-lucene Q.P. can, but dismax can't? Maybe I'm
  misinterpreting or misunderstanding my experimental results.


Re: dismax 1.4.1 and pure negative queries

2011-03-17 Thread Erik Hatcher
purely negative queries work with Solr's default (lucene) query parser.  But 
don't with dismax.   Or so that seems with my experience testing this out just 
now, on trunk.

In chatting with Jonathan further off-list we discussed having the best of both 
worlds 

   q={!lucene}*:* AND NOT _query_:{!dismax ...}inverse of original negative 
query

But this of course requires detecting that a query is all negative.  edismax 
can handle purely negative, FWIW, -ipod = +(-DisjunctionMaxQuery((text:ipod)) 
+MatchAllDocsQuery(*:*))

Erik



On Mar 17, 2011, at 16:45 , Markus Jelsma wrote:

 Oh i see, i overlooked your first query. A query with one term that is 
 negated 
 will yield zero results, it doesn't return all documents because nothing 
 matches. It's, if i remember correctly, the same as when you're looking for a 
 field that doesn't have a value: q=-field:[* TO *].
 
 My fault for putting in the quotes in the email, I actually don't have
 tests in my quotes, just tried again to make sure.
 
 And I always get 0 results on a pure negative Solr 1.4.1 dismax query. I
 think it does not actually work?
 
 On 3/17/2011 3:52 PM, Markus Jelsma wrote:
 Hi,
 
 It works just as expected, but not in a phrase query. Get rid of your
 quotes and you'll be fine.
 
 Cheers,
 
 Should 1.4.1 dismax query parser be able to handle pure negative queries
 like:
 
 q=-foo
 q=-foo -bar
 
 It kind of seems to me trying it out that it can NOT.  Can anyone else
 verify?  The documentation I can find doesn't say one way or another.
 Which is odd because the documentation for straight solr-lucene query
 parser athttp://wiki.apache.org/solr/SolrQuerySyntax  suggests that
 straight solr-lucene query parser_can_  handle pure negative.  That
 seems odd that solr-lucene Q.P. can, but dismax can't? Maybe I'm
 misinterpreting or misunderstanding my experimental results.



Re: dismax 1.4.1 and pure negative queries

2011-03-17 Thread Jonathan Rochkind
Yeah, looks to me like two or more negated terms does the same thing, 
not just one.


q=-foo -bar -baz

Also always returns zero hits. For the same reason. I understand why 
(sort of), although at the same time there is a logical answer to this 
question -foo -bar -baz, and oddly, 1.4.1 _lucene_ query parser _can_ 
handle it.


Erik Hatcher in IRC gave me one transformation of this query that still 
uses dismax as a unit, but can get you a solution.  (I want to use 
dismax in this case for it's convenient aggregation of multiple fields 
in qf, not so much for actual disjunction-maximum behavior).


defType=lucene
q=*:* AND NOT _query_:{!dismax} foo bar baz

I might be able to work with that in my situation.  But it also seems 
like something that dismax could take care of for you in such a 
situation. It looks from the documentation like the newer (not in 1.4.1) 
edismax does in at least some cases, where the pure negative query is 
inside grouping/subquery parens, it's not clear to me if it does it in 
general or not.


On 3/17/2011 4:45 PM, Markus Jelsma wrote:

Oh i see, i overlooked your first query. A query with one term that is negated
will yield zero results, it doesn't return all documents because nothing
matches. It's, if i remember correctly, the same as when you're looking for a
field that doesn't have a value: q=-field:[* TO *].


My fault for putting in the quotes in the email, I actually don't have
tests in my quotes, just tried again to make sure.

And I always get 0 results on a pure negative Solr 1.4.1 dismax query. I
think it does not actually work?

On 3/17/2011 3:52 PM, Markus Jelsma wrote:

Hi,

It works just as expected, but not in a phrase query. Get rid of your
quotes and you'll be fine.

Cheers,


Should 1.4.1 dismax query parser be able to handle pure negative queries
like:

q=-foo
q=-foo -bar

It kind of seems to me trying it out that it can NOT.  Can anyone else
verify?  The documentation I can find doesn't say one way or another.
Which is odd because the documentation for straight solr-lucene query
parser athttp://wiki.apache.org/solr/SolrQuerySyntax  suggests that
straight solr-lucene query parser_can_  handle pure negative.  That
seems odd that solr-lucene Q.P. can, but dismax can't? Maybe I'm
misinterpreting or misunderstanding my experimental results.


Re: dismax 1.4.1 and pure negative queries

2011-03-17 Thread Jonathan Rochkind

On 3/17/2011 5:02 PM, Jonathan Rochkind wrote:

defType=lucene
q=*:* AND NOT _query_:{!dismax} foo bar baz



Oops, forgot a part, for anyone reading this and wanting to use it as a 
solution.


You can transform:

$defType=dismax
q=-foo -bar -baz

To:

defType=lucene
q=*:* AND NOT _query_:{!dismax mm=1}foo bar baz

And have basically equivalent semantics to what you meant but which 
dismax won't do.  The mm=1 is important, left that out before.


Jonathan



I might be able to work with that in my situation.  But it also seems
like something that dismax could take care of for you in such a
situation. It looks from the documentation like the newer (not in 1.4.1)
edismax does in at least some cases, where the pure negative query is
inside grouping/subquery parens, it's not clear to me if it does it in
general or not.

On 3/17/2011 4:45 PM, Markus Jelsma wrote:

Oh i see, i overlooked your first query. A query with one term that is negated
will yield zero results, it doesn't return all documents because nothing
matches. It's, if i remember correctly, the same as when you're looking for a
field that doesn't have a value: q=-field:[* TO *].


My fault for putting in the quotes in the email, I actually don't have
tests in my quotes, just tried again to make sure.

And I always get 0 results on a pure negative Solr 1.4.1 dismax query. I
think it does not actually work?

On 3/17/2011 3:52 PM, Markus Jelsma wrote:

Hi,

It works just as expected, but not in a phrase query. Get rid of your
quotes and you'll be fine.

Cheers,


Should 1.4.1 dismax query parser be able to handle pure negative queries
like:

q=-foo
q=-foo -bar

It kind of seems to me trying it out that it can NOT.  Can anyone else
verify?  The documentation I can find doesn't say one way or another.
Which is odd because the documentation for straight solr-lucene query
parser athttp://wiki.apache.org/solr/SolrQuerySyntax  suggests that
straight solr-lucene query parser_can_  handle pure negative.  That
seems odd that solr-lucene Q.P. can, but dismax can't? Maybe I'm
misinterpreting or misunderstanding my experimental results.