OK, so I figured out what the problem was. It wasn't with the digits but rather
with the various delimiters like ( and - that I use.
Essentially, the statement
String[] subTerms = qstr.split(\\s+);
Does not split a query the same way as the query parser would do it. And
thanks,
Just take the BooleanQuery returned by the QueryParser and get its clauses
(sub-queries like TermQuery, PhraseQuery, other BooleanQuery...). By that
you get all query components. In most cases some recursive instanceof
checking for various Query subclasses can do this.
Uwe
-
Uwe Schindler
: Subject: need to find locations of query hits in doc: works fine for regular
: text but not for phone numbers
: Message-ID: a57498edec10c64781ea0f7dba665cef264de...@ex2010mb01-1.caci.com
: References: 1339635547170-3989548.p...@n3.nabble.com
: In-Reply-To:
Uwe, sorry but I am having trouble understanding this. Can you point me to a
place in documentation that explains this in more detail (I've read
http://lucene.apache.org/core/old_versioned_docs/versions/3_4_0/api/core/org/apache/lucene/queryParser/QueryParser.html
but still am confused) or
Look at this code: QueryTermExtractor.getTerms(Query query)
http://lucene.apache.org/core/3_6_0/api/contrib-highlighter/org/apache/lucene/search/highlight/QueryTermExtractor.html
-- Jack Krupansky
-Original Message-
From: Ilya Zavorin
Sent: Thursday, June 14, 2012 2:36 PM
To:
worked like a charm!
thx!
From: Jack Krupansky [j...@basetechnology.com]
Sent: Thursday, June 14, 2012 3:30 PM
To: java-user@lucene.apache.org
Subject: Re: need to find locations of query hits in doc: works fine for
regular text but not for phone
Hello All,
I am using 3.4. I need to find locations of query hits in a document. What I've
implemented works fine for textual queries but does not work for phone numbers.
Here's how I index my docs:
String oc = Joe dialed 800-555-1212 but got a busy signal;
doc.add(new Field(contents,
Try putting the phone number in quotes in the query:
String qstr = \800-555-1212\;
And check query.toString to see how the query parser analyzed the term, bot
with and without quotes.
And make sure you initialized the query parser with contents as the
default field.
-- Jack Krupansky