Exemple #1
0
        private void BindData()
        {
            string url = filterInput(tbxUrl.Text);

            pnlExtract.Visible = false;
            pnlIndex.Visible   = true;
            id.PageParser pp = new id.PageParser(url);
            setUrlLiteral(ltrIndexUrl, url, pp.GetTitle());
            dgrTerms.DataSource = pp.GetTerms(dgrTerms.SortExpression);
            dgrTerms.DataBind();
            ltrTermCount.Text = pp.GetTermCount().ToString();
        }
Exemple #2
0
 private void btnExtract_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         string url = filterInput(tbxUrl.Text);
         pnlExtract.Visible = true;
         pnlIndex.Visible   = false;
         id.PageParser pp = new id.PageParser(url);
         setUrlLiteral(ltrExtractedUrl, url, pp.GetTitle());
         lblExtract.Text = pp.GetSource();
     }
 }
Exemple #3
0
        private void execSearch()
        {
            float w = 1.0f;

            try { w = Convert.ToSingle(tbxPageRank.Text); }
            catch (Exception) { }

            string url = filterInput(tbxUrl.Text);

            pnlDocs.Visible = true;
            id.PageParser pp = new id.PageParser(url);
            ltrUrl.Text = "<a href='" + url + "' target='_blank'>" + url + "</a> (" + pp.GetTitle() + ")";

            int[]          weights = { 1, 1, 1, 1, 1, 1 }; //text/bold/header/anchor/title/url
            id.QueryVector qv      = pp.GetQuery(weights);

            /*
             * if you ever change this, remember that the parserhelper.getDelims() protects against sql-injection by
             * treating all punctuation as a delimiter. Therefore, any comment syntax will not be included in a term.
             */
            DataSet ds = null;

            if (radIndex.SelectedValue == "0")
            {
                ds = new d.SearchData().GetSimilarityResults(qv.QueryTerms, qv.QueryWeights, w);
            }
            else if (radIndex.SelectedValue == "1")
            {
                ds = new d.SearchData().GetSimilarityResults_w(qv.QueryTerms, qv.QueryWeights, w);
            }
            else if (radIndex.SelectedValue == "2")
            {
                ds = new d.SearchData().GetSimilarityResults_a(qv.QueryTerms, qv.QueryWeights, w);
            }
            else if (radIndex.SelectedValue == "3")
            {
                ds = new d.SearchData().GetSimilarityResults_wa(qv.QueryTerms, qv.QueryWeights, w);
            }

            int results = Convert.ToInt32(ds.Tables[1].Rows[0][0]);

            if (results > 0)
            {
                count = 1;
                dgrDocs.DataSource = ds.Tables[0];
                dgrDocs.DataBind();
                ltrDocCount.Text = results.ToString();
                lblError.Visible = false;
            }
            else
            {
                pnlDocs.Visible  = false;
                lblError.Visible = true;
            }
        }