I definitely want tf, the number of times the matched term appears in the document, the key is that I want only the term that was searched for, not all terms.
Looking at the tf function this is close, except it needs to be the exact term, I really need it to be the user entered text. So for instance if the user said q=tests, I'd like the tf to be for any terms that tests got analyzed to. So if I had a stemming analyzer I'd expect the user search for tests to match test, and I'd like to get the number of time test appeared in the document of interest. Does that make sense? On Wed, Nov 27, 2013 at 9:40 AM, Erick Erickson <erickerick...@gmail.com>wrote: > Would it serve to return the tf or ttf? You'd have to > tack on clauses like > fl=*,ttf(name,drive) > or > fl=*.ttf(name,drive) > > Which implies that you'd have to do some work > on the query side to add the tf or ttf clauses. > > See: > http://wiki.apache.org/solr/FunctionQuery#tf > > Best, > Erick > > > On Wed, Nov 27, 2013 at 9:32 AM, Jamie Johnson <jej2...@gmail.com> wrote: > > > 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> > > >