Query parsed to: +date +rang
1 - 20 of 20 results (Page 1 of 1)
3.5.5 : Range searches
starts on page 96 under section 3.5 (Parsing query expressions: QueryParser) in chapter 3 (Adding search to your application)
...Text or
date range queries use bracketed syntax, with TO between the beginning term and ending term. The type of bracket determines whether the
range is inclusive (square brackets) or exclusive ... YYYYMM. Handling
date ranges When a
range query is encountered, the parser code first attempts ... to parse as a valid
date, they're both used as is for a textual
range. The Query's toString() output is interesting for
date-range queries. Let's parse one to see: Query query = QueryParser.parse("modified... [
Full sample chapter]
3.4.2 : Searching within a range: RangeQuery
starts on page 83 under section 3.4 (Creating queries programmatically) in chapter 3 (Adding search to your application)
...
range. If the begin and end terms represent
dates (and parse successively as such), then
ranges over ... within a
range. Lucene's RangeQuery facilitates searches from a starting term through an ending term ...
range queries inclusive of the begin and end terms: public class RangeQueryTest extends LiaTestCase ... ","198805"); // pub
date of TTC was October 1988 end = new Term("pubmonth","198810"); super.setUp ... to construct a RangeQuery is a boolean flag indicating whether the
range is inclusive. Using the same... [
Full sample chapter]
2.4 : Indexing dates
starts on page 39 in chapter 2 (Indexing)
... representation is lexicographically orderable; doing so allows for sen- sible date-range queries ... Email messages include sent and received dates, files have several timestamps associated with them, and HTTP responses have a Last-Modified header that includes the date of the requested page's last modification. Chances are, like many other Lucene users, you'll need to index dates. Lucene comes equipped with a Field.Keyword(String, Date) method, as well as a DateField class, which make date...
5.5.1 : Using DateFilter
starts on page 171 under section 5.5 (Filtering a search) in chapter 5 (Advanced search techniques)
... (as in this exam- ple) or long, take your pick. Open-ended date range filtering DateFilter also supports open-ended date ranges. To filter on dates with one end of the range specified and the other end open, use ... and After methods accept either a java.util.Date or a long. You can leave both ends of the date range ... The date field type is covered in section 2.4 along with its caveats. Having a date field, you filter as shown in testDateFilter() in listing 5.6. Our book data indexes the last modified date of each...
3.5.10 : To QueryParse or not to QueryParse?
starts on page 100 under section 3.5 (Parsing query expressions: QueryParser) in chapter 3 (Adding search to your application)
... category or narrow them to a
date range, you can have the user interface separate those selections into a category chooser or separate
date- range fields.... [
Full sample chapter]
10.7.3 : Building the index
starts on page 374 under section 10.7 (I love Lucene: TheServerSide) in chapter 10 (Case studies)
... date in Lucene format. Used for displaying the exact date of the content to the user. createddate Field.Keyword The created date in Lucene format. Used for displaying the exact date of the content to the user. modifieddate_range Field.Keyword Date as a String with the format YYYYMMDD. Used for date-range queries. createddate_range Field.Keyword Date as a String with the format YYYYMMDD. Used for date-range queries. We created a simple Java representation of this data, SearchContentHolder, which...
10.7.6 : Web tier: TheSeeeeeeeeeeeerverSide?
starts on page 383 under section 10.7 (I love Lucene: TheServerSide) in chapter 10 (Case studies)
... query string. For example, if the user typed Lucene in the search box, selected a date "after Jan ... AND modifieddate_range:[20040101 TO 20100101] So our code contains small snippets ... ("before")) { querySB.append( " AND modifieddate_range:[19900101 TO " + dateRange + "]"); } else if (dateRangeType.equals("after")) { querySB.append( " AND modifieddate_range:[" + dateRange...
3.4 : Creating queries programmatically
starts on page 81 in chapter 3 (Adding search to your application)
...'s user interface, you may have
date pickers to select a
date range, drop-downs for selecting... [
Full sample chapter]
6.3 : Extending QueryParser
starts on page 203 in chapter 6 (Extending search)
...In section 3.5, we introduced QueryParser and showed that it has a few settings to control its behavior, such as setting the locale for date parsing and controlling the default phrase slop. QueryParser is also extensible, allowing subclassing to override parts of the query-creation process. In this section, we demonstrate sub- classing QueryParser to disallow inefficient wildcard and fuzzy queries, custom date-range handling, and morphing phrase queries into SpanNearQuerys instead...
5.5.5 : Caching filter results
starts on page 177 under section 5.5 (Filtering a search) in chapter 5 (Advanced search techniques)
... in a sim- ilar manner to QueryFilter. To demonstrate its usage, we return to the date- range filtering example. We want to use DateFilter because the contortions of using a QueryFilter for dates are ugly ... Exception { Date jan1 = parseDate("2004 Jan 01"); Date dec31 = parseDate("2004 Dec 31"); DateFilter...
6.5.3 : QueryParser again!
starts on page 218 under section 6.5 (Performance testing) in chapter 6 (Extending search)
...QueryParser rears its ugly head again with our changed date format. The built-in date-range handling parses DateFormat.SHORT formats into the DateField text conversions. It would be nice to let users enter a typical date format like 1/1/04 and have it converted to our revised date format ... integers for range queries. The desired effect is shown in the following test: public void ... .getDateInstance(DateFormat.SHORT, getLocale()); df.setLenient(true); Date d1 = df.parse(part1); Date...
5.5.2 : Using QueryFilter
starts on page 173 under section 5.5 (Filtering a search) in chapter 5 (Advanced search techniques)
... and isn't nearly as elegant looking. The following code dem- onstrates date filtering using a QueryFilter on a RangeQuery using the same date range and search as the first DateFilter example: public void testQueryFilterWithRangeQuery() throws Exception { Date jan1 = parseDate("2004 Jan 01"); Unshown method: Date dec31 = parseDate("2004 Dec 31"); returns Date as expected Term start = new Term...
5.5 : Filtering a search
starts on page 171 in chapter 5 (Advanced search techniques)
... date field within a given range of dates. QueryFilter uses the results of query as the searchable...
6.5.1 : Testing the speed of a search
starts on page 213 under section 6.5 (Performance testing) in chapter 6 (Extending search)
... purposes, though, the goal is to be able to search by date range. It's unlikely we'll need to search ... the date-based index Now let's write a unit test that uses the YYYYMMDD range: public void testSearchByDay ... . In a similar fashion, RangeQuery can, too: As it enumerates all the terms in the range, it forms ... yesterday: Calendar timestamp = GregorianCalendar.getInstance(); timestamp.set(Calendar.DATE, timestamp.get(Calendar.DATE) - 1); b Yesterday for (int i = 0; i < size; i++) { timestamp.set(Calendar.SECOND...
8.5 : JavaScript browser utilities
starts on page 290 in chapter 8 (Tools and extensions)
...Integrating Lucene into an application often requires placing a search interface in a web application. QueryParser is handy, and it's easy to expose a simple text box allowing the user to enter a query; but it can be friendlier for users to see query options separated into fields, such as a date-range selection in conjunction with a text box for free-text searching. The JavaScript utilities in the Sandbox assist with browser-side usability in constructing and validating sophisticated...
6.3.3 : Handling numeric field-range queries
starts on page 205 under section 6.3 (Extending QueryParser) in chapter 6 (Extending search)
...Lucene is all about dealing with text. You've seen in several places how dates can be handled, which amounts to their being converted into a text representation that can be ordered alphabetically ... up to you. In this section, our example scenario indexes an integer id field so that range queries can ... shows that the range query worked as expected, and you can see the results of the padding using Query ... ()); } Our test shows that we've succeeded in allowing sensible-looking user-entered range queries to work...
5.1.2 : Sorting by relevance
starts on page 152 under section 5.1 (Sorting search results) in chapter 5 (Advanced search techniques)
... is different from the rest. Our query was on a publication date range. Both of these books have the same ... in the range. The document fre- quency of the term 199910 in the pubmonth field is 2, which lowers...
6.3.1 : Customizing QueryParser's behavior
starts on page 203 under section 6.3 (Extending QueryParser) in chapter 6 (Extending search)
... this method to perform any desired analysis. getRangeQuery(String field, Default range-query behavior has ... , boolean inclusive) Lowercase the start and end terms Use a different date format Handle number ranges by padding to match how numbers were indexed getWildcardQuery(String field, Wildcard queries can...
8.8 : Chaining filters
starts on page 304 in chapter 8 (Tools and extensions)
...", hits.doc(0).get("owner")); } In testANDNOT, given our test data, all documents in the date range ... 500; a date field with successive days starting from January 1, 2003; and an owner field ... .add( Field.Keyword("owner", (i < MAX / 2) ? "bob" : "sue")); doc.add(Field.Keyword("date", cal.getTime())); writer.addDocument(doc); cal.add(Calendar.DATE, 1); } writer.close(); searcher = new ... ("owner", "sue")),false, false); query = bq; // date filter matches everything too Date pastTheEnd...
index
starts on page 416
... 309 Snowball 25 date ranges 96 ChainedFilter 177 SnowballAnalyzer 282 default operator 94 Highlighter ... Berkeley UTF-8 140 DB 307 Etymon PJ 264 H date, indexing 216 Explanation 80 DateField 39 Harvest ... 20-22 highlighting, query terms range queries 96 appending to 33 300-303, 343 used with DateFilter ... ing 177 file handle customizing 350 open-ended ranges 172 issue 340 priority-queue idea ... 11 IndexReader 199 Konrad, Karsten 344 dates 39-40, 216 deleting documents 375 Korean analysis...