Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • jake williamson 162 posts 685 karma points
    Sep 04, 2019 @ 02:11
    jake williamson

    v8 examine search by 'parentID' doesn't return any results?!

    hey out there,

    this is a weird one, not sure if it's me or a bug...

    in v7 i used to filter by parent id using +parentID:1172 as a lucene search:

    enter image description here

    however the same query isn't working in v8! i've defo got items in the index e.g.

    enter image description here

    but when i run the search, no items come back...

    enter image description here

    although v8 is missing the toggle between a text search and a lucene search the search seems to accept lucene based searches as something like +__NodeTypeAlias:blogpost +postDateYearAndMonth:2019-sep works:

    enter image description here

    am i missing something obvious here?!?!

  • jake williamson 162 posts 685 karma points
    Sep 04, 2019 @ 05:42
    jake williamson

    ok, so this is interesting. i did some debugging of the search code i'd written and looked at the examine query and it's looks a little weird...

    this is the code:

    var parentId = 2287;
    var query = searcher.CreateQuery("content")
        .Field("__NodeTypeAlias", "BlogPost")
    query.Field("parentID", parentId).And();
    var results = query.All().Execute();
    totalRecords = results.TotalItemCount;

    which generates a lucene query of:

    +__NodeTypeAlias:blogpost +(parentID:[2287 TO 2287])

    and i get results back!

    however, if i take that lucene query and paste it into luke to test the query i get nothing back...

    if i change the query to:

    +__NodeTypeAlias:blogpost parentID:[2287 TO 2287]

    then i get results!

    seriously confused...

  • jake williamson 162 posts 685 karma points
    Sep 04, 2019 @ 05:46
    jake williamson

    the knock on of all this is that at some point i want to be able to do a GroupedOr query e.g.

    get me all the blog posts that have the parentId 1234 or 5678 or 9101

    but GroupedOr only allows strings to be passed to it...

Please Sign in or register to post replies

Write your reply to: