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 Majid Laali <mj...@gmail.com> on 2015/06/04 17:37:24 UTC

Re: How can I parse the TermVectorComponent response in SolrJ

Hi, 

Based on a few hours googling, I concluded that there is no class in SOLR 5.1 that can parser JSON response of The Term Vector Component. 
I am not sure if it is fine to create an issue in the SOLR JIRA website and make patch to address it. 

I would be grateful to get any advice for that.

Thanks, 
Majid



> On May 22, 2015, at 5:49 PM, Majid Laali <mj...@gmail.com> wrote:
> 
> Hi, 
> 
> I have a java program that sends a query to solr and get the term vector of a document. Something like this:
> 
> SolrQuery solrQuery = new SolrQuery();
> solrQuery.setRequestHandler("/tvrh");
> solrQuery.setQuery("id:" + id);
> solrQuery.setParam("fl", textField);
> solrQuery.setParam("tv.tf", "true");
> solrQuery.setParam("tv.df", "true");
> solrQuery.setParam("tv.tf_idf", "true");
> solrQuery.setRows(1);
> QueryResponse docTVResponse = solrClient.query(solrQuery);
> Object termVectors = docTVResponse.getResponse().get("termVectors”);
> 
> I am wondering if there is a class that can wrap the termVecotrs object so that I can access to tf, idf of terms or I have to manually parse the json response of TermVectoreComponent. 
> 
> Thanks in advance, 
> Majid
> 
> 
> /*******************************************
>  *   Majid Laali, Ph.D. Candidate, 
>  *   Computer Science & Software Engineering Department
>  *   Concordia University
> *******************************************/