Package de.jetwick.es

Examples of de.jetwick.es.SimilarTweetQuery


                updateAfterAjax(target, false);
            }

            @Override
            public void onFindSimilar(JTweet tweet, AjaxRequestTarget target) {
                JetwickQuery query = new SimilarTweetQuery(tweet, true);
                if (tweet.getTextTerms().size() == 0) {
                    warn("Try a different tweet. This tweet is too short.");
                    return;
                }

                logger.info("[stats] similar search:" + query.toString());
                doSearch(query, 0, false);
                updateAfterAjax(target, false);
            }

            @Override
            public Collection<JTweet> onInReplyOfClick(long id) {
                JTweet tw = getTweetSearch().findByTwitterId(id);
                logger.info("[stats] search tweet:" + id + " " + tw);
                if (tw != null)
                    return Arrays.asList(tw);
                else
                    return new ArrayList();
            }

            @Override
            public String getTweetsAsString() {
                if (lastQuery != null)
                    return twindexProvider.get().getTweetsAsString(lastQuery, "\t");

                return "";
            }

            @Override
            public void onHtmlExport() {
                if (lastQuery != null) {
                    PrinterPage printerPage = new PrinterPage();
                    List<JTweet> tweets = twindexProvider.get().searchTweets(lastQuery);
                    printerPage.setResults(tweets);
                    setResponsePage(printerPage);
                }
            }
        };
        add(resultsPanel.setOutputMarkupId(true));
//        add(wikiPanel = new WikipediaLazyLoadPanel("wikipanel"));

        String searchType = parameters.getString("search");
        String tmpUserName = null;
        boolean showSpacer = true;
        if (getMySession().hasLoggedIn()) {
            if (query.getQuery().isEmpty() && userName.isEmpty() && (searchType == null || searchType.isEmpty()))
                searchType = SearchBox.FRIENDS;
            tmpUserName = getMySession().getUser().getScreenName();
//            showSpacer = false;
        } else {
            ssPanel.setVisible(false);
            facetPanel.setVisible(false);
//            dateFilterPanel.setVisible(false);
            // so that the jetwick link on my twitter account works ;)           
            if (userName.isEmpty()) {
                tagCloudPanel.setVisible(false);

//                if (query.getQuery().isEmpty()) {
//                    resultsPanel.setVisible(false);
//                    navigationPanel.setVisible(false);
//                    showSpacer = false;
//                }
            }
        }
        dateFilterPanel.setVisible(false);

        searchBox = new SearchBox("searchbox", tmpUserName, searchType, showSpacer) {

            @Override
            protected Collection<String> getQueryChoices(String input) {
                return getTweetSearch().getQueryChoices(lastQuery, input);
            }

            @Override
            protected void onSelectionChange(AjaxRequestTarget target, String newValue) {
                if (lastQuery == null)
                    return;

                JetwickQuery tmpQ = lastQuery.getCopy().setQuery(newValue);
                tmpQ.removeFilterQueries(ElasticTweetSearch.DATE);
                doSearch(tmpQ, 0, false, true);
                updateAfterAjax(target, false);
            }

            @Override
            protected Collection<String> getUserChoices(String input) {
                return getTweetSearch().getUserChoices(lastQuery, input);
            }
        };
        add(searchBox.setOutputMarkupId(true));

        if (SearchBox.FRIENDS.equalsIgnoreCase(searchType)) {
            twitterFallback = false;
            query = createFriendQuery(query.getQuery());
            if (query == null)
                return;
        }

        doSearch(query, 0, twitterFallback);
View Full Code Here

TOP

Related Classes of de.jetwick.es.SimilarTweetQuery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.