示例#1
0
 JdbcIndexDefinition(
     DataSource ds,
     Element element,
     Set allIndexedFields,
     boolean storeText,
     boolean mergeText,
     Analyzer a,
     boolean isSub) {
   this.dataSource = ds;
   indexSql = element.getAttribute("sql");
   key = element.getAttribute("key");
   String elementId = element.getAttribute("identifier");
   identifier = "".equals(elementId) ? key : elementId;
   findSql = element.getAttribute("find");
   NodeList childNodes = element.getChildNodes();
   for (int k = 0; k < childNodes.getLength(); k++) {
     if (childNodes.item(k) instanceof Element) {
       Element childElement = (Element) childNodes.item(k);
       if ("field".equals(childElement.getLocalName())) {
         if (childElement.getAttribute("keyword").equals("true")) {
           keyWords.add(childElement.getAttribute("name"));
         }
         String m = childElement.getAttribute("multiple");
         if ("".equals(m)) m = "add";
         if (!m.equals("add")) {
           nonDefaultMultiples.put(
               childElement.getAttribute("name"), Indexer.Multiple.valueOf(m.toUpperCase()));
         }
         String b = childElement.getAttribute("boost");
         if (!b.equals("")) {
           boosts.put(childElement.getAttribute("name"), Float.valueOf(b));
         }
       } else if ("related".equals(childElement.getLocalName())) {
         subQueries.add(
             new JdbcIndexDefinition(
                 ds, childElement, allIndexedFields, storeText, mergeText, a, true));
       }
     }
   }
   this.analyzer = a;
   this.isSub = isSub;
   assert !isSub || "".equals(findSql);
 }
示例#2
0
 public Set<String> getIdentifiers() {
   Set<String> ids = new HashSet<String>();
   ids.add(getIdentifier());
   return ids;
 }