What you want sounds like grouping more like faceting? So e.g. if you have an Author field with values A1, A2, A3, and the user searches for 'love', then if I understand correctly, you want to display something like:
Author/A1 Doc1 Doc2 Author/A2 Doc3 Doc4 Author/A3 Doc5 Doc6 Is that right? Where's today your result page looks like this: Facets Results ------ ----------- Author Doc1_Title A1 (4) Doc1_Highlight A2 (3) ++++ A3 (1) Doc2_Title Doc2_Highlight +++ ... (Forgive my lack of creativity :)). If you're not interested in join, and just want to add to each document its Author facet in the results pane, then I suggest you add another stored field (only stored, not indexed) with the category value. And then you could display: Facets Results ------ ----------- Author Doc1_Title A1 (4) Doc1_Highlight A2 (3) Author: A1 A3 (1) ++++ Doc2_Title Doc2_Highlight Author: A2 +++ ... Did I understand properly? Shai On Mon, Feb 10, 2014 at 4:51 PM, Jebarlin Robertson <jebar...@gmail.com>wrote: > Hi Shai, > > Thanks for the explanation :) > > For my requirement, I just want to display the list of resulted documents > to the user. > In Facet search case also, I already have the resulted documents list in > TopDoc and the FacetResults have only the count of documents contributed to > each Catagory, > > According to my understanding, > > Suppose I query for the word "Love", Now I do Facet Search and gets 4 > (Files) documents as matched results from TopScoreDocCollector as TopDocs > and I will get the FacetResult from the FacetCollector. > And the FacetResultsNode gives me only the values of the category and the > count of how many documents falls under same category (May be by Author or > other provided categories ) among the 4 resulted documents only. > > I feel, It will be good if I get the category association with the resulted > documents, as I have the document list already from TopScoreDocCollector. > > I can do DrillDown Search also by selecting each category, But in my case I > just want to display the 4 documents result first and then category wise, > suppose 2 documents by the same Author etc.... > > As per my requirement, I am doing DrillDown Search by asking the user to > provide such as title of the docment, author of the document, etc... as > advanced search option. > > --- > Jebarlin Robertson.R > > > > On Mon, Feb 10, 2014 at 10:30 PM, Shai Erera <ser...@gmail.com> wrote: > > > 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. > > > > > > > > > -- > Thanks & Regards, > Jebarlin Robertson.R > GSM: 91-9538106181. >