0

I have a Solr query like this one:

(content_language:English OR content_language:"American French") AND ("Los Angeles" OR Washington)

I am trying to at least have a autocomplete for the "content_language" string but I was not able to make it. Here is my definition for Monarch that I don't know what I am missing:

return {
  defaultToken: 'invalid',
  ignoreCase: true,

  keywords: [
    'content_language'
  ],

  operators: [
    'AND', 'OR'
  ],

  tokenizer: {
    root: [
      {include: '@whitespace'},
      { include: '@strings' },
      [
        /[\w@#$]+/, {
          cases: {
            '@keywords': {token: 'keyword'},
            '@operators': 'operator',
          }
        }
      ]
    ],

    whitespace: [[/\s+/, 'white']],
        strings: [
            [/'/, { token: 'string', next: '@string' }],
            [/"/, { token: 'string.double', next: '@stringDouble' }]
        ],
        string: [
            [/[^']+/, 'string'],
            [/''/, 'string'],
            [/'/, { token: 'string', next: '@pop' }]
        ],
            stringDouble: [
            [/[^"]+/, 'string.double'],
            [/""/, 'string.double'],
            [/"/, { token: 'string.double', next: '@pop' }]
        ],
  },
};
ilhan
  • 8,700
  • 35
  • 117
  • 201

0 Answers0