HI,

Do I have to use any specific analyser to use PrefixQuery.
I am using WhitespaceAnalyzer and below is how I am populating the fileds
when dding to writer.

Document contactDocument  = new Document();
 contactDocument.add(new Field("type",contact.getType(),Field.Store.NO,
Field.Index.TOKENIZED));
 writer1.addDocument(contactDocument);

Thanks,
Babu


On 12/4/06, Eshwaramoorthy Babu <[EMAIL PROTECTED]> wrote:

Hi Bhavin,

Thanks for your response. I tried the below   Query query = new
PrefixQuery(new Term("name", "Z*"));

but it still the query returns 0 result.

Also can you please tell me how to search form  JAVA collection?

Thanks,
Babu


 On 12/4/06, Bhavin Pandya <[EMAIL PROTECTED]> wrote:
>
> Babu,
>
> Use "PrefixQuery" and if you are looking for phrase also then
> "PhrasePrefixQuery"...
> check api for usage....
>
> - Bhavin pandya
>
>
> ----- Original Message -----
> From: "Eshwaramoorthy Babu" <[EMAIL PROTECTED]>
> To: < java-user@lucene.apache.org>
> Sent: Monday, December 04, 2006 2:15 PM
> Subject: Multiple character wildcard search
>
>
> > Hi,
> >
> >
> >
> > Can anyone please tell me how to specify multiple character wildcard
> > searches in "Term"
> >
> > Below is my requirement
> >
> >
> >
> > 1) I want search all names that starts with Z (Z*)
> >
> > 2) My programme will receive list of names in JAVA collection (Vector
> or
> > ArrayList or Hashtable), I want to search for all the names which are
> not
> > there in the collection
> >
> >
> >
> > I have tried the below code to implement the 1st problem but the
> search
> > returns 0 result
> >
> >
> >
> > Analyzer analyzer = new WhitespaceAnalyzer();
> >
> > boolean createFlag = true;
> >
> > .......
> >
> > .......
> >
> > .......
> >
> > IndexSearcher searcher = new IndexSearcher(indexDir1);
> >
> > Query query = new TermQuery(new Term("name", "Z*"));
> >
> >
> >
> > When I execute teh above code the search is returning 0 Hits.
> >
> > If I give the full name "Zane" the search returns 1 Hits.
> >
> >
> >
> >
> >
> > Thanks in advance,
> >
> > Babu
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to