lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shai Erera <ser...@gmail.com>
Subject Re: Regarding DrillDown search
Date Mon, 10 Feb 2014 12:09:35 GMT
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 <jebarlin@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 <serera@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 <jebarlin@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.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message