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 Askar Zaidi <as...@gmail.com> on 2007/07/18 21:40:25 UTC

Lucene shows parts of search query as a HIT

Hey folks,

I am a new Lucene user , I used the following after indexing:

search(searcher, "W. Chan Kim");

Lucene showed me hits of documents where "channel" word existed. Notice that
"Chan" is a part of "Channel" . How do I stop this ?

I am keen to find the exact word.

I used the following, before the search method:

 IndexWriter writer = new IndexWriter(indexPath, new StandardAnalyzer(),
true);

                                writer.addDocument
(createDocument(item,words));
                                writer.optimize();
                                writer.close();
                                searcher = new IndexSearcher(indexPath);

thanks !

AZ

Re: Lucene shows parts of search query as a HIT

Posted by Askar Zaidi <as...@gmail.com>.
Hey Guys,

I just checked my Lucene results. It shows a document with the word hit
"change" when I am searching for "Chan", and it considers that as a hit. Is
there a way to stop this and show just the exact word match ?

I started using Lucene yesterday, so I am fairly new !

thanks
AZ

On 7/18/07, Erick Erickson <er...@gmail.com> wrote:
>
> Are you sure that the hit wasn't on "w" or "kim"? The
> default for searching is OR...
>
> I recommend that you get a copy of Luke (google lucene luke)
> which allows you to examine your index as well as see how
> queries parse using various analyzers. It's an invaluable tool...
>
> Best
> Erick
>
> On 7/18/07, Askar Zaidi <as...@gmail.com> wrote:
> >
> > Hey folks,
> >
> > I am a new Lucene user , I used the following after indexing:
> >
> > search(searcher, "W. Chan Kim");
> >
> > Lucene showed me hits of documents where "channel" word existed. Notice
> > that
> > "Chan" is a part of "Channel" . How do I stop this ?
> >
> > I am keen to find the exact word.
> >
> > I used the following, before the search method:
> >
> > IndexWriter writer = new IndexWriter(indexPath, new StandardAnalyzer(),
> > true);
> >
> >                                 writer.addDocument
> > (createDocument(item,words));
> >                                 writer.optimize();
> >                                 writer.close();
> >                                 searcher = new IndexSearcher(indexPath);
> >
> > thanks !
> >
> > AZ
> >
>

Re: Lucene shows parts of search query as a HIT

Posted by Erick Erickson <er...@gmail.com>.
Are you sure that the hit wasn't on "w" or "kim"? The
default for searching is OR...

I recommend that you get a copy of Luke (google lucene luke)
which allows you to examine your index as well as see how
queries parse using various analyzers. It's an invaluable tool...

Best
Erick

On 7/18/07, Askar Zaidi <as...@gmail.com> wrote:
>
> Hey folks,
>
> I am a new Lucene user , I used the following after indexing:
>
> search(searcher, "W. Chan Kim");
>
> Lucene showed me hits of documents where "channel" word existed. Notice
> that
> "Chan" is a part of "Channel" . How do I stop this ?
>
> I am keen to find the exact word.
>
> I used the following, before the search method:
>
> IndexWriter writer = new IndexWriter(indexPath, new StandardAnalyzer(),
> true);
>
>                                 writer.addDocument
> (createDocument(item,words));
>                                 writer.optimize();
>                                 writer.close();
>                                 searcher = new IndexSearcher(indexPath);
>
> thanks !
>
> AZ
>