Ahh I see ... so given a single FacetResultNode, you would like to know which documents contributed to its weight (count in your case). This is not available immediately, that's why you need to do a drill-down query. So if you return the user a list of categories, when he clicks one of them, you perform a drill-down query on that category and retrieve all the associated documents.
May I ask why do you need to know the list of documents given a FacetResultNode? Basically in the 3.6 API it's kind of not so simple to do what you want in one-pass, but in the 4.x API (especially the upcoming 4.7) it should be very easy -- when you traverse the list of matching documents, besides only reading the list of categories associated with it, you also store a map Category -> List<docIDs>. This isn't very cheap though ... So I guess it would be good if I understand why do you need to know which documents contributed to which category, before the results are returned to the user. Shai On Mon, Feb 10, 2014 at 3:16 PM, Jebarlin Robertson <jebar...@gmail.com>wrote: > Hi Shai, > > Thanks, > > I am using the same way of BooleanQuery only with list of PrefixQuery only. > I think I confused you sorry :) . > > I am using the same above code to get the result of documents. I am getting > the TopDocs and retrieving the Documents also, If I don't even try that for > the basic you will kill me :D. > But my question was different, from the List of FacetResult I am getting > only the counts or no of hits of Document in each category after iterating > the list. > I believe that the getLevel() of FacetNode returns the no of hits or no of > documents falls into the particular Category. > I need to know which are the documents are falling under the same category > from the FacetResult Object also. > > I hope you will understand my question :) > > Thank you :) > > -- > Jebarlin > > > > On Mon, Feb 10, 2014 at 9:09 PM, Shai Erera <ser...@gmail.com> wrote: > > > Hi > > > > You will need to build a BooleanQuery which comprises a list of > > PrefixQuery. The relation between each PrefixQuery should be OR or AND, > as > > you see fit (I believe OR?). > > > > In order to get documents' attributes you should execute > searcher.search() > > w/ e.g. MultiCollector which wraps a FacetsCollector and > > TopScoreDocCollector. Then after .search() finished, you should pull the > > facet results from the FacetsCollector instance and the document results > > from the TopScoreDocCollector instance. Something like (I hope it > compiles > > in 3.6! :)): > > > > TopScoreDocCollector tsdc = TopScoreDocCollector.create(...); > > FacetsCollector fc = FacetsCollector.create(...); > > searcher.search(query, MultiCollector.wrap(tsdc, fc)); > > > > List<FacetResult> facetResults = fc.getFacetResults(); > > TopDocs topDocs = tsdc.topDocs(); > > > > Something like that.. > > > > Shai > > > > > > On Mon, Feb 10, 2014 at 1:57 PM, Jebarlin Robertson <jebar...@gmail.com > > >wrote: > > > > > Dear Shai, > > > > > > Thank you for the quick response :) > > > > > > I have checked with PrefixQuery and term, it is working fine, But I > > think I > > > cannot pass multiple Category path in it. I am calling the > > > DrillDown.term() method 'N' number of times based on the number of > > Category > > > Path list. > > > > > > And I have one more question, When I get the FacetResult, I am getting > > only > > > the count of documents matched with the Category Path. > > > Is there anyway to get the Document object also along with the count to > > > know the file names For ex. Files (file names -title Field in Document) > > > which have the same Author from the FacetResult. I have read some > > articles > > > for the same from one of your answer I believe. > > > In that you have explained like this "Categories will be listed to the > > user > > > and when the user clicks the category we have to do DrillDown search to > > get > > > further result. > > > I just want to know if we can get the document names as well in the > first > > > Facet query search itself, when we get the count (no of hits) of > > documents > > > along with the FacetResult. Is there any solution available already or > > what > > > I can do for that. > > > > > > Kindly Guide me :) > > > > > > Thank you for All your Support. > > > > > > Regards, > > > Jebarlin.R > > > > > > > > > On Mon, Feb 10, 2014 at 1:28 PM, Shai Erera <ser...@gmail.com> wrote: > > > > > > > Hi > > > > > > > > If you want to drill-down on first name only, then you have several > > > > options: > > > > > > > > 1) Index Author/First, Author/Last, Author/First_Last as facets on > the > > > > document. This is the faster approach, but bloats the index. Also, if > > you > > > > index the author Author/Jebarlin, Author/Robertson and > > > > Author/Jebarlin_Robertson, it still won't allow you to execute a > query > > > > Author/Jebar. > > > > > > > > 2) You should modify the query to be a PrefixQuery, as if the user > > chose > > > to > > > > search Author/Jeral*. You can do that with DrillDown.term() to > create a > > > > Term($facets, Author/Jeral) (NOTE: you shouldn't pass '*' as part of > > the > > > > CategoryPath) and then construct your own PrefixQuery with that Term. > > > > > > > > Hope that helps, > > > > Shai > > > > > > > > > > > > On Mon, Feb 10, 2014 at 6:21 AM, Jebarlin Robertson < > > jebar...@gmail.com > > > > >wrote: > > > > > > > > > Dear Shai, > > > > > > > > > > I have one doubt in DrillDown search, when I search with a > > CategoryPath > > > > of > > > > > author, it is giving me the result if I give the accurate full name > > > only. > > > > > Is there any way to get the result even if I give the first or last > > > name. > > > > > Can you help me to search like (*contains* the word in Facet > search), > > > if > > > > > the latest API supports or any other APIs. > > > > > > > > > > Thank You > > > > > > > > > > -- > > > > > Thanks & Regards, > > > > > Jebarlin Robertson.R > > > > > GSM: 91-9538106181. > > > > > > > > > > > > > > > > > > > > > -- > > > Thanks & Regards, > > > Jebarlin Robertson.R > > > GSM: 91-9538106181. > > > > > > > > > -- > Thanks & Regards, > Jebarlin Robertson.R > GSM: 91-9538106181. >