To get the first n clauses you could maybe create your own query subclassing RegexQuery with an implementation of getEnum(reader) that returned a FilteredTermEnum that was a subclass of RegexTermEnum that stopped after the first n. That's made up from following the javadoc and I've no idea if it is practical or not. Perhaps someone else has a simpler suggestion.
-- Ian. On Tue, May 19, 2009 at 9:26 AM, Huntsman84 <tpgarci...@gmail.com> wrote: > > I tryed that solution at my first attempt, but the result is that my > application turns too slow. > > What I need is to create a query with a small amount of clauses, 100-200, > using some kind of filter. For example, if my RegexQuery generates 5000 > clauses, I just want from the 100 first clauses (in alphabetical order). > > How could I build the filter? > > > Ian Lea wrote: >> >> If you mean you are getting BooleanQuery.TooManyClauses then the >> simple solution is BooleanQuery.setMaxClauseCount(int maxClauseCount). >> See the javadocs for default values and some suggestions on >> workarounds. And the FAQ. And Google. >> >> If this isn't what you are getting, please tell us *exactly* what you >> are getting. >> >> >> -- >> Ian. >> >> >> >> On Tue, May 19, 2009 at 7:47 AM, Huntsman84 <tpgarci...@gmail.com> wrote: >>> >>> I mean "too many terms", excuse me. >>> >>> >>> JoelGrrrr wrote: >>>> >>>> "but in some cases the search returns too many results" >>>> do you *really* mean you get "too many results"? or do you actually mean >>>> you get a "too many terms" exception due to the query expansion? >>>> >>>> >>>> >>>> -----Original Message----- >>>> From: Huntsman84 <tpgarci...@gmail.com> >>>> Reply-To: java-user@lucene.apache.org >>>> To: java-user@lucene.apache.org >>>> Subject: Too many results with RegexQuery >>>> Date: Mon, 18 May 2009 09:07:27 -0700 (PDT) >>>> >>>> Hi, >>>> >>>> I am using RegexQuery aiming to get a list of records from a regular >>>> expression, but in some cases the search returns too many results, and >>>> for >>>> that my program throws an Exception. >>>> >>>> How could I customize the query or the searcher to, for example, get >>>> just >>>> a >>>> set of results? >>>> >>>> Thank you so much!! >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org >> For additional commands, e-mail: java-user-h...@lucene.apache.org >> >> >> > > -- > View this message in context: > http://www.nabble.com/Too-many-results-with-RegexQuery-tp23600064p23611881.html > Sent from the Lucene - Java Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org