Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Text Search...

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 442
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 531
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic