Ejemplo n.º 1
0
 private static void PushTermOnStack(string term, TermIndexAccessor index, Stack opStack)
 {
     if (!FullTextIndexer.isValuableToken(term))
     {
         opStack.Push(new StopwordTerm());
         if (Stopwords.IndexOf(term) == -1)
         {
             Stopwords.Add(term);
         }
     }
     else
     {
         TermIndexRecord record = index.GetRecord(term);
         if (record != null)
         {
             int order = Lexemes.IndexOf(term);
             if (order == -1)
             {
                 Lexemes.Add(term);
                 order = Lexemes.Count - 1;
             }
             record.PopulateRecordID((ushort)order);
         }
         opStack.Push(record);
     }
 }
Ejemplo n.º 2
0
        public TextQueriesOptimizationManager(AsyncProcessor processor, FullTextIndexer indexer)
        {
            _textProcessor = processor;
            _textIndexer   = indexer;
            _queryResults  = new Dictionary <string, IntArrayList>();
            _activeQueries = new List <string>();

            InitializeConditionsList();
            InitializeListeners();
        }
Ejemplo n.º 3
0
        private static void PushTermOnStack(string term, IntHashTable tokens, Stack <List <long> > opStack)
        {
            List <long> resultVal = null;

            if (FullTextIndexer.isValuableToken(term))
            {
                int HC;

                //  First check Id of the term in the local cache. Since the amount of
                //  query terms over all queries in the system is several tens (in average),
                //  the size of this cache is small enough. This cache allows not to
                //  consult terms trie each time.
                if (!_termIDs.TryGetValue(term, out HC))
                {
                    HC = Word.GetTokenIndex(term);
                }

                if (HC != -1)
                {
                    if (!_termIDs.ContainsKey(term))
                    {
                        _termIDs.Add(term, HC);
                    }

                    Object val = tokens[HC];
                    if (val != null)
                    {
                        resultVal = val as List <long>;
                        if (resultVal == null)
                        {
                            resultVal = new List <long>();
                            resultVal.Add((long)val);
                        }
                    }
                }
            }
            opStack.Push(resultVal);
        }