Package org.wijiscommons.ssaf.process.solr

Examples of org.wijiscommons.ssaf.process.solr.SSAFSolrException


      try {
        this.server = new CommonsHttpSolrServer( url );
      }
      catch (MalformedURLException e)
      {
        SSAFSolrException ssafException =
                    new SSAFSolrException(
                            SSAFSolrErrorCodes.ERROR_CONNECTING_SERVER,
                            SSAFErrorTypes.NONLOGIC);
        throw ssafException;
      }
    }
View Full Code Here


                    isIndexed = fieldType.isIndexed();
                }

                if (isIndexed == null)
                {
                    throw new SSAFSolrException("Pointer item, "
                            + pointerItem.getItemName()
                            + ", is not defined in semantics");
                }
               
                if (Boolean.valueOf(isIndexed))
                {

                    DataType dataType =
                        DataType.fromValue(fieldType.getDataType());

                    String fieldName =
                        pointerItem.getItemName() + "_" + dataType.value();

                    String pointerValue = "";

                    switch (dataType)
                    {
                    case STRING:
                        pointerValue =
                            pointerItem.getItemValue().toLowerCase();
                        break;

                    case DATE:
                        // Assuming the coming in date is of format YYYY-MM-DD,
                        // we concatenate the string
                        // with T00:00:00Z.
                        pointerValue =
                            pointerItem.getItemValue().concat(DATE_SUFFIX);
                        break;
                       
                    default:
                        pointerValue = pointerItem.getItemValue();
                        break;
                    }
                    doc.addField(fieldName, pointerValue);
                }
            }

     
      docs.add(doc);
        }

        // Add Docs to Server & Commit
        // Records will not be stored into Index until commit is performed.
        try
        {
            for (Pointer pointer : pointers)
            {
                SolrDocument solrDocument = ssafSearchImpl.searchWithRecordUri(
                    solrLocation, pointer.getRecordUri() );

                if (solrDocument != null)
                {
                    String pointerFilePath = (String) solrDocument
                            .get( "pointer_filepath" );
                    deleteFile( pointerFilePath );
                    String stashFilePath = (String) solrDocument
                            .get( "stash_filepath" );
                    deleteFile( stashFilePath );
                }

            }
            server.add(docs);
            server.commit();
        }
        catch (SolrServerException e)
        {
            log.error("Unable to Stash pointers", e);
            e.printStackTrace();
            throw new SSAFSolrException(SSAFSolrErrorCodes.UNABLE_TO_STASH);
        }
        catch (IOException e)
        {
            log.error("Unable to Stash pointers", e);
            e.printStackTrace();
            throw new SSAFSolrException(SSAFSolrErrorCodes.UNABLE_TO_STASH);
        }
       
  }
View Full Code Here

           
            // Get Pointer from Document
            pointer = (Pointer) u.unmarshal(document);

    } catch( JAXBException je ) {
      SSAFSolrException ssafException =
                new SSAFSolrException(SSAFSolrErrorCodes.XML_UNMARSHALL_ERROR,
                        SSAFErrorTypes.REQUEST_RECORD_ERROR);
      throw ssafException;
        }
    return pointer;
  }
View Full Code Here

        {
            Unmarshaller u = jaxbFactory.getUnmarshaller();
            pointer = (Pointer) u.unmarshal(new File(filePath));

    } catch( JAXBException je ) {
      SSAFSolrException ssafException =
                new SSAFSolrException(SSAFSolrErrorCodes.XML_UNMARSHALL_ERROR,
                        SSAFErrorTypes.NONLOGIC);
      throw ssafException;
        }
    return pointer;
  }
View Full Code Here

        searchResult
                        .setPresentationControlParameters(presentationControlParameters);
        // Return Document
                return marshal(searchResult);
      } else {
        SSAFSolrException ssafException =
                    new SSAFSolrException(
                            "Failed to construct the queryString",
                            SSAFErrorTypes.REQUEST_INVALID);
        throw ssafException;
      }
    } else {
      SSAFSolrException ssafException =
                new SSAFSolrException(
                        "Search Criteria is missing from the request.",
                        SSAFErrorTypes.REQUEST_INVALID);
      throw ssafException;
    }
  }
View Full Code Here

      return document;
     
    }
    catch (Exception e)
    {
      SSAFSolrException ssafException =
                new SSAFSolrException(
                        "Failed to convert the search result Document",
                        SSAFErrorTypes.NONLOGIC);
      throw ssafException;
    }
  }
View Full Code Here

                    searchStrings.add(searchString);
          }
            }
            else
            {
        SSAFSolrException ssafException =
                    new SSAFSolrException(
                            "Neither of the itemName and "
                            + "itemValue in the search request can be empty!");
        ssafException.setErrortype(SSAFErrorTypes.REQUEST_INVALID);
        throw ssafException;
      }
     
    }
View Full Code Here

            // Get SolrDocumentList
            docs = rsp.getResults();
        }
        catch (SolrServerException e)
        {
            SSAFSolrException ssafException =
                new SSAFSolrException(e.getMessage(), SSAFErrorTypes.NONLOGIC);
            throw ssafException;
        }

        return docs;
View Full Code Here

       
        Unmarshaller unmarshaller = jaxbFactory.getUnmarshaller();
            searchRequest = (SearchRequest) unmarshaller.unmarshal(document);

    } catch( JAXBException je ) {
      SSAFSolrException ssafException =
                new SSAFSolrException(SSAFSolrErrorCodes.XML_UNMARSHALL_ERROR,
                        SSAFErrorTypes.REQUEST_INVALID);
      throw ssafException;
        }
   
    return searchRequest;
View Full Code Here

            Unmarshaller unmarshaller = jaxbFactory.getUnmarshaller();
            pointer = (Pointer) unmarshaller.unmarshal(new File(filePath));

    } catch( JAXBException je ) {
      je.printStackTrace();
      SSAFSolrException ssafException =
                new SSAFSolrException("Failed to marshal the stashed pointer",
                        SSAFErrorTypes.NONLOGIC);
      throw ssafException;
        }
   
    // Return Pointer
View Full Code Here

TOP

Related Classes of org.wijiscommons.ssaf.process.solr.SSAFSolrException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.