Ahmet Arslan wrote:
--- On Mon, 2/7/11, alex <alex.alex.alex.9...@gmail.com> wrote:
From: alex <alex.alex.alex.9...@gmail.com>
Subject: hl.snippets in solr 3.1
To: solr-user@lucene.apache.org
Date: Monday, February 7, 2011, 7:38 PM
hi all,
I'm trying to get result like :
blabla <b>keyword</b> blabla ...
blabla<b>keyword</b> blabla...
so, I'd like to show 2 fragments.I've added these
settings
<str
name="hl.simple.pre"><![CDATA[<b>]]></str>
<str
name="hl.simple.post"><![CDATA[</b>]]></str>
<str
name="f.content.hl.fragsize">20</str>
<str
name="f.content.hl.snippets">3</str>
but I get only 1 fragment blabla <b>keyword</b>
blabla.
Am I trying to do it right way? Is it what can be done via
changes in config file?
how do I add separator between fragments(like ... in this
example)?
thanks.
These two should be declared under the defaults section of your requestHandler.
<int name="f.content.hl.fragsize">20</int>
<int name="f.content.hl.snippets">3</int>
Where did you define them? Under the highlighting section in solrconfig.xml?
yes, it's in solrconfig.xml:
<requestHandler name="/search" class="solr.SearchHandler">
<lst name="defaults">
<str name="defType">dismax</str>
<int name="rows">10</int>
<str name="echoParams">explicit</str>
<str name="qf">content^0.5 title^1.2 </str>
<str name="q.alt">*:*</str>
<bool name="hl">true</bool>
<str name="hl.fl">title content url</str>
<str name="f.content.hl.fragsize">20</str>
<str name="f.content.hl.snippets">3</str>
<str name="f.content.hl.alternateField">content</str>
<str name="f.title.hl.fragsize">0</str>
<str name="f.title.hl.alternateField">title</str>
<str name="f.url.hl.fragsize">0</str>
<str name="f.url.hl.alternateField">url</str>
</lst>
</requestHandler>
I don't include the whole config , because there are just default values
in it.
I can see changes if I change fragsize, but no hl.snippets.
and in schema.xml I have:
<fieldType name="text" class="solr.TextField" >
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.StopFilterFactory"
words="stopwords.txt" ignoreCase="true"
enablePositionIncrements="true"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.StopFilterFactory"
words="stopwords.txt" ignoreCase="true"
enablePositionIncrements="true"/>
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
</fieldType>
and
<field name="content" type="text" stored="true" indexed="true" />