Ejemplo n.º 1
0
  private void renderDocument(int i)
      throws IOException, ParseException, SyntaxError, SearchLibException {
    ResultDocument doc = result.getDocument(i, null);
    for (ReturnField field : searchRequest.getReturnFieldList()) {
      renderField(doc, field);
      if (field.getName() != null && !field.getName().equals("")) writer.print(',');
    }
    for (SnippetField field : searchRequest.getSnippetFieldList()) {
      renderSnippetValue(doc, field);
      String fName = field.getName();
      if (fName != null && fName.length() > 0) writer.print(',');
    }

    writer.print('\n');
  }
 public List<String> getFieldList() throws SearchLibException, InterruptedException {
   if (fieldType == null) return null;
   Client client = getClient();
   if (client == null) return null;
   if (searchTemplate == null) new AlertController("Please Select an Query Template");
   AbstractSearchRequest request =
       (AbstractSearchRequest) client.getRequestMap().get(searchTemplate);
   if (request == null) return null;
   List<String> nameList = new ArrayList<String>();
   nameList.add(null);
   if (fieldType == OpenSearchTypes.FIELD) request.getReturnFieldList().toNameList(nameList);
   else if (fieldType == OpenSearchTypes.SNIPPET)
     request.getSnippetFieldList().toNameList(nameList);
   return nameList;
 }
 public List<String> getSnippetFieldLeft() throws SearchLibException {
   synchronized (this) {
     Client client = getClient();
     if (client == null) return null;
     AbstractSearchRequest request = (AbstractSearchRequest) getRequest();
     if (request == null) return null;
     if (snippetFieldLeft != null) return snippetFieldLeft;
     snippetFieldLeft = new ArrayList<String>();
     SnippetFieldList snippetFields = request.getSnippetFieldList();
     for (SchemaField field : client.getSchema().getFieldList())
       if (field.checkStored(Stored.YES, Stored.COMPRESS))
         if (field.getTermVector() == TermVector.POSITIONS_OFFSETS)
           if (snippetFields.get(field.getName()) == null) {
             if (selectedSnippet == null) selectedSnippet = field.getName();
             snippetFieldLeft.add(field.getName());
           }
     return snippetFieldLeft;
   }
 }