Skip to content

Cannot recognize keyword's array if term contains spaces " " #34

@terrynguyen255

Description

@terrynguyen255

Hi @nepsilon ,

Thank you for your work on this awesome package.
I'd like to report an issue I found:

Code:

const parsedParams = advancedSearchParser.parse(
  `sentFrom:"Harry Potter","Hermione Granger","Ron Weasley" you are a wizard`,
  {
    alwaysArray: true,
    keywords: ['sentFrom'],
    offsets: false
  }
);

Reality:

{
  text: ',"Hermione Granger","Ron Weasley you are a wizard',
  sentFrom: [ 'Harry Potter' ],
  exclude: {}
}

Expectation:

{
  text: 'you are a wizard',
  sentFrom: [ 'Harry Potter', 'Hermione Granger', 'Ron Weasley' ],
  exclude: {}
}

These work-around cases work, but sometime we just cannot walk around:

sentFrom:Harry,Hermione,Ron you are a wizard
sentFrom:"Harry Potter" sentFrom:"Hermione Granger" sentFrom:"Ron Weasley" you are a wizard

Thank you for your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions