Project

General

Profile

« Previous | Next » 

Revision 3723

Added by Matt Jones over 16 years ago

MOdified query passing, and default cache location.

View differences:

src/perl/cache_eml_data.pl
24 24
my ($url) = @ARGV; 
25 25

  
26 26
# Initialize the data cache
27
my $cacheDir = "/tmp/metacat/cache";
27
my $cacheDir = "/var/metacat/cache";
28 28
my $cache = initializeCache($cacheDir);
29 29

  
30 30
# Open a metacat connection
31 31
my $metacat = openMetacatConnection($url);
32 32

  
33 33
# Get a list of EML documents
34
my $result = executeQuery($metacat);
34
#my $queryTerm = "%Jones%";
35
my $queryTerm = "%";
36
my $result = executeQuery($metacat, $queryTerm);
35 37

  
36 38
# Extract an array of all of the entity URLs for each EML document
37 39
my $listRef = extractEntityUrlList($result);
......
70 72
#
71 73
sub executeQuery {
72 74
    my $metacat = shift;
75
    my $queryTerm = shift;
73 76

  
74
    my $query = "<?xml version=\"1.0\" ?> <pathquery version=\"1.2\">  <querytitle>Untitled-Search-2</querytitle>  <returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN</returndoctype> <returndoctype>-//NCEAS//eml-dataset-2.0//EN</returndoctype>  <returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype>  <returndoctype>eml://ecoinformatics.org/eml-2.0.1</returndoctype><returnfield>dataTable/physical/distribution/online/url</returnfield><returnfield>dataTable/entityName</returnfield><querygroup operator=\"UNION\"><queryterm searchmode=\"contains\" casesensitive=\"false\"><value>%Jones%</value><pathexpr>surName</pathexpr></queryterm></querygroup></pathquery>";
77
    my $query = "<?xml version=\"1.0\" ?> <pathquery version=\"1.2\">  <querytitle>Untitled-Search-2</querytitle>  <returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN</returndoctype> <returndoctype>-//NCEAS//eml-dataset-2.0//EN</returndoctype>  <returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype>  <returndoctype>eml://ecoinformatics.org/eml-2.0.1</returndoctype><returnfield>dataTable/physical/distribution/online/url</returnfield><returnfield>dataTable/entityName</returnfield><querygroup operator=\"UNION\"><queryterm searchmode=\"contains\" casesensitive=\"false\"><value>$queryTerm</value><pathexpr>surName</pathexpr></queryterm></querygroup></pathquery>";
75 78

  
76 79
    my $code = $metacat->squery($query);
77 80
    

Also available in: Unified diff