apex-dev-tools / apex-parser

Salesforce Apex/SOQL/SOSL language parser
Other
15 stars 6 forks source link

SOSL find clause WITH USER_MODE or SYSTEM_MODE #42

Closed adangel closed 6 months ago

adangel commented 6 months ago

Reposting the issue from https://github.com/google/summit-ast/issues/53 here:

apex-parser doesn't support WITH USER_MODE and WITH SYSTEM_MODE when used in SOSL.

The Apex documentation is not clear, because:

Is the following code valid Apex code?

public inherited sharing class soqlExample {

  public static String example(){
    String SecondarySearchList = 'test';

    List<List<SObject>> accountList = [
      FIND :SecondarySearchList
      IN NAME FIELDS
      RETURNING Account(Id, Account.Name WHERE ID = '' LIMIT 100)
      WITH USER_MODE
    ];
  }
}

If yes, then someone needs to update the SOSL documentation and we probably need to enhance the parser: https://github.com/apex-dev-tools/apex-parser/blob/2f9160c4a33e5acf1a9014f0b67de0496df0ff47/antlr/ApexParser.g4#L826-L838

If no, then someone just needs to clarify the Apex documentation and remove the SOSL reference.

kjonescertinia commented 6 months ago

That code can be deployed so think this is an issue that needs fixing. Thanks for highlighting this, will try and get a fix done this week.

pwrightcertinia commented 6 months ago

Fix now available in v4.1.0 release, thanks for the report!