aspose file tools*
The moose likes Java in General and the fly likes Text Search... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Text Search..." Watch "Text Search..." New topic
Author

Text Search...

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
What are the different ways available for text search. We are using Lucene for it. One more I know is from String API (String Tokenizer...). Could any body please tell me others which are more efficient....

Thanks a lot.
Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
Originally posted by rathi ji:
What are the different ways available for text search. We are using Lucene for it. One more I know is from String API (String Tokenizer...). Could any body please tell me others which are more efficient....

Thanks a lot.


Have you looked at regular expressions?
If not browse the java.util.regex package
Rick O'Shay
Ranch Hand

Joined: Sep 19, 2004
Posts: 531
As you probably know, Lucene is an engine and an API for indexing text files and imposing your own grammars. Simple tokenizing is fine if you're not going to create an index for more efficient repeated searching. Tokenizing will not buy you proximity searches, stemming, fuzzy logic, common word filtering, and so on. Lucene is overkill for something like this:

int found = "All your base are belong to us".indexOf("base");
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Originally posted by Ta Ri Ki Sun:


Have you looked at regular expressions?
If not browse the java.util.regex package


No, But I think it is for string validation (providing restriction).
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Take a look at Pattern and Matcher in JDK 1.4 or later. You can use Regex for validation, searching, replacing, parsing, doing the dishes ... no, not that. Anyhow, it's a great way to find substrings that match patterns instead of exactly matching another string like indexOf. Regex can be a bit intimidating to get started with. Feel free to post almost-working code here for more help!


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
 
subject: Text Search...