Hi again Franklin. Sorry, but didn't work. I'm using Lucene.net 2.3 and doing exactly what you said, I'm getting this error:
System.FormatException: Input string was not in correct format. em System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) em System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) em Lucene.Net.Search.FieldCacheImpl.AnonymousClassIntParser.ParseInt(String value_Renamed) em Lucene.Net.Search.FieldCacheImpl.AnonymousClassCache2.CreateValue(IndexReader reader, Object entryKey) em Lucene.Net.Search.FieldCacheImpl.Cache.Get(IndexReader reader, Object key) em Lucene.Net.Search.FieldCacheImpl.GetInts(IndexReader reader, String field, IntParser parser) em Lucene.Net.Search.FieldCacheImpl.GetInts(IndexReader reader, String field) em Lucene.Net.Search.FieldSortedHitQueue.ComparatorInt(IndexReader reader, String fieldname) em Lucene.Net.Search.FieldSortedHitQueue.AnonymousClassCache.CreateValue(IndexReader reader, Object entryKey) em Lucene.Net.Search.FieldCacheImpl.Cache.Get(IndexReader reader, Object key) em Lucene.Net.Search.FieldSortedHitQueue.GetCachedComparator(IndexReader reader, String field, Int32 type, CultureInfo locale, SortComparatorSource factory) em Lucene.Net.Search.FieldSortedHitQueue..ctor(IndexReader reader, SortField[] fields, Int32 size) em Lucene.Net.Search.IndexSearcher.Search(Weight weight, Filter filter, Int32 nDocs, Sort sort) em Lucene.Net.Search.Hits.GetMoreDocs(Int32 min) em Lucene.Net.Search.Hits..ctor(Searcher s, Query q, Filter f, Sort o) em Lucene.Net.Search.Searcher.Search(Query query, Sort sort) em SearcherLibrary.Searcher.Search(String[] fields, String orderBy, Int32 type, Object analyzer) na c:\Maldonado\projetos\BuscaBlog\Indexer\SearcherLibrary\Searcher.cs:linha 252 em SearcherLibrary.Searcher.Search(String orderBy, sortType type, Int32 hitCount) na c:\Maldonado\projetos\BuscaBlog\Indexer\SearcherLibrary\Searcher.cs:linha 313 em IndexerConsole.Program.Main(String[] args) na c:\Maldonado\projetos\BuscaBlog\Indexer\IndexerConsole\Program.cs:linha 21 Any idea? Thank's "Então aproximaram-se os que estavam no barco, e adoraram-no, dizendo: És verdadeiramente o Filho de Deus." (Mateus 14:33) On Fri, Oct 30, 2009 at 16:06, Franklin Simmons <fsimm...@sccmediaserver.com > wrote: > I did it again, think I'll hang it up for the day. The correct query class > name is 'MatchAllDocsQuery'. > > -----Original Message----- > From: Franklin Simmons [mailto:fsimm...@sccmediaserver.com] > Sent: Friday, October 30, 2009 2:06 PM > To: lucene-net-user@incubator.apache.org > Subject: RE: Simple question > > Oops, I'm not being very helpful. > > Use the MatchAllDocumentsQuery class: > > Searcher searcher = new IndexSearcher(directory); > > Sort = new Sort(new SortField("another_field", SortField.AUTO, false)); > > Hits hits = searcher.search(new MatchAllDocumentsQuery(),sort); > > > However, that may be a lot of processing. You may want to tune the query > in a way to minimize overhead; someone else in the list may suggest a better > strategy. > > > -----Original Message----- > From: Franklin Simmons [mailto:fsimm...@sccmediaserver.com] > Sent: Friday, October 30, 2009 2:01 PM > To: lucene-net-user@incubator.apache.org > Subject: RE: Simple question > > Hi André, > > In this case you simply sort on the field. This may suffice: > > Searcher searcher = new IndexSearcher(directory); > > Sort = new Sort(new SortField("another_field", SortField.AUTO, false)); > > Hits hits = searcher.search(query,sort); > > > You can limit the number of hits (e.g. to 5), but I won't get into that > here. > > > Beyond SortField.AUTO, take a look at the SortField class to see specific > field types - the most interesting being SortField.CUSTOM. > > > -----Original Message----- > From: André Maldonado [mailto:andre.maldon...@gmail.com] > Sent: Friday, October 30, 2009 1:46 PM > To: lucene-net-user@incubator.apache.org > Subject: Re: Simple question > > Hi Franklin. > > Wich query I use for this search (variable: query)? I don't want any query, > I just want the TOP 5 documents ordered by a field. > > Thank's > > "Então aproximaram-se os que estavam no barco, e adoraram-no, dizendo: És > verdadeiramente o Filho de Deus." (Mateus 14:33) > > > On Fri, Oct 30, 2009 at 15:03, Franklin Simmons < > fsimm...@sccmediaserver.com > > wrote: > > > You can sort a search by multiple fields. I think you could try > something > > like this: > > > > Searcher searcher = new IndexSearcher(directory); > > Sort = new Sort(new SortField[] { SortField.FIELD_SCORE, new > > SortField("another_field") }; > > Hits hits = searcher.search(query,sort); > > > > > > -----Original Message----- > > From: André Maldonado [mailto:andre.maldon...@gmail.com] > > Sent: Friday, October 30, 2009 12:57 PM > > To: lucene-net-user@incubator.apache.org > > Subject: Simple question > > > > Hi. > > > > This can be a simple question, but I can't figure out the solution. > > > > I need to search my index in something like "SELECT TOP 5 ... ORDER BY > > another_field". But this is an empty query because I want to search in > all > > documents. > > > > How can I do it? > > > > Thank's > > >