Hi ,

I have written my custom Solr 4.3.0 SearchComponent and purpose of this
component is to sum the result of FunctionQuery (termfreq) of some term of
each doc and them embed the result in final output.

This is my query:

http://localhost:8080/solr/collection2/demoendpoint?q=spider&wt=xml&indent=true&fl=*,freq:termfreq%28product,%27spider%27%29

This is sample result doc on browser:

<doc><str name="id">11</str><str name="type">Video Games</str><str
name="format">xbox 360</str><str name="product">The Amazing
Spider-Man</str><int name="popularity">11</int><long
name="_version_">1439994081345273856</long><int name="freq">1</int></doc>


Here is my code from SearchComponent

DocList docs = rb.getResults().docList;
        DocIterator iterator = docs.iterator();
        int sumFreq = 0;
        String id = null;

        for (int i = 0; i < docs.size(); i++) {
            try {
                int docId = iterator.nextDoc();

               // Document doc = searcher.doc(docId, fieldSet);
                Document doc = searcher.doc(docId);

In 'doc' object I can see the schema fields like 'id', 'type','format' etc.
but I cannot find the field 'freq' which I needed.

Is there any way to get the FunctionQuery fields in doc object ?

Thanks,
Tony

Reply via email to