Ejemplo n.º 1
0
        public override void SetConfig(Config config)
        {
            m_strategy       = SpatialDocMaker.GetSpatialStrategy(config.RoundNumber);
            m_shapeConverter = SpatialDocMaker.MakeShapeConverter(m_strategy, config, "query.spatial.");

            m_distErrPct = config.Get("query.spatial.distErrPct", double.NaN);
            m_operation  = SpatialOperation.Get(config.Get("query.spatial.predicate", "Intersects"));
            m_score      = config.Get("query.spatial.score", false);

            base.SetConfig(config);//call last, will call prepareQueries()
        }
Ejemplo n.º 2
0
        protected override Query[] PrepareQueries()
        {
            int    maxQueries = m_config.Get("query.file.maxQueries", 1000);
            Config srcConfig  = new Config(new Dictionary <string, string>());

            srcConfig.Set("docs.file", m_config.Get("query.file", null));
            srcConfig.Set("line.parser", m_config.Get("query.file.line.parser", null));
            srcConfig.Set("content.source.forever", "false");

            JCG.List <Query> queries = new JCG.List <Query>();
            LineDocSource    src     = new LineDocSource();

            try
            {
                src.SetConfig(srcConfig);
                src.ResetInputs();
                DocData docData = new DocData();
                for (int i = 0; i < maxQueries; i++)
                {
                    docData = src.GetNextDocData(docData);
                    IShape shape = SpatialDocMaker.MakeShapeFromString(m_strategy, docData.Name, docData.Body);
                    if (shape != null)
                    {
                        shape = m_shapeConverter.Convert(shape);
                        queries.Add(MakeQueryFromShape(shape));
                    }
                    else
                    {
                        i--;//skip
                    }
                }
            }
#pragma warning disable 168
            catch (NoMoreDataException e)
#pragma warning restore 168
            {
                //all-done
            }
            finally
            {
                src.Dispose();
            }
            return(queries.ToArray());
        }