2 Replies Latest reply on Oct 2, 2013 6:25 PM by Yury Brigadirenko

    Problem with full text search and bind variable

    Yury Brigadirenko Newbie

      Hi.

       

      I'm trying full text search with query:

      SELECT s.*
      FROM [service:Service] as s
      WHERE contains(s.*, $text)
      

       

      bind $text variable with 'wow' value, execute query and result is empty. Repository contains document with property 'wow'.

       

      when executing query lucene query looks like:

      +(::wks:system ::wks:default) +::fts:"text" +jcr:primaryType:service:Service

      but proper query is:

      +(::wks:system ::wks:default) +::fts:"wow" +jcr:primaryType:service:Service

       

      probably problem is here:

      https://github.com/rhauch/modeshape/blob/master/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanUtil.java#L…

       

      here is new FullTextSearch object, but without field StaticOperand expression

      and when call getFullTextSearchExpression(https://github.com/rhauch/modeshape/blob/master/modeshape-jcr/src/main/java/org/modeshape/jcr/query/model/FullTextSearch…) expression replaced by Literal (proper expression is BindVariableName).

       

      fix for this:

      replace https://github.com/rhauch/modeshape/blob/master/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanUtil.java#L813 and https://github.com/rhauch/modeshape/blob/master/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanUtil.java#L…

      with

      return new FullTextSearch(newSelectorName, search.getPropertyName(), search.getFullTextSearchExpression(), null);