public static void TestLucene() { var tmp = TranslationMemoryHelpers.TempPath; var dir = FSDirectory.Open(tmp); bool created; TranslationMemoryHelpers.IsIndexExists(out created, dir); IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30), false, IndexWriter.MaxFieldLength.UNLIMITED); IndexDocument(writer, "About Hockey", "hockey", "Hockey is a cool sport which I really like, bla bla"); IndexDocument(writer, "Some great players", "hockey", "Some of the great players from Sweden - well Peter Forsberg, Mats Sunding, Henrik Zetterberg"); IndexDocument(writer, "Soccer info", "soccer", "Soccer might not be as fun as hockey but it's also pretty fun"); IndexDocument(writer, "Players", "soccer", "From Sweden we have Zlatan Ibrahimovic and Henrik Larsson. They are the most well known soccer players"); IndexDocument(writer, "1994", "soccer", "I remember World Cup 1994 when Sweden took the bronze. we had great players. players , bla bla"); writer.Optimize(); writer.Close(); Search(dir); }
public TranslationMemory(ITranslationProject tpCollection) { Index = TranslationMemoryHelpers.BuildTranslationProjectIndex(tpCollection.Modules); this.TranslationProject = tpCollection.Modules.First(); }
public IEnumerable <QueryResult> Query(string language, string query) { return(TranslationMemoryHelpers.SearchTranslationProjects(Index, language, query, TranslationProject.Languages)); }
public TranslationMemory(TranslationModule tp) { this.Index = TranslationMemoryHelpers.BuildTranslationProjectIndex(new ITranslationModule[] { tp }); this.TranslationProject = tp; }