You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Nicky Bulthuis <ni...@valuecare.nl> on 2007/09/18 09:25:59 UTC

Wicket and Searching with Solr

Dear Wicket Users,

I have a slight problem, although problem might not be the correct word. 
I'll explain.

I'm developing an application which allows the searching of metadata 
from scanned documents. For searching i'm using Solr and for the 
frontend i'm using Wicket. Both are new technologies to me and i'm 
having a lot of fun learning both. However, my implementation of the 
search page just doesn't feel exactly right. I was hoping to get some 
advice here about how to proceed.

Solr has the ability to give me facets, which you can use to refine a 
search. That is a feature i want, but it also adds a problem.
You search once, but get two different results. The first is the series 
of documents matching the search criteria, the second a list of facets 
about the documents in the search results. So, how do i only search 
once, and populate two different repeaters. Sofar i've done this in 
three different ways, but i'm not happy with either.

1. I've used a DataView for both the document list and the facet list. 
Both with a DataProvider doing the search and returning a subset. Where 
the facet list always returning the complete list.
Eventhough this is easy to implement, it also makes me search twice for 
the same query, which is something i try to avoid. However my experience 
with solr is still very limited, so i'm not sure if this is that much of 
a problem in the end. But sofar i've been trying to avoid the double 
search.

2. My second try was by doing the search in the onBeforeRender method. 
Creating a new Pageable list for the documents and a normal ListView for 
the facets and then using addOrReplace to get them on the page.
This is working just fine and i'm only doing one search. Except i've got 
this feeling that i'm not supposed to alter the components in the 
'onBeforeRender' method. I could be wrong, but it just doesn't feel right.

3. I create a new page for every request with a different Query Object. 
So the page does the search, fills the list and displays it. Rewrite 
every link to construct a new SearchPage and show that one.
The problem i'm having with this one is the constant contruct of new 
SearchPages. I should be reusing them.

Due to my inexperience with Wicket i'm kind of at a loss on how to 
proceed and hope i can get some advice. So i guess my question comes 
down to, what is the proper way to populate two lists from one source, 
while still being able to modify the search criteria.

I hope someone can give me some advice.

Regards,
Nicky
 

-- 
Nicky Bulthuis
ValueCare BV
Oudlaan 4
3515 GA  Utrecht
Mob: 06-41341545
E-mail: n.bulthuis@valuecare.nl
Web: www.valuecare.nl

Indien dit bericht niet voor u is bedoeld dan verzoeken wij u vriendelijk ons te informeren via een retour bericht en dient u deze mail direct te vernietigen.
ValueCare gebruikt virus scanners maar accepteert geen aansprakelijkheid voor virussen die de email mogelijk bevat.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and Searching with Solr

Posted by Nicky Bulthuis <ni...@valuecare.nl>.
That looks very interesting. I'ĺl look into that and see if i can get it 
to work.

Thanks Igor.

Igor Vaynberg wrote:
> an easy way to do this is to key both repeaters off the same model:
>
> class mypage extends webpage {
>   class resultsmodel extends loadabledetachablemodel {
>      load() { return solr.search(...); }
>    }
>
>     mypage() {
>       setmodel(new resultsmodel());
>        add(new listview("a", getmodel()));
>        add(new listview("b", getmodel()));
>     }
> }
>
>
> that way both repeaters are reusing the same cached result.
>
> -igor
>
>
> On 9/18/07, Nicky Bulthuis <ni...@valuecare.nl> wrote:
>   
>> Dear Wicket Users,
>>
>> I have a slight problem, although problem might not be the correct word.
>> I'll explain.
>>
>> I'm developing an application which allows the searching of metadata
>> from scanned documents. For searching i'm using Solr and for the
>> frontend i'm using Wicket. Both are new technologies to me and i'm
>> having a lot of fun learning both. However, my implementation of the
>> search page just doesn't feel exactly right. I was hoping to get some
>> advice here about how to proceed.
>>
>> Solr has the ability to give me facets, which you can use to refine a
>> search. That is a feature i want, but it also adds a problem.
>> You search once, but get two different results. The first is the series
>> of documents matching the search criteria, the second a list of facets
>> about the documents in the search results. So, how do i only search
>> once, and populate two different repeaters. Sofar i've done this in
>> three different ways, but i'm not happy with either.
>>
>> 1. I've used a DataView for both the document list and the facet list.
>> Both with a DataProvider doing the search and returning a subset. Where
>> the facet list always returning the complete list.
>> Eventhough this is easy to implement, it also makes me search twice for
>> the same query, which is something i try to avoid. However my experience
>> with solr is still very limited, so i'm not sure if this is that much of
>> a problem in the end. But sofar i've been trying to avoid the double
>> search.
>>
>> 2. My second try was by doing the search in the onBeforeRender method.
>> Creating a new Pageable list for the documents and a normal ListView for
>> the facets and then using addOrReplace to get them on the page.
>> This is working just fine and i'm only doing one search. Except i've got
>> this feeling that i'm not supposed to alter the components in the
>> 'onBeforeRender' method. I could be wrong, but it just doesn't feel right.
>>
>> 3. I create a new page for every request with a different Query Object.
>> So the page does the search, fills the list and displays it. Rewrite
>> every link to construct a new SearchPage and show that one.
>> The problem i'm having with this one is the constant contruct of new
>> SearchPages. I should be reusing them.
>>
>> Due to my inexperience with Wicket i'm kind of at a loss on how to
>> proceed and hope i can get some advice. So i guess my question comes
>> down to, what is the proper way to populate two lists from one source,
>> while still being able to modify the search criteria.
>>
>> I hope someone can give me some advice.
>>
>> Regards,
>> Nicky
>>
>>
>> --
>> Nicky Bulthuis
>> ValueCare BV
>> Oudlaan 4
>> 3515 GA  Utrecht
>> Mob: 06-41341545
>> E-mail: n.bulthuis@valuecare.nl
>> Web: www.valuecare.nl
>>
>> Indien dit bericht niet voor u is bedoeld dan verzoeken wij u vriendelijk
>> ons te informeren via een retour bericht en dient u deze mail direct te
>> vernietigen.
>> ValueCare gebruikt virus scanners maar accepteert geen aansprakelijkheid
>> voor virussen die de email mogelijk bevat.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
>   

-- 
Nicky Bulthuis
ValueCare BV
Oudlaan 4
3515 GA  Utrecht
Mob: 06-41341545
E-mail: n.bulthuis@valuecare.nl
Web: www.valuecare.nl

Indien dit bericht niet voor u is bedoeld dan verzoeken wij u vriendelijk ons te informeren via een retour bericht en dient u deze mail direct te vernietigen.
ValueCare gebruikt virus scanners maar accepteert geen aansprakelijkheid voor virussen die de email mogelijk bevat.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and Searching with Solr

Posted by Igor Vaynberg <ig...@gmail.com>.
an easy way to do this is to key both repeaters off the same model:

class mypage extends webpage {
  class resultsmodel extends loadabledetachablemodel {
     load() { return solr.search(...); }
   }

    mypage() {
      setmodel(new resultsmodel());
       add(new listview("a", getmodel()));
       add(new listview("b", getmodel()));
    }
}


that way both repeaters are reusing the same cached result.

-igor


On 9/18/07, Nicky Bulthuis <ni...@valuecare.nl> wrote:
>
> Dear Wicket Users,
>
> I have a slight problem, although problem might not be the correct word.
> I'll explain.
>
> I'm developing an application which allows the searching of metadata
> from scanned documents. For searching i'm using Solr and for the
> frontend i'm using Wicket. Both are new technologies to me and i'm
> having a lot of fun learning both. However, my implementation of the
> search page just doesn't feel exactly right. I was hoping to get some
> advice here about how to proceed.
>
> Solr has the ability to give me facets, which you can use to refine a
> search. That is a feature i want, but it also adds a problem.
> You search once, but get two different results. The first is the series
> of documents matching the search criteria, the second a list of facets
> about the documents in the search results. So, how do i only search
> once, and populate two different repeaters. Sofar i've done this in
> three different ways, but i'm not happy with either.
>
> 1. I've used a DataView for both the document list and the facet list.
> Both with a DataProvider doing the search and returning a subset. Where
> the facet list always returning the complete list.
> Eventhough this is easy to implement, it also makes me search twice for
> the same query, which is something i try to avoid. However my experience
> with solr is still very limited, so i'm not sure if this is that much of
> a problem in the end. But sofar i've been trying to avoid the double
> search.
>
> 2. My second try was by doing the search in the onBeforeRender method.
> Creating a new Pageable list for the documents and a normal ListView for
> the facets and then using addOrReplace to get them on the page.
> This is working just fine and i'm only doing one search. Except i've got
> this feeling that i'm not supposed to alter the components in the
> 'onBeforeRender' method. I could be wrong, but it just doesn't feel right.
>
> 3. I create a new page for every request with a different Query Object.
> So the page does the search, fills the list and displays it. Rewrite
> every link to construct a new SearchPage and show that one.
> The problem i'm having with this one is the constant contruct of new
> SearchPages. I should be reusing them.
>
> Due to my inexperience with Wicket i'm kind of at a loss on how to
> proceed and hope i can get some advice. So i guess my question comes
> down to, what is the proper way to populate two lists from one source,
> while still being able to modify the search criteria.
>
> I hope someone can give me some advice.
>
> Regards,
> Nicky
>
>
> --
> Nicky Bulthuis
> ValueCare BV
> Oudlaan 4
> 3515 GA  Utrecht
> Mob: 06-41341545
> E-mail: n.bulthuis@valuecare.nl
> Web: www.valuecare.nl
>
> Indien dit bericht niet voor u is bedoeld dan verzoeken wij u vriendelijk
> ons te informeren via een retour bericht en dient u deze mail direct te
> vernietigen.
> ValueCare gebruikt virus scanners maar accepteert geen aansprakelijkheid
> voor virussen die de email mogelijk bevat.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>