[ 
https://issues.apache.org/jira/browse/SOLR-8541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15102460#comment-15102460
 ] 

ASF subversion and git services commented on SOLR-8541:
-------------------------------------------------------

Commit 1724877 from [~dsmiley] in branch 'dev/branches/branch_5x'
[ https://svn.apache.org/r1724877 ]

LUCENE-6976 SOLR-8541: BytesTermAttributeImpl.copyTo could NPE.
Could be triggered by trying to highlight a spatial RPT field.

> NPE in spatial field highlighting
> ---------------------------------
>
>                 Key: SOLR-8541
>                 URL: https://issues.apache.org/jira/browse/SOLR-8541
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 5.3, 5.4
>            Reporter: Pawel Rog
>            Assignee: David Smiley
>
> I prepared a failing test. This worked for 4.x versions. This fails with 
> different stacktrace on 5.1 and 5.0 versions. I'm not sure if it is related 
> to Solr or Lucene. Since the stack trace is different before 5.2 maybe 
> something changed here SOLR-5855?
> test code:
> {code}
> public class Test extends SolrTestCaseJ4 {
>   @BeforeClass
>   public static void beforeClass() throws Exception {
>     initCore("solrconfig.xml", "schema.xml");
>   }
>   @Test
>   public void testConstantScoreQueryWithFilterPartOnly() {
>     final String[] doc1 = {"id", "1", "location", "56.9485,24.0980"};
>     assertU(adoc(doc1));
>     assertU(commit());
>     ModifiableSolrParams params = new ModifiableSolrParams();
>     params.add("q", "{!geofilt sfield=\"location\" pt=\"56.9484,24.0981\" 
> d=100}");
>     params.add("hl", "true");
>     params.add("hl.fl", "location");
>     assertQ(req(params), "*[count(//doc)=1]", 
> "count(//lst[@name='highlighting']/*)=1");
>   }
> }
> {code}
> solrconfig:
> {code}
> <?xml version="1.0" ?>
> <config><luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
>     <dataDir>${solr.data.dir:}</dataDir>
>     <directoryFactory name="DirectoryFactory" 
> class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
>     <queryResponseWriter name="xml" default="true" 
> class="solr.XMLResponseWriter" />
>     <requestHandler name="/select" class="solr.SearchHandler" />
>     <requestHandler name="/update" class="solr.UpdateRequestHandler"  />
> </config>
> {code}
> schema:
> {code}
> <schema name="example" version="1.1">
>   <fieldType name="string" class="solr.StrField" sortMissingLast="true" 
> omitNorms="true"/>
>   <fieldType name="double" class="solr.TrieDoubleField" 
> sortMissingLast="true" omitNorms="true"/>
>   <fieldType name="int" class="solr.TrieIntField" sortMissingLast="true" 
> omitNorms="true"/>
>   <fieldType name="location_rpt" 
> class="solr.SpatialRecursivePrefixTreeFieldType" units="degrees" geo="true" />
>   <field name="_version_" type="string"/>
>   <field name="id" type="string" required="true"/>
>   <field name="string_field" type="string"/>
>   <field name="double_field" type="double"/>
>   <field name="int_field" type="int"/>
>   <field name="location" type="location_rpt" />
>   <uniqueKey>id</uniqueKey>
>   <defaultSearchField>string_field</defaultSearchField>
> </schema>
> {code}
> This ends up with:
> {code}
> Exception during query
> java.lang.RuntimeException
>       at org.apache.lucene.util.BytesRef.deepCopyOf(BytesRef.java:281)
>       at 
> org.apache.lucene.analysis.tokenattributes.BytesTermAttributeImpl.copyTo(BytesTermAttributeImpl.java:51)
>       at 
> org.apache.lucene.analysis.tokenattributes.BytesTermAttributeImpl.clone(BytesTermAttributeImpl.java:57)
>       at 
> org.apache.lucene.util.AttributeSource$State.clone(AttributeSource.java:55)
>       at 
> org.apache.lucene.util.AttributeSource.captureState(AttributeSource.java:280)
>       at 
> org.apache.lucene.analysis.CachingTokenFilter.fillCache(CachingTokenFilter.java:96)
>       at 
> org.apache.lucene.analysis.CachingTokenFilter.incrementToken(CachingTokenFilter.java:70)
>       at 
> org.apache.lucene.index.memory.MemoryIndex.addField(MemoryIndex.java:452)
>       at 
> org.apache.lucene.index.memory.MemoryIndex.addField(MemoryIndex.java:384)
>       at 
> org.apache.lucene.index.memory.MemoryIndex.addField(MemoryIndex.java:359)
>       at 
> org.apache.lucene.index.memory.MemoryIndex.addField(MemoryIndex.java:339)
>       at 
> org.apache.lucene.search.highlight.WeightedSpanTermExtractor.getLeafContext(WeightedSpanTermExtractor.java:384)
>       at 
> org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extract(WeightedSpanTermExtractor.java:215)
>       at 
> org.apache.lucene.search.highlight.WeightedSpanTermExtractor.getWeightedSpanTerms(WeightedSpanTermExtractor.java:506)
>       at 
> org.apache.lucene.search.highlight.QueryScorer.initExtractor(QueryScorer.java:219)
>       at 
> org.apache.lucene.search.highlight.QueryScorer.init(QueryScorer.java:187)
>       at 
> org.apache.lucene.search.highlight.Highlighter.getBestTextFragments(Highlighter.java:196)
>       at 
> org.apache.solr.highlight.DefaultSolrHighlighter.doHighlightingByHighlighter(DefaultSolrHighlighter.java:595)
>       at 
> org.apache.solr.highlight.DefaultSolrHighlighter.doHighlighting(DefaultSolrHighlighter.java:429)
>       at 
> org.apache.solr.handler.component.HighlightComponent.process(HighlightComponent.java:143)
>       at 
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:273)
>       at 
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:156)
>       at org.apache.solr.core.SolrCore.execute(SolrCore.java:2073)
>       at org.apache.solr.util.TestHarness.query(TestHarness.java:311)
>       at org.apache.solr.util.TestHarness.query(TestHarness.java:293)
>       at org.apache.solr.SolrTestCaseJ4.assertQ(SolrTestCaseJ4.java:725)
>       at org.apache.solr.SolrTestCaseJ4.assertQ(SolrTestCaseJ4.java:718)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to