Skip to content
This repository was archived by the owner on Oct 3, 2026. It is now read-only.
This repository was archived by the owner on Oct 3, 2026. It is now read-only.

Bug in FanoutSearch with net6 #359

Description

@alenas

File:
src\Modules\LIKQ\FanoutSearch\QueryLanguage\ExpressionBuilder.cs

line 22 should be like this (with a type), otherwise it errors out and some unit tests do not pass:
private static readonly MethodInfo s_string_contains = typeof(String).GetMethod("Contains", new Type[] { typeof(String) });

Activity

  1. TaviTruman commented on Aug 16, 2022

    @TaviTruman
    Contributor

    Alenas (@alenas) - I am looking at this right now; what Test Case failed for you?

  2. alenas commented on Aug 16, 2022

    @alenas
    Author

    Most in FanoutSearch.UnitTest.JSONDSLTest (and 2). I ran from Visual Studio compiled with .net 6.0. And I see there are more JSON issues when using Newtonsoft version 13...

  3. TaviTruman commented on Aug 16, 2022

    @TaviTruman
    Contributor

    image

  4. TaviTruman commented on Aug 16, 2022

    @TaviTruman
    Contributor

    I found the actual bug!
    image

    image

    the and_pred has a value of null and the fails in the call:
    return Expression.Condition(GenerateBooleanPredicateExpression(pred_object, icell), action_const, noaction_const);

    in method: GenerateConditionalPredicateExpression

  5. alenas commented on Aug 16, 2022

    @alenas
    Author

    I changed language version to 10 on FanoutSearch (as I left only .net 6 compilation) and I that's why that line is broken for me. but seems like your and_pred is null for similar reasons, I will see how it works in my project.

  6. TaviTruman commented on Aug 16, 2022

    @TaviTruman
    Contributor

    Here is the offending outer code block:

    image

    The call to FanoutSearchDescriptor fails: FanoutSearchDescriptor fanoutSearch_desc = new FanoutSearchDescriptor(queryPath, queryObject);

    Here is the JsonQuery content that fails:

    image

    These LIKQ JsonQuery statements are slightly different:

    image

    The first one fails while the second one works. It looks like the results field is the first statement is expecting a Conditional while the second one is not.

  7. TaviTruman commented on Aug 16, 2022

    @TaviTruman
    Contributor

    Something is not right with the JSON parsing logic. I don't use JsonDSL but do use LambdaDSL and KnowledgeGraph LIKQ dialects and have not had any problems with the .NET 6 version.

  8. alenas commented on Aug 16, 2022

    @alenas
    Author

    I actually changed few other files as well:
    src\Modules\LIKQ\FanoutSearch\Descriptors\FanoutSearchDescriptor.cs
    Line 141 was:
    JObject jobj = JsonConvert.DeserializeObject(m_origin_query);
    changed to:
    var jobj = JObject.Parse(m_origin_query);

    file:
    src\Modules\LIKQ\FanoutSearch\QueryLanguage\Standard.cs
    line 31 was:
    string json_search_body = Newtonsoft.Json.JsonConvert.SerializeObject(search_body);
    changed to:
    string json_search_body;
    if (search_body is string) {
    json_search_body = search_body.ToString();
    } else {
    json_search_body = Newtonsoft.Json.JsonConvert.SerializeObject(search_body);
    }

    at the moment all my test pass. but there is one problem, as I think that JSON message that goes to the server is still not good.
    If I try to use json for start from like this, then I get server response error:

    var search = KnowledgeGraph.StartFrom($@"{{""type"":""Person"",""match"":{{""text"":""{word}""}}}}";);

  9. TaviTruman commented on Aug 16, 2022

    @TaviTruman
    Contributor

    Yeah - I totally don't use Json in any KnowledgeGraph productions:

    • Corrected to match actual working knowledge graph

    This works just fine for me:

            var pathsx = KnowledgeGraph
                .StartFrom(123)
                .FollowEdge("isa_agent")
                .FollowEdge("isa_buyer_lead")
                .VisitNode(_ => _.return_if(_.GetField<string>("rdf_subject").Contains("business_process") == _.has("workflow")), select: new List<string> { "open_house","new_client" })
                .VisitNode(queryPart => queryPart.continue_if(queryPart.has_cell_id(0)))
                    .ToList();
    

    image

  10. TaviTruman commented on Aug 17, 2022

    @TaviTruman
    Contributor

    Alenas (@alenas) not all LIKQ language dialects will process json statements. I am just looking at Lambda DSL, and Json DSL processing as there are some test case failing.

  11. TaviTruman commented on Oct 18, 2022

    @TaviTruman
    Contributor

    Alenas (@alenas) I think I have the fix in place; will need to re-run the existing tests and add a few new tests and the changes to the JSON parser do require some changes to the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions