You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by kd...@ezifile.com on 2002/09/11 05:00:42 UTC
Quotes in keyword field searches
Hi All,
I'm trying to run a search on a keyword field on a document. I've got the
following code:
Query query = QueryParser.parse("test:\"hello world\", "", new
StandardAnalyzer());
logger.debug("Searching for: " + query.toString("") + " using " +
query.toString());
Hits hits = searcher.search(query);
The test field was populated with:
doc.add(Field.Keyword("test", "hello world"));
The logger output is:
Searching for: key:"goodbye everyone" using
org.apache.lucene.search.PhraseQuery@5cda3f
For some reason that I can't fathom, the search is returning 0 hits...
Thanks for any help,
Kiril
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Quotes in keyword field searches
Posted by Joshua O'Madadhain <jm...@ics.uci.edu>.
On Wed, 11 Sep 2002 kdunn@ezifile.com wrote:
> I'm trying to run a search on a keyword field on a document. I've got the
> following code:
>
> Query query = QueryParser.parse("test:\"hello world\", "", new
> StandardAnalyzer());
> logger.debug("Searching for: " + query.toString("") + " using " +
> query.toString());
> Hits hits = searcher.search(query);
>
> The test field was populated with:
>
> doc.add(Field.Keyword("test", "hello world"));
>
> The logger output is:
>
> Searching for: key:"goodbye everyone" using
> org.apache.lucene.search.PhraseQuery@5cda3f
>
> For some reason that I can't fathom, the search is returning 0 hits...
>
> Thanks for any help,
Maybe I'm missing something, but it looks like your document is "hello
world" and your query string is "goodbye everyone". Under those
circumstances (no overlap of index and query) I'd expect 0 hits.
Good luck--
Joshua O'Madadhain
jmadden@ics.uci.edu...Obscurium Per Obscurius...www.ics.uci.edu/~jmadden
Joshua O'Madadhain: Information Scientist, Musician, Philosopher-At-Tall
It's that moment of dawning comprehension that I live for--Bill Watterson
My opinions are too rational and insightful to be those of any organization.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>