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)



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.
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.
Subject: Re: [rt.cpan.org #47025]
Date: Thu, 25 Jun 2009 10:06:51 +0800
To: bug-Search-QueryParser [...] rt.cpan.org
From: John Maslanik <maz [...] mlx.net>
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. > >
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")