Exemple #1
0
 /**
  * 设置索引唯一ID 对应 Lucene 中的 UN_TOKENIZED 类型,可以被搜索
  *
  * @param id
  */
 public void setId(String id) {
   RDocItem docItem = new RDocItem();
   docItem.setItemType(RetrievalType.RDocItemType.KEYWORD);
   docItem.setContent(id);
   docItem.setName(RetrievalType.RDocItemSpecialName._IID);
   putItem(docItem);
 }
Exemple #2
0
  /**
   * 获取所有索引字段
   *
   * @return
   */
  public List<RDocItem> getDocItemList() {
    List<RDocItem> docItemList = new ArrayList<RDocItem>();
    String fieldNames = "";

    Map<String, RDocItem> map = getDocItemMap();
    if (map == null || map.size() <= 0) {
      return docItemList;
    }

    Object[][] objects = UtilTool.getMapKeyValue(map);

    int length = objects.length;
    for (int i = 0; i < length; i++) {
      RDocItem docItem = (RDocItem) objects[i][1];
      docItemList.add(docItem);
      fieldNames +=
          StringClass.getString(objects[i][0]).toUpperCase()
              + RetrievalConstant.DEFAULT_INDEX_FIELD_NAME_SPLIT;
    }

    RDocItem allFieldRDocItem = new RDocItem();
    allFieldRDocItem.setName(RetrievalType.RDocItemSpecialName._IAF);
    allFieldRDocItem.setContent(fieldNames);
    allFieldRDocItem.setItemType(RetrievalType.RDocItemType.STORE_ONLY);

    docItemList.add(allFieldRDocItem);

    return docItemList;
  }
Exemple #3
0
 /**
  * 设置索引来源类型 对应 Lucene 中的 UN_TOKENIZED 类型,可以被搜索
  *
  * @param sourceIndexType
  */
 protected void setSourceIndexType(RetrievalType.RIndexSourceType sourceIndexType) {
   this.sourceIndexType = sourceIndexType;
   RDocItem docItem = new RDocItem();
   docItem.setItemType(RetrievalType.RDocItemType.KEYWORD);
   docItem.setContent(sourceIndexType);
   docItem.setName(RetrievalType.RDocItemSpecialName._IST);
   putItem(docItem);
 }
Exemple #4
0
 /**
  * 设置索引信息分类 对应 Lucene 中的 UN_TOKENIZED 类型,可以被搜索
  *
  * @param indexInfoType
  */
 public void setIndexInfoType(String indexInfoType) {
   this.indexInfoType = indexInfoType;
   RDocItem docItem = new RDocItem();
   docItem.setItemType(RetrievalType.RDocItemType.KEYWORD);
   docItem.setContent(indexInfoType);
   docItem.setName(RetrievalType.RDocItemSpecialName._IBT);
   putItem(docItem);
 }
Exemple #5
0
  /**
   * 获取所有索引字段
   *
   * @return
   */
  private Map<String, RDocItem> getDocItemMap() {

    RDocItem docItemFullContent = new RDocItem();
    docItemFullContent.setItemType(RetrievalType.RDocItemType.CONTENT);
    if (fullContentFlag) {
      docItemFullContent.setContent(fullContent);
    } else {
      docItemFullContent.setContent("");
    }
    docItemFullContent.setName(RetrievalType.RDocItemSpecialName._IAC);
    putItem(docItemFullContent);

    String creatTime = dateTime.getNowDateTime();

    RDocItem docItem = new RDocItem();
    docItem.setItemType(RetrievalType.RDocItemType.DATE);
    docItem.setContent(creatTime);
    docItem.setName(RetrievalType.RDocItemSpecialName._IC);
    putItem(docItem);

    //		RDocItem hitsDocItem=new RDocItem();
    //		hitsDocItem.setItemType(RetrievalType.RDocItemType.NUMBER);
    //		hitsDocItem.setContent("0");
    //		hitsDocItem.setName(RetrievalType.RDocItemSpecialName.R_DOC_ITEM_SPECIAL_NAME_HITS);
    //		putItem(hitsDocItem);

    return docItemMap;
  }
Exemple #6
0
 private void putItem(RDocItem docItem) {
   docItemMap.put(docItem.getName(), docItem);
 }
Exemple #7
0
 /**
  * 设置可以被模糊搜索的索引内容 对应 Lucene 中的 TOKENIZED 类型,可以被搜索
  *
  * @param content
  */
 public void addContent(RDocItem content) {
   content.setItemType(RetrievalType.RDocItemType.CONTENT);
   fullContent += content.getContent();
   putItem(content);
 }
Exemple #8
0
 /**
  * 设置可以被模糊搜索的索引属性内容 对应 Lucene 中的 TOKENIZED 类型,可以被搜索
  *
  * @param property
  */
 public void addProperty(RDocItem property) {
   property.setItemType(RetrievalType.RDocItemType.PROPERTY);
   fullContent += property.getContent();
   putItem(property);
 }
Exemple #9
0
 /**
  * 设置索引属性内容 对应 Lucene 中的 UN_TOKENIZED 类型,并且不能被搜索
  *
  * @param property
  */
 public void addUnTokenizedStoreOnlyProperty(RDocItem key) {
   key.setItemType(RetrievalType.RDocItemType.STORE_ONLY);
   putItem(key);
 }
Exemple #10
0
 /**
  * 设置只能被精确搜索的索引属性内容 对应 Lucene 中的 UN_TOKENIZED 类型,可以被搜索
  *
  * @param property
  */
 public void addUnTokenizedProperty(RDocItem key) {
   key.setItemType(RetrievalType.RDocItemType.KEYWORD);
   fullContent += key.getContent();
   putItem(key);
 }
Exemple #11
0
 /**
  * 设置数值类型索引内容 对应 Lucene 中的 UN_TOKENIZED 类型,可以被搜索
  *
  * @param property
  */
 public void addNumberProperty(RDocItem number) {
   number.setItemType(RetrievalType.RDocItemType.NUMBER);
   fullContent += number.getContent();
   putItem(number);
 }
Exemple #12
0
 /**
  * 设置日期类型索引内容 对应 Lucene 中的 UN_TOKENIZED 类型,可以被搜索
  *
  * @param property
  */
 public void addDateProperty(RDocItem date) {
   date.setItemType(RetrievalType.RDocItemType.DATE);
   fullContent += date.getContent();
   putItem(date);
 }