public void testRandomHindiwords() throws Exception { Long bucketId = 16L; String inputString = " तुम्हारा नाम क्या है ? Las Vegas is a sin!#^& City. asd hello asd asd sad asd asdsaasd asda ssdsA "; testAddDocument( bucketId, 40, "s21", "http://www.one.com", "This is test end of word..", "." + inputString + " asd ", "No Preview..."); List<String> matchingWords = new ArrayList<String>(); matchingWords.add("नाम"); List<Integer> hids = new ArrayList<Integer>(); hids.add(40); List<DocumentVO> teasers = TeaserReader.read(new Storable(bucketId), hids, matchingWords, 30); assertNotNull("Expecting one result", teasers); assertEquals(1, teasers.size()); String aTeaser = null; for (DocumentVO vo : teasers) { aTeaser = vo.getTeaser(); } System.out.println("aTeaser : [" + aTeaser + "]"); System.out.println("inputString : [" + inputString + "]"); assertEquals(" तुम्हारा नाम क्या है ? Las Vegas is a sin!#^& City. asd hello ", aTeaser); }
// out of the box word search// public void testNoWord() throws Exception { Long bucketId = 16L; testAddDocument( bucketId, 9, "s9", "http://www.one.com", "This is no word ..", ".Las Vegas is a sin!#^& City. asd asd asd sad asd asdsaasd asda ssdsa asd ", "No Preview..."); List<String> matchingWords = new ArrayList<String>(); matchingWords.add("GoD"); List<Integer> hids = new ArrayList<Integer>(); hids.add(9); List<DocumentVO> teasers = TeaserReader.read(new Storable(bucketId), hids, matchingWords, 30); assertNotNull("Expecting one result", teasers); assertEquals(1, teasers.size()); String aTeaser = null; for (DocumentVO vo : teasers) { aTeaser = vo.getTeaser(); } assertEquals("", aTeaser); }
public void testFirstWordsLastCaps() throws Exception { Long bucketId = 16L; String inputString = " laS Vegas is a sin!#^& City asd hello asd asd sad asd asdsaasd asda ssdsa "; testAddDocument( bucketId, 16, "s16", "http://www.one.com", "This is test end of word..", "." + inputString + " asd ", "No Preview..."); List<String> matchingWords = new ArrayList<String>(); matchingWords.add("laS"); List<Integer> hids = new ArrayList<Integer>(); hids.add(16); List<DocumentVO> teasers = TeaserReader.read(new Storable(bucketId), hids, matchingWords, 30); assertNotNull("Expecting one result", teasers); assertEquals(1, teasers.size()); String aTeaser = null; for (DocumentVO vo : teasers) { aTeaser = vo.getTeaser(); } assertEquals(inputString, aTeaser); }
// three same word contd// public void testThreeWordsCount() throws Exception { Long bucketId = 16L; String inputString = "Las Vegas is a sin!#^& City. asd asd asd sad asd asdsaasd asda ssdsa"; testAddDocument( bucketId, 7, "s7", "http://www.one.com", "This is three words contd..", "." + inputString + " asd ", "No Preview..."); List<String> matchingWords = new ArrayList<String>(); matchingWords.add("asd asd asd"); List<Integer> hids = new ArrayList<Integer>(); hids.add(7); List<DocumentVO> teasers = TeaserReader.read(new Storable(bucketId), hids, matchingWords, 30); assertNotNull("Expecting one result", teasers); assertEquals(1, teasers.size()); String aTeaser = null; for (DocumentVO vo : teasers) { aTeaser = vo.getTeaser(); } assertEquals(inputString, aTeaser); }
/** * public void testCheckOneRecord() throws Exception { testA(1L, 1, "id1", "http://www.one.com", * "This is One Title", "One starts from one and extends to infinite", "No Preview"); * * <p>List<Integer> hids = new ArrayList<Integer>(); hids.add(1); List<String> matchingWords = new * ArrayList<String>(); matchingWords.add("starts"); TeaserReader.read(new Storable(1L), hids, * matchingWords, 40); } */ public void testCheckTwoRecord() throws Exception { Long bucketId = 6L; testAddDocument( bucketId, 1, "x1", "http://www.one.com", "This is One Title", ".One starts from one and extends to infinite. However donkies are cows and cows are dogs.Large kala Lala Mala Ramchik pksdfkjd dsfdkjs dsjfhdkjs sdjfhdskj sdfdshf dsfdshfdshfh shfdshjf j sdfdshf dsjhf sd sdhfdsjhf dsjfgdshfgdsj f END", "No Preview..."); testAddDocument( bucketId, 2, "x2", "http://www.one.com", "This is two Title", "One starts from two and extends to infinite are yy ttt.....", "No Preview"); testAddDocument( bucketId, 3, "x3", "http://www.one.com", "This is third Title :- what's your name ???", " how are you ", "No Answer YEt...."); List<String> matchingWords = new ArrayList<String>(); matchingWords.add("are"); List<Integer> hids = new ArrayList<Integer>(); hids.add(1); hids.add(2); hids.add(3); List<DocumentVO> founds = TeaserReader.read(new Storable(bucketId), hids, matchingWords, 30); for (DocumentVO documentVO : founds) { System.out.println(documentVO.getTeaser()); } }