Examples of SearchResult


Examples of it.unibz.instasearch.indexing.SearchResult

    }
   
    if( searchQuery.equals(currentSearchQuery) && cachedResults != null ) // same query
      return cachedResults;
   
    SearchResult result = null;
    cachedResults = null;
    resultCount = 0;
    Object[] resultArray = null;
   
    if(searchString != null)
    {
      try {
        result = searcher.search(searchQuery); // do the search
        currentSearchQuery = searchQuery;
       
        if( result == null ) {
          if( !searchQuery.isFuzzy() ) {
            SearchQuery newQuery = new SearchQuery(searchQuery);
            newQuery.setExact(false);
            newQuery.setFuzzy(true);
            resultArray = new Object[]{NO_RESULTS_MESSAGE, newQuery}; // add fuzzy query
          } else {
            resultArray = new Object[]{NO_RESULTS_MESSAGE};
          }
         
          cachedResults = resultArray;
         
          return resultArray;
        }
       
        searchTerms = result.getSearchTerms();
       
      } catch (Exception e) {
        InstaSearchPlugin.log(e);
        return new Exception[]{e};
      }
    }
   
    List<SearchResultDoc> resultDocs = result.getResultDocs();
    this.resultCount = resultDocs.size();
   
    boolean addMoreResults = false, addFindSimilar = false;
   
    if( searchQuery.isLimited() && result.isFull() ) { // if only showing limited number of matches
      addMoreResults = true;
    }
    else
    {
      if( searchQuery.isExact() && !searchQuery.isFuzzy() ) // if query is exact, can try search for individual tokens
View Full Code Here

Examples of javax.naming.directory.SearchResult

      // The search has been executed, so process up to one batch of
      // results.
      List<?> result = null;
      while (result == null && searchEnumeration != null && searchEnumeration.hasMore())
      {
        SearchResult searchResult = (SearchResult) searchEnumeration.next();
        result = getRow(searchResult);
      }

      return result;
    } catch (SizeLimitExceededException e) {
View Full Code Here

Examples of javax.naming.directory.SearchResult

    doc.getDocumentElement().appendChild(resultElement);

    Element record = null;
    Element attribute = null;

    SearchResult sr = null;
    NamingEnumeration attrs = null;
    Attribute attr = null;
    String key = null;
    NamingEnumeration values = null;
    String value = null;

    try
    {
      while (results.hasMore())
      {
        sr = (SearchResult) results.next();
        attrs = sr.getAttributes().getAll();

        record = doc.createElement("Record");

        while (attrs.hasMore())
        {
View Full Code Here

Examples of javax.naming.directory.SearchResult

    {
      ldapResult = executeLdap(binding, context);

      while (ldapResult.hasMore())
      {
        SearchResult sr = ldapResult.next();
        Attributes sra = sr.getAttributes();
       
        Map<String, Node> aBinding = new HashMap<String, Node>();

        // Mapping results to rdf
        if (subject.isVariable())
          aBinding.put(subject.getName(), createLdapNode(sr
              .getNameInNamespace()));

        boolean valid = true;

        for (Triple triple : query)
View Full Code Here

Examples of javax.naming.directory.SearchResult

    if ("".equals(queryString)) // We aren't searching, just get attributes
    {
      Attributes attrs = context.getAttributes(baseURI, (String[]) toGet
          .toArray(new String[] {}));
      // Wrap this to fit this method's contract
      SearchResult sr = new SearchResult(null, null, attrs);
      sr.setNameInNamespace(uriToName(baseURI));
      results = new SingletonNamingEnumeration<SearchResult>(sr);
    }
    else // An actual query
    {
      SearchControls sc = new SearchControls();
View Full Code Here

Examples of javax.naming.directory.SearchResult

   
    assertTrue("I found Paul", results.hasMore());
   
    while (results.hasMore())
    {
      SearchResult result = results.next();
      Attributes attributes = result.getAttributes();
      NamingEnumeration<? extends Attribute> theAttributes = attributes.getAll();
      while (theAttributes.hasMore())
      {
        Attribute attribute = theAttributes.next();
        log.info("Attribute: " + attribute.getID());
View Full Code Here

Examples of javax.naming.directory.SearchResult

       
    NamingEnumeration<SearchResult> results = map.executeLdap(new BindingRoot(), null);
   
    assertTrue("I got a result", results.hasMore());
   
    SearchResult result = results.next();
   
    log.info("Result: " + result.getNameInNamespace());
   
    assertEquals("Paul's email address is right", "paul.shabajee@hp.com", result.getAttributes().get("uid").get(0));
   
    results.close();
   
    Iterator<Map <String, Node>> res = map.execute(new BindingRoot(), null);
   
View Full Code Here

Examples of javax.naming.directory.SearchResult

        }
    }

    private void mapResults(PagedResultMapper mapper, NamingEnumeration<SearchResult> results) throws NamingException {
        while (results != null && results.hasMore()) {
            SearchResult searchResult = results.next();
            String dn = searchResult.getNameInNamespace();
           
            try {
                if (isDnValid(dn)) {
                    if (logger.isDebugEnabled()) {
                        logger.debug("Included result " + dn);
View Full Code Here

Examples of javax.naming.directory.SearchResult

        try {
            SearchControls sctrl = new SearchControls();
            String filter = "(&(objectclass=organizationalUnit)(ou=*))";                       
            NamingEnumeration enm = ctx.search(baseDN, filter, sctrl);
            while (enm.hasMore()) {
                SearchResult sr = (SearchResult) enm.next();               
                config.setCategory(sr.getName());               
            }

        } catch (Exception e) {  
          ErrorReporter.getErrorHandler().reportError(e.getLocalizedMessage(), e);
        }
View Full Code Here

Examples of javax.naming.directory.SearchResult

    String userDN = null;
    for (String ldapBase : ldapBases) {
      try {
        NamingEnumeration<SearchResult> enm = ctx.search(ldapBase, filter, ctls);
        while (enm.hasMore()) {
          SearchResult result = enm.next();
          userDN = result.getNameInNamespace();
        }
        if (userDN != null) break;
      } catch (NamingException e) {
        log.error("NamingException when trying to bind user with username::" + uid + " on ldapBase::" + ldapBase, e);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.