Exemplo n.º 1
0
        public int Compare(object a, object b)
        {
            HashtableRecord r1 = (HashtableRecord)a;
            HashtableRecord r2 = (HashtableRecord)b;

            return(((IComparable)r1["Name"]).CompareTo(r2["Name"]));
        }
Exemplo n.º 2
0
        HashtableRecord CreateRecord(string name, int age)
        {
            HashtableRecord record = new HashtableRecord();

            record["Name"] = name;
            record["Age"]  = age;
            return(record);
        }
Exemplo n.º 3
0
        public void SetUp()
        {
            _record1 = CreateRecord("Teresa", 43);
            _record2 = CreateRecord("M�rcia", 26);
            _record3 = CreateRecord("Bamboo", 27);

            _result = new SearchResult();
            _result.Add(new SearchHit(_record1));
            _result.Add(new SearchHit(_record2));
            _result.Add(new SearchHit(_record3));
        }
Exemplo n.º 4
0
        public void TestIndexSerialization()
        {
            _index = TokenAssertions.SerializeDeserialize(_index) as IIndex;

            FullTextSearchIndex index = _index as FullTextSearchIndex;

            IRecord[] records = index.Records;
            AssertEquals(3, records.Length);
            _record1 = FindByTitle(records, (string)_record1["Title"]);
            _record2 = FindByTitle(records, (string)_record2["Title"]);
            _record3 = FindByTitle(records, (string)_record3["Title"]);

            TestSimpleSearch();
        }
Exemplo n.º 5
0
        public void SetUp()
        {
            FullTextSearchIndex index = new FullTextSearchIndex();

            index.Fields.Add("Title");

            FullTextSearchIndex multipleFieldIndex = new FullTextSearchIndex();

            multipleFieldIndex.Fields.Add("Title");
            multipleFieldIndex.Fields.Add("Ingredients");

            _index = index;
            _multipleFieldIndex = multipleFieldIndex;

            _record1                = new HashtableRecord();
            _record1["Title"]       = "Bolo de Chocolate";
            _record1["Calories"]    = 300;
            _record1["Ingredients"] = "3 colheres de açucar\n1 lata de nescau\nfermento";
            _index.Add(_record1);
            _multipleFieldIndex.Add(_record1);
            DumpPostings(index.Postings);

            _record2                = new HashtableRecord();
            _record2["Title"]       = "Bolo de Açafrão";
            _record2["Calories"]    = 100;
            _record2["Ingredients"] = "10 folhas de açafrão\n1 colher de fermento em pó";
            _index.Add(_record2);
            _multipleFieldIndex.Add(_record2);
            DumpPostings(index.Postings);

            _record3                = new HashtableRecord();
            _record3["Title"]       = "Torta de Chocolate";
            _record3["Calories"]    = 400;
            _record3["Ingredients"] = "1 lata de nescau\nchocolate granulado\naçucar";
            _index.Add(_record3);
            _multipleFieldIndex.Add(_record3);
            DumpPostings(index.Postings);
        }