`
DavyJones2010
  • 浏览: 154265 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论
文章列表
1. A simple mockup for ArrayList package edu.xmu.designPattern.DesignPattern_Iterator; public class ArrayList { private Object[] objects = new Object[10]; private int index = 0; public void add(Object o) { if (index == objects.length) { Object[] newObjects = new Object[obje ...
1. Eager Initialization Approach package edu.xmu.designPattern.DesingPattern_Singleton; public class Singleton { private static Singleton singleton = new Singleton(); private Singleton() { } public static Singleton getInstance() { return singleton; } } package edu.xmu.de ...
1. Introduction to QueryParser     1) Sometimes we want to pass a String like this: "student AND teacher" to execue query.         It means we want to search a certain field which contains both "student" and "teacher".         We can easily use QueryParser to achiev ...
Summary:     1) In last chapter, we've introduced TermQuery, NumericQuery and TermRangeQuery.     2) In this chapter, we will introduce PrefixQuery/WildcardQuery/BoolenQuery/PhaseQuery/FuzzyQuery.   1) Introduction to PrefixQuery public void searchByPrefix(String fieldName, String fieldValue, ...
1. Application Scenario:     1) We want to build an BBS and enable user to post their comments.         How can we filter the sensitive messages that user posted?     2) In chatting room, our message are filtered and tagged as " Davy Says: *** "         " Davy Says " has bee ...
Summary:     1) Execute precise query using TermQuery     2) Execute fuzzy String type range query using TermRangeQuery     3) Execute precise Numeric type range query using NumericRangeQuery   1. We can use TermQuery to execute precise query.   2. Example as below:     1) Main Function pac ...
1. JUL is an inbeded util tool for logging.   2. The work flow of JUL 3. JUL has abstracted Logging procession into the interaction of several Classes.     1) Level --> Define the the severe level of the log.                    --> JUL has used a different logging level compared with L ...
1. As the time evolves, many logging techniques emerged.     1) java.util.logging (JUL) is provided by SUN along with JDK.     2) org.apache.log4j (Log4j) is provided by ASF.          -> Log4j-1.X and Log4j-2.X          -> But most projects are using Log4j-1.X     3) logback     4) org. ...
1. The lifecycle of IndexReader and IndexWriter     1) The open and close operations for reader/writer are at high cost.     2) Especially for IndexReader, time consumption of these operations are high.     3) So by convention, IndexReader is set as singleton in application. package edu.xmu.luc ...
1. How do we add index for number type? // new Field(String, String, Field.Store.YES, Field.Index.NOT_ANALYZED) // is only applicable for building for string type // we should use a sub-class of Field called NumericField doc.add(new Field("score", 110 + "", Field.Store.YES, F ...
1. Lucene Delete Function  /**   * Delete Index   *   */  public void delete()  {   Directory dir = FSDirectory.open(new File("E:/LuceneIndex"));   IndexWriter writer = null;   try   {    writer = new IndexWriter(dir, new IndexWriterConfig(      Version.LUCENE_35, new SimpleA ...
1. Why do we use Lucene?     1) If we want to execute the query like this:         (content like '%DataStructure%') or (content like '%XMU%') in DB. Then it starts searching the whole content from start to end. That would be low efficiency.         The Lucene comes to build index for the whole c ...
1. Requirement Specification     1) After we have loading data from two different file, and then assembly them into two different kind of JavaBean.     2) We want to join the two list of JavaBean together into a single list of bean using the foreign key.   1. The first kind of JavaBean package ...
1. TreeOriginalNode.java package edu.xmu.tree; public class TreeOriginalNode { private String attr1; private String attr2; private String attr3; private int total; public String getAttr1() { return attr1; } public void setAttr1(String attr1) { this.attr1 = attr1; ...
   1. What is transaction? ----> It is a sequence of operations that should be regard as a whole and cannot be split. One operation in the sequence failed, then all the operation should be rollback.       1) Take a common scenario for example:          1) Money transfer in Bank. A want to tr ...
Global site tag (gtag.js) - Google Analytics