What is a good Java library that can be used to search across multiple search query list files?

Basically, what I would like to do is search in the folder of my subfolders for a list of search terms. It should not be heavily optimized or anything like that. I would like the library to be able to "match the case", the coincidence "Only whole words", etc.

I think I could write something like this, opening every file in the file, and looking for every word, etc., but I really want a short reduction. Is there some kind of library that already does most of this?

My dream code would be something like this:

ArrayList occurrences = SomeLibrary.parse("directoryPath","searchTerm");

Is there anything close to this high level?

Thanks Grae

+5
source share
4 answers

I would not recommend using Lucene (or Solr) for these requirements.

  • First of all, there is no need for a fully functional text search library that (simply) makes all kinds of magic a very reliable text search, using all the linguistic knowledge of shadow games, grammar and syntax.

  • Lucene , Lucene . , , . . , " 123" 12345. "" , . Lucene - "google", , . "" , , Lucene, .

Java BufferedReader, String.match String.contains.

+4

Lucene? . , , "ArrayList occences = SomeLibrary.parse(" directoryPath "," searchTerm ");:) , , .

, Lucene.

Solr ( Apache), .

Lucene, .

+3

Apache Solr. . Solr . . , .

+2

Grae, :

  • Lucene - Java. .
  • Solr - , Lucene -. HTTP Java Solrj.

Java, Lucene. , Solr. Solr tutorial Lucene.

Both approaches here require an indexing stage and a later search stage. Your question seems to have a more grep-like flavor, but I don't know the appropriate Java library for this. You also did not describe file types - zero Lucene works with raw text. You may need Apache Tika to get text and metadata from your files.

0
source

All Articles