Changeset 6994


Ignore:
Timestamp:
11/06/10 15:35:59 (9 years ago)
Author:
mnagni
Message:

Fixed a wrong loop in SearchAgent?.assembleTermTarget
If the Term is equal to one illegal character the term is skipped from the search
Update the artifact version to 1.1.12

Location:
TI01-discovery-API/trunk/MEDINDiscoveryService
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TI01-discovery-API/trunk/MEDINDiscoveryService/pom.xml

    r6874 r6994  
    44        <groupId>ndg.services.discovery</groupId> 
    55        <artifactId>MedinDiscoveryService</artifactId> 
    6         <version>1.1.11</version> 
     6        <version>1.1.12</version> 
    77        <packaging>aar</packaging> 
    88 
  • TI01-discovery-API/trunk/MEDINDiscoveryService/src/main/java/ndg/services/discovery/model/SearchAgent.java

    r6874 r6994  
    163163        } 
    164164 
    165         /** 
    166          * Take the results set returned from a call to doSearch and extract the 
    167          * data into a SearchSummary object NB, only return the number of docs 
    168          * requested 
    169          *  
    170          * @param results 
    171          *            - a 2D string array of results from the doSearch call 
    172          * @return SearchSummary object wrappering the results set 
    173          */ 
    174         /* 
    175          * private SearchSummary processResults(Connection conn, 
    176          * Set<MEDINSearchResult> results) { SearchSummary result = new 
    177          * SearchSummary(); result.setHits(0); // NB ensure this is 0 if not data 
    178          * returned ArrayList<String> docs = new ArrayList<String>(); 
    179          *  
    180          * // set up another DB connection to query and update record access try { 
    181          * if (results.size() > 0) { // if the requested number of docs to be 
    182          * returned is less than // the total number of results, restrict the number 
    183          * int resultsNumber = (searchType.getHowMany() == null || results .size() < 
    184          * searchType.getHowMany().intValue()) ? results .size() : 
    185          * searchType.getHowMany().intValue(); 
    186          *  
    187          * Vector<Hashtable<String, String>> documents = new 
    188          * Vector<Hashtable<String, String>>(); // counter to ensure the proper 
    189          * number of hits are returned int duplicateDocs = 0; Integer numIncluded; 
    190          * for (int i = 0; i < resultsNumber; i++) { Hashtable<String, String> 
    191          * thisDoc = new Hashtable<String, String>(); // avoid duplicate results - 
    192          * NB, this could be done using // the DISTINCT SQL keyword but // this 
    193          * would require the 'order by' clause to change so // would necessitate a 
    194          * much more // complex sql query construction if 
    195          * (!docs.contains(results[i][0])) { logger 
    196          * .info("Found matching document - adding this to results"); 
    197          * docs.add(results[i][0]); thisDoc.put("name", results[i][0]); 
    198          *  
    199          * // increment relevant access count in the Discovery DB // reset relevant 
    200          * column if (client.runUpdateQuery(updateResultSetQueryString( 
    201          * results[i][0], numIncluded))) { logger 
    202          * .info("Successfully UPDATED dataset access counter!"); } else { logger 
    203          * .warn("Could NOT update dataset access counter!"); } 
    204          *  
    205          * // TODO: these next two are not used anywhere - remove // or use? 
    206          * thisDoc.put("matches", String.valueOf(1)); thisDoc.put("position", 
    207          * String.valueOf(i)); documents.add(thisDoc); } else { 
    208          * logger.info("Duplicate document found - ignoring"); duplicateDocs++; } } 
    209          *  
    210          * client.closeConnection(); 
    211          *  
    212          * result.setStatus(true); result.setStatusMessage("Success"); 
    213          * result.setDocuments(documents); // result.setHits(results.length - 
    214          * duplicateDocs + // this.getStart().intValue()); 
    215          * logger.info("Results added to search summary"); } else { 
    216          * result.setStatus(false); String outMessage = 
    217          * "Search was successful but generated no results."; 
    218          * result.setStatusMessage(outMessage); logger.info(outMessage); } } catch 
    219          * (Exception E) { 
    220          *  
    221          * } 
    222          *  
    223          * return result; } 
    224          */ 
    225165 
    226166        /** 
     
    267207                for (TermSearchType termType : terms) { 
    268208                        String term = termType.getTerm(); 
     209                         
     210                        if (term.trim().equals("&") || term.trim().equals("'")) 
     211                                continue; 
     212                         
    269213                        DiscoveryDictionary.TermTarget termTarget = DiscoveryDictionary.getTermType(termType.getTermTarget()); 
    270214 
     
    292236                        String operator = getOperator(termType.getOperator()); 
    293237 
    294                         if ((!secondPass && operator.equals(OPERATOR.NOT.name())) || (secondPass && queryIndex < term.length())) { 
     238                        if ((!secondPass && operator.equals(OPERATOR.NOT.name())) || (secondPass && queryIndex < terms.size())) { 
    295239                                whereSQL.append(" "); 
    296240                                whereSQL.append(operator); 
     
    305249                } 
    306250        } 
    307  
     251         
    308252        private String composeVector(DiscoveryDictionary.TermTarget termTarget){ 
    309253                StringBuffer bf = new StringBuffer(); 
Note: See TracChangeset for help on using the changeset viewer.