To use SpanRegexQuery, you need to understand regular expressions. The WildcardQuery syntax is _NOT_ the same as SpanRegexQuery syntax. WildcardQuery supports a ? for single character match and * for multiple characters. SpanRegexQuery use standard regular expression syntax.

"200?" matches 20 and 200, but not 2001 (using java.util.regex, that is).

        <http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html>

"X? matches X, once or not at all"

Use "200.?" perhaps, or more appropriately for matching any year 2000 - 2009 as "200\d".

        Erik




On Sep 8, 2006, at 8:50 PM, Luke Tan wrote:

Hi,

Can this be use to search year 2000, 2001, 2002, ... 2009?

SpanFirstQuery snq = new SpanFirstQuery(new SpanRegexQuery(new Term ("year",
"200?")), 1);


I need to use it to search something like

Who is born in 200?

Thanks


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to