|
|
@ -12,7 +12,7 @@ import com.fr.design.mainframe.toolbar.UpdateActionManager; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.json.JSONException; |
|
|
|
import com.fr.json.JSONException; |
|
|
|
import com.fr.json.JSONObject; |
|
|
|
import com.fr.json.JSONObject; |
|
|
|
import com.fr.log.FRLoggerFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.stable.ProductConstants; |
|
|
|
import com.fr.stable.ProductConstants; |
|
|
|
import com.fr.third.org.apache.lucene.analysis.Analyzer; |
|
|
|
import com.fr.third.org.apache.lucene.analysis.Analyzer; |
|
|
|
import com.fr.third.org.apache.lucene.analysis.standard.StandardAnalyzer; |
|
|
|
import com.fr.third.org.apache.lucene.analysis.standard.StandardAnalyzer; |
|
|
@ -98,12 +98,12 @@ public class RecentSearchManager implements AlphaFineSearchProvider { |
|
|
|
try { |
|
|
|
try { |
|
|
|
directory = FSDirectory.open(new File(path)); |
|
|
|
directory = FSDirectory.open(new File(path)); |
|
|
|
} catch (IOException e) { |
|
|
|
} catch (IOException e) { |
|
|
|
FRLoggerFactory.getLogger().error("cannot open directory " + path); |
|
|
|
FineLoggerFactory.getLogger().error("cannot open directory " + path); |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
try { |
|
|
|
indexWriter = new IndexWriter(directory, config); |
|
|
|
indexWriter = new IndexWriter(directory, config); |
|
|
|
} catch (IOException e) { |
|
|
|
} catch (IOException e) { |
|
|
|
FRLoggerFactory.getLogger().error("not privilege to write to" + path); |
|
|
|
FineLoggerFactory.getLogger().error("not privilege to write to" + path); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -118,7 +118,7 @@ public class RecentSearchManager implements AlphaFineSearchProvider { |
|
|
|
directory = FSDirectory.open(new File(path)); |
|
|
|
directory = FSDirectory.open(new File(path)); |
|
|
|
indexReader = DirectoryReader.open(directory); |
|
|
|
indexReader = DirectoryReader.open(directory); |
|
|
|
} catch (IOException e) { |
|
|
|
} catch (IOException e) { |
|
|
|
FRLoggerFactory.getLogger().error("not privilege to read " + path); |
|
|
|
FineLoggerFactory.getLogger().error("not privilege to read " + path); |
|
|
|
} |
|
|
|
} |
|
|
|
indexSearcher = new IndexSearcher(indexReader); |
|
|
|
indexSearcher = new IndexSearcher(indexReader); |
|
|
|
} |
|
|
|
} |
|
|
@ -140,7 +140,7 @@ public class RecentSearchManager implements AlphaFineSearchProvider { |
|
|
|
doc.add(new IntField("searchCount", searchCount, Field.Store.YES)); |
|
|
|
doc.add(new IntField("searchCount", searchCount, Field.Store.YES)); |
|
|
|
writeDoc(doc); |
|
|
|
writeDoc(doc); |
|
|
|
} catch (JSONException e) { |
|
|
|
} catch (JSONException e) { |
|
|
|
FRLoggerFactory.getLogger().error("add document error: " + e.getMessage()); |
|
|
|
FineLoggerFactory.getLogger().error("add document error: " + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -154,7 +154,7 @@ public class RecentSearchManager implements AlphaFineSearchProvider { |
|
|
|
indexWriter.commit(); |
|
|
|
indexWriter.commit(); |
|
|
|
indexWriter.close(); |
|
|
|
indexWriter.close(); |
|
|
|
} catch (IOException e) { |
|
|
|
} catch (IOException e) { |
|
|
|
FRLoggerFactory.getLogger().error("write document error: " + e.getMessage()); |
|
|
|
FineLoggerFactory.getLogger().error("write document error: " + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -195,7 +195,7 @@ public class RecentSearchManager implements AlphaFineSearchProvider { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
FRLoggerFactory.getLogger().error("local search error: " + e.getMessage()); |
|
|
|
FineLoggerFactory.getLogger().error("local search error: " + e.getMessage()); |
|
|
|
return recentModelList; |
|
|
|
return recentModelList; |
|
|
|
} |
|
|
|
} |
|
|
|
return recentModelList; |
|
|
|
return recentModelList; |
|
|
|