コード例 #1
0
 /**
  * Perform searching for word by word content.
  *
  * @param content the content used to search.
  * @return a list of found documents.
  * @throws java.io.IOException if the path to the lucene index is incorrect.
  */
 public static List<Document> performSearchByContent(String content) throws IOException {
   List<Document> foundDocs =
       performSearch(QueryUtils.buildPhraseQuery(content), LuceneUtils.getLuceneSearcher());
   if (CollectionUtils.isEmpty(foundDocs)) {
     foundDocs =
         performSearch(QueryUtils.buildFuzzyQuery(content), LuceneUtils.getLuceneSearcher());
   }
   return foundDocs;
 }
コード例 #2
0
 /**
  * Perform searching for word by word content.
  *
  * @param content the content used to search.
  * @param luceneDirPath the lucene index path.
  * @return a list of found documents.
  * @throws java.io.IOException if the path to the lucene index is incorrect.
  */
 public static List<Document> performSearchByContent(String content, String luceneDirPath)
     throws IOException {
   String indexDirPath = luceneDirPath + PACKAGE_PATH;
   return performSearch(
       QueryUtils.buildPhraseQuery(content), LuceneUtils.getLuceneSearcher(indexDirPath));
 }