Skip Menu |
 

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

Report information
The Basics
Id: 47025
Status: rejected
Priority: 0/
Queue: Search-QueryParser

People
Owner: Nobody in particular
Requestors: maz [...] mlx.net
Cc:
AdminCc:

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



MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Type: text/plain
Charset: utf8
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 495
Download (untitled) / with headers
text/plain 495b
The last error check of the _parse function checks that there is a positive value. Is it possible to make the check optional? Reason being is I have a search form with multiple fields. Each one of those fields are separately ran through Search::QueryParser. So if I wanted to find all books by rowling that were not Harry Potter books, I could enter rowling in the author field and -"harry potter" in the title field. If I comment out the positive value check, everything works as expected.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-4110-1245893721-1722.47025-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 1074
Le Mer. Jun. 17 00:16:22 2009, https://me.yahoo.com/a/C65XGal9idYkAVpA7fvNCA.qOi8-#33740 a écrit : Show quoted text
> The last error check of the _parse function checks that there is a > positive value. Is it possible to make the check optional? Reason > being is I have a search form with multiple fields. Each one of those > fields are separately ran through Search::QueryParser. So if I wanted > to find all books by rowling that were not Harry Potter books, I could > enter rowling in the author field and -"harry potter" in the title > field. If I comment out the positive value check, everything works as > expected.
Hi, A request without positive value doesn't make sense (Google won't let you do that either). You should join your request fields into a single string BEFORE passing them to QueryParser. I have one application where this is done in javascript on the client-side (onsubmit handler); but of course it can also be done server-side. Once you have a joined string like 'author:rowling -title:"Harry Potter"' then Search::QueryParser will happily parse it.
MIME-Version: 1.0 (Apple Message framework v929.2)
X-Spam-Status: No, hits=-0.0 required=8.0 tests=SPF_PASS
In-Reply-To: <rt-3.6.HEAD-4110-1245893721-1722.47025-6-0 [...] rt.cpan.org>
X-Mailer: Apple Mail (2.929.2)
References: <RT-Ticket-47025 [...] rt.cpan.org> <rt-3.6.HEAD-4110-1245893721-1722.47025-6-0 [...] rt.cpan.org>
X-Virus-Scanned: amavisd-new at squirtle.mlx.net
Message-ID: <0112DB8A-8C3A-4932-A582-CF8E3D30317A [...] mlx.net>
Content-Type: text/plain; charset="utf-8"; delsp="yes"; format="flowed"
X-RT-Original-Encoding: utf-8
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by diesel.bestpractical.com (Postfix) with SMTP id F40264D80D7 for <bug-Search-QueryParser [...] rt.cpan.org>; Wed, 24 Jun 2009 22:07:09 -0400 (EDT)
Received: (qmail 29582 invoked by uid 103); 25 Jun 2009 02:07:09 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 25 Jun 2009 02:07:09 -0000
Received: from squirtle.mlx.net (HELO squirtle.mlx.net) (206.71.172.5) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Wed, 24 Jun 2009 19:07:02 -0700
Received: from localhost (localhost [127.0.0.1]) by squirtle.mlx.net (Postfix) with ESMTP id 84B34528002 for <bug-Search-QueryParser [...] rt.cpan.org>; Wed, 24 Jun 2009 19:06:59 -0700 (PDT)
Received: from squirtle.mlx.net ([127.0.0.1]) by localhost (squirtle.mlx.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vc6XH2ih5lSL for <bug-Search-QueryParser [...] rt.cpan.org>; Wed, 24 Jun 2009 19:06:55 -0700 (PDT)
Received: from [192.168.1.7] (unknown [203.213.220.150]) by squirtle.mlx.net (Postfix) with ESMTP id 8F493528001 for <bug-Search-QueryParser [...] rt.cpan.org>; Wed, 24 Jun 2009 19:06:54 -0700 (PDT)
Delivered-To: cpan-bug+Search-QueryParser [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #47025]
Return-Path: <maz [...] mlx.net>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-Search-QueryParser [...] rt.cpan.org
Date: Thu, 25 Jun 2009 10:06:51 +0800
X-Spam-Level: *
To: bug-Search-QueryParser [...] rt.cpan.org
Content-Transfer-Encoding: quoted-printable
From: John Maslanik <maz [...] mlx.net>
RT-Message-ID: <rt-3.6.HEAD-13950-1245895640-1244.47025-0-0 [...] rt.cpan.org>
Content-Length: 2047
Download (untitled) / with headers
text/plain 1.9k
Laurent, The problem with joining the requested string is that then I have to manually parse the string for quotes, logic operators, etc. Why do that when Search::QueryParser does that already. I am using Search::QueryParser to join the strings. Let me try to explain with a simple example. Here is an example search form: Title: -"Harry Potter" AND - "Goblet" Artist: Rowing (submit) So for each of these fields I create a new query parser object, one for title and one for artist. This is so I do not have to parse the strings. I then combine the results. To put it another way, I am using QP for sub queries, then combining the results to construct the full query. So while something may not be valid for a full query, for a sub query it becomes valid. John On Jun 25, 2009, at 9:35 AM, Laurent Dami via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=47025 > > > Le Mer. Jun. 17 00:16:22 2009, > https://me.yahoo.com/a/C65XGal9idYkAVpA7fvNCA.qOi8-#33740 a écrit :
>> The last error check of the _parse function checks that there is a >> positive value. Is it possible to make the check optional? Reason >> being is I have a search form with multiple fields. Each one of >> those >> fields are separately ran through Search::QueryParser. So if I >> wanted >> to find all books by rowling that were not Harry Potter books, I >> could >> enter rowling in the author field and -"harry potter" in the title >> field. If I comment out the positive value check, everything works >> as >> expected.
> > Hi, > > A request without positive value doesn't make sense (Google won't let > you do that either). > > You should join your request fields into a single string BEFORE > passing > them to QueryParser. I have one application where this is done in > javascript on the client-side (onsubmit handler); but of course it can > also be done server-side. Once you have a joined string like > > 'author:rowling -title:"Harry Potter"' > > then Search::QueryParser will happily parse it. > >
MIME-Version: 1.0
In-Reply-To: <rt-3.6.HEAD-13950-1245895640-1244.47025-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
References: <RT-Ticket-47025 [...] rt.cpan.org> <rt-3.6.HEAD-4110-1245893721-1722.47025-6-0 [...] rt.cpan.org> <0112DB8A-8C3A-4932-A582-CF8E3D30317A [...] mlx.net> <rt-3.6.HEAD-13950-1245895640-1244.47025-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-2295-1254343546-669.47025-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 1201
Download (untitled) / with headers
text/plain 1.1k
Le Mer. Jun. 24 22:07:20 2009, maz@mlx.net a écrit : Show quoted text
> Laurent, > > The problem with joining the requested string is that then I have to > manually parse the string for quotes, logic operators, etc. Why do > that when Search::QueryParser does that already. I am using > Search::QueryParser to join the strings. Let me try to explain with a > simple example. Here is an example search form: > > Title: -"Harry Potter" AND - "Goblet" > Artist: Rowing > (submit) > > So for each of these fields I create a new query parser object, one > for title and one for artist. This is so I do not have to parse the > strings. I then combine the results. To put it another way, I am > using QP for sub queries, then combining the results to construct the > full query. So while something may not be valid for a full query, for > a sub query it becomes valid. > > John
Same answer as before. The job of your form is to collect user input. The job of QueryParser is to parse a whole query. To make them collaborate, join the strings. See for example http://justice.geneve.ch/audiences/aud.tdb or http://justice.geneve.ch/jurisprudence/PH/CAPH/ (and click on "recherche avancée")


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.