Skip to content

Instantly share code, notes, and snippets.

@ayushgp
Last active February 15, 2016 10:27
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 ayushgp/fd0b23a6d214e451edf1 to your computer and use it in GitHub Desktop.
Save ayushgp/fd0b23a6d214e451edf1 to your computer and use it in GitHub Desktop.
Xapian 'contains' method for OmegaScript
//Added this at line 886:
CMD_contains,
//Added the function description at line 1012
T(contains, 2, 2, N, 0), //return position of substring, if not found return empty string
//Implemented contains function at line
case CMD_contains: {
size_t pos = args[1].find(args[0]);
if(pos!=string::npos){
stringstream ss;
ss << pos;
value = ss.str();
} else {
value = "";
}
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment