FAQ
It seems that when I run the query "datelastrevised:[0e130wml4 TO
0e2alh18o]" (where datelastrevised is a lucene date field) and the result
contains more than X results, that an IndexAccessException is thrown with no
error message. If I perform the same query on a smaller set of possible
matches, then it works fine.

I'm assuming that this must have something to do with how the date field
enumerates against the matches with 'by the second' granularity - and
thereby exceeding the maximum number of boolean clauses (please correct me
if I am wrong).

Is there some way to reduce the granularity of the search to 'by the day'
granularity? Otherwise is there some way to perform this query so that I can
retrieve the results without error?

Best,
Shawn.


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org

Search Discussions

  • Chris Hostetter at Dec 3, 2004 at 6:33 pm
    : I'm assuming that this must have something to do with how the date field
    : enumerates against the matches with 'by the second' granularity - and
    : thereby exceeding the maximum number of boolean clauses (please correct me
    : if I am wrong).

    I'm not so certain .. if you were really exceeding the max boolean clauses
    limit, you should get a "TooManyClauses" exception

    : Is there some way to reduce the granularity of the search to 'by the day'
    : granularity? Otherwise is there some way to perform this query so that I can
    : retrieve the results without error?

    take a look at the RangeFilter class i recently sent to the list (and is
    now in cvs) ... in exchange for giving up scoring, it doesn't suffer any
    of the Boolean Clause limitations of RangeQuery.



    -Hoss


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
    For additional commands, e-mail: lucene-user-help@jakarta.apache.org
  • Shawn Konopinsky at Dec 3, 2004 at 7:19 pm
    Thanks for the quick response Chris.

    The problem with using a Filter is that I want to be able to merely generate
    a text query based on the range information instead of having to modify the
    core search module which basically receives text queries. If I understand
    correctly, the Filter would actually have to be created and passed into the
    search method.

    Thoughts?

    Shawn.

    -----Original Message-----
    From: hossman@hal.rescomp.berkeley.edu
    On Behalf Of Chris Hostetter
    Sent: Friday, December 03, 2004 1:33 PM
    To: Lucene Users List
    Subject: Re: Date Range Search throws IndexAccessException



    : I'm assuming that this must have something to do with how the date field
    : enumerates against the matches with 'by the second' granularity - and
    : thereby exceeding the maximum number of boolean clauses (please correct me
    : if I am wrong).

    I'm not so certain .. if you were really exceeding the max boolean clauses
    limit, you should get a "TooManyClauses" exception

    : Is there some way to reduce the granularity of the search to 'by the day'
    : granularity? Otherwise is there some way to perform this query so that I
    can
    : retrieve the results without error?

    take a look at the RangeFilter class i recently sent to the list (and is
    now in cvs) ... in exchange for giving up scoring, it doesn't suffer any
    of the Boolean Clause limitations of RangeQuery.



    -Hoss


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
    For additional commands, e-mail: lucene-user-help@jakarta.apache.org



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
    For additional commands, e-mail: lucene-user-help@jakarta.apache.org
  • Chris Hostetter at Dec 3, 2004 at 7:31 pm
    : The problem with using a Filter is that I want to be able to merely generate
    : a text query based on the range information instead of having to modify the
    : core search module which basically receives text queries. If I understand
    : correctly, the Filter would actually have to be created and passed into the
    : search method.

    I haven't acctually done this myself, but when I asked about RangeQuery vs
    RangeFilter before, Erik pointed out that you can wrap a RangeFilter in
    "FilteredQuery" so that you can still use the simpler search API (without
    explicitly passing the filter).

    If you're using the QueryParser that comes with Lucene, you can probably
    subclass it and write you're own "getRangeQuery" to look like the code
    below. (like i said, i haven't acctually tried this yet)

    Truthfully, i wonder if it might not be a good idea to change the default
    implimentation of getRangeQuery to be something like this?




    protected Query getRangeQuery(String field,
    String part1,
    String part2,
    boolean inclusive) throws ParseException
    {
    try {
    DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
    df.setLenient(true);
    Date d1 = df.parse(part1);
    Date d2 = df.parse(part2);
    part1 = DateField.dateToString(d1);
    part2 = DateField.dateToString(d2);
    }
    catch (Exception e) { }

    return new FilteredQuery(
    new TermQuery(new Term(field,"")), // match all docs
    new RangeFilter(
    new Term(field, part1),
    new Term(field, part2),
    inclusive,inclusive));
    }

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
    For additional commands, e-mail: lucene-user-help@jakarta.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedDec 3, '04 at 6:14p
activeDec 3, '04 at 7:31p
posts4
users2
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase