Revision 2561
Added by sgarg about 19 years ago
src/edu/ucsb/nceas/metacat/QuerySpecification.java | ||
---|---|---|
79 | 79 |
/** List of users owning documents to be searched */ |
80 | 80 |
private Vector ownerList; |
81 | 81 |
|
82 |
/** List of sites/scopes used to constrain search */ |
|
83 |
private Vector siteList; |
|
84 |
|
|
85 | 82 |
/** The root query group that contains the recursive query constraints */ |
86 | 83 |
private QueryGroup query = null; |
87 | 84 |
|
... | ... | |
140 | 137 |
queryStack = new Stack(); |
141 | 138 |
returnFieldList = new Vector(); |
142 | 139 |
ownerList = new Vector(); |
143 |
siteList = new Vector(); |
|
144 | 140 |
this.parserName = parserName; |
145 | 141 |
this.accNumberSeparator = accNumberSeparator; |
146 | 142 |
|
... | ... | |
190 | 186 |
queryStack = new Stack(); |
191 | 187 |
returnFieldList = new Vector(); |
192 | 188 |
ownerList = new Vector(); |
193 |
siteList = new Vector(); |
|
194 | 189 |
this.accNumberSeparator = accNumberSeparator; |
195 | 190 |
} |
196 | 191 |
|
... | ... | |
480 | 475 |
} |
481 | 476 |
|
482 | 477 |
/** |
483 |
* Accessor method to return a vector of the site fields as defined in the |
|
484 |
* <site> tag in the pathquery dtd. |
|
485 |
*/ |
|
486 |
public Vector getSiteList() |
|
487 |
{ |
|
488 |
return this.siteList; |
|
489 |
} |
|
490 |
|
|
491 |
/** |
|
492 |
* method to set the list of sites used to constrain this query |
|
493 |
*/ |
|
494 |
public void setSiteList(Vector siteList) |
|
495 |
{ |
|
496 |
this.siteList = siteList; |
|
497 |
} |
|
498 |
|
|
499 |
/** |
|
500 | 478 |
* get the QueryGroup used to express query constraints |
501 | 479 |
*/ |
502 | 480 |
public QueryGroup getQueryGroup() |
... | ... | |
625 | 603 |
filterDocList.add(textBuffer.toString().trim()); |
626 | 604 |
} else if (leaving.getTagName().equals("owner")) { |
627 | 605 |
ownerList.add(textBuffer.toString().trim()); |
628 |
} else if (leaving.getTagName().equals("site")) { |
|
629 |
siteList.add(textBuffer.toString().trim()); |
|
630 | 606 |
} |
631 | 607 |
|
632 | 608 |
//rest textBuffer |
... | ... | |
789 | 765 |
} |
790 | 766 |
} |
791 | 767 |
|
792 |
// Add SQL to filter for sites requested in the query |
|
793 |
// This is an implicit OR for the list of sites |
|
794 |
if (!siteList.isEmpty()) { |
|
795 |
boolean first = true; |
|
796 |
boolean emptyString = true; |
|
797 |
|
|
798 |
if(!self.toString().equals("")){ |
|
799 |
self.append(" AND ("); |
|
800 |
emptyString = false; |
|
801 |
} |
|
802 |
|
|
803 |
Enumeration en = siteList.elements(); |
|
804 |
while (en.hasMoreElements()) { |
|
805 |
String current = (String) en.nextElement(); |
|
806 |
if (first) { |
|
807 |
first = false; |
|
808 |
self.append(" SUBSTR(docid, 1, INSTR(docid, '" |
|
809 |
+ accNumberSeparator + "')-1) = '" + current + "'"); |
|
810 |
} else { |
|
811 |
self.append(" OR SUBSTR(docid, 1, INSTR(docid, '" |
|
812 |
+ accNumberSeparator + "')-1) = '" + current + "'"); |
|
813 |
} |
|
814 |
} |
|
815 |
|
|
816 |
if(!emptyString){ |
|
817 |
self.append(") "); |
|
818 |
} |
|
819 |
} |
|
820 |
|
|
821 | 768 |
// if there is only one percentage search item, this query is a |
822 | 769 |
// percentage |
823 | 770 |
// search query |
Also available in: Unified diff
Removing support for 'site' from pathquery