lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Wolanin (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (LUCENE-1500) Highlighter throws StringIndexOutOfBoundsException
Date Tue, 24 Feb 2009 21:39:03 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-1500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12676421#action_12676421
] 

pwolanin edited comment on LUCENE-1500 at 2/24/09 1:37 PM:
----------------------------------------------------------------

I have run into this issue over the last couple days.  Also using Solr, but the error is triggered
by content that has multi-byte characters (such as German).

It seems that somewhere lucene is counting bytes instead of characters, so each substring
the highlighter tries to select is offset further forward in the string being matched.

here's an example trying to highlight the string 'Drupaltalk' with "strong" tags
{code}
<p class="search-snippet">
 Community ist - und dieses Portal Dr<strong>upaltalk.d</strong>e samt seinem
schon eifrigen Benutzer- und Gästezulauf ( ... 
 nter "Dru<strong>paltalk001</strong>" könnt Ihr die erste Konferenz noch mal
nachhören und erfahren, wie Selbstorganisation in der Drupal Szene funktioniert.  
 "Dru<strong>paltalk002</strong>" ist dann der Talk vom Dienstag zum Thema "Drupal
Al</p>
{code}
        
So the attached patch would probably avoid the exception (and is a good idea) but would not
fix the bug I'm seeing.

      was (Author: pwolanin):
    I have run into this issue over the last couple days.  Also using Solr, but the error
is triggered by content that has multi-byte characters (such as German).

It seems that somewhere lucene is counting bytes instead of characters, so each substring
the highlighter tries to select is offset further forward in the string being matched.

here's an example trying to highlight the string 'Drupaltalk' with "strong" tags
{code}
<p class="search-snippet">
 Community ist - und dieses Portal Dr<strong>upaltalk.d</strong>e samt seinem
schon eifrigen Benutzer- und Gästezulauf ( ... 
 nter "Dru<strong>paltalk001</strong>" könnt Ihr die erste Konferenz noch mal
nachhören und erfahren, wie Selbstorganisation in der Drupal Szene funktioniert.  
 "Dru<strong>paltalk002</strong>" ist dann der Talk vom Dienstag zum Thema "Drupal
Al</p>
{code}
        

  
> Highlighter throws StringIndexOutOfBoundsException
> --------------------------------------------------
>
>                 Key: LUCENE-1500
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1500
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: contrib/highlighter
>    Affects Versions: 2.4
>         Environment: Found this running the example code in Solr (latest version).
>            Reporter: David Bowen
>         Attachments: patch.txt
>
>
> Using the canonical Solr example (ant run-example) I added this document (using exampledocs/post.sh):
> <add><doc>
>   <field name="id">Test for Highlighting StringIndexOutOfBoundsExcdption</field>
>   <field name="name">Some Name</field>
>   <field name="manu">Acme, Inc.</field>
>   <field name="features">Description of the features, mentioning various things</field>
>   <field name="features">Features also is multivalued</field>
>   <field name="popularity">6</field>
>   <field name="inStock">true</field>
> </doc></add>
> and then the URL http://localhost:8983/solr/select/?q=features&hl=true&hl.fl=features
caused the exception.
> I have a patch.  I don't know if it is completely correct, but it avoids this exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


Mime
View raw message