Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-2834

SolrJ Field and Document Analyzes Response classes cannot parse CharFilter information

    XMLWordPrintableJSON

Details

    Description

      When using FieldAnalysisRequest.java to analysis a field, a ClassCastExcpetion is thrown if the schema defines the filter org.apache.solr.analysis.HTMLStripCharFilter. The exception is:

      java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
      at org.apache.solr.client.solrj.response.AnalysisResponseBase.buildPhases(AnalysisResponseBase.java:69)
      at org.apache.solr.client.solrj.response.FieldAnalysisResponse.setResponse(FieldAnalysisResponse.java:66)
      at org.apache.solr.client.solrj.request.FieldAnalysisRequest.process(FieldAnalysisRequest.java:107)

      My schema definition is:

      <fieldType name="text" class="solr.TextField" positionIncrementGap="100">
      <analyzer>
      <charFilter class="solr.HTMLStripCharFilterFactory" />
      <tokenizer class="solr.StandardTokenizerFactory" />
      <filter class="solr.StandardFilterFactory" />
      <filter class="solr.TrimFilterFactory" />
      <filter class="solr.LowerCaseFilterFactory" />
      </analyzer>
      </fieldType>

      The response is part is:

      <lst name="query">
      <str name="org.apache.solr.analysis.HTMLStripCharFilter">testing analysis</str>
      <arr name="org.apache.lucene.analysis.standard.StandardTokenizer">
      <lst>...

      A simplistic fix would be to test if the Entry value is an instance of List.

      Attachments

        1. AnalysisResponseBase.patch
          0.9 kB
          Shane
        2. SOLR-2834.patch
          10 kB
          Alexandre Rafalovitch
        3. SOLR-2834.patch
          2 kB
          Shalin Shekhar Mangar

        Issue Links

          Activity

            People

              arafalov Alexandre Rafalovitch
              thrykol Shane
              Votes:
              5 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 5m
                  5m
                  Remaining:
                  Remaining Estimate - 5m
                  5m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified