Project

General

Profile

« Previous | Next » 

Revision 2425

Added by sgarg almost 20 years ago

Added code to check if the document is indexed yet! So entry into xml_queryresult is only made if the doc is in xml_index.

View differences:

src/edu/ucsb/nceas/metacat/DBQuery.java
648 648
     while (_keys.hasMoreElements()){
649 649
         partOfDoclist.remove(_keys.nextElement());
650 650
     }
651

  
652
     // backup the keys-elements in partOfDoclist to check later
653
     // if the doc entry is indexed yet
654
     Hashtable partOfDoclistBackup = new Hashtable();
655
     _keys = partOfDoclist.keys();
656
     while (_keys.hasMoreElements()){
657
	 Object key = _keys.nextElement();
658
         partOfDoclistBackup.put(key, partOfDoclist.get(key));
659
     }
660

  
651 661
     MetaCatUtil.debugMessage("size of partOfDoclist after"
652 662
                             + " docidsInQueryresultTable(): "
653 663
                             + partOfDoclist.size() , 50);
......
671 681
         key = (String) keys.nextElement();
672 682
         element = (String)partOfDoclist.get(key);
673 683

  
674
         if(enterRecords && element != null && element.length() < offset){
684
	 // check if the enterRecords is true, elements is not null, element's 
685
         // length is less than the limit of table column and if the document 
686
         // has been indexed already
687
         if(enterRecords && element != null 
688
		&& element.length() < offset
689
		&& element.compareTo((String) partOfDoclistBackup.get(key)) != 0){
675 690
             query = "INSERT INTO xml_queryresult (returnfield_id, docid, "
676 691
                 + "queryresult_string) VALUES ('" + returnfield_id
677 692
                 + "', '" + key + "', '" + element + "')";

Also available in: Unified diff