lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yogesh patel <yogeshpateldai...@gmail.com>
Subject Re: Lucene Query About Sorting
Date Wed, 27 Jun 2012 05:44:53 GMT
Thanks for reply Ian ,

But i just gave suppose document number..i have 2-3 GB index and every day
, it goes higher. so i cant use searcher.maxdoc(). So i need this solution.
Can you please help me out?


On Tue, Jun 26, 2012 at 10:42 PM, Ian Lea <ian.lea@gmail.com> wrote:

> Do you mean you want all hits that match B:abc, sorted by field A?  As
> opposed to the top 100 hits sorted by field A?  Just pass a higher
> value in the search(query, ... 100, ...) call.  It will be slower and
> potentially use more memory but with only 10K docs you probably won't
> notice.
>
>
> --
> Ian.
>
>
>
> On Tue, Jun 26, 2012 at 4:05 AM, Yogesh patel
> <yogeshpateldaiict@gmail.com> wrote:
> > Hi,
> >
> > I have one query of lucene about sort.
> >
> > I have 10000 documents in my index which having fields A,B,C,D. i want
> > first 100 results in my query but they must be sort by field A.
> > Suppose I have query "B:abc".
> >
> > so used below code with search :
> >
> > qp is object of query parser.
> >
> > Query query=qp.parse("B:abc");
> >
> > Sort sort= new Sort(new SortField("A",SortField.STRING_VAL,true));
> >
> > hits = searcher.search(query, null,100,sort);
> >
> > but when i search above way.it gives me result in sorting but sorting
> > applies to only matching first 100 results.It search first 100 results
> and
> > then sort. I want first 100 sorted descending of Field A with matching
> > query.
> >
> > Is it possible in Lucene?
> >
> > Thanks
> >
> > *Regards,
> >
> > Yogesh Patel*
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 
*

Regards,

Yogesh Patel*

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