Skip to content

Instantly share code, notes, and snippets.

@vrutberg
Created January 27, 2009 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vrutberg/53272 to your computer and use it in GitHub Desktop.
Save vrutberg/53272 to your computer and use it in GitHub Desktop.
// ----- SÅHÄR GÖR JAG NU -----
while(doc != null)
{
// söker i hela databasen varje gång
Document searchDoc = someDatabase.search("MYFIELD=\""+ doc.getItemValueString("MYFIELD") +"\"").getFirstDocument();
// jobba med dokumentet...
doc = someView.getNextDocument(doc);
}
// ----- SÅHÄR VILL JAG GÖRA -----
// söker i databasen en gång
DocumentCollection possibleDocs = someDatabase.search("MYFIELD!=\"\"");
while(doc != null)
{
// och sedan söker jag i en docoumentcollection
Document searchDoc = possibleDocs.search("MYFIELD="\""+ doc.getItemValueString("MYFLEID") +"\"").getFirstDocument();
// jobba med dokumentet...
doc = possibleDocs.getNextDocument(doc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment