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 Amit Aggarwal <am...@gmail.com> on 2013/11/19 03:38:02 UTC
How to get score with getDocList method Solr API
Hello All,
I am trying to develop a custom request handler.
Here is the snippet :
// returnMe is nothing but a list of Document going to return
try {
// FLAG ???
DocList docList = searcher.getDocList(parsedQuery,
parsedFilterQueryList, Sort.RELEVANCE, 1, maxDocs , FLAG);
// Now get DocIterator
DocIterator it = docList.iterator();
// Now for each id get doc and put it in list<Document>
int i =0;
while (it.hasNext()) {
returnMe.add(searcher.doc(it.next()));
}
Ques 1 - > My question is , what does FLAG represent in getDocList method ?
Ques 2 - > How can I ensure that searcher.getDocList method give me
score also with each document.
--
Amit Aggarwal
8095552012
Re: How to get score with getDocList method Solr API
Posted by Amit Aggarwal <am...@gmail.com>.
Hello shekhar ,
Thanks for answering . Do I have to set GET_SCORES FLAG as last parameter
of getDocList method ?
Thanks
On 19-Nov-2013 1:43 PM, "Shalin Shekhar Mangar" <sh...@gmail.com>
wrote:
> A few flags are supported:
> public static final int GET_DOCSET = 0x40000000;
> public static final int TERMINATE_EARLY = 0x04;
> public static final int GET_DOCLIST = 0x02; // get
> the documents actually returned in a response
> public static final int GET_SCORES = 0x01;
>
> Use the GET_SCORES flag to get the score with each document.
>
> On Tue, Nov 19, 2013 at 8:08 AM, Amit Aggarwal
> <am...@gmail.com> wrote:
> > Hello All,
> >
> > I am trying to develop a custom request handler.
> > Here is the snippet :
> >
> > // returnMe is nothing but a list of Document going to return
> >
> > try {
> >
> > // FLAG ???
> > DocList docList = searcher.getDocList(parsedQuery,
> > parsedFilterQueryList, Sort.RELEVANCE, 1, maxDocs , FLAG);
> >
> > // Now get DocIterator
> > DocIterator it = docList.iterator();
> >
> > // Now for each id get doc and put it in
> list<Document>
> >
> > int i =0;
> > while (it.hasNext()) {
> >
> > returnMe.add(searcher.doc(it.next()));
> >
> > }
> >
> >
> > Ques 1 - > My question is , what does FLAG represent in getDocList
> method ?
> > Ques 2 - > How can I ensure that searcher.getDocList method give me score
> > also with each document.
> >
> >
> > --
> > Amit Aggarwal
> > 8095552012
> >
>
>
>
> --
> Regards,
> Shalin Shekhar Mangar.
>
Re: How to get score with getDocList method Solr API
Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
A few flags are supported:
public static final int GET_DOCSET = 0x40000000;
public static final int TERMINATE_EARLY = 0x04;
public static final int GET_DOCLIST = 0x02; // get
the documents actually returned in a response
public static final int GET_SCORES = 0x01;
Use the GET_SCORES flag to get the score with each document.
On Tue, Nov 19, 2013 at 8:08 AM, Amit Aggarwal
<am...@gmail.com> wrote:
> Hello All,
>
> I am trying to develop a custom request handler.
> Here is the snippet :
>
> // returnMe is nothing but a list of Document going to return
>
> try {
>
> // FLAG ???
> DocList docList = searcher.getDocList(parsedQuery,
> parsedFilterQueryList, Sort.RELEVANCE, 1, maxDocs , FLAG);
>
> // Now get DocIterator
> DocIterator it = docList.iterator();
>
> // Now for each id get doc and put it in list<Document>
>
> int i =0;
> while (it.hasNext()) {
>
> returnMe.add(searcher.doc(it.next()));
>
> }
>
>
> Ques 1 - > My question is , what does FLAG represent in getDocList method ?
> Ques 2 - > How can I ensure that searcher.getDocList method give me score
> also with each document.
>
>
> --
> Amit Aggarwal
> 8095552012
>
--
Regards,
Shalin Shekhar Mangar.