Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
5.4.1
-
None
-
OS X 10.10.5
-
New
Description
I have reported issues with highlighting of EdgeNGram fields in SOLR-7926.
As a workaround I now try to use an NGramField and the FastVectorHighlighter, but I often hit the FastVectorHighlighter StringIndexOutOfBoundsException-issue.
Note that I use luceneMatchVersion="4.3". Without this, the whole term is highlighted, not just the search-term, as I reported in SOLR-7926.
Any help with this would be highly appreciated! (Or tips on how otherwise to achieve proper highlighting of EdgeNGram and NGram-fields.)
The issue can easily be reproduced by following these steps:
Download and start Solr 5.4.1, create a core:
-------------------------------------------------------------
$ wget http://apache.uib.no/lucene/solr/5.4.1/solr-5.4.1.tgz
$ tar xvf solr-5.4.1.tgz
$ cd solr-5.4.1
$ bin/solr start -f
$ bin/solr create_core -c test -d server/solr/configsets/basic_configs
(in a second terminal window)
Add dynamic field and fieldtype to server/solr/test/conf/schema.xml:
-----------------------------------------------------------------------------------------
<dynamicField name="*_ngram" type="text_ngram" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true"/>
<fieldType name="text_ngram" class="solr.TextField">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.NGramFilterFactory" minGramSize="1" maxGramSize="20" luceneMatchVersion="4.3"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
Replace existing /select requestHandler in server/solr/test/conf/solrconfig.xml with:
-------------------------------------------------------------------------------------
<requestHandler name="/select" class="solr.SearchHandler">
<lst name="defaults">
<str name="echoParams">explicit</str>
<int name="rows">10</int>
<str name="df">name_ngram</str>
<str name="mm">100%</str>
<str name="defType">edismax</str>
<str name="qf">
name_ngram
</str>
<str name="fl">*</str>
<str name="hl">true</str>
<str name="hl.fl">name_ngram </str>
<str name="hl.useFastVectorHighlighter">true</str>
</lst>
</requestHandler>
Stop and restart Solr
-----------------------
Create and index this document:
------------------------------
$ more doc.xml
<add>
<doc>
<field name="id">1</field>
<field name="name_ngram">Jan-Ole Pedersen</field>
</doc>
</add>
$ bin/post -c test doc.xml
Execute search:
$ curl "http://localhost:8983/solr/test/select?q=jan+ol&wt=json&indent=true"
{
"responseHeader":{
"status":500,
"QTime":3,
"params":{
"q":"jan ol",
"indent":"true",
"wt":"json"}},
"response":{"numFound":1,"start":0,"docs":[
]
},
"error":
}
Attachments
Attachments
Issue Links
- is part of
-
SOLR-4137 FastVectorHighlighter: StringIndexOutOfBoundsException in BaseFragmentsBuilder
- Closed
- relates to
-
LUCENE-9591 StringIndexOutOfBoundsException in FastVectorHighlighter
- Open