Last active
January 3, 2016 09:59
-
-
Save sirkirby/8446352 to your computer and use it in GitHub Desktop.
Azure Full Text Search Ex 2
This file contains hidden or 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
| var indexWriter = new IndexWriter(directory, new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30), true, | |
| new IndexWriter.MaxFieldLength(IndexWriter.DEFAULT_MAX_FIELD_LENGTH)); | |
| foreach (var book in Books) | |
| { | |
| var document = new Document(); | |
| // store the Id but don't need to index it | |
| document.Add(new Field("Id", | |
| book.BookId.ToString(), | |
| Field.Store.YES, | |
| Field.Index.NO, | |
| Field.TermVector.NO)); | |
| document.Add(new Field("Title", | |
| book.Title, | |
| Field.Store.YES, | |
| Field.Index.ANALYZED, | |
| Field.TermVector.NO)); | |
| document.Add(new Field("Author", | |
| book.Author ?? "", | |
| Field.Store.YES, | |
| Field.Index.ANALYZED, | |
| Field.TermVector.NO)); | |
| document.Add(new Field("CoAuthor", | |
| book.CoAuthor ?? "", | |
| Field.Store.YES, | |
| Field.Index.ANALYZED, | |
| Field.TermVector.NO)); | |
| indexWriter.AddDocument(document); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment