コード例 #1
0
        protected override void Execute()
        {
            ArrayList contextHighlightOffsets = null;
            string    context = (Core.State != CoreState.ShuttingDown) ? ContextCtor.GetContext(TermEntry, Lexemes, out contextHighlightOffsets) : ContextCtor.cFragmentsDelimiter;

            Core.ResourceAP.QueueJob(JobPriority.Immediate, new SetPropProviderDelegate(PropProvider.SetProp),
                                     TermEntry.DocIndex, FullTextIndexer.ContextPropId, context);
            Core.ResourceAP.QueueJob(JobPriority.Immediate, new SetPropProviderDelegate(PropProvider.SetProp),
                                     TermEntry.DocIndex, FullTextIndexer.ContextHighlightPropId, contextHighlightOffsets);
        }
コード例 #2
0
        [Test] public void Context1()
        {
            indexer.AddDocumentFragment(10, "Attachment 0\n");
            indexer.EndBatchUpdate();

            Entry[] result = indexer.ProcessQueryInternal("attachment");
            Assert.IsTrue(result.Length == 1);

            ArrayList contextHighlightData;
            Hashtable map = new Hashtable();

            map[0] = "attachment";
            string[] tokens = QueryProcessor.LastSearchLexemes;
            ContextCtor.GetContext(result[0], tokens, out contextHighlightData);
        }
コード例 #3
0
ファイル: TextIndexManager.cs プロジェクト: mo5h/omeo
 public bool GetHighlightData(IResource res, out WordPtr[] words)
 {
     words = null;
     if (_entries != null)
     {
         foreach (Entry e in _entries)
         {
             if (e.DocIndex == res.Id)
             {
                 ContextCtor.GetHighlightedTerms(e, _lexemes, out words);
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #4
0
        [Test] public void TestContextWithQueryTermNearRightEnd()
        {
            IResource newRes1 = Core.ResourceStore.NewResource("TestType");

            indexer.AddDocumentFragment(newRes1.Id, "word1 word2 word3 word4 word5 word6 word7 word8 word9 word10 word11 word21 word31 word41 word51 word61 word71 word81 word91 word101 ");
            indexer.EndBatchUpdate();

            Entry[] result = indexer.ProcessQueryInternal("word7 word31");
            Assert.IsTrue(result.Length == 1);

            ArrayList contextHighlightData;

            string[] tokens = QueryProcessor.LastSearchLexemes;
            foreach (string tok in tokens)
            {
                Console.Write(tok + "; ");
            }
            Console.WriteLine(" ");
            string context = ContextCtor.GetContext(result[0], tokens, out contextHighlightData);

            Console.WriteLine(context);
        }