Search the exact match of a word in Lucene..
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   nithya_vembu
Posted On:   Wednesday, July 19, 2006 05:16 AM

Hi All, I am using Lucene 2.0. I need to fetch a document which exactly matches the searchText. To be more specific,i am having 2 documents with a field CONTENT document1: CONTENT:Robin hood document2: CONTENT:Robin If i search for CONTENTS:Robin, lucene fetches both the documents. But I need document2 alone. I am able to get the document with Robin hood alone by using double quotes ("Robin hood"). But I couldnt fetch the document which possess the text "Robin" alone. Is there any workaround for this? Any help is appreciable. Thanks, Nithya.V    More>>

Hi All,


I am using Lucene 2.0. I need to fetch a document which exactly matches the searchText.


To be more specific,i am having 2 documents with a field CONTENT



document1:

CONTENT:Robin hood



document2:

CONTENT:Robin



If i search for CONTENTS:Robin, lucene fetches both the documents. But I need document2 alone.
I am able to get the document with Robin hood alone by using double quotes ("Robin hood"). But I couldnt fetch the document which possess the text "Robin" alone.
Is there any workaround for this?

Any help is appreciable.



Thanks,

Nithya.V

   <<Less

Re: Search the exact match of a word in Lucene..

Posted By:   vicente_vastich  
Posted On:   Thursday, July 27, 2006 01:21 AM

boolean NOT 'hood'! Using the APi, you can construct a BooleanQuery of the type AND Robin NOT Hood. With QueryParser its + Robin - Hood

-Vicente
About | Sitemap | Contact