You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Andreas Hartmann <an...@apache.org> on 2008/04/02 11:06:00 UTC

API for document search

Hi Lenya users,

I'd like to hear about your opinions regarding the search capabilities 
Lenya should provide.

I have the requirement that it should be possible to issue a search for 
documents from every Java service. For this purpose, I'd like to 
introduce a service interface, e.g. DocumentSearcher, with a method that 
returns a list of hits. But I'm not sure about the method signature yet. 
IMO it has to be something like

   Hits find(Index index, Query query)

Should we abstract away Lucene, or should we just use the Lucene classes 
Hits and Query? If we introduce our own hits interface, e.g. 
DocumentHits, it would be easier to obtain the document from a hit:

   o.a.l.cms.publication.Document doc = hit.getDocument();

Otherwise, a helper would be needed:

   o.a.l.cms.publication.Document doc = searcher.getDocument(hit);

IMO the first version is preferrable.

The same question applies to the Query. That mainly depends on how we 
want to build queries. If we use the Lucene Query interface, we could

a) use subclasses, e.g. MetaDataQuery (IMO preferrable)
b) use helpers, e.g. SearchUtil.buildMetaDataQuery(…)

If we introduce our own Query syntax, things might become more 
complicated. Another option would be to use just query strings, but this 
requires us to define a syntax. Or we could just use the Lucene query 
parser syntax. The signature would then be

   Hits find(Index index, String queryString)


BTW, JCR uses the following API:

   QueryManager queryManager = workspace.getQueryManager();

   Query xPathQuery = queryManager.createQuery("//*", Query.XPATH);
   Query sqlQuery = queryManager.createQuery("select * …", Query.SQL);

   QueryResult result = xPathQuery.execute();


WDYT?

-- Andreas

-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: API for document search

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Thu, 2009-07-16 at 12:19 +0200, Andreas Hartmann wrote:
> Thorsten Scherler schrieb:
> > On Tue, 2008-05-13 at 17:28 +0200, Andreas Hartmann wrote:
> >> Andreas Hartmann schrieb:
> >>> Andreas Hartmann schrieb:
> >>>> Hi Lenya users,
> >>>>
> >>>> I'd like to hear about your opinions regarding the search capabilities 
> >>>> Lenya should provide.
> >>> I have prepared a first draft for the search API:
> >>>
> >>> http://lenya.zones.apache.org/drafts/searchapi/
> >>>
> >>> Any questions and comments are very welcome. In my sandbox I also have a 
> >>> Lucene-based implementation which I'm testing at the moment.
> >> I opened a bug and attached a patch:
> >>
> >> https://issues.apache.org/bugzilla/show_bug.cgi?id=44990
> > 
> > I had a quick look at the patch. The only question is why you removed
> > the ESCAPED_CHARACTERS part? Is it to force this control to the client? 
> 
> The Lucene QueryParser already provides a method for this purpose, so we 
> can delegate it:
> 
> -        return new Term(escape(field), value);
> +        return new Term(QueryParser.escape(field), value);

Right I forgot about that. 

> 
> 
> > IMO this functionality is a BIG improvement to lenya and should go into
> > our dist.
> 
> Yes, I think so too. I could commit it to the 2.1 branch as soon as it 
> is created.

+1 

TIA

salu2
-- 
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>

Sociedad Andaluza para el Desarrollo de la Sociedad 
de la Información, S.A.U. (SADESI)





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: API for document search

Posted by Andreas Hartmann <an...@apache.org>.
Thorsten Scherler schrieb:
> On Tue, 2008-05-13 at 17:28 +0200, Andreas Hartmann wrote:
>> Andreas Hartmann schrieb:
>>> Andreas Hartmann schrieb:
>>>> Hi Lenya users,
>>>>
>>>> I'd like to hear about your opinions regarding the search capabilities 
>>>> Lenya should provide.
>>> I have prepared a first draft for the search API:
>>>
>>> http://lenya.zones.apache.org/drafts/searchapi/
>>>
>>> Any questions and comments are very welcome. In my sandbox I also have a 
>>> Lucene-based implementation which I'm testing at the moment.
>> I opened a bug and attached a patch:
>>
>> https://issues.apache.org/bugzilla/show_bug.cgi?id=44990
> 
> I had a quick look at the patch. The only question is why you removed
> the ESCAPED_CHARACTERS part? Is it to force this control to the client? 

The Lucene QueryParser already provides a method for this purpose, so we 
can delegate it:

-        return new Term(escape(field), value);
+        return new Term(QueryParser.escape(field), value);


> IMO this functionality is a BIG improvement to lenya and should go into
> our dist.

Yes, I think so too. I could commit it to the 2.1 branch as soon as it 
is created.

-- Andreas



-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: API for document search

Posted by Thorsten Scherler <th...@juntadeandalucia.es>.
On Tue, 2008-05-13 at 17:28 +0200, Andreas Hartmann wrote:
> Andreas Hartmann schrieb:
> > Andreas Hartmann schrieb:
> >> Hi Lenya users,
> >>
> >> I'd like to hear about your opinions regarding the search capabilities 
> >> Lenya should provide.
> > 
> > I have prepared a first draft for the search API:
> > 
> > http://lenya.zones.apache.org/drafts/searchapi/
> > 
> > Any questions and comments are very welcome. In my sandbox I also have a 
> > Lucene-based implementation which I'm testing at the moment.
> 
> I opened a bug and attached a patch:
> 
> https://issues.apache.org/bugzilla/show_bug.cgi?id=44990

I had a quick look at the patch. The only question is why you removed
the ESCAPED_CHARACTERS part? Is it to force this control to the client? 

IMO this functionality is a BIG improvement to lenya and should go into
our dist.

salu2
-- 
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>

Sociedad Andaluza para el Desarrollo de la Sociedad 
de la Información, S.A.U. (SADESI)





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: API for document search

Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann schrieb:
> Andreas Hartmann schrieb:
>> Hi Lenya users,
>>
>> I'd like to hear about your opinions regarding the search capabilities 
>> Lenya should provide.
> 
> I have prepared a first draft for the search API:
> 
> http://lenya.zones.apache.org/drafts/searchapi/
> 
> Any questions and comments are very welcome. In my sandbox I also have a 
> Lucene-based implementation which I'm testing at the moment.

I opened a bug and attached a patch:

https://issues.apache.org/bugzilla/show_bug.cgi?id=44990

-- Andreas


> 
> -- Andreas
> 
> 
>>
>> I have the requirement that it should be possible to issue a search 
>> for documents from every Java service. For this purpose, I'd like to 
>> introduce a service interface, e.g. DocumentSearcher, with a method 
>> that returns a list of hits. But I'm not sure about the method 
>> signature yet. IMO it has to be something like
>>
>>   Hits find(Index index, Query query)
>>
>> Should we abstract away Lucene, or should we just use the Lucene 
>> classes Hits and Query? If we introduce our own hits interface, e.g. 
>> DocumentHits, it would be easier to obtain the document from a hit:
>>
>>   o.a.l.cms.publication.Document doc = hit.getDocument();
>>
>> Otherwise, a helper would be needed:
>>
>>   o.a.l.cms.publication.Document doc = searcher.getDocument(hit);
>>
>> IMO the first version is preferrable.
>>
>> The same question applies to the Query. That mainly depends on how we 
>> want to build queries. If we use the Lucene Query interface, we could
>>
>> a) use subclasses, e.g. MetaDataQuery (IMO preferrable)
>> b) use helpers, e.g. SearchUtil.buildMetaDataQuery(…)
>>
>> If we introduce our own Query syntax, things might become more 
>> complicated. Another option would be to use just query strings, but 
>> this requires us to define a syntax. Or we could just use the Lucene 
>> query parser syntax. The signature would then be
>>
>>   Hits find(Index index, String queryString)
>>
>>
>> BTW, JCR uses the following API:
>>
>>   QueryManager queryManager = workspace.getQueryManager();
>>
>>   Query xPathQuery = queryManager.createQuery("//*", Query.XPATH);
>>   Query sqlQuery = queryManager.createQuery("select * …", Query.SQL);
>>
>>   QueryResult result = xPathQuery.execute();
>>
>>
>> WDYT?
>>
>> -- Andreas
>>
> 
> 


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: API for document search

Posted by Andreas Hartmann <an...@apache.org>.
Hi Kanth,

kanth nalluri schrieb:
> its better to  put all search  results in a way that allow to perform 
> bulk actions  like (delete ....etc)

do you have something particular in mind? Would you mind giving a code 
example?

BTW, a direct translation from search results to a document collection 
is a bit complicated, because there might be index entries for which the 
current session doesn't contain a document.

-- Andreas


> 
> On 4/4/08, *Andreas Hartmann* <andreas@apache.org 
> <ma...@apache.org>> wrote:
> 
>     Andreas Hartmann schrieb:
> 
>         Hi Lenya users,
> 
>         I'd like to hear about your opinions regarding the search
>         capabilities Lenya should provide.
> 
> 
>     I have prepared a first draft for the search API:
> 
>     http://lenya.zones.apache.org/drafts/searchapi/
> 
>     Any questions and comments are very welcome. In my sandbox I also
>     have a Lucene-based implementation which I'm testing at the moment.
> 
>     -- Andreas
> 
> 
> 
> 
>         I have the requirement that it should be possible to issue a
>         search for documents from every Java service. For this purpose,
>         I'd like to introduce a service interface, e.g.
>         DocumentSearcher, with a method that returns a list of hits. But
>         I'm not sure about the method signature yet. IMO it has to be
>         something like
> 
>          Hits find(Index index, Query query)
> 
>         Should we abstract away Lucene, or should we just use the Lucene
>         classes Hits and Query? If we introduce our own hits interface,
>         e.g. DocumentHits, it would be easier to obtain the document
>         from a hit:
> 
>          o.a.l.cms.publication.Document doc = hit.getDocument();
> 
>         Otherwise, a helper would be needed:
> 
>          o.a.l.cms.publication.Document doc = searcher.getDocument(hit);
> 
>         IMO the first version is preferrable.
> 
>         The same question applies to the Query. That mainly depends on
>         how we want to build queries. If we use the Lucene Query
>         interface, we could
> 
>         a) use subclasses, e.g. MetaDataQuery (IMO preferrable)
>         b) use helpers, e.g. SearchUtil.buildMetaDataQuery(…)
> 
>         If we introduce our own Query syntax, things might become more
>         complicated. Another option would be to use just query strings,
>         but this requires us to define a syntax. Or we could just use
>         the Lucene query parser syntax. The signature would then be
> 
>          Hits find(Index index, String queryString)
> 
> 
>         BTW, JCR uses the following API:
> 
>          QueryManager queryManager = workspace.getQueryManager();
> 
>          Query xPathQuery = queryManager.createQuery("//*", Query.XPATH);
>          Query sqlQuery = queryManager.createQuery("select * …", Query.SQL);
> 
>          QueryResult result = xPathQuery.execute();
> 
> 
>         WDYT?
> 
>         -- Andreas
> 
> 
> 
>     -- 
>     Andreas Hartmann, CTO
>     BeCompany GmbH
>     http://www.becompany.ch <http://www.becompany.ch/>
>     Tel.: +41 (0) 43 818 57 01
> 
> 
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
>     <ma...@lenya.apache.org>
>     For additional commands, e-mail: user-help@lenya.apache.org
>     <ma...@lenya.apache.org>
> 
> 


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: API for document search

Posted by kanth nalluri <ka...@gmail.com>.
its better to  put all search  results in a way that allow to perform bulk
actions  like (delete ....etc)

On 4/4/08, Andreas Hartmann <an...@apache.org> wrote:
>
> Andreas Hartmann schrieb:
>
> > Hi Lenya users,
> >
> > I'd like to hear about your opinions regarding the search capabilities
> > Lenya should provide.
> >
>
> I have prepared a first draft for the search API:
>
> http://lenya.zones.apache.org/drafts/searchapi/
>
> Any questions and comments are very welcome. In my sandbox I also have a
> Lucene-based implementation which I'm testing at the moment.
>
> -- Andreas
>
>
>
> > I have the requirement that it should be possible to issue a search for
> > documents from every Java service. For this purpose, I'd like to introduce a
> > service interface, e.g. DocumentSearcher, with a method that returns a list
> > of hits. But I'm not sure about the method signature yet. IMO it has to be
> > something like
> >
> >  Hits find(Index index, Query query)
> >
> > Should we abstract away Lucene, or should we just use the Lucene classes
> > Hits and Query? If we introduce our own hits interface, e.g. DocumentHits,
> > it would be easier to obtain the document from a hit:
> >
> >  o.a.l.cms.publication.Document doc = hit.getDocument();
> >
> > Otherwise, a helper would be needed:
> >
> >  o.a.l.cms.publication.Document doc = searcher.getDocument(hit);
> >
> > IMO the first version is preferrable.
> >
> > The same question applies to the Query. That mainly depends on how we
> > want to build queries. If we use the Lucene Query interface, we could
> >
> > a) use subclasses, e.g. MetaDataQuery (IMO preferrable)
> > b) use helpers, e.g. SearchUtil.buildMetaDataQuery(…)
> >
> > If we introduce our own Query syntax, things might become more
> > complicated. Another option would be to use just query strings, but this
> > requires us to define a syntax. Or we could just use the Lucene query parser
> > syntax. The signature would then be
> >
> >  Hits find(Index index, String queryString)
> >
> >
> > BTW, JCR uses the following API:
> >
> >  QueryManager queryManager = workspace.getQueryManager();
> >
> >  Query xPathQuery = queryManager.createQuery("//*", Query.XPATH);
> >  Query sqlQuery = queryManager.createQuery("select * …", Query.SQL);
> >
> >  QueryResult result = xPathQuery.execute();
> >
> >
> > WDYT?
> >
> > -- Andreas
> >
> >
>
> --
> Andreas Hartmann, CTO
> BeCompany GmbH
> http://www.becompany.ch
> Tel.: +41 (0) 43 818 57 01
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
> For additional commands, e-mail: user-help@lenya.apache.org
>
>

Re: API for document search

Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann schrieb:
> Hi Lenya users,
> 
> I'd like to hear about your opinions regarding the search capabilities 
> Lenya should provide.

I have prepared a first draft for the search API:

http://lenya.zones.apache.org/drafts/searchapi/

Any questions and comments are very welcome. In my sandbox I also have a 
Lucene-based implementation which I'm testing at the moment.

-- Andreas


> 
> I have the requirement that it should be possible to issue a search for 
> documents from every Java service. For this purpose, I'd like to 
> introduce a service interface, e.g. DocumentSearcher, with a method that 
> returns a list of hits. But I'm not sure about the method signature yet. 
> IMO it has to be something like
> 
>   Hits find(Index index, Query query)
> 
> Should we abstract away Lucene, or should we just use the Lucene classes 
> Hits and Query? If we introduce our own hits interface, e.g. 
> DocumentHits, it would be easier to obtain the document from a hit:
> 
>   o.a.l.cms.publication.Document doc = hit.getDocument();
> 
> Otherwise, a helper would be needed:
> 
>   o.a.l.cms.publication.Document doc = searcher.getDocument(hit);
> 
> IMO the first version is preferrable.
> 
> The same question applies to the Query. That mainly depends on how we 
> want to build queries. If we use the Lucene Query interface, we could
> 
> a) use subclasses, e.g. MetaDataQuery (IMO preferrable)
> b) use helpers, e.g. SearchUtil.buildMetaDataQuery(…)
> 
> If we introduce our own Query syntax, things might become more 
> complicated. Another option would be to use just query strings, but this 
> requires us to define a syntax. Or we could just use the Lucene query 
> parser syntax. The signature would then be
> 
>   Hits find(Index index, String queryString)
> 
> 
> BTW, JCR uses the following API:
> 
>   QueryManager queryManager = workspace.getQueryManager();
> 
>   Query xPathQuery = queryManager.createQuery("//*", Query.XPATH);
>   Query sqlQuery = queryManager.createQuery("select * …", Query.SQL);
> 
>   QueryResult result = xPathQuery.execute();
> 
> 
> WDYT?
> 
> -- Andreas
> 


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org