Skip to content

Commit

Permalink
Cleaning Z3950 / Remove server - keeping SRU.
Browse files Browse the repository at this point in the history
  • Loading branch information
fxprunayre committed Mar 25, 2016
1 parent c805843 commit f898165
Show file tree
Hide file tree
Showing 100 changed files with 60 additions and 1,439 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* An interactive Web Map Viewer to combine Web Map Services from distributed servers around the world
* Online editing of metadata with a powerful template system
* Scheduled harvesting and synchronization of metadata between distributed catalogs
* Support for OGC-CSW 2.0.2 ISO Profile, OAI-PMH, Z39.50 protocols
* Support for OGC-CSW 2.0.2 ISO Profile, OAI-PMH, SRU protocols
* Fine-grained access control with group and user management
* Multi-lingual user interface

Expand Down
5 changes: 0 additions & 5 deletions code_quality/findbugs-excludes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@
<Class name="org.fao.geonet.kernel.rdf.Query$QueryResults" />
<Bug pattern="SE_BAD_FIELD_INNER_CLASS" />
</Match>
<Match>
<Class name="org.fao.geonet.kernel.search.Z3950Searcher" />
<Bug pattern="REC_CATCH_EXCEPTION" />
<Method name="presentDocuments" />
</Match>
<Match>
<Class name="org.fao.geonet.kernel.Thesaurus" />
<Bug pattern="REC_CATCH_EXCEPTION" />
Expand Down
35 changes: 3 additions & 32 deletions core/src/main/java/org/fao/geonet/constants/Geonet.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ public static final class File {
public static final String SCHEMATRON_XML = "schematron_xml.xsl";
public static final String SCHEMATRON_VERBID = "schematron_verbid.xsl";
public static final String SEARCH_LUCENE = "lucene.xsl";
public static final String SEARCH_Z3950_CLIENT = "z3950Client.xsl";
public static final String SEARCH_Z3950_SERVER = "z3950Server.xsl";
public static final String UPDATE_FIXED_INFO = "update-fixed-info.xsl";
public static final String UPDATE_CHILD_FROM_PARENT_INFO = "update-child-from-parent-info.xsl";
public static final String EXTRACT_UUID = "extract-uuid.xsl";
Expand All @@ -76,9 +74,9 @@ public static final class File {
public static final String SCHEMA_OASIS = "oasis-catalog.xml";
public static final String SCHEMA_PLUGINS_CATALOG = "schemaplugin-uri-catalog.xml";
public static final String SORT_HARVESTERS = "sort-harvesters.xsl";
public static final String JZKITCONFIG_TEMPLATE= "JZKitConfig.xml.tem";
public static final String JZKITAPPLICATIONCONTEXT= "JZkitApplicationContext.xml";
public static final String JZKITCONFIG_TEMPLATE= "JZKitConfig.xml.tem";
public static final String JZKITAPPLICATIONCONTEXT= "JZkitApplicationContext.xml";

/**
* Stylesheet to convert a CQL parameter to a filter.
*/
Expand Down Expand Up @@ -345,24 +343,6 @@ public static final class SearchResult {
* {@value org.fao.geonet.constants.Geonet.Text#OFF} (default) */
public static final String EXTENDED = "extended";

/** Parameter name: {@value #REMOTE} - Boolean that indicates if
* search is done on the local repository or using Z39.50 for on the
* fly searches in remote catalogs. Values are
* {@value org.fao.geonet.constants.Geonet.Text#ON} or
* {@value org.fao.geonet.constants.Geonet.Text#OFF} (default) */
public static final String REMOTE = "remote";

/** Parameter name: {@value #TIMEOUT} - Time in seconds the Z39.50
* search waits for responses from remote servers before timing out.
* Default is 20 seconds */
public static final String TIMEOUT = "timeout";

/** Parameter name: {@value #SERVERHTML} - Boolean that indicates
* whether remote Z39.50 server should return HTML or XML. Values are
* {@value org.fao.geonet.constants.Geonet.Text#ON} or
* {@value org.fao.geonet.constants.Geonet.Text#OFF} (default) */
public static final String SERVERHTML = "serverhtml";

/** Parameter name: {@value #HITS_PER_PAGE} - Number of results
* returned by the search engine. Default is 10 results */
public static final String HITS_PER_PAGE = "hitsPerPage";
Expand Down Expand Up @@ -403,13 +383,6 @@ public static final class SearchResult {
/** Parameter name: {@value #UUID} - Text field that search
* for specific uuid given */
public static final String UUID = "uuid";
/**
* Attrset used in Z39.50 search
*/
public static final String ATTRSET = "attrset";
/** Parameter name: {@value #ZQUERY} - A Z3950 query as specified in the
* Z3950 harvester */
public static final String ZQUERY = "zquery";


public static final String RESULT_TYPE = "resultType";
Expand Down Expand Up @@ -556,8 +529,6 @@ public static final class CodeList {
public static final String SEARCH_ENGINE = GEONETWORK + ".search";
public static final String FACET_ENGINE = GEONETWORK + ".facet";
public static final String CUSTOM_ELEMENTSET = GEONETWORK + ".customelementset";
public static final String Z3950_SERVER = GEONETWORK + ".z3950server";
public static final String Z3950 = GEONETWORK + ".z3950";
public static final String INDEX_ENGINE = GEONETWORK + ".index";
public static final String LUCENE = GEONETWORK + ".lucene";
public static final String LUCENE_TRACKING = LUCENE + ".tracking";
Expand Down
45 changes: 18 additions & 27 deletions core/src/main/java/org/fao/geonet/kernel/search/LuceneSearcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -829,35 +829,26 @@ private void computeQuery(ServiceContext srvContext, Element request, ServiceCon
}
}

if (_styleSheetName.equals(Geonet.File.SEARCH_Z3950_SERVER)) {
// Construct Lucene query by XSLT, not Java, for Z3950 anyway :-)
Element xmlQuery = _sm.transform(_styleSheetName, request);
if(Log.isDebugEnabled(Geonet.SEARCH_ENGINE))
Log.debug(Geonet.SEARCH_ENGINE, "XML QUERY:\n"+ Xml.getString(xmlQuery));
_query = LuceneSearcher.makeLocalisedQuery(xmlQuery, SearchManager.getAnalyzer(_language.analyzerLanguage, true), _luceneConfig, _language.presentationLanguage, requestedLanguageOnly);
}
else {
// Construct Lucene query (Java)
if(Log.isDebugEnabled(Geonet.LUCENE))
Log.debug(Geonet.LUCENE, "LuceneSearcher constructing Lucene query (LQB)");
LuceneQueryInput luceneQueryInput = new LuceneQueryInput(request);
luceneQueryInput.setRequestedLanguageOnly(requestedLanguageOnly);
// Construct Lucene query (Java)
if(Log.isDebugEnabled(Geonet.LUCENE))
Log.debug(Geonet.LUCENE, "LuceneSearcher constructing Lucene query (LQB)");
LuceneQueryInput luceneQueryInput = new LuceneQueryInput(request);
luceneQueryInput.setRequestedLanguageOnly(requestedLanguageOnly);

_query = new LuceneQueryBuilder(_luceneConfig, _tokenizedFieldSet, SearchManager.getAnalyzer(_language.analyzerLanguage, true), _language.presentationLanguage).build(luceneQueryInput);
if(Log.isDebugEnabled(Geonet.SEARCH_ENGINE))
Log.debug(Geonet.SEARCH_ENGINE,"Lucene query: " + _query);
_query = new LuceneQueryBuilder(_luceneConfig, _tokenizedFieldSet, SearchManager.getAnalyzer(_language.analyzerLanguage, true), _language.presentationLanguage).build(luceneQueryInput);
if(Log.isDebugEnabled(Geonet.SEARCH_ENGINE))
Log.debug(Geonet.SEARCH_ENGINE,"Lucene query: " + _query);

try {
// only for debugging -- might cause NPE is query was wrongly constructed
//Query rw = _query.rewrite(_indexAndTaxonomy.indexReader);
//if(Log.isDebugEnabled(Geonet.SEARCH_ENGINE)) Log.debug(Geonet.SEARCH_ENGINE,"Rewritten Lucene query: " + _query);
//System.out.println("** rewritten:\n"+ rw);
}
catch(Throwable x){
Log.warning(Geonet.SEARCH_ENGINE,"Error rewriting Lucene query: " + _query);
//System.out.println("** error rewriting query: "+x.getMessage());
}
}
try {
// only for debugging -- might cause NPE is query was wrongly constructed
//Query rw = _query.rewrite(_indexAndTaxonomy.indexReader);
//if(Log.isDebugEnabled(Geonet.SEARCH_ENGINE)) Log.debug(Geonet.SEARCH_ENGINE,"Rewritten Lucene query: " + _query);
//System.out.println("** rewritten:\n"+ rw);
}
catch(Throwable x){
Log.warning(Geonet.SEARCH_ENGINE,"Error rewriting Lucene query: " + _query);
//System.out.println("** error rewriting query: "+x.getMessage());
}

// Boosting query
if (_boostQueryClass != null) {
Expand Down
15 changes: 0 additions & 15 deletions core/src/main/java/org/fao/geonet/kernel/search/SearchManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,6 @@ public void initNonStaticData(boolean logAsynch, boolean logSpatialObject, Strin
_luceneTermsToExclude = luceneTermsToExclude;

initLucene();
initZ3950();

_luceneOptimizerManager = new LuceneOptimizerManager(this, settingInfo);
}
Expand All @@ -563,7 +562,6 @@ public void end() throws Exception {
} else {
Log.error(Geonet.SEARCH_ENGINE, "Unable to get a hook on the application context (already destroyed ?).");
}
endZ3950();
_spatial.end();
_luceneOptimizerManager.cancel();
}
Expand Down Expand Up @@ -648,7 +646,6 @@ public MetaSearcher newSearcher(SearcherType type, String stylesheetName) throws
switch (type) {
case LUCENE:
return new LuceneSearcher(this, stylesheetName, luceneConfig);
case Z3950: return new Z3950Searcher(this, schemaManager, stylesheetName);
case UNUSED: return new UnusedSearcher();
default: throw new Exception("unknown MetaSearcher type: " + type);
}
Expand All @@ -662,18 +659,6 @@ private void initLucene() throws Exception {
setupIndex(false);
}

// Z39.50 init/end methods

/**
* Initializes the Z3950 client searcher.
*/
private void initZ3950() {}

/**
* deinitializes the Z3950 client searcher.
*/
private void endZ3950() {}

public Path getHtmlCacheDir() {
return _htmlCacheDir;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ public class UserQueryInput {
Geonet.SearchResult.FAST,
Geonet.SearchResult.SORT_BY,
Geonet.SearchResult.SORT_ORDER,
Geonet.SearchResult.REMOTE,
Geonet.SearchResult.EXTENDED,
Geonet.SearchResult.INTERMAP,
Geonet.SearchResult.HITS_PER_PAGE,
Geonet.SearchResult.GEOMETRY,
Geonet.SearchResult.TIMEOUT,
Geonet.SearchResult.OUTPUT,
Geonet.SearchResult.OUTPUT,
Geonet.SearchResult.SUMMARY_ONLY,
Geonet.SearchResult.BUILD_SUMMARY,
Geonet.SearchResult.REQUESTED_LANGUAGE,
Expand Down
Loading

0 comments on commit f898165

Please sign in to comment.