Esempio n. 1
0
        /// <summary>
        /// Creazione oggetto "FullTextResultInfo" contenente le informazioni
        /// su un file ricercato
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        protected virtual FullTextResultInfo GetFullTextResultInfo(IDataReader reader)
        {
            FullTextResultInfo retValue = new FullTextResultInfo();

            retValue.FileName = reader.GetValue(reader.GetOrdinal("SYSTEM.FILENAME")).ToString();

            if (retValue.FileName != string.Empty)
            {
                int indexOf = retValue.FileName.IndexOf(".");

                if (indexOf > -1)
                {
                    retValue.Name = retValue.FileName.Substring(0, indexOf);
                }
                else
                {
                    retValue.Name = retValue.FileName;
                }
            }

            retValue.Rank             = reader.GetValue(reader.GetOrdinal("SYSTEM.SEARCH.RANK")).ToString();
            retValue.VPath            = reader.GetValue(reader.GetOrdinal("SYSTEM.ITEMPATHDISPLAY")).ToString();
            retValue.DocTitle         = reader.GetValue(reader.GetOrdinal("SYSTEM.TITLE")).ToString();
            retValue.Characterization = "";
            retValue.Write            = reader.GetValue(reader.GetOrdinal("SYSTEM.ITEMDATE")).ToString();

            return(retValue);
        }
Esempio n. 2
0
        public static FullTextResultInfo[] parseXML(string xmlString)
        {
            SolrData sd = new SolrData();

            SolrData.response r        = sd.deserialize(xmlString);
            ArrayList         retValue = new ArrayList();

            if (r.result.docs != null)
            {
                foreach (SolrData.doc ri in r.result.docs)
                {
                    FullTextResultInfo docItem = new FullTextResultInfo();
                    foreach (SolrData.docValue li in ri.str)
                    {
                        if (li.name == "id")
                        {
                            docItem.DocTitle = li.Value;
                            docItem.Name     = li.Value;
                            docItem.FileName = li.Value;
                        }
                    }

                    foreach (SolrData.docValue li in ri.floats)
                    {
                        if (li.name == "score")
                        {
                            docItem.Rank = li.Value;
                        }
                    }
                    retValue.Add(docItem);
                }
            }
            return((FullTextResultInfo[])retValue.ToArray(typeof(FullTextResultInfo)));
        }
Esempio n. 3
0
        /// <summary>
        /// Creazione oggetto "FullTextResultInfo" contenente le informazioni
        /// su un file ricercato
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        protected virtual FullTextResultInfo GetFullTextResultInfo(IDataReader reader)
        {
            FullTextResultInfo retValue = new FullTextResultInfo();

            retValue.FileName = reader.GetValue(reader.GetOrdinal("Filename")).ToString();

            if (retValue.FileName != string.Empty)
            {
                int indexOf = retValue.FileName.IndexOf(".");

                if (indexOf > -1)
                {
                    retValue.Name = retValue.FileName.Substring(0, indexOf);
                }
                else
                {
                    retValue.Name = retValue.FileName;
                }
            }

            retValue.Rank             = reader.GetValue(reader.GetOrdinal("Rank")).ToString();
            retValue.VPath            = reader.GetValue(reader.GetOrdinal("VPath")).ToString();
            retValue.DocTitle         = reader.GetValue(reader.GetOrdinal("DocTitle")).ToString();
            retValue.Characterization = reader.GetValue(reader.GetOrdinal("Characterization")).ToString();
            retValue.Write            = reader.GetValue(reader.GetOrdinal("Write")).ToString();

            return(retValue);
        }
Esempio n. 4
0
        /// <summary>
        /// Ricerca FullText
        /// </summary>
        /// <param name="textQuery">Testo da ricercare</param>
        /// <param name="indexCatalogName">Nome del catalogo utilizzato per la ricerca</param>
        /// <param name="maxRowCount">Numero massimo di righe da estrarre dalla ricerca</param>
        /// <returns></returns>
        public FullTextResultInfo[] Search(string textToSearch, string indexCatalogName, int maxRowCount)
        {
            if (indexCatalogName == null || indexCatalogName == string.Empty)
            {
                indexCatalogName = this.GetConfig(FULLTEXT_INDEX_CATALOG);
            }

            if (maxRowCount <= 0)
            {
                maxRowCount = this.MaxRows;
            }

            FullTextResultInfo[] retValue = null;

            string fullTextWS;

            if (this.IsRemoteFullTextEnabled(out fullTextWS))
            {
                // Ricerca FullText da contesto remoto
                FullTextIndexingWS.FullTextWS ws = new FullTextIndexingWS.FullTextWS();
                ws.Url = fullTextWS;
                FullTextIndexingWS.FullTextResultInfo[] result = ws.Search(textToSearch, indexCatalogName, maxRowCount);

                ArrayList list = new ArrayList();

                foreach (FullTextIndexingWS.FullTextResultInfo item in result)
                {
                    FullTextResultInfo info = new FullTextResultInfo();

                    info.Characterization = item.Characterization;
                    info.DocTitle         = item.DocTitle;
                    info.FileName         = item.FileName;
                    info.Name             = item.Name;
                    info.Rank             = item.Rank;
                    info.VPath            = item.VPath;
                    info.Write            = item.Write;

                    list.Add(info);
                }

                retValue = (FullTextResultInfo[])list.ToArray(typeof(FullTextResultInfo));
            }
            else
            {
                // Ricerca FullText da contesto locale
                string engine = Engine;
                if (engine == "index")
                {
                    IndexServer isvr = new IndexServer();
                    retValue = isvr.FullTextSearch(textToSearch, indexCatalogName, maxRowCount);
                }
                else if (engine == "search")
                {
                    SearchServer isvr = new SearchServer();

                    retValue = isvr.FullTextSearch(textToSearch, indexCatalogName, maxRowCount);
                }
                else if (engine == "solr")
                {
                    SolrServer isrv = new SolrServer();
                    retValue = isrv.FullTextSearch(textToSearch, indexCatalogName, maxRowCount);
                }
            }

            return(retValue);
        }