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 ya...@bloglines.com on 2004/07/07 20:27:14 UTC
Searching for asterisk in a term
Hi,
I'm trying to search for a term that contains an asterisk.
This
is the field that I indexed:
- new Field("testField", "Hello *foo bar", true,
true, true);
I'm trying to find this document by matching '*foo':
- new
TermQuery(new Term("testField", "*me"));
I've also tried to escape the
* like this:
- new TermQuery(new Term("testField", "\\*me"));
Neither
of these queries return this document. Is this type of search possible with
Lucene?
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org
Re: Searching for asterisk in a term
Posted by Otis Gospodnetic <ot...@yahoo.com>.
The first thing you'll want to check is that you are using an Analyzer
that does not discard that '*' before indexing. StandardAnalyzer, for
instance, will discard it. Check one of Erik Hatcher's articles that
includes a tool that helps you see what your Analyzer does with the any
given text input. You can also use Luke to see what your index
contains.
Otis
--- yahootintin.1247688@bloglines.com wrote:
> Hi,
>
> I'm trying to search for a term that contains an asterisk.
>
> This
> is the field that I indexed:
> - new Field("testField", "Hello *foo bar", true,
> true, true);
>
> I'm trying to find this document by matching '*foo':
> - new
> TermQuery(new Term("testField", "*me"));
>
> I've also tried to escape the
> * like this:
> - new TermQuery(new Term("testField", "\\*me"));
>
> Neither
> of these queries return this document. Is this type of search
> possible with
> Lucene?
>
> Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org