Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOSL find clause WITH USER_MODE or SYSTEM_MODE #42

Closed
adangel opened this issue Apr 26, 2024 · 2 comments · Fixed by #43
Closed

SOSL find clause WITH USER_MODE or SYSTEM_MODE #42

adangel opened this issue Apr 26, 2024 · 2 comments · Fixed by #43
Assignees

Comments

@adangel
Copy link
Contributor

adangel commented Apr 26, 2024

Reposting the issue from google/summit-ast#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:

soslClauses
: (IN searchGroup)?
(RETURNING fieldSpecList)?
(WITH DIVISION ASSIGN StringLiteral)?
(WITH DATA CATEGORY filteringExpression)?
(WITH SNIPPET (LPAREN TARGET_LENGTH ASSIGN IntegerLiteral RPAREN)? )?
(WITH NETWORK IN LPAREN networkList RPAREN)?
(WITH NETWORK ASSIGN StringLiteral)?
(WITH PRICEBOOKID ASSIGN StringLiteral)?
(WITH METADATA ASSIGN StringLiteral)?
limitClause?
(UPDATE updateList)?
;

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

@kjonescertinia
Copy link
Contributor

kjonescertinia commented May 7, 2024

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.

@nawforce nawforce self-assigned this May 12, 2024
@nawforce nawforce linked a pull request May 12, 2024 that will close this issue
@pwrightcertinia
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants