@Test public void testGrammarSearchFullEntry() { BibEntry entry = new BibEntry(); entry.setField(FieldName.TITLE, "systematic review"); SearchQuery searchQuery = new SearchQuery("title=\"systematic review\"", false, false); assertTrue(searchQuery.isMatch(entry)); }
@Test public void testGrammarSearch() { BibEntry entry = new BibEntry(); entry.addKeyword("one two", ','); SearchQuery searchQuery = new SearchQuery("keywords=\"one two\"", false, false); assertTrue(searchQuery.isMatch(entry)); }
@Test public void testSearchMatchesSingleKeyword() { BibEntry e = new BibEntry(BibtexEntryTypes.INPROCEEDINGS.getName()); e.setField("keywords", "banana, pineapple, orange"); SearchQuery searchQuery = new SearchQuery("anykeyword==pineapple", false, false); assertTrue(searchQuery.isMatch(e)); }
@Test public void testSearchingForOpenBraketInBooktitle() { BibEntry e = new BibEntry(BibtexEntryTypes.INPROCEEDINGS.getName()); e.setField(FieldName.BOOKTITLE, "Super Conference (SC)"); SearchQuery searchQuery = new SearchQuery("booktitle=\"(\"", false, false); assertTrue(searchQuery.isMatch(e)); }
@Test public void testSearchAllFieldsNotForSpecificField() { BibEntry e = new BibEntry(BibtexEntryTypes.INPROCEEDINGS.getName()); e.setField("title", "Fruity features"); e.setField("keywords", "banana, pineapple, orange"); SearchQuery searchQuery = new SearchQuery("anyfield=fruit and keywords!=banana", false, false); assertFalse(searchQuery.isMatch(e)); }