In fact you are right. It's not working. I need to use the ChainedJahiaSearcher to do that.
Thanks for your help. Nicolas -----Message d'origine----- De : Khue Nguyen [mailto:[EMAIL PROTECTED] Envoyé : mardi 19 juillet 2005 19:09 À : [email protected] Objet : Re: Probleme lucene Hi, >The second possibility is to use directly the lucene syntax >(fieldname:field1 AND value:XXXX) INTERSECT (fieldname:field2 AND >value:YYYYY) >This command seems work good. maybe I miss something but this can not work. Can you point me out where INTERSECT is documented ? For what I have tested, the word INTERSECT is searched as any ordinary free text word. Instead, there is an "AND" operator that is equivalent to an intersection. But you cannot use it because the unit of indexation in Jahia is Field, not Container. Regards, Khue Nguyen ----- Original Message ----- From: "Nicolas Lafaury" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Tuesday, July 19, 2005 12:04 PM Subject: RE : Probleme lucene Hi all Just to finish with lucene For multiple searches in particular field in a containerList you have 2 possibilities. Download the new Java class and replace in the Jahia.jar. ChainedJahiaSearcher.java ContainerFactory.java JahiaSearcher.java Then you just have to do the search ContainerSearcher ContainerSearcher1= new ContainerSearcher(jData.params().getSiteID(), "", query1, jData.params().getEntryLoadRequest()); ContainerSearcher ContainerSearcher2= new ContainerSearcher(jData.params().getSiteID(), "", query2, jData.params().getEntryLoadRequest()); ChainedJahiaSearcher chainedSearcher = new ChainedJahiaSearcher(new JahiaSearcher[]{ContainerSearcher1, ContainerSearcher2},ChainedJahiaSearcher.AND); JahiaSearchResult jSearchResultChained=chainedSearcher.search(chainedSearcher.getQuery(),jParams); The second possibility is to use directly the lucene syntax (fieldname:field1 AND value:XXXX) INTERSECT (fieldname:field2 AND value:YYYYY) This command seems work good. Nicolas -----Message d'origine----- De : Khue Nguyen [mailto:[EMAIL PROTECTED] Envoyé : lundi 18 juillet 2005 16:59 À : [email protected] Objet : Re: Probleme lucene Hi, please, see below the response given to one of our customer about similar issue. Regards, Khue Nguyen >----- Original Message ----- >From: Khue Nguyen >To: [EMAIL PROTECTED] >Sent: Tuesday, July 05, 2005 11:36 AM >Subject: Re: About Lucene query >Hello Alessandro, >unfortunately none of these queries actually work because the unit of >indexation is field, not container nor page. >We may index by container as well in future refactoring of the search >engine. >At least, I just added to the cvs ( last version of jahia 4.0.6 and jahia >4.1), a ChainedJahiaSearcher class that allow you to combine and, or, xor >logics >((a or b) and c) ... between several searchers, so that you can >search on several fields of a same container. What you are trying to do. >Note that there is a org.jahia.data.containers.ContainerChainedFilter that >works in the same way but for Container filters ( only with last version of >Jahia >4.1 ). >Below is an example of search performed on the firstname field and lastname >field of the people container. > // first name searcher > String firstNameQuery = "toto AND fieldname:firsname"; > ContainerSearcher firstNameSearcher = > new ContainerSearcher("directoryPeopleContainer",jParams,firstNameQuery > ,jParams.getEntryLoadRequest()); > // last name searcher > String lastNameQuery = "mc* AND fieldname:lastname"; > ContainerSearcher lastNameSearcher = > new ContainerSearcher("directoryPeopleContainer",jParams,lastNameQuery > ,jParams.getEntryLoadRequest()); > // chaining searcher > ChainedJahiaSearcher chainedSearcher = new ChainedJahiaSearcher( > new > JahiaSearcher[]{firstNameSearcher,lastNameSearcher},ChainedJahiaSearcher.AND); > // may be OR, ANDNOT, XOR, ... > request.setAttribute("directoryPeopleContainer_search_handler",chainedSearcher); ----- Original Message ----- From: "Nicolas Lafaury" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Monday, July 18, 2005 3:40 PM Subject: Probleme lucene Hi all I want search a name in a particular field. This is my containerList definition. <content:declareContainerList name='myLuceneContainerList' title="myContainerList" > <content:declareContainer> <content:declareField name='number' title="number" type="SmallText" /> <content:declareField name='title' title="title" type="SmallText" /> </content:declareContainer> </content:declareContainerList> I want retrieve all containers where the field "title" is equal to "Hello". The syntax to search is : Hello AND fieldname: title. But my problem is how I can find all containers where the field "number" is equals to "2" and the field "title" is equal to "hello". Is anyone has a idea? Thanks. Nicolas
