Beispiel #1
0
        public List <ElasticProjectData> SearchItemsProject(string tstring, Paging paging, DescriptionKind isExtended)
        {
            int from = paging.From;
            int size = paging.Size;
            var sr   = clientProject.Search <ElasticProjectData>(s => s.
                                                                 From(from)
                                                                 .Size(size).
                                                                 Query(q => q
                                                                       .Bool(b => b.
                                                                             Should(m => m.
                                                                                    Match(mp => mp
                                                                                          .Field(fg => fg.Name)
                                                                                          .Query(tstring)
                                                                                          .Fuzziness(Fuzziness.Auto)
                                                                                          ),

                                                                                    m => m.Match(mp => mp
                                                                                                 .Field(fg => fg.InternalDescr)
                                                                                                 .Query(tstring)
                                                                                                 .Fuzziness(Fuzziness.Auto)
                                                                                                 )

                                                                                    ))));
            var returnlist = new List <ElasticProjectData>();

            List <ElasticProjectData> resultList = new List <ElasticProjectData>();
            var temp = new ElasticProjectData();

            returnlist = HitToDataConvertProject(sr, isExtended);
            return(returnlist);
        }
Beispiel #2
0
        public void UpdateProjectData(ElasticProjectData InsertData) //wokrs!
        {
            int InsertId       = InsertData.Id;
            var updateResponse = clientProject.Update <ElasticProjectData, object>(InsertId, u => u.Doc(InsertData).RetryOnConflict(1));

            if (!updateResponse.IsValid && updateResponse.ApiCall.HttpStatusCode == 404)
            {
                //insert document
                var insertResponse = clientProject.IndexDocument(InsertData);
            }
        }
Beispiel #3
0
        public ElasticProjectData(ElasticProjectData data, DescriptionKind isExtended)
        {
            Id            = data.Id;
            Name          = data.Name;
            ExternalDescr = data.ExternalDescr;

            if (isExtended == DescriptionKind.Internal)
            {
                InternalDescr = data.InternalDescr;
            }
            else
            {
                InternalDescr = "Internal description is not available";
            }
        }
Beispiel #4
0
 public void AddItem(ElasticProjectData item) //works
 {
     var resp = clientProject.IndexDocument(item);
 }