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 Xavier Schepler <xa...@sciences-po.fr> on 2010/01/14 17:32:03 UTC
Need help with highlighting (detailed problem with code samples)
Hey,
I have highlighting working with this field :
<field name="questionsLabelsFr"
required="false"
type="textFr"
multiValued="true"
indexed="true"
stored="true"
compressed="false"
omitNorms="false"
termVectors="true"
termPositions="true"
termOffsets="true"
/>
when I query the solr server this way :
/select/?q=election&version=2.2&start=0&rows=10&indent=on&hl=on&hl.fl=questionsLabelsFr&hl.fragsize=0
I got results like this :
<lst name="highlighting">
<lst name="0ad4d4fe-cff8-43c8-b5d2-cf86c71b044c">
<arr name="questionsLabelsFr">
<str>
Au second tour des <em>élections</em> législatives dimanche prochain,
avez-vous l'intention d'aller voter?
</str>
</arr>
</lst>
....
That's the expected result and I'm pretty happy with it.
But with this field :
<field name="variableEltDDIXML"
required="true"
type="string"
multiValued="false"
indexed="true"
stored="true"
compressed="false"
omitNorms="false"
termVectors="false"
termPositions="false"
termOffsets="false"
/>
when I query the solr server this way :
/select/?q=election&version=2.2&start=0&rows=10&indent=on&hl=on&hl.fl=variableEltDDIXML&hl.fragsize=0
I got results like this :
<lst name="highlighting">
<lst name="0ad4d4fe-cff8-43c8-b5d2-cf86c71b044c"/>
...
with self closing lst tags, whereas I want the whole contents from the
field with highlighted matches.
The field named variableEltDDIXML contains all the contents from the
other fields but in XML format :
<var ID="V18" name="q11a1" files="F1" dcml="0" intrvl="discrete">
<location width="1"/>
<labl>
Ira voter au second tour des élections législatives
</labl>
<qstn>
<qstnLit>
Au second tour des élections législatives dimanche prochain,
avez-vous l'intention d'aller voter?
</qstnLit>
<postQTxt>
<![CDATA[si réponse "oui" poser la question 11a2
si autres réponses passer à la question 13]]>
</postQTxt>
</qstn>
<valrng>
<range UNITS="REAL" min="1" max="2"/>
</valrng>
<invalrng>
<item UNITS="REAL" VALUE="8"/>
<item UNITS="REAL" VALUE="9"/>
</invalrng>
<sumStat type="vald">
2962
</sumStat>
<sumStat type="invd">
48
</sumStat>
<catgry>
<catValu>
1
</catValu>
<labl>
Oui
</labl>
<catStat type="freq">
2747
</catStat>
</catgry>
<catgry>
<catValu>
2
</catValu>
<labl>
Non
</labl>
<catStat type="freq">
215
</catStat>
</catgry>
<catgry missing="Y">
<catValu>
8
</catValu>
<catStat type="freq">
30
</catStat>
</catgry>
<catgry missing="Y">
<catValu>
9
</catValu>
<labl>
Non réponse
</labl>
<catStat type="freq">
18
</catStat>
</catgry>
<varFormat type="numeric" schema="other"/>
</var>
Why are the "lst" tags from the "lst highlighting" list self closing
when matches are found in variableEltDDIXML contents ?
Thanks in advance,
Xavier
Re: Need help with highlighting (detailed problem with code samples)
Posted by Ahmet Arslan <io...@yahoo.com>.
> That's the expected result and I'm pretty happy with it.
>
> But with this field :
>
> <field name="variableEltDDIXML"
>
> required="true"
>
> type="string"
>
> multiValued="false"
>
> indexed="true"
>
> stored="true"
>
> compressed="false"
>
> omitNorms="false"
>
> termVectors="false"
>
> termPositions="false"
>
> termOffsets="false"
> />
>
> when I query the solr server this way :
> /select/?q=election&version=2.2&start=0&rows=10&indent=on&hl=on&hl.fl=variableEltDDIXML&hl.fragsize=0
>
> I got results like this :
>
> <lst name="highlighting">
> <lst name="0ad4d4fe-cff8-43c8-b5d2-cf86c71b044c"/>
> ...
It is okey to query one field, and request highlight from another field. But to get highlight, first you need a match. I see that type of variableEltDDIXML is string which is not tokenized at all.
/select/?q=variableEltDDIXML:election&version=2.2&start=0&rows=10&indent=on&hl=on&hl.fl=variableEltDDIXML&hl.fragsize=0
Does the query above return documents?