You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2020/11/01 15:46:38 UTC
[lucenenet] 03/05: website: Changed home page example to use
Console.WriteLine() instead of 3rd party LinqPad Dump() method.
This is an automated email from the ASF dual-hosted git repository.
nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git
commit 9df13addcbb74a44f65fc72485db287465eb03c1
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Nov 1 22:15:06 2020 +0700
website: Changed home page example to use Console.WriteLine() instead of 3rd party LinqPad Dump() method.
---
.../lucenetemplate/partials/home-quick-start.tmpl.partial | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/websites/site/lucenetemplate/partials/home-quick-start.tmpl.partial b/websites/site/lucenetemplate/partials/home-quick-start.tmpl.partial
index ef89a38..6bcead6 100644
--- a/websites/site/lucenetemplate/partials/home-quick-start.tmpl.partial
+++ b/websites/site/lucenetemplate/partials/home-quick-start.tmpl.partial
@@ -69,12 +69,17 @@ var phrase = new MultiPhraseQuery
using var reader = writer.GetReader(applyAllDeletes: true);
var searcher = new IndexSearcher(reader);
var hits = searcher.Search(phrase, 20 /* top 20 */).ScoreDocs;
+
+// Display the output in a table
+Console.WriteLine($"{"Score",10}" +
+ $" {"Name",-15}" +
+ $" {"Favorite Phrase",-40}");
foreach (var hit in hits)
{
- var foundDoc = searcher.Doc(hit.Doc);
- hit.Score.Dump("Score");
- foundDoc.Get("name").Dump("Name");
- foundDoc.Get("favoritePhrase").Dump("Favorite Phrase");
+ var foundDoc = searcher.Doc(hit.Doc);
+ Console.WriteLine($"{hit.Score:f8}" +
+ $" {foundDoc.Get("name"),-15}" +
+ $" {foundDoc.Get("favoritePhrase"),-40}");
}
</code>
</pre>