示例#1
0
          General Public License for more details.
  
          You should have received a copy of the GNU General Public License 
          along with this program; if not, write to the Free Software 
          Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
          02110-1301, USA.
"""

from LmServer.common.log import ConsoleLogger
from LmServer.db.peruser import Peruser

namesFn = ""
outFn = ""

if __name__ == "__main__":
   
   peruser = Peruser(ConsoleLogger())
   peruser.openConnections()
   
   names = open(namesFn)
   output = open(outFn, 'w')
   
   for name in names:
      occAtoms = peruser.listOccurrenceSets(0, 10, displayName=name.strip())
      if len(occAtoms) > 0:
         output.write('%s : %s\n' % (name.strip(), ' '.join([str(occ.id) for occ in occAtoms])))
   
   output.close()
   
   peruser.closeConnections()
   
示例#2
0
   @param doc: A document to post (string)
   @param collection: The collection to add the document to
   @param mimeType: (optional) The MIME type of the document
   """
   cmd = "{cmd} -c {collection} -type {mimeType} -out no -d $'{data}'".format(
            cmd=SOLR_POST_COMMAND, collection=collection, mimeType=mimeType,
            data=doc)
   p = Popen(cmd)
   while p.poll() is None:
      sleep(.2)
      

# .............................................................................
if __name__ == "__main__":
   
   peruser = Peruser(ConsoleLogger())
   peruser.openConnections()
   
   beforeTime = None
   maxReturned = 10000
   startRecord = 0
   
   prjs = peruser.listProjections(startRecord, maxReturned, 
                              beforeTime=beforeTime, status=JobStatus.COMPLETE, 
                              atom=False)
   while len(prjs) == 0:
      # Make documents and post
      for prj in prjs:
         doc = makeProjectionDoc(prj)
         # Post document
         postDocument(doc, COLLECTION, mimeType='application/xml')