001    package railo.runtime.search;
002    
003    
004    
005    /**
006     * A Single Record of a Search Result
007     */
008    public class SearchResulItemImpl implements SearchResulItem {
009        
010            private String title;
011        private float score;
012        private int recordsSearched;
013        private String id;
014        private String key;
015        private String url;
016        private String summary;
017        private String custom1;
018        private String custom2;
019        private String custom3;
020        private String custom4;
021            private String categoryTree;
022            private String category;
023            private String mimeType;
024            private String author;
025            private String size;
026            private String contextSummary;
027        
028        /**
029         * @param id
030         * @param title
031         * @param score
032         * @param key 
033         * @param url 
034         * @param summary
035         * @param custom1 
036         * @param custom2 
037         * @param custom3 
038         * @param custom4 
039         * @param mimeType 
040         * @param author 
041         * @param size 
042         */
043        public SearchResulItemImpl(String id,String title, float score, String key, String url,String summary,String contextSummary,
044                    String categoryTree,String category,
045                String custom1,String custom2,String custom3,String custom4, String mimeType, String author, String size) {
046            this.id = id;
047            this.title = title;
048            this.score = score;
049            //this.recordsSearched = recordsSearched;
050            this.key = key;
051            this.url = url;
052            this.summary = summary;
053            this.contextSummary = contextSummary;
054    
055            this.categoryTree = categoryTree;
056            this.category = category;
057            this.custom1 = custom1;
058            this.custom2 = custom2;
059            this.custom3 = custom3;
060            this.custom4 = custom4;
061            this.mimeType = mimeType;
062            this.author = author;
063            this.size = size;
064        }
065        @Override
066        public int getRecordsSearched() {
067            return recordsSearched;
068        }
069        @Override
070        public float getScore() {
071            return score;
072        }
073        @Override
074        public String getSummary() {
075            return summary;
076        }
077        @Override
078        public String getTitle() {
079            return title;
080        }
081        @Override
082        public String getId() {
083            return id;
084        }
085        
086        
087        @Override
088        public String getKey() {
089            return key;
090        }
091        
092        @Override
093        public String getUrl() {
094            return url;
095        }
096        @Override
097        public String getCustom1() {
098            return custom1;
099        }
100        @Override
101        public String getCustom2() {
102            return custom2;
103        }
104        @Override
105        public String getCustom3() {
106            return custom3;
107        }
108        @Override
109        public String getCustom4() {
110            return custom4;
111        }
112        
113        public String getCustom(int index) throws SearchException {
114            if(index==1) return custom1;
115            if(index==2) return custom2;
116            if(index==3) return custom3;
117            if(index==4) return custom4;
118            
119            throw new SearchException("invalid index ["+index+"], valid index is [1,2,3,4]");
120        }
121        
122            /**
123             * @return the category
124             */
125            public String getCategory() {
126                    return category;
127            }
128            /**
129             * @return the categoryTree
130             */
131            public String getCategoryTree() {
132                    return categoryTree;
133            }
134            /**
135             * @return the mimeType
136             */
137            public String getMimeType() {
138                    return mimeType;
139            }
140            /**
141             * @return the author
142             */
143            public String getAuthor() {
144                    return author;
145            }
146            /**
147             * @return the size
148             */
149            public String getSize() {
150                    return size;
151            }
152            
153    
154        /**
155             * @return the contextSummary
156             */
157            public String getContextSummary() {
158                    return contextSummary;
159            }
160    }