You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by alex <al...@gmail.com> on 2011/02/07 18:38:14 UTC
hl.snippets in solr 3.1
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.
Re: hl.snippets in solr 3.1
Posted by alex <al...@gmail.com>.
Ahmet Arslan wrote:
>> I can see changes if I change fragsize, but no
>> hl.snippets.
>
> May be your text is too short to generate more than one snippets?
>
> What happens when you increase hl.maxAnalyzedChars parameter?
> &hl.maxAnalyzedChars=2147483647
>
>
>
It's working now. I guess, it was a problem with config file.
thanks!
Re: hl.snippets in solr 3.1
Posted by Ahmet Arslan <io...@yahoo.com>.
> I can see changes if I change fragsize, but no
> hl.snippets.
May be your text is too short to generate more than one snippets?
What happens when you increase hl.maxAnalyzedChars parameter?
&hl.maxAnalyzedChars=2147483647
Re: hl.snippets in solr 3.1
Posted by alex <al...@gmail.com>.
Ahmet Arslan wrote:
> --- On Mon, 2/7/11, alex <al...@gmail.com> wrote:
>
>
>> From: alex <al...@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" />
Re: hl.snippets in solr 3.1
Posted by Ahmet Arslan <io...@yahoo.com>.
--- On Mon, 2/7/11, alex <al...@gmail.com> wrote:
> From: alex <al...@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?