I'm trying to come up with a search interface that works similar to google where you can use query words (see: advanced operators reference) to let you specify specific sub fields in the data.

for example: if I was looking for a customer in ny named jones I could enter something like: "name: jones location: ny"

I'm interested in this approach because the number of potential fields to query can be numerous in my application. Most of the time only a few fields are used, but I'd like to have the power to get to any of the fields on tap if needed.

I've already got the data in a normalized mysql database. I'm confident that I can turn the query words into the SQL I need to get the information out of the database, but don't want to reinvent a parser if someone's already done that already. I know from experience that parsing is always a bunch harder than it looks on the surface.

I've scanned cpan for likely candidates, but can't find anything that seems to be close.

Can anyone point me in the right direction?


In reply to Module suggestions for parsing query words (ala google)? by pffan239

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.