@Test public void testAnalyse() throws Exception { List<String> rez; rez = LuceneSearchUtil.analyseForSearch("de", "HP 410A - Schwarz - Original - LaserJet - Tonerpatrone (CF410A) - für Color LaserJet Pro M452, LaserJet Pro MFP M377, MFP M477"); assertArrayEquals(new String[] {"hp", "410a", "schwarz", "original", "laserjet", "tonerpatron" , "cf410a", "color", "laserjet", "pro", "m452", "laserjet", "pro", "mfp", "m377", "mfp", "m477"}, rez.toArray()); rez = LuceneSearchUtil.analyseForSearch("en", "HP 410A - Schwarz - Original - LaserJet - Tonerpatrone (CF410A) - für Color LaserJet Pro M452, LaserJet Pro MFP M377, MFP M477"); assertArrayEquals(new String[] {"hp", "410a", "schwarz", "original", "laserjet", "tonerpatrone", "cf410a", "für", "color", "laserjet", "pro", "m452", "laserjet", "pro", "mfp", "m377", "mfp", "m477"}, rez.toArray()); rez = LuceneSearchUtil.analyseForSearch("en", "HP 410A - Black - Original LaserJet Toner Cartridge (CF410A) - for Color LaserJet Pro M452, LaserJet Pro MFP M377, MFP M477"); assertArrayEquals(new String[] {"hp", "410a", "black", "original", "laserjet", "toner", "cartridge", "cf410a", "color", "laserjet", "pro", "m452", "laserjet", "pro", "mfp", "m377", "mfp", "m477"}, rez.toArray()); rez = LuceneSearchUtil.analyseForSearch("ru", "HP 410A - Schwarz - Original - LaserJet - Tonerpatrone (CF410A) - für Color LaserJet Pro M452, LaserJet Pro MFP M377, MFP M477"); assertArrayEquals(new String[] {"hp", "410a", "schwarz", "original", "laserjet", "tonerpatrone", "cf410a", "für", "color", "laserjet", "pro", "m452", "laserjet", "pro", "mfp", "m377", "mfp", "m477"}, rez.toArray()); rez = LuceneSearchUtil.analyseForSearch("ru", "HP 410A - черный - оригинальный картридж с тонером LaserJet (CF410A) - для Color LaserJet Pro M452, LaserJet Pro MFP M377, MFP M477"); assertArrayEquals(new String[] {"hp", "410a", "черн" , "оригинальн" , "картридж", "тонер" , "laserjet", "cf410a", "color", "laserjet", "pro", "m452", "laserjet", "pro", "mfp", "m377", "mfp", "m477"}, rez.toArray()); rez = LuceneSearchUtil.analyseForSearch("de", "HP Prelude Toploader-Tasche, 15,6 Zoll"); assertArrayEquals(new String[] {"hp", "prelud" , "topload" , "tasch" , "15,6", "zoll"}, rez.toArray()); rez = LuceneSearchUtil.analyseForSearch("ru", "HP Prelude Toploader-Tasche, 15,6 Zoll"); assertArrayEquals(new String[] {"hp", "prelude", "toploader", "tasche", "15,6", "zoll"}, rez.toArray()); rez = LuceneSearchUtil.analyseForSearch("de", "1y SecureDoc WinEntr Supp 5K+ E-LTU"); assertArrayEquals(new String[] {"1y", "securedoc", "winentr", "supp", "5k", "e", "ltu"}, rez.toArray()); rez = LuceneSearchUtil.analyseForSearch("ru", "1y SecureDoc WinEntr Supp 5K+ E-LTU"); assertArrayEquals(new String[] {"1y", "securedoc", "winentr", "supp", "5k", "e", "ltu"}, rez.toArray()); rez = LuceneSearchUtil.analyseForSearch("ru", "черная компьтерная мышка ABC-001 с USB"); assertArrayEquals(new String[] {"черн" , "компьтерн" , "мышк" , "abc", "001", "usb"}, rez.toArray()); rez = LuceneSearchUtil.analyseForSearch("uk", "черная компьтерная мышка ABC-001 с USB"); assertArrayEquals(new String[] {"черн" , "компьтерн" , "мышк" , "abc", "001", "usb"}, rez.toArray()); rez = LuceneSearchUtil.analyseForSearch("zz", "HP Prelude Toploader-Tasche, 15,6 Zoll"); assertArrayEquals(new String[] {"hp", "prelude", "toploader", "tasche", "15,6", "zoll"}, rez.toArray()); rez = LuceneSearchUtil.analyseForSearch(null, "HP Prelude Toploader-Tasche, 15,6 Zoll"); assertArrayEquals(new String[] {"hp", "prelude", "toploader", "tasche", "15,6", "zoll"}, rez.toArray()); }
public static List<String> analyseForSearch(final String lang, final String phrase) { final Analysis analysis = LANGUAGE_SPECIFIC.getOrDefault(lang, LANGUAGE_SPECIFIC.get("default")); return analysis.analyse(phrase); }
LuceneSearchUtil { public static List<String> analyseForSearch(final String lang, final String phrase) { final Analysis analysis = LANGUAGE_SPECIFIC.getOrDefault(lang, LANGUAGE_SPECIFIC.get("default")); return analysis.analyse(phrase); } }
LuceneSearchUtil { public static List<String> analyseForSearch(final String lang, final String phrase) { final Analysis analysis = LANGUAGE_SPECIFIC.getOrDefault(lang, LANGUAGE_SPECIFIC.get("default")); return analysis.analyse(phrase); }  }
LuceneSearchUtil { public static List<String> analyseForSearch(final String lang, final String phrase) { final Analysis analysis = LANGUAGE_SPECIFIC.getOrDefault(lang, LANGUAGE_SPECIFIC.get("default")); return analysis.analyse(phrase); }  static List<String> analyseForSearch(final String lang, final String phrase); static void destroy(); }
LuceneSearchUtil { public static List<String> analyseForSearch(final String lang, final String phrase) { final Analysis analysis = LANGUAGE_SPECIFIC.getOrDefault(lang, LANGUAGE_SPECIFIC.get("default")); return analysis.analyse(phrase); }  static List<String> analyseForSearch(final String lang, final String phrase); static void destroy();  }