In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
In this issue, the editor will bring you a simple search about Lucene. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
First of all, we will explain several basic properties and methods of Lucene.
Attributes:
TotalHits-the number of documents that match the search criteria
ScoreDocs []-an array of ScoreDoc objects containing search results
Methods:
GetMaxScore---- returns the maximum score if it has finished sorting (when passing and sorting, the program needs to control whether the field is scored or not calculated separately).
Package lab02;import java.io.File;import java.io.IOException;import org.apache.lucene.document.Document;import org.apache.lucene.index.IndexReader;import org.apache.lucene.index.Term;import org.apache.lucene.search.IndexSearcher;import org.apache.lucene.search.Query;import org.apache.lucene.search.TermQuery;import org.apache.lucene.search.TopDocs;import org.apache.lucene.store.Directory;import org.apache.lucene.store.FSDirectory Public class BasicSearchTest {/ * @ author Owater * @ param args * / public static void main (String [] args) throws IOException {/ / TODO Auto-generated method stub String indexDir = "E:/MyEclipse/Lucene/lab02/index" / / Open the index Directory dir = FSDirectory.open (new File (indexDir)) in the specified directory; IndexReader reader = IndexReader.open (dir); / / display all the documents in the index System.out.println ("document list in the index:"); for (int item0
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.