There is an XML version of explain as well, if parsing the structured text is too difficult for your application. The point is that debug "explain" details precisely the term vector values for actual query terms.

Don't let the "debug" moniker throw you - this parameter is simply giving you access to detail information that you might find of value in your application.

As Erick explained, the function query approach ("tf(query-term)") also works, kind of, sort of, at least where all query terms must be matched, but when the "OR" operator is used, it won't tell you which term matched - although a tf value of 0 basically tells you that.

-- Jack Krupansky

-----Original Message----- From: Jamie Johnson
Sent: Wednesday, November 27, 2013 11:38 AM
To: solr-user@lucene.apache.org
Subject: Re: Term Vector Component Question

Jack,

I'm not following, are you suggesting to turn on debug and then parse the
explain?  Seems very round about if that is the case, no?


On Wed, Nov 27, 2013 at 9:40 AM, Jack Krupansky <j...@basetechnology.com>wrote:

That information would be included in the debugQuery output as well.

-- Jack Krupansky

-----Original Message----- From: Jamie Johnson Sent: Wednesday, November
27, 2013 9:32 AM To: solr-user@lucene.apache.org Subject: Term Vector
Component Question
I am interested in retrieving the tf for terms that matched the query, not
all terms in the document.  Is this possible?  Looking at the example when
I search for the word cable I get the response that is shown below, ideally
I'd like to see only the tf for the word cable.  Is this possible or would
I need to write a custom query component to do this?

<response>

<lst name="responseHeader">

<int name="status">0</int>

<int name="QTime">2</int>

</lst>

<result name="response" numFound="4" start="0">

<doc/>

<doc>

<str name="includes">32MB SD card, USB cable, AV cable, battery</str>

</doc>

<doc>

<str name="includes">USB cable</str>

</doc>

<doc>

<str name="includes">earbud headphones, USB cable</str>

</doc>

</result>

<lst name="termVectors">

<str name="uniqueKeyFieldName">id</str>

<lst name="IW-02">

<str name="uniqueKey">IW-02</str>

</lst>

<lst name="9885A004">

<str name="uniqueKey">9885A004</str>

<lst name="includes">

<lst name="32mb">

<int name="tf">1</int>

</lst>

<lst name="av">

<int name="tf">1</int>

</lst>

<lst name="battery">

<int name="tf">1</int>

</lst>

<lst name="cable">

<int name="tf">2</int>

</lst>

<lst name="card">

<int name="tf">1</int>

</lst>

<lst name="sd">

<int name="tf">1</int>

</lst>

<lst name="usb">

<int name="tf">1</int>

</lst>

</lst>

</lst>

<lst name="3007WFP">

<str name="uniqueKey">3007WFP</str>

<lst name="includes">

<lst name="cable">

<int name="tf">1</int>

</lst>

<lst name="usb">

<int name="tf">1</int>

</lst>

</lst>

</lst>

<lst name="MA147LL/A">

<str name="uniqueKey">MA147LL/A</str>

<lst name="includes">

<lst name="cable">

<int name="tf">1</int>

</lst>

<lst name="earbud">

<int name="tf">1</int>

</lst>

<lst name="headphones">

<int name="tf">1</int>

</lst>

<lst name="usb">

<int name="tf">1</int>

</lst>

</lst>

</lst>

</lst>

</response>


Reply via email to