LOL.. Thank's Franklin, I think this will be helpful. Thank's again.
"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 > > >