Return-Path: Delivered-To: apmail-lucene-c-commits-archive@www.apache.org Received: (qmail 73006 invoked from network); 25 May 2005 05:43:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 25 May 2005 05:43:13 -0000 Received: (qmail 45334 invoked by uid 500); 25 May 2005 05:43:13 -0000 Delivered-To: apmail-lucene-c-commits-archive@lucene.apache.org Received: (qmail 45305 invoked by uid 500); 25 May 2005 05:43:13 -0000 Mailing-List: contact c-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: c-dev@lucene.apache.org Delivered-To: mailing list c-commits@lucene.apache.org Received: (qmail 45292 invoked by uid 500); 25 May 2005 05:43:12 -0000 Delivered-To: apmail-incubator-lucene4c-cvs@incubator.apache.org Received: (qmail 45287 invoked by uid 99); 25 May 2005 05:43:12 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 24 May 2005 22:43:12 -0700 Received: (qmail 72985 invoked by uid 65534); 25 May 2005 05:43:11 -0000 Message-ID: <20050525054311.72980.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: svn commit: r178377 - in /incubator/lucene4c/branches/gcj-backend: Makefile include/lcn_index_searcher.h include/lcn_query.h include/lcn_searcher.h src/search/searcher.cxx src/search/searcher.hxx Date: Wed, 25 May 2005 05:43:10 -0000 To: lucene4c-cvs@incubator.apache.org From: rooneg@apache.org X-Mailer: svnmailer-1.0.0-dev X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: rooneg Date: Tue May 24 22:43:09 2005 New Revision: 178377 URL: http://svn.apache.org/viewcvs?rev=3D178377&view=3Drev Log: Implement a first cut at lcn_searcher_search. This is totally untested, since I don't have a way to actually create an lcn_searcher_t yet, but that will come soon enough... * include/lcn_index_searcher.h: renamed to... * include/lcn_searcher.h: this. (lcn_index_searcher_t): rename to... (lcn_searcher_t): this. (lcn_filter_t, lcn_sort_t): new typedefs. (lcn_index_searcher_open, lcn_index_searcher_close): take lcn_searcher_t, not lcn_index_searcher_t. (lcn_index_searcher_search): rename to... (lcn_searcher_search): this. also update arguments. * include/lcn_query.h: include lcn_error.h. * src/search/searcher.hxx: new file. * src/search/searcher.cxx: new file. * Makefile: build src/search/searcher.cxx. Added: incubator/lucene4c/branches/gcj-backend/include/lcn_searcher.h - copied, changed from r178073, incubator/lucene4c/branches/gcj-backe= nd/include/lcn_index_searcher.h incubator/lucene4c/branches/gcj-backend/src/search/searcher.cxx incubator/lucene4c/branches/gcj-backend/src/search/searcher.hxx Removed: incubator/lucene4c/branches/gcj-backend/include/lcn_index_searcher.h Modified: incubator/lucene4c/branches/gcj-backend/Makefile incubator/lucene4c/branches/gcj-backend/include/lcn_query.h Modified: incubator/lucene4c/branches/gcj-backend/Makefile URL: http://svn.apache.org/viewcvs/incubator/lucene4c/branches/gcj-backend/= Makefile?rev=3D178377&r1=3D178376&r2=3D178377&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/lucene4c/branches/gcj-backend/Makefile (original) +++ incubator/lucene4c/branches/gcj-backend/Makefile Tue May 24 22:43:09 20= 05 @@ -20,6 +20,7 @@ src/analysis/standard.o \ src/org/apache/lucene4c/QueryParserHack.o \ src/query_parser/query_parser.o \ + src/search/searcher.o \ src/index/writer.o =20 %.o: %.cxx Modified: incubator/lucene4c/branches/gcj-backend/include/lcn_query.h URL: http://svn.apache.org/viewcvs/incubator/lucene4c/branches/gcj-backend/= include/lcn_query.h?rev=3D178377&r1=3D178376&r2=3D178377&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/lucene4c/branches/gcj-backend/include/lcn_query.h (original) +++ incubator/lucene4c/branches/gcj-backend/include/lcn_query.h Tue May 24 = 22:43:09 2005 @@ -22,6 +22,8 @@ #ifndef _LCN_QUERY_H #define _LCN_QUERY_H =20 +#include "lcn_error.h" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ Copied: incubator/lucene4c/branches/gcj-backend/include/lcn_searcher.h (fro= m r178073, incubator/lucene4c/branches/gcj-backend/include/lcn_index_search= er.h) URL: http://svn.apache.org/viewcvs/incubator/lucene4c/branches/gcj-backend/= include/lcn_searcher.h?p2=3Dincubator/lucene4c/branches/gcj-backend/include= /lcn_searcher.h&p1=3Dincubator/lucene4c/branches/gcj-backend/include/lcn_in= dex_searcher.h&r1=3D178073&r2=3D178377&rev=3D178377&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/lucene4c/branches/gcj-backend/include/lcn_index_searcher.h (o= riginal) +++ incubator/lucene4c/branches/gcj-backend/include/lcn_searcher.h Tue May = 24 22:43:09 2005 @@ -19,31 +19,39 @@ =20 #include =20 -#ifndef _LCN_INDEX_SEARCHER_H -#define _LCN_INDEX_SEARCHER_H +#ifndef _LCN_SEARCHER_H +#define _LCN_SEARCHER_H =20 #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ =20 -typedef struct lcn_index_searcher_t lcn_index_searcher_t; +typedef struct lcn_searcher_t lcn_searcher_t; + +/* XXX temporarily declared here, will move eventually */ +typedef struct lcn_filter_t lcn_filter_t; +typedef struct lcn_sort_t lcn_sort_t; =20 lcn_error_t * -lcn_index_searcher_open (lcn_index_searcher_t **searcher, +lcn_index_searcher_open (lcn_searcher_t **searcher, const char *path, apr_pool_t *pool); =20 lcn_error_t * -lcn_index_searcher_search (apr_array_header_t **hits, - lcn_index_searcher_t *searcher, - lcn_query_t *query, - apr_pool_t *pool); +lcn_index_searcher_close (lcn_searcher_t *searcher); =20 +/* XXX should replace the array with a real hits interface, to avoid pulli= ng + * tons of stuff into ram. */ lcn_error_t * -lcn_index_searcher_close (lcn_index_searcher_t *searcher); +lcn_searcher_search (apr_array_header_t **hits, + lcn_searcher_t *searcher, + lcn_query_t *query, + lcn_filter_t *filter, + lcn_sort_t *sort, + apr_pool_t *pool); =20 #ifdef __cplusplus } #endif /* __cplusplus */ =20 -#endif /* _LCN_INDEX_SEARCHER_H */ +#endif /* _LCN_SEARCHER_H */ Added: incubator/lucene4c/branches/gcj-backend/src/search/searcher.cxx URL: http://svn.apache.org/viewcvs/incubator/lucene4c/branches/gcj-backend/= src/search/searcher.cxx?rev=3D178377&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/lucene4c/branches/gcj-backend/src/search/searcher.cxx (added) +++ incubator/lucene4c/branches/gcj-backend/src/search/searcher.cxx Tue May= 24 22:43:09 2005 @@ -0,0 +1,100 @@ +/* Copyright 2005 The Apache Software Foundation or its licensors, as + * applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include + +#include + +#include "lcn_searcher.h" +#include "lcn_document.h" + +#include "../util/exception.h" + +#include "searcher.hxx" +#include "query.hxx" + +#include "../document/document.hxx" + +using namespace java::lang; + +using namespace org::apache::lucene::search; + +extern "C" { + +struct searcher_search_baton { + apr_array_header_t **hits; + lcn_searcher_t *searcher; + lcn_query_t *query; + lcn_filter_t *filter; + lcn_sort_t *sort; + apr_pool_t *pool; +}; + +void +searcher_search_internal (void *baton) +{ + searcher_search_baton *ssb =3D static_cast(bato= n); + + if (ssb->filter || ssb->sort) + { + throw new IllegalArgumentException ( + JvNewStringUTF ("filter and sort must be NULL got now...") + ); + } + + Hits *h =3D ssb->searcher->impl->search (ssb->query->impl); + + *ssb->hits =3D apr_array_make (ssb->pool, + h->length (), + sizeof (lcn_document_t *)); + + for (int i =3D 0; i < h->length (); ++i) + { + lcn_document_t *d =3D static_cast( + apr_palloc (ssb->pool, sizeof (lcn_document_t)) + ); + + d->impl =3D h->doc (i); + + /* XXX should just find a place to put APR_ARRAY_PUSH... */ +=20 + (*((lcn_document_t **) apr_array_push (*ssb->hits))) =3D d; + } +} + +lcn_error_t * +lcn_searcher_search (apr_array_header_t **hits, + lcn_searcher_t *searcher, + lcn_query_t *query, + lcn_filter_t *filter, + lcn_sort_t *sort, + apr_pool_t *pool) +{ + searcher_search_baton ssb; + + ssb.hits =3D hits; + ssb.searcher =3D searcher; + ssb.query =3D query; + ssb.filter =3D filter; + ssb.sort =3D sort; + ssb.pool =3D pool; + + return lcn__swallow_exception (searcher_search_internal, &ssb); +} + +} // extern "C" Added: incubator/lucene4c/branches/gcj-backend/src/search/searcher.hxx URL: http://svn.apache.org/viewcvs/incubator/lucene4c/branches/gcj-backend/= src/search/searcher.hxx?rev=3D178377&view=3Dauto =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/lucene4c/branches/gcj-backend/src/search/searcher.hxx (added) +++ incubator/lucene4c/branches/gcj-backend/src/search/searcher.hxx Tue May= 24 22:43:09 2005 @@ -0,0 +1,30 @@ +/* Copyright 2005 The Apache Software Foundation or its licensors, as + * applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#ifndef _SEARCHER_HXX +#define _SEARCHER_HXX + +extern "C" { + +struct lcn_searcher_t { + org::apache::lucene::search::Searcher *impl; +}; + +} // extern "C" + +#endif // _SEARCHER_HXX