public WebProcessor(ConfiguredSettings settings)
 {
     searchPhrase = settings.get(ConfiguredConstants.SEARCH_PHRASE_LBL).ToLower();
     usingFilter  = StringExtensionMethods.ToBoolean(settings.get(ConfiguredConstants.USE_FILTER_LBL));
     string[] terms = searchPhrase.Split(' ');
     searchTokens = new List <string>();
     for (int i = 0; i < terms.Length; i++)
     {
         searchTokens.Add(terms[i].ToLower());
     }
     searchTokens.Add(searchPhrase);
 }
        public SearchContext(ConfiguredSettings configs, ConcurrentQueue <string> mainQueue, ConcurrentQueue <string> secondaryQueue, string id) : base(mainQueue, secondaryQueue)
        {
            contextualId       = id;
            configuredSettings = configs;

            bool isUsingQueue = configs.get(ConfiguredConstants.USE_QUEUE_LBL).ToBoolean();

            if (sharedSearchContext == null)
            {
                sharedSearchContext = new SharedSearchContextState(isUsingQueue);
                sharedSearchContext.getContextInfo().addThreadId(contextualId);
            }
            else
            {
                sharedSearchContext.getContextInfo().addThreadId(contextualId);
            }
            maxPageSearchLimit = StringExtensionMethods.ToInteger(configs.get(ConfiguredConstants.SEARCH_LIMIT_LBL));
            traversalStyle     = TraversalStyle.getTraversalType(configs.get(ConfiguredConstants.TRAVERSAL_STYLE_LBL));
            currentUrl         = StringExtensionMethods.URLifyParseAddition(configs.get(ConfiguredConstants.ENTRY_POINT_LBL), configs.get(ConfiguredConstants.SEARCH_PHRASE_LBL));
        }
Esempio n. 3
0
        /// <summary>
        /// Constructs multiple search context instance
        /// </summary>
        /// <param name="contexts"></param>
        private void constructAndDeployAetherlings(ConfiguredSettings configs)
        {
            int deploys = Int32.Parse(configs.get(ConfiguredConstants.THREADLING_COUNT_LBL));

            m_threadlings = new Threadling[deploys];
            string[] faces = m_repository.getRandomFaces(deploys);
            for (int i = 0; i < m_threadlings.Length; i++)
            {
                string contextId = StringExtensionMethods.generateUsername(6);
                m_threadlings[i] = new Threadling(configs, m_mainDisplayQueue, m_secondaryDisplayQueue, faces[i]);
                m_threadlings[i].start();
                // threads must be space out to prevent intersecting traversals
                Thread.Sleep(ApplicationConstants.TEN_SECONDS_AS_MS);
            }
        }