Esempio n. 1
0
        private void CreateInitialScoreBoostersFile()
        {
            string customBoostersFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MyPhoto", "CustomTermBooster.txt");
            if (!File.Exists(customBoostersFile))
            {
                var initialCustomBoosters = new CustomScoreOptions()
                {
                    Enabled = false,
                    Global = new System.Collections.Generic.List<GlobalTermScoreOptions>()
                    {
                        new GlobalTermScoreOptions()
                        {
                            Boost = 3.0f,
                            Fields = "title_sort",
                            Term = "study set"
                        }
                    },
                    Single = new System.Collections.Generic.List<SingleTermScoreOptions>()
                    {
                        new SingleTermScoreOptions()
                        {
                            Boost = 1.0f,
                            ElanId = "3659",
                            Query = "isaiah"
                        }
                    }
                };

                var initialCustomBoostersJson = JsonConvert.SerializeObject(initialCustomBoosters);
                File.WriteAllText(customBoostersFile, initialCustomBoostersJson);
            }
        }
 public CustomTermScoreProvider(IndexReader reader, CustomScoreOptions options)
     : base(reader)
 {
     this.options = options;
 }