lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [lucenenet] NightOwl888 commented on issue #229: Updates docs build
Date Tue, 20 Aug 2019 00:56:42 GMT
NightOwl888 commented on issue #229: Updates docs build
URL: https://github.com/apache/lucenenet/pull/229#issuecomment-522809141
 
 
   While going through and cleaning up the code in the test framework, I was reminded about
an important c# syntax that is not demonstrated on the home page (https://lucenenet.apache.org),
that probably should be.
   
   ```c#
   // Add to the index
   
   var source = new
   {
       Name = "Kermit the Frog",
       FavouritePhrase = "The quick brown fox jumps over the lazy dog"
   };
   var doc = new Document();
   // StringField indexes but doesn't tokenise
   doc.Add(new StringField("name", source.Name, Field.Store.YES));
   
   doc.Add(new TextField("favouritePhrase", source.FavouritePhrase, Field.Store.YES));
   
   writer.AddDocument(doc);
   writer.Flush(triggerMerge: false, applyAllDeletes: false);
   ```
   can be simplified to:
   
   ```c#
   // Add to the index
   
   var source = new
   {
       Name = "Kermit the Frog",
       FavoritePhrase = "The quick brown fox jumps over the lazy dog"
   };
   Document doc = new Document
   {
       // StringField indexes but doesn't tokenize
       new StringField("name", source.Name, Field.Store.YES),
       new TextField("favoritePhrase", source.FavoritePhrase, Field.Store.YES)
   };
   
   writer.AddDocument(doc);
   writer.Flush(triggerMerge: false, applyAllDeletes: false);
   ```
   
   Not urgent, but could we make sure this is updated eventually?
   
   VS2019 is smart enough to give you a hint to do this, but it would be great if the main
samples showed how much we have bent the Java-ness toward .NET. 
   
   > Note to self: Now that I think about it, there is probably a way to add an extension
method to IndexWriter so the whole document initialization and addition can be done in a single
operation. Food for thought...
   
   Side note: could we normalize it to US English? 
   
   * `favorite` instead of `favourite`
   * `tokenize` instead of `tokenise`
   
   Or, just change the samples so they are culture neutral instead, then there doesn't need
to be a debate about it.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message