: 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]