java.lang.Object
ch.tocco.nice2.persist.core.impl.hibernate.query.likeall.LikeAllFunction
All Implemented Interfaces:
QueryFunction

@Component public class LikeAllFunction extends Object implements QueryFunction
Implementation of our old "fulltext-search" function.

Example query:

     find Address where crosslike("word", fieldname1, fieldname2, fieldname3)
 
The crosslike function will translate this query into a OR combination comparing each field name against the string literal using EquationNode.Operator.LIKE.

So the example from above is transalted to this:

    fieldname1~"word1" or fieldname2~"word1" or fieldname3~"word1"
 

In case a path contains references to relations, this function partitions the crosslike among equal path names.

  • Constructor Details

    • LikeAllFunction

      public LikeAllFunction()
  • Method Details

    • getName

      public String getName()
      Description copied from interface: QueryFunction
      The unique function name.
      Specified by:
      getName in interface QueryFunction
    • postCompile

      public Node postCompile(Cursor cursor, FuncallNode functionRoot, EntityModel entityModel) throws Exception
      Description copied from interface: QueryFunction
      Applies this function to the given (sub)tree.
      Specified by:
      postCompile in interface QueryFunction
      Throws:
      Exception
    • partitionLike

      public Node partitionLike(NodeContainer container)
      Partitions the children (actually the function's arguments) into a set of OR nodes each containing the children that belong to the same path set.

      It creates and returns a new OR node containing itself OR nodes that represent the partitions. Each nested OR node contains a subset of the children of the specified container.