Skip Menu |
 
rt.cpan.org will be shut down on March 1st, 2021.

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)



From koenc [...] dalicon.com Thu Jul 25 05: 31:35 2013
CC: "'K. Cuelenaere'" <koenc [...] dalicon.com>
MIME-Version: 1.0
X-Spam-Status: No, score=-5.549 tagged_above=-99.9 required=10 tests=[AWL=-1.349, BAYES_50=0.8, RCVD_IN_DNSWL_HI=-5] autolearn=ham
X-Spam-Flag: NO
content-type: text/plain; charset="utf-8"; format="flowed"
Message-ID: <51F0F05F.6070300 [...] dalicon.com>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Spam-Score: -5.549
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 90E6124052B for <cpan-bug+search-queryparser-sql [...] hipster.bestpractical.com>; Thu, 25 Jul 2013 05:31:35 -0400 (EDT)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vQlPd2LMj1Gd for <cpan-bug+search-queryparser-sql [...] hipster.bestpractical.com>; Thu, 25 Jul 2013 05:31:30 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 261F92404FC for <bug-search-queryparser-sql [...] rt.cpan.org>; Thu, 25 Jul 2013 05:31:29 -0400 (EDT)
Received: (qmail 4242 invoked by alias); 25 Jul 2013 09:31:29 -0000
Received: from fep17.mx.upcmail.net (HELO fep17.mx.upcmail.net) (62.179.121.37) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Thu, 25 Jul 2013 02:31:23 -0700
Received: from edge02.upcmail.net ([192.168.13.237]) by viefep17-int.chello.at (InterMail vM.8.01.05.05 201-2260-151-110-20120111) with ESMTP id <20130725093118.CUDO8072.viefep17-int.chello.at [...] edge02.upcmail.net>; Thu, 25 Jul 2013 11:31:18 +0200
Received: from [10.0.1.123] ([95.97.92.196]) by edge02.upcmail.net with edge id 4ZXH1m03c4EBnwF02ZXJj2; Thu, 25 Jul 2013 11:31:18 +0200
Delivered-To: cpan-bug+search-queryparser-sql [...] hipster.bestpractical.com
Subject: the dbic output for negations shows problem when combining with other searchs
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6
Return-Path: <koenc [...] dalicon.com>
X-RT-Mail-Extension: search-queryparser-sql
X-Original-To: cpan-bug+search-queryparser-sql [...] hipster.bestpractical.com
X-Spam-Check-BY: la.mx.develooper.com
Date: Thu, 25 Jul 2013 11:31:11 +0200
X-Spam-Level:
X-Sourceip: 95.97.92.196
To: bug-search-queryparser-sql [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Koen Cuelenaere <koenc [...] dalicon.com>
X-RT-Original-Encoding: iso-8859-1
X-RT-Interface: Email
Content-Length: 1642
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
MIME-Version: 1.0
In-Reply-To: <51F0F05F.6070300 [...] dalicon.com>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <51F0F05F.6070300 [...] dalicon.com>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.16-27586-1377055560-1186.87287-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 297
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.