This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Highlight and Print Search Results for all the documents | |
for (int i = 0 ; i < result.getDocumentCount(); i++) | |
{ | |
FoundDocument document = result.getFoundDocument(i); | |
OutputAdapter outputAdapter = new FileOutputAdapter(OutputFormat.Html, "path/Highlight" + i + ".html"); | |
Highlighter highlighter = new DocumentHighlighter(outputAdapter); | |
index.highlight(document, highlighter); | |
System.out.println("\tDocument: " + document.getDocumentInfo().getFilePath()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Highlight and Print Search Results for all the documents using C# | |
for (int i = 0; i < result.DocumentCount; i++) | |
{ | |
FoundDocument document = result.GetFoundDocument(i); | |
OutputAdapter outputAdapter = new FileOutputAdapter(OutputFormat.Html, indexFolder + "/Highlight" + i + ".html"); | |
Highlighter highlighter = new DocumentHighlighter(outputAdapter); | |
index.Highlight(document, highlighter); | |
Console.WriteLine("\tDocument: " + document.DocumentInfo.FilePath); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fuzzy Search multiple files across multiple folders using C# | |
// Creating an index folder and add document's folder to it | |
Index index = new Index("indexing-folder-path"); | |
index.Add("path/parent-folder"); | |
SearchOptions options = new SearchOptions(); | |
options.FuzzySearch.Enabled = true; // Enabling the fuzzy search | |
options.FuzzySearch.FuzzyAlgorithm = new SimilarityLevel(0.8); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Regex Search multiple files across folders using Java | |
// Creating an index folder and add document's folder to it | |
Index index = new Index("path/indexing-folder-path"); | |
index.add("path/parent-folder"); | |
// Prepare the Regex Query and Search | |
// Regex here is to identify all words having any consecutive repeated characters. | |
String query = "^(.)\\1{1,}"; | |
SearchResult result = index.search(query); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Search by RegEx in multiple files across multiple folders using C# | |
// Creating an index folder and add document's folder to it | |
Index index = new Index("indexing-folder-path"); | |
index.Add("path/parent-folder"); | |
// Prepare the Regex Query and Search | |
// Regex here is to identify all words having any consecutive repeated characters. | |
string query = "^(.)\\1{1,}"; | |
SearchResult result = index.Search(query); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Printing the result | |
Console.WriteLine("Documents: " + result.DocumentCount); | |
Console.WriteLine("Total occurrences: " + result.OccurrenceCount); | |
for (int i = 0; i < result.DocumentCount; i++) | |
{ | |
FoundDocument document = result.GetFoundDocument(i); | |
Console.WriteLine("Document: " + document.DocumentInfo.FilePath); | |
Console.WriteLine("Occurrences: " + document.OccurrenceCount); | |
for (int j = 0; j < document.FoundFields.Length; j++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Printing Search Results === | |
for (int i = 0 ; i < result.getDocumentCount(); i++) | |
{ | |
FoundDocument document = result.getFoundDocument(i); | |
// Printing Search Results =========== | |
System.out.println("Occurrences: " + document.getOccurrenceCount()); | |
for (FoundDocumentField field : document.getFoundFields()) { | |
System.out.println("\tField: " + field.getFieldName()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Read Dublin Core metadata using Java | |
try (Metadata metadata = new Metadata("path/ebook.epub")) { | |
EpubRootPackage root = metadata.getRootPackageGeneric(); | |
System.out.println(root.getDublinCorePackage().getRights()); | |
System.out.println(root.getDublinCorePackage().getPublisher()); | |
System.out.println(root.getDublinCorePackage().getTitle()); | |
System.out.println(root.getDublinCorePackage().getCreator()); | |
System.out.println(root.getDublinCorePackage().getLanguage()); | |
System.out.println(root.getDublinCorePackage().getDate()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Read Dublin Core metadata using C# | |
using (Metadata metadata = new Metadata("path/ebook.epub")) | |
{ | |
var root = metadata.GetRootPackage<EpubRootPackage>(); | |
Console.WriteLine(root.DublinCorePackage.Rights); | |
Console.WriteLine(root.DublinCorePackage.Publisher); | |
Console.WriteLine(root.DublinCorePackage.Title); | |
Console.WriteLine(root.DublinCorePackage.Creator); | |
Console.WriteLine(root.DublinCorePackage.Language); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Edit PPT/PPTX presenatations in Java using GroupDocs presentation editing and automation API | |
// Load Presentation | |
PresentationLoadOptions loadOptions = new PresentationLoadOptions(); | |
loadOptions.setPassword("P@$$w0Rd"); | |
// Edit Presentation | |
Editor editor = new Editor(new FileInputStream("path/presentation.pptx"), loadOptions); | |
PresentationEditOptions editOptions = new PresentationEditOptions(); | |
editOptions.setSlideNumber(0); //1st slide |