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 Eoin O'Toole <eo...@obs.com> on 2002/10/10 18:39:30 UTC

Phrase match with wildcards e.g. "search for st*"

I would like the phrase "search for st*" to return matches which expand the 
wildcard... but it doesn't seem to work.

right now I can get "search for stuff" and "search for stars" to return 
hits, but "search for st*" doesn't.

Any ideas on how to implement this functionality?

Thanks,

Eoin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Phrase match with wildcards e.g. "search for st*"

Posted by Ype Kingma <yk...@xs4all.nl>.
Eoin,

Get the cvs version and have a look at:

org/apache/lucene/search/PhrasePrefixQuery.java

It sais:

/**
 * PhrasePrefixQuery is a generalized version of PhraseQuery, with an added
 * method {@link #add(Term[])}.
 * To use this class, to search for the phrase "Microsoft app*" first use
 * add(Term) on the term "Microsoft", then find all terms that has "app" as
 * prefix using IndexReader.terms(Term), and use PhrasePrefixQuery.add(Term[]
 * terms) to add them to the query.
 *
 * @author Anders Nielsen
 * @version 1.0
 */

I don't know whether the query parser in cvs already uses it.

Good luck,
Ype


On Thursday 10 October 2002 18:39, you wrote:
> I would like the phrase "search for st*" to return matches which expand the
> wildcard... but it doesn't seem to work.
>
> right now I can get "search for stuff" and "search for stars" to return
> hits, but "search for st*" doesn't.
>
> Any ideas on how to implement this functionality?
>
> Thanks,
>
> Eoin

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>