From: <jes...@us...> - 2009-08-20 09:42:38
|
Revision: 4986 http://geonetwork.svn.sourceforge.net/geonetwork/?rev=4986&view=rev Author: jesseeichar Date: 2009-08-20 09:42:29 +0000 (Thu, 20 Aug 2009) Log Message: ----------- rollback work on keywords Modified Paths: -------------- sandbox/geocat.ch/tags/18_Aout_2009/src/org/fao/geonet/kernel/search/KeywordsSearcher.java Property Changed: ---------------- sandbox/geocat.ch/tags/18_Aout_2009/ sandbox/geocat.ch/tags/18_Aout_2009/web/geonetwork/images/txt.gif sandbox/geocat.ch/tags/18_Aout_2009/web/geonetwork/xml/codelist/external/thesauri/_none_/gemet.rdf sandbox/geocat.ch/tags/18_Aout_2009/web/geonetwork/xml/codelist/external/thesauri/_none_/inspire.rdf sandbox/geocat.ch/tags/18_Aout_2009/web/geonetwork/xml/codelist/local/thesauri/_none_/geocat.ch.rdf sandbox/geocat.ch/tags/18_Aout_2009/web/geonetwork/xml/codelist/local/thesauri/_none_/non_validated.rdf sandbox/geocat.ch/tags/18_Aout_2009/web/geonetwork/xsl/conversion/import/ISO19139CHE-to-GM03.xsl sandbox/geocat.ch/tags/18_Aout_2009/web/geonetwork/xsl/conversion/import/ISO19139CHE-to-GM03small.xsl Property changes on: sandbox/geocat.ch/tags/18_Aout_2009 ___________________________________________________________________ Added: svn:mergeinfo + /sandbox/geocat.ch/trunk:4966-4967 Modified: sandbox/geocat.ch/tags/18_Aout_2009/src/org/fao/geonet/kernel/search/KeywordsSearcher.java =================================================================== --- sandbox/geocat.ch/tags/18_Aout_2009/src/org/fao/geonet/kernel/search/KeywordsSearcher.java 2009-08-20 07:24:49 UTC (rev 4985) +++ sandbox/geocat.ch/tags/18_Aout_2009/src/org/fao/geonet/kernel/search/KeywordsSearcher.java 2009-08-20 09:42:29 UTC (rev 4986) @@ -262,7 +262,7 @@ + " [gml:BoundedBy {} gml:lowerCorner {lowc}]; " + " [gml:BoundedBy {} gml:upperCorner {uppc}] " + " WHERE lang(prefLab) LIKE \""+defaultLangCode+"\"" - + " AND ("; + + " AND prefLab LIKE "; } else { _query = "SELECT prefLab, note, id, lowc, uppc " + " FROM {id} rdf:type {skos:Concept}; " @@ -270,33 +270,24 @@ + " [skos:scopeNote {note}"; } - List<String> keywordVariations = getKeywordVariations(sKeyword); - - int pos = 0; - for(String k : keywordVariations) { - if (pos > 0) _query += " OR "; - switch (pTypeSearch) { - - case 0: // Start with - _query += "prefLab LIKE \""+ k+ "*\" IGNORE CASE"; - break; - case 1: // contains - _query += "prefLab LIKE \"*"+ k+ "*\" IGNORE CASE"; - break; - case 2: // exact match - _query += "prefLab LIKE\""+ k+ "\" IGNORE CASE"; - break; - default: - break; - } - pos++; - } - - _query += " ) " + switch (pTypeSearch) { + case 0: // Start with + _query += "\""+ sKeyword+ "*\" "; + break; + case 1: // contains + _query += "\"*"+ sKeyword+ "*\" "; + break; + case 2: // exact match + _query += "\""+ sKeyword+ "\" "; + break; + default: + break; + } + _query += " IGNORE CASE " + " USING NAMESPACE skos=<" + Concept.NS_SKOS + ">, gml=<" + Concept.NS_GML + "> "; Log.debug(Geonet.THESAURUS_MAN, _query); - System.out.println("_query:" + _query); + // For each thesaurus, search for keywords in _results _results = new ArrayList<Concept>(); Map<String/*Code*/, Concept> bag = new HashMap<String, Concept>(); @@ -601,53 +592,4 @@ return keyword; } - private List<String> getKeywordVariations(String keyword) { - final String A_VOWEL = "a\xE1\xE0"; - final String E_VOWEL = "e\xE9\xE8"; - final String I_VOWEL = "i\xED\xEC"; - final String O_VOWEL = "o\xF3\xF2"; - final String U_VOWEL = "u\xFA\xF9\xFC"; - final String VOWELS = A_VOWEL + E_VOWEL + I_VOWEL + O_VOWEL + U_VOWEL; - - List<String> keywordVariations = new ArrayList<String>(); - keywordVariations.add(keyword); - - for(int i = 0; i < keyword.length(); i++) { - char currentLetter = keyword.charAt(i); - - - // If the character is a vocal, then generate variations - if (VOWELS.indexOf(currentLetter) > -1) { - List<String> aux = new ArrayList<String>(); - String variationVowels = ""; - - if (A_VOWEL.indexOf(currentLetter) > -1) { - variationVowels = A_VOWEL; - } else if (E_VOWEL.indexOf(currentLetter) > -1) { - variationVowels = E_VOWEL; - } else if (I_VOWEL.indexOf(currentLetter) > -1) { - variationVowels = I_VOWEL; - } else if (O_VOWEL.indexOf(currentLetter) > -1) { - variationVowels = O_VOWEL; - } else if (U_VOWEL.indexOf(currentLetter) > -1) { - variationVowels = U_VOWEL; - } - - - for(String k : keywordVariations) { - for(int j = 0; j < variationVowels.length(); j++) { - if (currentLetter != variationVowels.charAt(j)) { - aux.add(k.substring(0, i) + variationVowels.charAt(j) +k.substring(i+1)); - } - } - - } - - keywordVariations.addAll(aux); - } - - } - - return keywordVariations; - } } Property changes on: sandbox/geocat.ch/tags/18_Aout_2009/web/geonetwork/images/txt.gif ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: sandbox/geocat.ch/tags/18_Aout_2009/web/geonetwork/xml/codelist/external/thesauri/_none_/gemet.rdf ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: sandbox/geocat.ch/tags/18_Aout_2009/web/geonetwork/xml/codelist/external/thesauri/_none_/inspire.rdf ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: sandbox/geocat.ch/tags/18_Aout_2009/web/geonetwork/xml/codelist/local/thesauri/_none_/geocat.ch.rdf ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: sandbox/geocat.ch/tags/18_Aout_2009/web/geonetwork/xml/codelist/local/thesauri/_none_/non_validated.rdf ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: sandbox/geocat.ch/tags/18_Aout_2009/web/geonetwork/xsl/conversion/import/ISO19139CHE-to-GM03.xsl ___________________________________________________________________ Deleted: svn:mergeinfo - Property changes on: sandbox/geocat.ch/tags/18_Aout_2009/web/geonetwork/xsl/conversion/import/ISO19139CHE-to-GM03small.xsl ___________________________________________________________________ Deleted: svn:mergeinfo - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |