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.
>
>