use of com.zimbra.cs.index.query.parser.QueryParser in project zm-mailbox by Zimbra.
the class QueryParserTest method init.
@BeforeClass
public static void init() throws Exception {
MailboxTestUtil.initServer();
Provisioning prov = Provisioning.getInstance();
prov.createAccount("test@zimbra.com", "secret", new HashMap<String, Object>());
Mailbox mbox = MailboxManager.getInstance().getMailboxByAccountId(MockProvisioning.DEFAULT_ACCOUNT_ID);
parser = new QueryParser(mbox, ZimbraAnalyzer.getInstance());
}
use of com.zimbra.cs.index.query.parser.QueryParser in project zm-mailbox by Zimbra.
the class QueryParserTest method contactContent.
@Test
public void contactContent() throws Exception {
QueryParser parser = new QueryParser(null, ZimbraAnalyzer.getInstance());
parser.setTypes(EnumSet.of(MailItem.Type.CONTACT));
String src = "zimbra";
Assert.assertEquals("(Q(CONTACT:zimbra) || Q(l.content:zimbra))", Query.toString(parser.parse(src)));
// stop word
src = "in";
Assert.assertEquals("(Q(CONTACT:in) || Q(l.content:))", Query.toString(parser.parse(src)));
}
use of com.zimbra.cs.index.query.parser.QueryParser in project zm-mailbox by Zimbra.
the class QueryParserTest method contact.
@Test
public void contact() throws Exception {
QueryParser parser = new QueryParser(null, ZimbraAnalyzer.getInstance());
String src = "contact:\"Conf -\"";
Assert.assertEquals("Q(CONTACT:conf,-)", Query.toString(parser.parse(src)));
src = "contact:\"Conf - Prom\"";
Assert.assertEquals("Q(CONTACT:conf,-,prom)", Query.toString(parser.parse(src)));
src = "contact:\"Conf - Promontory E\"";
Assert.assertEquals("Q(CONTACT:conf,-,promontory,e)", Query.toString(parser.parse(src)));
src = "contact:\"Conf - Promontory E*****\"";
Assert.assertEquals("Q(CONTACT:conf,-,promontory,e)", Query.toString(parser.parse(src)));
src = "contact:\"Conf - Prom* E*\"";
Assert.assertEquals("Q(CONTACT:conf,-,prom,e)", Query.toString(parser.parse(src)));
}
use of com.zimbra.cs.index.query.parser.QueryParser in project zm-mailbox by Zimbra.
the class QueryParserTest method quoted.
@Test
public void quoted() throws Exception {
QueryParser parser = new QueryParser(null, ZimbraAnalyzer.getInstance());
parser.setTypes(EnumSet.of(MailItem.Type.CONTACT));
Assert.assertEquals("(Q(CONTACT:zimbra,quoted,test) || Q(l.content:zimbra,quoted,test))", Query.toString(parser.parse("\"Zimbra \\\"quoted\\\" test\"")));
}
use of com.zimbra.cs.index.query.parser.QueryParser in project zm-mailbox by Zimbra.
the class QueryParserTest method quick.
@Test
public void quick() throws Exception {
QueryParser parser = new QueryParser(null, ZimbraAnalyzer.getInstance());
parser.setQuick(true);
Assert.assertEquals("Q(l.content:all,hands,meeting[*])", Query.toString(parser.parse("all hands meeting")));
Assert.assertEquals("Q(l.content:all,hands,meeting[*])", Query.toString(parser.parse("all hands meeting*")));
}
Aggregations