Lucy
  1. Lucy
  2. LUCY-209

Lucy::Search::QueryParser set_heed_colons doesn't work as expected with Lucy::Plan::StringType

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      basically, if you have a StringType field and wish to use set_heed_colons on it, it doesn't work as expected as the input into the QueryParser is stemming it.

      e.g. search "type:cats" will stem to "type:cat" and either find no results, or find a different type than the one requested.

      I have a test case I have written for this, as soon as I remember how to use JIRA i'll upload it...

      1. lucy.pl
        3 kB
        mark ellis

        Activity

        Hide
        Marvin Humphrey added a comment -

        > I tried so hard this time to read everything, but there's
        > so much of it!

        Haha, so true.

        On our end, we try hard to design APIs which fail in
        ways which are easy to understand when used improperly –
        but you users are so damn creative!

        Show
        Marvin Humphrey added a comment - > I tried so hard this time to read everything, but there's > so much of it! Haha, so true. On our end, we try hard to design APIs which fail in ways which are easy to understand when used improperly – but you users are so damn creative!
        Hide
        mark ellis added a comment -

        user error...

        Show
        mark ellis added a comment - user error...
        Hide
        mark ellis added a comment -

        Hi Marvin,

        Thanks for the quick reply, and sorry for not reading properly. I tried so hard this time to read everything, but there's so much of it!

        Sorry for being dumb, and thanks for your time though, and excellent work.

        Mark

        Show
        mark ellis added a comment - Hi Marvin, Thanks for the quick reply, and sorry for not reading properly. I tried so hard this time to read everything, but there's so much of it! Sorry for being dumb, and thanks for your time though, and excellent work. Mark
        Hide
        Marvin Humphrey added a comment -

        Hi, Mark...

        The problem arises from this line in the test case:

        my $query_parser = Lucy::Search::QueryParser->new(
            schema => $searcher->get_schema,
            analyzer => $polyanalyzer,   # <-------------- DO NOT WANT
        );
        

        Here's the documentation for the "analyzer" parameter to QueryParser#new
        which explains the behavior you're seeing:

        analyzer - An Analyzer. Ordinarily, the analyzers specified by each field's definition will be used, but if analyzer is supplied, it will override and be used for all fields. This can lead to mismatches between what is in the index and what is being searched for, so use caution.

        If you remove the "analyzer" parameter, all tests pass.

        Show
        Marvin Humphrey added a comment - Hi, Mark... The problem arises from this line in the test case: my $query_parser = Lucy::Search::QueryParser->new( schema => $searcher->get_schema, analyzer => $polyanalyzer, # <-------------- DO NOT WANT ); Here's the documentation for the "analyzer" parameter to QueryParser#new which explains the behavior you're seeing: analyzer - An Analyzer. Ordinarily, the analyzers specified by each field's definition will be used, but if analyzer is supplied, it will override and be used for all fields. This can lead to mismatches between what is in the index and what is being searched for, so use caution. If you remove the "analyzer" parameter, all tests pass.
        Hide
        mark ellis added a comment -

        I'm using Lucy version version 0.002002

        Show
        mark ellis added a comment - I'm using Lucy version version 0.002002

          People

          • Assignee:
            Unassigned
            Reporter:
            mark ellis
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development