public NotTerm(IParseTerm NotTerm, int maxDoc) { Ch = NotTerm; now = 0; LastCh = NotTerm.NextPage(now); MaxDoc = maxDoc; }
private static IParseTerm mergeOr(IParseTerm a, IParseTerm b) { if (a != null && b != null) { return(new OrTerm(a, b)); } return(a == null ? b : a); }
public AndTerm(IParseTerm first, IParseTerm second) { Ch = new List <IParseTerm> { first, second }; chLast = new List <int> { first.NextPage(0), second.NextPage(0) }; }
public static IParseTerm NewParse(string[] TermBase, int Beg, int End) { IParseTerm ret = null; int WordId; List <int> AllDoc; for (; Beg + 1 < End; Beg++) { } return(ret); }
private static IParseTerm BildParse(string sm) { IParseTerm ret = null; //string smp = porter.Stemm(sm); int WordId = SearchData.Singelton.wordDic.NumbWord(sm); if (WordId >= 0) { List <int> AllDoc = SearchData.Singelton.blockTab.AllDockForWord(WordId); //byte[] AllDoc = SearchData.Singelton.blockTab.StringTableForWord(WordId); if (AllDoc != null) { //ret = new TermDocArh(AllDoc, WordId); ret = new TermDock(AllDoc, WordId); } } return(ret); }
public static IParseTerm parseBool(string[] TermBase) { IParseTerm ret = null; IParseTerm and = null; IParseTerm not = null; IParseTerm or = null; for (int i = 0; i < TermBase.Length; i++) { if (TermBase[i] == "\"") { i++; List <string> Ls = new List <string>(); for (; i < TermBase.Length && TermBase[i] != "\""; i++) { Ls.Add(TermBase[i]); } and = mergeAnd(and, InitQuote(Ls.ToArray(), (int)(Ls.Count * 1.2f))); } else if (TermBase[i] == "!") { i++; IParseTerm tmp = BildParse(TermBase[i]); if (tmp != null) { not = mergeAnd(not, new NotTerm(tmp, 1350000)); } } else if (TermBase[i] == "|") { i++;; or = mergeOr(or, BildParse(TermBase[i])); } else { and = mergeAnd(and, BildParse(TermBase[i])); } } ret = mergeAnd(mergeAnd(or, and), not); return(ret); }
public List <int> Search(string Zapros, out List <List <Tuple <int, int> > > ToCreateSniped) { IParseTerm Term = Parser.parse(Zapros);//Parser.InitQuote(Zapros.Split(), 10);// ToCreateSniped = new List <List <Tuple <int, int> > >(); List <int> SearchList = new List <int>(); int n = 0; if (Term != null) { for (;;) { n = Term.NextPage(n); if (n == -1) { break; } SearchList.Add(n); ToCreateSniped.Add(Term.GetInfo()); } } return(SearchList); }