lucene-c-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roo...@apache.org
Subject svn commit: r179487 - in /incubator/lucene4c/trunk: ./ config/ include/ lib/ src/analysis/ src/cmdline/ src/document/ src/index/ src/org/ src/org/apache/ src/org/apache/lucene4c/ src/query_parser/ src/search/ src/store/ src/util/ test/
Date Thu, 02 Jun 2005 02:08:32 GMT
Author: rooneg
Date: Wed Jun  1 19:08:31 2005
New Revision: 179487

URL: http://svn.apache.org/viewcvs?rev=179487&view=rev
Log:
Merge the gcj-backend branch into the trunk.

For the details on these changes please see revisions 171264 through 179346
of http://svn.apache.org/repos/asf/incubator/lucene4c/branches/gcj-backend

Added:
    incubator/lucene4c/trunk/config/config_nice.m4
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/config/config_nice.m4
    incubator/lucene4c/trunk/include/lcn_analyzer.h
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/include/lcn_analyzer.h
    incubator/lucene4c/trunk/include/lcn_error.h
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/include/lcn_error.h
    incubator/lucene4c/trunk/include/lcn_index_writer.h
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/include/lcn_index_writer.h
    incubator/lucene4c/trunk/include/lcn_init.h
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/include/lcn_init.h
    incubator/lucene4c/trunk/include/lcn_pools.h
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/include/lcn_pools.h
    incubator/lucene4c/trunk/include/lcn_searcher.h
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/include/lcn_searcher.h
    incubator/lucene4c/trunk/lib/   (props changed)
      - copied from r179483, incubator/lucene4c/branches/gcj-backend/lib/
    incubator/lucene4c/trunk/lib/lucene-1.4.3.jar   (props changed)
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/lib/lucene-1.4.3.jar
    incubator/lucene4c/trunk/src/analysis/   (props changed)
      - copied from r179483, incubator/lucene4c/branches/gcj-backend/src/analysis/
    incubator/lucene4c/trunk/src/analysis/analyzer.hxx
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/src/analysis/analyzer.hxx
    incubator/lucene4c/trunk/src/analysis/standard.cxx
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/src/analysis/standard.cxx
    incubator/lucene4c/trunk/src/document/document.cxx
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/src/document/document.cxx
    incubator/lucene4c/trunk/src/document/document.hxx
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/src/document/document.hxx
    incubator/lucene4c/trunk/src/document/field.cxx
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/src/document/field.cxx
    incubator/lucene4c/trunk/src/document/field.hxx
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/src/document/field.hxx
    incubator/lucene4c/trunk/src/index/writer.cxx
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/src/index/writer.cxx
    incubator/lucene4c/trunk/src/org/
      - copied from r179483, incubator/lucene4c/branches/gcj-backend/src/org/
    incubator/lucene4c/trunk/src/org/apache/
      - copied from r179483, incubator/lucene4c/branches/gcj-backend/src/org/apache/
    incubator/lucene4c/trunk/src/org/apache/lucene4c/   (props changed)
      - copied from r179483, incubator/lucene4c/branches/gcj-backend/src/org/apache/lucene4c/
    incubator/lucene4c/trunk/src/org/apache/lucene4c/IndexSearcherHack.java
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/src/org/apache/lucene4c/IndexSearcherHack.java
    incubator/lucene4c/trunk/src/org/apache/lucene4c/QueryParserHack.java
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/src/org/apache/lucene4c/QueryParserHack.java
    incubator/lucene4c/trunk/src/query_parser/query_parser.cxx
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/src/query_parser/query_parser.cxx
    incubator/lucene4c/trunk/src/search/index_searcher.cxx
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/src/search/index_searcher.cxx
    incubator/lucene4c/trunk/src/search/query.hxx
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/src/search/query.hxx
    incubator/lucene4c/trunk/src/search/searcher.cxx
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/src/search/searcher.cxx
    incubator/lucene4c/trunk/src/search/searcher.hxx
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/src/search/searcher.hxx
    incubator/lucene4c/trunk/src/util/exception.cxx
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/src/util/exception.cxx
    incubator/lucene4c/trunk/src/util/exception.h
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/src/util/exception.h
    incubator/lucene4c/trunk/src/util/init.cxx
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/src/util/init.cxx
    incubator/lucene4c/trunk/test/main.c
      - copied unchanged from r179483, incubator/lucene4c/branches/gcj-backend/test/main.c
Removed:
    incubator/lucene4c/trunk/include/lcn_api.h
    incubator/lucene4c/trunk/include/lcn_directory.h
    incubator/lucene4c/trunk/include/lcn_fielddata.h
    incubator/lucene4c/trunk/include/lcn_fieldinfos.h
    incubator/lucene4c/trunk/include/lcn_frequencies.h
    incubator/lucene4c/trunk/include/lcn_index.h
    incubator/lucene4c/trunk/include/lcn_istream.h
    incubator/lucene4c/trunk/include/lcn_scorer.h
    incubator/lucene4c/trunk/include/lcn_segment.h
    incubator/lucene4c/trunk/include/lcn_segments.h
    incubator/lucene4c/trunk/include/lcn_term.h
    incubator/lucene4c/trunk/include/lcn_terminfos.h
    incubator/lucene4c/trunk/src/document/document.c
    incubator/lucene4c/trunk/src/document/field.c
    incubator/lucene4c/trunk/src/index/fielddata.c
    incubator/lucene4c/trunk/src/index/fieldinfos.c
    incubator/lucene4c/trunk/src/index/frequencies.c
    incubator/lucene4c/trunk/src/index/index.c
    incubator/lucene4c/trunk/src/index/segment.c
    incubator/lucene4c/trunk/src/index/segments.c
    incubator/lucene4c/trunk/src/index/term.c
    incubator/lucene4c/trunk/src/index/terminfos.c
    incubator/lucene4c/trunk/src/query_parser/parser.c
    incubator/lucene4c/trunk/src/search/query.c
    incubator/lucene4c/trunk/src/search/scorer.c
    incubator/lucene4c/trunk/src/store/
    incubator/lucene4c/trunk/src/util/string.c
Modified:
    incubator/lucene4c/trunk/   (props changed)
    incubator/lucene4c/trunk/Makefile.am
    incubator/lucene4c/trunk/configure.in
    incubator/lucene4c/trunk/include/   (props changed)
    incubator/lucene4c/trunk/include/lcn_document.h
    incubator/lucene4c/trunk/include/lcn_field.h
    incubator/lucene4c/trunk/include/lcn_query.h
    incubator/lucene4c/trunk/include/lcn_query_parser.h
    incubator/lucene4c/trunk/include/lcn_types.h
    incubator/lucene4c/trunk/src/cmdline/main.c
    incubator/lucene4c/trunk/src/document/   (props changed)
    incubator/lucene4c/trunk/src/index/   (props changed)
    incubator/lucene4c/trunk/src/query_parser/   (props changed)
    incubator/lucene4c/trunk/src/search/   (props changed)
    incubator/lucene4c/trunk/src/util/   (props changed)
    incubator/lucene4c/trunk/src/util/error.c
    incubator/lucene4c/trunk/test/   (props changed)

Propchange: incubator/lucene4c/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Jun  1 19:08:31 2005
@@ -1,3 +1,4 @@
+config.nice
 .gdb_history
 Makefile.in
 Makefile

Modified: incubator/lucene4c/trunk/Makefile.am
URL: http://svn.apache.org/viewcvs/incubator/lucene4c/trunk/Makefile.am?rev=179487&r1=179486&r2=179487&view=diff
==============================================================================
--- incubator/lucene4c/trunk/Makefile.am (original)
+++ incubator/lucene4c/trunk/Makefile.am Wed Jun  1 19:08:31 2005
@@ -1,6 +1,5 @@
-AUTOMAKE_OPTIONS = subdir-objects
 
-EXTRA_DIST = bootstrap
+AUTOMAKE_OPTIONS = subdir-objects dist-bzip2
 
 MAINTAINERCLEANFILES = Makefile.in \
                        aclocal.m4 \
@@ -15,77 +14,119 @@
 
 lib_LTLIBRARIES = liblucene4c.la
 
-liblucene4c_la_SOURCES = src/util/error.c \
-                         src/util/string.c \
+liblucene4c_la_LDFLAGS = -version-info 0:1:0 
+liblucene4c_la_LIBADD = $(top_srcdir)/lib/lucene-1.4.3.jar 
+
+
+LIBHEADERS = src/search/searcher.hxx \
+                         src/search/query.hxx \
+                         src/document/field.hxx \
+                         src/document/document.hxx \
+                         src/analysis/analyzer.hxx \
+                         src/util/exception.h
+
+liblucene4c_la_SOURCES = src/util/exception.cxx \
+                         src/util/error.c \
+                         src/util/init.cxx \
                          src/util/pools.c \
-                         src/store/istream.c \
-                         src/store/directory.c \
-                         src/search/query.c \
-                         src/search/scorer.c \
-                         src/query_parser/parser.c \
-                         src/index/index.c \
-                         src/index/segments.c \
-                         src/index/segment.c \
-                         src/index/term.c \
-                         src/index/terminfos.c \
-                         src/index/frequencies.c \
-                         src/index/fielddata.c \
-                         src/index/fieldinfos.c \
-                         src/document/document.c \
-                         src/document/field.c
+                         src/index/writer.cxx \
+                         src/search/searcher.cxx \
+                         src/search/index_searcher.cxx \
+                         src/query_parser/query_parser.cxx \
+                         src/document/field.cxx \
+                         src/document/document.cxx \
+                         src/analysis/standard.cxx \
+                         src/org/apache/lucene4c/QueryParserHack.java \
+                         src/org/apache/lucene4c/IndexSearcherHack.java
+
+BUILT_SOURCES = include/org/apache/lucene/analysis/Analyzer.h \
+                include/org/apache/lucene4c/QueryParserHack.h \
+                include/org/apache/lucene4c/IndexSearcherHack.h
+
+%.class: %.java
+	javac -classpath $(top_srcdir)/lib/lucene-1.4.3.jar -d src $<
+
+include/org/apache/lucene/analysis/Analyzer.h: build-headers 
+
+include/org/apache/lucene4c/QueryParserHack.h: src/org/apache/lucene4c/QueryParserHack.class
+	$(JCCH) --classpath lib/lucene-1.4.3.jar:src org.apache.lucene4c.QueryParserHack -d include
+
+include/org/apache/lucene4c/IndexSearcherHack.h: src/org/apache/lucene4c/IndexSearcherHack.class
+	$(JCCH) --classpath lib/lucene-1.4.3.jar:src org.apache.lucene4c.IndexSearcherHack -d include
+
 
-noinst_PROGRAMS = test/tests
+noinst_PROGRAMS = test/test
 
 bin_PROGRAMS = src/cmdline/lcn
 
-test_tests_SOURCES = test/abts.c \
-                     test/lcn_tests.c \
-                     test/util/string_test.c \
-                     test/index/fieldinfos_test.c \
-                     test/index/fielddata_test.c \
-                     test/index/index_test.c \
-                     test/index/segments_test.c \
-                     test/index/segment_test.c \
-                     test/index/terminfos_test.c \
-                     test/index/frequencies_test.c \
-                     test/store/istream_test.c \
-                     test/search/scorer_test.c \
-                     test/query_parser/parser_test.c \
-                     test/store/directory_test.c
+test_test_SOURCES = test/main.c
+test_test_LDADD = liblucene4c.la
 
 src_cmdline_lcn_SOURCES = src/cmdline/main.c
-
 src_cmdline_lcn_LDADD= liblucene4c.la
 
-test_tests_LDADD = liblucene4c.la
-
 inst_includesdir = $(includedir)/lucene4c-0
 
-inst_includes_HEADERS = include/lcn_api.h \
-                        include/lcn_directory.h \
+inst_includes_HEADERS = include/lcn_analyzer.h \
                         include/lcn_document.h \
+                        include/lcn_error.h \
                         include/lcn_field.h \
-                        include/lcn_fielddata.h \
-                        include/lcn_fieldinfos.h \
-                        include/lcn_frequencies.h \
-                        include/lcn_index.h \
-                        include/lcn_istream.h \
+                        include/lcn_index_writer.h \
+                        include/lcn_init.h \
+                        include/lcn_pools.h \
                         include/lcn_query.h \
                         include/lcn_query_parser.h \
-                        include/lcn_scorer.h \
-                        include/lcn_segment.h \
-                        include/lcn_segments.h \
-                        include/lcn_terminfos.h \
-                        include/lcn_term.h \
+                        include/lcn_searcher.h \
                         include/lcn_types.h
 
-INCLUDES = -Iinclude -Itest $(LCN_APR_INCLUDES)
-
-LIBS = $(LCN_APR_LIBS) -lm
-
-check:
-	@./test/tests
+INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/test \
+           -I$(top_builddir)/include \
+           $(LCN_APR_INCLUDES)
+
+LIBS = $(LCN_LIBS)
+
+lib/lucene.o: lib/lucene-1.4.3.jar
+	$(GCJ) -c -o $@ $(top_srcdir)/lib/lucene-1.4.3.jar
+
+test:
+	@./test/test
+
+localclean:
+	$(RM) -f build-headers
+	${RM} -rf include/org
+	${RM} -rf src/org/apache/lucene/
+	${RM} -rf org
+clean: localclean clean-am
+distclean: localclean distclean-am
+
+lib/lucene-1.4.3.jar:
+	touch $@
+
+build-headers: lib/lucene-1.4.3.jar
+	$(JAR) xvf $(top_srcdir)/lib/lucene-1.4.3.jar
+	$(RM) -rf META-INF
+	$(MKDIR) -p src/org/apache/lucene4c
+	$(MKDIR) -p include/org/apache/lucene4c
+	$(FIND) org -type d | \
+        $(SED) 's|org/|include/org/|' | \
+        $(XARGS) mkdir -p
+	-$(FIND) org -name \*.class | \
+        $(SED) 's|\.class||' | \
+        $(SED) 's|/|.|g' | \
+        $(XARGS) $(JCCH) -d include --classpath=$(top_srcdir)/lib/lucene-1.4.3.jar
+	touch $@
 
 doxygen:
-	@doxygen doc/doxygen.conf
+	@mkdir -p www/apidocs
+	@doxygen $(top_srcdir)/doc/doxygen.conf
 	@cp -r doc/doxygen/html/* www/apidocs/
+
+
+EXTRA_DIST = bootstrap \
+             config/config_nice.m4 \
+             config/find_apr.m4 \
+             lib/lucene-1.4.3.jar \
+             doc/doxygen.conf \
+             $(LIBHEADERS) 
+
+.PHONY = doxygen

Modified: incubator/lucene4c/trunk/configure.in
URL: http://svn.apache.org/viewcvs/incubator/lucene4c/trunk/configure.in?rev=179487&r1=179486&r2=179487&view=diff
==============================================================================
--- incubator/lucene4c/trunk/configure.in (original)
+++ incubator/lucene4c/trunk/configure.in Wed Jun  1 19:08:31 2005
@@ -1,11 +1,24 @@
 AC_INIT(lucene4c, 0.04)
-AC_CONFIG_SRCDIR([src/store/istream.c])
+MAKE_CONFIG_NICE([config.nice])
+AC_CONFIG_SRCDIR([src/document/document.cxx])
 AC_CONFIG_AUX_DIR(config)
 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
 
 AC_PROG_CC
 AM_PROG_CC_C_O
+AC_PROG_CXX
+AM_PROG_GCJ
 
+AC_CHECK_PROGS(JCCH, gcjh)
+AC_CHECK_PROGS(JAR, fastjar)
+
+AC_CHECK_PROGS(MKDIR, mkdir)
+AC_CHECK_PROGS(FIND, find)
+AC_CHECK_PROGS(SED, sed)
+AC_CHECK_PROGS(XARGS, xargs)
+AC_CHECK_PROGS(RM, rm)
+
+AC_CHECK_LIB([gcj], [JNI_CreateJavaVM])
 AC_MSG_NOTICE([Apache Portable Runtime (APR) library configuration])
 
 APR_FIND_APR("", "", 1, 1 0)
@@ -19,7 +32,9 @@
 CFLAGS="$CFLAGS `$apr_config --cflags`"
 LDFLAGS="$LDLAGS `$apr_config --ldflags`"
 
-LCN_APR_LIBS="$LIBS `$apr_config --link-ld --libs`"
+GCJ_RPATH=`echo ${GCJ} | ${SED} 's|bin/.*|lib|'`
+
+LCN_LIBS="-R${GCJ_RPATH} $LIBS `$apr_config --link-libtool --libs`"
 LCN_APR_INCLUDES="`$apr_config --includes`"
 
 LIBTOOL="`$apr_config --apr-libtool`"
@@ -49,6 +64,5 @@
 
 AC_SUBST(ac_aux_dir)
 AC_SUBST(LCN_APR_INCLUDES)
-AC_SUBST(LCN_APR_LIBS)
-
+AC_SUBST(LCN_LIBS)
 AC_OUTPUT([Makefile])

Propchange: incubator/lucene4c/trunk/include/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jun  1 19:08:31 2005
@@ -0,0 +1 @@
+org

Modified: incubator/lucene4c/trunk/include/lcn_document.h
URL: http://svn.apache.org/viewcvs/incubator/lucene4c/trunk/include/lcn_document.h?rev=179487&r1=179486&r2=179487&view=diff
==============================================================================
--- incubator/lucene4c/trunk/include/lcn_document.h (original)
+++ incubator/lucene4c/trunk/include/lcn_document.h Wed Jun  1 19:08:31 2005
@@ -22,7 +22,6 @@
 #ifndef _LCN_DOCUMENT_H
 #define _LCN_DOCUMENT_H
 
-#include "lcn_types.h"
 #include "lcn_field.h"
 
 #ifdef __cplusplus
@@ -32,25 +31,19 @@
 /** Opaque structure representing a document in the index. */
 typedef struct lcn_document_t lcn_document_t;
 
-/** Create an empty document, allocated from @a pool. */
-lcn_document_t *
-lcn_document_create (apr_pool_t *pool);
-
-/** Return the number of fields in document @a doc. */
-apr_uint32_t lcn_document_numfields (lcn_document_t *doc);
+/** Return an empty document in @a document, allocated from @a pool. */
+lcn_error_t *
+lcn_document_create (lcn_document_t **document, apr_pool_t *pool);
 
 /** Add @a field to @a doc. */
-void lcn_document_add_field (lcn_document_t *doc, lcn_field_t *field);
-
-/** Return field number @a num from @a doc, or @c NULL if it does not exist. */
-const lcn_field_t *
-lcn_document_field_by_num (const lcn_document_t *doc,
-                           apr_uint32_t num);
+lcn_error_t *
+lcn_document_add_field (lcn_document_t *doc, lcn_field_t *field);
 
-/** Return field @a name from @a doc, or @c NULL if it does not exist. */
-const lcn_field_t *
-lcn_document_field_by_name (const lcn_document_t *doc,
-                            const lcn_char_t *name);
+lcn_error_t *
+lcn_document_get_field_by_name (lcn_field_t **field,
+                                lcn_document_t *doc,
+                                const char *fieldname,
+                                apr_pool_t *pool);
 
 #ifdef __cplusplus
 }

Modified: incubator/lucene4c/trunk/include/lcn_field.h
URL: http://svn.apache.org/viewcvs/incubator/lucene4c/trunk/include/lcn_field.h?rev=179487&r1=179486&r2=179487&view=diff
==============================================================================
--- incubator/lucene4c/trunk/include/lcn_field.h (original)
+++ incubator/lucene4c/trunk/include/lcn_field.h Wed Jun  1 19:08:31 2005
@@ -22,7 +22,7 @@
 #ifndef _LCN_FIELD_H
 #define _LCN_FIELD_H
 
-#include "lcn_types.h"
+#include "lcn_error.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -31,61 +31,20 @@
 /** Opaque structure representing a field in a document. */
 typedef struct lcn_field_t lcn_field_t;
 
-/** Indicates if a field is stored in the index or not. */
-typedef enum {
-  LCN_STORED_NO,       /**< Field is not stored */
-  LCN_STORED_YES,      /**< Field is stored */
-  LCN_STORED_COMPRESS  /**< Field is stored in compressed form */
-} lcn_field_stored_t;
-
-/** Indicates if a field is indexed or not. */
-typedef enum {
-  LCN_INDEXED_NO,          /**< Field is not indexed */
-  LCN_INDEXED_TOKENIZED,   /**< Field is indexed in tokenized form */
-  LCN_INDEXED_UNTOKENIZED  /**< Field is indexed without being tokenized */
-} lcn_field_indexed_t;
-
-/** Indicates if a field is stored in the index's termvector. */
-typedef enum {
-  /** Field is not stored in the termvector */
-  LCN_TERMVECTOR_NO,
-
-  /** Field is stored in the termvector */
-  LCN_TERMVECTOR_YES,
-
-  /** Field is stored in the termvector along with its positions */
-  LCN_TERMVECTOR_WITH_POSITIONS,
-
-  /** Field is stored in the termvector along with its offsets */
-  LCN_TERMVECTOR_WITH_OFFSETS,
-
-  /** Field is stored in the termvector along with its positions and offsets */
-  LCN_TERMVECTOR_WITH_POSITIONS_OFFSETS
-} lcn_field_termvector_t;
-
-/** Create new field.
- *
- * The field will have the name @a name, the value @a value, and its status
- * with regard to storage, indexing, and termvector are determined by the
- * @a stored, @a indexed, and @a termvector arguments.
- *
- * All allocation is done with @a pool.
- */
-lcn_field_t *
-lcn_field_create (const lcn_char_t *name,
-                  const lcn_char_t *value,
-                  lcn_field_stored_t stored,
-                  lcn_field_indexed_t indexed,
-                  lcn_field_termvector_t termvector,
-                  apr_pool_t *pool);
-
-/** Return the name of field @a f. */
-const lcn_char_t *
-lcn_field_name (const lcn_field_t *f);
-
-/** Return the content of field @a f. */
-const lcn_char_t *
-lcn_field_content (const lcn_field_t *f);
+/** Create a text field. */
+lcn_error_t *
+lcn_field_text (lcn_field_t **f,
+                const char *name,
+                const char *value,
+                apr_pool_t *pool);
+
+/** Return the name of field @a f in @a name, allocated in @a pool. */
+lcn_error_t *
+lcn_field_name (char **name, const lcn_field_t *f, apr_pool_t *pool);
+
+/** Return the content of field @a f in @a content, allocated in @a pool. */
+lcn_error_t *
+lcn_field_content (char **content, const lcn_field_t *f, apr_pool_t *pool);
 
 #ifdef __cplusplus
 }

Modified: incubator/lucene4c/trunk/include/lcn_query.h
URL: http://svn.apache.org/viewcvs/incubator/lucene4c/trunk/include/lcn_query.h?rev=179487&r1=179486&r2=179487&view=diff
==============================================================================
--- incubator/lucene4c/trunk/include/lcn_query.h (original)
+++ incubator/lucene4c/trunk/include/lcn_query.h Wed Jun  1 19:08:31 2005
@@ -22,9 +22,7 @@
 #ifndef _LCN_QUERY_H
 #define _LCN_QUERY_H
 
-#include "lcn_types.h"
-#include "lcn_scorer.h"
-#include "lcn_term.h"
+#include "lcn_error.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -33,69 +31,10 @@
 /** Abstract query object. */
 typedef struct lcn_query_t lcn_query_t;
 
-/** Create a @a query that matches @a term, allocated in @a pool. */
-lcn_error_t *
-lcn_term_query_create (lcn_query_t **query,
-                       lcn_term_t *term,
-                       apr_pool_t *pool);
-
-/** Create a @a query that matches a number of other queries, each of which
- * either MUST occur, SHOULD occur, or MUST NOT occur in the documents matched,
- * the query is allocated in @a pool.
- */
-lcn_error_t *
-lcn_boolean_query_create (lcn_query_t **query, apr_pool_t *pool);
-
-/** An indication of what requirement is placed on a particular part of a
- * boolean query.
- */
-typedef enum {
-  LCN_MUST,    /**< The query must match */
-  LCN_SHOULD,  /**< At least one of the queries with this occur must match */
-  LCN_MUST_NOT /**< The query must not match */
-} lcn_boolean_clause_occur_t;
-
-/** Add @a clause to @a query, with @a occur as the specification for whether
- * it is required or not.
- *
- * @note all clauses that are added to @a query must be allocated from a pool
- * that lives at least as long as the pool used to allocate @a query, or the
- * behavior is undefined.
- */
-lcn_error_t *
-lcn_boolean_query_add (lcn_query_t *query,
-                       lcn_query_t *clause,
-                       lcn_boolean_clause_occur_t occur);
-
-/** Return @a weight's underlying query. */
-lcn_query_t * lcn_weight_query (lcn_weight_t *weight);
-
-/** Return the value of @a weight. */
-float lcn_weight_value (lcn_weight_t *weight);
-
-/** Return the sum of the squared weight sof contained query clauses. */
-lcn_error_t *
-lcn_weight_sum_of_squared_weights (float *sum, lcn_weight_t *weight);
-
-/** Assign a query normalization factor @a norm to this @a weight. */
-lcn_error_t * lcn_weight_normalize (lcn_weight_t *weight, float norm);
-
-/* XXX leaving out lcn_weight_explain for now... */
-
-/** Create an @a weight from @a query, to be run over @a index and allocated
- * from @a pool.
- */
-lcn_error_t *
-lcn_query_weight (lcn_weight_t **weight,
-                  lcn_query_t *query,
-                  lcn_index_t *index,
-                  apr_pool_t *pool);
-
-/** Return a @a scorer for @a weight, allocated in @a pool. */
-lcn_error_t *
-lcn_weight_scorer (lcn_scorer_t **scorer,
-                   lcn_weight_t *weight,
-                   apr_pool_t *pool);
+lcn_error_t
+lcn_query_to_string(char **str,
+                    lcn_query_t *query,
+                    apr_pool_t *pool);
 
 #ifdef __cplusplus
 }

Modified: incubator/lucene4c/trunk/include/lcn_query_parser.h
URL: http://svn.apache.org/viewcvs/incubator/lucene4c/trunk/include/lcn_query_parser.h?rev=179487&r1=179486&r2=179487&view=diff
==============================================================================
--- incubator/lucene4c/trunk/include/lcn_query_parser.h (original)
+++ incubator/lucene4c/trunk/include/lcn_query_parser.h Wed Jun  1 19:08:31 2005
@@ -22,8 +22,10 @@
 #ifndef _LCN_QUERY_PARSER_H
 #define _LCN_QUERY_PARSER_H
 
-#include "lcn_types.h"
+#include "lcn_pools.h"
+#include "lcn_error.h"
 #include "lcn_query.h"
+#include "lcn_analyzer.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -32,20 +34,18 @@
 /** A query parser. */
 typedef struct lcn_query_parser_t lcn_query_parser_t;
 
-/** Create a query parser @a parser, which uses @a default_field and
- * @a default_occur and is allocated from @a pool. */
+/** Create @a query from @a input, with default field @a field, analyzed
+ * with @a analyzer, allocated in @a pool.
+ *
+ * @note this creates an @c lcn_query_parser_t object under the hood.  If
+ * you want to avoid the overhead of recreating the parser for each parse
+ * use @c lcn_query_parser_create and @c lcn_query_parser_parse. */
 lcn_error_t *
-lcn_query_parser_create (lcn_query_parser_t **parser,
-                         lcn_char_t *default_field,
-                         lcn_boolean_clause_occur_t default_occur,
-                         apr_pool_t *pool);
-
-/** Use @a parser to create @a query from @a input, allocated in @a pool. */
-lcn_error_t *
-lcn_query_parser_parse (lcn_query_t **query,
-                        lcn_query_parser_t *parser,
-                        lcn_char_t *input,
-                        apr_pool_t *pool);
+lcn_query_parse (lcn_query_t **query,
+                 const char *input,
+                 const char *field,
+                 lcn_analyzer_t *analyzer,
+                 apr_pool_t *pool);
 
 #ifdef __cplusplus
 }

Modified: incubator/lucene4c/trunk/include/lcn_types.h
URL: http://svn.apache.org/viewcvs/incubator/lucene4c/trunk/include/lcn_types.h?rev=179487&r1=179486&r2=179487&view=diff
==============================================================================
--- incubator/lucene4c/trunk/include/lcn_types.h (original)
+++ incubator/lucene4c/trunk/include/lcn_types.h Wed Jun  1 19:08:31 2005
@@ -23,7 +23,6 @@
 #define _LCN_TYPES_H
 
 #include <apr.h>
-#include <apr_pools.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -42,44 +41,6 @@
 #define TRUE 1
 #endif
 
-/** Our exception object. */
-typedef struct lcn_error_t {
-  apr_status_t apr_err;      /**< The underlying APR error */
-
-  const char *message;       /**< Human readable error message */
-
-  struct lcn_error_t *child; /**< The next error in the chain, or @c NULL */
-
-  apr_pool_t *pool;          /**< The pool this error was allocated in */
-
-} lcn_error_t;
-
-/** The best kind of error. */
-#define LCN_NO_ERROR 0
-
-/** Create a new error with underlying error code @a apr_err, wrapping around
- * @a child, with error message @a message.
- */
-lcn_error_t *
-lcn_error_create (apr_status_t apr_err,
-                  lcn_error_t *child,
-                  const char *message);
-
-/** A @c printf style version of @c lcn_error_create. */
-lcn_error_t *
-lcn_error_createf (apr_status_t apr_err,
-                   lcn_error_t *child,
-                   const char *fmt,
-                   ...)
-#ifdef DOXYGEN_SHOULD_SKIP_THIS
-                   ;
-#else
-                   __attribute__ ((format (printf, 3, 4)));
-#endif
-
-/** Destroy @a error. */
-void lcn_error_clear (lcn_error_t *error);
-
 /** A handy wrapper for functions that return an @c lcn_error_t, just returns
  * the error to our caller if it's not @c LCN_NO_ERROR.
  */
@@ -90,47 +51,11 @@
       return lcn_err__temp;              \
     } while (0)
 
-/** A java style 16 bit char. */
-typedef apr_uint16_t lcn_char_t;
-
-/** Count the number of characters in a string of lcn_char_t's */
-apr_size_t lcn_strlen (const lcn_char_t *str);
-
-/** Get the size of a string of lcn_char_t's in bytes */
-#define LCN_STRING_SIZE(str) ((lcn_strlen (str) + 1) * sizeof (lcn_char_t))
-
-/** Lexographically compare @a first and @a second. */
-int lcn_strcmp (const lcn_char_t *first, const lcn_char_t *second);
-
-/** Return a copy of @a str, allocated in @a pool. */
-lcn_char_t *
-lcn_strcpy (const lcn_char_t *str, apr_pool_t *pool);
-
-/** Convert @a in into a cstring @a out, allocated in @a pool.
- *
- * This will result in an error if @a in cannot be represented in ASCII
- * characters.
- */
-lcn_error_t *
-lcn_str_to_cstring (char **out, const lcn_char_t *in, apr_pool_t *pool);
-
-/** Create a string of @c lcn_char_ts that corresponds to the contents of 
- * @a in, allocated in @a pool.
- */
-lcn_char_t *
-lcn_str_from_cstring (const char *in, apr_pool_t *pool);
-
 /** Index into an apr_array_header_t */
 #define APR_ARRAY_IDX(ary,i,type) (((type *)(ary)->elts)[i])
 
 /** Easier array-pushing syntax */
 #define APR_ARRAY_PUSH(ary,type) (*((type *)apr_array_push (ary)))
-
-/** A convenience wrapper for @c apr_pool_create. */
-apr_pool_t *lcn_pool_create (apr_pool_t *parent);
-
-/** For symmetry with @c lcn_pool_create. */
-#define lcn_pool_destroy apr_pool_destroy
 
 #ifdef __cplusplus
 }

Propchange: incubator/lucene4c/trunk/lib/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jun  1 19:08:31 2005
@@ -0,0 +1 @@
+liblucene4c.so

Copied: incubator/lucene4c/trunk/lib/lucene-1.4.3.jar (from r179483, incubator/lucene4c/branches/gcj-backend/lib/lucene-1.4.3.jar)
URL: http://svn.apache.org/viewcvs/incubator/lucene4c/trunk/lib/lucene-1.4.3.jar?p2=incubator/lucene4c/trunk/lib/lucene-1.4.3.jar&p1=incubator/lucene4c/branches/gcj-backend/lib/lucene-1.4.3.jar&r1=179483&r2=179487&rev=179487&view=diff
==============================================================================
Binary files - no diff available.

Propchange: incubator/lucene4c/trunk/lib/lucene-1.4.3.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Propchange: incubator/lucene4c/trunk/src/analysis/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jun  1 19:08:31 2005
@@ -0,0 +1,3 @@
+.dirstamp
+.deps
+*.loT

Modified: incubator/lucene4c/trunk/src/cmdline/main.c
URL: http://svn.apache.org/viewcvs/incubator/lucene4c/trunk/src/cmdline/main.c?rev=179487&r1=179486&r2=179487&view=diff
==============================================================================
--- incubator/lucene4c/trunk/src/cmdline/main.c (original)
+++ incubator/lucene4c/trunk/src/cmdline/main.c Wed Jun  1 19:08:31 2005
@@ -15,19 +15,22 @@
  */
 
 #include <stdlib.h>
+#include <stdio.h>
 
 #include <apr.h>
 
-#include "lcn_index.h"
+#include "lcn_init.h"
 #include "lcn_types.h"
-#include "lcn_segments.h"
+#include "lcn_pools.h"
 #include "lcn_query_parser.h"
+#include "lcn_searcher.h"
+#include "lcn_document.h"
 
 typedef lcn_error_t *(lcn_subcommand_t) (int argc,
                                          char *argv[],
                                          apr_pool_t *pool);
 
-lcn_subcommand_t lcn_segments_cmd, lcn_termdocs_cmd, lcn_search_cmd;
+lcn_subcommand_t lcn_search_cmd;
 
 typedef struct {
   const char *name;
@@ -35,134 +38,28 @@
 } subcommand_desc_t;
 
 subcommand_desc_t dispatch_table[] = {
-  { "segments", lcn_segments_cmd },
-  { "termdocs", lcn_termdocs_cmd },
   { "search", lcn_search_cmd },
   { NULL }
 };
 
-lcn_error_t *
-lcn_segments_cmd (int argc, char *argv[], apr_pool_t *pool)
-{
-  if (argc != 1)
-    {
-      printf ("usage: lcn segments <index>\n");
-      return lcn_error_create (APR_EGENERAL, NULL, "missing argument");
-    }
-  else
-    {
-      apr_array_header_t *names;
-      lcn_segments_t *segs;
-      lcn_directory_t *d;
-      int i;
-
-      LCN_ERR (lcn_fs_directory_open (&d, argv[0], pool));
-
-      LCN_ERR (lcn_segments_read (&segs, d, pool));
-
-      names = lcn_segments_names (segs, pool);
-
-      for (i = 0; i < names->nelts; ++i)
-        {
-          lcn_char_t *name = APR_ARRAY_IDX (names, i, lcn_char_t *);
-          char *pname;
-
-          LCN_ERR (lcn_str_to_cstring (&pname, name, pool));
-
-          printf ("%s\n", pname);
-        }
-
-      return LCN_NO_ERROR;
-    }
-}
-
 static lcn_error_t *
-print_doc_field (lcn_index_t *idx,
-                 apr_uint32_t doc_num,
-                 lcn_char_t *pfield,
+print_doc_field (lcn_document_t *doc,
+                 const char *fieldname,
                  apr_pool_t *pool)
 {
-  const lcn_field_t *field;
-  lcn_document_t *doc;
-  char *cstr;
-
-  LCN_ERR (lcn_index_get_document (&doc, idx, doc_num, pool));
+  lcn_field_t *field;
+  char *content;
 
-  field = lcn_document_field_by_name (doc, pfield);
-  if (field)
-    {
-      const lcn_char_t *cont;
-
-      cont = lcn_field_content (field);
+  LCN_ERR (lcn_document_get_field_by_name (&field, doc, fieldname, pool));
 
-      LCN_ERR (lcn_str_to_cstring (&cstr, cont, pool));
-
-      printf ("%s\n", cstr);
-    }
-  else
-    {
-      LCN_ERR (lcn_str_to_cstring (&cstr, pfield, pool));
+  LCN_ERR (lcn_field_content (&content, field, pool));
 
-      return lcn_error_createf (APR_EINVAL,
-                                NULL,
-                                "field '%s' does not exist",
-                                cstr);
-    }
+  printf ("%s\n", content);
 
   return LCN_NO_ERROR;
 }
 
 lcn_error_t *
-lcn_termdocs_cmd (int argc, char *argv[], apr_pool_t *pool)
-{
-  if (argc != 4)
-    {
-      printf ("usage: lcn termdocs <index> <term> <field> <pfield>\n");
-      return LCN_NO_ERROR;
-    }
-  else
-    {
-      lcn_doc_iter_t *itr;
-      apr_pool_t *subpool;
-      lcn_boolean_t next;
-      lcn_char_t *pfield;
-      lcn_error_t *err;
-      lcn_index_t *idx;
-      lcn_term_t t;
-
-      LCN_ERR (lcn_index_open (&idx, argv[0], pool));
-
-      t.contents = lcn_str_from_cstring (argv[1], pool);
-
-      t.field = lcn_str_from_cstring (argv[2], pool);
-
-      pfield = lcn_str_from_cstring (argv[3], pool);
-
-      LCN_ERR (lcn_index_term_docs (&itr, idx, &t, pool));
-
-      subpool = lcn_pool_create (pool);
-
-      LCN_ERR (print_doc_field (idx, lcn_doc_iter_doc (itr), pfield, subpool));
-
-      while ((err = lcn_doc_iter_next (&next, itr)) == LCN_NO_ERROR && next)
-        {
-          apr_pool_clear (subpool);
-
-          LCN_ERR (print_doc_field (idx,
-                                    lcn_doc_iter_doc (itr),
-                                    pfield,
-                                    subpool));
-        }
-
-      LCN_ERR (lcn_doc_iter_close (itr));
-
-      lcn_pool_destroy (subpool);
-
-      return LCN_NO_ERROR;
-    }
-}
-
-lcn_error_t *
 lcn_search_cmd (int argc, char *argv[], apr_pool_t *pool)
 {
   if (argc != 3)
@@ -172,45 +69,40 @@
     }
   else
     {
-      lcn_char_t *pfield = lcn_str_from_cstring (argv[2], pool);
-      apr_pool_t *subpool = lcn_pool_create (pool);
-      lcn_query_parser_t *parser;
-      lcn_scorer_t *scorer;
-      lcn_weight_t *weight;
-      lcn_boolean_t next;
+      apr_array_header_t *results;
+      lcn_searcher_t *searcher;
+      lcn_analyzer_t *analyzer;
+      apr_pool_t *subpool;
       lcn_query_t *query;
-      lcn_index_t *idx;
-      lcn_error_t *err;
-
-      LCN_ERR (lcn_index_open (&idx, argv[0], pool));
-
-      LCN_ERR (lcn_query_parser_create (&parser,
-                                        lcn_str_from_cstring ("contents",
-                                                              pool),
-                                        LCN_SHOULD,
-                                        pool));
+      int idx;
 
-      LCN_ERR (lcn_query_parser_parse (&query,
-                                       parser,
-                                       lcn_str_from_cstring (argv[1], pool),
-                                       pool));
+      LCN_ERR (lcn_analyzer_standard_create (&analyzer, pool));
 
-      LCN_ERR (lcn_query_weight (&weight, query, idx, pool));
+      LCN_ERR (lcn_query_parse (&query,
+                                argv[1],
+                                "contents",
+                                analyzer,
+                                pool));
+
+      LCN_ERR (lcn_index_searcher_open (&searcher, argv[0], pool));
+
+      LCN_ERR (lcn_searcher_search (&results,
+                                    searcher,
+                                    query,
+                                    NULL,
+                                    NULL,
+                                    pool));
 
-      LCN_ERR (lcn_weight_scorer (&scorer, weight, pool));
-
-      LCN_ERR (print_doc_field (idx,
-                                lcn_scorer_doc (scorer),
-                                pfield,
-                                subpool));
+      subpool = lcn_pool_create (pool);
 
-      while ((err = lcn_scorer_next (&next, scorer)) == LCN_NO_ERROR && next)
+      for (idx = 0; idx < results->nelts; ++idx)
         {
           apr_pool_clear (subpool);
 
-          LCN_ERR (print_doc_field (idx,
-                                    lcn_scorer_doc (scorer),
-                                    pfield,
+          LCN_ERR (print_doc_field (APR_ARRAY_IDX (results,
+                                                   idx,
+                                                   lcn_document_t *),
+                                    argv[2],
                                     subpool));
         }
 
@@ -229,6 +121,10 @@
   apr_initialize ();
 
   atexit (apr_terminate);
+
+  lcn_init ();
+
+  lcn_thread_attach ();
 
   pool = lcn_pool_create (NULL);
 

Propchange: incubator/lucene4c/trunk/src/document/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Jun  1 19:08:31 2005
@@ -1,3 +1,4 @@
 .deps
 .dirstamp
 .libs
+*.loT

Propchange: incubator/lucene4c/trunk/src/index/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Jun  1 19:08:31 2005
@@ -1,3 +1,4 @@
 .deps
 .dirstamp
 .libs
+*.loT

Propchange: incubator/lucene4c/trunk/src/org/apache/lucene4c/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jun  1 19:08:31 2005
@@ -0,0 +1,3 @@
+*.class
+.dirstamp
+.deps

Propchange: incubator/lucene4c/trunk/src/query_parser/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Jun  1 19:08:31 2005
@@ -1,3 +1,4 @@
 .dirstamp
 .deps
 .libs
+*.loT

Propchange: incubator/lucene4c/trunk/src/search/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Jun  1 19:08:31 2005
@@ -1,3 +1,4 @@
 .deps
 .dirstamp
 .libs
+*.loT

Propchange: incubator/lucene4c/trunk/src/util/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Jun  1 19:08:31 2005
@@ -1,3 +1,4 @@
 .deps
 .dirstamp
 .libs
+*.loT

Modified: incubator/lucene4c/trunk/src/util/error.c
URL: http://svn.apache.org/viewcvs/incubator/lucene4c/trunk/src/util/error.c?rev=179487&r1=179486&r2=179487&view=diff
==============================================================================
--- incubator/lucene4c/trunk/src/util/error.c (original)
+++ incubator/lucene4c/trunk/src/util/error.c Wed Jun  1 19:08:31 2005
@@ -14,61 +14,22 @@
  * limitations under the License.
  */
 
-#include <stdlib.h>
-
 #include <apr_strings.h>
 
-#include "lcn_types.h"
-
-static lcn_error_t *
-make_error_internal (apr_status_t apr_err, lcn_error_t *child)
-{
-  apr_pool_t *pool;
-  lcn_error_t *new_error;
-
-  if (child)
-    pool = child->pool;
-  else
-    {
-      pool = lcn_pool_create (NULL);
-      if (! pool)
-        abort ();
-    }
-
-  new_error = apr_pcalloc (pool, sizeof (*new_error));
-
-  new_error->apr_err = apr_err;
-  new_error->child = child;
-  new_error->pool = pool;
-
-  return new_error;
-}
-
-lcn_error_t *
-lcn_error_create (apr_status_t apr_err, lcn_error_t *child, const char *msg)
-{
-  lcn_error_t *err = make_error_internal (apr_err, child);
-
-  if (msg)
-    err->message = apr_pstrdup (err->pool, msg);
-
-  return err;
-}
+#include "lcn_pools.h"
+#include "lcn_error.h"
 
 lcn_error_t *
-lcn_error_createf (apr_status_t apr_err,
-                   lcn_error_t *child,
-                   const char *fmt,
-                   ...)
+lcn_error_create (lcn_error_code_t code, const char *reason)
 {
-  lcn_error_t *err = make_error_internal (apr_err, child);
-  va_list ap;
+  apr_pool_t *pool = lcn_pool_create (NULL);
 
-  va_start (ap, fmt);
+  lcn_error_t *err = apr_palloc (pool, sizeof (*err));
 
-  err->message = apr_pvsprintf (err->pool, fmt, ap);
+  err->pool = pool;
+  err->code = code;
 
-  va_end (ap);
+  err->message = apr_pstrdup (pool, reason);
 
   return err;
 }
@@ -77,7 +38,5 @@
 lcn_error_clear (lcn_error_t *err)
 {
   if (err)
-    {
-      lcn_pool_destroy (err->pool);
-    }
+    lcn_pool_destroy (err->pool);
 }

Propchange: incubator/lucene4c/trunk/test/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Jun  1 19:08:31 2005
@@ -1,4 +1,5 @@
 tests
+test
 .deps
 .dirstamp
 .libs



Mime
View raw message