DataStax Help Center

Solr unique key "Lexical error" seen when reindexing a core

Summary

When re-indexing a Solr core an error is seen on the unique key due to incorrect escaping of special characters

Symptoms

The following error is typical of the type of error seen in the /var/log/cassandra/system.log

ERROR [Index WorkPool work thread-30] 2016-05-27 02:03:24,762  Worker.java:57 - org.apache.solr.common.SolrException: org.apache.solr.search.SyntaxError: Cannot parse '_uniqueKey:"[\"b0bbdc56-2043-4182-aa77-23cc5a4f2c46\",\"My Data--10\\"\Key 1\"]"': Lexical error at line 1, column 90.  Encountered: "]" (93), after : ""
org.apache.solr.common.SolrException: org.apache.solr.common.SolrException: org.apache.solr.search.SyntaxError: Cannot parse '_uniqueKey:"[\"b0bbdc56-2043-4182-aa77-23cc5a4f2c46\",\"My Data--10\\" Key 1\"]"': Lexical error at line 1, column 90.  Encountered: "]" (93), after : ""
        at com.datastax.bdp.search.solr.handler.update.CassandraDirectUpdateHandler.deleteByQuery(CassandraDirectUpdateHandler.java:343) ~[dse-4.7.6.jar:4.7.6]
        at com.datastax.bdp.search.solr.AbstractSolrSecondaryIndex.doDelete(AbstractSolrSecondaryIndex.java:716) ~[dse-4.7.6.jar:4.7.6]
        at com.datastax.bdp.search.solr.Cql3SolrSecondaryIndex.updateColumnFamilyIndex(Cql3SolrSecondaryIndex.java:287) ~[dse-4.7.6.jar:4.7.6]
        at com.datastax.bdp.search.solr.AbstractSolrSecondaryIndex$3.run(AbstractSolrSecondaryIndex.java:1025) ~[dse-4.7.6.jar:4.7.6]
        at com.datastax.bdp.concurrent.Worker.run(Worker.java:44) ~[dse-4.7.6.jar:4.7.6]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_66]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_66]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_66]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_66]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_66]
Caused by: org.apache.solr.common.SolrException: org.apache.solr.search.SyntaxError: Cannot parse '_uniqueKey:"[\"b0bbdc56-2043-4182-aa77-23cc5a4f2c46\",\"My Data--10\\" Key 1\"]"': Lexical error at line 1, column 90.  Encountered: "]" (93), after : ""
        at org.apache.solr.update.DirectUpdateHandler2.getQuery(DirectUpdateHandler2.java:400) ~[solr-uber-with-auth_2.0-4.10.3.0.262.jar:na]
        at org.apache.solr.update.DirectUpdateHandler2.deleteByQuery(DirectUpdateHandler2.java:412) ~[solr-uber-with-auth_2.0-4.10.3.0.262.jar:na]
        at com.datastax.bdp.search.solr.handler.update.CassandraDirectUpdateHandler.deleteQuery(CassandraDirectUpdateHandler.java:743) ~[dse-4.7.6.jar:4.7.6]
        at com.datastax.bdp.search.solr.handler.update.CassandraDirectUpdateHandler.deleteByQuery(CassandraDirectUpdateHandler.java:243) ~[dse-4.7.6.jar:4.7.6]
        ... 9 common frames omitted
Caused by: org.apache.solr.search.SyntaxError: Cannot parse '_uniqueKey:"[\"b0bbdc56-2043-4182-aa77-23cc5a4f2c46\",\"My Data--10\\" Key l\"]"': Lexical error at line 1, column 90.  Encountered: "]" (93), after : ""
        at org.apache.solr.parser.SolrQueryParserBase.parse(SolrQueryParserBase.java:158) ~[solr-uber-with-auth_2.0-4.10.3.0.262.jar:na]
        at org.apache.solr.search.LuceneQParser.parse(LuceneQParser.java:50) ~[solr-uber-with-auth_2.0-4.10.3.0.262.jar:na]
        at org.apache.solr.search.QParser.getQuery(QParser.java:142) ~[solr-uber-with-auth_2.0-4.10.3.0.262.jar:na]
        at org.apache.solr.update.DirectUpdateHandler2.getQuery(DirectUpdateHandler2.java:382) ~[solr-uber-with-auth_2.0-4.10.3.0.262.jar:na]
        ... 12 common frames omitted
Caused by: org.apache.solr.parser.TokenMgrError: Lexical error at line 1, column 90.  Encountered: "]" (93), after : ""
        at org.apache.solr.parser.QueryParserTokenManager.getNextToken(QueryParserTokenManager.java:1197) ~[solr-uber-with-auth_2.0-4.10.3.0.262.jar:na]
        at org.apache.solr.parser.QueryParser.jj_scan_token(QueryParser.java:540) ~[solr-uber-with-auth_2.0-4.10.3.0.262.jar:na]
        at org.apache.solr.parser.QueryParser.jj_3R_2(QueryParser.java:423) ~[solr-uber-with-auth_2.0-4.10.3.0.262.jar:na]
        at org.apache.solr.parser.QueryParser.jj_3_1(QueryParser.java:430) ~[solr-uber-with-auth_2.0-4.10.3.0.262.jar:na]
        at org.apache.solr.parser.QueryParser.jj_2_1(QueryParser.java:416) ~[solr-uber-with-auth_2.0-4.10.3.0.262.jar:na]
        at org.apache.solr.parser.QueryParser.Clause(QueryParser.java:154) ~[solr-uber-with-auth_2.0-4.10.3.0.262.jar:na]
        at org.apache.solr.parser.QueryParser.Query(QueryParser.java:139) ~[solr-uber-with-auth_2.0-4.10.3.0.262.jar:na]
        at org.apache.solr.parser.QueryParser.TopLevelQuery(QueryParser.java:96) ~[solr-uber-with-auth_2.0-4.10.3.0.262.jar:na]
        at org.apache.solr.parser.SolrQueryParserBase.parse(SolrQueryParserBase.java:151) ~[solr-uber-with-auth_2.0-4.10.3.0.262.jar:na]
        ... 15 common frames omitted

 

Cause

The issue is caused by incorrect escaping of special characters in the unique key to the Solr core. This is outlined in the following internal jira:

DSP-8884: Document deletion fails due to incorrect escaping of Solr special characters in unique key

Solution

An upgrade is necessary to avoid this problem. The above jira is fixed in the following releases or later : DSE4.6.12, 4.7.8, 4.8.6, 5.0.0

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk