Skip Menu |
 

This queue is for tickets about the Search-QueryParser-SQL CPAN distribution.

Report information
The Basics
Id: 87287
Status: resolved
Priority: 0/
Queue: Search-QueryParser-SQL

People
Owner: karman [...] cpan.org
Requestors: koenc [...] dalicon.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: "'K. Cuelenaere'" <koenc [...] dalicon.com>
Subject: the dbic output for negations shows problem when combining with other searchs
Date: Thu, 25 Jul 2013 11:31:11 +0200
To: bug-search-queryparser-sql [...] rt.cpan.org
From: Koen Cuelenaere <koenc [...] dalicon.com>
Download (untitled) / with headers
text/plain 1.6k
Dear reader, I'm using search-queryparser-sql v0.08, and I'm using this module to construct DBIx::Class type of search structures. This is what I do in my Perl code: my $qp = Search::QueryParser::SQL->new( columns => ['table1.column1', 'table1.column2'], like => 'LIKE', fuzzify2 => 1, ); my $query = $qp->parse("$value", 0); print Dumper $query->dbic; print Dumper $query->stringify; When I search for "butter -milk" This is what I see: as output: $VAR1 = [ ***'-or'***, [ '-or', [ 'table1.column1', { 'LIKE' => '%butter%' }, 'table1.column2', { 'LIKE' => '%butter%' } ], '-and', [ 'table1.column1', { 'NOT LIKE' => '%milk%' }, 'table1.column2', { 'NOT LIKE' => '%milk%' } ] ] ]; $VAR1 = '(table1.column1 LIKE \'%butter%\' OR table1.column2 LIKE \'%butter%\') ***AND*** (table1.column1 NOT LIKE \'%milk%\' AND table1.column2 NOT LIKE \'%milk%\')'; I have marked the problem with stars. The DBIx::Class/dbic/orm version in my opinion shows a bug, as it uses an "or", while the regular SQL version (second output) shows the correct "and". I'll try to work on a fix for it, but you might beat me to it ;) best regards Koen Cuelenaere Dalicon BV
Download (untitled) / with headers
text/plain 297b
Thanks for the thorough bug report. I have fixed it here: https://github.com/karpet/search-queryparser-sql/commit/1b102775b9aea21c252fc9189fef85e183e26f4c and released 0.009 to CPAN. Please let me know if that addresses your problem. (PS Sorry for the delay in response. I've been in transit.)


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.