On Jun 26, 2012, at 5:32 AM, Apostolis Xekoukoulotakis wrote:
> I am just new here.
>
> When you make a query, you create an ordering of the documents based on
> this query.
> If you have a second ordering, you have to decide what to do with those 2
> orderings. You have to decide how to join those two.
>
> The default search orders your results by the query and picks the top n,
> then it sorts them by your sort.
> You can see the code at TopDocColector.
>
> 2012/6/26 Yogesh patel <yogeshpateldaiict@gmail.com>
>
>> 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*
>>
>
>
>
> --
>
>
> Sincerely yours,
>
> Apostolis Xekoukoulotakis
Regards,
Karthik
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
|