lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erdinc Akkaya <hz.r...@gmail.com>
Subject Re: reverse TermsEnum (/trunk)?
Date Mon, 23 Aug 2010 15:07:35 GMT
hmm you can try creating

Sort sort = null;
        SortField[] sortFields = new SortField[1];
        sortFields[0] = new SortField(FIELD_TO_SEARCH, LOCALE,true**);
        sort = new Sort(sortFields);

** org.apache.lucene.search.SortField<eclipse-javadoc:%E2%98%82=SearchIndexWeb/%5C/var%5C/www%5C/SearchIndexWeb%5C/WebContent%5C/WEB-INF%5C/lib%5C/lucene-core-3.0.2.jar%3Corg.apache.lucene.search%28SortField.class%E2%98%83SortField>
.SortField(String<eclipse-javadoc:%E2%98%82=SearchIndexWeb/%5C/var%5C/www%5C/SearchIndexWeb%5C/WebContent%5C/WEB-INF%5C/lib%5C/lucene-core-3.0.2.jar%3Corg.apache.lucene.search%28SortField.class%E2%98%83SortField%7ESortField%7ELjava.lang.String;%7ELjava.util.Locale;%7EZ%E2%98%82String>field,
Locale<eclipse-javadoc:%E2%98%82=SearchIndexWeb/%5C/var%5C/www%5C/SearchIndexWeb%5C/WebContent%5C/WEB-INF%5C/lib%5C/lucene-core-3.0.2.jar%3Corg.apache.lucene.search%28SortField.class%E2%98%83SortField%7ESortField%7ELjava.lang.String;%7ELjava.util.Locale;%7EZ%E2%98%82Locale>locale,
boolean reverse)
if you set last variable true it will walk reverse order.
then give it to Searcher object as a sort parameter
Searcher searcher = null;
TopFieldDocs topFieldDocs = searcher.search(query, AMOUNT_YOU_WANT, sort);




2010/8/23 Ryan McKinley <ryantxu@gmail.com>

> Is there anyway to walk the terms in reverse order?
>
> I have a query that need to find the last matching term -- if it could
> start checking from the end, it would avoid a lot of work.
>
> Thanks
> Ryan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 
Erdinc Akkaya
Web Developer @ CE / Positive
www.positive.com.tr

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