Hi Suman, as far as I understand Lucene, this results from the way how range query are executed. E.g., if you have an index with the terms A, B, C, D and E, the range query [B TO D] will be internally rewritten to "B OR C OR D" before execution. If you have a big index with many terms, then a range query can slow down the search engine or even trigger a "Too many clauses" exception.
To avoid this, you can use a RangeFilter (see the Lucene JavaDoc [1]). E.g., I extended the query parser, so that every range query is replaced by a range filter. But a drawback of this solution is, that the range filters are not considered in the calculation of the hit score. To the number problem: Yes, you need to convert the numbers to an text representation, whose lexicographical order is the same as the numeric order. There are already some classes in CLucene to do this: CL_NS(document)::NumberTools [2] and CL_NS(document)::DateTools [3]. Regarding the dates, I use a own Analyzer, which converted dates and times into the ISO 8601 [4] representation, e.g. March 25th, 2010 into 2010-03-25. If you sort them lexicographically, then they are in the "right" order, e.g. 2010-03-01, 2010-03-02, ... Kind regards, Veit [1] http://lucene.apache.org/java/2_3_2/api/core/org/apache/lucene/search/RangeFilter.html [2] http://lucene.apache.org/java/2_3_2/api/core/org/apache/lucene/document/NumberTools.html [3] http://lucene.apache.org/java/2_3_2/api/core/org/apache/lucene/document/DateTools.html [4] http://en.wikipedia.org/wiki/ISO_8601 2010/3/25 suman holani <[email protected]>: > Hello , > > > Range queries are lowering down the performance of search. > > I am using date in my clucene application . > > lucene Index doc has these kind of fields: > > > startdt="1242758400" enddt="1241980500" > > > > > now when i am searching for > searchingdate = new RangeQuery(lastyear time in seconds,current time in > > seconds, true); > > searchingdate1 = new RangeQuery(current time in seconds,nextyear time in > > seconds, true); > > Query :i want all doc , created after last year and expired before next > year. > > but the query is taking 15ms to run. > if i remove the query the execution time is reduced to half. > > > 1. any other thing that i can use for range queries > 2. converting the time to minutes is also not helping me. > 3. Is there something Numeric Range Query. Does that simply means using > padding technique in indexing and searching. > > eg: > for numbers 1...10 > indexes should be 01 02....10 > rather than 1 10 2.....9 > ll that help? > > > > > Help me with the solution. > > > > > > > Thanks, > Suman > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > CLucene-developers mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/clucene-developers > > ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ CLucene-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/clucene-developers
