Refactoring method and avoing Xapian warnings when query is '*'