Source Code Cross Referenced for IndexReader.java in  » Search-Engine » mg4j » it » unimi » dsi » mg4j » index » 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 » mg4j » it.unimi.dsi.mg4j.index 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package it.unimi.dsi.mg4j.index;
002:
003:        /*		 
004:         * MG4J: Managing Gigabytes for Java
005:         *
006:         * Copyright (C) 2005-2007 Paolo Boldi and Sebastiano Vigna 
007:         *
008:         *  This library is free software; you can redistribute it and/or modify it
009:         *  under the terms of the GNU Lesser General Public License as published by the Free
010:         *  Software Foundation; either version 2.1 of the License, or (at your option)
011:         *  any later version.
012:         *
013:         *  This library is distributed in the hope that it will be useful, but
014:         *  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
015:         *  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
016:         *  for more details.
017:         *
018:         *  You should have received a copy of the GNU Lesser General Public License
019:         *  along with this program; if not, write to the Free Software
020:         *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
021:         *
022:         */
023:
024:        import it.unimi.dsi.io.SafelyCloseable;
025:        import it.unimi.dsi.util.StringMap;
026:
027:        import java.io.IOException;
028:
029:        /** Provides access to an inverted index.
030:         *
031:         * <P>An {@link it.unimi.dsi.mg4j.index.Index} contains global read-only metadata. To get actual data
032:         * from an index, you need to get an index reader <i>via</i> a call to {@link Index#getReader()}. Once
033:         * you have an index reader, you can ask for the {@linkplain #documents(CharSequence) documents matching a term}.
034:         * 
035:         * <p>Alternatively, you can perform a <em>read-once scan</em> of the index calling {@link #nextIterator()},
036:         * which will return in order the {@linkplain IndexIterator index iterators} of all terms of the underlying index.
037:         * More generally, {@link #nextIterator()} returns an iterator positioned at the start of the inverted
038:         * list of the term after the current one. When called just after the reader creation, it returns an
039:         * index iterator for the first term.
040:         * 
041:         * <p><strong>Warning:</strong> An index reader is exactly what it looks like&mdash;a <em>reader</em>. It
042:         * cannot be used by many threads at the same time, and all its access methods are exclusive: if you
043:         * obtain a {@linkplain #documents(int) document iterator}, the previous one is no longer valid. However,
044:         * you can generate many readers, and use them concurrently.
045:         * 
046:         * <p><strong>Warning:</strong> Invoking the {@link it.unimi.dsi.mg4j.search.DocumentIterator#dispose()} method
047:         * on iterators returned by an instance of this class will invoke {@link #close()} on the instance, thus
048:         * making the instance no longer accessible. This behaviour is necessary to handle cases in which a
049:         * reader is created on-the-fly just to create an iterator.
050:         *
051:         * <P><strong>Warning:<strong> As of MG4J 1.2, direct (i.e., bit-level) access to an inverted index is no longer possible.
052:         *
053:         * @author Paolo Boldi 
054:         * @author Sebastiano Vigna 
055:         * @since 1.0
056:         */
057:
058:        public interface IndexReader extends SafelyCloseable {
059:
060:            /** Returns a document iterator over the documents containing a term.
061:             * 
062:             * <p>Note that the index iterator returned by this method will
063:             * return <code>null</code> on a call to {@link IndexIterator#term() term()}.
064:             * 
065:             * 	<p>Note that it is <em>always</em> possible
066:             * to call this method with argument 0, even if the underlying index
067:             * does not provide random access.
068:             * 
069:             * @param termNumber the number of a term.
070:             * @throws UnsupportedOperationException if this index reader is not accessible by term
071:             * number.
072:             */
073:            public IndexIterator documents(int termNumber) throws IOException;
074:
075:            /** Returns an index iterator over the documents containing a term; the term is
076:             *  given explicitly.
077:             * 
078:             * <p>Unless the {@linkplain Index#termProcessor term processor} of
079:             * the associated index is <code>null</code>, words coming from a query will
080:             * have to be processed before being used with this method.
081:             * 
082:             * <p>Note that the index iterator returned by this method will
083:             * return <code>term</code> on a call to {@link IndexIterator#term() term()}.
084:             *
085:             * @param term a term (the term will be downcased if the index is case insensitive).
086:             * @throws UnsupportedOperationException if the {@linkplain StringMap term map} is not available for the underlying index.
087:             */
088:            public IndexIterator documents(CharSequence term)
089:                    throws IOException;
090:
091:            /** Returns an {@link IndexIterator} on the term after the current one (optional operation).
092:             * 
093:             * <p>Note that after creation there is no current term. Thus, the first call to this
094:             * method will return an {@link IndexIterator} on the first term. As a consequence, repeated
095:             * calls to this method provide a way to scan sequentially an index.
096:             * 
097:             * @return the index iterator of the next term, or <code>null</code> if there are no more terms
098:             * after the current one.
099:             */
100:
101:            public IndexIterator nextIterator() throws IOException;
102:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.