| |
|
How to create and search a Lucene.Net index in 4 simple steps using C#, Step 4
|
| |
|
|
| |
| Display the results. |
| |
| To view the results we need to loop through the ScoreDoc array we
created in Part3. We do this by iterating through it within a for loop. |
| |
for (int i = 0; i < hits.Length; i++)
{
int docId = hits[i].doc;
float score = hits[i].score;
Lucene.Net.Documents.Document doc = searcher.Doc(docId);
string result = "Score: " + score.ToString() +
" Field: " + doc.Get("fieldName") +
" Field2: " + doc.Get("TERM");
}
|
| |
| That’s it. Follow these steps and you will have implemented a
very powerful search capability. |
| |
| |
| |
    |
| |
| |
| |
|
|
| |
|
|
| |
|
|
| |
| |
| Posts: 113 |
| Comments:
86 |
| Fundamentals:
16 |
| |
 |
| |
| |
|
| |
 |
| |
 |
| |
 |
| |
|
| 2011 December (2) |
| 2011 November (6) |
| 2011 October (7) |
| 2011 September (7) |
| 2011 August (9) |
| 2011 July (9) |
| 2011 June (8) |
| 2011 May (9) |
| 2011 April (7) |
| 2011 March (9) |
| 2011 February (8) |
| 2011 January (8) |
| 2010 December (7) |
| 2010 November (8) |
| 2010 October (4) |
| |
| |
|
| |
|
|
| |
| |
|
The sample code on this website is provided to illustrate a concept and should not be used in
applications or Web sites without proper professional consultation, as it may not illustrate
the safest coding practices. I assume no liability for incidental or consequential damages
should the sample code be used for purposes other than as intended.
|
| |
|
| | | |