Revision 4812
Added by daigle over 15 years ago
lib/metacat.properties | ||
---|---|---|
199 | 199 |
xml.entitydoctype=-//ecoinformatics.org//eml-entity-2.0.0beta6//EN, -//ecoinformatics.org//eml-entity-2.0.0beta4//EN |
200 | 200 |
xml.packagedoctypeset=BIN,-//ecoinformatics.org//eml-access-2.0.0beta6//EN,-//ecoinformatics.org//eml-access-2.0.0beta4//EN,-//ecoinformatics.org//eml-attribute-2.0.0beta6//EN,-//ecoinformatics.org//eml-attribute-2.0.0beta4//EN,-//ecoinformatics.org//eml-constraint-2.0.0beta6//EN,-//ecoinformatics.org//eml-constraint-2.0.0beta4//EN,-//ecoinformatics.org//eml-coverage-2.0.0beta6//EN,-//ecoinformatics.org//eml-coverage-2.0.0beta4//EN,-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN,-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN,-//ecoinformatics.org//eml-entity-2.0.0beta6//EN,-//ecoinformatics.org//eml-entity-2.0.0beta4//EN,-//ecoinformatics.org//eml-literature-2.0.0beta6//EN,-//ecoinformatics.org//eml-literature-2.0.0beta4//EN,-//ecoinformatics.org//eml-physical-2.0.0beta6//EN,-//ecoinformatics.org//eml-physical-2.0.0beta4//EN,-//ecoinformatics.org//eml-project-2.0.0beta6//EN,-//ecoinformatics.org//eml-project-2.0.0beta4//EN,-//ecoinformatics.org//eml-protocol-2.0.0beta6//EN,-//ecoinformatics.org//eml-protocol-2.0.0beta4//EN,-//ecoinformatics.org//eml-software-2.0.0beta6//EN,-//ecoinformatics.org//eml-software-2.0.0beta4//EN |
201 | 201 |
xml.indexNamespaces=eml://ecoinformatics.org/eml-2.0.0,eml://ecoinformatics.org/eml-2.0.1 |
202 |
xml.indexPaths=organizationName,originator/individualName/surName,originator/individualName/givenName,originator/organizationName,creator/individualName/surName,creator/individualName/givenName,creator/organizationName,dataset/title,keyword,geographicCoverage/boundingCoordinates/northBoundingCoordinate,geographicCoverage/boundingCoordinates/southBoundingCoordinate,geographicCoverage/boundingCoordinates/westBoundingCoordinate,geographicCoverage/boundingCoordinates/eastBoundingCoordinate,eastBoundingCoordinate,title,entityName,individualName/surName,abstract/para,surName,givenName,para,geographicDescription,literalLayout,eastbc,northbc,westbc,southbc,dataset/access/allow/principal,access/allow/principal,entityName,taxonRankValue,dataset/dataTable/physical/distribution/online/url,dataset/spatialRaster/physical/distribution/online/url,@packageId,/reviewHistory/review/packageId,EcogridRegEntry/description,EcogridRegEntry/serviceName,EcogridRegEntry/endPoint,associatedParty/individualName/surName,associatedParty/organizationName,coverage/temporalCoverage/singleDateTime/alternativeTimeScale/timeScaleName,coverage/temporalCoverage/rangeOfDates/beginDate/alternativeTimeScale/timeScaleName,coverage/temporalCoverage/rangeOfDates/endDate/alternativeTimeScale/timeScaleName,placekey,idinfo/citation/citeinfo/title,idinfo/citation/citeinfo/origin,idinfo/keywords/theme/themekey,abstract |
|
202 |
xml.indexPaths= \ |
|
203 |
@packageId, \ |
|
204 |
/reviewHistory/review/packageId, \ |
|
205 |
abstract, \ |
|
206 |
abstract/para, \ |
|
207 |
access/allow/principal, \ |
|
208 |
additionalMetadata/moderatorComment \ |
|
209 |
associatedParty/individualName/surName, \ |
|
210 |
associatedParty/organizationName, \ |
|
211 |
coverage/temporalCoverage/rangeOfDates/beginDate/alternativeTimeScale/timeScaleName, \ |
|
212 |
coverage/temporalCoverage/rangeOfDates/endDate/alternativeTimeScale/timeScaleName, \ |
|
213 |
coverage/temporalCoverage/singleDateTime/alternativeTimeScale/timeScaleName, \ |
|
214 |
creator/individualName/surName, \ |
|
215 |
creator/individualName/givenName, \ |
|
216 |
creator/organizationName, \ |
|
217 |
dataset/access/allow/principal, \ |
|
218 |
dataset/dataTable/physical/distribution/online/url, \ |
|
219 |
dataset/dataTable/physical/distribution/online/url/@function, \ |
|
220 |
dataset/spatialRaster/physical/distribution/online/url, \ |
|
221 |
dataset/spatialRaster/physical/distribution/online/url/@function, \ |
|
222 |
dataset/title, \ |
|
223 |
eastBoundingCoordinate, \ |
|
224 |
eastbc, \ |
|
225 |
EcogridRegEntry/description, \ |
|
226 |
EcogridRegEntry/endPoint, \ |
|
227 |
EcogridRegEntry/serviceName, \ |
|
228 |
entityName, \ |
|
229 |
geographicCoverage/boundingCoordinates/eastBoundingCoordinate, \ |
|
230 |
geographicCoverage/boundingCoordinates/northBoundingCoordinate, \ |
|
231 |
geographicCoverage/boundingCoordinates/southBoundingCoordinate, \ |
|
232 |
geographicCoverage/boundingCoordinates/westBoundingCoordinate, \ |
|
233 |
geographicDescription, \ |
|
234 |
givenName, \ |
|
235 |
idinfo/citation/citeinfo/title, \ |
|
236 |
idinfo/citation/citeinfo/origin, \ |
|
237 |
idinfo/keywords/theme/themekey, \ |
|
238 |
individualName/surName, \ |
|
239 |
keyword, \ |
|
240 |
literalLayout, \ |
|
241 |
northbc, \ |
|
242 |
northBoundingCoordinate, \ |
|
243 |
organizationName, \ |
|
244 |
originator/individualName/surName, \ |
|
245 |
originator/individualName/givenName, \ |
|
246 |
originator/organizationName, \ |
|
247 |
para, \ |
|
248 |
placekey, \ |
|
249 |
southBoundingCoordinate, \ |
|
250 |
southbc, \ |
|
251 |
surName, \ |
|
252 |
taxonomicClassification/taxonRankName, \ |
|
253 |
taxonomicClassification/taxonRankValue, \ |
|
254 |
taxonRankValue, \ |
|
255 |
title, \ |
|
256 |
westBoundingCoordinate, \ |
|
257 |
westbc |
|
203 | 258 |
|
204 | 259 |
######## Outgoing email ######################################### |
205 | 260 |
|
src/edu/ucsb/nceas/metacat/QuerySpecification.java | ||
---|---|---|
37 | 37 |
import java.util.Vector; |
38 | 38 |
|
39 | 39 |
import edu.ucsb.nceas.metacat.util.MetacatUtil; |
40 |
import edu.ucsb.nceas.metacat.util.SystemUtil; |
|
41 |
import edu.ucsb.nceas.metacat.util.UtilException; |
|
40 | 42 |
|
41 | 43 |
import org.apache.log4j.Logger; |
42 | 44 |
import org.xml.sax.Attributes; |
... | ... | |
984 | 986 |
else |
985 | 987 |
{ |
986 | 988 |
elementVector.add(path); |
987 |
} |
|
988 |
if(!MetacatUtil.pathsForIndexing.contains(path)){ |
|
989 |
usePathIndex = false; |
|
990 |
} |
|
989 |
} |
|
990 |
try { |
|
991 |
if(!SystemUtil.getPathsForIndexing().contains(path)){ |
|
992 |
usePathIndex = false; |
|
993 |
} |
|
994 |
} catch (UtilException ue) { |
|
995 |
logMetacat.warn("Could not get index paths: " + ue.getMessage()); |
|
996 |
} |
|
991 | 997 |
|
992 | 998 |
} |
993 | 999 |
// check if has return field |
src/edu/ucsb/nceas/metacat/MetaCatServlet.java | ||
---|---|---|
363 | 363 |
*/ |
364 | 364 |
private void checkIndexPaths() { |
365 | 365 |
Logger logMetacat = Logger.getLogger(MetaCatServlet.class); |
366 |
|
|
367 |
try { |
|
368 |
MetacatUtil.pathsForIndexing |
|
369 |
= MetacatUtil.getOptionList(PropertyService.getProperty("xml.indexPaths")); |
|
370 |
|
|
371 |
MetacatUtil.pathsForIndexing = |
|
372 |
MetacatUtil.getOptionList(PropertyService.getProperty("xml.indexPaths")); |
|
366 |
|
|
367 |
Vector<String> pathsForIndexing = null; |
|
368 |
try { |
|
369 |
pathsForIndexing = SystemUtil.getPathsForIndexing(); |
|
373 | 370 |
} |
374 |
catch (PropertyNotFoundException pnfe) {
|
|
375 |
MetacatUtil.pathsForIndexing = null;
|
|
371 |
catch (UtilException ue) {
|
|
372 |
pathsForIndexing = null; |
|
376 | 373 |
logMetacat.error("Could not find index paths. Setting " |
377 |
+ "MetacatUtil.pathsForIndexing to null: " + pnfe.getMessage());
|
|
374 |
+ "pathsForIndexing to null: " + ue.getMessage());
|
|
378 | 375 |
} |
379 | 376 |
|
380 |
if (MetacatUtil.pathsForIndexing != null) {
|
|
377 |
if (pathsForIndexing != null && !pathsForIndexing.isEmpty()) {
|
|
381 | 378 |
|
382 | 379 |
logMetacat.debug("Indexing paths specified in metacat.properties...."); |
383 | 380 |
|
... | ... | |
387 | 384 |
PreparedStatement pstmt1 = null; |
388 | 385 |
ResultSet rs = null; |
389 | 386 |
|
390 |
for (int i = 0; i < MetacatUtil.pathsForIndexing.size(); i++) { |
|
391 |
logMetacat.debug("Checking if '" |
|
392 |
+ (String) MetacatUtil.pathsForIndexing.elementAt(i) |
|
393 |
+ "' is indexed.... "); |
|
387 |
for (String pathIndex : pathsForIndexing) { |
|
388 |
logMetacat.debug("Checking if '" + pathIndex + "' is indexed.... "); |
|
394 | 389 |
|
395 | 390 |
try { |
396 | 391 |
//check out DBConnection |
... | ... | |
400 | 395 |
|
401 | 396 |
pstmt = conn.prepareStatement( |
402 | 397 |
"SELECT * FROM xml_path_index " + "WHERE path = ?"); |
403 |
pstmt.setString(1, (String) MetacatUtil.pathsForIndexing |
|
404 |
.elementAt(i)); |
|
398 |
pstmt.setString(1, pathIndex); |
|
405 | 399 |
|
406 | 400 |
pstmt.execute(); |
407 | 401 |
rs = pstmt.getResultSet(); |
... | ... | |
412 | 406 |
pstmt.close(); |
413 | 407 |
conn.increaseUsageCount(1); |
414 | 408 |
|
415 |
logMetacat.debug( |
|
416 |
"Inserting following path in xml_path_index: " |
|
417 |
+ (String)MetacatUtil.pathsForIndexing |
|
418 |
.elementAt(i)); |
|
419 |
if(((String)MetacatUtil.pathsForIndexing.elementAt(i)).indexOf("@")<0){ |
|
409 |
logMetacat.debug("Inserting following path in xml_path_index: " |
|
410 |
+ pathIndex); |
|
411 |
if(pathIndex.indexOf("@")<0){ |
|
420 | 412 |
pstmt = conn.prepareStatement("SELECT DISTINCT n.docid, " |
421 | 413 |
+ "n.nodedata, n.nodedatanumerical, n.parentnodeid" |
422 | 414 |
+ " FROM xml_nodes n, xml_index i WHERE" |
... | ... | |
429 | 421 |
+ " i.path = ? and n.nodeid=i.nodeid and" |
430 | 422 |
+ " n.nodetype LIKE 'ATTRIBUTE' order by n.parentnodeid"); |
431 | 423 |
} |
432 |
pstmt.setString(1, (String) MetacatUtil. |
|
433 |
pathsForIndexing.elementAt(i)); |
|
424 |
pstmt.setString(1, pathIndex); |
|
434 | 425 |
pstmt.execute(); |
435 | 426 |
rs = pstmt.getResultSet(); |
436 | 427 |
|
437 | 428 |
int count = 0; |
438 |
logMetacat.debug( |
|
439 |
"Executed the select statement for: " |
|
440 |
+ (String) MetacatUtil.pathsForIndexing |
|
441 |
.elementAt(i)); |
|
429 |
logMetacat.debug("Executed the select statement for: " |
|
430 |
+ pathIndex); |
|
442 | 431 |
|
443 | 432 |
try { |
444 | 433 |
while (rs.next()) { |
... | ... | |
456 | 445 |
+ " VALUES (?, ?, ?, ?, ?)"); |
457 | 446 |
|
458 | 447 |
pstmt1.setString(1, docid); |
459 |
pstmt1.setString(2, (String) MetacatUtil. |
|
460 |
pathsForIndexing.elementAt(i)); |
|
448 |
pstmt1.setString(2, pathIndex); |
|
461 | 449 |
pstmt1.setString(3, nodedata); |
462 | 450 |
pstmt1.setFloat(4, nodedatanumerical); |
463 | 451 |
pstmt1.setInt(5, parentnodeid); |
... | ... | |
478 | 466 |
pstmt.close(); |
479 | 467 |
conn.increaseUsageCount(1); |
480 | 468 |
|
481 |
logMetacat.info("Indexed " + count |
|
482 |
+ " records from xml_nodes for '" |
|
483 |
+ (String) MetacatUtil.pathsForIndexing.elementAt(i) |
|
484 |
+ "'"); |
|
469 |
logMetacat.info("Indexed " + count + " records from xml_nodes for '" |
|
470 |
+ pathIndex + "'"); |
|
485 | 471 |
|
486 | 472 |
} else { |
487 | 473 |
logMetacat.debug(".....already indexed."); |
src/edu/ucsb/nceas/metacat/DocumentImpl.java | ||
---|---|---|
61 | 61 |
import edu.ucsb.nceas.metacat.util.AuthUtil; |
62 | 62 |
import edu.ucsb.nceas.metacat.util.MetacatUtil; |
63 | 63 |
import edu.ucsb.nceas.metacat.util.SystemUtil; |
64 |
import edu.ucsb.nceas.metacat.util.UtilException; |
|
64 | 65 |
import edu.ucsb.nceas.utilities.FileUtil; |
65 | 66 |
import edu.ucsb.nceas.utilities.PropertyNotFoundException; |
66 | 67 |
import edu.ucsb.nceas.utilities.StringUtil; |
... | ... | |
1724 | 1725 |
currentName, docid, doctype, parentId)); |
1725 | 1726 |
} |
1726 | 1727 |
} |
1727 |
if( MetacatUtil.pathsForIndexing.contains(currentName) && |
|
1728 |
leafData.trim().length() != 0 ){ |
|
1729 |
logMetacat.debug("paths found for indexing: " + currentName); |
|
1730 |
pathsFoundForIndexing.put(currentName, new PathIndexEntry( |
|
1731 |
leafNodeId, currentName, docid, leafParentId, leafData, |
|
1732 |
leafDataNumerical)); |
|
1733 |
} |
|
1728 |
try { |
|
1729 |
if (SystemUtil.getPathsForIndexing().contains(currentName) |
|
1730 |
&& leafData.trim().length() != 0) { |
|
1731 |
logMetacat.debug("paths found for indexing: " + currentName); |
|
1732 |
pathsFoundForIndexing.put(currentName, new PathIndexEntry( |
|
1733 |
leafNodeId, currentName, docid, leafParentId, leafData, |
|
1734 |
leafDataNumerical)); |
|
1735 |
} |
|
1736 |
} catch (UtilException ue) { |
|
1737 |
logMetacat.warn("Could not get index paths: " + ue.getMessage()); |
|
1738 |
} |
|
1739 |
|
|
1734 | 1740 |
} |
1735 | 1741 |
|
1736 | 1742 |
// process relative xpaths |
... | ... | |
1748 | 1754 |
logMetacat.debug("B: " + path +"\n"); |
1749 | 1755 |
pathList.put(path, new PathIndexEntry(leafNodeId, path, docid, |
1750 | 1756 |
doctype, parentId)); |
1751 |
if( MetacatUtil.pathsForIndexing.contains(path) && |
|
1752 |
leafData.trim().length() != 0 ){ |
|
1753 |
logMetacat.debug("paths found for indexing: " + currentName); |
|
1754 |
pathsFoundForIndexing.put(path, new PathIndexEntry( |
|
1755 |
leafNodeId, path, docid, leafParentId, leafData, |
|
1756 |
leafDataNumerical)); |
|
1757 |
} |
|
1757 |
try { |
|
1758 |
if (SystemUtil.getPathsForIndexing().contains(path) |
|
1759 |
&& leafData.trim().length() != 0) { |
|
1760 |
logMetacat.debug("paths found for indexing: " + currentName); |
|
1761 |
pathsFoundForIndexing.put(path, new PathIndexEntry(leafNodeId, |
|
1762 |
path, docid, leafParentId, leafData, leafDataNumerical)); |
|
1763 |
} |
|
1764 |
} catch (UtilException ue) { |
|
1765 |
logMetacat.warn("Could not get index paths: " + ue.getMessage()); |
|
1766 |
} |
|
1758 | 1767 |
} |
1759 | 1768 |
// process absolute xpaths |
1760 | 1769 |
if (id == rootNodeId) { |
... | ... | |
1765 | 1774 |
logMetacat.debug("C: " + fullPath +"\n"); |
1766 | 1775 |
pathList.put(fullPath, new PathIndexEntry(leafNodeId, fullPath, |
1767 | 1776 |
docid, doctype, parentId)); |
1768 |
if( MetacatUtil.pathsForIndexing.contains(fullPath) && |
|
1769 |
leafData.trim().length() != 0 ){ |
|
1770 |
logMetacat.debug("paths found for indexing: " + currentName); |
|
1771 |
pathsFoundForIndexing.put(fullPath, new PathIndexEntry( |
|
1772 |
leafNodeId, fullPath, docid, leafParentId, leafData, |
|
1773 |
leafDataNumerical)); |
|
1774 |
} |
|
1777 |
try { |
|
1778 |
if (SystemUtil.getPathsForIndexing().contains(fullPath) |
|
1779 |
&& leafData.trim().length() != 0) { |
|
1780 |
logMetacat.debug("paths found for indexing: " + currentName); |
|
1781 |
pathsFoundForIndexing.put(fullPath, new PathIndexEntry( |
|
1782 |
leafNodeId, fullPath, docid, leafParentId, leafData, |
|
1783 |
leafDataNumerical)); |
|
1784 |
} |
|
1785 |
} catch (UtilException ue) { |
|
1786 |
logMetacat.warn("Could not get index paths: " + ue.getMessage()); |
|
1787 |
} |
|
1775 | 1788 |
} |
1776 | 1789 |
} |
1777 | 1790 |
} |
1778 | 1791 |
|
1779 | 1792 |
/** |
1780 |
* Delete the paths from the xml_index table on the database in preparation |
|
1781 |
* of a subsequent update. |
|
1782 |
* |
|
1783 |
* @param conn the database connection to use, keeping a single transaction |
|
1784 |
* @throws SQLException if there is an error deleting from the db |
|
1785 |
*/ |
|
1793 |
* Delete the paths from the xml_index table on the database in preparation |
|
1794 |
* of a subsequent update. |
|
1795 |
* |
|
1796 |
* @param conn |
|
1797 |
* the database connection to use, keeping a single transaction |
|
1798 |
* @throws SQLException |
|
1799 |
* if there is an error deleting from the db |
|
1800 |
*/ |
|
1786 | 1801 |
private void deleteNodeIndex(DBConnection conn) throws SQLException |
1787 | 1802 |
{ |
1788 | 1803 |
//String familyId = MetacatUtil.getDocIdFromString(docid); |
src/edu/ucsb/nceas/metacat/util/SystemUtil.java | ||
---|---|---|
27 | 27 |
package edu.ucsb.nceas.metacat.util; |
28 | 28 |
|
29 | 29 |
import java.io.IOException; |
30 |
import java.util.Vector; |
|
30 | 31 |
import java.util.regex.Matcher; |
31 | 32 |
import java.util.regex.Pattern; |
32 | 33 |
import javax.servlet.ServletContext; |
... | ... | |
40 | 41 |
import edu.ucsb.nceas.metacat.service.ServiceService; |
41 | 42 |
import edu.ucsb.nceas.utilities.FileUtil; |
42 | 43 |
import edu.ucsb.nceas.utilities.PropertyNotFoundException; |
44 |
import edu.ucsb.nceas.utilities.StringUtil; |
|
43 | 45 |
|
44 | 46 |
public class SystemUtil { |
45 | 47 |
|
... | ... | |
573 | 575 |
public static String getUserHomeDir() { |
574 | 576 |
return System.getProperty("user.home"); |
575 | 577 |
} |
576 |
|
|
577 |
} |
|
578 |
|
|
579 |
/** |
|
580 |
* Get a list of xml paths that need to be indexed |
|
581 |
*/ |
|
582 |
public static Vector<String> getPathsForIndexing() throws UtilException { |
|
583 |
Vector <String> indexPaths = null; |
|
584 |
try { |
|
585 |
indexPaths = |
|
586 |
StringUtil.toVector(PropertyService.getProperty("xml.indexPaths"), ','); |
|
587 |
} catch (PropertyNotFoundException pnfe) { |
|
588 |
throw new UtilException("could not get index paths: " + pnfe.getMessage()); |
|
589 |
} |
|
590 |
|
|
591 |
return indexPaths; |
|
592 |
} |
|
593 |
} |
src/edu/ucsb/nceas/metacat/util/MetacatUtil.java | ||
---|---|---|
58 | 58 |
{ |
59 | 59 |
|
60 | 60 |
public static AbstractDatabase dbAdapter; |
61 |
|
|
62 |
public static Vector<String> pathsForIndexing; |
|
63 | 61 |
|
64 | 62 |
private static boolean debugErrorDisplayed = false; |
65 | 63 |
|
src/edu/ucsb/nceas/metacat/QueryGroup.java | ||
---|---|---|
31 | 31 |
|
32 | 32 |
import edu.ucsb.nceas.dbadapter.*; |
33 | 33 |
import edu.ucsb.nceas.metacat.util.MetacatUtil; |
34 |
import edu.ucsb.nceas.metacat.util.SystemUtil; |
|
35 |
import edu.ucsb.nceas.metacat.util.UtilException; |
|
34 | 36 |
|
35 | 37 |
import java.io.*; |
36 | 38 |
import java.util.Hashtable; |
... | ... | |
329 | 331 |
{ |
330 | 332 |
//System.out.println("new term is not null branch in handle new query term"); |
331 | 333 |
//we only handle union operator now. |
332 |
if (operator != null && operator.equalsIgnoreCase(UNION) && |
|
333 |
MetacatUtil.pathsForIndexing.contains(newTerm.getPathExpression())) |
|
334 |
{ |
|
335 |
//System.out.println("in only union branch in handle new query term"); |
|
336 |
for (int i=0; i<queryTermsInPathIndex.size(); i++) |
|
337 |
{ |
|
338 |
QueryTerm term = (QueryTerm)queryTermsInPathIndex.elementAt(i); |
|
339 |
if (term != null && term.hasSameSearchValue(newTerm)) |
|
340 |
{ |
|
341 |
//System.out.println("1Move a query term and add a new query term into search value in handle new query term"); |
|
342 |
// find a target which has same search value |
|
343 |
Vector newSameValueVector = new Vector(); |
|
344 |
newSameValueVector.add(term); |
|
345 |
newSameValueVector.addElement(newTerm); |
|
346 |
queryTermsWithSameValue.add(newSameValueVector); |
|
347 |
queryTermsInPathIndex.remove(i); |
|
348 |
return; |
|
349 |
} |
|
350 |
} |
|
351 |
// no same search value was found in queryTerms. |
|
352 |
// then we need search queryTermsWithSameValue |
|
353 |
for (int i=0; i<queryTermsWithSameValue.size(); i++) |
|
354 |
{ |
|
355 |
Vector sameValueVec = (Vector)queryTermsWithSameValue.elementAt(i); |
|
356 |
// we only compare the first query term |
|
357 |
QueryTerm term = (QueryTerm)sameValueVec.elementAt(0); |
|
358 |
if (term != null && term.hasSameSearchValue(newTerm)) |
|
359 |
{ |
|
360 |
//System.out.println("2add a new query term into search value in handle new query term"); |
|
361 |
sameValueVec.add(newTerm); |
|
362 |
return; |
|
363 |
} |
|
364 |
} |
|
365 |
//nothing found, but the search path is still in xml_path_index, |
|
366 |
// save it into queryTermsInPathIndex vector |
|
367 |
queryTermsInPathIndex.add(newTerm); |
|
368 |
return; |
|
369 |
} |
|
334 |
try { |
|
335 |
if (operator != null |
|
336 |
&& operator.equalsIgnoreCase(UNION) |
|
337 |
&& SystemUtil.getPathsForIndexing().contains( |
|
338 |
newTerm.getPathExpression())) { |
|
339 |
// System.out.println("in only union branch in handle new |
|
340 |
// query term"); |
|
341 |
for (int i = 0; i < queryTermsInPathIndex.size(); i++) { |
|
342 |
QueryTerm term = (QueryTerm) queryTermsInPathIndex.elementAt(i); |
|
343 |
if (term != null && term.hasSameSearchValue(newTerm)) { |
|
344 |
// System.out.println("1Move a query term and add a |
|
345 |
// new query term into search value in handle new |
|
346 |
// query term"); |
|
347 |
// find a target which has same search value |
|
348 |
Vector newSameValueVector = new Vector(); |
|
349 |
newSameValueVector.add(term); |
|
350 |
newSameValueVector.addElement(newTerm); |
|
351 |
queryTermsWithSameValue.add(newSameValueVector); |
|
352 |
queryTermsInPathIndex.remove(i); |
|
353 |
return; |
|
354 |
} |
|
355 |
} |
|
356 |
// no same search value was found in queryTerms. |
|
357 |
// then we need search queryTermsWithSameValue |
|
358 |
for (int i = 0; i < queryTermsWithSameValue.size(); i++) { |
|
359 |
Vector sameValueVec = (Vector) queryTermsWithSameValue |
|
360 |
.elementAt(i); |
|
361 |
// we only compare the first query term |
|
362 |
QueryTerm term = (QueryTerm) sameValueVec.elementAt(0); |
|
363 |
if (term != null && term.hasSameSearchValue(newTerm)) { |
|
364 |
// System.out.println("2add a new query term into |
|
365 |
// search value in handle new query term"); |
|
366 |
sameValueVec.add(newTerm); |
|
367 |
return; |
|
368 |
} |
|
369 |
} |
|
370 |
// nothing found, but the search path is still in |
|
371 |
// xml_path_index, |
|
372 |
// save it into queryTermsInPathIndex vector |
|
373 |
queryTermsInPathIndex.add(newTerm); |
|
374 |
return; |
|
375 |
} |
|
376 |
} catch (UtilException ue) { |
|
377 |
logMetacat.warn("Could not get index paths: " + ue.getMessage()); |
|
378 |
} |
|
370 | 379 |
|
371 | 380 |
// add this newTerm to queryTerms since we couldn't find it in xml_path_index |
372 | 381 |
queryTerms.add(newTerm); |
src/edu/ucsb/nceas/metacat/QueryTerm.java | ||
---|---|---|
33 | 33 |
import org.apache.log4j.Logger; |
34 | 34 |
|
35 | 35 |
import edu.ucsb.nceas.metacat.util.MetacatUtil; |
36 |
import edu.ucsb.nceas.metacat.util.SystemUtil; |
|
37 |
import edu.ucsb.nceas.metacat.util.UtilException; |
|
36 | 38 |
|
37 | 39 |
/** a utility class that represents a single term in a query */ |
38 | 40 |
public class QueryTerm |
... | ... | |
224 | 226 |
|
225 | 227 |
// if pathexpr has been specified in metacat.properties for indexing |
226 | 228 |
if(pathexpr != null){ |
227 |
if(MetacatUtil.pathsForIndexing.contains(pathexpr)){ |
|
228 |
usePathIndex = true; |
|
229 |
} |
|
229 |
try { |
|
230 |
if (SystemUtil.getPathsForIndexing().contains(pathexpr)) { |
|
231 |
usePathIndex = true; |
|
232 |
} |
|
233 |
} catch (UtilException ue) { |
|
234 |
log.warn("Could not get index paths: " + ue.getMessage()); |
|
235 |
} |
|
230 | 236 |
} |
231 | 237 |
|
232 |
|
|
233 | 238 |
if(usePathIndex){ |
234 | 239 |
// using xml_path_index table..... |
235 | 240 |
if(notEqual == true ){ |
build.properties | ||
---|---|---|
27 | 27 |
http.protocol=http |
28 | 28 |
config.lsidauthority=ecoinformatics.org |
29 | 29 |
|
30 |
# Select the database to use for metadata storage |
|
31 |
# Valid values are oracle, postgresql, sqlserver |
|
32 |
# MCD the next line needs to go away |
|
33 |
#database=postgresql |
|
34 |
|
|
35 |
# The JDBC connection string used to connect to the database |
|
36 |
#jdbc-connect=jdbc:oracle:thin:@metacat.nceas.ucsb.edu:1521:knb |
|
37 |
#jdbc-connect=jdbc:postgresql://localhost/postgres |
|
38 |
#jdbc-connect=jdbc:microsoft:sqlserver://fatali.nceas.ucsb.edu:1433 |
|
39 |
|
|
40 |
# The base directory for locating JDBC jar files (not needed for postgresql) |
|
41 |
#jdbc.base=./lib |
|
42 |
#jdbc-base=F:\\Program Files\\Microsoft SQL Server 2000 Driver for JDBC\\lib |
|
43 |
#jdbc.lib.oracle=classes111.zip |
|
44 |
#jdbc.lib.postgres=postgresql-8.0-312.jdbc3.jar |
|
45 |
#jdbc.lib.sqlserver1=msbase.jar |
|
46 |
#jdbc.lib.sqlserver2=msutil.jar |
|
47 |
#jdbs.lib.sqlserver3=mssqlserver.jar |
|
48 |
|
|
49 |
# Registry & LDAP properties |
|
50 |
# This section can safely be ignored if installing Metacat without the Perl components |
|
51 |
# LDAP configuration |
|
52 |
ldap.context=unaffiliated |
|
53 |
ldap.url=ldap.ecoinformatics.org |
|
54 |
ldap.password=LDAP_PASSWORD_HERE |
|
55 |
|
|
56 |
# Registry CGIs URL |
|
57 |
cgi-prefix=http://${httpserver}/${metacat.context}/cgi-bin |
|
58 |
|
|
59 | 30 |
# SCW: Set the cgi-user, either here or in scripts to properly |
60 | 31 |
# set the permissions on the temporary folder; cgi-writable files |
61 | 32 |
cgi-user=www-data |
... | ... | |
94 | 65 |
|
95 | 66 |
compile.debug=true |
96 | 67 |
compile.deprecation=false |
97 |
compile.optimize=true |
|
68 |
compile.optimize=true
|
|
98 | 69 |
|
99 |
# paths to be indexed when document is inserted. these are the paths which will be searched often |
|
100 |
indexPaths=organizationName,originator/individualName/surName,originator/individualName/givenName,originator/organizationName,creator/individualName/surName,creator/individualName/givenName,creator/organizationName,dataset/title,keyword,geographicCoverage/boundingCoordinates/northBoundingCoordinate,geographicCoverage/boundingCoordinates/southBoundingCoordinate,geographicCoverage/boundingCoordinates/westBoundingCoordinate,geographicCoverage/boundingCoordinates/eastBoundingCoordinate,eastBoundingCoordinate,title,entityName,individualName/surName,abstract/para,surName,givenName,para,geographicDescription,literalLayout,eastbc,northbc,westbc,southbc,dataset/access/allow/principal,access/allow/principal,entityName,taxonRankValue,dataset/dataTable/physical/distribution/online/url,dataset/spatialRaster/physical/distribution/online/url,@packageId,/reviewHistory/review/packageId,EcogridRegEntry/description,EcogridRegEntry/serviceName,EcogridRegEntry/endPoint,associatedParty/individualName/surName,associatedParty/organizationName,coverage/temporalCoverage/singleDateTime/alternativeTimeScale/timeScaleName,coverage/temporalCoverage/rangeOfDates/beginDate/alternativeTimeScale/timeScaleName,coverage/temporalCoverage/rangeOfDates/endDate/alternativeTimeScale/timeScaleName,placekey,idinfo/citation/citeinfo/title,idinfo/citation/citeinfo/origin,idinfo/keywords/theme/themekey,abstract,dataset/dataTable/physical/distribution/online/url/@function,dataset/spatialRaster/physical/distribution/online/url/@function,taxonomicClassification/taxonRankValue,taxonomicClassification/taxonRankName,northBoundingCoordinate,southBoundingCoordinate,westBoundingCoordinate,eastBoundingCoordinate,additionalMetadata/moderatorComment |
|
101 |
|
|
102 | 70 |
# Flag to install ecogird or not. Possible values are true or false |
103 | 71 |
install.ecogrid=true |
104 | 72 |
|
build.xml | ||
---|---|---|
156 | 156 |
<filter token="eml2_0_1namespace" value="${eml2_0_1namespace}"/> |
157 | 157 |
<filter token="eml2_1_0namespace" value="${eml2_1_0namespace}"/> |
158 | 158 |
<filter token="stmmlnamespace" value="${stmmlnamespace}"/> |
159 |
<!-- MCD BYE filter token="forcereplicationwaitingtime" value="${forcereplicationwaitingtime}" / --> |
|
160 |
<!-- MCD BYE filter filter token="debuglevel" value="${debuglevel}" / --> |
|
161 |
<!-- MCD BYE filter token="defaultcontenttype" value="${defaultcontenttype}" / --> |
|
162 | 159 |
<filter token="debugprefix" value="${debugprefix}"/> |
163 |
<filter token="indexPaths" value="${indexPaths}"/> |
|
164 | 160 |
|
165 | 161 |
<filter token="defaultStage" value="${defaultStage}"/> |
166 | 162 |
<filter token="defaultHeader" value="${defaultHeader}"/> |
Also available in: Unified diff
Format indexPaths in metacat.properties. Remove from build.properties and build.xml. Move indexPath list getter from MetacatUtil to SystemUtil.