Skip to content

Instantly share code, notes, and snippets.

@aliahmedaspose
aliahmedaspose / App.java
Last active September 24, 2018 11:48
New Test
String indexFolder = "D:\\Search\\MyIndex\\";
String documentsFolder = "D:\\Search\\MyDocuments\\";
String searchQuery = "\u03c0\u03b1\u03b8\u03c3\u03b5"; // παθσε
System.out.println("Search query: " + searchQuery);
Index index = new Index(indexFolder, true);
index.addToIndex(documentsFolder);
SearchParameters parameters = new SearchParameters();
@aliahmedaspose
aliahmedaspose / App.java
Created September 24, 2018 11:42
Testing
package com.groupdocs.search;
public class App
{
public static void main( String[] args )
{
String indexFolder = "D:\\Search\\MyIndex\\";
String documentsFolder = "D:\\Search\\MyDocuments\\";
String searchQuery = "\u03c0\u03b1\u03b8\u03c3\u03b5"; // παθσε
// For complete examples and data files, please go to https://github.com/groupdocs-metadata/GroupDocs.Metadata-for-.NET
try (TiffFormat format = new TiffFormat(Common.mapSourceFilePath(path)))
{
TiffTag[] tags = new TiffTag[]
{
new TiffAsciiTag(TiffTagIdEnum.Artist, "GroupDocs"),
new TiffAsciiTag(TiffTagIdEnum.Copyright, "GroupDocs.Metadata"),
};
format.getExifValues().setTags(tags);
// For complete examples and data files, please go to https://github.com/groupdocs-metadata/GroupDocs.Metadata-for-.NET
try (TiffFormat format = new TiffFormat(Common.mapSourceFilePath(path)))
{
format.getExifValues().setArtist("GroupDocs");
format.getExifValues().setSoftware("GroupDocs.Metadata");
format.save(Common.mapDestinationFilePath(path));
}
//For complete examples and data files, please go to https://github.com/groupdocs-search/GroupDocs.Search-for-.NET
// Creating cancellation object
Cancellation cancellation = new Cancellation();
// Load index
Index index = new Index(Utilities.indexPath);
// Updating
index.UpdateAsync(cancellation);
//For complete examples and data files, please go to https://github.com/groupdocs-search/GroupDocs.Search-for-.NET
// Load index
Index index = new Index(Utilities.indexPath);
// Updating index
index.UpdateAsync();
// Breaking updating
index.Break();
//For complete examples and data files, please go to https://github.com/groupdocs-search/GroupDocs.Search-for-.NET
Index index = new Index(Utilities.indexPath); // Creating index
index.AddToIndex(Utilities.documentsPath); // Indexing folder with documents
SearchParameters parameters = new SearchParameters();
parameters.UseWordFormsSearch = true; // Enabling word forms search
SearchResults searchResult = index.Search("swimming", parameters); // Searching for words "swim", "swims", "swimming", "swam", "swum"
if (searchResult.Count > 0)
{
// List of found files
//For complete examples and data files, please go to https://github.com/groupdocs-search/GroupDocs.Search-for-.NET
string indexFolder = Utilities.indexPath;
string documentFolder = Utilities.documentsPath;
IndexingSettings settings = new IndexingSettings();
// specifying count of threads for searching
settings.SearchingThreads = NumberOfThreads.One;
Index index = new Index(indexFolder, true, settings);
index.AddToIndex(documentFolder);
//For complete examples and data files, please go to https://github.com/groupdocs-search/GroupDocs.Search-for-.NET
string indexFolder = Utilities.indexPath;
string documentFolder1 = Utilities.documentsPath;
string documentFolder2 = Utilities.documentsPath2;
string documentFolder3 = Utilities.documentsPath3;
Index index = new Index(indexFolder, true);
index.AddToIndex(documentFolder1);
// For complete examples and data files, please go to https://github.com/groupdocsmetadata/GroupDocs_Metadata_NET
try
{
using (TorrentFormat torrentFormat = new TorrentFormat(Common.MapDestinationFilePath(filePath)))
{
TorrentMetadata info = torrentFormat.TorrentInfo;
Console.WriteLine(info.Announce);
Console.WriteLine(info.CreatedBy);
Console.WriteLine(info.CreationDate);
Console.WriteLine(info.Comment);