Package com.uwyn.drone.tools

Examples of com.uwyn.drone.tools.SearchTool


      return (long)(((double)elapsed/mProcessedCount)*mTotalCount)-elapsed;
    }
   
    public void run()
    {
      mSearchTool = new SearchTool();
      mSearchTool.reindexFull(this);

      synchronized (sIndexingMonitor)
      {
        sIndexingThread = null;
View Full Code Here


    catch (LogManagerException e)
    {
      Logger.getLogger("com.uwyn.drone.modules").severe(ExceptionUtils.getExceptionStackTrace(e));
    }

    SearchTool search_tool = new SearchTool();
    search_tool.indexServerMessage(moment, bot, channel, ServerMessage.parse(fullMessage.getRaw()));
  }
View Full Code Here

  {
    assert submission != null;

    BooleanQuery.setMaxClauseCount(Integer.MAX_VALUE);

    SearchTool     search_tool = new SearchTool();
    BooleanQuery   query = search_tool.getSearchQuery(submission);

    setNamedOutputBean("OffsetBean", submission);

    if (submission.isValidSearch() && query != null)
    {
      Hits hits = null;

      try
      {
        MultiReader       reader = null;
        ParallelMultiSearcher   searcher = null;

        List           searchers = new ArrayList();
        List           readers = new ArrayList();
        Collection         bots = BotsRunner.getRepInstance().getBots();
        Iterator         iter = bots.iterator();

        while (iter.hasNext())
        {
          Bot bot = (Bot)iter.next();

          Iterator channels_it = bot.getJoinedChannels().iterator();
          while (channels_it.hasNext())
          {
            Channel     channel = ((Channel)channels_it.next());
            StringBuffer   key = new StringBuffer();
            key
              .append(Config.getRepInstance().getString("LUCENE_DIR"))
              .append(File.separator)
              .append(bot.getName())
              .append("-")
              .append(bot.getServer().getServerName())
              .append("-")
              .append(channel.getName().substring(1));
           
            if (submission.getChannel() == null ||
              submission.getChannel().equals(""))
            {
              IndexReader   r = IndexReader.open(key.toString());
              IndexSearcher   s = new IndexSearcher(r);

              searchers.add(s);
              readers.add(r);
            }
            else
            {
              String submissionChannel = submission.getChannel().substring(submission.getChannel().indexOf("#"));
              if (channel.getName().equals(submissionChannel))
              {
                IndexReader   r = IndexReader.open(key.toString());
                IndexSearcher   s = new IndexSearcher(r);

                searchers.add(s);
                readers.add(r);
              }
            }
          }
        }

        IndexSearcher[] searcherArray = (IndexSearcher[])searchers.toArray(new IndexSearcher[0]);
        IndexReader[]   readerArray = (IndexReader[])readers.toArray(new IndexReader[0]);

        searcher = new ParallelMultiSearcher(searcherArray);
        reader = new MultiReader(readerArray);

        SortField dateSort = new SortField("momentDateSort", SortField.AUTO, true);
        SortField timeSort = new SortField("momentTimeSort", SortField.AUTO, false);

        hits = searcher.search(query, new Sort(new SortField[] { dateSort, timeSort }));

        // only highlight in the message
        Query           keywordQuery = search_tool.getKeywordQuery();
        Highlighter       highlighter = null;
        if (keywordQuery != null)
        {
          Query         rewritten_query =  keywordQuery.rewrite(reader);
          SimpleHTMLFormatter formatter = new SimpleHTMLFormatter("<span class=\"highlighted\">", "</span>");
View Full Code Here

TOP

Related Classes of com.uwyn.drone.tools.SearchTool

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.