Hi Zhenjian YU

 

      Means Now I have 2 options

1.    WildCardQuery

2.       PrefixQuery

A] If I use WildCardQuery it will search “a” in whole word and then return result

      e.g If I type “a” then it will return all results which contain “a” in their spelling.

But I want when user type “a” it will show only “America” & “Asia

And when I type “as” then it will show only “Asia”.

Does WildCardQuery has that capacity to do?

Because this will send query to search engine as “a*” and “as*” ……

 

B] I think so PrefixQuery will do it. Because It will search for those terms in index who has “a” or “as” as prefix.

 

Thanks

     

 

 

Hi Vikas,

 

Seems that you can use the WildCardQuery to do this, just put "a*" as the query term.

But take caution to use WildCardQuery, because it can bring the performance of your system down.

 

Yes, you can also implement your own filter to filter out the results which don't starting with "a".

 

Either way is a solution.

 

Best Regards,

Zhenjian

 

On 5/24/06, Vikas Khengare <[EMAIL PROTECTED]> wrote:

> 

> 

> 

> Hi Zhenjian YU

> 

> 

> 

>       I have implemented that with AJAX Search But when I type "*a*"

> in textbox. It gives me all results which contains letter "a".

> 

> So I am getting "*A*merica", "*A*sia", "Fl*a*g" & "Zhenji*a*n" also.

> 

> But in actual I want only "America" & "Asia".

> 

> 

> 

> Thanks

> 

> 

> 

> -----Original Message-----

> From: Zhenjian YU [mailto:[EMAIL PROTECTED]]

> Sent: Wednesday, May 24, 2006 1:33 PM

> To: java-user@lucene.apache.org

> Cc: lucene-user@jakarta.apache.org; java-dev@lucene.apache.org

> Subject: Re: Can I do "Google Suggest" Like Search? - - - from - -

> -vikas

> 

> 

> 

> hi, *vikas,

> *the ajax way should work for you.

> while in the lucene part, you should do something to handle the prefix

> query.

> 

> Best Regards,

> 

> Zhenjian

> 

> 

> 

> On 5/24/06, Vikas Khengare <[EMAIL PROTECTED]> wrote:

> 

> >

> 

> >  Hi Friend

> >             I want to perform search like "Google search" which will give

> 

> > suggestions to user.

> 

> > So when I type *"L"* it will give me search options names which will

> start

> 

> > from "L". Then when I will type *"Lu"* then it should give me

> > options

> for

> 

> > names which are starting from "Lu". & so on ……

> 

> > 1) Does Lucene provide any API for doing so?

> > 2) Can I use Sort / Filter classes for it?

> > 3) Or do I need to handle it in java (may be any other language)?

 

==================================================================================================

 

with best regards

from .........

vikas r. khengare

Veritas Software India Private Ltd.

Symantec Corporation

Pune, India

                        [ Enjoy your life today.... because yesterday had gone.... and tommorow may never come . ]

 

Reply via email to