Solr
  1. Solr
  2. SOLR-2025

SpellCheckResponse --.ClassCastException: org.apache.solr.common.util.SimpleOrderedMap cannot be cast to java.util.List

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.4.1
    • Fix Version/s: None
    • Component/s: clients - java
    • Labels:
      None

      Description

      org.apache.solr.client.solrj.SolrServerException: Error executing query
      at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:95)
      at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:118)
      ...
      Caused by: java.lang.ClassCastException: org.apache.solr.common.util.SimpleOrderedMap cannot be cast to java.util.List
      at org.apache.solr.client.solrj.response.SpellCheckResponse$Suggestion.<init>(SpellCheckResponse.java:107)
      at org.apache.solr.client.solrj.response.SpellCheckResponse.<init>(SpellCheckResponse.java:51)
      at org.apache.solr.client.solrj.response.QueryResponse.extractSpellCheckInfo(QueryResponse.java:125)
      at org.apache.solr.client.solrj.response.QueryResponse.setResponse(QueryResponse.java:115)
      at org.apache.solr.client.solrj.response.QueryResponse.<init>(QueryResponse.java:80)
      at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:89)

        Activity

        Hide
        Reuben Firmin added a comment - - edited

        RLa asked for more details.

        I snipped some lines (indicated by ...) from our code and the webapp container. Unfortunately the "caused by" exception is cut off by log4j/tomcat/something.

        Here's everything that leads up to the query (flattened out - this is actually in several classes) - hopefully this will give you a path to the cause.

        			StringBuilder builder = new StringBuilder();
        
        			if (StringUtils.isEmpty(name)) {
        				builder.append("*:*");
        			} else {
        
        				if (!fuzzy) {
        					builder.append("+name:\"");
        					builder.append(name);
        					builder.append("\"");
        				} else {
        					builder.append("name:\"");
        					builder.append(name);
        					builder.append("\"");
        
        					builder.append(" nameFuzzy:");
        					builder.append(name);
        				}
        			}
        
        			if (types.length > 0) {
        
        				builder.append(" +type:(");
        
        				builder.append(types[0].name());
        
        				for (int i = 1; i < types.length; i++) {
        					builder.append(" or ");
        					builder.append(types[i].name());
        				}
        
        				builder.append(")");
        
        			}
        
        			SolrQuery query = new SolrQuery();
        			query.setQuery(builder.toString());
        			query.addField("score");
        			query.addSortField("score", SolrQuery.ORDER.desc);
        
                                CommonsHttpSolrServer server = new CommonsHttpSolrServer(url);
                                server.setAllowCompression(true);
        
                                QueryResponse rsp = server.query(query);
        
        
        Show
        Reuben Firmin added a comment - - edited RLa asked for more details. I snipped some lines (indicated by ...) from our code and the webapp container. Unfortunately the "caused by" exception is cut off by log4j/tomcat/something. Here's everything that leads up to the query (flattened out - this is actually in several classes) - hopefully this will give you a path to the cause. StringBuilder builder = new StringBuilder(); if (StringUtils.isEmpty(name)) { builder.append( "*:*" ); } else { if (!fuzzy) { builder.append( "+name:\" "); builder.append(name); builder.append( "\" "); } else { builder.append( "name:\" "); builder.append(name); builder.append( "\" "); builder.append( " nameFuzzy:" ); builder.append(name); } } if (types.length > 0) { builder.append( " +type:(" ); builder.append(types[0].name()); for ( int i = 1; i < types.length; i++) { builder.append( " or " ); builder.append(types[i].name()); } builder.append( ")" ); } SolrQuery query = new SolrQuery(); query.setQuery(builder.toString()); query.addField( "score" ); query.addSortField( "score" , SolrQuery.ORDER.desc); CommonsHttpSolrServer server = new CommonsHttpSolrServer(url); server.setAllowCompression( true ); QueryResponse rsp = server.query(query);
        Hide
        Reuben Firmin added a comment -

        This bug was introduced somewhere between 1.4-dev and 1.4.1. When I run our code with 1.4-dev I don't get the exception; with 1.4.1 I do.

        Show
        Reuben Firmin added a comment - This bug was introduced somewhere between 1.4-dev and 1.4.1. When I run our code with 1.4-dev I don't get the exception; with 1.4.1 I do.
        Reuben Firmin created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Reuben Firmin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development