Source Code Cross Referenced for SolrQueryResponse.java in  » Search-Engine » apache-solr-1.2.0 » org » apache » solr » request » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Search Engine » apache solr 1.2.0 » org.apache.solr.request 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */package org.apache.solr.request;
017:
018:        import org.apache.solr.util.NamedList;
019:        import org.apache.solr.util.SimpleOrderedMap;
020:
021:        import java.util.*;
022:
023:        /**
024:         * <code>SolrQueryResponse</code> is used by a query handler to return
025:         * the response to a query request.
026:         *
027:         * <p>
028:         * <a name="returnable_data" /><b>Note On Returnable Data...</b><br/>
029:         * A <code>SolrQueryResponse</code> may contain the following types of
030:         * Objects generated by the <code>SolrRequestHandler</code> that processed
031:         * the request.
032:         * </p>
033:         * <ul>
034:         *  <li>{@link String}</li>
035:         *  <li>{@link Integer}</li>
036:         *  <li>{@link Long}</li>
037:         *  <li>{@link Float}</li>
038:         *  <li>{@link Double}</li>
039:         *  <li>{@link Boolean}</li>
040:         *  <li>{@link Date}</li>
041:         *  <li>{@link org.apache.solr.search.DocList}</li>
042:         *  <li>{@link Map} containing any of the items in this list</li>
043:         *  <li>{@link NamedList} containing any of the items in this list</li>
044:         *  <li>{@link Collection} containing any of the items in this list</li>
045:         *  <li>Array containing any of the items in this list</li>
046:         *  <li>null</li>
047:         * </ul>
048:         *
049:         * @author yonik
050:         * @version $Id: SolrQueryResponse.java 501512 2007-01-30 18:36:32Z yonik $
051:         * @since solr 0.9
052:         */
053:        public class SolrQueryResponse {
054:
055:            /**
056:             * Container for user defined values
057:             * @see #getValues
058:             * @see #add
059:             * @see #setAllValues
060:             * @see <a href="#returnable_data">Note on Returnable Data</a>
061:             */
062:            protected NamedList values = new SimpleOrderedMap();
063:
064:            protected Set<String> defaultReturnFields;
065:
066:            // error if this is set...
067:            protected Exception err;
068:
069:            /***
070:             // another way of returning an error
071:            int errCode;
072:            String errMsg;
073:             ***/
074:
075:            /**
076:             * Gets data to be returned in this response
077:             * @see <a href="#returnable_data">Note on Returnable Data</a>
078:             */
079:            public NamedList getValues() {
080:                return values;
081:            }
082:
083:            /**
084:             * Sets data to be returned in this response
085:             * @see <a href="#returnable_data">Note on Returnable Data</a>
086:             */
087:            public void setAllValues(NamedList nameValuePairs) {
088:                values = nameValuePairs;
089:            }
090:
091:            /**
092:             * Sets the document field names of fields to return by default when
093:             * returning DocLists
094:             */
095:            public void setReturnFields(Set<String> fields) {
096:                defaultReturnFields = fields;
097:            }
098:
099:            // TODO: should this be represented as a String[] such
100:            // that order can be maintained if needed?
101:
102:            /**
103:             * Gets the document field names of fields to return by default when
104:             * returning DocLists
105:             */
106:            public Set<String> getReturnFields() {
107:                return defaultReturnFields;
108:            }
109:
110:            /**
111:             * Appends a named value to the list of named values to be returned.
112:             * @param name  the name of the value - may be null if unnamed
113:             * @param val   the value to add - also may be null since null is a legal value
114:             * @see <a href="#returnable_data">Note on Returnable Data</a>
115:             */
116:            public void add(String name, Object val) {
117:                values.add(name, val);
118:            }
119:
120:            /**
121:             * Causes an error to be returned instead of the results.
122:             */
123:            public void setException(Exception e) {
124:                err = e;
125:            }
126:
127:            /**
128:             * Returns an Exception if there was a fatal error in processing the request.
129:             * Returns null if the request succeeded.
130:             */
131:            public Exception getException() {
132:                return err;
133:            }
134:
135:            /**
136:             * The endtime of the request in milliseconds.
137:             * Used to calculate query time.
138:             * @see #setEndTime(long)
139:             * @see #getEndTime()
140:             */
141:            protected long endtime;
142:
143:            /**
144:             * Get the time in milliseconds when the response officially finished. 
145:             */
146:            public long getEndTime() {
147:                if (endtime == 0) {
148:                    setEndTime();
149:                }
150:                return endtime;
151:            }
152:
153:            /**
154:             * Stop the timer for how long this query took.
155:             * @see #setEndTime(long)
156:             */
157:            public long setEndTime() {
158:                return setEndTime(System.currentTimeMillis());
159:            }
160:
161:            /**
162:             * Set the in milliseconds when the response officially finished. 
163:             * @see #setEndTime()
164:             */
165:            public long setEndTime(long endtime) {
166:                if (endtime != 0) {
167:                    this.endtime = endtime;
168:                }
169:                return this.endtime;
170:            }
171:
172:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.